Files
orca/src/cli/root-help-text-primary.ts
Jinwoo Hong 3631a1e77f feat(cli): show orca search now the settings toggle ships (#20677)
* feat(cli): orca search over the agent session index

`orca search <query>` calls PR 5's `aiVault.searchSessions` over the CLI's
existing runtime RPC, against the host `--environment` / `--pairing-code`
selects and no other. `orca search --index-status` calls `aiVault.searchStatus`.
It is the proof the contract works with no panel.

Every flag maps onto a contract field and nothing else: `--scope`, `--fresh`,
`--limit`, `--cursor`, repeatable `--agent` and `--path`, `--since`, `--sort`,
`--debug`, `--json`. No fan-out, no merged output, no `--host`.

One command rather than a `search status` subcommand: the query is a bare
positional, so `orca search status` could not be told apart from searching for
the word "status". `--status` is unavailable because `orchestration task-list
--status <state>` already owns the name as a valued flag.

No new runtime capability. PR 5 decided an explicit `method_not_found` refusal
maps to `unavailable/no-service`, so reusing `createSessionSearchClient` gives
an old host a plain "this host runs no session search service" answer at exit 0
instead of a raw JSON-RPC error.

`CommandSpec.repeatableFlags` scopes repeatability per command, because
`--agent` must repeat for search and stay single-valued for `worktree create`.
`help.ts` sat exactly at max-lines, so `skills-command-flag-help.ts` becomes
`command-scoped-flag-help.ts` carrying both tables at the same call-site size.

* refactor(cli): drop the search type assertions main's casting gate now rejects

Main gained a `consistent-type-assertions: never` scan in the changed-code gate
after this branch was cut, and it reported twelve assertions in the new files.

The four in the argument parser were avoidable. `readEnum` now keeps the value
`find` returns, which already carries the narrow type, and the agent filter goes
through an `isAiVaultAgent` predicate over a `Set<string>` instead of widening
the agent tuple.

The test now narrows the printed envelope by shape and re-reads the printed
result through `AiVaultSearchResponseSchema`, so the JSON assertions are checked
rather than claimed, and the flag table is typed so its callback needs no cast.
One assertion is left, for the structural fake client, with the SAFETY rationale
AGENTS.md requires.

* fix(cli): sanitize host strings and scope pre-command repeatable flags

Route every host-supplied string the search formatter prints through the
escape stripper, and resolve the repeatable-flag set from the command
tokens ahead when a flag sits before the command.

* refactor(cli): resolve repeatable flag rules once per command

* fix(cli): clarify session search availability and SSH scope

* feat(cli): hide orca search until the settings toggle ships

`orca search` stays dispatchable but leaves every discovery surface: root
help, group help, unknown-command suggestions, and `agent-context --json`.
`buildAgentContext` did not filter hidden specs, so it also stops leaking
the hidden `terminal stop`.

* feat(cli): show orca search now the settings toggle ships

* docs(skills): teach the orca-cli guide the search command

One section: what orca search covers, one host at a time, scope and
narrowing flags, index status before searching, and that a human turns
search on.

* docs(skills): shape the search section like the other command sections
2026-09-16 12:29:35 -04:00

187 lines
11 KiB
TypeScript

export const ROOT_HELP_TEXT_PRIMARY = [
'orca',
'',
'Usage: orca <command> [options]',
'',
'Startup:',
' open Launch Orca and wait for the runtime to be reachable',
' serve Start a headless Orca runtime server',
' status Show app/runtime/graph readiness',
'',
'Diagnostics:',
' diagnostics memory Collect a memory snapshot for Orca and managed terminals',
'',
'Agent Discovery:',
' agent-context Print the machine-readable command schema for agents',
'',
'Agent Sessions:',
' search Search the full text of agent sessions on one Orca host',
'',
'Accounts:',
' account add Add a managed Claude or Codex account on this Orca host',
' account list List managed Claude and Codex accounts on this Orca host',
'',
'Skills:',
' skills installed List installed skill selectors',
' skills share Publish selected skills behind one unlisted link',
' skills list List version-matched skill guides bundled with this Orca CLI',
' skills get Print a version-matched skill guide as Markdown',
' skills install Install bundled Orca skills globally via the community skills CLI',
' skills update Update already-installed Orca skills via the community skills CLI',
'',
'Hosts:',
' host list List targetable machines and how to name each one',
'',
'Environments:',
' environment add Save a remote Orca runtime from a pairing code',
' environment list List saved remote Orca runtimes',
' environment show Show one saved remote Orca runtime',
' environment rm Remove a saved remote Orca runtime',
'',
'Environment Recipes:',
' vm recipe doctor Validate a per-workspace environment recipe',
'',
'Automations:',
' automations list List scheduled Orca automations',
' automations show Show one Orca automation',
' automations create Create a scheduled Orca automation',
' automations edit Edit an Orca automation',
' automations remove Remove an Orca automation and its run history',
' automations run Run an Orca automation now',
' automations runs List automation run history',
'',
'Projects:',
' project list List durable projects known to Orca',
' project setups List project host setups',
' project setup-existing-folder Make a project available on a host by importing an existing folder',
' project setup-clone Make a project available on a host by cloning a repository',
' project setup-create Create independent project host setup metadata',
' project setup-update Update project host setup metadata',
' project setup-delete Remove a project host setup',
'',
'Repos:',
' repo list List repos registered in Orca',
' repo add Add a project to Orca by filesystem path',
' repo show Show one registered repo',
" repo set-base-ref Set the repo's default base ref for future worktrees",
' repo search-refs Search branch/tag refs within a repo',
'',
'Worktrees:',
' worktree list List Orca-managed worktrees',
' worktree show Show one worktree',
' worktree current Show the Orca-managed worktree for the current directory',
' worktree create Create a new Orca-managed worktree',
' worktree set Update Orca metadata for a worktree',
' worktree rm Remove a worktree from Orca and git',
' worktree ps Show a compact orchestration summary across worktrees',
'',
'Files:',
' file open Open a workspace file in the Orca editor',
' file diff Open a workspace file diff in the Orca editor',
' file open-changed Open all git-changed files for a workspace',
'',
'Terminals:',
' terminal list List live Orca-managed terminals',
' terminal show Show terminal metadata and preview',
' terminal read Read bounded terminal output',
' terminal send Send input to a live terminal',
' terminal wait Wait for a terminal condition (exit, tui-idle)',
' terminal create Create a terminal session in a worktree',
' terminal rename Set or clear the title of a terminal tab',
' terminal split Split an existing terminal pane',
' terminal switch Bring a terminal tab to the foreground',
' terminal focus Alias for terminal switch',
' terminal close Close one terminal, its whole tab with --tab, or all in a worktree',
'',
'Orchestration:',
' orchestration run-create Create and bind a lightweight orchestration Run',
' orchestration run-use Bind this coordinator terminal to an existing Run',
" orchestration run-current Show this terminal's bound Run",
' orchestration run-list List lightweight orchestration Runs',
' orchestration run-show Show one lightweight orchestration Run',
' orchestration send Send an inter-agent message',
' orchestration check Check the bound Run mailbox',
' orchestration ask Ask the coordinator a blocking question',
' orchestration reply Reply to a message',
' orchestration inbox Show all messages across recipients',
' orchestration task-create Create an orchestration task',
' orchestration task-list List orchestration tasks',
' orchestration task-update Update a task status',
' orchestration dispatch Dispatch a task to a terminal',
' orchestration dispatch-show Show dispatch context for a task',
' orchestration worker-start Start a supervised worker locally or on a connected Orca server',
' orchestration worker-show Inspect one supervised worker',
' orchestration worker-read Read bounded output from one supervised worker',
' orchestration worker-stop Fence one Dispatch; stop only its supervised worker',
' orchestration worker-abandon Fence an uncertain worker without claiming it stopped',
" orchestration worker-release Release a settled worker's terminal after archiving its output",
' orchestration worker-retain Keep a worker terminal live for debugging',
' orchestration worker-list Report worker terminal resource accounting',
' orchestration coordinator-start Retired: load the current orchestration skill',
' orchestration coordinator-stop Retired: load the current orchestration skill',
' orchestration gate-create Create a decision gate blocking a task',
' orchestration gate-resolve Resolve a pending decision gate',
' orchestration gate-list List decision gates',
' orchestration reset Reset orchestration state',
'',
'Computer Use:',
' computer capabilities Show computer-use provider capabilities',
' computer permissions Show or open computer-use permission setup',
' computer list-apps List running apps available to computer-use',
' computer list-windows List visible windows for a target app',
' computer get-app-state Capture a compact accessibility snapshot of an app',
' computer click Click an app element or window coordinate',
' computer perform-secondary-action Run an advertised accessibility action',
' computer scroll Scroll an app element',
' computer drag Drag between app elements or window coordinates',
' computer type-text Type literal text at the current app focus',
' computer press-key Press a single key such as Return or Escape',
' computer hotkey Press a shortcut combination such as CmdOrCtrl+A',
' computer paste-text Paste text through the native clipboard path',
' computer set-value Set the value of a settable app element',
'',
'Linear:',
' linear Read Linear ticket context for agents',
'',
'Mobile Emulator (iOS Simulator):',
' emulator list List available/running emulators (Orca-managed + raw serve-sim)',
' emulator attach <device> Attach/start helper and make active for the worktree',
' emulator tap <x> <y> Tap at normalized 0..1 coords (preferred for single taps)',
' emulator type <text> Type text (US ASCII only)',
' emulator gesture <json> Send begin/move/end touch points',
' emulator button <name> Hardware button (home, side_button, etc.)',
' emulator rotate <o> Rotate device (portrait|landscape_left|...)',
' emulator exec --command Raw serve-sim subcommand passthrough (no "serve-sim" prefix)',
' emulator kill Stop helper for device',
'',
'Browser Automation:',
' tab create Create a new browser tab (navigates to --url)',
' tab list List open browser tabs',
' tab show Show one browser tab by page id',
' tab current Show the current browser tab',
' tab profile list List browser session profiles',
' tab profile create Create a browser session profile',
' tab profile delete Delete a browser session profile',
' tab profile set Switch a browser tab to a different profile',
' tab profile show Show the profile bound to a browser tab',
' tab profile use-default Switch a browser tab back to the default profile',
' tab profile clone Clone a browser tab into another profile',
' tab switch Switch the active browser tab by --index or --page',
' tab close Close a browser tab by --index/--page or the current tab',
' snapshot Accessibility snapshot with element refs (e.g. @e1, @e2)',
' goto Navigate the active tab to --url',
' click Click element by --element ref',
' fill Clear and fill input by --element ref with --value',
' type Type --input text at the current focus (no element needed)',
' select Select dropdown option by --element ref and --value',
' hover Hover element by --element ref',
' keypress Press a key (e.g. --key Enter, --key Tab)',
' scroll Scroll --direction (up/down) by --amount pixels',
' back Navigate back in browser history',
' reload Reload the active browser tab',
' screenshot Capture viewport screenshot (--format png|jpeg)',
' eval Evaluate --expression JavaScript in the page context',
' wait Wait for page idle or --timeout ms',
' check Check a checkbox by --element ref'
].join('\n')