Repository navigation
feat(cli): add orca skills install and orca skills update for headless skill setup - #9201
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 3761de2c-7653-45c8-9ad8-b68bd0e5f045
📥 Commits
Reviewing files that changed from the base of the PR and between 1c54171 and 332ff9e5910c1cbe039ee6da23e233c1a19d48bb.
📒 Files selected for processing (8)
docs/reference/headless-linux-server.mdsrc/cli/args.tssrc/cli/handlers/skills.tssrc/cli/help.tssrc/cli/skills.test.tssrc/cli/specs/skills.tssrc/shared/agent-feature-install-commands.test.tssrc/shared/agent-feature-install-commands.ts
|
Taking a look! |
orca skills install for headless skill setuporca skills install and orca skills update for headless skill setup
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 6cd6c853-fd47-4a69-be6d-8b525ebce58a
📥 Commits
Reviewing files that changed from the base of the PR and between f1765dfeea71cef513a0620819540e8ff6b0783b and f9e8fb46a692719022272e0c6cb48a9045190d7f.
📒 Files selected for processing (7)
docs/reference/headless-linux-server.mdsrc/cli/handlers/skills.tssrc/cli/help.tssrc/cli/skills.test.tssrc/cli/specs/skills.tssrc/shared/agent-feature-install-commands.test.tssrc/shared/agent-feature-install-commands.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- src/cli/help.ts
- src/cli/specs/skills.ts
Headless hosts (SSH, containers, CI) have no desktop Settings UI to copy the `npx skills add ... --global` command from, so there was no way to install Orca's bundled agent skills there. `orca skills install` lists installable skills, resolves the same command Settings would show, and runs it via `npx` (or just prints it with `--dry-run`). `--local` installs into the current project instead of globally. Also simplifies `orca skills list`'s text output to bare names (the prior one-line-per-skill format with full descriptions was unreadable in a real terminal); `--json` is unchanged. Co-Authored-By: Claude Sonnet 5 <[email protected]>
CodeRabbit flagged that --json inherited npx's raw stdout during a real (non-dry-run) install instead of emitting JSON, breaking the machine-readable contract --json implies. A real install streams npx's own output live (useful for a possibly slow network install), so buffering it into a JSON envelope would trade away that visibility; reject the combination instead and point callers at --dry-run --json for a JSON-formatted preview. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Addresses CodeRabbit's docstring-coverage flag on this PR's changed files. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Headless hosts had no CLI-native way to refresh already-installed skills — the
`npx skills update` rail was only reachable from the desktop Settings UI. Add a
symmetric `orca skills update` that mirrors install's flags (--skill/--all,
--local, --dry-run, --json) and resolves to `npx skills update <names...>`.
The install and update handlers now share one implementation
(createSkillMutationHandler); the shared update-command builder accepts
multiple skill names and a { global } option (single-string callers in the
Settings UI are unaffected).
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Addresses two CodeRabbit review comments on the skills install/update commands. - Build `npx skills add` with a repeated `--skill <name>` per skill instead of one space-joined `--skill a b`. The installed skills CLI (v1.5.19) `add` parser accepts both forms, but the per-flag form is portable across CLI versions and keeps the dry-run string and the spawned argv identical. `update` keeps positional names, matching `skills update [skills...]`. - Wrap the child-process `error` event in a RuntimeClientError so a missing npx/Node on a headless host reports an actionable message instead of a raw spawn error, consistent with the other failure paths in this file. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Use shared argument builders for both displayed and executed commands, select project scope explicitly for local updates, and invoke the Windows command shim without shell-mode argument rewriting. Reject missing skill values and keep command documentation and consumer expectations synchronized.
fe2f9ff to
fb38267
Compare
|
Thanks for the contribution! I rebased the branch onto current main and tightened the execution path: local updates now select project scope explicitly, displayed commands and spawned argv share the same builders, Windows invokes the npx shim without shell-mode argument rewriting, and missing |
The manifest-based router landed after this branch was written, so `skills install`/`skills update` were unroutable once rebased onto main. Also mirror the real RuntimeClientError in the test mock: format.ts narrows with `instanceof` against ./runtime/types, so a look-alike collapsed every error into the generic runtime_error shape.
Three real defects on the path this feature targets: - `skills add` opens an interactive agent picker and blocks forever on any allocated TTY, which is every ssh session. Verified against the real CLI under a pty: it hangs and installs nothing. Send `-y`, and `npx --yes` so a cold package cache cannot prompt either. The copyable Settings strings are unchanged — `yes` defaults to false. - Windows hardcoded `npx.cmd` behind cmd.exe, so an `npx.exe` shim was missed and a missing npx surfaced as cmd.exe's own exit code, making the friendly ENOENT message unreachable. Reuse resolveCliCommand + getSpawnArgsForWindows. - --dry-run built its command string separately from the spawned argv, so the two could drift. Render the argv instead. Also revert the unrelated `skills list` output change (out of scope) and correct the docs/spec notes that promised --json on a real run.
Round-2 review findings: - resolveCliCommand can return an npx that is off PATH, but npx is an `env node` script: without node alongside it the child exits 127 with no 'error' event, so the actionable message never fired. Put the resolved directory (and the version-manager bins) on the child's PATH. - The SSH relay and WSL bridge forward argv to the Orca host, so a real run would install onto the desktop and silently skip the machine the user is on. Refuse when ORCA_CLI_CWD marks a forwarded shell; --dry-run still works. - getSpawnArgsForWindows rejects cmd metacharacters, which a username like 'A&B' puts in the resolved npx path. Report that instead of a bare throw. - --skill had no help text, and the specs/docs claimed --json needs --dry-run when the skill listing supports it too.
resolveCliCommand returns the bare name when it finds nothing, and
dirname('npx') is '.', so the previous commit prepended the caller's cwd to
the child's PATH — an executable named npx in a checked-out repo would run
with inherited stdio instead of the missing-npx message. Verified closed
against a repro.
Also narrow the spawn-args catch to UnsafeWindowsBatchArgumentsError so an
unrelated throw is not mislabelled, and drop getVersionManagerBinPaths: every
version manager ships node beside npx, so the resolved sibling is enough.
The tests asserted against the ambient PATH, so a dev machine with a trailing separator or a '.' entry failed them spuriously. Stub it and assert the exact constructed value instead, which also kills more mutations than not.toContain.
A one-entry stub made 'append the whole inherited PATH' and 'append its first entry' indistinguishable, which is exactly what the assertion is for.
|
Thanks for this — the headless gap is real and a CLI-native path is the right shape. I reviewed it end to end, rebased it onto current It didn't dispatch on current The install hung on any TTY and installed nothing. This is the big one.
Windows. The hand-rolled SSH relay / WSL. These commands write to the invoker's disk, which every other Smaller things: Known and accepted, not blocking: the CLI trusts npx's exit code rather than re-scanning disk the way Verified: typecheck, |
| function formatNpxCommand(args: string[]): string { | ||
| return `npx ${args.join(' ')}` | ||
| } |
There was a problem hiding this comment.
--dry-run command display doesn't shell-quote arguments
formatNpxCommand joins args with a raw space: a skill name containing a space or metacharacter would produce a displayed command that doesn't round-trip correctly in a shell. Right now all skill names are validated against an allowlist (lowercase, hyphens only) and the URL is a constant, so there's no current exposure — but if either ever changes the user-visible command shown by --dry-run could be misleading without any other indication. Consider using a quoting helper (e.g., wrapping each arg in single-quotes and escaping internal ') if this display string is intended to be copy-pasteable.
Greptile SummaryAdds
Confidence Score: 5/5Safe to merge — purely additive CLI surface with no Electron/renderer/IPC code touched, and the one shared-module change is backward-compatible. All changed paths are covered by targeted tests: skill-name validation, alias resolution, agent detection and mapping, Windows .cmd routing via cmd.exe, ORCA_CLI_CWD forwarding guard, --dry-run/--json lifecycle, and exit-code propagation. The widened install-command builder guards against the dangerous yes:true + no-agents combination at the shared layer. No runtime, IPC, or data-persistence paths are affected. Files Needing Attention: No files require special attention — the most complex file (src/cli/handlers/skills.ts) is well-covered by the new test suite.
|
| Filename | Overview |
|---|---|
| src/cli/handlers/skills.ts | Core implementation — adds resolveSelectedSkillNames, resolveInstallAgentKeys, buildNpxSkillsArgs, runNpxSkills, and createSkillMutationHandler; handles Windows .cmd routing, ORCA_CLI_CWD guard, agent detection, and --dry-run/--json lifecycle correctly. |
| src/shared/agent-feature-install-commands.ts | Shared command builders widened: install switches to one --skill per name (repeated flag form), update accepts string |
| src/shared/skills-cli-agent-keys.ts | New module mapping Orca TuiAgent ids to skills-CLI --agent keys; null entries drop unmappable agents gracefully; universal is always appended so skills reach the shared directory even without a specific agent match. |
| src/cli/skills.test.ts | Comprehensive new tests covering listing, --skill/--all/--local/--dry-run/--json combinations, ORCA_CLI_CWD guard, Windows .cmd routing, agent detection/deduplication, exit-code forwarding, and legacy alias resolution via mocked child_process. |
| src/shared/skills-cli-agent-keys.test.ts | New tests pin every SKILLS_CLI_AGENT_KEY_BY_TUI_AGENT value against a hardcoded snapshot of the skills CLI's valid-key list (v1.5.20) and assert full TuiAgent coverage to catch new agents silently falling through. |
| src/cli/specs/skills.ts | Adds allowedFlags, notes, and examples for install and update; correctly omits --agent from update's allowedFlags since update never takes install targets. |
| src/cli/args.ts | Adds 'local' to BOOLEAN_FLAGS and 'skill' to REPEATABLE_STRING_FLAGS; both are narrow, targeted additions with no risk to other commands. |
| docs/reference/headless-linux-server.md | Adds a new section documenting install/update usage, the --agent requirement, --dry-run, and SSH/WSL forwarding behaviour; content matches the implementation accurately. |
Reviews (6): Last reviewed commit: "Merge commit 'bbb3e7e5ee4a7c861d2f0e3a17..." | Re-trigger Greptile
… CLI's Converges with stablyai#11254 (fixes stablyai#9567): a pasted Settings install stalls on npm's fetch prompt and the skills agent picker exactly as a spawned one does, so `npx --yes` and `-y` are unconditional on install rather than a CLI-only opt-in. The desktop and CLI install commands are now byte-identical. Update keeps them opt-in and the CLI alone passes them: the pasted update string has to stay `npx skills update <name> --global` because normalizeWindowsSkillUpdateCommand parses that exact shape to swap in a reinstall on native Windows, and the extra flags stop it matching. Pinned with a test so the two cannot drift apart silently.
|
Follow-up after cross-checking this against the wider skill-install cluster — one substantive change, pushed as The Update deliberately stays opt-in, and that asymmetry is load-bearing. On the two claims flagged as unverified — here's the evidence. Repeated
So the variadic form silently swallows names the repo doesn't have. The repeated form is the hardening, not the risk — worth considering for #11254, which currently keeps the variadic shape.
One thing this does not fix, and shouldn't: Gates on the pushed head: typecheck, |
…just the CLI's" This reverts commit abc9306.
`skills add -y` skips the agent picker, and with no agent detected it falls into a branch that installs into every agent it knows. Measured on a bare home: 52 new top-level agent config directories and 53 symlinks, for agents the host does not have. Real Windows validation showed the same, 52 dirs / 54 junctions. Pass an explicit --agent list instead, built from Orca's own detection plus the shared .agents/skills directory Orca reads, which makes that branch unreachable. Same bare home with --agent universal: 1 directory, 0 symlinks, skill still installed. When Orca detects nothing, refuse and ask for --agent rather than guessing at ~75 targets. The GUI command is untouched — its picker is deliberate. --agent takes one comma-separated value rather than repeating, because `agent` is a single-value flag on other commands and the repeatable set is process-wide.
…nstall Both reviewers found the same one: `--agent ','` trims to no tokens, which skipped the no-agent refusal AND emitted no --agent, producing exactly the command this scoping exists to prevent. Reproduced on the built binary. Enforced at the choke point instead of on the input — the install args builder now refuses -y with an empty target list, so no caller present or future can express that combination. `--agent` with a bare, empty or separator-only value is a clear error rather than a silent fallback. Also from review: run the forwarded-shell refusal before target resolution, so the message never carries the wrong host's agent list or gets replaced by a no-agent error; give `--agent` command-specific help instead of inheriting the terminal-launch wording; and follow Orca's own evidence on two mappings — openclaude reads Claude-owned roots (native-chat-agent-profiles), and trae is detected by `traecli`, an alias only TRAE CN ships.
The emptiness guard was not enough. The skills CLI drops a --agent value that starts with `-` without erroring, which leaves its target list empty and falls into the same all-agents branch as passing no --agent at all — so `--agent -y` reproduced the 52-directory install on a bare host. Confirmed end to end. Validate shape, not just emptiness, at the same choke point, so any token that reaches the argv is one the CLI will keep. `*` stays allowed since asking for every agent explicitly is a choice, not an accident. An unknown but plausible key is still left to the CLI, which rejects it loudly before writing anything. Also pin the two evidence-based mappings and the forwarded-shell ordering, which mutation testing showed were unasserted.
…-command-to-install-skills
|
looking into it |
…s skill setup (stablyai#9201) Adds `orca skills install` and `orca skills update` so skills can be set up without the GUI — SSH hosts, containers, CI. Previously `orca skills` had only `list` and `get`, so there was no headless path. **Agent targeting is scoped explicitly rather than delegated to detection.** The `skills` CLI decides which agents to install into, and with `-y` and zero detected agents it takes `targetAgents = validAgents` — all ~75. That is not a corner case for a headless CLI: a fresh SSH box or container with no agent installed is the normal starting state. Measured on a bare host, the unscoped command created **52 top-level agent directories and 54 junctions** (one real payload in `~/.agents/skills`, the rest links) on Windows, and 52/53 on macOS. The CLI now passes `--agent` derived from Orca's own detection, mapped to the `skills` key namespace, plus `universal`. Supplying `--agent` makes `runAdd` use it directly and never call `detectInstalledAgents()`, so the fan-out branch is unreachable. On a bare host it now refuses with `No coding agent detected on this host` and exit 1, creating nothing. Same command with scoping: **1 directory, 0 junctions.** `universal` alone would under-install — Claude Code is not in that set, and 19 of 28 mapped keys write agent-private homes `universal` never touches. `--agent '*'` is the bug itself. The mapping is hedged three ways: `null` for any agent whose key could not be confirmed, `satisfies Record<TuiAgent, …>` so a new Orca agent is a compile error, and a test pinning every mapped key against the CLI's own valid list. Fixed during review — two holes that each restored the full fan-out through a different door: - `--agent ','` trimmed to nothing, which skipped the refusal *and* emitted no `--agent`. - `--agent -y` passed an emptiness check, and the vendor CLI silently drops `-`-leading values, re-emptying its list. The real invariant is argument *shape*, not emptiness, and it is now enforced at the choke point in `buildAgentFeatureSkillInstallArgs`, so no caller can emit `-y` without a usable target. `*` remains allowed — asking for every agent explicitly is a choice, not an accident. Verified with 51 hostile inputs through the built binary, each recorded argv replayed through the vendor's own parser. Also fixed: the `ORCA_CLI_CWD` refusal now runs before target resolution (it was quoting the wrong host's agent list), and `--dry-run` is refused in a forwarded shell rather than printing a command naming the wrong machine. Validated on a real Windows host across PowerShell 7, PowerShell 5.1, cmd.exe and Git Bash: `.cmd` shims route through `cmd.exe` and `.exe` shims spawn directly (proved with instrumented shims, not inferred), the ENOENT path produces an actionable error rather than a silent failure, and `skills update` genuinely restores a corrupted skill byte-for-byte. Known, not addressed here — both upstream behaviours this only forwards: a partial install failure exits 0, and "no installed skills found" exits 0. Both are invisible to the headless callers this feature exists for. Co-authored-by: scastanoh21 <[email protected]>
Summary
Adds
orca skills installandorca skills update— local-only (no running Orca runtime needed) CLI commands that install and refresh Orca's bundled agent skills without the desktop app. Today the only documented paths are thenpx skills add ... --global/npx skills update ... --globalcommands pre-filled by Orca's Settings UI — on a headless host (SSH, container, CI) there's no Settings UI to copy them from.orca skills install/orca skills updatewith no args list the installable/updatable skill names.--skill <name> [--skill <name> ...]or--allresolve to the samenpx skills add <repo> --skill <names...>/npx skills update <names...>commands Settings would show (via the sharedbuildAgentFeatureSkill{Install,Update}Commandhelpers), then run them vianpx, forwarding output and exit code.--global, matching current Settings behavior);--localtargets the current project instead.--dry-runprints the resolved command without running it.--jsonis only valid together with--dry-run(a real run streams npx's own non-JSON stdout live) and is rejected otherwise with a clear error.skills get.createSkillMutationHandler), and the shared update-command builder now accepts multiple skill names plus a{ global }option — single-string callers in the Settings UI are unaffected (the parameter is astring | readonly string[]union defaulting to global).Also simplifies
orca skills list's plain-text output to just the bare skill names, one per line — the previous format printedname: <full multi-sentence description>as one very long unwrapped line per skill, which was unreadable in a real terminal.--jsonoutput is unchanged (still includes full descriptions).Documented both commands in
docs/reference/headless-linux-server.mdfor the headless-host use case they target.Screenshots
No visual change (CLI-only; no renderer/UI code touched).
Testing
pnpm lint— passes for all changed files (oxlint, styled-scrollbars check, reliability gates, max-lines ratchet, bundled-skill-guides/skill-bundle-manifest verification, localization catalog/coverage all green). Note:pnpm run lint:switch-exhaustivenessfails onmainitself (pre-existing, insrc/renderer/src/components/native-chat/native-chat-session-option-labels.tsandsrc/renderer/src/components/skills/skill-freshness-group.tsx) — confirmed by stashing this branch's changes and re-running against a clean checkout; neither file is touched by this PR.pnpm typecheck— clean (node, cli, web configs).pnpm test— passes for everything this PR touches:src/cli506/506,src/shared/agent-feature-install-commands.test.ts7/7, and a 290-file / 2665-test renderer sweep covering every UI caller of the shared update-command helper whose signature changed. The full monorepo run has 43 pre-existing failures across 8 renderer test files (window.localStorageundefined in the local sandbox's happy-dom environment) — confirmed pre-existing by stashing this branch's changes and reproducing identically on a clean checkout; none of those files are touched by this PR.pnpm build— the desktop + native build passed on the earlier install-only commits; this delta only adds CLI +src/sharedcode (no native/electron/web runtime surface), re-verified viapnpm build:cliplus all three typecheck configs, and exercised against the rebuilt binary (orca skills install/update,list, group help).orca skills installandorca skills updatebehavior (listing,--skill/--all/--local/--dry-runcombinations,--json-without---dry-runrejection, unknown-skill/conflicting-flag errors, legacy alias resolution, realnpxspawn args + exit-code/error propagation via a mockedchild_process), the simplifiedskills listoutput, group/root help listing both new commands, and the multi-skill +{ global }update-command builder insrc/shared/agent-feature-install-commands.test.ts.AI Review Report
Reviewed with Claude Code (this PR was written by an AI coding agent under human supervision).
npxis spawned withshell: process.platform === 'win32'(Windows only resolves.cmdshims through a shell; macOS/Linux spawnnpxdirectly), mirroring the existing pattern insrc/cli/runtime/launch.ts. No hardcoded path separators; no OS-specific string literals beyond that one guarded branch.skills list/get/install/updateare all local-only handlers (never touchctx.client/RuntimeClient), so they work identically over SSH-managed terminals, WSL, or a bare local shell — no runtime/network dependency.src/shared/agent-feature-install-commands.ts(the same source Settings uses). The one shared-module change — wideningbuildAgentFeatureSkillUpdateCommandto accept a name array +{ global }— is backward compatible for its many single-string UI callers (verified by the 290-file renderer sweep passing unmodified).import()s the large generated skill-guide table only when it runs, so unrelated CLI commands don't pay that cost.npxis invoked with an explicit argv array (never a shell string built from user input) except for the Windowsshell: truecase, where the only interpolated values are the fixedORCA_SKILLS_REPOSITORY_URLconstant and skill names validated against a canonical allowlist before use (unknown names are rejected, never passed through). No new file writes from Orca itself — installation/updating is delegated to the existing, already-documentednpx skillscommunity tool, exactly as Orca Settings already recommends; this PR only adds CLI-native ways to construct/run those same commands.Security Audit
--skillvalues are resolved against the bundled skill registry (BUNDLED_SKILL_GUIDES, including legacy aliases) before use; anything not in that allowlist is rejected with aninvalid_argumenterror listing the valid names. No arbitrary string is passed through to command execution.child_process.spawnis called with an argv array, not a shell string, on macOS/Linux. On Windows,shell: trueis required for Node to resolve thenpx.cmdshim, but the argv values passed alongside it are limited to the fixed repo URL and allowlisted skill names above, so this does not introduce a shell-injection surface.npx skillspackage (already the documented install/update mechanism referenced throughoutsrc/shared/agent-feature-install-commands.tsand Orca Settings).Notes
shell: truerequirement for spawningnpx.lint:switch-exhaustivenessfailures and the pre-existing renderer test failures noted above are unrelated to this change and were not introduced or touched by it.Twitter/X: @scastano21
ELI5
Headless hosts can install and update Orca's bundled agent skills from the CLI with orca skills install and orca skills update. You no longer need the desktop Settings UI to copy npx commands.