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

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
@@ -24,23 +24,13 @@ Usage: ${usage}`);
24
24
  }
25
25
 
26
26
  // packages/cli/src/commands/_doctor-checks.ts
27
- import { existsSync as existsSync4, readFileSync as readFileSync4 } from "fs";
28
- import { resolve as resolve4 } from "path";
27
+ import { existsSync as existsSync3, readFileSync as readFileSync2 } from "fs";
28
+ import { resolve as resolve3 } from "path";
29
29
  import { isSupportedBunVersion, MIN_SUPPORTED_BUN_VERSION } from "@rig/runtime/control-plane/setup-version";
30
30
 
31
31
  // packages/cli/src/commands/_connection-state.ts
32
32
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
33
- import { homedir } from "os";
34
33
  import { dirname, resolve } from "path";
35
- function resolveGlobalConnectionsPath(env = process.env) {
36
- const explicit = env.RIG_CONNECTIONS_FILE?.trim();
37
- if (explicit)
38
- return resolve(explicit);
39
- const stateDir = env.RIG_GLOBAL_STATE_DIR?.trim();
40
- if (stateDir)
41
- return resolve(stateDir, "connections.json");
42
- return resolve(homedir(), ".rig", "connections.json");
43
- }
44
34
  function resolveRepoConnectionPath(projectRoot) {
45
35
  return resolve(projectRoot, ".rig", "state", "connection.json");
46
36
  }
@@ -53,40 +43,6 @@ function readJsonFile(path) {
53
43
  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>`." });
54
44
  }
55
45
  }
56
- function writeJsonFile(path, value) {
57
- mkdirSync(dirname(path), { recursive: true });
58
- writeFileSync(path, `${JSON.stringify(value, null, 2)}
59
- `, "utf8");
60
- }
61
- function normalizeConnection(value) {
62
- if (!value || typeof value !== "object" || Array.isArray(value))
63
- return null;
64
- const record = value;
65
- if (record.kind === "local")
66
- return { kind: "local", mode: "auto" };
67
- if (record.kind === "remote" && typeof record.baseUrl === "string" && record.baseUrl.trim()) {
68
- const baseUrl = record.baseUrl.trim().replace(/\/+$/, "");
69
- return { kind: "remote", baseUrl };
70
- }
71
- return null;
72
- }
73
- function readGlobalConnections(options = {}) {
74
- const path = resolveGlobalConnectionsPath(options.env ?? process.env);
75
- const payload = readJsonFile(path);
76
- if (!payload || typeof payload !== "object" || Array.isArray(payload)) {
77
- return { connections: {} };
78
- }
79
- const rawConnections = payload.connections;
80
- const connections = {};
81
- if (rawConnections && typeof rawConnections === "object" && !Array.isArray(rawConnections)) {
82
- for (const [alias, raw] of Object.entries(rawConnections)) {
83
- const connection = normalizeConnection(raw);
84
- if (connection)
85
- connections[alias] = connection;
86
- }
87
- }
88
- return { connections };
89
- }
90
46
  function readRepoConnection(projectRoot) {
91
47
  const payload = readJsonFile(resolveRepoConnectionPath(projectRoot));
92
48
  if (!payload || typeof payload !== "object" || Array.isArray(payload))
@@ -99,247 +55,68 @@ function readRepoConnection(projectRoot) {
99
55
  selected,
100
56
  project: typeof record.project === "string" ? record.project : undefined,
101
57
  linkedAt: typeof record.linkedAt === "string" ? record.linkedAt : undefined,
102
- serverProjectRoot: typeof record.serverProjectRoot === "string" && record.serverProjectRoot.trim() ? record.serverProjectRoot.trim() : undefined
58
+ serverProjectRoot: typeof record.serverProjectRoot === "string" && record.serverProjectRoot.trim() ? record.serverProjectRoot.trim() : undefined,
59
+ serverProjectRootAlias: typeof record.serverProjectRootAlias === "string" && record.serverProjectRootAlias.trim() ? record.serverProjectRootAlias.trim() : undefined,
60
+ serverProjectRootBaseUrl: typeof record.serverProjectRootBaseUrl === "string" && record.serverProjectRootBaseUrl.trim() ? record.serverProjectRootBaseUrl.trim().replace(/\/+$/, "") : undefined
103
61
  };
104
62
  }
105
- function writeRepoConnection(projectRoot, state) {
106
- writeJsonFile(resolveRepoConnectionPath(projectRoot), state);
107
- }
108
- function resolveSelectedConnection(projectRoot, options = {}) {
109
- const repo = readRepoConnection(projectRoot);
110
- if (!repo)
111
- return null;
112
- if (repo.selected === "local")
113
- return { alias: "local", connection: { kind: "local", mode: "auto" }, serverProjectRoot: repo.serverProjectRoot };
114
- const global = readGlobalConnections(options);
115
- const connection = global.connections[repo.selected];
116
- if (!connection) {
117
- throw new CliError(`Selected Rig server "${repo.selected}" was not found. Run \`rig server list\` or \`rig server use local\`.`, 1);
118
- }
119
- return { alias: repo.selected, connection, serverProjectRoot: repo.serverProjectRoot };
120
- }
121
- function writeRepoServerProjectRoot(projectRoot, serverProjectRoot) {
122
- const repo = readRepoConnection(projectRoot);
123
- if (!repo)
124
- return;
125
- writeRepoConnection(projectRoot, { ...repo, serverProjectRoot });
126
- }
127
63
 
128
- // packages/cli/src/commands/_server-client.ts
129
- import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
130
- import { resolve as resolve2 } from "path";
131
- import { ensureLocalRigServerConnection } from "@rig/runtime/local-server";
64
+ // packages/cli/src/commands/_inprocess-services.ts
65
+ import {
66
+ beginGitHubDeviceFlow,
67
+ checkGitHubRepoPermissions,
68
+ createGitHubAuthStore,
69
+ listGitHubProjects,
70
+ pollGitHubDeviceFlow,
71
+ resolveGitHubAuthStatus,
72
+ resolveProjectStatusField,
73
+ saveGitHubTokenForProject
74
+ } from "@rig/runtime/control-plane/github/index";
132
75
  var scopedGitHubBearerTokens = new Map;
133
- var serverPhaseListener = null;
134
- function setServerPhaseListener(listener) {
135
- const previous = serverPhaseListener;
136
- serverPhaseListener = listener;
137
- return previous;
138
- }
139
- function reportServerPhase(label) {
140
- serverPhaseListener?.(label);
141
- }
142
76
  function cleanToken(value) {
143
77
  const trimmed = value?.trim();
144
78
  return trimmed ? trimmed : null;
145
79
  }
146
- function readPrivateRemoteSessionToken(projectRoot) {
147
- const path = resolve2(projectRoot, ".rig", "state", "github-auth.json");
148
- if (!existsSync2(path))
149
- return null;
150
- try {
151
- const parsed = JSON.parse(readFileSync2(path, "utf8"));
152
- return cleanToken(typeof parsed.apiSessionToken === "string" ? parsed.apiSessionToken : typeof parsed.sessionToken === "string" ? parsed.sessionToken : undefined);
153
- } catch {
154
- return null;
155
- }
156
- }
157
- function readGitHubBearerTokenForRemote(projectRoot) {
158
- const scopedKey = resolve2(projectRoot);
159
- if (scopedGitHubBearerTokens.has(scopedKey))
160
- return scopedGitHubBearerTokens.get(scopedKey) ?? null;
161
- const privateSession = readPrivateRemoteSessionToken(projectRoot);
162
- if (privateSession)
163
- return privateSession;
164
- return cleanToken(process.env.RIG_SERVER_AUTH_TOKEN) ?? cleanToken(process.env.RIG_REMOTE_AUTH_TOKEN);
165
- }
166
- function readStoredGitHubAuthToken(projectRoot) {
167
- const path = resolve2(projectRoot, ".rig", "state", "github-auth.json");
168
- if (!existsSync2(path))
169
- return null;
170
- try {
171
- const parsed = JSON.parse(readFileSync2(path, "utf8"));
172
- return cleanToken(typeof parsed.token === "string" ? parsed.token : undefined);
173
- } catch {
174
- return null;
175
- }
176
- }
177
- function readLocalConnectionFallbackToken(projectRoot) {
178
- return readGitHubBearerTokenForRemote(projectRoot) ?? cleanToken(process.env.RIG_GITHUB_TOKEN) ?? readStoredGitHubAuthToken(projectRoot);
179
- }
180
- async function ensureServerForCli(projectRoot) {
181
- try {
182
- const selected = resolveSelectedConnection(projectRoot);
183
- if (selected?.connection.kind === "remote") {
184
- reportServerPhase(`Connecting to ${selected.alias}\u2026`);
185
- const authToken = readGitHubBearerTokenForRemote(projectRoot);
186
- const serverProjectRoot = selected.serverProjectRoot ?? await backfillRemoteServerProjectRoot(projectRoot, selected.connection.baseUrl, authToken);
187
- return {
188
- baseUrl: selected.connection.baseUrl,
189
- authToken,
190
- connectionKind: "remote",
191
- serverProjectRoot
192
- };
193
- }
194
- reportServerPhase("Starting local Rig server\u2026");
195
- const connection = await ensureLocalRigServerConnection(projectRoot);
196
- return {
197
- baseUrl: connection.baseUrl,
198
- authToken: connection.authToken ?? readLocalConnectionFallbackToken(projectRoot),
199
- connectionKind: "local",
200
- serverProjectRoot: resolve2(projectRoot)
201
- };
202
- } catch (error) {
203
- if (error instanceof Error) {
204
- throw new CliError(error.message, 1);
205
- }
206
- throw error;
207
- }
208
- }
209
- async function backfillRemoteServerProjectRoot(projectRoot, baseUrl, authToken) {
210
- const repo = readRepoConnection(projectRoot);
211
- const slug = repo?.project?.trim();
212
- if (!slug)
213
- return null;
214
- try {
215
- const response = await fetch(`${baseUrl}/api/projects/${encodeURIComponent(slug)}`, {
216
- headers: mergeHeaders(undefined, authToken)
217
- });
218
- if (!response.ok)
219
- return null;
220
- const payload = await response.json();
221
- const project = payload.project && typeof payload.project === "object" && !Array.isArray(payload.project) ? payload.project : null;
222
- const checkouts = Array.isArray(project?.checkouts) ? project.checkouts : [];
223
- const latestCheckout = [...checkouts].reverse().find((entry) => Boolean(entry && typeof entry === "object" && !Array.isArray(entry) && typeof entry.path === "string"));
224
- const path = typeof latestCheckout?.path === "string" && latestCheckout.path.trim() ? latestCheckout.path.trim() : null;
225
- if (path)
226
- writeRepoServerProjectRoot(projectRoot, path);
227
- return path;
228
- } catch {
229
- return null;
230
- }
231
- }
232
- function mergeHeaders(headers, authToken) {
233
- const merged = new Headers(headers);
234
- if (authToken) {
235
- merged.set("authorization", `Bearer ${authToken}`);
236
- }
237
- return merged;
238
- }
239
- function diagnosticMessage(payload) {
240
- if (!payload || typeof payload !== "object" || Array.isArray(payload))
241
- return null;
242
- const record = payload;
243
- const diagnostics = Array.isArray(record.diagnostics) ? record.diagnostics : [];
244
- const messages = diagnostics.flatMap((entry) => {
245
- if (!entry || typeof entry !== "object" || Array.isArray(entry))
246
- return [];
247
- const diagnostic = entry;
248
- const kind = typeof diagnostic.kind === "string" ? diagnostic.kind : "task-source";
249
- const message = typeof diagnostic.message === "string" ? diagnostic.message : null;
250
- return message ? [`${kind}: ${message}`] : [];
251
- });
252
- return messages.length > 0 ? messages.join("; ") : null;
253
- }
254
- var serverReachabilityCache = new Map;
255
- async function probeServerReachability(baseUrl, authToken) {
256
- try {
257
- const response = await fetch(`${baseUrl.replace(/\/+$/, "")}/api/server/status`, {
258
- headers: mergeHeaders(undefined, authToken),
259
- signal: AbortSignal.timeout(1500)
80
+ function cleanString(value) {
81
+ return typeof value === "string" && value.trim() ? value.trim() : null;
82
+ }
83
+ function oauthClientId() {
84
+ return cleanToken(process.env.RIG_GITHUB_OAUTH_CLIENT_ID);
85
+ }
86
+ async function getGitHubAuthStatusInProcess(context) {
87
+ return { ok: true, ...resolveGitHubAuthStatus({ projectRoot: context.projectRoot, oauthConfigured: Boolean(oauthClientId()) }) };
88
+ }
89
+ async function requestGitHubAuthJsonInProcess(context, pathname, init = {}) {
90
+ const method = (init.method ?? "GET").toUpperCase();
91
+ if (pathname === "/api/github/auth/status")
92
+ return getGitHubAuthStatusInProcess(context);
93
+ if (pathname === "/api/github/repo/permissions") {
94
+ return checkGitHubRepoPermissions({ projectRoot: context.projectRoot, oauthConfigured: Boolean(oauthClientId()) });
95
+ }
96
+ if (pathname === "/api/github/auth/device/start" && method === "POST") {
97
+ const clientId = oauthClientId();
98
+ if (!clientId)
99
+ return { ok: false, oauthConfigured: false, error: "RIG_GITHUB_OAUTH_CLIENT_ID is not configured." };
100
+ const body = init.body ? JSON.parse(String(init.body)) : {};
101
+ return beginGitHubDeviceFlow({
102
+ projectRoot: context.projectRoot,
103
+ clientId,
104
+ scope: cleanString(body.scope) ?? undefined,
105
+ selectedRepo: cleanString(body.repoSlug)
260
106
  });
261
- return response.ok;
262
- } catch {
263
- return false;
264
107
  }
265
- }
266
- function cachedServerReachability(projectRoot, baseUrl, authToken) {
267
- const key = resolve2(projectRoot);
268
- const cached = serverReachabilityCache.get(key);
269
- if (cached)
270
- return cached;
271
- const probe = probeServerReachability(baseUrl, authToken);
272
- serverReachabilityCache.set(key, probe);
273
- return probe;
274
- }
275
- function describeSelectedServer(projectRoot, server) {
276
- try {
277
- const selected = resolveSelectedConnection(projectRoot);
278
- if (selected) {
279
- return {
280
- alias: selected.alias,
281
- target: selected.connection.kind === "remote" ? selected.connection.baseUrl : server.baseUrl
282
- };
283
- }
284
- } catch {}
285
- return { alias: server.connectionKind === "remote" ? "remote" : "local", target: server.baseUrl };
286
- }
287
- async function buildServerFailureContext(projectRoot, server) {
288
- const { alias, target } = describeSelectedServer(projectRoot, server);
289
- const reachable = await cachedServerReachability(projectRoot, server.baseUrl, server.authToken);
290
- const reachability = reachable ? "server is reachable" : "server is unreachable";
291
- return {
292
- contextLine: `Currently connected to: ${alias} at ${target} (${reachability}).`,
293
- hint: "Check the selected server with `rig server status`, or switch with `rig server use <alias|local>`."
294
- };
295
- }
296
- async function requestServerJson(context, pathname, init = {}) {
297
- const server = await ensureServerForCli(context.projectRoot);
298
- const headers = mergeHeaders(init.headers, server.authToken);
299
- if (server.serverProjectRoot)
300
- headers.set("x-rig-project-root", server.serverProjectRoot);
301
- reportServerPhase(`${(init.method ?? "GET").toUpperCase()} ${pathname.split("?")[0]}\u2026`);
302
- let response;
303
- try {
304
- response = await fetch(`${server.baseUrl}${pathname}`, {
305
- ...init,
306
- headers
307
- });
308
- } catch (error) {
309
- const failure = await buildServerFailureContext(context.projectRoot, server);
310
- throw new CliError(`Rig server request failed: ${error instanceof Error ? error.message : String(error)}
311
- ${failure.contextLine}`, 1, { hint: failure.hint });
108
+ if (pathname === "/api/github/auth/device/poll" && method === "POST") {
109
+ const clientId = oauthClientId();
110
+ if (!clientId)
111
+ return { ok: false, oauthConfigured: false, error: "RIG_GITHUB_OAUTH_CLIENT_ID is not configured." };
112
+ const body = init.body ? JSON.parse(String(init.body)) : {};
113
+ const pollId = cleanString(body.pollId);
114
+ if (!pollId)
115
+ return { ok: false, status: "error", error: "pollId is required" };
116
+ return pollGitHubDeviceFlow({ projectRoot: context.projectRoot, clientId, pollId, selectedRepo: cleanString(body.repoSlug) });
312
117
  }
313
- const text = await response.text();
314
- const payload = text.trim().length > 0 ? (() => {
315
- try {
316
- return JSON.parse(text);
317
- } catch {
318
- return null;
319
- }
320
- })() : null;
321
- if (!response.ok) {
322
- const diagnostics = diagnosticMessage(payload);
323
- const rawDetail = diagnostics ?? (text || response.statusText);
324
- const detail = diagnostics ? rawDetail : rawDetail.split(`
325
- `).map((line) => line.trim()).find((line) => line.length > 0)?.slice(0, 200) ?? response.statusText;
326
- const failure = await buildServerFailureContext(context.projectRoot, server);
327
- throw new CliError(`Rig server request failed (${response.status}): ${detail}
328
- ${failure.contextLine}`, 1, { hint: failure.hint });
329
- }
330
- return payload;
118
+ throw new Error(`No in-process GitHub auth API for ${method} ${pathname}`);
331
119
  }
332
- var RESUMABLE_RUN_STATUSES = new Set([
333
- "created",
334
- "preparing",
335
- "running",
336
- "validating",
337
- "reviewing",
338
- "stopped",
339
- "failed",
340
- "needs-attention",
341
- "needs_attention"
342
- ]);
343
120
 
344
121
  // packages/cli/src/commands/_parsers.ts
345
122
  async function loadRigConfigOrNull(projectRoot) {
@@ -352,11 +129,10 @@ async function loadRigConfigOrNull(projectRoot) {
352
129
  }
353
130
 
354
131
  // packages/cli/src/commands/_pi-install.ts
355
- import { existsSync as existsSync3, readFileSync as readFileSync3, rmSync } from "fs";
356
- import { homedir as homedir2 } from "os";
357
- import { resolve as resolve3 } from "path";
132
+ import { existsSync as existsSync2 } from "fs";
133
+ import { homedir } from "os";
134
+ import { resolve as resolve2 } from "path";
358
135
  var PI_RIG_PACKAGE_NAME = "@h-rig/pi-rig";
359
- var LEGACY_PI_RIG_PACKAGE_NAME = "@rig/pi-rig";
360
136
  async function defaultCommandRunner(command, options = {}) {
361
137
  const proc = Bun.spawn(command, { cwd: options.cwd, stdout: "pipe", stderr: "pipe" });
362
138
  const [stdout, stderr, exitCode] = await Promise.all([
@@ -367,15 +143,15 @@ async function defaultCommandRunner(command, options = {}) {
367
143
  return { exitCode, stdout, stderr };
368
144
  }
369
145
  function resolvePiRigExtensionPath(homeDir) {
370
- return resolve3(homeDir, ".pi", "agent", "extensions", "pi-rig");
146
+ return resolve2(homeDir, ".pi", "agent", "extensions", "pi-rig");
371
147
  }
372
148
  function resolvePiHomeDir(inputHomeDir) {
373
- return inputHomeDir ?? process.env.RIG_PI_HOME_DIR?.trim() ?? homedir2();
149
+ return inputHomeDir ?? process.env.RIG_PI_HOME_DIR?.trim() ?? homedir();
374
150
  }
375
151
  function piListContainsPiRig(output) {
376
152
  return output.split(/\r?\n/).some((line) => {
377
153
  const normalized = line.trim();
378
- return normalized.includes(PI_RIG_PACKAGE_NAME) || normalized.includes(LEGACY_PI_RIG_PACKAGE_NAME) || /(?:^|[\\/])packages[\\/]pi-rig(?:$|\s)/.test(normalized);
154
+ return normalized.includes(PI_RIG_PACKAGE_NAME) || /(?:^|[\\/])packages[\\/]pi-rig(?:$|\s)/.test(normalized);
379
155
  });
380
156
  }
381
157
  async function safeRun(runner, command, options) {
@@ -395,27 +171,25 @@ async function checkPiRigInstall(input = {}) {
395
171
  piRig: { ok: true, label: "pi-rig global extension", detail: extensionPath }
396
172
  };
397
173
  }
398
- const exists = input.exists ?? existsSync3;
399
174
  const runner = input.commandRunner ?? defaultCommandRunner;
400
175
  const piResult = await safeRun(runner, ["pi", "--version"]);
401
176
  const piListResult = piResult.exitCode === 0 ? await safeRun(runner, ["pi", "list"]) : { exitCode: 1, stdout: "", stderr: "" };
402
- const listedPiRig = piListResult.exitCode === 0 && piListContainsPiRig(`${piListResult.stdout}
177
+ const hasPiRig = piListResult.exitCode === 0 && piListContainsPiRig(`${piListResult.stdout}
403
178
  ${piListResult.stderr}`);
404
- const legacyBridge = exists(resolve3(extensionPath, "index.ts"));
405
- const hasPiRig = listedPiRig;
179
+ const hasLegacyBridgeScaffold = !hasPiRig && (input.exists ?? existsSync2)(extensionPath);
406
180
  return {
407
181
  extensionPath,
408
182
  pi: {
409
183
  ok: piResult.exitCode === 0,
410
184
  label: "pi",
411
185
  detail: (piResult.stdout || piResult.stderr).trim() || undefined,
412
- hint: piResult.exitCode === 0 ? undefined : "Install Pi or run `rig init --yes` to install/update the Pi runtime."
186
+ hint: piResult.exitCode === 0 ? undefined : "Install Pi/OMP manually or set RIG_PI_INSTALL_COMMAND before verifying with bare `rig` / Cockpit \u2192 Doctor."
413
187
  },
414
188
  piRig: {
415
189
  ok: hasPiRig,
416
190
  label: "pi-rig global extension",
417
- detail: hasPiRig ? piListResult.stdout.trim() || PI_RIG_PACKAGE_NAME : legacyBridge ? `${extensionPath} (legacy bridge; reinstall required)` : undefined,
418
- hint: hasPiRig ? undefined : "Run `rig init --yes` to install/enable the global pi-rig package with `pi install`."
191
+ detail: hasPiRig ? piListResult.stdout.trim() || PI_RIG_PACKAGE_NAME : hasLegacyBridgeScaffold ? `legacy bridge scaffold at ${extensionPath}` : undefined,
192
+ hint: hasPiRig ? undefined : `Install the Rig OMP extension with \`pi install ${PI_RIG_PACKAGE_NAME}\`, then verify with bare \`rig\` / Cockpit \u2192 Doctor.`
419
193
  }
420
194
  };
421
195
  }
@@ -443,31 +217,14 @@ function isAuthenticated(payload) {
443
217
  const record = payload;
444
218
  return record.signedIn === true || record.authenticated === true || record.status === "authenticated" || record.ok === true && typeof record.login === "string" && record.login.trim().length > 0;
445
219
  }
446
- function repoSlugFromConfig(config) {
447
- const project = config?.project;
448
- if (project && typeof project === "object" && !Array.isArray(project)) {
449
- const record = project;
450
- if (typeof record.repo === "string" && /^([^/\s]+)\/([^/\s]+)$/.test(record.repo))
451
- return record.repo;
452
- if (typeof record.name === "string" && /^([^/\s]+)\/([^/\s]+)$/.test(record.name))
453
- return record.name;
454
- }
455
- const taskSource = config?.taskSource;
456
- if (taskSource && typeof taskSource === "object" && !Array.isArray(taskSource)) {
457
- const source = taskSource;
458
- if (typeof source.owner === "string" && typeof source.repo === "string")
459
- return `${source.owner}/${source.repo}`;
460
- }
461
- return null;
462
- }
463
220
  function loadFallbackConfig(projectRoot) {
464
221
  const candidates = ["rig.config.ts", "rig.config.mts", "rig.config.json"];
465
222
  for (const name of candidates) {
466
- const path = resolve4(projectRoot, name);
467
- if (!existsSync4(path))
223
+ const path = resolve3(projectRoot, name);
224
+ if (!existsSync3(path))
468
225
  continue;
469
226
  try {
470
- const source = readFileSync4(path, "utf8");
227
+ const source = readFileSync2(path, "utf8");
471
228
  if (name.endsWith(".json"))
472
229
  return JSON.parse(source);
473
230
  const owner = source.match(/owner\s*:\s*["']([^"']+)["']/)?.[1];
@@ -486,14 +243,11 @@ function loadFallbackConfig(projectRoot) {
486
243
  }
487
244
  return null;
488
245
  }
489
- function projectStatusSlug(projectRoot, config) {
490
- return readRepoConnection(projectRoot)?.project ?? repoSlugFromConfig(config);
491
- }
492
246
  function githubProjectsCheck(config) {
493
247
  const github = config?.github;
494
248
  const projects = github?.projects;
495
249
  if (!projects?.enabled) {
496
- 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.");
250
+ 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.");
497
251
  }
498
252
  if (projects.projectId && projects.statusFieldId) {
499
253
  return check("github-projects", "GitHub Projects status sync", "pass", `project ${projects.projectId}`);
@@ -518,16 +272,6 @@ function permissionAllowsPr(payload) {
518
272
  }
519
273
  return null;
520
274
  }
521
- function labelsReady(payload) {
522
- if (!payload || typeof payload !== "object" || Array.isArray(payload))
523
- return null;
524
- const record = payload;
525
- if (record.ok === true || record.ready === true || record.labelsReady === true)
526
- return true;
527
- if (record.ok === false || record.ready === false || record.labelsReady === false)
528
- return false;
529
- return null;
530
- }
531
275
  function prMergeCheck(config) {
532
276
  const pr = config?.pr;
533
277
  const merge = config?.merge;
@@ -541,7 +285,7 @@ async function runRigDoctorChecks(options) {
541
285
  const checks = [];
542
286
  const which = options.which ?? ((binary) => Bun.which(binary));
543
287
  const bunVersion = options.bunVersion ?? Bun.version;
544
- const request = options.requestJson ?? ((pathname, init) => requestServerJson({ projectRoot }, pathname, init));
288
+ const request = options.requestJson ?? ((pathname, init) => requestGitHubAuthJsonInProcess({ projectRoot }, pathname, init));
545
289
  const loadConfig = options.loadConfig ?? loadRigConfigOrNull;
546
290
  const progress = options.onProgress ?? (() => {});
547
291
  progress("Checking local toolchain\u2026");
@@ -549,78 +293,26 @@ async function runRigDoctorChecks(options) {
549
293
  progress("Loading rig.config\u2026");
550
294
  const loadedConfig = await loadConfig(projectRoot).catch(() => null);
551
295
  const config = loadedConfig ?? loadFallbackConfig(projectRoot);
552
- const hasConfigFile = ["rig.config.ts", "rig.config.mts", "rig.config.json"].some((name) => existsSync4(resolve4(projectRoot, name)));
553
- 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."));
296
+ const hasConfigFile = ["rig.config.ts", "rig.config.mts", "rig.config.json"].some((name) => existsSync3(resolve3(projectRoot, name)));
297
+ 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."));
554
298
  const taskSourceKind = config?.taskSource?.kind;
555
299
  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."));
556
300
  const repo = readRepoConnection(projectRoot);
557
- checks.push(repo ? check("project-link", "repo selected Rig server", 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 server", "fail", "missing .rig/state/connection.json", "Run `rig init` or `rig server use <alias|local>`."));
558
- const selected = (() => {
559
- try {
560
- return resolveSelectedConnection(projectRoot);
561
- } catch {
562
- return null;
563
- }
564
- })();
565
- checks.push(selected ? check("connection", "selected server connection", "pass", selected.connection.kind === "remote" ? selected.connection.baseUrl : "local auto") : check("connection", "selected server", repo ? "fail" : "warn", repo ? "selected alias is missing" : "will auto-start local server", repo ? "Run `rig server list` and `rig server use <alias|local>`." : undefined));
566
- let server = null;
301
+ 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."));
567
302
  try {
568
- progress("Connecting to the selected Rig server\u2026");
569
- server = await (options.resolveServer ?? ensureServerForCli)(projectRoot);
570
- checks.push(check("server", "Rig server reachable", "pass", `${server.connectionKind} ${server.baseUrl}`));
303
+ progress("Checking GitHub auth\u2026");
304
+ const auth = await request("/api/github/auth/status");
305
+ 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>`."));
571
306
  } catch (error) {
572
- checks.push(check("server", "Rig server reachable", "fail", errorMessage(error), "Start the local Rig server or fix the selected remote connection."));
307
+ checks.push(check("github-auth", "GitHub auth", "fail", errorMessage(error), "Authenticate GitHub through Rig."));
573
308
  }
574
- if (server || options.requestJson) {
575
- try {
576
- progress("Checking server status\u2026");
577
- const status = await request("/api/server/status");
578
- checks.push(check("server-status", "server project status", "pass", JSON.stringify(status).slice(0, 180)));
579
- } catch (error) {
580
- checks.push(check("server-status", "server project status", "fail", errorMessage(error), "Run `rig doctor` after the selected server is reachable."));
581
- }
582
- try {
583
- progress("Checking GitHub auth\u2026");
584
- const auth = await request("/api/github/auth/status");
585
- 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>`."));
586
- } catch (error) {
587
- checks.push(check("github-auth", "GitHub auth", "fail", errorMessage(error), "Authenticate GitHub through Rig and ensure the server exposes auth status."));
588
- }
589
- try {
590
- progress("Checking GitHub repo permissions\u2026");
591
- const permissions = await request("/api/github/repo/permissions");
592
- const allowed = permissionAllowsPr(permissions);
593
- 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."));
594
- } catch (error) {
595
- 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."));
596
- }
597
- try {
598
- progress("Checking GitHub issue labels\u2026");
599
- const labels = await request("/api/workspace/task-labels");
600
- const ready = labelsReady(labels);
601
- 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."));
602
- } catch (error) {
603
- checks.push(check("task-labels", "GitHub issue labels", "warn", errorMessage(error), "Run `rig init`/`rig doctor` after label setup is wired on the server."));
604
- }
605
- try {
606
- progress("Checking task projection\u2026");
607
- const projection = await request("/api/workspace/task-projection");
608
- checks.push(check("task-projection", "task projection", "pass", JSON.stringify(projection).slice(0, 180)));
609
- } catch (error) {
610
- checks.push(check("task-projection", "task projection", "warn", errorMessage(error), "Refresh task projection with `rig task list` or fix the task source."));
611
- }
612
- const slug = projectStatusSlug(projectRoot, config);
613
- if (slug) {
614
- try {
615
- progress("Checking server project checkout\u2026");
616
- const project = await request(`/api/projects/${encodeURIComponent(slug)}`);
617
- checks.push(check("remote-checkout", "server project checkout", "pass", JSON.stringify(project).slice(0, 180)));
618
- } catch (error) {
619
- 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."));
620
- }
621
- } else {
622
- checks.push(check("remote-checkout", "server project checkout", "warn", "repo slug unknown", "Set project.repo or run `rig init --repo owner/repo`."));
623
- }
309
+ try {
310
+ progress("Checking GitHub repo permissions\u2026");
311
+ const permissions = await request("/api/github/repo/permissions");
312
+ const allowed = permissionAllowsPr(permissions);
313
+ 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."));
314
+ } catch (error) {
315
+ checks.push(check("github-repo-permissions", "GitHub repo PR permissions", "warn", errorMessage(error), "Ensure the token can open PRs."));
624
316
  }
625
317
  if (taskSourceKind === "github-issues") {
626
318
  checks.push(check("gh", "gh CLI fallback", which("gh") ? "pass" : "warn", which("gh") ?? undefined, "Install gh for local/dev GitHub fallback operations."));
@@ -634,7 +326,7 @@ async function runRigDoctorChecks(options) {
634
326
  hint: errorMessage(error)
635
327
  }]);
636
328
  for (const pi of piChecks) {
637
- 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.")));
329
+ 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.")));
638
330
  }
639
331
  return checks;
640
332
  }
@@ -685,7 +377,7 @@ function createTtySpinner(input) {
685
377
  output.write("\r\x1B[2K");
686
378
  };
687
379
  render();
688
- const timer = isTty ? setInterval(render, input.intervalMs ?? 120) : null;
380
+ const timer = isTty ? setInterval(render, input.intervalMs ?? 16) : null;
689
381
  return {
690
382
  setLabel(next) {
691
383
  label = next;
@@ -715,90 +407,20 @@ function createTtySpinner(input) {
715
407
  };
716
408
  }
717
409
 
718
- // packages/cli/src/app/theme.ts
719
- var RIG_PALETTE = {
720
- ink: "#f2f3f6",
721
- ink2: "#aeb0ba",
722
- ink3: "#6c6e79",
723
- ink4: "#44464f",
724
- accent: "#ccff4d",
725
- accentDim: "#a9d63f",
726
- cyan: "#56d8ff",
727
- red: "#ff5d5d",
728
- yellow: "#ffd24d"
729
- };
730
- function hexToRgb(hex) {
731
- const value = hex.replace("#", "");
732
- return [
733
- Number.parseInt(value.slice(0, 2), 16),
734
- Number.parseInt(value.slice(2, 4), 16),
735
- Number.parseInt(value.slice(4, 6), 16)
736
- ];
737
- }
738
- function fg(hex) {
739
- const [r, g, b] = hexToRgb(hex);
740
- return (text) => `\x1B[38;2;${r};${g};${b}m${text}\x1B[39m`;
741
- }
742
- var ink = fg(RIG_PALETTE.ink);
743
- var ink2 = fg(RIG_PALETTE.ink2);
744
- var ink3 = fg(RIG_PALETTE.ink3);
745
- var ink4 = fg(RIG_PALETTE.ink4);
746
- var accent = fg(RIG_PALETTE.accent);
747
- var accentDim = fg(RIG_PALETTE.accentDim);
748
- var cyan = fg(RIG_PALETTE.cyan);
749
- var red = fg(RIG_PALETTE.red);
750
- var yellow = fg(RIG_PALETTE.yellow);
751
- function bold(text) {
752
- return `\x1B[1m${text}\x1B[22m`;
753
- }
754
- var DRONE_ART = [
755
- " .-=-. .-=-. ",
756
- " ( !!! ) ( !!! ) ",
757
- " '-=-'._ _.'-=-' ",
758
- " '._ _.' ",
759
- " '=$$$$$$$=.' ",
760
- " =$$$$$$$$$$$= ",
761
- " $$$@@@@@@@@@@$$$ ",
762
- " $$$@@ @@$$$ ",
763
- " $$@ ? @$$$ ",
764
- " $$$@ '-' @$$$ ",
765
- " $$$@@ @@$$$ ",
766
- " $$$@@@@@@@@@@$$$ ",
767
- " =$$$$$$$$$$$= ",
768
- " '=$$$$$$$=.' ",
769
- " _.' '._ ",
770
- " .-=-.' '.-=-. ",
771
- " ( !!! ) ( !!! ) ",
772
- " '-=-' '-=-' "
773
- ];
774
- var EYE_FRAMES = ["@", "o", "."];
775
- var DRONE_WIDTH = DRONE_ART[0].length;
776
- var DRONE_HEIGHT = DRONE_ART.length;
777
- var MICRO_BLADES = ["---", "\\\\\\", "|||", "///"];
778
- function microDroneFrame(tick) {
779
- const blade = MICRO_BLADES[tick % MICRO_BLADES.length];
780
- const eye = EYE_FRAMES[Math.floor(tick / 2) % EYE_FRAMES.length];
781
- return `(${blade})${eye}(${blade})`;
782
- }
783
- var MICRO_DRONE_FRAMES = Array.from({ length: 12 }, (_, index) => microDroneFrame(index));
784
- function renderMicroDroneFrame(tick) {
785
- const blade = MICRO_BLADES[tick % MICRO_BLADES.length];
786
- const eye = EYE_FRAMES[Math.floor(tick / 2) % EYE_FRAMES.length];
787
- return `${ink4("(")}${cyan(blade)}${ink4(")")}${bold(accent(eye))}${ink4("(")}${cyan(blade)}${ink4(")")}`;
788
- }
789
-
790
410
  // packages/cli/src/commands/_async-ui.ts
411
+ var FRAMES = ["\u25D0", "\u25D3", "\u25D1", "\u25D2"];
791
412
  var DONE_SYMBOL = pc.green("\u25C7");
792
413
  var FAIL_SYMBOL = pc.red("\u25A0");
793
414
  var activeUpdate = null;
794
415
  async function withSpinner(label, work, options = {}) {
795
416
  if (options.outputMode === "json") {
796
- return work(() => {});
417
+ return work(() => {
418
+ return;
419
+ });
797
420
  }
798
421
  if (activeUpdate) {
799
- const outer = activeUpdate;
800
- outer(label);
801
- return work(outer);
422
+ activeUpdate(label);
423
+ return work(activeUpdate);
802
424
  }
803
425
  const output = options.output ?? process.stderr;
804
426
  const isTty = output.isTTY === true;
@@ -810,26 +432,23 @@ async function withSpinner(label, work, options = {}) {
810
432
  lastLabel = next;
811
433
  };
812
434
  activeUpdate = update2;
813
- const previousListener2 = setServerPhaseListener(update2);
814
435
  try {
815
436
  return await work(update2);
816
437
  } finally {
817
438
  activeUpdate = null;
818
- setServerPhaseListener(previousListener2);
819
439
  }
820
440
  }
821
441
  const spinner = createTtySpinner({
822
442
  label,
823
443
  output,
824
- frames: MICRO_DRONE_FRAMES,
825
- styleFrame: (frame) => renderMicroDroneFrame(Math.max(0, MICRO_DRONE_FRAMES.indexOf(frame)))
444
+ frames: FRAMES,
445
+ styleFrame: (frame) => pc.cyan(frame)
826
446
  });
827
447
  const update = (next) => {
828
448
  lastLabel = next;
829
449
  spinner.setLabel(next);
830
450
  };
831
451
  activeUpdate = update;
832
- const previousListener = setServerPhaseListener(update);
833
452
  try {
834
453
  const result = await work(update);
835
454
  spinner.stop(options.doneLabel ? `${DONE_SYMBOL} ${options.doneLabel}` : undefined);
@@ -839,13 +458,12 @@ async function withSpinner(label, work, options = {}) {
839
458
  throw error;
840
459
  } finally {
841
460
  activeUpdate = null;
842
- setServerPhaseListener(previousListener);
843
461
  }
844
462
  }
845
463
 
846
464
  // packages/cli/src/commands/doctor.ts
847
465
  async function executeDoctor(context, args) {
848
- requireNoExtraArgs(args, "rig doctor");
466
+ requireNoExtraArgs(args, "legacy diagnostic: rig doctor");
849
467
  const checks = await withSpinner("Running doctor checks\u2026", (update) => runRigDoctorChecks({ projectRoot: context.projectRoot, onProgress: update }), { outputMode: context.outputMode });
850
468
  if (context.outputMode === "text") {
851
469
  console.log(formatDoctorChecks(checks));