@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.
Files changed (118) hide show
  1. package/README.md +18 -19
  2. package/dist/bin/build-rig-binaries.js +22 -10
  3. package/dist/bin/rig.d.ts +71 -1
  4. package/dist/bin/rig.js +15078 -11169
  5. package/dist/config/rig-default-config.yml +5 -0
  6. package/dist/src/app/drone-ui.d.ts +11 -14
  7. package/dist/src/app/drone-ui.js +70 -86
  8. package/dist/src/commands/_async-ui.d.ts +1 -4
  9. package/dist/src/commands/_async-ui.js +9 -111
  10. package/dist/src/commands/_cli-format.d.ts +16 -9
  11. package/dist/src/commands/_cli-format.js +167 -295
  12. package/dist/src/commands/_connection-state.d.ts +11 -1
  13. package/dist/src/commands/_connection-state.js +50 -5
  14. package/dist/src/commands/_doctor-checks.d.ts +0 -6
  15. package/dist/src/commands/_doctor-checks.js +79 -382
  16. package/dist/src/commands/_help-catalog.d.ts +1 -1
  17. package/dist/src/commands/_help-catalog.js +217 -157
  18. package/dist/src/commands/_inprocess-services.d.ts +33 -0
  19. package/dist/src/commands/_inprocess-services.js +102 -0
  20. package/dist/src/commands/_json-output.js +4 -0
  21. package/dist/src/commands/_lazy-reconcile.d.ts +34 -0
  22. package/dist/src/commands/_lazy-reconcile.js +102 -0
  23. package/dist/src/commands/_paths.js +1 -1
  24. package/dist/src/commands/_pi-frontend.d.ts +18 -10
  25. package/dist/src/commands/_pi-frontend.js +37 -715
  26. package/dist/src/commands/_pi-install.js +18 -36
  27. package/dist/src/commands/_policy.d.ts +1 -1
  28. package/dist/src/commands/_policy.js +56 -15
  29. package/dist/src/commands/_run-bridge.d.ts +114 -0
  30. package/dist/src/commands/_run-bridge.js +387 -0
  31. package/dist/src/commands/_run-diagnostics.d.ts +9 -0
  32. package/dist/src/commands/_run-diagnostics.js +51 -0
  33. package/dist/src/commands/_run-driver-helpers.d.ts +8 -81
  34. package/dist/src/commands/_run-driver-helpers.js +79 -283
  35. package/dist/src/commands/_run-projection.d.ts +50 -0
  36. package/dist/src/commands/_run-projection.js +349 -0
  37. package/dist/src/commands/_run-subcommands.d.ts +3 -0
  38. package/dist/src/commands/_run-subcommands.js +31 -0
  39. package/dist/src/commands/_spinner.js +1 -1
  40. package/dist/src/commands/agent.d.ts +1 -1
  41. package/dist/src/commands/agent.js +8559 -239
  42. package/dist/src/commands/dist.d.ts +1 -1
  43. package/dist/src/commands/dist.js +27 -19
  44. package/dist/src/commands/doctor.d.ts +1 -1
  45. package/dist/src/commands/doctor.js +93 -475
  46. package/dist/src/commands/github.d.ts +1 -1
  47. package/dist/src/commands/github.js +113 -387
  48. package/dist/src/commands/inbox.d.ts +22 -24
  49. package/dist/src/commands/inbox.js +420 -691
  50. package/dist/src/commands/init.d.ts +6 -16
  51. package/dist/src/commands/init.js +334 -971
  52. package/dist/src/commands/inspect.d.ts +19 -2
  53. package/dist/src/commands/inspect.js +644 -610
  54. package/dist/src/commands/pi.d.ts +1 -1
  55. package/dist/src/commands/plugin.d.ts +1 -1
  56. package/dist/src/commands/plugin.js +486 -7
  57. package/dist/src/commands/profile-and-review.d.ts +1 -1
  58. package/dist/src/commands/profile-and-review.js +94 -56
  59. package/dist/src/commands/queue.js +1 -21
  60. package/dist/src/commands/remote.d.ts +1 -1
  61. package/dist/src/commands/remote.js +837 -14
  62. package/dist/src/commands/repo-git-harness.d.ts +1 -1
  63. package/dist/src/commands/repo-git-harness.js +57 -14
  64. package/dist/src/commands/run.d.ts +20 -2
  65. package/dist/src/commands/run.js +17579 -1759
  66. package/dist/src/commands/server.d.ts +2 -6
  67. package/dist/src/commands/server.js +141 -723
  68. package/dist/src/commands/setup.d.ts +1 -1
  69. package/dist/src/commands/setup.js +102 -484
  70. package/dist/src/commands/stats.d.ts +13 -10
  71. package/dist/src/commands/stats.js +689 -761
  72. package/dist/src/commands/task-run-driver.d.ts +50 -88
  73. package/dist/src/commands/task-run-driver.js +116 -2717
  74. package/dist/src/commands/task.d.ts +34 -13
  75. package/dist/src/commands/task.js +668 -2523
  76. package/dist/src/commands/test.d.ts +1 -1
  77. package/dist/src/commands/triage.d.ts +11 -0
  78. package/dist/src/commands/triage.js +227 -0
  79. package/dist/src/commands/workspace.d.ts +1 -1
  80. package/dist/src/commands.d.ts +0 -16
  81. package/dist/src/commands.js +16657 -12250
  82. package/dist/src/index.js +16528 -12497
  83. package/dist/src/launcher.js +4 -0
  84. package/dist/src/operator-cli.d.ts +2 -0
  85. package/dist/src/operator-cli.js +17837 -0
  86. package/dist/src/operator-entry.d.ts +1 -0
  87. package/dist/src/operator-entry.js +3 -0
  88. package/package.json +18 -12
  89. package/dist/src/app/board.d.ts +0 -23
  90. package/dist/src/app/board.js +0 -1786
  91. package/dist/src/app/theme.d.ts +0 -47
  92. package/dist/src/app/theme.js +0 -150
  93. package/dist/src/commands/_authority-runs.d.ts +0 -22
  94. package/dist/src/commands/_authority-runs.js +0 -110
  95. package/dist/src/commands/_operator-surface.d.ts +0 -34
  96. package/dist/src/commands/_operator-surface.js +0 -220
  97. package/dist/src/commands/_operator-view.d.ts +0 -30
  98. package/dist/src/commands/_operator-view.js +0 -1070
  99. package/dist/src/commands/_preflight.d.ts +0 -22
  100. package/dist/src/commands/_preflight.js +0 -540
  101. package/dist/src/commands/_run-replay.d.ts +0 -24
  102. package/dist/src/commands/_run-replay.js +0 -142
  103. package/dist/src/commands/_server-client.d.ts +0 -186
  104. package/dist/src/commands/_server-client.js +0 -681
  105. package/dist/src/commands/_snapshot-upload.d.ts +0 -39
  106. package/dist/src/commands/_snapshot-upload.js +0 -455
  107. package/dist/src/commands/_task-picker.d.ts +0 -9
  108. package/dist/src/commands/_task-picker.js +0 -201
  109. package/dist/src/commands/browser.d.ts +0 -65
  110. package/dist/src/commands/browser.js +0 -1173
  111. package/dist/src/commands/connect.d.ts +0 -7
  112. package/dist/src/commands/connect.js +0 -419
  113. package/dist/src/commands/inspector.d.ts +0 -3
  114. package/dist/src/commands/inspector.js +0 -263
  115. package/dist/src/commands/task-report-bug.d.ts +0 -19
  116. package/dist/src/commands/task-report-bug.js +0 -1281
  117. package/dist/src/report-bug.d.ts +0 -44
  118. package/dist/src/report-bug.js +0 -260
@@ -1,44 +0,0 @@
1
- export type BrowserBugEnvironment = "local" | "shared-dev" | "staging" | "production" | "custom";
2
- export type BrowserBugReportInput = {
3
- projectRoot: string;
4
- outputRoot: string;
5
- title: string;
6
- url: string;
7
- browserRequired?: boolean;
8
- environment: BrowserBugEnvironment | string;
9
- preset: string;
10
- profile: string;
11
- attachUrl: string;
12
- stateDir: string;
13
- mode: string;
14
- viewport: string;
15
- summary: string;
16
- steps: string[];
17
- expected: string;
18
- actual: string;
19
- evidence: string[];
20
- screenshots?: string[];
21
- assets?: string[];
22
- issueId?: string;
23
- slug?: string;
24
- overwrite: boolean;
25
- };
26
- export type BrowserBugReportResult = {
27
- slug: string;
28
- reportDir: string;
29
- taskPath: string;
30
- browserPath: string | null;
31
- manifestPath: string;
32
- assetDir: string;
33
- screenshotDir: string;
34
- copiedAssets: string[];
35
- copiedScreenshots: string[];
36
- };
37
- export declare function slugifyBugTitle(value: string): string;
38
- export declare function defaultBrowserBugProfile(title: string): string;
39
- export declare function defaultBrowserBugOptions(environment: string): {
40
- preset: string;
41
- attachUrl: string;
42
- stateDir: string;
43
- };
44
- export declare function createBugReportFiles(input: BrowserBugReportInput): BrowserBugReportResult;
@@ -1,260 +0,0 @@
1
- // @bun
2
- // packages/cli/src/report-bug.ts
3
- import { copyFileSync, existsSync, mkdirSync, rmSync, writeFileSync } from "fs";
4
- import { basename, extname, join, resolve } from "path";
5
- function slugifyBugTitle(value) {
6
- const slug = value.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 80).replace(/-+$/g, "");
7
- return slug || "bug-report";
8
- }
9
- function defaultBrowserBugProfile(title) {
10
- return `hp-next-${slugifyBugTitle(title)}`;
11
- }
12
- function defaultBrowserBugOptions(environment) {
13
- if (environment === "shared-dev") {
14
- return {
15
- preset: "hp-next-shared",
16
- attachUrl: "http://127.0.0.1:9341",
17
- stateDir: ".tmp/rig-browser/hp-next-shared"
18
- };
19
- }
20
- return {
21
- preset: "hp-next-local",
22
- attachUrl: "http://127.0.0.1:9333",
23
- stateDir: ".tmp/rig-browser/hp-next"
24
- };
25
- }
26
- function createBugReportFiles(input) {
27
- const slug = slugifyBugTitle(input.slug || input.title);
28
- const outputDir = resolve(input.projectRoot, input.outputRoot);
29
- const reportDir = resolve(outputDir, slug);
30
- const assetDir = join(reportDir, "assets");
31
- const screenshotDir = join(reportDir, "screenshots");
32
- const taskPath = join(reportDir, "task.md");
33
- const browserRequired = input.browserRequired ?? true;
34
- const browserPath = browserRequired ? join(reportDir, "browser.json") : null;
35
- const manifestPath = join(reportDir, "manifest.json");
36
- if (existsSync(reportDir)) {
37
- if (!input.overwrite) {
38
- throw new Error(`Bug report directory already exists: ${reportDir}`);
39
- }
40
- rmSync(reportDir, { recursive: true, force: true });
41
- }
42
- mkdirSync(assetDir, { recursive: true });
43
- mkdirSync(screenshotDir, { recursive: true });
44
- const copiedScreenshots = copyEvidenceFiles(input.projectRoot, screenshotDir, input.screenshots ?? [], "screenshot");
45
- const copiedAssets = copyEvidenceFiles(input.projectRoot, assetDir, input.assets ?? [], "asset");
46
- const manifestAssets = [
47
- ...copiedScreenshots.map((name) => ({
48
- path: `screenshots/${name}`,
49
- type: mediaTypeForFileName(name)
50
- })),
51
- ...copiedAssets.map((name) => ({
52
- path: `assets/${name}`,
53
- type: mediaTypeForFileName(name)
54
- }))
55
- ];
56
- const browser = browserRequired ? buildBrowserBlock(input) : null;
57
- const manifest = {
58
- schema_version: 1,
59
- slug,
60
- issue_id: input.issueId ?? null,
61
- title: input.title,
62
- environment: input.environment,
63
- url: input.url,
64
- viewport: input.viewport,
65
- task_file: "task.md",
66
- browser_file: browserRequired ? "browser.json" : null,
67
- screenshots: copiedScreenshots.map((name) => `screenshots/${name}`),
68
- assets: manifestAssets,
69
- created_at: new Date().toISOString(),
70
- platform: process.platform,
71
- arch: process.arch
72
- };
73
- writeFileSync(join(assetDir, "README.md"), buildAssetReadme(input.title), "utf8");
74
- writeFileSync(join(screenshotDir, "README.md"), buildScreenshotReadme(input.title), "utf8");
75
- if (browserPath && browser) {
76
- writeFileSync(browserPath, `${JSON.stringify(browser, null, 2)}
77
- `, "utf8");
78
- }
79
- writeFileSync(manifestPath, `${JSON.stringify(manifest, null, 2)}
80
- `, "utf8");
81
- writeFileSync(taskPath, buildBugReportMarkdown(input, browser, copiedScreenshots, copiedAssets), "utf8");
82
- return {
83
- slug,
84
- reportDir,
85
- taskPath,
86
- browserPath,
87
- manifestPath,
88
- assetDir,
89
- screenshotDir,
90
- copiedAssets,
91
- copiedScreenshots
92
- };
93
- }
94
- function buildBrowserBlock(input) {
95
- return {
96
- browser: {
97
- required: true,
98
- preset: input.preset,
99
- profile: input.profile,
100
- attach_url: input.attachUrl,
101
- state_dir: input.stateDir,
102
- dev_command: "bun run app:dev:browser:hp-next",
103
- launch_command: "bun run app:start:browser:hp-next",
104
- check_command: "bun run app:check:browser:hp-next",
105
- e2e_command: "bun run app:e2e:browser:hp-next",
106
- mode: input.mode
107
- }
108
- };
109
- }
110
- function buildBugReportMarkdown(input, browser, screenshots, assets) {
111
- const browserRequired = input.browserRequired ?? true;
112
- const assetEntries = [
113
- ...screenshots.map((name) => ({ name, path: `screenshots/${name}` })),
114
- ...assets.map((name) => ({ name, path: `assets/${name}` }))
115
- ];
116
- const assetLines = assetEntries.length > 0 ? assetEntries.map(({ name, path }) => formatAssetMarkdown(name, path)) : ["- No assets attached yet. Drag screenshots or videos into `assets/` and link them here."];
117
- const evidenceLines = input.evidence.length > 0 ? input.evidence.map((item) => `- ${item}`) : ["- Console errors: not captured yet.", "- Failed network requests: not captured yet."];
118
- return [
119
- `# ${input.title}`,
120
- "",
121
- ...input.issueId ? ["## Task", "", `Task ID: \`${input.issueId}\``, ""] : [],
122
- "## Summary",
123
- "",
124
- input.summary || "TODO: describe the user-visible bug.",
125
- "",
126
- ...browser ? [
127
- "## Browser Block",
128
- "",
129
- "```json",
130
- JSON.stringify(browser, null, 2),
131
- "```",
132
- ""
133
- ] : [],
134
- "## Environment",
135
- "",
136
- `- URL: \`${input.url}\``,
137
- `- Environment: \`${input.environment}\``,
138
- ...browserRequired ? [
139
- `- Preset: \`${input.preset}\``,
140
- `- Profile: \`${input.profile}\``,
141
- `- Viewport: \`${input.viewport}\``
142
- ] : ["- Browser: not required for this report."],
143
- "",
144
- "## Reproduction",
145
- "",
146
- ...numberedLines(input.steps.length > 0 ? input.steps : ["TODO: add reproduction step."]),
147
- "",
148
- "## Expected",
149
- "",
150
- input.expected || "TODO: expected behavior.",
151
- "",
152
- "## Actual",
153
- "",
154
- input.actual || "TODO: actual behavior.",
155
- "",
156
- "## Assets",
157
- "",
158
- ...assetLines,
159
- "",
160
- "## Evidence",
161
- "",
162
- ...evidenceLines,
163
- "",
164
- "## Agent Handoff",
165
- "",
166
- ...input.issueId ? [
167
- `- Canonical task assets live under \`artifacts/${input.issueId}/bug-report/\`.`,
168
- `- Start with \`artifacts/${input.issueId}/bug-report/task.md\` and the files in \`artifacts/${input.issueId}/bug-report/assets/\`.`,
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
- ] : [
171
- "- Draft-only report: convert this into a Rig task before assigning it to an agent run."
172
- ],
173
- "",
174
- "## Validation",
175
- "",
176
- "```bash",
177
- ...input.issueId ? [`rig task validate --task ${input.issueId}`] : [],
178
- ...browserRequired ? [
179
- "bun run app:check:browser:hp-next",
180
- "bun run app:e2e:browser:hp-next"
181
- ] : [],
182
- "```",
183
- ""
184
- ].join(`
185
- `);
186
- }
187
- function numberedLines(items) {
188
- return items.map((item, index) => `${index + 1}. ${item}`);
189
- }
190
- function buildAssetReadme(title) {
191
- return [
192
- `# Evidence Assets For ${title}`,
193
- "",
194
- "Drag and drop screenshots or videos for this bug report into this directory.",
195
- "Use stable, descriptive file names such as `login-loading.png`, `chunk-404-network.png`, or `otp-flow.webm`.",
196
- "Reference images from `../task.md` with Markdown image links and videos with normal file links.",
197
- ""
198
- ].join(`
199
- `);
200
- }
201
- function buildScreenshotReadme(title) {
202
- return [
203
- `# Screenshots For ${title}`,
204
- "",
205
- "Drop legacy screenshot files for this bug report into this directory.",
206
- "Use `assets/` for new screenshot, video, and mixed evidence attachments.",
207
- "Reference screenshots from `../task.md` with Markdown image links.",
208
- ""
209
- ].join(`
210
- `);
211
- }
212
- function copyEvidenceFiles(projectRoot, targetDir, paths, label) {
213
- const copied = [];
214
- const used = new Set;
215
- for (const rawPath of paths.map((path) => path.trim()).filter(Boolean)) {
216
- const source = resolve(projectRoot, rawPath);
217
- if (!existsSync(source)) {
218
- throw new Error(`${label} does not exist: ${source}`);
219
- }
220
- const targetName = uniqueEvidenceName(rawPath, used, label);
221
- copyFileSync(source, join(targetDir, targetName));
222
- copied.push(targetName);
223
- }
224
- return copied;
225
- }
226
- function uniqueEvidenceName(path, used, fallback) {
227
- const original = sanitizeFileName(basename(path)) || fallback;
228
- const extension = extname(original);
229
- const stem = extension ? original.slice(0, -extension.length) : original;
230
- let candidate = original;
231
- let index = 2;
232
- while (used.has(candidate)) {
233
- candidate = `${stem}-${index}${extension}`;
234
- index += 1;
235
- }
236
- used.add(candidate);
237
- return candidate;
238
- }
239
- function sanitizeFileName(value) {
240
- return value.trim().replace(/[^a-zA-Z0-9._-]+/g, "-").replace(/^-+|-+$/g, "");
241
- }
242
- function mediaTypeForFileName(fileName) {
243
- const extension = extname(fileName).toLowerCase();
244
- if ([".png", ".jpg", ".jpeg", ".gif", ".webp", ".svg"].includes(extension)) {
245
- return "image";
246
- }
247
- if ([".mp4", ".mov", ".m4v", ".webm", ".avi", ".mkv"].includes(extension)) {
248
- return "video";
249
- }
250
- return "file";
251
- }
252
- function formatAssetMarkdown(name, path) {
253
- return mediaTypeForFileName(name) === "image" ? `- ![${name}](${path})` : `- [${name}](${path})`;
254
- }
255
- export {
256
- slugifyBugTitle,
257
- defaultBrowserBugProfile,
258
- defaultBrowserBugOptions,
259
- createBugReportFiles
260
- };