@h-rig/cli 0.0.6-alpha.90 → 0.0.6-alpha.91
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.
- package/README.md +18 -19
- package/dist/bin/build-rig-binaries.js +22 -10
- package/dist/bin/rig.d.ts +71 -1
- package/dist/bin/rig.js +15078 -11169
- package/dist/config/rig-default-config.yml +5 -0
- package/dist/src/app/drone-ui.d.ts +11 -14
- package/dist/src/app/drone-ui.js +70 -86
- package/dist/src/commands/_async-ui.d.ts +1 -4
- package/dist/src/commands/_async-ui.js +9 -111
- package/dist/src/commands/_cli-format.d.ts +16 -9
- package/dist/src/commands/_cli-format.js +167 -295
- package/dist/src/commands/_connection-state.d.ts +11 -1
- package/dist/src/commands/_connection-state.js +50 -5
- package/dist/src/commands/_doctor-checks.d.ts +0 -6
- package/dist/src/commands/_doctor-checks.js +79 -382
- package/dist/src/commands/_help-catalog.d.ts +1 -1
- package/dist/src/commands/_help-catalog.js +217 -157
- package/dist/src/commands/_inprocess-services.d.ts +33 -0
- package/dist/src/commands/_inprocess-services.js +102 -0
- package/dist/src/commands/_json-output.js +4 -0
- package/dist/src/commands/_lazy-reconcile.d.ts +34 -0
- package/dist/src/commands/_lazy-reconcile.js +102 -0
- package/dist/src/commands/_paths.js +1 -1
- package/dist/src/commands/_pi-frontend.d.ts +18 -10
- package/dist/src/commands/_pi-frontend.js +37 -715
- package/dist/src/commands/_pi-install.js +18 -36
- package/dist/src/commands/_policy.d.ts +1 -1
- package/dist/src/commands/_policy.js +56 -15
- package/dist/src/commands/_run-bridge.d.ts +114 -0
- package/dist/src/commands/_run-bridge.js +387 -0
- package/dist/src/commands/_run-diagnostics.d.ts +9 -0
- package/dist/src/commands/_run-diagnostics.js +51 -0
- package/dist/src/commands/_run-driver-helpers.d.ts +8 -81
- package/dist/src/commands/_run-driver-helpers.js +79 -283
- package/dist/src/commands/_run-projection.d.ts +50 -0
- package/dist/src/commands/_run-projection.js +349 -0
- package/dist/src/commands/_run-subcommands.d.ts +3 -0
- package/dist/src/commands/_run-subcommands.js +31 -0
- package/dist/src/commands/_spinner.js +1 -1
- package/dist/src/commands/agent.d.ts +1 -1
- package/dist/src/commands/agent.js +8559 -239
- package/dist/src/commands/dist.d.ts +1 -1
- package/dist/src/commands/dist.js +27 -19
- package/dist/src/commands/doctor.d.ts +1 -1
- package/dist/src/commands/doctor.js +93 -475
- package/dist/src/commands/github.d.ts +1 -1
- package/dist/src/commands/github.js +113 -387
- package/dist/src/commands/inbox.d.ts +22 -24
- package/dist/src/commands/inbox.js +420 -691
- package/dist/src/commands/init.d.ts +6 -16
- package/dist/src/commands/init.js +334 -971
- package/dist/src/commands/inspect.d.ts +19 -2
- package/dist/src/commands/inspect.js +644 -610
- package/dist/src/commands/pi.d.ts +1 -1
- package/dist/src/commands/plugin.d.ts +1 -1
- package/dist/src/commands/plugin.js +486 -7
- package/dist/src/commands/profile-and-review.d.ts +1 -1
- package/dist/src/commands/profile-and-review.js +94 -56
- package/dist/src/commands/queue.js +1 -21
- package/dist/src/commands/remote.d.ts +1 -1
- package/dist/src/commands/remote.js +837 -14
- package/dist/src/commands/repo-git-harness.d.ts +1 -1
- package/dist/src/commands/repo-git-harness.js +57 -14
- package/dist/src/commands/run.d.ts +20 -2
- package/dist/src/commands/run.js +17579 -1759
- package/dist/src/commands/server.d.ts +2 -6
- package/dist/src/commands/server.js +141 -723
- package/dist/src/commands/setup.d.ts +1 -1
- package/dist/src/commands/setup.js +102 -484
- package/dist/src/commands/stats.d.ts +13 -10
- package/dist/src/commands/stats.js +689 -761
- package/dist/src/commands/task-run-driver.d.ts +50 -88
- package/dist/src/commands/task-run-driver.js +116 -2717
- package/dist/src/commands/task.d.ts +34 -13
- package/dist/src/commands/task.js +668 -2523
- package/dist/src/commands/test.d.ts +1 -1
- package/dist/src/commands/triage.d.ts +11 -0
- package/dist/src/commands/triage.js +227 -0
- package/dist/src/commands/workspace.d.ts +1 -1
- package/dist/src/commands.d.ts +0 -16
- package/dist/src/commands.js +16657 -12250
- package/dist/src/index.js +16528 -12497
- package/dist/src/launcher.js +4 -0
- package/dist/src/operator-cli.d.ts +2 -0
- package/dist/src/operator-cli.js +17837 -0
- package/dist/src/operator-entry.d.ts +1 -0
- package/dist/src/operator-entry.js +3 -0
- package/package.json +18 -12
- package/dist/src/app/board.d.ts +0 -23
- package/dist/src/app/board.js +0 -1786
- package/dist/src/app/theme.d.ts +0 -47
- package/dist/src/app/theme.js +0 -150
- package/dist/src/commands/_authority-runs.d.ts +0 -22
- package/dist/src/commands/_authority-runs.js +0 -110
- package/dist/src/commands/_operator-surface.d.ts +0 -34
- package/dist/src/commands/_operator-surface.js +0 -220
- package/dist/src/commands/_operator-view.d.ts +0 -30
- package/dist/src/commands/_operator-view.js +0 -1070
- package/dist/src/commands/_preflight.d.ts +0 -22
- package/dist/src/commands/_preflight.js +0 -540
- package/dist/src/commands/_run-replay.d.ts +0 -24
- package/dist/src/commands/_run-replay.js +0 -142
- package/dist/src/commands/_server-client.d.ts +0 -186
- package/dist/src/commands/_server-client.js +0 -681
- package/dist/src/commands/_snapshot-upload.d.ts +0 -39
- package/dist/src/commands/_snapshot-upload.js +0 -455
- package/dist/src/commands/_task-picker.d.ts +0 -9
- package/dist/src/commands/_task-picker.js +0 -201
- package/dist/src/commands/browser.d.ts +0 -65
- package/dist/src/commands/browser.js +0 -1173
- package/dist/src/commands/connect.d.ts +0 -7
- package/dist/src/commands/connect.js +0 -419
- package/dist/src/commands/inspector.d.ts +0 -3
- package/dist/src/commands/inspector.js +0 -263
- package/dist/src/commands/task-report-bug.d.ts +0 -19
- package/dist/src/commands/task-report-bug.js +0 -1281
- package/dist/src/report-bug.d.ts +0 -44
- package/dist/src/report-bug.js +0 -260
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type RunnerContext } from "../runner";
|
|
2
|
-
import type { CommandOutcome } from "@rig/runtime
|
|
2
|
+
import type { CommandOutcome } from "@rig/runtime";
|
|
3
3
|
export declare function executeTest(context: RunnerContext, args: string[]): Promise<CommandOutcome>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type IssueAnalysisTriageRunResult, type RunIssueAnalysisTriageOptions } from "@rig/runtime/control-plane/github";
|
|
2
|
+
import type { CommandOutcome } from "@rig/runtime/control-plane/runtime/types";
|
|
3
|
+
import { type RunnerContext } from "../runner";
|
|
4
|
+
type TriageCommandDeps = {
|
|
5
|
+
runTriage?: (options: RunIssueAnalysisTriageOptions) => Promise<IssueAnalysisTriageRunResult>;
|
|
6
|
+
spinner?: <T>(label: string, work: (update: (label: string) => void) => Promise<T>, options: {
|
|
7
|
+
outputMode: RunnerContext["outputMode"];
|
|
8
|
+
}) => Promise<T>;
|
|
9
|
+
};
|
|
10
|
+
export declare function executeTriage(context: RunnerContext, args: string[], deps?: TriageCommandDeps): Promise<CommandOutcome>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// packages/cli/src/commands/triage.ts
|
|
3
|
+
import { runIssueAnalysisTriage } from "@rig/runtime/control-plane/github";
|
|
4
|
+
|
|
5
|
+
// packages/cli/src/runner.ts
|
|
6
|
+
import { EventBus } from "@rig/runtime/control-plane/runtime/events";
|
|
7
|
+
import { CliError as RuntimeCliError } from "@rig/runtime/control-plane/errors";
|
|
8
|
+
import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
|
|
9
|
+
import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
|
|
10
|
+
|
|
11
|
+
class CliError extends RuntimeCliError {
|
|
12
|
+
hint;
|
|
13
|
+
constructor(message, exitCode = 1, options = {}) {
|
|
14
|
+
super(message, exitCode);
|
|
15
|
+
if (options.hint?.trim()) {
|
|
16
|
+
this.hint = options.hint.trim();
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function takeOption(args, option) {
|
|
21
|
+
const rest = [];
|
|
22
|
+
let value;
|
|
23
|
+
for (let index = 0;index < args.length; index += 1) {
|
|
24
|
+
const current = args[index];
|
|
25
|
+
if (current === option) {
|
|
26
|
+
const next = args[index + 1];
|
|
27
|
+
if (!next || next.startsWith("-")) {
|
|
28
|
+
throw new CliError(`Missing value for ${option}`, 1, { hint: `Provide a value after ${option}, e.g. \`${option} <value>\`.` });
|
|
29
|
+
}
|
|
30
|
+
value = next;
|
|
31
|
+
index += 1;
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
if (current !== undefined) {
|
|
35
|
+
rest.push(current);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return { value, rest };
|
|
39
|
+
}
|
|
40
|
+
function requireNoExtraArgs(args, usage) {
|
|
41
|
+
if (args.length > 0) {
|
|
42
|
+
throw new CliError(`Unexpected arguments: ${args.join(" ")}
|
|
43
|
+
Usage: ${usage}`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// packages/cli/src/commands/_async-ui.ts
|
|
48
|
+
import pc from "picocolors";
|
|
49
|
+
|
|
50
|
+
// packages/cli/src/commands/_spinner.ts
|
|
51
|
+
var SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
52
|
+
function createTtySpinner(input) {
|
|
53
|
+
const output = input.output ?? process.stdout;
|
|
54
|
+
const isTty = output.isTTY === true;
|
|
55
|
+
const frames = input.frames && input.frames.length > 0 ? input.frames : SPINNER_FRAMES;
|
|
56
|
+
let label = input.label;
|
|
57
|
+
let frame = 0;
|
|
58
|
+
let paused = false;
|
|
59
|
+
let stopped = false;
|
|
60
|
+
let lastPrintedLabel = "";
|
|
61
|
+
const render = () => {
|
|
62
|
+
if (stopped || paused)
|
|
63
|
+
return;
|
|
64
|
+
if (!isTty) {
|
|
65
|
+
if (label !== lastPrintedLabel) {
|
|
66
|
+
output.write(`${label}
|
|
67
|
+
`);
|
|
68
|
+
lastPrintedLabel = label;
|
|
69
|
+
}
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
frame = (frame + 1) % frames.length;
|
|
73
|
+
const glyph = frames[frame] ?? frames[0] ?? "";
|
|
74
|
+
output.write(`\r\x1B[2K${input.styleFrame ? input.styleFrame(glyph) : glyph} ${label}`);
|
|
75
|
+
};
|
|
76
|
+
const clearLine = () => {
|
|
77
|
+
if (isTty)
|
|
78
|
+
output.write("\r\x1B[2K");
|
|
79
|
+
};
|
|
80
|
+
render();
|
|
81
|
+
const timer = isTty ? setInterval(render, input.intervalMs ?? 16) : null;
|
|
82
|
+
return {
|
|
83
|
+
setLabel(next) {
|
|
84
|
+
label = next;
|
|
85
|
+
render();
|
|
86
|
+
},
|
|
87
|
+
pause() {
|
|
88
|
+
paused = true;
|
|
89
|
+
clearLine();
|
|
90
|
+
},
|
|
91
|
+
resume() {
|
|
92
|
+
if (stopped)
|
|
93
|
+
return;
|
|
94
|
+
paused = false;
|
|
95
|
+
render();
|
|
96
|
+
},
|
|
97
|
+
stop(finalLine) {
|
|
98
|
+
if (stopped)
|
|
99
|
+
return;
|
|
100
|
+
stopped = true;
|
|
101
|
+
if (timer)
|
|
102
|
+
clearInterval(timer);
|
|
103
|
+
clearLine();
|
|
104
|
+
if (finalLine)
|
|
105
|
+
output.write(`${finalLine}
|
|
106
|
+
`);
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// packages/cli/src/commands/_async-ui.ts
|
|
112
|
+
var FRAMES = ["\u25D0", "\u25D3", "\u25D1", "\u25D2"];
|
|
113
|
+
var DONE_SYMBOL = pc.green("\u25C7");
|
|
114
|
+
var FAIL_SYMBOL = pc.red("\u25A0");
|
|
115
|
+
var activeUpdate = null;
|
|
116
|
+
async function withSpinner(label, work, options = {}) {
|
|
117
|
+
if (options.outputMode === "json") {
|
|
118
|
+
return work(() => {
|
|
119
|
+
return;
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
if (activeUpdate) {
|
|
123
|
+
activeUpdate(label);
|
|
124
|
+
return work(activeUpdate);
|
|
125
|
+
}
|
|
126
|
+
const output = options.output ?? process.stderr;
|
|
127
|
+
const isTty = output.isTTY === true;
|
|
128
|
+
let lastLabel = label;
|
|
129
|
+
if (!isTty) {
|
|
130
|
+
output.write(`${label}
|
|
131
|
+
`);
|
|
132
|
+
const update2 = (next) => {
|
|
133
|
+
lastLabel = next;
|
|
134
|
+
};
|
|
135
|
+
activeUpdate = update2;
|
|
136
|
+
try {
|
|
137
|
+
return await work(update2);
|
|
138
|
+
} finally {
|
|
139
|
+
activeUpdate = null;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
const spinner = createTtySpinner({
|
|
143
|
+
label,
|
|
144
|
+
output,
|
|
145
|
+
frames: FRAMES,
|
|
146
|
+
styleFrame: (frame) => pc.cyan(frame)
|
|
147
|
+
});
|
|
148
|
+
const update = (next) => {
|
|
149
|
+
lastLabel = next;
|
|
150
|
+
spinner.setLabel(next);
|
|
151
|
+
};
|
|
152
|
+
activeUpdate = update;
|
|
153
|
+
try {
|
|
154
|
+
const result = await work(update);
|
|
155
|
+
spinner.stop(options.doneLabel ? `${DONE_SYMBOL} ${options.doneLabel}` : undefined);
|
|
156
|
+
return result;
|
|
157
|
+
} catch (error) {
|
|
158
|
+
spinner.stop(`${FAIL_SYMBOL} ${lastLabel}`);
|
|
159
|
+
throw error;
|
|
160
|
+
} finally {
|
|
161
|
+
activeUpdate = null;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// packages/cli/src/commands/triage.ts
|
|
166
|
+
function printTriageResult(context, result) {
|
|
167
|
+
if (context.outputMode === "json") {
|
|
168
|
+
console.log(JSON.stringify(result, null, 2));
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
if (!result.enabled) {
|
|
172
|
+
const suffix = result.skippedReason === "no-config" ? "no rig.config task source was found" : "config.issueAnalysis is not enabled for continuous Pi analysis";
|
|
173
|
+
console.log(`Rig triage skipped: ${suffix}.`);
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
console.log([
|
|
177
|
+
`Rig triage analyzed ${result.analyzedIssues} issue${result.analyzedIssues === 1 ? "" : "s"}.`,
|
|
178
|
+
`metadata patches: ${result.metadataPatches}`,
|
|
179
|
+
`labels added: ${result.labelsAdded}`,
|
|
180
|
+
`labels removed: ${result.labelsRemoved}`,
|
|
181
|
+
`generated issues: ${result.generatedIssues}`,
|
|
182
|
+
`snapshot refreshes: ${result.writeBackRefreshes}`
|
|
183
|
+
].join(`
|
|
184
|
+
`));
|
|
185
|
+
}
|
|
186
|
+
async function executeTriage(context, args, deps = {}) {
|
|
187
|
+
if (args[0] === "--help" || args[0] === "-h" || args[0] === "help") {
|
|
188
|
+
console.log(`Usage: rig triage [--reason <text>]
|
|
189
|
+
|
|
190
|
+
Runs the configured issueAnalysis pass once. Schedule this command externally for continuous triage.`);
|
|
191
|
+
return { ok: true, group: "triage", command: "help" };
|
|
192
|
+
}
|
|
193
|
+
const parsedReason = takeOption(args, "--reason");
|
|
194
|
+
requireNoExtraArgs(parsedReason.rest, "rig triage [--reason <text>]");
|
|
195
|
+
if (context.dryRun) {
|
|
196
|
+
const result2 = {
|
|
197
|
+
ok: true,
|
|
198
|
+
enabled: false,
|
|
199
|
+
reason: parsedReason.value?.trim() || "triage",
|
|
200
|
+
sourceId: null,
|
|
201
|
+
sourceKind: null,
|
|
202
|
+
analyzedIssues: 0,
|
|
203
|
+
metadataPatches: 0,
|
|
204
|
+
labelsAdded: 0,
|
|
205
|
+
labelsRemoved: 0,
|
|
206
|
+
generatedIssues: 0,
|
|
207
|
+
writeBackRefreshes: 0,
|
|
208
|
+
refreshedIssueCount: null,
|
|
209
|
+
skippedReason: "disabled",
|
|
210
|
+
dryRun: true
|
|
211
|
+
};
|
|
212
|
+
if (context.outputMode === "json")
|
|
213
|
+
console.log(JSON.stringify(result2, null, 2));
|
|
214
|
+
else
|
|
215
|
+
console.log("[dry-run] rig triage would run the configured issueAnalysis pass once.");
|
|
216
|
+
return { ok: true, group: "triage", command: "run", details: result2 };
|
|
217
|
+
}
|
|
218
|
+
const result = await (deps.spinner ?? withSpinner)("Running Rig issue-analysis triage\u2026", () => (deps.runTriage ?? runIssueAnalysisTriage)({
|
|
219
|
+
projectRoot: context.projectRoot,
|
|
220
|
+
reason: parsedReason.value?.trim() || "triage"
|
|
221
|
+
}), { outputMode: context.outputMode });
|
|
222
|
+
printTriageResult(context, result);
|
|
223
|
+
return { ok: true, group: "triage", command: "run", details: result };
|
|
224
|
+
}
|
|
225
|
+
export {
|
|
226
|
+
executeTriage
|
|
227
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type RunnerContext } from "../runner";
|
|
2
|
-
import type { CommandOutcome } from "@rig/runtime
|
|
2
|
+
import type { CommandOutcome } from "@rig/runtime";
|
|
3
3
|
export declare function executeWorkspace(context: RunnerContext, args: string[]): Promise<CommandOutcome>;
|
package/dist/src/commands.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { type RunnerContext } from "./runner";
|
|
2
2
|
import type { CommandOutcome } from "@rig/runtime/control-plane/runtime/types";
|
|
3
|
-
import { buildBrowserDemoAgentCommands, buildBrowserDemoRuntime, browserDemoCommandCompletions, browserDemoCommandMatches, browserHelpText, findBrowserDemoPageTarget, formatBrowserDemoCdpResult, formatBrowserDemoCheckOutput, formatBrowserDemoCommandOutput, normalizeBrowserDemoCommand } from "./commands/browser";
|
|
4
3
|
import { buildRunPrompt } from "./commands/_run-driver-helpers";
|
|
5
|
-
import { bugPromptExampleText, formatDroppedAssetDefault, splitDroppedAssetList, validateRequiredBugPromptValue } from "./commands/task-report-bug";
|
|
6
4
|
export declare function printGroupHelp(group: string): void;
|
|
7
5
|
/** Returns true if args[0] requests group help (--help, -h, or "help"). */
|
|
8
6
|
export declare function isHelpArg(arg: string | undefined): boolean;
|
|
@@ -12,18 +10,4 @@ export { buildRigInitConfigSource } from "./commands/init";
|
|
|
12
10
|
export type { RigInitConfigInput } from "./commands/init";
|
|
13
11
|
export declare const __testOnly: {
|
|
14
12
|
buildRunPrompt: typeof buildRunPrompt;
|
|
15
|
-
buildBrowserDemoAgentCommands: typeof buildBrowserDemoAgentCommands;
|
|
16
|
-
buildBrowserDemoRuntime: typeof buildBrowserDemoRuntime;
|
|
17
|
-
browserDemoCommandCompletions: typeof browserDemoCommandCompletions;
|
|
18
|
-
browserDemoCommandMatches: typeof browserDemoCommandMatches;
|
|
19
|
-
browserHelpText: typeof browserHelpText;
|
|
20
|
-
bugPromptExampleText: typeof bugPromptExampleText;
|
|
21
|
-
findBrowserDemoPageTarget: typeof findBrowserDemoPageTarget;
|
|
22
|
-
formatBrowserDemoCdpResult: typeof formatBrowserDemoCdpResult;
|
|
23
|
-
formatBrowserDemoCheckOutput: typeof formatBrowserDemoCheckOutput;
|
|
24
|
-
formatBrowserDemoCommandOutput: typeof formatBrowserDemoCommandOutput;
|
|
25
|
-
formatDroppedAssetDefault: typeof formatDroppedAssetDefault;
|
|
26
|
-
normalizeBrowserDemoCommand: typeof normalizeBrowserDemoCommand;
|
|
27
|
-
splitDroppedAssetList: typeof splitDroppedAssetList;
|
|
28
|
-
validateRequiredBugPromptValue: typeof validateRequiredBugPromptValue;
|
|
29
13
|
};
|