Skip to content

cli: add orca plugin dev load/unload/reload, list, logs, enable and disable - #36288

Merged
nwparker merged 2 commits into
mainfrom
nwparker/plugin-cli-dev-loop
Oct 30, 2026
Merged

nwparker merged 2 commits into
mainfrom
nwparker/plugin-cli-dev-loop

Conversation

@nwparker

@nwparker nwparker commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​170 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​168
Prod 18 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​851 $\color{#cf222e}{\Huge{\mathbf{−}}}$​17 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​834

ELI5

An agent (or a person) can now load a plugin folder into the running Orca, see whether it works, read its logs, and turn plugins on and off, all with orca:

  • orca plugin dev load ./my-theme makes a theme show up in Orca right away. Themes, icons, syntaxes and translations never need approval.
  • orca plugin dev load ./my-panel refuses with approval_required (exit 3) and says exactly what the plugin would be allowed to do. It also prints the exact command to re-run with --approve <fingerprint>. The agent decides whether to ask its user first.
  • The orca-cli skill guide now teaches agents the whole loop: create → validate → dev load → iterate → logs, plus how to publish with Git and gh.

Builds on #36279 and #36280, which have both merged.

What Changed

  • New runtime RPCs: plugins.devLoad, plugins.devUnload, plugins.refresh and plugins.getLogs, all host-admin.
    • devLoad resolves the path on the host, adds it to the same development-folder list Settings → Plugins edits, refreshes, and then applies plugins: require an explicit approve fingerprint for RPC plugin grants #36279's approvePluginFromCli.
    • Content-only plugins run at once. Anything else stays loaded but inert until the matching fingerprint is passed. Every grant is audit-logged as "approved via CLI".
    • devUnload and disable never need approval.
  • New CLI commands, each with --json and the stable exit codes from cli: add orca plugin create, validate and inspect #36280:
    • plugin dev load|reload|unload, plugin list, plugin logs, plugin enable|disable;
    • enable/dev load/dev reload take --approve <fingerprint>;
    • on approval_required/approval_stale, the CLI adds data.command: the caller's exact command plus --approve <fingerprint>.
  • Re-enabling a disabled plugin that runs code needs --approve again. Re-enabling a content-only plugin, or "enabling" one that is already approved and running, needs nothing.
  • New skill-guides/orca-cli/references/plugins.md, with a pointer and gate row in orca-cli.md. It covers commands, approval rules ("confirm with your user unless they already asked for exactly this plugin and access"), and publish steps (tag vX.Y.Z, add the orca-plugin topic with gh, check https://www.onorca.dev/plugins/<owner>/<repo>).
  • docs/reference/plugin-authoring.md gets the CLI dev loop and the same publish steps.
  • Approval message wording: the stale case now also covers a wrong fingerprint.
  • The plugin handler groups moved to src/cli/plugin-handler-groups.ts, which keeps the manifest under its line limit.

Why

This finishes Phase 1 of the plugin CLI for agents: the agent can now see the plugin it made running in Orca. Dev load reuses the existing development-folder setting and watcher rather than adding a parallel mechanism, so the desktop Settings list, hot reload, and dev-consent semantics stay exactly as they are. Approval goes through the single host function from #36279, so install and update in Phase 2 will reuse the same flag. Per the CEO's decision there is no orca plugin publish command; agents follow the documented Git and gh steps.

Linked Issue

N/A (maintainer).

Visual Proof

N/A: this is CLI and RPC only. A dev-loaded plugin shows in the existing Settings → Plugins list, which is unchanged.

Testing

  • Automated tests added/updated
  • plugin-dev-folders.test.ts:
    • a content-only folder activates;
    • a panel stays inert without the flag, then activates with the shown fingerprint;
    • relative paths and a host with plugins off are refused;
    • unload works by key and by path.
  • plugin-runtime.test.ts: the re-run command keeps every other argument and replaces only --approve.
  • Skill guide tests are updated for the new reference.
  • Manual end-to-end against a headless orca serve built from this branch (isolated user data, background launch):
    • a theme dev load gives content-only;
    • an editor dev load exits 3 with the grant list and the re-run command;
    • a wrong fingerprint gives approval_stale, and the right one gives "approved with --approve";
    • disable then enable without the flag asks again;
    • logs and list work;
    • the same flow works over --pairing-code (paired-device caller), and a relative path is refused there;
    • audit.log shows cli:local and cli:paired-device:<id> entries.
  • pnpm tc, pnpm run check:code-quality:changed, and the cli, plugin, runtime-rpc and shared-plugin test folders pass locally (macOS).

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • SSH/remote: development folders are paths on the Orca host.
    • With --environment/--pairing-code, the CLI sends an absolute path, and a relative one is refused.
    • From a bridged shell (ORCA_CLI_CWD), the commands refuse instead of naming the wrong machine's folder.
    • Legacy SSH relay CLIs cannot reach these methods at all.
  • Mixed versions: these are all new methods. An older host answers method_not_found, which the CLI maps to runtime_unsupported ("update Orca on that host"). approvalFingerprint is an optional field.
  • Windows: the host resolves paths with realpath/isAbsolute, and argument quoting in the re-run command follows the existing CLI helper.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • N/A for visuals with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote impact considered
  • Typecheck, lint, tests pass locally; CI covers the rest

@nwparker
nwparker changed the base branch from nwparker/plugin-cli-authoring to main October 30, 2026 08:00
@nwparker
nwparker force-pushed the nwparker/plugin-cli-dev-loop branch 2 times, most recently from 900b137 to c71993a Compare October 30, 2026 08:02
@coderabbitai

coderabbitai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0d9bdb06-689a-47f0-8006-29a1e1713c91
Commits

Reviewing files that changed from the base of the PR and between c71993a and c825db0.

Files ignored due to path filters: 1
  • src/shared/rpc-contract/rpc-params-catalog.generated.ts is excluded by !**/*.generated.*
Files selected for processing: 1
  • src/cli/plugin-authoring/plugin-folder-validation.ts
Files with no reviewable changes: 1
  • src/cli/plugin-authoring/plugin-folder-validation.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

Walkthrough

The CLI adds commands to list plugins and logs, enable or disable plugins, and load, reload, or unload development plugins. New RPC methods and folder operations support development-plugin lifecycle actions, with approval handling for plugins that run code. The changes also add command specifications, tests, and plugin authoring and publishing guidance, including a bundled plugin reference.

Priority: Normal

Merge Risk: Low · up to c825d

The constant relocation introduces no identified regression. Pathless reload approval and cross-platform host paths remain bounded concerns to address or explicitly accept.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 28.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly identifies the primary CLI additions for plugin development and management, including load, unload, reload, list, logs, enable, and disable commands.
Description check Passed The description includes the required sections and provides clear user-facing changes, rationale, linked-issue context, visual-proof justification, testing details, compatibility notes, and checklist …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description includes the required sections and provides clear user-facing changes, rationale, linked-issue context, visual-proof justification, testing details, compatibility notes, and checklist results. The empty Review and omitted AI Disclosure details are non-critical for this maintainer PR.

Full details: Docstring Coverage

Explanation

Docstring coverage is 28.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 25 functions across 18 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Additional comments: 1
docs/reference/plugin-authoring.md-179-180: 1

179-180: Minor · Functional Correctness · Quick win

Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.

Include the directory’s license requirement.

The scaffolded plugin has no license, but the directory excludes repositories without a manifest license or detectable LICENSE file. A plugin can pass validation and follow these steps without being listed. Add this prerequisite here and in skill-guides/orca-cli/references/plugins.md. (raw.githubusercontent.com)


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 61ece383-c41f-41e1-b2fc-8c0ac46cce08
Commits

Reviewing files that changed from the base of the PR and between f7ff1ee and c71993a.

Files ignored due to path filters: 1
  • src/shared/rpc-contract/rpc-params-catalog.generated.ts is excluded by !**/*.generated.*
Files selected for processing: 22
  • config/scripts/generate-bundled-skill-guides.test.mjs
  • docs/reference/plugin-authoring.md
  • skill-guides/orca-cli.md
  • skill-guides/orca-cli/references/plugins.md
  • src/cli/bundled-skill-guides.ts
  • src/cli/handler-group-manifest.ts
  • src/cli/handlers/plugin-authoring.ts
  • src/cli/handlers/plugin-runtime.test.ts
  • src/cli/handlers/plugin-runtime.ts
  • src/cli/handlers/skill-guide-host-gate.test.ts
  • src/cli/plugin-authoring/plugin-folder-validation.ts
  • src/cli/plugin-authoring/plugin-templates.test.ts
  • src/cli/plugin-handler-groups.ts
  • src/cli/root-help-text-primary.ts
  • src/cli/specs/index.ts
  • src/cli/specs/plugin.ts
  • src/main/plugins/plugin-dev-folders.test.ts
  • src/main/plugins/plugin-dev-folders.ts
  • src/main/runtime/rpc/methods/plugins.ts
  • src/main/startup/main-process-plugins.ts
  • src/shared/plugins/approval/plugin-cli-approval.ts
  • src/shared/rpc-contract/plugins-params.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

ORCA plugin validate <dir|orca-plugin.json|orca-catalog.json> --json
ORCA plugin inspect <dir> --json
ORCA plugin dev load <dir> [--approve <fingerprint>] --json
ORCA plugin dev reload [<dir>] [--approve <fingerprint>] --json

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor · Functional Correctness · Quick win

Supported by static analysis

Script executed:

sed -n 160,225p src/cli/handlers/plugin-runtime.ts
rg -n "reload" src/cli/specs/plugin.ts skill-guides/orca-cli/references/plugins.md

Repository: stablyai/orca

Length of output: 3263


Script executed:

set -eu
printf '%s\n' '--- plugin spec ---'
sed -n '90,145p' src/cli/specs/plugin.ts
printf '%s\n' '--- approval and argument helpers ---'
rg -n -F --glob '*.ts' -e "approve" -e "stringFlag" -e "requirePluginPathArg" -e "plugin dev reload" src/cli | sed -n '1,240p'
printf '%s\n' '--- bundled guide occurrences ---'
rg -n -F --glob 'src/cli/bundled-skill-guides.ts' -e "plugin dev reload" -e "ORCA plugin dev reload" src/cli/bundled-skill-guides.ts || true
printf '%s\n' '--- source guide context ---'
sed -n '1,45p' skill-guides/orca-cli/references/plugins.md
printf '%s\n' '--- bundled guide context ---'
python3 - <<'PY'
from pathlib import Path
p = Path('src/cli/bundled-skill-guides.ts')
text = p.read_text()
needle = 'plugin dev reload'
for i, line in enumerate(text.splitlines(), 1):
    if needle in line:
        print(f'{p}:{i}:{line}')
PY

Repository: stablyai/orca

Length of output: 13883


Script executed:

set -eu
printf '%s\n' '--- command spec and parser references ---'
rg -n -F --glob '*.ts' -e 'allowedFlags' -e 'positionalArgs' -e 'CommandSpec' -e 'commandSpec' -e 'validate' src/cli | sed -n '1,260p'
printf '%s\n' '--- reload dispatch and tests ---'
sed -n '1,90p' src/cli/plugin-handler-groups.ts
rg -n -F --glob '*.test.ts' -e 'plugin dev reload' -e 'plugins.refresh' -e '--approve' src/cli | sed -n '1,240p'
printf '%s\n' '--- handler entry context ---'
sed -n '1,175p' src/cli/handlers/plugin-runtime.ts

Repository: stablyai/orca

Length of output: 31000


Script executed:

set -eu
rg -n -F -- 'export function validateCommandAndFlags' 'function validateCommandAndFlags' 'export function parseArgs' 'function parseArgs' src/cli/args.ts
sed -n '1,180p' src/cli/args.ts
sed -n '280,365p' src/cli/args.test.ts

Repository: stablyai/orca

Length of output: 471


Script executed:

set -eu
sed -n '180,270p' src/cli/args.ts

Repository: stablyai/orca

Length of output: 3029


Document --approve only with a directory.

The command accepts a pathless reload, but --approve has no effect in that form. Show the pathless and directory-specific forms separately, and apply the same edit to the bundled guide.

Suggested documentation fix
--- "a/skill-guides/orca-cli/references/plugins.md"
+++ "b/skill-guides/orca-cli/references/plugins.md"
@@ -9,7 +9,8 @@
 ORCA plugin validate <dir|orca-plugin.json|orca-catalog.json> --json
 ORCA plugin inspect <dir> --json
 ORCA plugin dev load <dir> [--approve <fingerprint>] --json
-ORCA plugin dev reload [<dir>] [--approve <fingerprint>] --json
+ORCA plugin dev reload [--json]
+ORCA plugin dev reload <dir> [--approve <fingerprint>] --json
 ORCA plugin dev unload <dir|plugin-key> --json
 ORCA plugin list --json
 ORCA plugin logs <plugin-key> --json

Update the equivalent usage text in src/cli/specs/plugin.ts so CLI help does not present --approve as independent of <dir>.

Committable suggestion

IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
ORCA plugin dev reload [<dir>] [--approve <fingerprint>] --json
ORCA plugin dev reload [--json]
ORCA plugin dev reload <dir> [--approve <fingerprint>] --json

Comment on lines +94 to +99
if (process.env.ORCA_CLI_CWD) {
throw new RuntimeClientError(
'invalid_environment',
'This shell forwards orca to an Orca host on another machine, which cannot read this folder. Run the command on the machine that runs Orca, or pass --environment for an Orca server that has the folder.'
)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor · Functional Correctness · Quick win

Supported by static analysis

Script executed:

#!/bin/bash
# Check where ORCA_CLI_CWD is read and how isRemote is derived.
rg -nP -C4 'ORCA_CLI_CWD' src/cli
rg -nP -C4 'isRemote' src/cli/runtime

Repository: stablyai/orca

Length of output: 10962


Script executed:

set -o pipefail
printf '%s\n' '--- CLI environment and client construction ---'
rg -n -F -C5 -- '--environment' src/cli src | head -n 240
printf '%s\n' '--- RuntimeClient construction and remote assignment ---'
rg -n -F -C6 -- 'new RuntimeClient' src/cli
rg -n -F -C6 -- 'this.remote' src/cli/runtime
printf '%s\n' '--- ORCA_CLI_CWD assignment and bridge handling ---'
rg -n -F -C6 -- 'ORCA_CLI_CWD' src | head -n 240

Repository: stablyai/orca

Length of output: 45667


Script executed:

set -o pipefail
printf '%s\n' '--- src/cli/index.ts ---'
nl -ba src/cli/index.ts | sed -n '1,180p'
printf '%s\n' '--- src/cli/runtime/client.ts constructor ---'
nl -ba src/cli/runtime/client.ts | sed -n '1,115p'
printf '%s\n' '--- RuntimeClient export/constructor wrapper ---'
nl -ba src/cli/runtime-client.ts | sed -n '1,180p'
printf '%s\n' '--- execution host selection ---'
nl -ba src/cli/execution-host-flag.ts | sed -n '1,360p'

Repository: stablyai/orca

Length of output: 29285


Allow explicitly selected remote environments.

When --environment selects a remote RuntimeClient, ORCA_CLI_CWD can remain set by the bridge. The current guard throws before resolving the plugin path, so the documented recovery fails. Keep rejecting forwarded local clients, but allow ctx.client.isRemote.

Suggested fix
--- "a/src/cli/handlers/plugin-runtime.ts"
+++ "b/src/cli/handlers/plugin-runtime.ts"
@@ -91,7 +91,7 @@
 
 /** Development folders are paths on the Orca host, which may not be this machine. */
 function resolveHostPluginPath(ctx: HandlerContext, value: string): string {
-  if (process.env.ORCA_CLI_CWD) {
+  if (process.env.ORCA_CLI_CWD && !ctx.client.isRemote) {
     throw new RuntimeClientError(
       'invalid_environment',
       'This shell forwards orca to an Orca host on another machine, which cannot read this folder. Run the command on the machine that runs Orca, or pass --environment for an Orca server that has the folder.'
Committable suggestion

IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (process.env.ORCA_CLI_CWD) {
throw new RuntimeClientError(
'invalid_environment',
'This shell forwards orca to an Orca host on another machine, which cannot read this folder. Run the command on the machine that runs Orca, or pass --environment for an Orca server that has the folder.'
)
}
if (process.env.ORCA_CLI_CWD && !ctx.client.isRemote) {
throw new RuntimeClientError(
'invalid_environment',
'This shell forwards orca to an Orca host on another machine, which cannot read this folder. Run the command on the machine that runs Orca, or pass --environment for an Orca server that has the folder.'
)
}

Comment on lines +100 to +108
if (isAbsolute(value)) {
return value
}
if (ctx.client.isRemote) {
throw new RuntimeClientError(
'invalid_argument',
'Pass an absolute path on the Orca server; a relative path names a folder on this machine.'
)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor · Functional Correctness · Quick win

Remote path check uses the CLI machine's path rules.

isAbsolute runs on the CLI machine. The host can use a different platform. Example: a Linux CLI sends C:\plugins\dusk to a Windows Orca server with --environment. isAbsolute returns false on POSIX, so lines 103-108 reject a valid host path.

The host already validates this in resolveDevFolder in plugin-dev-folders.ts. It rejects relative paths with invalid_argument, using the host's own isAbsolute. For a remote client, pass the value through and let the host decide.

♻️ Proposed fix
--- "a/src/cli/handlers/plugin-runtime.ts"
+++ "b/src/cli/handlers/plugin-runtime.ts"
@@ -97,16 +97,11 @@
       'This shell forwards orca to an Orca host on another machine, which cannot read this folder. Run the command on the machine that runs Orca, or pass --environment for an Orca server that has the folder.'
     )
   }
-  if (isAbsolute(value)) {
-    return value
-  }
-  if (ctx.client.isRemote) {
-    throw new RuntimeClientError(
-      'invalid_argument',
-      'Pass an absolute path on the Orca server; a relative path names a folder on this machine.'
-    )
-  }
+  if (ctx.client.isRemote || isAbsolute(value)) {
+    // The host validates the path with its own platform rules.
+    return value
+  }
   return resolve(ctx.cwd, value)
 }
 
 function formatPluginRow(plugin: PluginHostListEntry): string {

plugin dev unload has the same assumption at line 208. A remote Windows path is not a plugin key, so it reaches this function and gets the same result.

Committable suggestion

IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (isAbsolute(value)) {
return value
}
if (ctx.client.isRemote) {
throw new RuntimeClientError(
'invalid_argument',
'Pass an absolute path on the Orca server; a relative path names a folder on this machine.'
)
}
if (ctx.client.isRemote || isAbsolute(value)) {
// The host validates the path with its own platform rules.
return value
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant