Clarify terminal vs worktree creation for fresh local agents (#5549)

- Document and update the CLI help, specs, and tests to explicitly guide
  users toward `orca terminal create --worktree active --command <agent>`
  to launch a fresh agent session in the current checkout.
- Update orchestration and orca-cli skills to prefer active-worktree
  terminals when dependent on uncommitted files or active branch state,
  distinguishing them from separate worktree creation.
This commit is contained in:
Jinjing
2026-06-16 18:05:08 -07:00
committed by GitHub
parent 7077736602
commit e3ffdbfa3a
5 changed files with 53 additions and 6 deletions
+6
View File
@@ -254,6 +254,11 @@ Behavior:
Remote runtime access can also be supplied with ORCA_PAIRING_CODE or ORCA_ENVIRONMENT.
Use selectors for discovery and handles for repeated live terminal operations.
Agent Sessions And Worktrees:
\`worktree create --agent\` creates a new checkout/workspace with an agent.
To start a fresh agent in the current worktree, use:
orca terminal create --worktree active --command "codex"
Browser Workflow:
1. Create or navigate: orca tab create --url https://example.com
orca goto --url https://example.com
@@ -303,6 +308,7 @@ Examples:
$ orca worktree ps --limit 10
$ orca file open-changed --mode diff
$ orca file open src/App.tsx
$ orca terminal create --worktree active --command "codex"
$ orca terminal list --worktree path:/Users/me/orca/workspaces/orca/cli-test-1 --json
$ orca terminal send --terminal term_123 --text "hi" --enter
$ orca terminal wait --terminal term_123 --for exit --timeout-ms 60000 --json
+29
View File
@@ -153,6 +153,13 @@ describe('orca root help', () => {
expect(logSpy.mock.calls[0][0]).toContain(
'project setup-delete Remove a project host setup'
)
expect(logSpy.mock.calls[0][0]).toContain('Agent Sessions And Worktrees:')
expect(logSpy.mock.calls[0][0]).toContain(
'`worktree create --agent` creates a new checkout/workspace with an agent.'
)
expect(logSpy.mock.calls[0][0]).toContain(
'orca terminal create --worktree active --command "codex"'
)
expect(callMock).not.toHaveBeenCalled()
})
@@ -213,6 +220,28 @@ describe('orca root help', () => {
expect(setHelp).toContain('--linear-issue <id|url|null> Linked Linear issue identifier or URL')
expect(callMock).not.toHaveBeenCalled()
})
it('distinguishes new worktrees from fresh agent terminals in command help', async () => {
const logSpy = vi.spyOn(console, 'log').mockImplementation(() => {})
logSpy.mockClear()
await main(['worktree', 'create', '--help'], '/tmp/repo')
expect(String(logSpy.mock.calls[0][0])).toContain('This creates a new checkout/workspace')
expect(String(logSpy.mock.calls[0][0])).toContain(
'orca terminal create --worktree active --command "codex"'
)
logSpy.mockClear()
await main(['terminal', 'create', '--help'], '/tmp/repo')
const terminalHelp = String(logSpy.mock.calls[0][0])
expect(terminalHelp).toContain('Use this, not worktree create')
expect(terminalHelp).toContain(
'orca terminal create --worktree active --command "codex" --json'
)
expect(callMock).not.toHaveBeenCalled()
})
})
describe('orca cli worktree awareness', () => {
+4 -1
View File
@@ -124,6 +124,7 @@ export const CORE_COMMAND_SPECS: CommandSpec[] = [
'activate'
],
notes: [
'This creates a new checkout/workspace. For a fresh agent in an existing worktree, use `orca terminal create --worktree active --command "codex"` instead.',
'By default, Orca records the new worktree as a child of the caller workspace when it can infer one from the Orca terminal or current directory.',
'If --repo is omitted, Orca infers the repo from the current Orca-managed worktree.',
'Use --project with --host to create on a ready project host setup without spelling the backing repo id.',
@@ -239,10 +240,12 @@ export const CORE_COMMAND_SPECS: CommandSpec[] = [
'orca terminal create [--worktree <selector>] [--title <name>] [--command <text>] [--focus] [--json]',
allowedFlags: [...GLOBAL_FLAGS, 'worktree', 'command', 'title', 'focus'],
notes: [
'Creates a visible terminal tab without switching focus when possible; falls back to a background handle if the UI cannot adopt it. Pass --focus to switch to it.'
'Creates a visible terminal tab without switching focus when possible; falls back to a background handle if the UI cannot adopt it. Pass --focus to switch to it.',
'Use this, not worktree create, for a fresh agent in the current checkout.'
],
examples: [
'orca terminal create --json',
'orca terminal create --worktree active --command "codex" --json',
'orca terminal create --worktree path:/projects/myapp --title "RUNNER" --command "opencode"',
'orca terminal create --worktree path:/projects/myapp --command "opencode" --focus'
]