@h-rig/cli 0.0.6-alpha.9 → 0.0.6-alpha.90

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 (114) hide show
  1. package/README.md +1 -1
  2. package/dist/bin/build-rig-binaries.d.ts +2 -0
  3. package/dist/bin/rig.d.ts +2 -0
  4. package/dist/bin/rig.js +11052 -6668
  5. package/dist/src/app/board.d.ts +23 -0
  6. package/dist/src/app/board.js +1786 -0
  7. package/dist/src/app/drone-ui.d.ts +37 -0
  8. package/dist/src/app/drone-ui.js +294 -0
  9. package/dist/src/app/theme.d.ts +47 -0
  10. package/dist/src/app/theme.js +150 -0
  11. package/dist/src/commands/_async-ui.d.ts +13 -0
  12. package/dist/src/commands/_async-ui.js +223 -0
  13. package/dist/src/commands/_authority-runs.d.ts +22 -0
  14. package/dist/src/commands/_authority-runs.js +2 -3
  15. package/dist/src/commands/_cli-format.d.ts +49 -0
  16. package/dist/src/commands/_cli-format.js +447 -0
  17. package/dist/src/commands/_connection-state.d.ts +44 -0
  18. package/dist/src/commands/_connection-state.js +30 -11
  19. package/dist/src/commands/_doctor-checks.d.ts +52 -0
  20. package/dist/src/commands/_doctor-checks.js +180 -44
  21. package/dist/src/commands/_help-catalog.d.ts +51 -0
  22. package/dist/src/commands/_help-catalog.js +442 -0
  23. package/dist/src/commands/_json-output.d.ts +11 -0
  24. package/dist/src/commands/_json-output.js +56 -0
  25. package/dist/src/commands/_operator-surface.d.ts +34 -0
  26. package/dist/src/commands/_operator-surface.js +220 -0
  27. package/dist/src/commands/_operator-view.d.ts +30 -0
  28. package/dist/src/commands/_operator-view.js +803 -73
  29. package/dist/src/commands/_parsers.d.ts +15 -0
  30. package/dist/src/commands/_parsers.js +18 -11
  31. package/dist/src/commands/_paths.d.ts +11 -0
  32. package/dist/src/commands/_pi-frontend.d.ts +27 -0
  33. package/dist/src/commands/_pi-frontend.js +742 -0
  34. package/dist/src/commands/_pi-install.d.ts +42 -0
  35. package/dist/src/commands/_pi-install.js +5 -4
  36. package/dist/src/commands/_policy.d.ts +8 -0
  37. package/dist/src/commands/_policy.js +12 -5
  38. package/dist/src/commands/_preflight.d.ts +22 -0
  39. package/dist/src/commands/_preflight.js +190 -128
  40. package/dist/src/commands/_probes.d.ts +1 -0
  41. package/dist/src/commands/_run-driver-helpers.d.ts +99 -0
  42. package/dist/src/commands/_run-driver-helpers.js +75 -22
  43. package/dist/src/commands/_run-replay.d.ts +24 -0
  44. package/dist/src/commands/_run-replay.js +142 -0
  45. package/dist/src/commands/_server-client.d.ts +186 -0
  46. package/dist/src/commands/_server-client.js +360 -61
  47. package/dist/src/commands/_snapshot-upload.d.ts +39 -0
  48. package/dist/src/commands/_snapshot-upload.js +163 -39
  49. package/dist/src/commands/_spinner.d.ts +25 -0
  50. package/dist/src/commands/_spinner.js +65 -0
  51. package/dist/src/commands/_task-picker.d.ts +9 -0
  52. package/dist/src/commands/_task-picker.js +172 -19
  53. package/dist/src/commands/agent.d.ts +3 -0
  54. package/dist/src/commands/agent.js +39 -20
  55. package/dist/src/commands/browser.d.ts +65 -0
  56. package/dist/src/commands/browser.js +334 -51
  57. package/dist/src/commands/connect.d.ts +7 -0
  58. package/dist/src/commands/connect.js +272 -33
  59. package/dist/src/commands/dist.d.ts +28 -0
  60. package/dist/src/commands/dist.js +19 -12
  61. package/dist/src/commands/doctor.d.ts +3 -0
  62. package/dist/src/commands/doctor.js +378 -45
  63. package/dist/src/commands/github.d.ts +3 -0
  64. package/dist/src/commands/github.js +375 -53
  65. package/dist/src/commands/inbox.d.ts +30 -0
  66. package/dist/src/commands/inbox.js +760 -70
  67. package/dist/src/commands/init.d.ts +74 -0
  68. package/dist/src/commands/init.js +963 -119
  69. package/dist/src/commands/inspect.d.ts +3 -0
  70. package/dist/src/commands/inspect.js +588 -32
  71. package/dist/src/commands/inspector.d.ts +3 -0
  72. package/dist/src/commands/inspector.js +20 -13
  73. package/dist/src/commands/pi.d.ts +3 -0
  74. package/dist/src/commands/pi.js +177 -0
  75. package/dist/src/commands/plugin.d.ts +16 -0
  76. package/dist/src/commands/plugin.js +95 -27
  77. package/dist/src/commands/profile-and-review.d.ts +4 -0
  78. package/dist/src/commands/profile-and-review.js +26 -19
  79. package/dist/src/commands/queue.d.ts +3 -0
  80. package/dist/src/commands/queue.js +32 -12
  81. package/dist/src/commands/remote.d.ts +3 -0
  82. package/dist/src/commands/remote.js +43 -36
  83. package/dist/src/commands/repo-git-harness.d.ts +5 -0
  84. package/dist/src/commands/repo-git-harness.js +22 -15
  85. package/dist/src/commands/run.d.ts +3 -0
  86. package/dist/src/commands/run.js +1379 -159
  87. package/dist/src/commands/server.d.ts +7 -0
  88. package/dist/src/commands/server.js +502 -57
  89. package/dist/src/commands/setup.d.ts +16 -0
  90. package/dist/src/commands/setup.js +390 -63
  91. package/dist/src/commands/stats.d.ts +12 -0
  92. package/dist/src/commands/stats.js +1051 -0
  93. package/dist/src/commands/task-report-bug.d.ts +19 -0
  94. package/dist/src/commands/task-report-bug.js +260 -62
  95. package/dist/src/commands/task-run-driver.d.ts +132 -0
  96. package/dist/src/commands/task-run-driver.js +886 -130
  97. package/dist/src/commands/task.d.ts +14 -0
  98. package/dist/src/commands/task.js +1644 -314
  99. package/dist/src/commands/test.d.ts +3 -0
  100. package/dist/src/commands/test.js +15 -8
  101. package/dist/src/commands/workspace.d.ts +3 -0
  102. package/dist/src/commands/workspace.js +18 -11
  103. package/dist/src/commands.d.ts +29 -0
  104. package/dist/src/commands.js +10967 -6637
  105. package/dist/src/index.d.ts +4 -0
  106. package/dist/src/index.js +10168 -5787
  107. package/dist/src/launcher.d.ts +61 -0
  108. package/dist/src/launcher.js +77 -13
  109. package/dist/src/report-bug.d.ts +44 -0
  110. package/dist/src/report-bug.js +3 -3
  111. package/dist/src/runner.d.ts +47 -0
  112. package/dist/src/runner.js +16 -22
  113. package/dist/src/withMutedConsole.d.ts +2 -0
  114. package/package.json +13 -6
@@ -0,0 +1,3 @@
1
+ import { type RunnerContext } from "../runner";
2
+ import type { CommandOutcome } from "@rig/runtime/control-plane/runtime/types";
3
+ export declare function executeTest(context: RunnerContext, args: string[]): Promise<CommandOutcome>;
@@ -1,12 +1,19 @@
1
1
  // @bun
2
2
  // packages/cli/src/runner.ts
3
3
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
4
- import { CliError } from "@rig/runtime/control-plane/errors";
4
+ import { CliError as RuntimeCliError } 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
- import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
7
+
8
+ class CliError extends RuntimeCliError {
9
+ hint;
10
+ constructor(message, exitCode = 1, options = {}) {
11
+ super(message, exitCode);
12
+ if (options.hint?.trim()) {
13
+ this.hint = options.hint.trim();
14
+ }
15
+ }
16
+ }
10
17
  function requireNoExtraArgs(args, usage) {
11
18
  if (args.length > 0) {
12
19
  throw new CliError(`Unexpected arguments: ${args.join(" ")}
@@ -19,19 +26,19 @@ async function executeTest(context, args) {
19
26
  const [command = "unit", ...rest] = args;
20
27
  switch (command) {
21
28
  case "unit":
22
- requireNoExtraArgs(rest, "bun run rig test unit");
29
+ requireNoExtraArgs(rest, "rig test unit");
23
30
  await context.runCommand(["bun", "test", "tests/harness/", "--ignore", "tests/harness/e2e/**"]);
24
31
  return { ok: true, group: "test", command };
25
32
  case "e2e":
26
- requireNoExtraArgs(rest, "bun run rig test e2e");
33
+ requireNoExtraArgs(rest, "rig test e2e");
27
34
  await context.runCommand(["bun", "test", "tests/harness/e2e/"]);
28
35
  return { ok: true, group: "test", command };
29
36
  case "all":
30
- requireNoExtraArgs(rest, "bun run rig test all");
37
+ requireNoExtraArgs(rest, "rig test all");
31
38
  await context.runCommand(["bun", "test", "tests/harness/"]);
32
39
  return { ok: true, group: "test", command };
33
40
  default:
34
- throw new CliError2(`Unknown test command: ${command}`);
41
+ throw new CliError(`Unknown test command: ${command}`, 1, { hint: "Run `rig test --help` \u2014 commands are unit|e2e|all." });
35
42
  }
36
43
  }
37
44
  export {
@@ -0,0 +1,3 @@
1
+ import { type RunnerContext } from "../runner";
2
+ import type { CommandOutcome } from "@rig/runtime/control-plane/runtime/types";
3
+ export declare function executeWorkspace(context: RunnerContext, args: string[]): Promise<CommandOutcome>;
@@ -1,12 +1,19 @@
1
1
  // @bun
2
2
  // packages/cli/src/runner.ts
3
3
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
4
- import { CliError } from "@rig/runtime/control-plane/errors";
4
+ import { CliError as RuntimeCliError } 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
- import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
7
+
8
+ class CliError extends RuntimeCliError {
9
+ hint;
10
+ constructor(message, exitCode = 1, options = {}) {
11
+ super(message, exitCode);
12
+ if (options.hint?.trim()) {
13
+ this.hint = options.hint.trim();
14
+ }
15
+ }
16
+ }
10
17
  function takeOption(args, option) {
11
18
  const rest = [];
12
19
  let value;
@@ -15,7 +22,7 @@ function takeOption(args, option) {
15
22
  if (current === option) {
16
23
  const next = args[index + 1];
17
24
  if (!next || next.startsWith("-")) {
18
- throw new CliError(`Missing value for ${option}`);
25
+ throw new CliError(`Missing value for ${option}`, 1, { hint: `Provide a value after ${option}, e.g. \`${option} <value>\`.` });
19
26
  }
20
27
  value = next;
21
28
  index += 1;
@@ -45,7 +52,7 @@ async function executeWorkspace(context, args) {
45
52
  const [command = "summary", ...rest] = args;
46
53
  switch (command) {
47
54
  case "summary": {
48
- requireNoExtraArgs(rest, "bun run rig workspace summary");
55
+ requireNoExtraArgs(rest, "rig workspace summary");
49
56
  const summary = await readWorkspaceSummary(context.projectRoot);
50
57
  if (context.outputMode === "text") {
51
58
  console.log("Workspace Summary");
@@ -70,7 +77,7 @@ Warnings:`);
70
77
  return { ok: true, group: "workspace", command, details: summary };
71
78
  }
72
79
  case "topology": {
73
- requireNoExtraArgs(rest, "bun run rig workspace topology");
80
+ requireNoExtraArgs(rest, "rig workspace topology");
74
81
  const topology = readWorkspaceTopology(context.projectRoot);
75
82
  if (context.outputMode === "text") {
76
83
  console.log(`Topology: ${topology.status}`);
@@ -83,7 +90,7 @@ Warnings:`);
83
90
  return { ok: true, group: "workspace", command, details: topology };
84
91
  }
85
92
  case "remote-hosts": {
86
- requireNoExtraArgs(rest, "bun run rig workspace remote-hosts");
93
+ requireNoExtraArgs(rest, "rig workspace remote-hosts");
87
94
  const fleet = readWorkspaceRemoteFleet(context.projectRoot);
88
95
  if (context.outputMode === "text") {
89
96
  console.log(`Remote Hosts: ${fleet.status}`);
@@ -98,9 +105,9 @@ Warnings:`);
98
105
  let pending = serviceRest;
99
106
  const services = takeOption(pending, "--service");
100
107
  pending = services.rest;
101
- requireNoExtraArgs(pending, "bun run rig workspace service-fabric <status|up|verify|down> [--service <name>]");
108
+ requireNoExtraArgs(pending, "rig workspace service-fabric <status|up|verify|down> [--service <name>]");
102
109
  if (action !== "status" && action !== "up" && action !== "verify" && action !== "down") {
103
- throw new CliError2(`Unknown workspace service-fabric action: ${action}`);
110
+ throw new CliError(`Unknown workspace service-fabric action: ${action}`, 1, { hint: "Use one of: `rig workspace service-fabric status|up|verify|down`." });
104
111
  }
105
112
  const selectedServices = services.value ? services.value.split(",").map((entry) => entry.trim()).filter(Boolean) : [];
106
113
  const summary = action === "status" ? await mutateWorkspaceServiceFabric(context.projectRoot, "verify", selectedServices) : await mutateWorkspaceServiceFabric(context.projectRoot, action, selectedServices);
@@ -115,7 +122,7 @@ Warnings:`);
115
122
  };
116
123
  }
117
124
  default:
118
- throw new CliError2(`Unknown workspace command: ${command}`);
125
+ throw new CliError(`Unknown workspace command: ${command}`, 1, { hint: "Run `rig workspace --help` \u2014 commands are summary|topology|remote-hosts|service-fabric." });
119
126
  }
120
127
  }
121
128
  export {
@@ -0,0 +1,29 @@
1
+ import { type RunnerContext } from "./runner";
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
+ import { buildRunPrompt } from "./commands/_run-driver-helpers";
5
+ import { bugPromptExampleText, formatDroppedAssetDefault, splitDroppedAssetList, validateRequiredBugPromptValue } from "./commands/task-report-bug";
6
+ export declare function printGroupHelp(group: string): void;
7
+ /** Returns true if args[0] requests group help (--help, -h, or "help"). */
8
+ export declare function isHelpArg(arg: string | undefined): boolean;
9
+ export declare function helpText(): string;
10
+ export declare function execute(context: RunnerContext, args: string[]): Promise<CommandOutcome>;
11
+ export { buildRigInitConfigSource } from "./commands/init";
12
+ export type { RigInitConfigInput } from "./commands/init";
13
+ export declare const __testOnly: {
14
+ 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
+ };