@h-rig/cli 0.0.6-alpha.28 → 0.0.6-alpha.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/bin/rig.js +421 -241
  2. package/dist/src/commands/_connection-state.js +0 -2
  3. package/dist/src/commands/_doctor-checks.js +0 -2
  4. package/dist/src/commands/_help-catalog.js +27 -3
  5. package/dist/src/commands/_operator-view.js +0 -2
  6. package/dist/src/commands/_parsers.js +0 -2
  7. package/dist/src/commands/_pi-frontend.js +0 -2
  8. package/dist/src/commands/_pi-worker-bridge-extension.js +0 -2
  9. package/dist/src/commands/_policy.js +0 -2
  10. package/dist/src/commands/_preflight.js +0 -2
  11. package/dist/src/commands/_run-driver-helpers.js +0 -2
  12. package/dist/src/commands/_server-client.js +0 -2
  13. package/dist/src/commands/_snapshot-upload.js +0 -2
  14. package/dist/src/commands/agent.js +0 -2
  15. package/dist/src/commands/browser.js +0 -2
  16. package/dist/src/commands/connect.js +0 -2
  17. package/dist/src/commands/dist.js +0 -2
  18. package/dist/src/commands/doctor.js +0 -2
  19. package/dist/src/commands/github.js +0 -2
  20. package/dist/src/commands/inbox.js +0 -2
  21. package/dist/src/commands/init.js +0 -2
  22. package/dist/src/commands/inspect.js +0 -2
  23. package/dist/src/commands/inspector.js +0 -2
  24. package/dist/src/commands/plugin.js +73 -19
  25. package/dist/src/commands/profile-and-review.js +0 -2
  26. package/dist/src/commands/queue.js +0 -2
  27. package/dist/src/commands/remote.js +0 -2
  28. package/dist/src/commands/repo-git-harness.js +2 -4
  29. package/dist/src/commands/run.js +2 -4
  30. package/dist/src/commands/server.js +0 -2
  31. package/dist/src/commands/setup.js +0 -8
  32. package/dist/src/commands/task-report-bug.js +0 -2
  33. package/dist/src/commands/task-run-driver.js +0 -2
  34. package/dist/src/commands/task.js +34 -7
  35. package/dist/src/commands/test.js +0 -2
  36. package/dist/src/commands/workspace.js +0 -2
  37. package/dist/src/commands.js +403 -214
  38. package/dist/src/index.js +415 -238
  39. package/dist/src/runner.js +2 -17
  40. package/package.json +6 -6
@@ -8,8 +8,6 @@ import { dirname, resolve } from "path";
8
8
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
9
9
  import { CliError } from "@rig/runtime/control-plane/errors";
10
10
  import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
11
- import { PluginManager } from "@rig/runtime/control-plane/runtime/plugins";
12
- import { loadRuntimeContextFromEnv } from "@rig/runtime/control-plane/runtime/context";
13
11
  import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
14
12
  import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
15
13
 
@@ -9,8 +9,6 @@ import { resolve as resolve4 } from "path";
9
9
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
10
10
  import { CliError } from "@rig/runtime/control-plane/errors";
11
11
  import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
12
- import { PluginManager } from "@rig/runtime/control-plane/runtime/plugins";
13
- import { loadRuntimeContextFromEnv } from "@rig/runtime/control-plane/runtime/context";
14
12
  import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
15
13
  import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
16
14
 
@@ -86,6 +86,9 @@ var PRIMARY_GROUPS = [
86
86
  { command: "show <id>|--task <id> [--raw]", description: "Show a human task summary; --raw prints the full payload.", primary: true },
87
87
  { command: "run [#<issue>|<task-id>|--next|--task <id>]", description: "Submit a task run; interactive follows with bundled Pi.", primary: true },
88
88
  { command: "validate|verify [--task <id>]", description: "Run configured task checks/review gates." },
89
+ { command: "details --task <id>", description: "Show full task info from the configured source." },
90
+ { command: "reopen [--task <id> | --all] [--reason <text>]", description: "Reopen closed task(s) in the configured source." },
91
+ { command: "reset --task <id>", description: "Compatibility spelling of `reopen --task <id>`." },
89
92
  { command: "artifacts|artifact-dir|artifact-write", description: "Inspect or write task artifacts." },
90
93
  { command: "report-bug", description: "Create a structured bug report/task." }
91
94
  ],
@@ -110,6 +113,8 @@ var PRIMARY_GROUPS = [
110
113
  { command: "attach <run-id>|--run <id> [--follow]", description: "Attach to the run; --follow launches native bundled Pi for live Pi runs.", primary: true },
111
114
  { command: "stop [<run-id>|--run <id>]", description: "Request stop for one run or local active runs.", primary: true },
112
115
  { command: "timeline --run <id> [--follow]", description: "Stream raw run timeline events." },
116
+ { command: "resume", description: "Resume the most recent interrupted local run." },
117
+ { command: "restart", description: "Restart the most recent local run from a clean runtime." },
113
118
  { command: "delete|cleanup", description: "Remove completed run records/artifacts." }
114
119
  ],
115
120
  examples: [
@@ -196,8 +201,28 @@ var ADVANCED_GROUPS = [
196
201
  { name: "inspect", summary: "Inspect logs, artifacts, graphs, failures.", usage: ["rig inspect <logs|artifacts|failures|graph|audit|diff>"], commands: [{ command: "logs --task <id>", description: "Inspect task logs." }] },
197
202
  { name: "repo", summary: "Repository sync/baseline helpers.", usage: ["rig repo <sync|reset-baseline>"], commands: [{ command: "sync", description: "Sync project repository state." }] },
198
203
  { name: "profile", summary: "Runtime profile/model defaults.", usage: ["rig profile <show|set>"], commands: [{ command: "show", description: "Show active profile." }] },
199
- { name: "browser", summary: "Browser/app diagnostics.", usage: ["rig browser <help|explain|demo|app>"], commands: [{ command: "help", description: "Browser command help." }] },
200
- { name: "plugin", summary: "Plugin validation/listing.", usage: ["rig plugin <list|validate>"], commands: [{ command: "list", description: "List plugins." }] },
204
+ {
205
+ name: "browser",
206
+ summary: "Browser/app diagnostics for browser-required tasks.",
207
+ usage: ["rig browser <help|explain|demo|app|hp-next> [options]"],
208
+ commands: [
209
+ { command: "help", description: "Rich browser command help (canonical: `rig browser help`)." },
210
+ { command: "explain", description: "Explain the browser-required task contract." },
211
+ { command: "demo", description: "Run browser demo flows against a local page." },
212
+ { command: "app", description: "Launch the Rig Browser workstation app." },
213
+ { command: "hp-next <dev|check|e2e|reset>", description: "Drive the hp-next browser test harness." }
214
+ ]
215
+ },
216
+ {
217
+ name: "plugin",
218
+ summary: "Plugin listing, validation, and plugin-contributed commands.",
219
+ usage: ["rig plugin <list|validate|run> [options]"],
220
+ commands: [
221
+ { command: "list", description: "List plugins declared in rig.config.ts and their contributions." },
222
+ { command: "validate --task <id>", description: "Run plugin-contributed validators for a task." },
223
+ { command: "run <command-id> [args...]", description: "Execute a plugin-contributed CLI command (also callable as `rig <command-id>`)." }
224
+ ]
225
+ },
201
226
  { name: "queue", summary: "Run task queues locally.", usage: ["rig queue run [options]"], commands: [{ command: "run", description: "Process queue work." }] },
202
227
  { name: "agent", summary: "Runtime agent workspace helpers.", usage: ["rig agent <list|prepare|run|cleanup>"], commands: [{ command: "list", description: "List prepared agents." }] },
203
228
  { name: "inspector", summary: "Event stream and drift scanners.", usage: ["rig inspector <stream|scan-upstream-drift>"], commands: [{ command: "stream", description: "Stream events." }] },
@@ -212,7 +237,6 @@ var ADVANCED_COMMANDS = [
212
237
  { command: "rig server task-run ...", description: "Internal server-owned task execution entry point." },
213
238
  { command: "rig server notify-test [--event <type>]", description: "Internal event notification smoke command." },
214
239
  { command: "rig run start|start-serial|start-parallel", description: "Compatibility local run starters; prefer `rig task run ...`." },
215
- { command: "rig setup install-agent-shell", description: "Development helper for materializing the agent shell." },
216
240
  { command: "rig remote orchestrate-*", description: "Compatibility remote orchestration commands." }
217
241
  ];
218
242
  var ALL_GROUPS = [...PRIMARY_GROUPS, ...ADVANCED_GROUPS];
@@ -7,8 +7,6 @@ import { resolve as resolve2 } from "path";
7
7
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
8
8
  import { CliError } from "@rig/runtime/control-plane/errors";
9
9
  import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
10
- import { PluginManager } from "@rig/runtime/control-plane/runtime/plugins";
11
- import { loadRuntimeContextFromEnv } from "@rig/runtime/control-plane/runtime/context";
12
10
  import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
13
11
  import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
14
12
 
@@ -9,8 +9,6 @@ import { resolve } from "path";
9
9
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
10
10
  import { CliError } from "@rig/runtime/control-plane/errors";
11
11
  import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
12
- import { PluginManager } from "@rig/runtime/control-plane/runtime/plugins";
13
- import { loadRuntimeContextFromEnv } from "@rig/runtime/control-plane/runtime/context";
14
12
  import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
15
13
  import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
16
14
 
@@ -13,8 +13,6 @@ import { resolve as resolve2 } from "path";
13
13
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
14
14
  import { CliError } from "@rig/runtime/control-plane/errors";
15
15
  import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
16
- import { PluginManager } from "@rig/runtime/control-plane/runtime/plugins";
17
- import { loadRuntimeContextFromEnv } from "@rig/runtime/control-plane/runtime/context";
18
16
  import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
19
17
  import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
20
18
 
@@ -7,8 +7,6 @@ import { resolve as resolve2 } from "path";
7
7
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
8
8
  import { CliError } from "@rig/runtime/control-plane/errors";
9
9
  import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
10
- import { PluginManager } from "@rig/runtime/control-plane/runtime/plugins";
11
- import { loadRuntimeContextFromEnv } from "@rig/runtime/control-plane/runtime/context";
12
10
  import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
13
11
  import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
14
12
 
@@ -7,8 +7,6 @@ import { resolve } from "path";
7
7
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
8
8
  import { CliError } from "@rig/runtime/control-plane/errors";
9
9
  import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
10
- import { PluginManager } from "@rig/runtime/control-plane/runtime/plugins";
11
- import { loadRuntimeContextFromEnv } from "@rig/runtime/control-plane/runtime/context";
12
10
  import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
13
11
  import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
14
12
  function formatCommand(parts) {
@@ -3,8 +3,6 @@
3
3
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
4
4
  import { CliError } from "@rig/runtime/control-plane/errors";
5
5
  import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
6
- import { PluginManager } from "@rig/runtime/control-plane/runtime/plugins";
7
- import { loadRuntimeContextFromEnv } from "@rig/runtime/control-plane/runtime/context";
8
6
  import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
9
7
  import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
10
8
 
@@ -7,8 +7,6 @@ import { resolve as resolve3 } from "path";
7
7
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
8
8
  import { CliError } from "@rig/runtime/control-plane/errors";
9
9
  import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
10
- import { PluginManager } from "@rig/runtime/control-plane/runtime/plugins";
11
- import { loadRuntimeContextFromEnv } from "@rig/runtime/control-plane/runtime/context";
12
10
  import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
13
11
  import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
14
12
 
@@ -7,8 +7,6 @@ import { resolve as resolve2 } from "path";
7
7
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
8
8
  import { CliError } from "@rig/runtime/control-plane/errors";
9
9
  import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
10
- import { PluginManager } from "@rig/runtime/control-plane/runtime/plugins";
11
- import { loadRuntimeContextFromEnv } from "@rig/runtime/control-plane/runtime/context";
12
10
  import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
13
11
  import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
14
12
 
@@ -11,8 +11,6 @@ import { resolve as resolve2 } from "path";
11
11
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
12
12
  import { CliError } from "@rig/runtime/control-plane/errors";
13
13
  import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
14
- import { PluginManager } from "@rig/runtime/control-plane/runtime/plugins";
15
- import { loadRuntimeContextFromEnv } from "@rig/runtime/control-plane/runtime/context";
16
14
  import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
17
15
  import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
18
16
 
@@ -6,8 +6,6 @@ import { resolve as resolve2 } from "path";
6
6
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
7
7
  import { CliError } from "@rig/runtime/control-plane/errors";
8
8
  import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
9
- import { PluginManager } from "@rig/runtime/control-plane/runtime/plugins";
10
- import { loadRuntimeContextFromEnv } from "@rig/runtime/control-plane/runtime/context";
11
9
  import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
12
10
  import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
13
11
  function takeFlag(args, flag) {
@@ -12,8 +12,6 @@ import pc2 from "picocolors";
12
12
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
13
13
  import { CliError } from "@rig/runtime/control-plane/errors";
14
14
  import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
15
- import { PluginManager } from "@rig/runtime/control-plane/runtime/plugins";
16
- import { loadRuntimeContextFromEnv } from "@rig/runtime/control-plane/runtime/context";
17
15
  import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
18
16
  import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
19
17
  function takeFlag(args, flag) {
@@ -6,8 +6,6 @@ import { cancel, isCancel, select } from "@clack/prompts";
6
6
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
7
7
  import { CliError } from "@rig/runtime/control-plane/errors";
8
8
  import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
9
- import { PluginManager } from "@rig/runtime/control-plane/runtime/plugins";
10
- import { loadRuntimeContextFromEnv } from "@rig/runtime/control-plane/runtime/context";
11
9
  import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
12
10
  import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
13
11
  function requireNoExtraArgs(args, usage) {
@@ -19,8 +19,6 @@ import { resolve as resolve3 } from "path";
19
19
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
20
20
  import { CliError } from "@rig/runtime/control-plane/errors";
21
21
  import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
22
- import { PluginManager } from "@rig/runtime/control-plane/runtime/plugins";
23
- import { loadRuntimeContextFromEnv } from "@rig/runtime/control-plane/runtime/context";
24
22
  import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
25
23
  import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
26
24
  function takeOption(args, option) {
@@ -5,8 +5,6 @@ var __require = import.meta.require;
5
5
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
6
6
  import { CliError } from "@rig/runtime/control-plane/errors";
7
7
  import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
8
- import { PluginManager } from "@rig/runtime/control-plane/runtime/plugins";
9
- import { loadRuntimeContextFromEnv } from "@rig/runtime/control-plane/runtime/context";
10
8
  import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
11
9
  import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
12
10
  function requireNoExtraArgs(args, usage) {
@@ -6,8 +6,6 @@ import { spawnSync } from "child_process";
6
6
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
7
7
  import { CliError } from "@rig/runtime/control-plane/errors";
8
8
  import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
9
- import { PluginManager } from "@rig/runtime/control-plane/runtime/plugins";
10
- import { loadRuntimeContextFromEnv } from "@rig/runtime/control-plane/runtime/context";
11
9
  import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
12
10
  import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
13
11
  function takeOption(args, option) {
@@ -7,8 +7,6 @@ import { resolve as resolve3 } from "path";
7
7
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
8
8
  import { CliError } from "@rig/runtime/control-plane/errors";
9
9
  import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
10
- import { PluginManager } from "@rig/runtime/control-plane/runtime/plugins";
11
- import { loadRuntimeContextFromEnv } from "@rig/runtime/control-plane/runtime/context";
12
10
  import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
13
11
  import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
14
12
  function takeOption(args, option) {
@@ -10,8 +10,6 @@ import { resolve as resolve6 } from "path";
10
10
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
11
11
  import { CliError } from "@rig/runtime/control-plane/errors";
12
12
  import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
13
- import { PluginManager } from "@rig/runtime/control-plane/runtime/plugins";
14
- import { loadRuntimeContextFromEnv } from "@rig/runtime/control-plane/runtime/context";
15
13
  import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
16
14
  import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
17
15
  function takeFlag(args, flag) {
@@ -7,8 +7,6 @@ import { resolve } from "path";
7
7
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
8
8
  import { CliError } from "@rig/runtime/control-plane/errors";
9
9
  import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
10
- import { PluginManager } from "@rig/runtime/control-plane/runtime/plugins";
11
- import { loadRuntimeContextFromEnv } from "@rig/runtime/control-plane/runtime/context";
12
10
  import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
13
11
  import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
14
12
  function takeOption(args, option) {
@@ -6,8 +6,6 @@ import { iterateServerSentEvents } from "@rig/client";
6
6
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
7
7
  import { CliError } from "@rig/runtime/control-plane/errors";
8
8
  import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
9
- import { PluginManager } from "@rig/runtime/control-plane/runtime/plugins";
10
- import { loadRuntimeContextFromEnv } from "@rig/runtime/control-plane/runtime/context";
11
9
  import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
12
10
  import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
13
11
  function takeFlag(args, flag) {
@@ -5,8 +5,6 @@ var __require = import.meta.require;
5
5
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
6
6
  import { CliError } from "@rig/runtime/control-plane/errors";
7
7
  import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
8
- import { PluginManager } from "@rig/runtime/control-plane/runtime/plugins";
9
- import { loadRuntimeContextFromEnv } from "@rig/runtime/control-plane/runtime/context";
10
8
  import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
11
9
  import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
12
10
  function takeOption(args, option) {
@@ -43,6 +41,9 @@ Usage: ${usage}`);
43
41
  return taskId;
44
42
  }
45
43
 
44
+ // packages/cli/src/commands/plugin.ts
45
+ import { buildPluginHostContext } from "@rig/runtime/control-plane/plugin-host-context";
46
+
46
47
  // packages/cli/src/commands/_parsers.ts
47
48
  async function loadRigConfigOrNull(projectRoot) {
48
49
  try {
@@ -59,7 +60,6 @@ async function executePlugin(context, args) {
59
60
  switch (command) {
60
61
  case "list": {
61
62
  requireNoExtraArgs(rest, "rig plugin list");
62
- const legacyPlugins = context.plugins.list();
63
63
  const declarative = [];
64
64
  const config = await loadRigConfigOrNull(context.projectRoot);
65
65
  if (config && Array.isArray(config.plugins)) {
@@ -75,16 +75,15 @@ async function executePlugin(context, args) {
75
75
  taskSources: (c.taskSources ?? []).map((s) => s.id),
76
76
  skills: (c.skills ?? []).map((s) => s.id),
77
77
  taskFieldExtensions: (c.taskFieldSchemas ?? []).map((f) => f.id),
78
- cliCommands: (c.cliCommands ?? []).map((c2) => c2.id)
78
+ cliCommands: (c.cliCommands ?? []).map((entry) => entry.id)
79
79
  });
80
80
  }
81
81
  }
82
82
  if (context.outputMode === "text") {
83
- if (legacyPlugins.length === 0 && declarative.length === 0) {
84
- console.log("No plugins loaded.");
85
- }
86
- if (declarative.length > 0) {
87
- console.log("Declarative plugins (rig.config.ts):");
83
+ if (declarative.length === 0) {
84
+ console.log("No plugins loaded. Declare plugins in rig.config.ts.");
85
+ } else {
86
+ console.log("Plugins (rig.config.ts):");
88
87
  for (const p of declarative) {
89
88
  console.log(` ${p.name}@${p.version}`);
90
89
  const lines = [];
@@ -103,31 +102,45 @@ async function executePlugin(context, args) {
103
102
  if (p.taskFieldExtensions.length)
104
103
  lines.push(` task-fields: ${p.taskFieldExtensions.join(", ")}`);
105
104
  if (p.cliCommands.length)
106
- lines.push(` cli-commands: ${p.cliCommands.join(", ")}`);
105
+ lines.push(` cli-commands: ${p.cliCommands.join(", ")} (run with \`rig plugin run <id>\`)`);
107
106
  for (const line of lines)
108
107
  console.log(line);
109
108
  }
110
109
  }
111
- if (legacyPlugins.length > 0) {
112
- console.log("Legacy disk-scan plugins (rig/plugins/):");
113
- for (const plugin of legacyPlugins) {
114
- const validators = plugin.validators.length > 0 ? plugin.validators.join(", ") : "none";
115
- console.log(` ${plugin.name} (validators: ${validators})`);
116
- }
117
- }
118
110
  }
119
111
  return {
120
112
  ok: true,
121
113
  group: "plugin",
122
114
  command,
123
- details: { declarative, legacy: legacyPlugins }
115
+ details: { declarative }
124
116
  };
125
117
  }
126
118
  case "validate": {
127
119
  const { value: task, rest: remaining } = takeOption(rest, "--task");
128
120
  requireNoExtraArgs(remaining, "rig plugin validate --task <task-id>");
129
121
  const taskId = requireTask(task, "rig plugin validate --task <task-id>");
130
- const results = await context.plugins.runValidators(taskId);
122
+ const hostCtx = await buildPluginHostContext(context.projectRoot);
123
+ if (!hostCtx) {
124
+ throw new CliError2(`No rig.config found at ${context.projectRoot}. Run \`rig init\` to set up plugins.`, 2);
125
+ }
126
+ const validators = hostCtx.validatorRegistry.list();
127
+ const results = [];
128
+ for (const validator of validators) {
129
+ try {
130
+ results.push(await validator.run({
131
+ taskId,
132
+ workspaceRoot: context.projectRoot,
133
+ scope: []
134
+ }));
135
+ } catch (error) {
136
+ results.push({
137
+ id: validator.id,
138
+ passed: false,
139
+ summary: `${validator.id} failed unexpectedly`,
140
+ details: `${error}`
141
+ });
142
+ }
143
+ }
131
144
  const passed = results.filter((result) => result.passed).length;
132
145
  const failed = results.length - passed;
133
146
  if (context.outputMode === "text") {
@@ -158,10 +171,51 @@ async function executePlugin(context, args) {
158
171
  }
159
172
  };
160
173
  }
174
+ case "run": {
175
+ const [commandId, ...commandArgs] = rest;
176
+ if (!commandId) {
177
+ throw new CliError2("Usage: rig plugin run <command-id> [args...]");
178
+ }
179
+ const hostCtx = await buildPluginHostContext(context.projectRoot);
180
+ if (!hostCtx) {
181
+ throw new CliError2(`No rig.config found at ${context.projectRoot}. Run \`rig init\` to set up plugins.`, 2);
182
+ }
183
+ const registration = resolvePluginCliCommand(hostCtx.pluginHost.listCliCommands(), commandId);
184
+ if (!registration) {
185
+ const available = hostCtx.pluginHost.listCliCommands().map((entry) => entry.id);
186
+ throw new CliError2(available.length > 0 ? `Unknown plugin command "${commandId}". Available: ${available.join(", ")}` : `No plugin CLI commands are registered. Plugins contribute them via contributes.cliCommands.`, 2);
187
+ }
188
+ if (context.dryRun) {
189
+ if (context.outputMode === "text") {
190
+ console.log(`[dry-run] ${registration.command}${commandArgs.length ? ` ${commandArgs.join(" ")}` : ""}`);
191
+ }
192
+ return { ok: true, group: "plugin", command, details: { id: registration.id, dryRun: true } };
193
+ }
194
+ const proc = Bun.spawn(["bash", "-c", `${registration.command} "$@"`, registration.id, ...commandArgs], {
195
+ cwd: context.projectRoot,
196
+ env: process.env,
197
+ stdin: "inherit",
198
+ stdout: "inherit",
199
+ stderr: "inherit"
200
+ });
201
+ const exitCode = await proc.exited;
202
+ if (exitCode !== 0) {
203
+ throw new CliError2(`Plugin command "${registration.id}" exited with code ${exitCode}.`, exitCode);
204
+ }
205
+ return { ok: true, group: "plugin", command, details: { id: registration.id, exitCode } };
206
+ }
161
207
  default:
162
208
  throw new CliError2(`Unknown plugin command: ${command}`);
163
209
  }
164
210
  }
211
+ function resolvePluginCliCommand(commands, requested) {
212
+ const exact = commands.find((entry) => entry.id === requested);
213
+ if (exact)
214
+ return exact;
215
+ const byLocalPart = commands.filter((entry) => entry.id.split(":").slice(1).join(":") === requested);
216
+ return byLocalPart.length === 1 ? byLocalPart[0] : undefined;
217
+ }
165
218
  export {
219
+ resolvePluginCliCommand,
166
220
  executePlugin
167
221
  };
@@ -3,8 +3,6 @@
3
3
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
4
4
  import { CliError } from "@rig/runtime/control-plane/errors";
5
5
  import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
6
- import { PluginManager } from "@rig/runtime/control-plane/runtime/plugins";
7
- import { loadRuntimeContextFromEnv } from "@rig/runtime/control-plane/runtime/context";
8
6
  import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
9
7
  import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
10
8
  function takeOption(args, option) {
@@ -3,8 +3,6 @@
3
3
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
4
4
  import { CliError } from "@rig/runtime/control-plane/errors";
5
5
  import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
6
- import { PluginManager } from "@rig/runtime/control-plane/runtime/plugins";
7
- import { loadRuntimeContextFromEnv } from "@rig/runtime/control-plane/runtime/context";
8
6
  import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
9
7
  import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
10
8
  function takeFlag(args, flag) {
@@ -3,8 +3,6 @@
3
3
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
4
4
  import { CliError } from "@rig/runtime/control-plane/errors";
5
5
  import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
6
- import { PluginManager } from "@rig/runtime/control-plane/runtime/plugins";
7
- import { loadRuntimeContextFromEnv } from "@rig/runtime/control-plane/runtime/context";
8
6
  import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
9
7
  import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
10
8
  function takeFlag(args, flag) {
@@ -3,8 +3,6 @@
3
3
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
4
4
  import { CliError } from "@rig/runtime/control-plane/errors";
5
5
  import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
6
- import { PluginManager } from "@rig/runtime/control-plane/runtime/plugins";
7
- import { loadRuntimeContextFromEnv } from "@rig/runtime/control-plane/runtime/context";
8
6
  import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
9
7
  import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
10
8
  function formatCommand(parts) {
@@ -187,7 +185,7 @@ async function executeGit(context, args) {
187
185
  return { ok: true, group: "git", command: args[0] ?? "git" };
188
186
  }
189
187
  try {
190
- await executeHarnessCommand(context.projectRoot, context.plugins, ["git", ...args]);
188
+ await executeHarnessCommand(context.projectRoot, ["git", ...args]);
191
189
  } catch (error) {
192
190
  throw new CliError2(error instanceof Error ? error.message : String(error), 2);
193
191
  }
@@ -208,7 +206,7 @@ async function executeHarness(context, args) {
208
206
  return { ok: true, group: "harness", command: args[0] ?? "harness" };
209
207
  }
210
208
  try {
211
- await executeHarnessCommand(context.projectRoot, context.plugins, args);
209
+ await executeHarnessCommand(context.projectRoot, args);
212
210
  } catch (error) {
213
211
  throw new CliError2(error instanceof Error ? error.message : String(error), 2);
214
212
  }
@@ -6,8 +6,6 @@ import { createInterface as createInterface2 } from "readline/promises";
6
6
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
7
7
  import { CliError } from "@rig/runtime/control-plane/errors";
8
8
  import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
9
- import { PluginManager } from "@rig/runtime/control-plane/runtime/plugins";
10
- import { loadRuntimeContextFromEnv } from "@rig/runtime/control-plane/runtime/context";
11
9
  import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
12
10
  import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
13
11
  function takeFlag(args, flag) {
@@ -66,7 +64,7 @@ import {
66
64
  startRun,
67
65
  defaultStartRunOptions
68
66
  } from "@rig/runtime/control-plane/native/run-ops";
69
- import { loadRuntimeContextFromEnv as loadRuntimeContextFromEnv2 } from "@rig/runtime/control-plane/runtime/context";
67
+ import { loadRuntimeContextFromEnv } from "@rig/runtime/control-plane/runtime/context";
70
68
 
71
69
  // packages/cli/src/commands/_parsers.ts
72
70
  function parsePositiveInt(value, option, fallback) {
@@ -1504,7 +1502,7 @@ async function promptForEpicSelection(projectRoot, command) {
1504
1502
  }
1505
1503
  async function executeRun(context, args) {
1506
1504
  const [command = "status", ...rest] = args;
1507
- const runtimeContext = loadRuntimeContextFromEnv2() ?? undefined;
1505
+ const runtimeContext = loadRuntimeContextFromEnv() ?? undefined;
1508
1506
  switch (command) {
1509
1507
  case "list": {
1510
1508
  requireNoExtraArgs(rest, "rig run list");
@@ -3,8 +3,6 @@
3
3
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
4
4
  import { CliError } from "@rig/runtime/control-plane/errors";
5
5
  import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
6
- import { PluginManager } from "@rig/runtime/control-plane/runtime/plugins";
7
- import { loadRuntimeContextFromEnv } from "@rig/runtime/control-plane/runtime/context";
8
6
  import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
9
7
  import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
10
8
  function takeOption(args, option) {
@@ -9,8 +9,6 @@ import { resolve as resolve6 } from "path";
9
9
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
10
10
  import { CliError } from "@rig/runtime/control-plane/errors";
11
11
  import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
12
- import { PluginManager } from "@rig/runtime/control-plane/runtime/plugins";
13
- import { loadRuntimeContextFromEnv } from "@rig/runtime/control-plane/runtime/context";
14
12
  import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
15
13
  import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
16
14
  function requireNoExtraArgs(args, usage) {
@@ -611,12 +609,6 @@ async function executeSetup(context, args) {
611
609
  requireNoExtraArgs(rest, "rig setup preflight");
612
610
  await withMutedConsole(context.outputMode === "json", () => runSetupPreflight(context.projectRoot));
613
611
  return { ok: true, group: "setup", command };
614
- case "install-agent-shell":
615
- requireNoExtraArgs(rest, "rig setup install-agent-shell");
616
- if (context.outputMode === "text") {
617
- console.log("install-agent-shell is deprecated. Runtime shells now use compiled rig-agent directly.");
618
- }
619
- return { ok: true, group: "setup", command };
620
612
  default:
621
613
  throw new CliError2(`Unknown setup command: ${command}`);
622
614
  }
@@ -9,8 +9,6 @@ import pc from "picocolors";
9
9
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
10
10
  import { CliError } from "@rig/runtime/control-plane/errors";
11
11
  import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
12
- import { PluginManager } from "@rig/runtime/control-plane/runtime/plugins";
13
- import { loadRuntimeContextFromEnv } from "@rig/runtime/control-plane/runtime/context";
14
12
  import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
15
13
  import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
16
14
  function formatCommand(parts) {
@@ -9,8 +9,6 @@ import { createInterface as createLineInterface } from "readline";
9
9
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
10
10
  import { CliError } from "@rig/runtime/control-plane/errors";
11
11
  import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
12
- import { PluginManager } from "@rig/runtime/control-plane/runtime/plugins";
13
- import { loadRuntimeContextFromEnv } from "@rig/runtime/control-plane/runtime/context";
14
12
  import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
15
13
  import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
16
14
  function formatCommand(parts) {