@h-rig/cli 0.0.6-alpha.3 → 0.0.6-alpha.30

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 (47) hide show
  1. package/dist/bin/rig.js +3606 -1172
  2. package/dist/src/commands/_authority-runs.js +1 -0
  3. package/dist/src/commands/_cli-format.js +369 -0
  4. package/dist/src/commands/_connection-state.js +1 -3
  5. package/dist/src/commands/_doctor-checks.js +13 -27
  6. package/dist/src/commands/_help-catalog.js +388 -0
  7. package/dist/src/commands/_operator-surface.js +204 -0
  8. package/dist/src/commands/_operator-view.js +861 -56
  9. package/dist/src/commands/_parsers.js +0 -2
  10. package/dist/src/commands/_pi-frontend.js +841 -0
  11. package/dist/src/commands/_pi-install.js +4 -3
  12. package/dist/src/commands/_pi-worker-bridge-extension.js +759 -0
  13. package/dist/src/commands/_policy.js +0 -2
  14. package/dist/src/commands/_preflight.js +32 -109
  15. package/dist/src/commands/_run-driver-helpers.js +0 -2
  16. package/dist/src/commands/_server-client.js +161 -31
  17. package/dist/src/commands/_snapshot-upload.js +8 -23
  18. package/dist/src/commands/_task-picker.js +44 -16
  19. package/dist/src/commands/agent.js +9 -9
  20. package/dist/src/commands/browser.js +4 -6
  21. package/dist/src/commands/connect.js +132 -25
  22. package/dist/src/commands/dist.js +4 -6
  23. package/dist/src/commands/doctor.js +13 -27
  24. package/dist/src/commands/github.js +10 -25
  25. package/dist/src/commands/inbox.js +351 -31
  26. package/dist/src/commands/init.js +298 -71
  27. package/dist/src/commands/inspect.js +10 -12
  28. package/dist/src/commands/inspector.js +2 -4
  29. package/dist/src/commands/plugin.js +76 -22
  30. package/dist/src/commands/profile-and-review.js +8 -10
  31. package/dist/src/commands/queue.js +2 -3
  32. package/dist/src/commands/remote.js +18 -20
  33. package/dist/src/commands/repo-git-harness.js +6 -8
  34. package/dist/src/commands/run.js +1157 -122
  35. package/dist/src/commands/server.js +217 -33
  36. package/dist/src/commands/setup.js +17 -37
  37. package/dist/src/commands/task-report-bug.js +5 -7
  38. package/dist/src/commands/task-run-driver.js +660 -73
  39. package/dist/src/commands/task.js +1542 -252
  40. package/dist/src/commands/test.js +3 -5
  41. package/dist/src/commands/workspace.js +4 -6
  42. package/dist/src/commands.js +3599 -1159
  43. package/dist/src/index.js +3646 -1215
  44. package/dist/src/launcher.js +5 -3
  45. package/dist/src/report-bug.js +3 -3
  46. package/dist/src/runner.js +5 -19
  47. package/package.json +6 -4
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  // packages/cli/src/launcher.ts
3
3
  import { existsSync } from "fs";
4
- import { resolve } from "path";
4
+ import { basename, resolve } from "path";
5
5
  import { loadDotEnvSecrets } from "@rig/runtime/baked-secrets";
6
6
  import { RIG_DEFINITION_DIRNAME, RIG_STATE_DIRNAME, resolveNearestRigProjectRoot } from "@rig/runtime/layout";
7
7
  function parsePolicyMode(value) {
@@ -14,7 +14,7 @@ function parsePolicyMode(value) {
14
14
  throw new Error(`Invalid --policy-mode value: ${value}. Use off|observe|enforce.`);
15
15
  }
16
16
  function hasRigProjectMarker(candidate) {
17
- return existsSync(resolve(candidate, RIG_DEFINITION_DIRNAME)) || existsSync(resolve(candidate, RIG_STATE_DIRNAME)) || existsSync(resolve(candidate, "rig.config.ts")) || existsSync(resolve(candidate, "rig.config.json"));
17
+ return existsSync(resolve(candidate, RIG_DEFINITION_DIRNAME)) || existsSync(resolve(candidate, RIG_STATE_DIRNAME)) || existsSync(resolve(candidate, "rig.config.ts")) || existsSync(resolve(candidate, "rig.config.json")) || existsSync(resolve(candidate, ".git"));
18
18
  }
19
19
  function resolveProjectRoot({
20
20
  envProjectRoot,
@@ -26,7 +26,9 @@ function resolveProjectRoot({
26
26
  return resolve(cwd, envProjectRoot);
27
27
  }
28
28
  const fallbackImportDir = importDir ?? cwd;
29
- const candidates = [cwd, resolve(execPath, "..", ".."), resolve(fallbackImportDir, "..")];
29
+ const execName = basename(execPath).toLowerCase();
30
+ const execCandidates = execName === "rig" || execName === "rig.exe" ? [resolve(execPath, "..", "..")] : [];
31
+ const candidates = [cwd, ...execCandidates, resolve(fallbackImportDir, "..")];
30
32
  for (const candidate of candidates) {
31
33
  const nearest = resolveNearestRigProjectRoot(candidate);
32
34
  if (hasRigProjectMarker(nearest)) {
@@ -166,15 +166,15 @@ function buildBugReportMarkdown(input, browser, screenshots, assets) {
166
166
  ...input.issueId ? [
167
167
  `- Canonical task assets live under \`artifacts/${input.issueId}/bug-report/\`.`,
168
168
  `- Start with \`artifacts/${input.issueId}/bug-report/task.md\` and the files in \`artifacts/${input.issueId}/bug-report/assets/\`.`,
169
- browserRequired ? `- Run \`bun run rig task info --task ${input.issueId}\` to confirm browser wiring before debugging.` : `- Run \`bun run rig task info --task ${input.issueId}\` to confirm scope and artifact links before debugging.`
169
+ browserRequired ? `- Run \`rig task info --task ${input.issueId}\` to confirm browser wiring before debugging.` : `- Run \`rig task info --task ${input.issueId}\` to confirm scope and artifact links before debugging.`
170
170
  ] : [
171
- "- Draft-only report: convert this into a beads task before assigning it to an agent run."
171
+ "- Draft-only report: convert this into a Rig task before assigning it to an agent run."
172
172
  ],
173
173
  "",
174
174
  "## Validation",
175
175
  "",
176
176
  "```bash",
177
- ...input.issueId ? [`bun run rig task validate --task ${input.issueId}`] : [],
177
+ ...input.issueId ? [`rig task validate --task ${input.issueId}`] : [],
178
178
  ...browserRequired ? [
179
179
  "bun run app:check:browser:hp-next",
180
180
  "bun run app:e2e:browser:hp-next"
@@ -6,8 +6,6 @@ import { resolve } 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 withProjectRoot(projectRoot) {
@@ -61,13 +59,6 @@ async function ensureAgentShellBinary(projectRoot, options = {}) {
61
59
  }
62
60
  async function initializeRuntime(options) {
63
61
  const eventBus = new EventBus({ projectRoot: options.projectRoot, runId: options.runId });
64
- const runtimeContext = loadRuntimeContextFromEnv() ?? undefined;
65
- const plugins = await PluginManager.load({
66
- projectRoot: options.projectRoot,
67
- runId: eventBus.getRunId(),
68
- eventBus,
69
- runtimeContext
70
- });
71
62
  const context = {
72
63
  projectRoot: options.projectRoot,
73
64
  dryRun: options.dryRun,
@@ -75,10 +66,8 @@ async function initializeRuntime(options) {
75
66
  runId: eventBus.getRunId(),
76
67
  policyMode: options.policyMode,
77
68
  eventBus,
78
- plugins,
79
69
  emitEvent: async (type, payload) => {
80
- const event = await eventBus.emit(type, payload);
81
- await plugins.onEvent(event);
70
+ await eventBus.emit(type, payload);
82
71
  }
83
72
  };
84
73
  context.runCommand = async (parts) => runCommand(context, parts);
@@ -87,8 +76,7 @@ async function initializeRuntime(options) {
87
76
  outputMode: context.outputMode,
88
77
  dryRun: context.dryRun,
89
78
  policyMode: context.policyMode ?? loadPolicy(options.projectRoot).mode,
90
- policyFile: resolve(options.projectRoot, "rig/policy/policy.json"),
91
- plugins: context.plugins.list()
79
+ policyFile: resolve(options.projectRoot, "rig/policy/policy.json")
92
80
  });
93
81
  return context;
94
82
  }
@@ -99,12 +87,13 @@ async function runCommand(context, parts) {
99
87
  const envMode = process.env.RIG_BASH_MODE;
100
88
  const effectiveMode = context.policyMode || (envMode === "off" || envMode === "observe" || envMode === "enforce" ? envMode : loadPolicy(context.projectRoot).mode);
101
89
  const controlledPath = `${resolve(context.projectRoot, ".rig", "bin")}:${context.projectRoot}/rig/tools:${process.env.PATH ?? ""}`;
102
- const controlledBash = await ensureAgentShellBinary(context.projectRoot);
90
+ const usesInfrastructureBinary = parts[0] === "rig-server";
91
+ const controlledBash = usesInfrastructureBinary ? null : await ensureAgentShellBinary(context.projectRoot);
103
92
  const commandEnv = [
104
93
  "env",
105
94
  `PATH=${controlledPath}`,
106
95
  `PROJECT_RIG_ROOT=${context.projectRoot}`,
107
- `BASH=${controlledBash}`,
96
+ ...controlledBash ? [`BASH=${controlledBash}`] : [],
108
97
  `RIG_BASH_MODE=${effectiveMode}`,
109
98
  `RIG_POLICY_FILE=${resolve(context.projectRoot, "rig/policy/policy.json")}`,
110
99
  ...context.eventBus.getEventsFile() ? [`RIG_EVENTS_FILE=${context.eventBus.getEventsFile()}`] : []
@@ -138,7 +127,6 @@ async function runCommand(context, parts) {
138
127
  });
139
128
  throw new CliError(`Policy blocked command: ${formatted}`, 126);
140
129
  }
141
- await context.plugins.beforeCommand({ command: commandWithEnv, formattedCommand: formatted });
142
130
  const startedAt = new Date;
143
131
  await context.emitEvent("command.started", {
144
132
  command: commandWithEnv,
@@ -158,7 +146,6 @@ async function runCommand(context, parts) {
158
146
  if (context.outputMode === "text") {
159
147
  console.log(`$ ${formatted}`);
160
148
  }
161
- await context.plugins.afterCommand(dryResult);
162
149
  await context.emitEvent("command.finished", {
163
150
  ...dryResult,
164
151
  dryRun: true
@@ -198,7 +185,6 @@ async function runCommand(context, parts) {
198
185
  stdout: context.outputMode === "json" ? stdout : undefined,
199
186
  stderr: context.outputMode === "json" ? stderr : undefined
200
187
  };
201
- await context.plugins.afterCommand(result);
202
188
  if (exitCode !== 0) {
203
189
  await context.emitEvent("command.failed", {
204
190
  ...result
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@h-rig/cli",
3
- "version": "0.0.6-alpha.3",
3
+ "version": "0.0.6-alpha.30",
4
4
  "type": "module",
5
5
  "description": "Rig package",
6
6
  "license": "UNLICENSED",
@@ -23,9 +23,11 @@
23
23
  },
24
24
  "dependencies": {
25
25
  "@clack/prompts": "^1.2.0",
26
- "@rig/core": "npm:@h-rig/core@0.0.6-alpha.3",
27
- "@rig/runtime": "npm:@h-rig/runtime@0.0.6-alpha.3",
28
- "@rig/client": "npm:@h-rig/client@0.0.6-alpha.3",
26
+ "@earendil-works/pi-coding-agent": "npm:@h-rig/pi-coding-agent@0.0.6-alpha.30",
27
+ "@rig/core": "npm:@h-rig/core@0.0.6-alpha.30",
28
+ "@rig/runtime": "npm:@h-rig/runtime@0.0.6-alpha.30",
29
+ "@rig/client": "npm:@h-rig/client@0.0.6-alpha.30",
30
+ "@rig/server": "npm:@h-rig/server@0.0.6-alpha.30",
29
31
  "picocolors": "^1.1.1"
30
32
  }
31
33
  }