@h-rig/cli 0.0.6-alpha.9 → 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 (116) hide show
  1. package/README.md +18 -19
  2. package/dist/bin/build-rig-binaries.d.ts +2 -0
  3. package/dist/bin/build-rig-binaries.js +22 -10
  4. package/dist/bin/rig.d.ts +72 -0
  5. package/dist/bin/rig.js +15637 -7344
  6. package/dist/config/rig-default-config.yml +5 -0
  7. package/dist/src/app/drone-ui.d.ts +34 -0
  8. package/dist/src/app/drone-ui.js +278 -0
  9. package/dist/src/commands/_async-ui.d.ts +10 -0
  10. package/dist/src/commands/_async-ui.js +121 -0
  11. package/dist/src/commands/_cli-format.d.ts +56 -0
  12. package/dist/src/commands/_cli-format.js +319 -0
  13. package/dist/src/commands/_connection-state.d.ts +54 -0
  14. package/dist/src/commands/_connection-state.js +75 -11
  15. package/dist/src/commands/_doctor-checks.d.ts +46 -0
  16. package/dist/src/commands/_doctor-checks.js +100 -267
  17. package/dist/src/commands/_help-catalog.d.ts +51 -0
  18. package/dist/src/commands/_help-catalog.js +502 -0
  19. package/dist/src/commands/_inprocess-services.d.ts +33 -0
  20. package/dist/src/commands/_inprocess-services.js +102 -0
  21. package/dist/src/commands/_json-output.d.ts +11 -0
  22. package/dist/src/commands/_json-output.js +60 -0
  23. package/dist/src/commands/_lazy-reconcile.d.ts +34 -0
  24. package/dist/src/commands/_lazy-reconcile.js +102 -0
  25. package/dist/src/commands/_parsers.d.ts +15 -0
  26. package/dist/src/commands/_parsers.js +18 -11
  27. package/dist/src/commands/_paths.d.ts +11 -0
  28. package/dist/src/commands/_paths.js +1 -1
  29. package/dist/src/commands/_pi-frontend.d.ts +35 -0
  30. package/dist/src/commands/_pi-frontend.js +64 -0
  31. package/dist/src/commands/_pi-install.d.ts +42 -0
  32. package/dist/src/commands/_pi-install.js +19 -36
  33. package/dist/src/commands/_policy.d.ts +8 -0
  34. package/dist/src/commands/_policy.js +67 -19
  35. package/dist/src/commands/_probes.d.ts +1 -0
  36. package/dist/src/commands/_run-bridge.d.ts +114 -0
  37. package/dist/src/commands/_run-bridge.js +387 -0
  38. package/dist/src/commands/_run-diagnostics.d.ts +9 -0
  39. package/dist/src/commands/_run-diagnostics.js +51 -0
  40. package/dist/src/commands/_run-driver-helpers.d.ts +26 -0
  41. package/dist/src/commands/_run-driver-helpers.js +79 -230
  42. package/dist/src/commands/_run-projection.d.ts +50 -0
  43. package/dist/src/commands/_run-projection.js +349 -0
  44. package/dist/src/commands/_run-subcommands.d.ts +3 -0
  45. package/dist/src/commands/_run-subcommands.js +31 -0
  46. package/dist/src/commands/_spinner.d.ts +25 -0
  47. package/dist/src/commands/_spinner.js +65 -0
  48. package/dist/src/commands/agent.d.ts +3 -0
  49. package/dist/src/commands/agent.js +8575 -236
  50. package/dist/src/commands/dist.d.ts +28 -0
  51. package/dist/src/commands/dist.js +44 -29
  52. package/dist/src/commands/doctor.d.ts +3 -0
  53. package/dist/src/commands/doctor.js +219 -268
  54. package/dist/src/commands/github.d.ts +3 -0
  55. package/dist/src/commands/github.js +236 -188
  56. package/dist/src/commands/inbox.d.ts +28 -0
  57. package/dist/src/commands/inbox.js +530 -111
  58. package/dist/src/commands/init.d.ts +64 -0
  59. package/dist/src/commands/init.js +912 -705
  60. package/dist/src/commands/inspect.d.ts +20 -0
  61. package/dist/src/commands/inspect.js +709 -119
  62. package/dist/src/commands/pi.d.ts +3 -0
  63. package/dist/src/commands/pi.js +177 -0
  64. package/dist/src/commands/plugin.d.ts +16 -0
  65. package/dist/src/commands/plugin.js +576 -29
  66. package/dist/src/commands/profile-and-review.d.ts +4 -0
  67. package/dist/src/commands/profile-and-review.js +112 -67
  68. package/dist/src/commands/queue.d.ts +3 -0
  69. package/dist/src/commands/queue.js +20 -20
  70. package/dist/src/commands/remote.d.ts +3 -0
  71. package/dist/src/commands/remote.js +880 -50
  72. package/dist/src/commands/repo-git-harness.d.ts +5 -0
  73. package/dist/src/commands/repo-git-harness.js +78 -28
  74. package/dist/src/commands/run.d.ts +21 -0
  75. package/dist/src/commands/run.js +17701 -661
  76. package/dist/src/commands/server.d.ts +3 -0
  77. package/dist/src/commands/server.js +166 -303
  78. package/dist/src/commands/setup.d.ts +16 -0
  79. package/dist/src/commands/setup.js +244 -299
  80. package/dist/src/commands/stats.d.ts +15 -0
  81. package/dist/src/commands/stats.js +979 -0
  82. package/dist/src/commands/task-run-driver.d.ts +94 -0
  83. package/dist/src/commands/task-run-driver.js +116 -1961
  84. package/dist/src/commands/task.d.ts +35 -0
  85. package/dist/src/commands/task.js +676 -1201
  86. package/dist/src/commands/test.d.ts +3 -0
  87. package/dist/src/commands/test.js +15 -8
  88. package/dist/src/commands/triage.d.ts +11 -0
  89. package/dist/src/commands/triage.js +227 -0
  90. package/dist/src/commands/workspace.d.ts +3 -0
  91. package/dist/src/commands/workspace.js +18 -11
  92. package/dist/src/commands.d.ts +13 -0
  93. package/dist/src/commands.js +16792 -8055
  94. package/dist/src/index.d.ts +4 -0
  95. package/dist/src/index.js +16862 -8450
  96. package/dist/src/launcher.d.ts +61 -0
  97. package/dist/src/launcher.js +81 -13
  98. package/dist/src/operator-cli.d.ts +2 -0
  99. package/dist/src/operator-cli.js +17837 -0
  100. package/dist/src/operator-entry.d.ts +1 -0
  101. package/dist/src/operator-entry.js +3 -0
  102. package/dist/src/runner.d.ts +47 -0
  103. package/dist/src/runner.js +16 -22
  104. package/dist/src/withMutedConsole.d.ts +2 -0
  105. package/package.json +21 -8
  106. package/dist/src/commands/_authority-runs.js +0 -111
  107. package/dist/src/commands/_operator-view.js +0 -340
  108. package/dist/src/commands/_preflight.js +0 -478
  109. package/dist/src/commands/_server-client.js +0 -382
  110. package/dist/src/commands/_snapshot-upload.js +0 -331
  111. package/dist/src/commands/_task-picker.js +0 -48
  112. package/dist/src/commands/browser.js +0 -890
  113. package/dist/src/commands/connect.js +0 -180
  114. package/dist/src/commands/inspector.js +0 -256
  115. package/dist/src/commands/task-report-bug.js +0 -1083
  116. package/dist/src/report-bug.js +0 -260
@@ -2,17 +2,24 @@
2
2
  var __require = import.meta.require;
3
3
 
4
4
  // packages/cli/src/commands/setup.ts
5
- import { existsSync as existsSync5, mkdirSync as mkdirSync2, readdirSync, writeFileSync as writeFileSync2 } from "fs";
6
- import { resolve as resolve6 } from "path";
5
+ import { existsSync as existsSync4, mkdirSync as mkdirSync2, readdirSync, writeFileSync as writeFileSync2 } from "fs";
6
+ import { resolve as resolve5 } 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
  function requireNoExtraArgs(args, usage) {
17
24
  if (args.length > 0) {
18
25
  throw new CliError(`Unexpected arguments: ${args.join(" ")}
@@ -78,7 +85,7 @@ async function loadRigConfigOrNull(projectRoot) {
78
85
 
79
86
  // packages/cli/src/commands/_paths.ts
80
87
  import { resolve } from "path";
81
- import { resolveMonorepoRoot } from "@rig/runtime/control-plane/native/utils";
88
+ import { resolveMonorepoRoot } from "@rig/runtime/layout";
82
89
  function resolveControlPlaneMonorepoRoot(projectRoot) {
83
90
  return resolveMonorepoRoot(projectRoot);
84
91
  }
@@ -99,10 +106,10 @@ function resolveControlPlaneDefinitionRoot(projectRoot) {
99
106
  }
100
107
 
101
108
  // packages/cli/src/commands/_pi-install.ts
102
- import { existsSync, readFileSync, rmSync } from "fs";
109
+ import { existsSync } from "fs";
103
110
  import { homedir } from "os";
104
111
  import { resolve as resolve2 } from "path";
105
- var PI_RIG_PACKAGE_NAME = "@rig/pi-rig";
112
+ var PI_RIG_PACKAGE_NAME = "@h-rig/pi-rig";
106
113
  async function defaultCommandRunner(command, options = {}) {
107
114
  const proc = Bun.spawn(command, { cwd: options.cwd, stdout: "pipe", stderr: "pipe" });
108
115
  const [stdout, stderr, exitCode] = await Promise.all([
@@ -141,27 +148,25 @@ async function checkPiRigInstall(input = {}) {
141
148
  piRig: { ok: true, label: "pi-rig global extension", detail: extensionPath }
142
149
  };
143
150
  }
144
- const exists = input.exists ?? existsSync;
145
151
  const runner = input.commandRunner ?? defaultCommandRunner;
146
152
  const piResult = await safeRun(runner, ["pi", "--version"]);
147
153
  const piListResult = piResult.exitCode === 0 ? await safeRun(runner, ["pi", "list"]) : { exitCode: 1, stdout: "", stderr: "" };
148
- const listedPiRig = piListResult.exitCode === 0 && piListContainsPiRig(`${piListResult.stdout}
154
+ const hasPiRig = piListResult.exitCode === 0 && piListContainsPiRig(`${piListResult.stdout}
149
155
  ${piListResult.stderr}`);
150
- const legacyBridge = exists(resolve2(extensionPath, "index.ts"));
151
- const hasPiRig = listedPiRig;
156
+ const hasLegacyBridgeScaffold = !hasPiRig && (input.exists ?? existsSync)(extensionPath);
152
157
  return {
153
158
  extensionPath,
154
159
  pi: {
155
160
  ok: piResult.exitCode === 0,
156
161
  label: "pi",
157
162
  detail: (piResult.stdout || piResult.stderr).trim() || undefined,
158
- hint: piResult.exitCode === 0 ? undefined : "Install Pi or run `rig init --yes` to install/update the Pi runtime."
163
+ hint: piResult.exitCode === 0 ? undefined : "Install Pi/OMP manually or set RIG_PI_INSTALL_COMMAND before verifying with bare `rig` / Cockpit \u2192 Doctor."
159
164
  },
160
165
  piRig: {
161
166
  ok: hasPiRig,
162
167
  label: "pi-rig global extension",
163
- detail: hasPiRig ? piListResult.stdout.trim() || PI_RIG_PACKAGE_NAME : legacyBridge ? `${extensionPath} (legacy bridge; reinstall required)` : undefined,
164
- hint: hasPiRig ? undefined : "Run `rig init --yes` to install/enable the global pi-rig package with `pi install`."
168
+ detail: hasPiRig ? piListResult.stdout.trim() || PI_RIG_PACKAGE_NAME : hasLegacyBridgeScaffold ? `legacy bridge scaffold at ${extensionPath}` : undefined,
169
+ hint: hasPiRig ? undefined : `Install the Rig OMP extension with \`pi install ${PI_RIG_PACKAGE_NAME}\`, then verify with bare \`rig\` / Cockpit \u2192 Doctor.`
165
170
  }
166
171
  };
167
172
  }
@@ -171,23 +176,13 @@ async function buildPiSetupChecks(input = {}) {
171
176
  }
172
177
 
173
178
  // packages/cli/src/commands/_doctor-checks.ts
174
- import { existsSync as existsSync4, readFileSync as readFileSync4 } from "fs";
175
- import { resolve as resolve5 } from "path";
179
+ import { existsSync as existsSync3, readFileSync as readFileSync2 } from "fs";
180
+ import { resolve as resolve4 } from "path";
176
181
  import { isSupportedBunVersion, MIN_SUPPORTED_BUN_VERSION } from "@rig/runtime/control-plane/setup-version";
177
182
 
178
183
  // packages/cli/src/commands/_connection-state.ts
179
- import { existsSync as existsSync2, mkdirSync, readFileSync as readFileSync2, writeFileSync } from "fs";
180
- import { homedir as homedir2 } from "os";
184
+ import { existsSync as existsSync2, mkdirSync, readFileSync, writeFileSync } from "fs";
181
185
  import { dirname, resolve as resolve3 } from "path";
182
- function resolveGlobalConnectionsPath(env = process.env) {
183
- const explicit = env.RIG_CONNECTIONS_FILE?.trim();
184
- if (explicit)
185
- return resolve3(explicit);
186
- const stateDir = env.RIG_GLOBAL_STATE_DIR?.trim();
187
- if (stateDir)
188
- return resolve3(stateDir, "connections.json");
189
- return resolve3(homedir2(), ".rig", "connections.json");
190
- }
191
186
  function resolveRepoConnectionPath(projectRoot) {
192
187
  return resolve3(projectRoot, ".rig", "state", "connection.json");
193
188
  }
@@ -195,39 +190,10 @@ function readJsonFile(path) {
195
190
  if (!existsSync2(path))
196
191
  return null;
197
192
  try {
198
- return JSON.parse(readFileSync2(path, "utf8"));
193
+ return JSON.parse(readFileSync(path, "utf8"));
199
194
  } catch (error) {
200
- throw new CliError2(`Invalid Rig connection state at ${path}: ${error instanceof Error ? error.message : String(error)}`, 1);
201
- }
202
- }
203
- function normalizeConnection(value) {
204
- if (!value || typeof value !== "object" || Array.isArray(value))
205
- return null;
206
- const record = value;
207
- if (record.kind === "local")
208
- return { kind: "local", mode: "auto" };
209
- if (record.kind === "remote" && typeof record.baseUrl === "string" && record.baseUrl.trim()) {
210
- const baseUrl = record.baseUrl.trim().replace(/\/+$/, "");
211
- return { kind: "remote", baseUrl };
212
- }
213
- return null;
214
- }
215
- function readGlobalConnections(options = {}) {
216
- const path = resolveGlobalConnectionsPath(options.env ?? process.env);
217
- const payload = readJsonFile(path);
218
- if (!payload || typeof payload !== "object" || Array.isArray(payload)) {
219
- return { connections: {} };
220
- }
221
- const rawConnections = payload.connections;
222
- const connections = {};
223
- if (rawConnections && typeof rawConnections === "object" && !Array.isArray(rawConnections)) {
224
- for (const [alias, raw] of Object.entries(rawConnections)) {
225
- const connection = normalizeConnection(raw);
226
- if (connection)
227
- connections[alias] = connection;
228
- }
195
+ throw new CliError(`Invalid Rig connection state at ${path}: ${error instanceof Error ? error.message : String(error)}`, 1, { hint: "Fix or delete that file, then re-select a server with `rig server use <alias|local>`." });
229
196
  }
230
- return { connections };
231
197
  }
232
198
  function readRepoConnection(projectRoot) {
233
199
  const payload = readJsonFile(resolveRepoConnectionPath(projectRoot));
@@ -240,130 +206,68 @@ function readRepoConnection(projectRoot) {
240
206
  return {
241
207
  selected,
242
208
  project: typeof record.project === "string" ? record.project : undefined,
243
- linkedAt: typeof record.linkedAt === "string" ? record.linkedAt : undefined
209
+ linkedAt: typeof record.linkedAt === "string" ? record.linkedAt : undefined,
210
+ serverProjectRoot: typeof record.serverProjectRoot === "string" && record.serverProjectRoot.trim() ? record.serverProjectRoot.trim() : undefined,
211
+ serverProjectRootAlias: typeof record.serverProjectRootAlias === "string" && record.serverProjectRootAlias.trim() ? record.serverProjectRootAlias.trim() : undefined,
212
+ serverProjectRootBaseUrl: typeof record.serverProjectRootBaseUrl === "string" && record.serverProjectRootBaseUrl.trim() ? record.serverProjectRootBaseUrl.trim().replace(/\/+$/, "") : undefined
244
213
  };
245
214
  }
246
- function resolveSelectedConnection(projectRoot, options = {}) {
247
- const repo = readRepoConnection(projectRoot);
248
- if (!repo)
249
- return null;
250
- if (repo.selected === "local")
251
- return { alias: "local", connection: { kind: "local", mode: "auto" } };
252
- const global = readGlobalConnections(options);
253
- const connection = global.connections[repo.selected];
254
- if (!connection) {
255
- throw new CliError2(`Selected Rig connection "${repo.selected}" was not found. Run \`rig connect list\` or \`rig connect use local\`.`, 1);
256
- }
257
- return { alias: repo.selected, connection };
258
- }
259
215
 
260
- // packages/cli/src/commands/_server-client.ts
261
- import { spawnSync } from "child_process";
262
- import { existsSync as existsSync3, readFileSync as readFileSync3 } from "fs";
263
- import { resolve as resolve4 } from "path";
264
- import { ensureLocalRigServerConnection } from "@rig/runtime/local-server";
265
- var cachedGitHubBearerToken;
216
+ // packages/cli/src/commands/_inprocess-services.ts
217
+ import {
218
+ beginGitHubDeviceFlow,
219
+ checkGitHubRepoPermissions,
220
+ createGitHubAuthStore,
221
+ listGitHubProjects,
222
+ pollGitHubDeviceFlow,
223
+ resolveGitHubAuthStatus,
224
+ resolveProjectStatusField,
225
+ saveGitHubTokenForProject
226
+ } from "@rig/runtime/control-plane/github/index";
227
+ var scopedGitHubBearerTokens = new Map;
266
228
  function cleanToken(value) {
267
229
  const trimmed = value?.trim();
268
230
  return trimmed ? trimmed : null;
269
231
  }
270
- function readPrivateRemoteSessionToken(projectRoot) {
271
- const path = resolve4(projectRoot, ".rig", "state", "github-auth.json");
272
- if (!existsSync3(path))
273
- return null;
274
- try {
275
- const parsed = JSON.parse(readFileSync3(path, "utf8"));
276
- return cleanToken(typeof parsed.apiSessionToken === "string" ? parsed.apiSessionToken : typeof parsed.sessionToken === "string" ? parsed.sessionToken : undefined);
277
- } catch {
278
- return null;
279
- }
280
- }
281
- function readGitHubBearerTokenForRemote(projectRoot) {
282
- if (cachedGitHubBearerToken !== undefined)
283
- return cachedGitHubBearerToken;
284
- const privateSession = readPrivateRemoteSessionToken(projectRoot);
285
- if (privateSession) {
286
- cachedGitHubBearerToken = privateSession;
287
- return cachedGitHubBearerToken;
288
- }
289
- const envToken = cleanToken(process.env.RIG_GITHUB_TOKEN) ?? cleanToken(process.env.GITHUB_TOKEN) ?? cleanToken(process.env.GH_TOKEN);
290
- if (envToken) {
291
- cachedGitHubBearerToken = envToken;
292
- return cachedGitHubBearerToken;
293
- }
294
- const result = spawnSync("gh", ["auth", "token"], {
295
- encoding: "utf8",
296
- timeout: 5000,
297
- stdio: ["ignore", "pipe", "ignore"]
298
- });
299
- cachedGitHubBearerToken = result.status === 0 ? cleanToken(result.stdout) : null;
300
- return cachedGitHubBearerToken;
301
- }
302
- async function ensureServerForCli(projectRoot) {
303
- try {
304
- const selected = resolveSelectedConnection(projectRoot);
305
- if (selected?.connection.kind === "remote") {
306
- return {
307
- baseUrl: selected.connection.baseUrl,
308
- authToken: readGitHubBearerTokenForRemote(projectRoot),
309
- connectionKind: "remote"
310
- };
311
- }
312
- const connection = await ensureLocalRigServerConnection(projectRoot);
313
- return {
314
- baseUrl: connection.baseUrl,
315
- authToken: connection.authToken,
316
- connectionKind: "local"
317
- };
318
- } catch (error) {
319
- if (error instanceof Error) {
320
- throw new CliError2(error.message, 1);
321
- }
322
- throw error;
323
- }
324
- }
325
- function mergeHeaders(headers, authToken) {
326
- const merged = new Headers(headers);
327
- if (authToken) {
328
- merged.set("authorization", `Bearer ${authToken}`);
329
- }
330
- return merged;
331
- }
332
- function diagnosticMessage(payload) {
333
- if (!payload || typeof payload !== "object" || Array.isArray(payload))
334
- return null;
335
- const record = payload;
336
- const diagnostics = Array.isArray(record.diagnostics) ? record.diagnostics : [];
337
- const messages = diagnostics.flatMap((entry) => {
338
- if (!entry || typeof entry !== "object" || Array.isArray(entry))
339
- return [];
340
- const diagnostic = entry;
341
- const kind = typeof diagnostic.kind === "string" ? diagnostic.kind : "task-source";
342
- const message = typeof diagnostic.message === "string" ? diagnostic.message : null;
343
- return message ? [`${kind}: ${message}`] : [];
344
- });
345
- return messages.length > 0 ? messages.join("; ") : null;
346
- }
347
- async function requestServerJson(context, pathname, init = {}) {
348
- const server = await ensureServerForCli(context.projectRoot);
349
- const response = await fetch(`${server.baseUrl}${pathname}`, {
350
- ...init,
351
- headers: mergeHeaders(init.headers, server.authToken)
352
- });
353
- const text = await response.text();
354
- const payload = text.trim().length > 0 ? (() => {
355
- try {
356
- return JSON.parse(text);
357
- } catch {
358
- return null;
359
- }
360
- })() : null;
361
- if (!response.ok) {
362
- const diagnostics = diagnosticMessage(payload);
363
- const detail = diagnostics ?? (text || response.statusText);
364
- throw new CliError2(`Rig server request failed (${response.status}): ${detail}`, 1);
365
- }
366
- return payload;
232
+ function cleanString(value) {
233
+ return typeof value === "string" && value.trim() ? value.trim() : null;
234
+ }
235
+ function oauthClientId() {
236
+ return cleanToken(process.env.RIG_GITHUB_OAUTH_CLIENT_ID);
237
+ }
238
+ async function getGitHubAuthStatusInProcess(context) {
239
+ return { ok: true, ...resolveGitHubAuthStatus({ projectRoot: context.projectRoot, oauthConfigured: Boolean(oauthClientId()) }) };
240
+ }
241
+ async function requestGitHubAuthJsonInProcess(context, pathname, init = {}) {
242
+ const method = (init.method ?? "GET").toUpperCase();
243
+ if (pathname === "/api/github/auth/status")
244
+ return getGitHubAuthStatusInProcess(context);
245
+ if (pathname === "/api/github/repo/permissions") {
246
+ return checkGitHubRepoPermissions({ projectRoot: context.projectRoot, oauthConfigured: Boolean(oauthClientId()) });
247
+ }
248
+ if (pathname === "/api/github/auth/device/start" && method === "POST") {
249
+ const clientId = oauthClientId();
250
+ if (!clientId)
251
+ return { ok: false, oauthConfigured: false, error: "RIG_GITHUB_OAUTH_CLIENT_ID is not configured." };
252
+ const body = init.body ? JSON.parse(String(init.body)) : {};
253
+ return beginGitHubDeviceFlow({
254
+ projectRoot: context.projectRoot,
255
+ clientId,
256
+ scope: cleanString(body.scope) ?? undefined,
257
+ selectedRepo: cleanString(body.repoSlug)
258
+ });
259
+ }
260
+ if (pathname === "/api/github/auth/device/poll" && method === "POST") {
261
+ const clientId = oauthClientId();
262
+ if (!clientId)
263
+ return { ok: false, oauthConfigured: false, error: "RIG_GITHUB_OAUTH_CLIENT_ID is not configured." };
264
+ const body = init.body ? JSON.parse(String(init.body)) : {};
265
+ const pollId = cleanString(body.pollId);
266
+ if (!pollId)
267
+ return { ok: false, status: "error", error: "pollId is required" };
268
+ return pollGitHubDeviceFlow({ projectRoot: context.projectRoot, clientId, pollId, selectedRepo: cleanString(body.repoSlug) });
269
+ }
270
+ throw new Error(`No in-process GitHub auth API for ${method} ${pathname}`);
367
271
  }
368
272
 
369
273
  // packages/cli/src/commands/_doctor-checks.ts
@@ -385,31 +289,14 @@ function isAuthenticated(payload) {
385
289
  const record = payload;
386
290
  return record.signedIn === true || record.authenticated === true || record.status === "authenticated" || record.ok === true && typeof record.login === "string" && record.login.trim().length > 0;
387
291
  }
388
- function repoSlugFromConfig(config) {
389
- const project = config?.project;
390
- if (project && typeof project === "object" && !Array.isArray(project)) {
391
- const record = project;
392
- if (typeof record.repo === "string" && /^([^/\s]+)\/([^/\s]+)$/.test(record.repo))
393
- return record.repo;
394
- if (typeof record.name === "string" && /^([^/\s]+)\/([^/\s]+)$/.test(record.name))
395
- return record.name;
396
- }
397
- const taskSource = config?.taskSource;
398
- if (taskSource && typeof taskSource === "object" && !Array.isArray(taskSource)) {
399
- const source = taskSource;
400
- if (typeof source.owner === "string" && typeof source.repo === "string")
401
- return `${source.owner}/${source.repo}`;
402
- }
403
- return null;
404
- }
405
292
  function loadFallbackConfig(projectRoot) {
406
293
  const candidates = ["rig.config.ts", "rig.config.mts", "rig.config.json"];
407
294
  for (const name of candidates) {
408
- const path = resolve5(projectRoot, name);
409
- if (!existsSync4(path))
295
+ const path = resolve4(projectRoot, name);
296
+ if (!existsSync3(path))
410
297
  continue;
411
298
  try {
412
- const source = readFileSync4(path, "utf8");
299
+ const source = readFileSync2(path, "utf8");
413
300
  if (name.endsWith(".json"))
414
301
  return JSON.parse(source);
415
302
  const owner = source.match(/owner\s*:\s*["']([^"']+)["']/)?.[1];
@@ -428,14 +315,11 @@ function loadFallbackConfig(projectRoot) {
428
315
  }
429
316
  return null;
430
317
  }
431
- function projectStatusSlug(projectRoot, config) {
432
- return readRepoConnection(projectRoot)?.project ?? repoSlugFromConfig(config);
433
- }
434
318
  function githubProjectsCheck(config) {
435
319
  const github = config?.github;
436
320
  const projects = github?.projects;
437
321
  if (!projects?.enabled) {
438
- return check("github-projects", "GitHub Projects status sync", "warn", "disabled or not configured", "Run `rig init --github-project <project>` or configure github.projects when Project status sync should be authoritative.");
322
+ return check("github-projects", "GitHub Projects status sync", "warn", "disabled or not configured", "Current OMP flow does not require GitHub Projects status sync; configure github.projects manually when Project status sync should be authoritative.");
439
323
  }
440
324
  if (projects.projectId && projects.statusFieldId) {
441
325
  return check("github-projects", "GitHub Projects status sync", "pass", `project ${projects.projectId}`);
@@ -460,16 +344,6 @@ function permissionAllowsPr(payload) {
460
344
  }
461
345
  return null;
462
346
  }
463
- function labelsReady(payload) {
464
- if (!payload || typeof payload !== "object" || Array.isArray(payload))
465
- return null;
466
- const record = payload;
467
- if (record.ok === true || record.ready === true || record.labelsReady === true)
468
- return true;
469
- if (record.ok === false || record.ready === false || record.labelsReady === false)
470
- return false;
471
- return null;
472
- }
473
347
  function prMergeCheck(config) {
474
348
  const pr = config?.pr;
475
349
  const merge = config?.merge;
@@ -483,89 +357,48 @@ async function runRigDoctorChecks(options) {
483
357
  const checks = [];
484
358
  const which = options.which ?? ((binary) => Bun.which(binary));
485
359
  const bunVersion = options.bunVersion ?? Bun.version;
486
- const request = options.requestJson ?? ((pathname, init) => requestServerJson({ projectRoot }, pathname, init));
360
+ const request = options.requestJson ?? ((pathname, init) => requestGitHubAuthJsonInProcess({ projectRoot }, pathname, init));
487
361
  const loadConfig = options.loadConfig ?? loadRigConfigOrNull;
362
+ const progress = options.onProgress ?? (() => {});
363
+ progress("Checking local toolchain\u2026");
488
364
  checks.push(check("bun", `bun >= ${MIN_SUPPORTED_BUN_VERSION}`, isSupportedBunVersion(bunVersion) ? "pass" : "fail", `found ${bunVersion}`, `Install Bun ${MIN_SUPPORTED_BUN_VERSION} or newer.`), check("git", "git", which("git") ? "pass" : "fail", which("git") ?? undefined, "Install git and ensure it is on PATH."), check("jq", "jq", which("jq") ? "pass" : "warn", which("jq") ?? undefined, "Install jq (for example `brew install jq`)."));
365
+ progress("Loading rig.config\u2026");
489
366
  const loadedConfig = await loadConfig(projectRoot).catch(() => null);
490
367
  const config = loadedConfig ?? loadFallbackConfig(projectRoot);
491
- const hasConfigFile = ["rig.config.ts", "rig.config.mts", "rig.config.json"].some((name) => existsSync4(resolve5(projectRoot, name)));
492
- checks.push(config ? check("config", "rig.config loadable", "pass") : check("config", "rig.config loadable", hasConfigFile ? "fail" : "fail", hasConfigFile ? "config file exists but failed to load" : "missing rig.config.ts/json", "Run `rig init` or fix the config error."));
368
+ const hasConfigFile = ["rig.config.ts", "rig.config.mts", "rig.config.json"].some((name) => existsSync3(resolve4(projectRoot, name)));
369
+ checks.push(config ? check("config", "rig.config loadable", "pass") : check("config", "rig.config loadable", hasConfigFile ? "fail" : "fail", hasConfigFile ? "config file exists but failed to load" : "missing rig.config.ts/json", "Create/fix rig.config.ts or use the OMP cockpit Start tab to scaffold one."));
493
370
  const taskSourceKind = config?.taskSource?.kind;
494
371
  checks.push(taskSourceKind ? check("task-source", "task source configured", "pass", taskSourceKind) : check("task-source", "task source configured", "fail", "missing taskSource", "Configure taskSource in rig.config.ts."));
495
372
  const repo = readRepoConnection(projectRoot);
496
- checks.push(repo ? check("project-link", "repo selected Rig connection", repo.project ? "pass" : "warn", `${repo.selected}${repo.project ? ` -> ${repo.project}` : ""}`, "Run `rig init --yes --repo owner/repo` to link this checkout to a GitHub repo slug.") : check("project-link", "repo selected Rig connection", "fail", "missing .rig/state/connection.json", "Run `rig init` or `rig connect use <alias|local>`."));
497
- const selected = (() => {
498
- try {
499
- return resolveSelectedConnection(projectRoot);
500
- } catch {
501
- return null;
502
- }
503
- })();
504
- checks.push(selected ? check("connection", "selected server connection", "pass", selected.connection.kind === "remote" ? selected.connection.baseUrl : "local auto") : check("connection", "selected server connection", repo ? "fail" : "warn", repo ? "selected alias is missing" : "will auto-start local server", repo ? "Run `rig connect list` and `rig connect use <alias|local>`." : undefined));
505
- let server = null;
373
+ checks.push(repo ? check("project-link", "repo selected for local setup", repo.project ? "pass" : "warn", `${repo.selected}${repo.project ? ` -> ${repo.project}` : ""}`, "Run `rig init --repo owner/repo` if this project should use GitHub Issues.") : check("project-link", "repo selected for local setup", "warn", "missing .rig/state/connection.json", "Current UX can run without this compatibility file; `rig init` recreates it for GitHub-backed projects."));
506
374
  try {
507
- server = await (options.resolveServer ?? ensureServerForCli)(projectRoot);
508
- checks.push(check("server", "Rig server reachable", "pass", `${server.connectionKind} ${server.baseUrl}`));
375
+ progress("Checking GitHub auth\u2026");
376
+ const auth = await request("/api/github/auth/status");
377
+ checks.push(isAuthenticated(auth) ? check("github-auth", "GitHub auth", "pass") : check("github-auth", "GitHub auth", "fail", "not authenticated", "Run `rig github auth import-gh` or `rig github auth token --token <token>`."));
509
378
  } catch (error) {
510
- checks.push(check("server", "Rig server reachable", "fail", errorMessage(error), "Start the local Rig server or fix the selected remote connection."));
379
+ checks.push(check("github-auth", "GitHub auth", "fail", errorMessage(error), "Authenticate GitHub through Rig."));
511
380
  }
512
- if (server || options.requestJson) {
513
- try {
514
- const status = await request("/api/server/status");
515
- checks.push(check("server-status", "server project status", "pass", JSON.stringify(status).slice(0, 180)));
516
- } catch (error) {
517
- checks.push(check("server-status", "server project status", "fail", errorMessage(error), "Run `rig doctor` after the selected server is reachable."));
518
- }
519
- try {
520
- const auth = await request("/api/github/auth/status");
521
- checks.push(isAuthenticated(auth) ? check("github-auth", "GitHub auth", "pass") : check("github-auth", "GitHub auth", "fail", "not authenticated", "Run `rig github auth import-gh` or `rig github auth token --token <token>`."));
522
- } catch (error) {
523
- checks.push(check("github-auth", "GitHub auth", "fail", errorMessage(error), "Authenticate GitHub through Rig and ensure the server exposes auth status."));
524
- }
525
- try {
526
- const permissions = await request("/api/github/repo/permissions");
527
- const allowed = permissionAllowsPr(permissions);
528
- checks.push(allowed === true ? check("github-repo-permissions", "GitHub repo PR permissions", "pass", JSON.stringify(permissions).slice(0, 180)) : allowed === false ? check("github-repo-permissions", "GitHub repo PR permissions", "fail", JSON.stringify(permissions).slice(0, 180), "Grant the selected GitHub token permission to push branches, open PRs, and merge according to repo rules.") : check("github-repo-permissions", "GitHub repo PR permissions", "warn", JSON.stringify(permissions).slice(0, 180), "Confirm the selected token can push branches and open PRs."));
529
- } catch (error) {
530
- checks.push(check("github-repo-permissions", "GitHub repo PR permissions", "warn", errorMessage(error), "Ensure the server exposes repo permission checks and the token can open PRs."));
531
- }
532
- try {
533
- const labels = await request("/api/workspace/task-labels");
534
- const ready = labelsReady(labels);
535
- checks.push(ready === false ? check("task-labels", "GitHub issue labels", "fail", JSON.stringify(labels).slice(0, 180), "Let Rig create required labels or create the configured lifecycle labels manually.") : check("task-labels", "GitHub issue labels", ready === true ? "pass" : "warn", JSON.stringify(labels).slice(0, 180), "Confirm required Rig lifecycle labels exist."));
536
- } catch (error) {
537
- checks.push(check("task-labels", "GitHub issue labels", "warn", errorMessage(error), "Run `rig init`/`rig doctor` after label setup is wired on the server."));
538
- }
539
- try {
540
- const projection = await request("/api/workspace/task-projection");
541
- checks.push(check("task-projection", "task projection", "pass", JSON.stringify(projection).slice(0, 180)));
542
- } catch (error) {
543
- checks.push(check("task-projection", "task projection", "warn", errorMessage(error), "Refresh task projection with `rig task list` or fix the task source."));
544
- }
545
- const slug = projectStatusSlug(projectRoot, config);
546
- if (slug) {
547
- try {
548
- const project = await request(`/api/projects/${encodeURIComponent(slug)}`);
549
- checks.push(check("remote-checkout", "server project checkout", "pass", JSON.stringify(project).slice(0, 180)));
550
- } catch (error) {
551
- checks.push(check("remote-checkout", "server project checkout", "warn", errorMessage(error), "Run `rig init --yes --repo owner/repo` to register/link the server project checkout."));
552
- }
553
- } else {
554
- checks.push(check("remote-checkout", "server project checkout", "warn", "repo slug unknown", "Set project.repo or run `rig init --repo owner/repo`."));
555
- }
381
+ try {
382
+ progress("Checking GitHub repo permissions\u2026");
383
+ const permissions = await request("/api/github/repo/permissions");
384
+ const allowed = permissionAllowsPr(permissions);
385
+ checks.push(allowed === true ? check("github-repo-permissions", "GitHub repo PR permissions", "pass", JSON.stringify(permissions).slice(0, 180)) : allowed === false ? check("github-repo-permissions", "GitHub repo PR permissions", "fail", JSON.stringify(permissions).slice(0, 180), "Grant the selected GitHub token permission to push branches, open PRs, and merge according to repo rules.") : check("github-repo-permissions", "GitHub repo PR permissions", "warn", JSON.stringify(permissions).slice(0, 180), "Confirm the selected token can push branches and open PRs."));
386
+ } catch (error) {
387
+ checks.push(check("github-repo-permissions", "GitHub repo PR permissions", "warn", errorMessage(error), "Ensure the token can open PRs."));
556
388
  }
557
389
  if (taskSourceKind === "github-issues") {
558
390
  checks.push(check("gh", "gh CLI fallback", which("gh") ? "pass" : "warn", which("gh") ?? undefined, "Install gh for local/dev GitHub fallback operations."));
559
391
  }
560
392
  checks.push(githubProjectsCheck(config));
561
393
  checks.push(prMergeCheck(config));
394
+ progress("Checking Pi installation\u2026");
562
395
  const piChecks = await (options.piChecks ?? (() => buildPiSetupChecks()))().catch((error) => [{
563
396
  ok: false,
564
397
  label: "pi/pi-rig checks",
565
398
  hint: errorMessage(error)
566
399
  }]);
567
400
  for (const pi of piChecks) {
568
- checks.push(check(pi.label === "pi" ? "pi" : "pi-rig", pi.label, pi.ok ? "pass" : "warn", pi.detail, pi.hint ?? (pi.ok ? undefined : "Run `rig init --yes` to install/update Pi and enable pi-rig.")));
401
+ checks.push(check(pi.label === "pi" ? "pi" : "pi-rig", pi.label, pi.ok ? "pass" : "warn", pi.detail, pi.hint ?? (pi.ok ? undefined : "Install Pi/OMP and the Rig extension, then use bare `rig` or Cockpit \u2192 Doctor to verify.")));
569
402
  }
570
403
  return checks;
571
404
  }
@@ -582,12 +415,130 @@ function countDoctorFailures(checks) {
582
415
  return checks.filter((entry) => entry.status === "fail").length;
583
416
  }
584
417
 
418
+ // packages/cli/src/commands/_async-ui.ts
419
+ import pc from "picocolors";
420
+
421
+ // packages/cli/src/commands/_spinner.ts
422
+ var SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
423
+ function createTtySpinner(input) {
424
+ const output = input.output ?? process.stdout;
425
+ const isTty = output.isTTY === true;
426
+ const frames = input.frames && input.frames.length > 0 ? input.frames : SPINNER_FRAMES;
427
+ let label = input.label;
428
+ let frame = 0;
429
+ let paused = false;
430
+ let stopped = false;
431
+ let lastPrintedLabel = "";
432
+ const render = () => {
433
+ if (stopped || paused)
434
+ return;
435
+ if (!isTty) {
436
+ if (label !== lastPrintedLabel) {
437
+ output.write(`${label}
438
+ `);
439
+ lastPrintedLabel = label;
440
+ }
441
+ return;
442
+ }
443
+ frame = (frame + 1) % frames.length;
444
+ const glyph = frames[frame] ?? frames[0] ?? "";
445
+ output.write(`\r\x1B[2K${input.styleFrame ? input.styleFrame(glyph) : glyph} ${label}`);
446
+ };
447
+ const clearLine = () => {
448
+ if (isTty)
449
+ output.write("\r\x1B[2K");
450
+ };
451
+ render();
452
+ const timer = isTty ? setInterval(render, input.intervalMs ?? 16) : null;
453
+ return {
454
+ setLabel(next) {
455
+ label = next;
456
+ render();
457
+ },
458
+ pause() {
459
+ paused = true;
460
+ clearLine();
461
+ },
462
+ resume() {
463
+ if (stopped)
464
+ return;
465
+ paused = false;
466
+ render();
467
+ },
468
+ stop(finalLine) {
469
+ if (stopped)
470
+ return;
471
+ stopped = true;
472
+ if (timer)
473
+ clearInterval(timer);
474
+ clearLine();
475
+ if (finalLine)
476
+ output.write(`${finalLine}
477
+ `);
478
+ }
479
+ };
480
+ }
481
+
482
+ // packages/cli/src/commands/_async-ui.ts
483
+ var FRAMES = ["\u25D0", "\u25D3", "\u25D1", "\u25D2"];
484
+ var DONE_SYMBOL = pc.green("\u25C7");
485
+ var FAIL_SYMBOL = pc.red("\u25A0");
486
+ var activeUpdate = null;
487
+ async function withSpinner(label, work, options = {}) {
488
+ if (options.outputMode === "json") {
489
+ return work(() => {
490
+ return;
491
+ });
492
+ }
493
+ if (activeUpdate) {
494
+ activeUpdate(label);
495
+ return work(activeUpdate);
496
+ }
497
+ const output = options.output ?? process.stderr;
498
+ const isTty = output.isTTY === true;
499
+ let lastLabel = label;
500
+ if (!isTty) {
501
+ output.write(`${label}
502
+ `);
503
+ const update2 = (next) => {
504
+ lastLabel = next;
505
+ };
506
+ activeUpdate = update2;
507
+ try {
508
+ return await work(update2);
509
+ } finally {
510
+ activeUpdate = null;
511
+ }
512
+ }
513
+ const spinner = createTtySpinner({
514
+ label,
515
+ output,
516
+ frames: FRAMES,
517
+ styleFrame: (frame) => pc.cyan(frame)
518
+ });
519
+ const update = (next) => {
520
+ lastLabel = next;
521
+ spinner.setLabel(next);
522
+ };
523
+ activeUpdate = update;
524
+ try {
525
+ const result = await work(update);
526
+ spinner.stop(options.doneLabel ? `${DONE_SYMBOL} ${options.doneLabel}` : undefined);
527
+ return result;
528
+ } catch (error) {
529
+ spinner.stop(`${FAIL_SYMBOL} ${lastLabel}`);
530
+ throw error;
531
+ } finally {
532
+ activeUpdate = null;
533
+ }
534
+ }
535
+
585
536
  // packages/cli/src/commands/setup.ts
586
537
  async function executeSetup(context, args) {
587
538
  const [command = "check", ...rest] = args;
588
539
  switch (command) {
589
540
  case "bootstrap":
590
- requireNoExtraArgs(rest, "bun run rig setup bootstrap");
541
+ requireNoExtraArgs(rest, "rig setup bootstrap");
591
542
  {
592
543
  const hostBash = Bun.which("bash") || "/bin/bash";
593
544
  const env = { ...process.env };
@@ -605,32 +556,26 @@ async function executeSetup(context, args) {
605
556
  });
606
557
  const exitCode = await proc.exited;
607
558
  if (exitCode !== 0) {
608
- throw new CliError2(`Command failed (${exitCode}): ${hostBash} ./bootstrap.sh`, exitCode);
559
+ throw new CliError(`Command failed (${exitCode}): ${hostBash} ./bootstrap.sh`, exitCode);
609
560
  }
610
561
  }
611
562
  return { ok: true, group: "setup", command };
612
563
  case "check":
613
- requireNoExtraArgs(rest, `bun run rig setup ${command}`);
564
+ requireNoExtraArgs(rest, `rig setup ${command}`);
614
565
  {
615
- const checks = await withMutedConsole(context.outputMode === "json", () => runSetupCheck(context.projectRoot));
566
+ const checks = await withMutedConsole(context.outputMode === "json", () => runSetupCheck(context.projectRoot, context.outputMode));
616
567
  return { ok: true, group: "setup", command, details: { checks, failures: countDoctorFailures(checks) } };
617
568
  }
618
569
  case "setup":
619
- requireNoExtraArgs(rest, "bun run rig setup setup");
570
+ requireNoExtraArgs(rest, "rig setup setup");
620
571
  withMutedConsole(context.outputMode === "json", () => runSetupInit(context.projectRoot));
621
572
  return { ok: true, group: "setup", command };
622
573
  case "preflight":
623
- requireNoExtraArgs(rest, "bun run rig setup preflight");
624
- await withMutedConsole(context.outputMode === "json", () => runSetupPreflight(context.projectRoot));
625
- return { ok: true, group: "setup", command };
626
- case "install-agent-shell":
627
- requireNoExtraArgs(rest, "bun run rig setup install-agent-shell");
628
- if (context.outputMode === "text") {
629
- console.log("install-agent-shell is deprecated. Runtime shells now use compiled rig-agent directly.");
630
- }
574
+ requireNoExtraArgs(rest, "rig setup preflight");
575
+ await withMutedConsole(context.outputMode === "json", () => runSetupPreflight(context.projectRoot, context.outputMode));
631
576
  return { ok: true, group: "setup", command };
632
577
  default:
633
- throw new CliError2(`Unknown setup command: ${command}`);
578
+ throw new CliError(`Unknown setup command: ${command}`, 1, { hint: "Run `rig setup --help` \u2014 commands are bootstrap|check|preflight." });
634
579
  }
635
580
  }
636
581
  function formatTaskSourceKinds(kinds) {
@@ -656,37 +601,37 @@ function runSetupInit(projectRoot) {
656
601
  mkdirSync2(stateDir, { recursive: true });
657
602
  mkdirSync2(logsDir, { recursive: true });
658
603
  mkdirSync2(artifactsDir, { recursive: true });
659
- const failuresPath = resolve6(stateDir, "failed_approaches.md");
660
- if (!existsSync5(failuresPath)) {
604
+ const failuresPath = resolve5(stateDir, "failed_approaches.md");
605
+ if (!existsSync4(failuresPath)) {
661
606
  writeFileSync2(failuresPath, `# Failed Approaches
662
607
 
663
608
  `, "utf-8");
664
609
  }
665
610
  console.log("Harness directories ready.");
666
611
  }
667
- async function runSetupCheck(projectRoot) {
668
- const doctorChecks = await runRigDoctorChecks({ projectRoot });
612
+ async function runSetupCheck(projectRoot, outputMode = "text") {
613
+ const doctorChecks = await withSpinner("Running setup checks\u2026", (update) => runRigDoctorChecks({ projectRoot, onProgress: update }), { outputMode });
669
614
  console.log(formatDoctorChecks(doctorChecks));
670
615
  const failures = countDoctorFailures(doctorChecks);
671
616
  if (failures > 0) {
672
- throw new CliError2(`Setup check failed (${failures} failing doctor check${failures === 1 ? "" : "s"}).`, 1);
617
+ throw new CliError(`Setup check failed (${failures} failing doctor check${failures === 1 ? "" : "s"}).`, 1, { hint: "Legacy setup diagnostics failed; for current UX run bare `rig` and open Cockpit \u2192 Doctor for remediation details." });
673
618
  }
674
619
  return doctorChecks;
675
620
  }
676
- async function runSetupPreflight(projectRoot) {
677
- await runSetupCheck(projectRoot);
678
- const validationRoot = resolve6(resolveControlPlaneDefinitionRoot(projectRoot), "validation");
679
- if (existsSync5(validationRoot)) {
621
+ async function runSetupPreflight(projectRoot, outputMode = "text") {
622
+ await runSetupCheck(projectRoot, outputMode);
623
+ const validationRoot = resolve5(resolveControlPlaneDefinitionRoot(projectRoot), "validation");
624
+ if (existsSync4(validationRoot)) {
680
625
  const validators = readdirSync(validationRoot, { withFileTypes: true }).filter((entry) => entry.isDirectory());
681
626
  for (const validator of validators) {
682
- const script = resolve6(validationRoot, validator.name, "validate.sh");
683
- if (existsSync5(script)) {
627
+ const script = resolve5(validationRoot, validator.name, "validate.sh");
628
+ if (existsSync4(script)) {
684
629
  console.log(`OK: validator script ${script}`);
685
630
  }
686
631
  }
687
632
  }
688
- const hooksRoot = resolve6(resolveControlPlaneDefinitionRoot(projectRoot), "hooks");
689
- if (existsSync5(hooksRoot)) {
633
+ const hooksRoot = resolve5(resolveControlPlaneDefinitionRoot(projectRoot), "hooks");
634
+ if (existsSync4(hooksRoot)) {
690
635
  const hooks = readdirSync(hooksRoot).filter((name) => name.endsWith(".sh"));
691
636
  for (const hook of hooks) {
692
637
  console.log(`OK: hook ${hook}`);