@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,15 @@
1
+ import type { TaskSourceConfig } from "@rig/contracts";
2
+ import type { RigPluginWithRuntime } from "@rig/core";
3
+ export declare function parsePositiveInt(value: string | undefined, option: string, fallback: number): number;
4
+ export declare function parseOptionalPositiveInt(value: string | undefined, option: string): number | undefined;
5
+ export declare function parseRequiredPositiveInt(value: string | undefined, option: string): number;
6
+ export declare function parseAction(value: string | undefined): "validate" | "verify" | "pipeline";
7
+ export declare function parseIsolationMode(value: string | undefined, allowOff: true): "off" | "worktree";
8
+ export declare function parseIsolationMode(value: string | undefined, allowOff: false): "worktree";
9
+ export declare function parseInstallScope(value: string | undefined): "user" | "system";
10
+ export declare function resolveInstallDir(scope: "user" | "system", explicitPath: string | undefined): string;
11
+ export type CliRigConfig = {
12
+ plugins?: readonly RigPluginWithRuntime[];
13
+ taskSource?: TaskSourceConfig;
14
+ };
15
+ export declare function loadRigConfigOrNull(projectRoot: string): Promise<CliRigConfig | null>;
@@ -7,12 +7,19 @@ import { resolve } from "path";
7
7
 
8
8
  // packages/cli/src/runner.ts
9
9
  import { EventBus } from "@rig/runtime/control-plane/runtime/events";
10
- import { CliError } from "@rig/runtime/control-plane/errors";
10
+ import { CliError as RuntimeCliError } from "@rig/runtime/control-plane/errors";
11
11
  import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
12
- import { PluginManager } from "@rig/runtime/control-plane/runtime/plugins";
13
- import { loadRuntimeContextFromEnv } from "@rig/runtime/control-plane/runtime/context";
14
12
  import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
15
- import { CliError as CliError2 } from "@rig/runtime/control-plane/errors";
13
+
14
+ class CliError extends RuntimeCliError {
15
+ hint;
16
+ constructor(message, exitCode = 1, options = {}) {
17
+ super(message, exitCode);
18
+ if (options.hint?.trim()) {
19
+ this.hint = options.hint.trim();
20
+ }
21
+ }
22
+ }
16
23
 
17
24
  // packages/cli/src/commands/_parsers.ts
18
25
  function parsePositiveInt(value, option, fallback) {
@@ -21,7 +28,7 @@ function parsePositiveInt(value, option, fallback) {
21
28
  }
22
29
  const parsed = Number.parseInt(value, 10);
23
30
  if (!Number.isFinite(parsed) || parsed <= 0) {
24
- throw new CliError2(`Invalid ${option} value: ${value}`);
31
+ throw new CliError(`Invalid ${option} value: ${value}`, 1, { hint: `Pass a positive integer, e.g. \`${option} 10\`.` });
25
32
  }
26
33
  return parsed;
27
34
  }
@@ -31,17 +38,17 @@ function parseOptionalPositiveInt(value, option) {
31
38
  }
32
39
  const parsed = Number.parseInt(value, 10);
33
40
  if (!Number.isFinite(parsed) || parsed <= 0) {
34
- throw new CliError2(`Invalid ${option} value: ${value}`);
41
+ throw new CliError(`Invalid ${option} value: ${value}`, 1, { hint: `Pass a positive integer, e.g. \`${option} 10\`.` });
35
42
  }
36
43
  return parsed;
37
44
  }
38
45
  function parseRequiredPositiveInt(value, option) {
39
46
  if (!value) {
40
- throw new CliError2(`Missing value for ${option}.`);
47
+ throw new CliError(`Missing value for ${option}.`, 1, { hint: `Provide a value after ${option}, e.g. \`${option} 10\`.` });
41
48
  }
42
49
  const parsed = Number.parseInt(value, 10);
43
50
  if (!Number.isFinite(parsed) || parsed <= 0) {
44
- throw new CliError2(`Invalid ${option} value: ${value}`);
51
+ throw new CliError(`Invalid ${option} value: ${value}`, 1, { hint: `Pass a positive integer, e.g. \`${option} 10\`.` });
45
52
  }
46
53
  return parsed;
47
54
  }
@@ -55,7 +62,7 @@ function parseAction(value) {
55
62
  if (value === "pipeline") {
56
63
  return "pipeline";
57
64
  }
58
- throw new CliError2(`Invalid --action value: ${value}. Use validate, verify, or pipeline.`);
65
+ throw new CliError(`Invalid --action value: ${value}. Use validate, verify, or pipeline.`);
59
66
  }
60
67
  function parseIsolationMode(value, allowOff) {
61
68
  if (!value) {
@@ -67,7 +74,7 @@ function parseIsolationMode(value, allowOff) {
67
74
  if (allowOff && value === "off") {
68
75
  return value;
69
76
  }
70
- throw new CliError2(`Invalid isolation mode: ${value}. Use ${allowOff ? "off|" : ""}worktree.`);
77
+ throw new CliError(`Invalid isolation mode: ${value}. Use ${allowOff ? "off|" : ""}worktree.`);
71
78
  }
72
79
  function parseInstallScope(value) {
73
80
  if (!value || value === "user") {
@@ -76,7 +83,7 @@ function parseInstallScope(value) {
76
83
  if (value === "system") {
77
84
  return "system";
78
85
  }
79
- throw new CliError2(`Invalid --scope value: ${value}. Use user|system.`);
86
+ throw new CliError(`Invalid --scope value: ${value}. Use user|system.`);
80
87
  }
81
88
  function resolveInstallDir(scope, explicitPath) {
82
89
  if (explicitPath) {
@@ -0,0 +1,11 @@
1
+ export declare function resolveControlPlaneMonorepoRoot(projectRoot: string): string;
2
+ export declare function resolveControlPlaneTaskConfigPath(projectRoot: string): string;
3
+ export declare function resolveControlPlaneHostStateRoot(projectRoot: string): string;
4
+ export declare function resolveControlPlaneHostStateDir(projectRoot: string): string;
5
+ export declare function resolveControlPlaneHostLogsDir(projectRoot: string): string;
6
+ export declare function resolveControlPlaneHostBinDir(projectRoot: string): string;
7
+ export declare function resolveControlPlaneHostDistDir(projectRoot: string): string;
8
+ export declare function resolveControlPlaneMonorepoStateRoot(projectRoot: string): string;
9
+ export declare function resolveControlPlaneMonorepoRuntimeDir(projectRoot: string): string;
10
+ export declare function resolveControlPlaneArtifactsDir(projectRoot: string): string;
11
+ export declare function resolveControlPlaneDefinitionRoot(projectRoot: string): string;
@@ -0,0 +1,27 @@
1
+ import type { RunnerContext } from "../runner";
2
+ type AttachResult = {
3
+ run: Record<string, unknown>;
4
+ logs: Record<string, unknown>[];
5
+ timeline: Record<string, unknown>[];
6
+ timelineCursor: string | null;
7
+ steered: boolean;
8
+ rendered: string;
9
+ detached?: boolean;
10
+ };
11
+ /**
12
+ * Compose the operator-session environment for the attached Pi console.
13
+ * Exported for tests: this is the contract between `rig run attach` and the
14
+ * pi-rig extension's context discovery (see packages/pi-rig/src/client.ts).
15
+ */
16
+ export declare function buildOperatorPiEnv(input: {
17
+ readonly runId: string;
18
+ readonly serverUrl: string;
19
+ readonly authToken?: string | null;
20
+ readonly serverProjectRoot?: string | null;
21
+ readonly sessionDir: string;
22
+ }): Record<string, string>;
23
+ export declare function attachRunBundledPiFrontend(context: Pick<RunnerContext, "projectRoot" | "outputMode">, input: {
24
+ readonly runId: string;
25
+ readonly steered?: boolean;
26
+ }): Promise<AttachResult>;
27
+ export {};