the runtime your coding agents live on
Rust agentagent-orchestrationaiai-agentsclaude-codeclicodexcoding-agentsdeveloper-toolsdevtoolsmultiplexerrustterminalterminal-multiplexerterminal-uitmuxtuiworkspace-manager
fix: stop advertising worktree json flag (#2174)
akbash9a4ce5e13c1d
diff --git a/docs/next/CHANGELOG.md b/docs/next/CHANGELOG.mdindex 6fcf7656a..4779d9f9d 100644--- a/docs/next/CHANGELOG.md+++ b/docs/next/CHANGELOG.md@@ -12,6 +12,7 @@- Relicensed Herdr from AGPL-3.0-or-later to Apache-2.0.### Fixed+- Worktree CLI help and docs no longer advertise the redundant `--json` flag; worktree commands remain JSON-only and continue accepting the flag for compatibility. (#2171)- OpenCode 2 preview panes now appear as OpenCode agents and use the existing OpenCode status detection. (#2169)- Pane text copied through VS Code Remote Tunnels now reaches the viewing machine's clipboard instead of overwriting the remote host clipboard. (#2015)- Windows agent detection now follows Git Bash-launched agents across emulated `exec` process boundaries. (#2107)diff --git a/docs/next/website/src/content/docs/cli-reference.mdx b/docs/next/website/src/content/docs/cli-reference.mdxindex 2aa008f5f..d0f1509ae 100644--- a/docs/next/website/src/content/docs/cli-reference.mdx+++ b/docs/next/website/src/content/docs/cli-reference.mdx@@ -135,10 +135,10 @@ A workspace is the top-level project or work context. Creating one also creates## Worktrees```bash-herdr worktree list [--workspace ID | --cwd PATH] [--json]-herdr worktree create [--workspace ID | --cwd PATH] [--branch NAME] [--base REF] [--path PATH] [--label TEXT] [--focus] [--no-focus] [--json]-herdr worktree open [--workspace ID | --cwd PATH] (--path PATH | --branch NAME) [--label TEXT] [--focus] [--no-focus] [--json]-herdr worktree remove --workspace ID [--force] [--json]+herdr worktree list [--workspace ID | --cwd PATH]+herdr worktree create [--workspace ID | --cwd PATH] [--branch NAME] [--base REF] [--path PATH] [--label TEXT] [--focus] [--no-focus]+herdr worktree open [--workspace ID | --cwd PATH] (--path PATH | --branch NAME) [--label TEXT] [--focus] [--no-focus]+herdr worktree remove --workspace ID [--force]```Worktrees are normal Herdr workspaces with Git checkout provenance. `worktree create` creates a Git worktree checkout, opens it as a workspace, and groups it with the parent repo workspace. If `--branch` names an existing local branch, Herdr checks it out; otherwise it creates the branch from `--base` or `HEAD`. Without `--path`, Herdr creates the checkout under `<worktrees.directory>/<repo>/<branch-slug>`.diff --git a/docs/next/website/src/content/docs/ja/cli-reference.mdx b/docs/next/website/src/content/docs/ja/cli-reference.mdxindex 3b96247ee..3cc1e13b3 100644--- a/docs/next/website/src/content/docs/ja/cli-reference.mdx+++ b/docs/next/website/src/content/docs/ja/cli-reference.mdx@@ -131,10 +131,10 @@ herdr workspace create --cwd ~/project --label api --no-focus## Worktree```bash-herdr worktree list [--workspace ID | --cwd PATH] [--json]-herdr worktree create [--workspace ID | --cwd PATH] [--branch NAME] [--base REF] [--path PATH] [--label TEXT] [--focus] [--no-focus] [--json]-herdr worktree open [--workspace ID | --cwd PATH] (--path PATH | --branch NAME) [--label TEXT] [--focus] [--no-focus] [--json]-herdr worktree remove --workspace ID [--force] [--json]+herdr worktree list [--workspace ID | --cwd PATH]+herdr worktree create [--workspace ID | --cwd PATH] [--branch NAME] [--base REF] [--path PATH] [--label TEXT] [--focus] [--no-focus]+herdr worktree open [--workspace ID | --cwd PATH] (--path PATH | --branch NAME) [--label TEXT] [--focus] [--no-focus]+herdr worktree remove --workspace ID [--force]```worktree は、Git チェックアウトの出自情報を持つ通常の Herdr ワークスペースです。`worktree create` は Git worktree のチェックアウトを作成し、ワークスペースとして開き、親リポジトリのワークスペースとグループ化します。`--branch` が既存のローカルブランチを指す場合はそれをチェックアウトし、そうでなければ `--base` または `HEAD` からブランチを作成します。`--path` がない場合、チェックアウトは `<worktrees.directory>/<repo>/<branch-slug>` の下に作成されます。diff --git a/docs/next/website/src/content/docs/zh-cn/cli-reference.mdx b/docs/next/website/src/content/docs/zh-cn/cli-reference.mdxindex 03831dc71..baebfcc85 100644--- a/docs/next/website/src/content/docs/zh-cn/cli-reference.mdx+++ b/docs/next/website/src/content/docs/zh-cn/cli-reference.mdx@@ -131,10 +131,10 @@ herdr workspace create --cwd ~/project --label api --no-focus## Worktree```bash-herdr worktree list [--workspace ID | --cwd PATH] [--json]-herdr worktree create [--workspace ID | --cwd PATH] [--branch NAME] [--base REF] [--path PATH] [--label TEXT] [--focus] [--no-focus] [--json]-herdr worktree open [--workspace ID | --cwd PATH] (--path PATH | --branch NAME) [--label TEXT] [--focus] [--no-focus] [--json]-herdr worktree remove --workspace ID [--force] [--json]+herdr worktree list [--workspace ID | --cwd PATH]+herdr worktree create [--workspace ID | --cwd PATH] [--branch NAME] [--base REF] [--path PATH] [--label TEXT] [--focus] [--no-focus]+herdr worktree open [--workspace ID | --cwd PATH] (--path PATH | --branch NAME) [--label TEXT] [--focus] [--no-focus]+herdr worktree remove --workspace ID [--force]```worktree 是带有 Git 检出来源信息的普通 Herdr 工作区。`worktree create` 创建一个 Git worktree 检出,作为工作区打开,并与父仓库工作区分到一组。如果 `--branch` 指向已有的本地分支,Herdr 检出它;否则从 `--base` 或 `HEAD` 创建分支。没有 `--path` 时,Herdr 在 `<worktrees.directory>/<repo>/<branch-slug>` 下创建检出。diff --git a/src/cli/spec.rs b/src/cli/spec.rsindex 1f2e85a4d..3be833286 100644--- a/src/cli/spec.rs+++ b/src/cli/spec.rs@@ -229,8 +229,7 @@ fn worktree_command() -> Command {Command::new("list").about("List worktree workspaces").arg(option("workspace", "ID"))- .arg(path_option("cwd", "PATH"))- .arg(json_flag()),+ .arg(path_option("cwd", "PATH")),).subcommand(Command::new("create")@@ -242,8 +241,7 @@ fn worktree_command() -> Command {.arg(path_option("path", "PATH")).arg(option("label", "TEXT")).arg(flag("focus"))- .arg(flag("no-focus"))- .arg(json_flag()),+ .arg(flag("no-focus")),).subcommand(Command::new("open")@@ -254,15 +252,13 @@ fn worktree_command() -> Command {.arg(option("branch", "NAME")).arg(option("label", "TEXT")).arg(flag("focus"))- .arg(flag("no-focus"))- .arg(json_flag()),+ .arg(flag("no-focus")),).subcommand(Command::new("remove").about("Remove a worktree checkout").arg(option("workspace", "ID"))- .arg(flag("force"))- .arg(json_flag()),+ .arg(flag("force")),)}@@ -1191,6 +1187,18 @@ mod tests {.contains("Usage: herdr agent rename <TARGET> <NAME>|--clear"));}+ #[test]+ fn worktree_json_compatibility_flag_stays_out_of_public_spec() {+ let cmd = super::command();+ for subcommand in ["list", "create", "open", "remove"] {+ let worktree_command = command_path(&cmd, &["worktree", subcommand]);+ assert!(+ !has_option(worktree_command, "json"),+ "herdr worktree {subcommand} should not advertise --json"+ );+ }+ }+#[test]fn spec_includes_nested_plugin_pane_open_options() {let cmd = super::command();diff --git a/src/cli/worktree.rs b/src/cli/worktree.rsindex b96bcb8fc..4a36876af 100644--- a/src/cli/worktree.rs+++ b/src/cli/worktree.rs@@ -2,6 +2,7 @@ use crate::api::schema::{WorktreeCreateParams, WorktreeListParams, WorktreeOpenParams, WorktreeRemoveParams,};+// Worktree output is always JSON. The parsers retain `--json` as a hidden compatibility no-op.pub(super) fn run_worktree_command(args: &[String]) -> std::io::Result<i32> {let Some(subcommand) = args.first().map(|arg| arg.as_str()) else {print_worktree_help();@@ -55,7 +56,7 @@ fn worktree_list(args: &[String]) -> std::io::Result<i32> {}}if workspace_id.is_some() && cwd.is_some() {- eprintln!("usage: herdr worktree list [--workspace ID | --cwd PATH] [--json]");+ eprintln!("usage: herdr worktree list [--workspace ID | --cwd PATH]");return Ok(2);}@@ -139,7 +140,7 @@ fn worktree_create(args: &[String]) -> std::io::Result<i32> {}if workspace_id.is_some() && cwd.is_some() {eprintln!(- "usage: herdr worktree create [--workspace ID | --cwd PATH] [--branch NAME] [--base REF] [--path PATH] [--label TEXT] [--focus] [--no-focus] [--json]"+ "usage: herdr worktree create [--workspace ID | --cwd PATH] [--branch NAME] [--base REF] [--path PATH] [--label TEXT] [--focus] [--no-focus]");return Ok(2);}@@ -223,13 +224,13 @@ fn worktree_open(args: &[String]) -> std::io::Result<i32> {}if workspace_id.is_some() && cwd.is_some() {eprintln!(- "usage: herdr worktree open [--workspace ID | --cwd PATH] (--path PATH | --branch NAME) [--label TEXT] [--focus] [--no-focus] [--json]"+ "usage: herdr worktree open [--workspace ID | --cwd PATH] (--path PATH | --branch NAME) [--label TEXT] [--focus] [--no-focus]");return Ok(2);}if path.is_some() == branch.is_some() {eprintln!(- "usage: herdr worktree open [--workspace ID | --cwd PATH] (--path PATH | --branch NAME) [--label TEXT] [--focus] [--no-focus] [--json]"+ "usage: herdr worktree open [--workspace ID | --cwd PATH] (--path PATH | --branch NAME) [--label TEXT] [--focus] [--no-focus]");return Ok(2);}@@ -272,7 +273,7 @@ fn worktree_remove(args: &[String]) -> std::io::Result<i32> {}let Some(workspace_id) = workspace_id else {- eprintln!("usage: herdr worktree remove --workspace ID [--force] [--json]");+ eprintln!("usage: herdr worktree remove --workspace ID [--force]");return Ok(2);};@@ -284,14 +285,14 @@ fn worktree_remove(args: &[String]) -> std::io::Result<i32> {fn print_worktree_help() {eprintln!("herdr worktree commands:");- eprintln!(" herdr worktree list [--workspace ID | --cwd PATH] [--json]");+ eprintln!(" herdr worktree list [--workspace ID | --cwd PATH]");eprintln!(- " herdr worktree create [--workspace ID | --cwd PATH] [--branch NAME] [--base REF] [--path PATH] [--label TEXT] [--focus] [--no-focus] [--json]"+ " herdr worktree create [--workspace ID | --cwd PATH] [--branch NAME] [--base REF] [--path PATH] [--label TEXT] [--focus] [--no-focus]");eprintln!(- " herdr worktree open [--workspace ID | --cwd PATH] (--path PATH | --branch NAME) [--label TEXT] [--focus] [--no-focus] [--json]"+ " herdr worktree open [--workspace ID | --cwd PATH] (--path PATH | --branch NAME) [--label TEXT] [--focus] [--no-focus]");- eprintln!(" herdr worktree remove --workspace ID [--force] [--json]");+ eprintln!(" herdr worktree remove --workspace ID [--force]");}fn normalize_path_arg(value: &str) -> std::io::Result<String> {