ππΌββοΈ The blackboard for coding agents - agentic development environment for claude code, codex, cursor, opencode, grok and more.
Rust adeai-agentsclaudeclaude-codecodexcursorgeminigrokopencodespec-driven-developmentvibe-codingvim
feat: add cursor cli (#41)
Fynn FlΓΌgged6181d9466e7
diff --git a/CLAUDE.md b/CLAUDE.mdindex 8b00a05..d9bcee8 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -123,6 +123,7 @@ Skills are markdown files with YAML frontmatter deployed to agent-native discove- Claude: `.claude/commands/agtx/plan.md`- Gemini: `.gemini/commands/agtx/plan.toml` (converted to TOML format)- Codex: `.codex/skills/agtx-plan/SKILL.md`+- Cursor: `.cursor/skills/agtx-plan/SKILL.md`- OpenCode: `.config/opencode/command/agtx-plan.md` (frontmatter stripped)- Copilot: `.github/agents/agtx/plan.md`@@ -130,7 +131,7 @@ Canonical copy always at `.agtx/skills/agtx-plan/SKILL.md`.Commands are written once in canonical format (`/ns:command`) and auto-translated:- Claude/Gemini: `/ns:command` (unchanged)-- OpenCode: `/ns-command` (colon β hyphen)+- OpenCode/Cursor: `/ns-command` (colon β hyphen)- Codex: `$ns-command` (slash β dollar, colon β hyphen)- Copilot: no interactive skill invocation (prompt only, no commands sent)diff --git a/README.md b/README.mdindex be2f9cc..98f0504 100644--- a/README.md+++ b/README.md@@ -18,7 +18,7 @@[](CONTRIBUTING.md)[](https://opensource.org/licenses/Apache-2.0)-<br/>+---<img width="840" src="https://github.com/user-attachments/assets/45858e09-ab61-422b-b708-db060c73a900" />@@ -48,7 +48,7 @@ With the orchestrator, you don't even manage the board yourself. **An AI agent p- **Parallel execution**: Every task gets its own git worktree and tmux window β run as many agents as you want, simultaneously- **Spec-driven plugins**: Plug in [GSD](https://github.com/fynnfluegge/get-shit-done-cc), [Spec-kit](https://github.com/github/spec-kit), [OpenSpec](https://github.com/Fission-AI/OpenSpec), [BMAD](https://github.com/bmad-code-org/BMAD-METHOD), [Superpowers](https://github.com/obra/superpowers) β or define your own with a single TOML file- **Multi-project dashboard**: Manage agent sessions across all your projects from one place-- **Works with**: [Claude Code](https://github.com/anthropics/claude-code) | [Codex](https://github.com/openai/codex) | [Gemini CLI](https://github.com/google-gemini/gemini-cli) | [OpenCode](https://github.com/sst/opencode) | [Copilot](https://github.com/github/copilot-cli)+- **Works with**: [Claude Code](https://github.com/anthropics/claude-code) | [Codex](https://github.com/openai/codex) | [Gemini CLI](https://github.com/google-gemini/gemini-cli) | [OpenCode](https://github.com/sst/opencode) | [Cursor Agent](https://cursor.com/docs/cli/overview) | [Copilot](https://github.com/github/copilot-cli)## Quick Start@@ -197,19 +197,19 @@ Press `P` to switch plugins. Ships with 7 built-in:Commands are written once in canonical format and automatically translated per agent:-| Canonical (plugin.toml) | Claude / Gemini | Codex | OpenCode |-|--------------------------|-----------------|-------|----------|-| `/agtx:plan` | `/agtx:plan` | `$agtx-plan` | `/agtx-plan` |--| | Claude | Codex | Gemini | Copilot | OpenCode |-|--|:------:|:-----:|:------:|:-------:|:--------:|-| **agtx** | β | β | β | π‘ | β |-| **gsd** | β | β | β | β | β |-| **spec-kit** | β | β | β | π‘ | β |-| **openspec** | β | β | β | π‘ | β |-| **bmad** | β | β | β | π‘ | β |-| **superpowers** | β | β | β | β | β |-| **void** | β | β | β | β | β |+| Canonical (plugin.toml) | Claude / Gemini | Codex | OpenCode | Cursor |+|--------------------------|-----------------|-------|----------|--------|+| `/agtx:plan` | `/agtx:plan` | `$agtx-plan` | `/agtx-plan` | `/agtx-plan` |++| | Claude | Codex | Gemini | OpenCode | Cursor | Copilot |+|--|:------:|:-----:|:------:|:--------:|:------:|:-------:|+| **agtx** | β | β | β | β | β | π‘ |+| **gsd** | β | β | β | β | β | β |+| **spec-kit** | β | β | β | β | β | π‘ |+| **openspec** | β | β | β | β | β | π‘ |+| **bmad** | β | β | β | β | β | π‘ |+| **superpowers** | β | β | β | β | β | β |+| **void** | β | β | β | β | β | β |β Skills, commands, and prompts fully supported Β· π‘ Prompt only, no interactive skill support Β· β Not supporteddiff --git a/src/agent/mod.rs b/src/agent/mod.rsindex bfb9207..b92d534 100644--- a/src/agent/mod.rs+++ b/src/agent/mod.rs@@ -44,6 +44,7 @@ impl Agent {"copilot" => "copilot --allow-all-tools".to_string(),"gemini" => "gemini --approval-mode yolo".to_string(),"opencode" => "opencode".to_string(),+ "cursor" => "agent --yolo".to_string(),_ => self.command.clone(),};}@@ -55,6 +56,7 @@ impl Agent {"copilot" => format!("copilot --allow-all-tools -p '{}'", escaped_prompt),"gemini" => format!("gemini --approval-mode yolo -i '{}'", escaped_prompt),"opencode" => format!("opencode -p '{}'", escaped_prompt),+ "cursor" => format!("agent --yolo '{}'", escaped_prompt),_ => format!("{} '{}'", self.command, escaped_prompt),}}@@ -68,6 +70,7 @@ pub fn known_agents() -> Vec<Agent> {Agent::new("copilot", "copilot", "GitHub Copilot CLI", "GitHub Copilot <[email protected]>"),Agent::new("gemini", "gemini", "Google Gemini CLI", "Gemini <[email protected]>"),Agent::new("opencode", "opencode", "AI-powered coding assistant", "OpenCode <[email protected]>"),+ Agent::new("cursor", "agent", "Cursor Agent CLI", "Cursor Agent <[email protected]>"),// TODO: investigate CLI usage before enabling// Agent::new("aider", "aider", "AI pair programming in your terminal", "Aider <[email protected]>"),// Agent::new("cline", "cline", "AI coding assistant for VS Code", "Cline <[email protected]>"),diff --git a/src/agent/operations.rs b/src/agent/operations.rsindex 57b150e..6b8d399 100644--- a/src/agent/operations.rs+++ b/src/agent/operations.rs@@ -48,6 +48,7 @@ impl AgentOperations for CodingAgent {"codex" => ("codex", vec!["exec", "--full-auto", prompt]),"copilot" => ("copilot", vec!["-p", prompt]),"gemini" => ("gemini", vec!["-p", prompt]),+ "cursor" => ("agent", vec!["--print", "--yolo", prompt]),_ => (self.agent.command.as_str(), vec![prompt]),};diff --git a/src/skills.rs b/src/skills.rsindex 31d4447..82e7704 100644--- a/src/skills.rs+++ b/src/skills.rs@@ -38,6 +38,7 @@ pub fn agent_native_skill_dir(agent_name: &str) -> Option<(&'static str, &'stati"gemini" => Some((".gemini/commands", "agtx")),"opencode" => Some((".opencode/commands", "")),"codex" => Some((".codex/skills", "")),+ "cursor" => Some((".cursor/skills", "")),"copilot" => Some((".github/agents", "agtx")),_ => None,}@@ -101,6 +102,10 @@ pub fn transform_plugin_command(canonical_cmd: &str, agent_name: &str) -> OptionSome(transformed)}}+ "cursor" => {+ // /agtx:plan β /agtx-plan (slash kept, colon β hyphen)+ Some(canonical_cmd.replacen(':', "-", 1))+ }_ => None,}}@@ -331,6 +336,27 @@ pub fn scan_agent_skills(agent_name: &str, project_path: &std::path::Path) -> Ve}}}+ "cursor" => {+ // Skill subdirectories with SKILL.md, invoked as /skill-name+ let base = project_path.join(".cursor/skills");+ let entries = match std::fs::read_dir(&base) {+ Ok(e) => e,+ Err(_) => return results,+ };+ for dir_entry in entries.flatten() {+ if !dir_entry.path().is_dir() {+ continue;+ }+ let dirname = dir_entry.file_name().to_string_lossy().to_string();+ let skill_file = dir_entry.path().join("SKILL.md");+ if skill_file.exists() {+ let command = format!("/{}", dirname);+ let description = extract_description_from_file(&skill_file)+ .unwrap_or_else(|| dirname.replace('-', " "));+ results.push((command, description));+ }+ }+ }"opencode" => {// Flat directory with .md fileslet base = project_path.join(".config/opencode/command");diff --git a/src/tui/app.rs b/src/tui/app.rsindex 2e63a2f..8dc60bb 100644--- a/src/tui/app.rs+++ b/src/tui/app.rs@@ -3873,8 +3873,10 @@ impl App {};let Some(project_path) = self.state.project_path.clone() else { return Ok(()) };- // Stamp plugin on task for research- task.plugin = self.state.config.workflow_plugin.clone();+ // Stamp plugin on task for research (only if not already set at task creation)+ if task.plugin.is_none() {+ task.plugin = self.state.config.workflow_plugin.clone();+ }let plugin_name = task.plugin.clone();let plugin = self.load_task_plugin(&task);@@ -4735,7 +4737,9 @@ impl App {for (task_id, status, worktree_path, task_plugin, session_name, cycle, was_ready, agent) in tasks_to_check {let plugin = plugin_cache.entry(task_plugin.clone()).or_insert_with(|| {match &task_plugin {- Some(name) => WorkflowPlugin::load(name, project_path.as_deref()).ok(),+ Some(name) => WorkflowPlugin::load(name, project_path.as_deref())+ .ok()+ .or_else(|| skills::load_bundled_plugin(name)),None => skills::load_bundled_plugin("agtx"),}});@@ -5992,7 +5996,7 @@ fn send_skill_and_prompt(// prompt, which gets lost or arrives too late.// Codex: skill mentions ($skill-name) are inline references that must be// part of a message β sending just "$skill" standalone does nothing.- if matches!(agent_name, "gemini" | "codex") {+ if matches!(agent_name, "gemini" | "codex" | "cursor") {let text_to_send = if let Some(cmd) = skill_cmd {if !prompt.is_empty() {Some(format!("{}\n\n{}", cmd, prompt))@@ -6281,13 +6285,24 @@ fn collect_phase_agents(config: &MergedConfig) -> Vec<String> {}/// Known agent binary names as they appear in `pane_current_command`.-const AGENT_COMMANDS: &[&str] = &["claude", "codex", "gemini", "copilot", "opencode", "node", "python3", "python"];--/// Strings in pane content that indicate an agent TUI is active.-/// Used by `is_agent_active` to detect agents like Gemini that run inside-/// bash and don't change `pane_current_command`.+/// Used by `is_pane_at_shell` to detect when an agent process is running.+/// Does NOT include `node` β Node/Ink agents (Gemini, Cursor, OpenCode, Codex) are+/// detected via `AGENT_ACTIVE_INDICATORS` instead, so Check 2 in `wait_for_agent_ready`+/// can fire for them rather than Check 1 firing too early.+/// Note: on systems where agents are installed via asdf/nvm, all agents run as `node`+/// and Check 1 never fires β AGENT_ACTIVE_INDICATORS is the only reliable signal there.+const AGENT_COMMANDS: &[&str] = &["claude", "codex", "gemini", "copilot", "opencode", "agent", "python3", "python"];++/// Strings in pane content that indicate a Node/Ink agent TUI is active and ready.+/// Used by `is_agent_active` to detect agents like Gemini and Cursor that run+/// inside bash/node and don't change `pane_current_command` to their own name.+/// Also used by `wait_for_agent_ready` (Check 2) to detect readiness for these agents.const AGENT_ACTIVE_INDICATORS: &[&str] = &[+ "Claude Code", // Claude"Type your message", // Gemini+ "Ask anything", // OpenCode+ "Cursor Agent", // Cursor+ "OpenAI Codex", // Codex];/// Check if the pane is running a shell (i.e. the agent has exited).@@ -6346,6 +6361,7 @@ fn switch_agent_in_tmux(let exit_cmd = match current_agent {"codex" => None, // Codex has no exit command β Ctrl+C is the only way"gemini" => Some("/quit"),+ "cursor" => None, // Ink/Node TUI β Ctrl+C is the only reliable exit_ => Some("/exit"), // claude, opencode, and others};@@ -6405,42 +6421,37 @@ fn switch_agent_in_tmux(// 6. Wait for the new agent process to actually start (pane_current_command != shell).// Without this, wait_for_agent_ready may see stale ">" from old pane content// and return before the new agent has even launched.- for _ in 0..100 { // 10s max- std::thread::sleep(std::time::Duration::from_millis(100));- if !is_pane_at_shell(tmux_ops, target) {- break;+ // Includes `node` here so Gemini/Cursor (Node/Ink TUIs) are detected immediately.+ for _ in 0..10 { // 10s max+ std::thread::sleep(std::time::Duration::from_secs(1));+ if let Some(cmd) = tmux_ops.pane_current_command(target) {+ let process_started = AGENT_COMMANDS.iter().any(|a| cmd.contains(a)) || cmd.contains("node");+ if process_started {+ break;+ }}}}/// Wait for an agent in a tmux pane to be ready for input.-/// First waits for the agent process to start (pane_current_command != shell),-/// then waits a fixed delay for the agent to fully initialize./// Handles the bypass warning prompt (sends acceptance) during the wait./// Always returns Some β the prompt is always sent (better late than never).-/// Strings that indicate an agent's TUI is ready for input.-const AGENT_READY_INDICATORS: &[&str] = &[- "Type your message", // Gemini- "Yes, I accept", // Claude bypass prompt- "I accept the risk", // Claude bypass prompt (alt)-];--/// Number of consecutive stable polls (200ms each) before considering the agent ready.+/// Number of consecutive stable polls (1s each) before considering the agent ready./// 3s of no pane content changes = agent has finished loading its TUI.-const CONTENT_STABLE_THRESHOLD: u32 = 15;+const CONTENT_STABLE_THRESHOLD: u32 = 3;fn wait_for_agent_ready(tmux_ops: &Arc<dyn TmuxOperations>, target: &str) -> Option<String> {- // Poll until the agent is ready (up to 30s).+ // Step 1: detect the ready signal (up to 30s).// Three detection methods, whichever fires first:// 1. Agent process detected via pane_current_command (Claude, Codex, Copilot)// 2. Known ready indicator in pane content (Gemini's "Type your message")- // 3. Content stabilization: pane unchanged for 3s (universal fallback)+ // 3. Content stabilization: pane unchanged for 3s after >=3 changes (universal fallback)let mut last_content = String::new();let mut stable_ticks: u32 = 0;let mut change_count: u32 = 0;- for _ in 0..150 { // 30s (150 * 200ms)- std::thread::sleep(std::time::Duration::from_millis(200));+ for _ in 0..30 { // 30s (30 * 1s)+ std::thread::sleep(std::time::Duration::from_secs(1));// Check 1: agent process detected via pane_current_commandif !is_pane_at_shell(tmux_ops.as_ref(), target) {@@ -6454,12 +6465,12 @@ fn wait_for_agent_ready(tmux_ops: &Arc<dyn TmuxOperations>, target: &str) -> Optlet _ = tmux_ops.send_keys_literal(target, "2");std::thread::sleep(std::time::Duration::from_millis(50));let _ = tmux_ops.send_keys_literal(target, "Enter");- std::thread::sleep(std::time::Duration::from_millis(1000));- return Some(target.to_string());+ // Fall through to settle wait below+ break;}- // Check 2: known ready indicator- if AGENT_READY_INDICATORS.iter().any(|s| content.contains(s)) {+ // Check 2: known ready indicator in pane content+ if AGENT_ACTIVE_INDICATORS.iter().any(|s| content.contains(s)) {break;}@@ -6474,14 +6485,31 @@ fn wait_for_agent_ready(tmux_ops: &Arc<dyn TmuxOperations>, target: &str) -> Opt} else if change_count >= 3 {stable_ticks += 1;if stable_ticks >= CONTENT_STABLE_THRESHOLD {- break;+ return Some(target.to_string());}}}}- // Short settle delay for the TUI to be fully interactive- std::thread::sleep(std::time::Duration::from_millis(1000));+ // Step 2: ready signal detected β wait for pane content to stop changing (up to 30s).+ // Needed for Node/Ink agents (Gemini, Cursor) where the process starts before the+ // TUI has finished rendering. Avoids sending the prompt into a half-drawn screen.+ let mut last_content = String::new();+ let mut stable_ticks: u32 = 0;+ for _ in 0..30 { // 30s hard timeout+ std::thread::sleep(std::time::Duration::from_secs(1));+ if let Ok(content) = tmux_ops.capture_pane(target) {+ if content != last_content {+ stable_ticks = 0;+ last_content = content;+ } else {+ stable_ticks += 1;+ if stable_ticks >= CONTENT_STABLE_THRESHOLD {+ break;+ }+ }+ }+ }Some(target.to_string())}@@ -6583,8 +6611,8 @@ fn write_skills_to_worktree(worktree_path: &str, project_path: &Path, plugin: &Olet filename = skills::skill_dir_to_filename(skill_dir_name, agent_name);let _ = std::fs::write(native_dir.join(&filename), toml_content);}- "codex" => {- // Codex uses SKILL.md in skill-name/ subdirectories+ "codex" | "cursor" => {+ // Codex/Cursor use SKILL.md in skill-name/ subdirectorieslet skill_subdir = native_dir.join(skill_dir_name);let _ = std::fs::create_dir_all(&skill_subdir);let _ = std::fs::write(skill_subdir.join("SKILL.md"), &content);@@ -6638,7 +6666,7 @@ fn deploy_skill(target_dir: &Path, skill_name: &str, content: &str, agent_name:let filename = skills::skill_dir_to_filename(skill_name, agent_name);let _ = std::fs::write(native_dir.join(&filename), toml_content);}- "codex" => {+ "codex" | "cursor" => {let skill_subdir = native_dir.join(skill_name);let _ = std::fs::create_dir_all(&skill_subdir);let _ = std::fs::write(skill_subdir.join("SKILL.md"), content);diff --git a/src/tui/app_tests.rs b/src/tui/app_tests.rsindex 86459f6..011d0e5 100644--- a/src/tui/app_tests.rs+++ b/src/tui/app_tests.rs@@ -2570,13 +2570,17 @@ fn test_is_pane_at_shell_returns_false_for_claude() {#[test]#[cfg(feature = "test-mocks")]-fn test_is_pane_at_shell_returns_false_for_node() {+fn test_is_pane_at_shell_returns_true_for_node() {+ // `node` is intentionally NOT in AGENT_COMMANDS β Node/Ink agents (Gemini, Cursor,+ // OpenCode, Codex) are detected via AGENT_ACTIVE_INDICATORS (Check 2) instead.+ // If node were in AGENT_COMMANDS, Check 1 would fire the moment the node process+ // starts, before the TUI has rendered, sending the prompt too early.let mut mock = MockTmuxOperations::new();mock.expect_pane_current_command().withf(|t| t == "sess:win").returning(|_| Some("node".to_string()));- assert!(!is_pane_at_shell(&mock, "sess:win"));+ assert!(is_pane_at_shell(&mock, "sess:win"));}#[test]@@ -6957,3 +6961,173 @@ fn test_wait_for_agent_ready_always_returns_some() {let result = wait_for_agent_ready(&(Arc::new(mock_tmux) as Arc<dyn TmuxOperations>), "proj:task");assert_eq!(result, Some("proj:task".to_string()));}++// =============================================================================+// Tests for is_pane_at_shell and is_agent_active+// =============================================================================++#[test]+#[cfg(feature = "test-mocks")]+fn test_is_pane_at_shell_returns_true_for_shell_process() {+ for shell in &["bash", "zsh", "sh", "fish"] {+ let mut mock = MockTmuxOperations::new();+ let shell_str = shell.to_string();+ mock.expect_pane_current_command()+ .returning(move |_| Some(shell_str.clone()));+ assert!(is_pane_at_shell(&mock, "t"), "should be at shell for {}", shell);+ }+}++#[test]+#[cfg(feature = "test-mocks")]+fn test_is_pane_at_shell_returns_false_for_agent_processes() {+ for agent in &["claude", "codex", "gemini", "copilot", "opencode", "agent"] {+ let mut mock = MockTmuxOperations::new();+ let agent_str = agent.to_string();+ mock.expect_pane_current_command()+ .returning(move |_| Some(agent_str.clone()));+ assert!(!is_pane_at_shell(&mock, "t"), "should not be at shell for {}", agent);+ }+}++#[test]+#[cfg(feature = "test-mocks")]+fn test_is_agent_active_detects_claude_via_indicator() {+ let mut mock = MockTmuxOperations::new();+ mock.expect_pane_current_command()+ .returning(|_| Some("bash".to_string())); // node/bash β Check 1 misses+ mock.expect_capture_pane()+ .returning(|_| Ok("Claude Code v2.1.72\n> ".to_string()));+ assert!(is_agent_active(&mock, "t"), "Claude Code indicator should trigger is_agent_active");+}++#[test]+#[cfg(feature = "test-mocks")]+fn test_is_agent_active_detects_gemini_via_indicator() {+ let mut mock = MockTmuxOperations::new();+ mock.expect_pane_current_command()+ .returning(|_| Some("bash".to_string()));+ mock.expect_capture_pane()+ .returning(|_| Ok("some output\nType your message".to_string()));+ assert!(is_agent_active(&mock, "t"), "Gemini indicator should trigger is_agent_active");+}++#[test]+#[cfg(feature = "test-mocks")]+fn test_is_agent_active_detects_opencode_via_indicator() {+ let mut mock = MockTmuxOperations::new();+ mock.expect_pane_current_command()+ .returning(|_| Some("bash".to_string()));+ mock.expect_capture_pane()+ .returning(|_| Ok("some output\nAsk anything".to_string()));+ assert!(is_agent_active(&mock, "t"), "OpenCode indicator should trigger is_agent_active");+}++#[test]+#[cfg(feature = "test-mocks")]+fn test_is_agent_active_detects_cursor_via_indicator() {+ let mut mock = MockTmuxOperations::new();+ mock.expect_pane_current_command()+ .returning(|_| Some("bash".to_string()));+ mock.expect_capture_pane()+ .returning(|_| Ok("some output\nCursor Agent\n> ".to_string()));+ assert!(is_agent_active(&mock, "t"), "Cursor indicator should trigger is_agent_active");+}++#[test]+#[cfg(feature = "test-mocks")]+fn test_is_agent_active_detects_codex_via_indicator() {+ let mut mock = MockTmuxOperations::new();+ mock.expect_pane_current_command()+ .returning(|_| Some("bash".to_string()));+ mock.expect_capture_pane()+ .returning(|_| Ok("some output\nOpenAI Codex".to_string()));+ assert!(is_agent_active(&mock, "t"), "Codex indicator should trigger is_agent_active");+}++#[test]+#[cfg(feature = "test-mocks")]+fn test_is_agent_active_returns_false_when_no_indicator() {+ let mut mock = MockTmuxOperations::new();+ mock.expect_pane_current_command()+ .returning(|_| Some("bash".to_string()));+ mock.expect_capture_pane()+ .returning(|_| Ok("just some shell output".to_string()));+ assert!(!is_agent_active(&mock, "t"), "no indicator should return false");+}++// =============================================================================+// Tests for wait_for_agent_ready β new ready indicators+// =============================================================================++#[test]+#[cfg(feature = "test-mocks")]+fn test_wait_for_agent_ready_detects_claude_via_banner() {+ // node process (asdf install) β Check 1 misses, Check 2 fires on "Claude Code"+ let mut mock = MockTmuxOperations::new();+ mock.expect_pane_current_command()+ .returning(|_| Some("bash".to_string()));+ mock.expect_capture_pane()+ .returning(|_| Ok("Claude Code v2.1.72\nsome context".to_string()));+ let result = wait_for_agent_ready(&(Arc::new(mock) as Arc<dyn TmuxOperations>), "proj:task");+ assert_eq!(result, Some("proj:task".to_string()));+}++#[test]+#[cfg(feature = "test-mocks")]+fn test_wait_for_agent_ready_detects_cursor_via_banner() {+ let mut mock = MockTmuxOperations::new();+ mock.expect_pane_current_command()+ .returning(|_| Some("bash".to_string()));+ mock.expect_capture_pane()+ .returning(|_| Ok("Cursor Agent\n> ".to_string()));+ let result = wait_for_agent_ready(&(Arc::new(mock) as Arc<dyn TmuxOperations>), "proj:task");+ assert_eq!(result, Some("proj:task".to_string()));+}++#[test]+#[cfg(feature = "test-mocks")]+fn test_wait_for_agent_ready_detects_opencode_via_banner() {+ let mut mock = MockTmuxOperations::new();+ mock.expect_pane_current_command()+ .returning(|_| Some("bash".to_string()));+ mock.expect_capture_pane()+ .returning(|_| Ok("Ask anything\n> ".to_string()));+ let result = wait_for_agent_ready(&(Arc::new(mock) as Arc<dyn TmuxOperations>), "proj:task");+ assert_eq!(result, Some("proj:task".to_string()));+}++#[test]+#[cfg(feature = "test-mocks")]+fn test_wait_for_agent_ready_detects_codex_via_banner() {+ let mut mock = MockTmuxOperations::new();+ mock.expect_pane_current_command()+ .returning(|_| Some("bash".to_string()));+ mock.expect_capture_pane()+ .returning(|_| Ok("OpenAI Codex\nsome output".to_string()));+ let result = wait_for_agent_ready(&(Arc::new(mock) as Arc<dyn TmuxOperations>), "proj:task");+ assert_eq!(result, Some("proj:task".to_string()));+}++// =============================================================================+// Tests for switch_agent_in_tmux β cursor exit behavior+// =============================================================================++#[test]+#[cfg(feature = "test-mocks")]+fn test_switch_agent_cursor_sends_ctrl_c_not_exit() {+ // Cursor is an Ink/Node TUI β uses Ctrl+C to exit, no /exit command+ let mut mock_tmux = MockTmuxOperations::new();+ mock_tmux.expect_send_keys_literal()+ .withf(|_, key: &str| key == "C-c")+ .times(1)+ .returning(|_, _| Ok(()));+ mock_tmux.expect_pane_current_command()+ .returning(|_| Some("bash".to_string()));+ mock_tmux.expect_send_keys()+ .withf(|_, cmd: &str| cmd == "agent --yolo")+ .times(1)+ .returning(|_, _| Ok(()));++ switch_agent_in_tmux(&mock_tmux, "proj:task", "cursor", "agent --yolo");+}diff --git a/tests/agent_tests.rs b/tests/agent_tests.rsindex 6d72679..9d311f7 100644--- a/tests/agent_tests.rs+++ b/tests/agent_tests.rs@@ -1,4 +1,5 @@-use agtx::agent::parse_agent_selection;+use agtx::agent::{known_agents, parse_agent_selection};+use agtx::skills::{agent_native_skill_dir, transform_plugin_command};#[test]fn test_parse_agent_selection_empty_defaults_to_first() {@@ -40,3 +41,100 @@ fn test_parse_agent_selection_single_agent() {assert_eq!(parse_agent_selection("2", 1), None);assert_eq!(parse_agent_selection("", 1), Some(0));}++// =============================================================================+// Tests for known_agents and build_interactive_command+// =============================================================================++#[test]+fn test_known_agents_includes_cursor() {+ let agents = known_agents();+ let cursor = agents.iter().find(|a| a.name == "cursor");+ assert!(cursor.is_some(), "cursor should be in known_agents");+ let cursor = cursor.unwrap();+ assert_eq!(cursor.command, "agent");+ assert_eq!(cursor.co_author, "Cursor Agent <[email protected]>");+}++#[test]+fn test_known_agents_includes_all_expected() {+ let agents = known_agents();+ let names: Vec<&str> = agents.iter().map(|a| a.name.as_str()).collect();+ for expected in &["claude", "codex", "copilot", "gemini", "opencode", "cursor"] {+ assert!(names.contains(expected), "missing agent: {}", expected);+ }+}++#[test]+fn test_build_interactive_command_cursor_no_prompt() {+ let agents = known_agents();+ let cursor = agents.iter().find(|a| a.name == "cursor").unwrap();+ assert_eq!(cursor.build_interactive_command(""), "agent --yolo");+}++#[test]+fn test_build_interactive_command_cursor_with_prompt() {+ let agents = known_agents();+ let cursor = agents.iter().find(|a| a.name == "cursor").unwrap();+ assert_eq!(+ cursor.build_interactive_command("do something"),+ "agent --yolo 'do something'"+ );+}++#[test]+fn test_build_interactive_command_cursor_escapes_single_quotes() {+ let agents = known_agents();+ let cursor = agents.iter().find(|a| a.name == "cursor").unwrap();+ let cmd = cursor.build_interactive_command("it's a test");+ assert!(cmd.contains("agent --yolo"), "should use agent --yolo");+ assert!(cmd.contains("it"), "prompt content should be present");+}++#[test]+fn test_build_interactive_command_existing_agents_unchanged() {+ let agents = known_agents();+ let by_name = |n: &str| agents.iter().find(|a| a.name == n).unwrap().clone();+ assert_eq!(by_name("claude").build_interactive_command(""), "claude --dangerously-skip-permissions");+ assert_eq!(by_name("codex").build_interactive_command(""), "codex --full-auto");+ assert_eq!(by_name("gemini").build_interactive_command(""), "gemini --approval-mode yolo");+ assert_eq!(by_name("opencode").build_interactive_command(""), "opencode");+}++// =============================================================================+// Tests for cursor skill integration+// =============================================================================++#[test]+fn test_cursor_has_native_skill_dir() {+ let dir = agent_native_skill_dir("cursor");+ assert_eq!(dir, Some((".cursor/skills", "")));+}++#[test]+fn test_cursor_transform_plugin_command() {+ // Cursor: colon β hyphen, slash kept+ assert_eq!(+ transform_plugin_command("/agtx:plan", "cursor"),+ Some("/agtx-plan".to_string())+ );+ assert_eq!(+ transform_plugin_command("/gsd:plan-phase", "cursor"),+ Some("/gsd-plan-phase".to_string())+ );+}++#[test]+fn test_codex_transform_plugin_command_unchanged() {+ // Codex: slash β dollar, colon β hyphen+ assert_eq!(+ transform_plugin_command("/agtx:plan", "codex"),+ Some("$agtx-plan".to_string())+ );+}++#[test]+fn test_copilot_has_no_transform() {+ // Copilot: no interactive command transform+ assert_eq!(transform_plugin_command("/agtx:plan", "copilot"), None);+}