@h-rig/cli 0.0.6-alpha.13 → 0.0.6-alpha.130

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 (48) hide show
  1. package/README.md +6 -28
  2. package/bin/rig.js +16 -0
  3. package/package.json +14 -27
  4. package/dist/bin/build-rig-binaries.js +0 -107
  5. package/dist/bin/rig.js +0 -9592
  6. package/dist/src/commands/_authority-runs.js +0 -111
  7. package/dist/src/commands/_connection-state.js +0 -123
  8. package/dist/src/commands/_doctor-checks.js +0 -519
  9. package/dist/src/commands/_operator-view.js +0 -340
  10. package/dist/src/commands/_parsers.js +0 -107
  11. package/dist/src/commands/_paths.js +0 -50
  12. package/dist/src/commands/_pi-install.js +0 -184
  13. package/dist/src/commands/_policy.js +0 -79
  14. package/dist/src/commands/_preflight.js +0 -478
  15. package/dist/src/commands/_probes.js +0 -13
  16. package/dist/src/commands/_run-driver-helpers.js +0 -289
  17. package/dist/src/commands/_server-client.js +0 -402
  18. package/dist/src/commands/_snapshot-upload.js +0 -331
  19. package/dist/src/commands/_task-picker.js +0 -48
  20. package/dist/src/commands/agent.js +0 -498
  21. package/dist/src/commands/browser.js +0 -890
  22. package/dist/src/commands/connect.js +0 -180
  23. package/dist/src/commands/dist.js +0 -402
  24. package/dist/src/commands/doctor.js +0 -529
  25. package/dist/src/commands/github.js +0 -294
  26. package/dist/src/commands/inbox.js +0 -160
  27. package/dist/src/commands/init.js +0 -1372
  28. package/dist/src/commands/inspect.js +0 -174
  29. package/dist/src/commands/inspector.js +0 -256
  30. package/dist/src/commands/plugin.js +0 -167
  31. package/dist/src/commands/profile-and-review.js +0 -178
  32. package/dist/src/commands/queue.js +0 -197
  33. package/dist/src/commands/remote.js +0 -507
  34. package/dist/src/commands/repo-git-harness.js +0 -221
  35. package/dist/src/commands/run.js +0 -797
  36. package/dist/src/commands/server.js +0 -386
  37. package/dist/src/commands/setup.js +0 -699
  38. package/dist/src/commands/task-report-bug.js +0 -1083
  39. package/dist/src/commands/task-run-driver.js +0 -2049
  40. package/dist/src/commands/task.js +0 -1343
  41. package/dist/src/commands/test.js +0 -39
  42. package/dist/src/commands/workspace.js +0 -123
  43. package/dist/src/commands.js +0 -9271
  44. package/dist/src/index.js +0 -9610
  45. package/dist/src/launcher.js +0 -133
  46. package/dist/src/report-bug.js +0 -260
  47. package/dist/src/runner.js +0 -273
  48. package/dist/src/withMutedConsole.js +0 -42
package/README.md CHANGED
@@ -1,30 +1,8 @@
1
- # CLI Package
1
+ # @h-rig/cli
2
2
 
3
- `@rig/cli` exposes the `rig` command.
3
+ Installs the prebuilt, self-contained `rig` binary for your platform via an os/cpu-gated optional dependency, then launches it.
4
4
 
5
- ## Purpose
6
-
7
- - route operator commands into the runtime control plane
8
- - provide setup, server, task, review, queue, and profile entry points
9
-
10
- ## Common command
11
-
12
- - `bun run rig -- <subcommand>`
13
- - `bun run rig report-bug`
14
- - `bun run rig report-bug --no-prompt --browser --title "OTP submit fails" --url "https://dev.rig.hptestingsite.com/login?next=%2F" --environment shared-dev --asset ./path/to/screenshot.png --video ./path/to/recording.webm`
15
- - `bun run rig report-bug --no-prompt --no-browser --title "OTP API fails" --url "https://dev.rig.hptestingsite.com/api/auth/email/otp/verify" --asset ./path/to/api-response.txt`
16
- - `bun run rig browser --help`
17
- - `bun run rig browser explain`
18
- - `bun run rig browser hp-next dev`
19
-
20
- ## Notes
21
-
22
- - CLI behavior should stay thin and delegate business logic into `@rig/runtime`.
23
- - `report-bug` uses `@clack/prompts` for its interactive wizard and asks whether Rig Browser is required.
24
- - `report-bug` creates a runnable beads `task` by default, writes committable evidence under `repos/spliter-monorepo/artifacts/<task-id>/bug-report/`, and upserts task-config wiring.
25
- - `report-bug --no-beads` keeps the old draft-only behavior under `docs/bug-reports/`.
26
- - `report-bug --no-browser` skips `browser.json`, the `browser-required` label, browser validation, and browser helper commands while preserving task assets.
27
- - `report-bug` accepts drag-and-drop asset values through `--asset` and `--video`; copied files are stored under `bug-report/assets/` and indexed in `manifest.json`.
28
- - Browser bug-report evidence must be tracked by git before validation/handoff; untracked assets fail `integration:browser-bug-report-task`.
29
- - Key `report-bug` flags: `--browser`, `--no-browser`, `--summary`, `--steps`, `--expected`, `--actual`, `--evidence`, `--asset`, `--video`, `--screenshot`, `--priority`, `--labels`, `--parent`, `--assignee`, `--owner`, `--preset`, `--profile`, `--attach-url`, `--state-dir`, `--mode`, `--viewport`, `--output-dir`, `--slug`, and `--overwrite`.
30
- - `rig browser` is the operator-friendly command family for Rig Browser help, hp-next launch/check/e2e/reset, and package-level CDP/profile diagnostics.
5
+ ```
6
+ bun add -g @h-rig/cli # or: npm i -g @h-rig/cli
7
+ rig --help
8
+ ```
package/bin/rig.js ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ // Launcher for the prebuilt rig binary (@h-rig/cli-<os>-<arch>, an optional dep).
4
+ const { spawnSync } = require("node:child_process");
5
+ const tag = process.platform + "-" + process.arch;
6
+ const exe = process.platform === "win32" ? "rig.exe" : "rig";
7
+ let bin;
8
+ try { bin = require.resolve("@h-rig/cli-" + tag + "/" + exe); } catch (_) {}
9
+ if (!bin) {
10
+ console.error("@h-rig/cli: no prebuilt rig binary for " + tag + ".");
11
+ console.error("Supported: darwin-arm64, darwin-x64, linux-x64, linux-arm64, win32-x64.");
12
+ process.exit(1);
13
+ }
14
+ const res = spawnSync(bin, process.argv.slice(2), { stdio: "inherit" });
15
+ if (res.error) { console.error(String(res.error.message || res.error)); process.exit(1); }
16
+ process.exit(res.status == null ? 1 : res.status);
package/package.json CHANGED
@@ -1,32 +1,19 @@
1
1
  {
2
2
  "name": "@h-rig/cli",
3
- "version": "0.0.6-alpha.13",
4
- "type": "module",
5
- "description": "Rig package",
6
- "license": "UNLICENSED",
7
- "files": [
8
- "dist",
9
- "README.md"
10
- ],
11
- "exports": {
12
- ".": {
13
- "import": "./dist/src/index.js"
14
- }
15
- },
16
- "engines": {
17
- "bun": ">=1.3.11"
18
- },
19
- "main": "./dist/src/index.js",
20
- "module": "./dist/src/index.js",
3
+ "version": "0.0.6-alpha.130",
4
+ "description": "Rig CLI — installs the prebuilt single-file rig binary for your platform.",
5
+ "license": "MIT",
21
6
  "bin": {
22
- "rig": "./dist/bin/rig.js"
7
+ "rig": "bin/rig.js"
23
8
  },
24
- "dependencies": {
25
- "@clack/prompts": "^1.2.0",
26
- "@rig/core": "npm:@h-rig/core@0.0.6-alpha.13",
27
- "@rig/runtime": "npm:@h-rig/runtime@0.0.6-alpha.13",
28
- "@rig/client": "npm:@h-rig/client@0.0.6-alpha.13",
29
- "@rig/server": "npm:@h-rig/server@0.0.6-alpha.13",
30
- "picocolors": "^1.1.1"
31
- }
9
+ "optionalDependencies": {
10
+ "@h-rig/cli-darwin-arm64": "0.0.6-alpha.130",
11
+ "@h-rig/cli-darwin-x64": "0.0.6-alpha.130",
12
+ "@h-rig/cli-linux-x64": "0.0.6-alpha.130",
13
+ "@h-rig/cli-linux-arm64": "0.0.6-alpha.130",
14
+ "@h-rig/cli-win32-x64": "0.0.6-alpha.130"
15
+ },
16
+ "files": [
17
+ "bin"
18
+ ]
32
19
  }
@@ -1,107 +0,0 @@
1
- #!/usr/bin/env bun
2
- // @bun
3
-
4
- // packages/cli/bin/build-rig-binaries.ts
5
- import { cpSync, existsSync, mkdirSync, readFileSync } from "fs";
6
- import { resolve } from "path";
7
- import { runCapture } from "@rig/runtime/control-plane/native/utils";
8
- import { buildRuntimeBinary } from "@rig/runtime/binary-run";
9
- function readCliVersion(rootDir) {
10
- try {
11
- const pkg = JSON.parse(readFileSync(resolve(rootDir, "packages/cli/package.json"), "utf-8"));
12
- return pkg.version || "0.0.0-dev";
13
- } catch {
14
- return "0.0.0-dev";
15
- }
16
- }
17
- async function main() {
18
- const rootDir = resolve(import.meta.dir, "..", "..", "..");
19
- process.chdir(rootDir);
20
- const args = parseArgs(process.argv.slice(2));
21
- const stamp = timestamp();
22
- const outputDir = args.outputDir || resolve(rootDir, ".rig/dist", `rig-${stamp}`);
23
- const binDir = resolve(outputDir, "bin");
24
- const runtimeDir = resolve(outputDir, "runtime", "rig");
25
- mkdirSync(binDir, { recursive: true });
26
- mkdirSync(runtimeDir, { recursive: true });
27
- const cliVersion = readCliVersion(rootDir);
28
- await buildBinary("packages/cli/bin/rig.ts", resolve(binDir, "rig"), rootDir, {
29
- "process.env.RIG_CLI_VERSION": JSON.stringify(cliVersion)
30
- });
31
- await buildBinary("packages/runtime/bin/rig-agent-dispatch.ts", resolve(binDir, "rig-agent"), rootDir);
32
- for (const entry of [
33
- "hooks",
34
- "lib",
35
- "tools",
36
- "templates",
37
- "policy",
38
- "plugins",
39
- "config.sh",
40
- "task-config.json"
41
- ]) {
42
- const source = resolve(rootDir, "rig", entry);
43
- if (existsSync(source)) {
44
- cpSync(source, resolve(runtimeDir, entry), { recursive: true });
45
- }
46
- }
47
- const manifest = {
48
- name: "project-rig-harness",
49
- version: cliVersion,
50
- builtAt: new Date().toISOString(),
51
- gitHead: runCapture(["git", "rev-parse", "HEAD"], rootDir).stdout.trim() || "unknown",
52
- bunVersion: Bun.version,
53
- binaries: {
54
- rig: "bin/rig",
55
- rigAgent: "bin/rig-agent"
56
- }
57
- };
58
- await Bun.write(resolve(outputDir, "manifest.json"), `${JSON.stringify(manifest, null, 2)}
59
- `);
60
- const archive = `${outputDir}.tar.gz`;
61
- const tar = await Bun.$`tar -czf ${archive} -C ${outputDir} .`.cwd(rootDir).quiet().nothrow();
62
- if (tar.exitCode !== 0) {
63
- throw new Error(`Failed to create archive: ${tar.stderr.toString() || tar.stdout.toString()}`);
64
- }
65
- console.log("Build complete");
66
- console.log(`- directory: ${outputDir}`);
67
- console.log(`- archive: ${archive}`);
68
- }
69
- function parseArgs(argv) {
70
- const args = {};
71
- for (let i = 0;i < argv.length; i += 1) {
72
- const current = argv[i];
73
- if (current === "--output-dir") {
74
- const value = argv[i + 1];
75
- if (!value) {
76
- throw new Error("Missing value for --output-dir");
77
- }
78
- args.outputDir = resolve(process.cwd(), value);
79
- i += 1;
80
- continue;
81
- }
82
- throw new Error(`Unknown option: ${current}`);
83
- }
84
- return args;
85
- }
86
- async function buildBinary(source, output, cwd, define) {
87
- await buildRuntimeBinary({
88
- sourcePath: source,
89
- outputPath: output,
90
- cwd,
91
- ...define ? { define } : {}
92
- });
93
- }
94
- function timestamp() {
95
- const date = new Date;
96
- const yyyy = date.getFullYear();
97
- const mm = `${date.getMonth() + 1}`.padStart(2, "0");
98
- const dd = `${date.getDate()}`.padStart(2, "0");
99
- const hh = `${date.getHours()}`.padStart(2, "0");
100
- const min = `${date.getMinutes()}`.padStart(2, "0");
101
- const sec = `${date.getSeconds()}`.padStart(2, "0");
102
- return `${yyyy}${mm}${dd}-${hh}${min}${sec}`;
103
- }
104
- main().catch((error) => {
105
- console.error(error instanceof Error ? error.message : error);
106
- process.exit(1);
107
- });