From 0cf4f6010ea4152ea6e766a2ea23a175ae76d5b0 Mon Sep 17 00:00:00 2001 From: Borja <3930245+BorjaLL@users.noreply.github.com> Date: Sun, 31 May 2026 18:41:10 +0100 Subject: [PATCH] Add --workspace-status flag to `worktree set` CLI (#3332) The `worktree.set` RPC already accepts `workspaceStatus`, but the CLI handler never forwarded it, so the board status could not be changed from the command line. Pass the flag through, document it in the spec and root help, and add a CLI test mirroring the existing --comment case. Co-authored-by: Claude Opus 4.8 (1M context) --- src/cli/handlers/worktree.ts | 1 + src/cli/help.ts | 4 +++- src/cli/index.test.ts | 37 ++++++++++++++++++++++++++++++++++++ src/cli/specs/core.ts | 6 +++++- 4 files changed, 46 insertions(+), 2 deletions(-) diff --git a/src/cli/handlers/worktree.ts b/src/cli/handlers/worktree.ts index b051479a43d..eda99c4b3b3 100644 --- a/src/cli/handlers/worktree.ts +++ b/src/cli/handlers/worktree.ts @@ -161,6 +161,7 @@ export const WORKTREE_HANDLERS: Record = { displayName: getOptionalStringFlag(flags, 'display-name'), linkedIssue: getOptionalNullableNumberFlag(flags, 'issue'), comment: getOptionalStringFlag(flags, 'comment'), + workspaceStatus: getOptionalStringFlag(flags, 'workspace-status'), parentWorktree: await getOptionalWorktreeSelector(flags, 'parent-worktree', cwd, client), noParent: flags.get('no-parent') === true }) diff --git a/src/cli/help.ts b/src/cli/help.ts index 50de2d06059..b5990b63eac 100644 --- a/src/cli/help.ts +++ b/src/cli/help.ts @@ -169,7 +169,7 @@ Common Commands: orca worktree create --repo --name [--base-branch ] [--issue ] [--comment ] [--parent-worktree ] [--no-parent] [--run-hooks] [--activate] [--json] orca worktree show --worktree [--json] orca worktree current [--json] - orca worktree set --worktree [--display-name ] [--issue ] [--comment ] [--parent-worktree |--no-parent] [--json] + orca worktree set --worktree [--display-name ] [--issue ] [--comment ] [--workspace-status ] [--parent-worktree |--no-parent] [--json] orca worktree rm --worktree [--force] [--run-hooks] [--json] orca worktree ps [--limit ] [--json] orca file open [--worktree ] [--json] @@ -388,6 +388,8 @@ export function formatFlagHelp(flag: string): string { worktree: '--worktree Worktree selector such as id:, branch:, issue:, path:, or active/current', workspace: '--workspace Existing worktree selector for automation runs', + 'workspace-status': + '--workspace-status Board status id (defaults: todo, in-progress, in-review, completed)', prompt: '--prompt Automation prompt to pass to the agent', staged: '--staged Open staged source-control changes', provider: '--provider Agent id such as codex, claude, or gemini', diff --git a/src/cli/index.test.ts b/src/cli/index.test.ts index 0cab307f702..8da612f0708 100644 --- a/src/cli/index.test.ts +++ b/src/cli/index.test.ts @@ -427,11 +427,48 @@ describe('orca cli worktree awareness', () => { displayName: undefined, linkedIssue: undefined, comment: undefined, + workspaceStatus: undefined, parentWorktree: undefined, noParent: true }) }) + it('passes workspace status through worktree.set', async () => { + queueFixtures( + callMock, + okFixture('req_set_status', { + worktree: { + ...buildWorktree('/tmp/repo/child', 'feature/child'), + workspaceStatus: 'in-review' + } + }) + ) + vi.spyOn(console, 'log').mockImplementation(() => {}) + + await main( + [ + 'worktree', + 'set', + '--worktree', + 'id:repo::/tmp/repo/child', + '--workspace-status', + 'in-review', + '--json' + ], + '/tmp/repo' + ) + + expect(callMock).toHaveBeenCalledWith('worktree.set', { + worktree: 'id:repo::/tmp/repo/child', + displayName: undefined, + linkedIssue: undefined, + comment: undefined, + workspaceStatus: 'in-review', + parentWorktree: undefined, + noParent: false + }) + }) + it('passes explicit activation through worktree.create', async () => { queueFixtures( callMock, diff --git a/src/cli/specs/core.ts b/src/cli/specs/core.ts index 6eea616b412..37d7881e666 100644 --- a/src/cli/specs/core.ts +++ b/src/cli/specs/core.ts @@ -123,15 +123,19 @@ export const CORE_COMMAND_SPECS: CommandSpec[] = [ path: ['worktree', 'set'], summary: 'Update Orca metadata for a worktree', usage: - 'orca worktree set --worktree [--display-name ] [--issue ] [--comment ] [--parent-worktree |--no-parent] [--json]', + 'orca worktree set --worktree [--display-name ] [--issue ] [--comment ] [--workspace-status ] [--parent-worktree |--no-parent] [--json]', allowedFlags: [ ...GLOBAL_FLAGS, 'worktree', 'display-name', 'issue', 'comment', + 'workspace-status', 'parent-worktree', 'no-parent' + ], + notes: [ + 'Workspace status ids match the board columns (defaults: todo, in-progress, in-review, completed); custom statuses use their configured id.' ] }, {