@mycompbox/compbox-cli 1.13.0

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 (98) hide show
  1. package/.tsbuildinfo +1 -0
  2. package/commands/configure.d.ts +24 -0
  3. package/commands/configure.d.ts.map +1 -0
  4. package/commands/configure.js +170 -0
  5. package/commands/configure.js.map +1 -0
  6. package/commands/doctor.d.ts +136 -0
  7. package/commands/doctor.d.ts.map +1 -0
  8. package/commands/doctor.js +606 -0
  9. package/commands/doctor.js.map +1 -0
  10. package/commands/install.d.ts +3 -0
  11. package/commands/install.d.ts.map +1 -0
  12. package/commands/install.js +88 -0
  13. package/commands/install.js.map +1 -0
  14. package/commands/list.d.ts +3 -0
  15. package/commands/list.d.ts.map +1 -0
  16. package/commands/list.js +141 -0
  17. package/commands/list.js.map +1 -0
  18. package/commands/login.d.ts +15 -0
  19. package/commands/login.d.ts.map +1 -0
  20. package/commands/login.js +102 -0
  21. package/commands/login.js.map +1 -0
  22. package/commands/publish.d.ts +3 -0
  23. package/commands/publish.d.ts.map +1 -0
  24. package/commands/publish.js +102 -0
  25. package/commands/publish.js.map +1 -0
  26. package/commands/run.d.ts +76 -0
  27. package/commands/run.d.ts.map +1 -0
  28. package/commands/run.js +417 -0
  29. package/commands/run.js.map +1 -0
  30. package/commands/service.d.ts +29 -0
  31. package/commands/service.d.ts.map +1 -0
  32. package/commands/service.js +142 -0
  33. package/commands/service.js.map +1 -0
  34. package/commands/update.d.ts +3 -0
  35. package/commands/update.d.ts.map +1 -0
  36. package/commands/update.js +141 -0
  37. package/commands/update.js.map +1 -0
  38. package/index.d.ts +3 -0
  39. package/index.d.ts.map +1 -0
  40. package/index.js +8508 -0
  41. package/index.js.map +1 -0
  42. package/package.json +30 -0
  43. package/utils/agent-invoker.d.ts +393 -0
  44. package/utils/agent-invoker.d.ts.map +1 -0
  45. package/utils/agent-invoker.js +1632 -0
  46. package/utils/agent-invoker.js.map +1 -0
  47. package/utils/api-client.d.ts +54 -0
  48. package/utils/api-client.d.ts.map +1 -0
  49. package/utils/api-client.js +214 -0
  50. package/utils/api-client.js.map +1 -0
  51. package/utils/auth-client.d.ts +61 -0
  52. package/utils/auth-client.d.ts.map +1 -0
  53. package/utils/auth-client.js +135 -0
  54. package/utils/auth-client.js.map +1 -0
  55. package/utils/claude-runtime.d.ts +116 -0
  56. package/utils/claude-runtime.d.ts.map +1 -0
  57. package/utils/claude-runtime.js +291 -0
  58. package/utils/claude-runtime.js.map +1 -0
  59. package/utils/config-store.d.ts +128 -0
  60. package/utils/config-store.d.ts.map +1 -0
  61. package/utils/config-store.js +137 -0
  62. package/utils/config-store.js.map +1 -0
  63. package/utils/file-manager.d.ts +32 -0
  64. package/utils/file-manager.d.ts.map +1 -0
  65. package/utils/file-manager.js +208 -0
  66. package/utils/file-manager.js.map +1 -0
  67. package/utils/keychain.d.ts +46 -0
  68. package/utils/keychain.d.ts.map +1 -0
  69. package/utils/keychain.js +167 -0
  70. package/utils/keychain.js.map +1 -0
  71. package/utils/loopback.d.ts +45 -0
  72. package/utils/loopback.d.ts.map +1 -0
  73. package/utils/loopback.js +95 -0
  74. package/utils/loopback.js.map +1 -0
  75. package/utils/mailbox-client.d.ts +98 -0
  76. package/utils/mailbox-client.d.ts.map +1 -0
  77. package/utils/mailbox-client.js +178 -0
  78. package/utils/mailbox-client.js.map +1 -0
  79. package/utils/mcp-config-writer.d.ts +133 -0
  80. package/utils/mcp-config-writer.d.ts.map +1 -0
  81. package/utils/mcp-config-writer.js +184 -0
  82. package/utils/mcp-config-writer.js.map +1 -0
  83. package/utils/pack-bundler.d.ts +30 -0
  84. package/utils/pack-bundler.d.ts.map +1 -0
  85. package/utils/pack-bundler.js +141 -0
  86. package/utils/pack-bundler.js.map +1 -0
  87. package/utils/prompt.d.ts +31 -0
  88. package/utils/prompt.d.ts.map +1 -0
  89. package/utils/prompt.js +86 -0
  90. package/utils/prompt.js.map +1 -0
  91. package/utils/table-formatter.d.ts +42 -0
  92. package/utils/table-formatter.d.ts.map +1 -0
  93. package/utils/table-formatter.js +125 -0
  94. package/utils/table-formatter.js.map +1 -0
  95. package/utils/version-resolver.d.ts +31 -0
  96. package/utils/version-resolver.d.ts.map +1 -0
  97. package/utils/version-resolver.js +75 -0
  98. package/utils/version-resolver.js.map +1 -0
@@ -0,0 +1,606 @@
1
+ /**
2
+ * `compbox doctor` — verify the local setup end-to-end.
3
+ *
4
+ * Runs a series of independent checks, each printed with a clear
5
+ * PASS / FAIL / SKIP and a concrete remediation on failure:
6
+ * 1. Local config present (central URL + token).
7
+ * 2. Central API reachable over the network.
8
+ * 3. Token authenticates (GET /auth/me returns an identity).
9
+ * 4. Attribution: a user-scoped write resolves to the expected user id.
10
+ * 5. Machine paired — the stored machine token resolves against central
11
+ * (reported present/valid; the token value is NEVER printed).
12
+ * 6. MCP config written at the expected path (verifies the WRITTEN config
13
+ * file, not a locally installed MCP binary — the server auto-installs via
14
+ * `npx` on first use).
15
+ * 6.5 Central target — which central the MCP writes to (its API_BASE_URL).
16
+ * WARN-level (never fails): warns when it is a local/loopback endpoint or
17
+ * differs from the logged-in central, so work is never silently pointed at
18
+ * localhost instead of the cloud. The API token is never printed.
19
+ * 6.7 MCP launch target — the written entry must actually be launchable
20
+ * (ENG-141): `node` entries must point at a bundle that exists on disk
21
+ * and answers a short startup probe (hard 5s timeout so doctor can never
22
+ * hang — WARN on timeout); `npx` entries resolve from registry.npmjs.org
23
+ * on first use, so there is nothing local to verify.
24
+ * 7. AI mode configured (keychain key present, or subscription acknowledged).
25
+ * 8. macOS only — the Homebrew-managed service is running (best-effort; skips
26
+ * gracefully when `brew` is not on PATH).
27
+ * 9. pxpipe token proxy — reachable when enabled (SKIP when disabled). Agents
28
+ * fall back to direct calls if it is down, so this never hard-fails setup.
29
+ *
30
+ * Exits non-zero if any non-skipped check fails so it is usable in scripts.
31
+ */
32
+ import { execFileSync, spawn } from 'child_process';
33
+ import { existsSync } from 'fs';
34
+ import { Command } from 'commander';
35
+ import chalk from 'chalk';
36
+ import { AuthClient, AuthClientError } from '../utils/auth-client.js';
37
+ import { MailboxClient, MailboxClientError } from '../utils/mailbox-client.js';
38
+ import { readConfig } from '../utils/config-store.js';
39
+ import { probeAgentRuntime, WELL_KNOWN_DIRS, claudeNotFoundMessage, } from '../utils/claude-runtime.js';
40
+ import { retrieveSecret, AI_KEY_ACCOUNT, MACHINE_TOKEN_ACCOUNT, } from '../utils/keychain.js';
41
+ import { defaultMcpConfigPath, inspectMcpConfig, MCP_SERVER_PACKAGE, } from '../utils/mcp-config-writer.js';
42
+ import { isLoopbackUrl, LOOPBACK_IMPACT } from '../utils/loopback.js';
43
+ import { isPxpipeEnabled, probeProxyHealth, getAnthropicProxyUrl } from '@mycompbox/shared';
44
+ function printResult(result) {
45
+ const marker = result.warning
46
+ ? chalk.yellow('WARN')
47
+ : result.skipped
48
+ ? chalk.yellow('SKIP')
49
+ : result.passed
50
+ ? chalk.green('PASS')
51
+ : chalk.red('FAIL');
52
+ console.log(` [${marker}] ${result.name}`);
53
+ if (result.detail.length > 0) {
54
+ console.log(chalk.gray(` ${result.detail}`));
55
+ }
56
+ }
57
+ /**
58
+ * Compare two central URLs for equivalence so trivial formatting differences
59
+ * don't trip the central-target mismatch warning. Normalizes via WHATWG
60
+ * `new URL(u).href` (lowercases scheme/host, drops default ports such as
61
+ * `:443` for https and `:80` for http), falling back to plain string
62
+ * normalization for values that don't parse as URLs, then ignores trailing
63
+ * slashes.
64
+ *
65
+ * Intentionally NOT tolerant of http↔https or path differences (e.g. an
66
+ * `/api` suffix): those point at genuinely different targets, so they should
67
+ * still trigger the mismatch WARN.
68
+ */
69
+ export function sameCentralUrl(a, b) {
70
+ const normalize = (u) => {
71
+ const trimmed = u.trim();
72
+ let href;
73
+ try {
74
+ href = new URL(trimmed).href;
75
+ }
76
+ catch {
77
+ href = trimmed.toLowerCase();
78
+ }
79
+ return href.replace(/\/+$/, '');
80
+ };
81
+ return normalize(a) === normalize(b);
82
+ }
83
+ /**
84
+ * Check 6.5: Central target — which central the MCP actually writes to.
85
+ * Uses the read-only API_BASE_URL from the written MCP entry (never the
86
+ * token). WARN-level only: localhost is valid in dev, so we surface — never
87
+ * block. Warns when the MCP writes to a local/loopback endpoint, OR when it
88
+ * targets a different central than the one this machine logged into.
89
+ * Extracted (and exported) so the WARN semantics are unit-testable.
90
+ */
91
+ export function centralTargetCheck(mcpStatus, loggedInUrl) {
92
+ const mcpTarget = mcpStatus.apiBaseUrl;
93
+ if (!mcpTarget) {
94
+ return {
95
+ name: 'Central target',
96
+ passed: true,
97
+ skipped: true,
98
+ detail: mcpStatus.entryPresent
99
+ ? 'Skipped — MCP entry present but has no API_BASE_URL, so the central target is unknown. Re-run `compbox configure` to write it.'
100
+ : 'Skipped — no CompBox MCP entry, so the central target is unknown. Run `compbox configure` to write it.',
101
+ };
102
+ }
103
+ const loopback = isLoopbackUrl(mcpTarget);
104
+ const mismatch = loggedInUrl !== undefined && !sameCentralUrl(mcpTarget, loggedInUrl);
105
+ if (loopback || mismatch) {
106
+ const reasons = [];
107
+ if (loopback) {
108
+ reasons.push(`the MCP writes to a LOCAL dev endpoint (${mcpTarget}) — ${LOOPBACK_IMPACT}`);
109
+ }
110
+ if (mismatch) {
111
+ reasons.push(`the MCP target (${mcpTarget}) differs from your logged-in central (${loggedInUrl})`);
112
+ }
113
+ return {
114
+ name: 'Central target',
115
+ passed: false,
116
+ warning: true,
117
+ detail: `${reasons.join('; ')}. To point at the cloud, run \`compbox login --url <cloud-url> && compbox configure\`.`,
118
+ };
119
+ }
120
+ return {
121
+ name: 'Central target',
122
+ passed: true,
123
+ detail: `MCP writes to ${mcpTarget}.`,
124
+ };
125
+ }
126
+ /**
127
+ * Count hard failures: skipped checks are informational and WARN-level checks
128
+ * (e.g. a localhost central target) never fail the run or affect the exit
129
+ * code. Extracted (and exported) so this exclusion is unit-testable.
130
+ */
131
+ export function countFailures(results) {
132
+ return results.filter((r) => !r.passed && !r.skipped && !r.warning).length;
133
+ }
134
+ /**
135
+ * Hard upper bound for the launch-target startup probe. The probe must never
136
+ * hang `doctor`: after this many milliseconds the child is killed and the
137
+ * check reports WARN (not FAIL — a slow machine is not a broken setup).
138
+ */
139
+ export const LAUNCH_PROBE_TIMEOUT_MS = 5000;
140
+ /**
141
+ * Spawn the configured MCP launch target and wait for its startup banner.
142
+ * The server logs `… started (stdio transport)` to stderr once the stdio
143
+ * transport is connected, so ANY output on stderr/stdout counts as an answer
144
+ * — the probe cares that the process starts, not what it says. Runs with a
145
+ * dummy API_TOKEN (env validation happens before the banner) pointing at an
146
+ * unroutable loopback port so the probe can never write to a real central.
147
+ * The child is always killed, and `timeoutMs` (default
148
+ * LAUNCH_PROBE_TIMEOUT_MS) guarantees the probe cannot hang.
149
+ */
150
+ export function probeLaunchTarget(command, args, timeoutMs = LAUNCH_PROBE_TIMEOUT_MS) {
151
+ return new Promise((resolve) => {
152
+ let settled = false;
153
+ const child = spawn(command, args, {
154
+ stdio: ['ignore', 'pipe', 'pipe'],
155
+ env: {
156
+ ...process.env,
157
+ // Dummy values only: enough to pass the server's env validation,
158
+ // never a real token, pointed at an unroutable loopback port.
159
+ API_TOKEN: 'compbox-doctor-probe',
160
+ API_BASE_URL: 'http://127.0.0.1:9',
161
+ },
162
+ });
163
+ const settle = (result) => {
164
+ if (settled) {
165
+ return;
166
+ }
167
+ settled = true;
168
+ clearTimeout(timer);
169
+ try {
170
+ child.kill('SIGKILL');
171
+ }
172
+ catch {
173
+ // Child already gone — nothing to clean up.
174
+ }
175
+ resolve(result);
176
+ };
177
+ // `settle` above closes over `timer`; it can only run once the event
178
+ // handlers below are attached, by which point `timer` is initialized.
179
+ const timer = setTimeout(() => {
180
+ settle({ status: 'timeout' });
181
+ }, timeoutMs);
182
+ const onOutput = () => {
183
+ settle({ status: 'answered' });
184
+ };
185
+ child.stdout.on('data', onOutput);
186
+ child.stderr.on('data', onOutput);
187
+ child.on('error', (error) => {
188
+ settle({ status: 'error', detail: error.message });
189
+ });
190
+ child.on('exit', (code) => {
191
+ settle({
192
+ status: 'error',
193
+ detail: `exited with code ${String(code ?? 'unknown')} before answering`,
194
+ });
195
+ });
196
+ });
197
+ }
198
+ /**
199
+ * Check 6.7: MCP launch target — the entry `configure` wrote must actually be
200
+ * launchable (ENG-141). Semantics:
201
+ * - `node <bundle>`: FAIL when the bundle file is missing (broken install)
202
+ * or crashes on startup; WARN when it exists but does not answer within
203
+ * LAUNCH_PROBE_TIMEOUT_MS; PASS when it answers the startup probe.
204
+ * - `npx …`: nothing installed locally to verify — PASS with a note that
205
+ * the package resolves from registry.npmjs.org on first use.
206
+ * - No entry / no command / custom override command: SKIP (informational).
207
+ * Extracted (and exported) with injectable fs/spawn deps so every branch is
208
+ * unit-testable without touching the real filesystem or spawning processes.
209
+ */
210
+ export async function launchTargetCheck(mcpStatus, deps = {}) {
211
+ const name = 'MCP launch target';
212
+ const fileExists = deps.fileExists ?? existsSync;
213
+ const probe = deps.probe ?? probeLaunchTarget;
214
+ if (!mcpStatus.entryPresent || mcpStatus.command === undefined) {
215
+ return {
216
+ name,
217
+ passed: true,
218
+ skipped: true,
219
+ detail: mcpStatus.entryPresent
220
+ ? 'Skipped — MCP entry present but has no launch command. Re-run `compbox configure` to rewrite it.'
221
+ : 'Skipped — no CompBox MCP entry to verify. Run `compbox configure` to write one.',
222
+ };
223
+ }
224
+ if (mcpStatus.command === 'npx') {
225
+ return {
226
+ name,
227
+ passed: true,
228
+ detail: `Launch target is \`npx\` — ${MCP_SERVER_PACKAGE} resolves from registry.npmjs.org on first use; nothing installed locally to verify.`,
229
+ };
230
+ }
231
+ if (mcpStatus.command !== 'node') {
232
+ return {
233
+ name,
234
+ passed: true,
235
+ skipped: true,
236
+ detail: `Skipped — custom launch command (\`${mcpStatus.command}\`) is not probed. Re-run \`compbox configure\` to restore the managed launch target.`,
237
+ };
238
+ }
239
+ const bundlePath = mcpStatus.args?.[0];
240
+ if (bundlePath === undefined || bundlePath.length === 0) {
241
+ return {
242
+ name,
243
+ passed: false,
244
+ detail: 'Launch command is `node` but no bundle path is configured — re-run `compbox configure` to rewrite the entry.',
245
+ };
246
+ }
247
+ if (!fileExists(bundlePath)) {
248
+ return {
249
+ name,
250
+ passed: false,
251
+ detail: `Configured MCP bundle not found at ${bundlePath} — run \`brew reinstall compbox\` (or re-run \`compbox configure\`) to restore it.`,
252
+ };
253
+ }
254
+ const probeResult = await probe('node', [bundlePath]);
255
+ if (probeResult.status === 'answered') {
256
+ return {
257
+ name,
258
+ passed: true,
259
+ detail: `Bundle at ${bundlePath} exists and answers a startup probe.`,
260
+ };
261
+ }
262
+ if (probeResult.status === 'timeout') {
263
+ return {
264
+ name,
265
+ passed: false,
266
+ warning: true,
267
+ detail: `Bundle at ${bundlePath} exists but did not answer within ${String(LAUNCH_PROBE_TIMEOUT_MS / 1000)}s — it may still work; if MCP calls fail, run \`brew reinstall compbox\`.`,
268
+ };
269
+ }
270
+ return {
271
+ name,
272
+ passed: false,
273
+ detail: `Bundle at ${bundlePath} exists but failed to start (${probeResult.detail ?? 'unknown error'}) — run \`brew reinstall compbox\` or re-run \`compbox configure\`.`,
274
+ };
275
+ }
276
+ /**
277
+ * macOS-only: best-effort check that the Homebrew-managed CompBox service is
278
+ * running. If `brew` is absent / not on PATH, this SKIPS gracefully (it does
279
+ * not fail) since the machine may have been installed by other means.
280
+ */
281
+ function checkBrewService() {
282
+ let output;
283
+ try {
284
+ output = execFileSync('brew', ['services', 'list'], {
285
+ encoding: 'utf-8',
286
+ timeout: 10_000,
287
+ stdio: ['ignore', 'pipe', 'ignore'],
288
+ });
289
+ }
290
+ catch {
291
+ // `brew` not installed / not on PATH, or the command failed — skip, don't fail.
292
+ return {
293
+ name: 'Homebrew service running (macOS)',
294
+ passed: true,
295
+ skipped: true,
296
+ detail: 'Skipped — `brew` not found on PATH. If you installed CompBox via Homebrew, ensure brew is available, then run `brew services start compbox`.',
297
+ };
298
+ }
299
+ const line = output.split('\n').find((l) => /^\s*compbox\b/.test(l));
300
+ if (!line) {
301
+ return {
302
+ name: 'Homebrew service running (macOS)',
303
+ passed: false,
304
+ detail: 'CompBox is not registered with `brew services` — run `brew services start compbox`.',
305
+ };
306
+ }
307
+ const started = /\bstarted\b/i.test(line);
308
+ return {
309
+ name: 'Homebrew service running (macOS)',
310
+ passed: started,
311
+ detail: started
312
+ ? 'CompBox Agent Runner is running under `brew services`.'
313
+ : 'CompBox service is registered but not running — run `brew services start compbox`.',
314
+ };
315
+ }
316
+ /**
317
+ * pxpipe token proxy (ENG-138). Informational when disabled (SKIP); when
318
+ * enabled, PASS/FAIL on reachability. Agents fall back to direct calls when the
319
+ * proxy is down, so an unreachable proxy is a warning, not a hard blocker.
320
+ */
321
+ async function checkPxpipe() {
322
+ if (!isPxpipeEnabled()) {
323
+ return {
324
+ name: 'pxpipe token proxy',
325
+ passed: true,
326
+ skipped: true,
327
+ detail: 'Disabled — set PXPIPE_ENABLED=true and run `npx pxpipe-proxy` to cut agent token usage. See docs/pxpipe-setup.md.',
328
+ };
329
+ }
330
+ const url = getAnthropicProxyUrl();
331
+ const health = await probeProxyHealth(url);
332
+ return {
333
+ name: 'pxpipe token proxy',
334
+ passed: health.healthy,
335
+ detail: health.healthy
336
+ ? `Enabled and reachable at ${url} — agent calls route through pxpipe.`
337
+ : `Enabled but unreachable at ${url} — start it with \`npx pxpipe-proxy\`. Agents fall back to direct calls until it is up.`,
338
+ };
339
+ }
340
+ /**
341
+ * Check 7.5: Agent runtime (claude CLI) — only meaningful in
342
+ * `claude-subscription` mode, where the `compbox run` daemon must be able to
343
+ * spawn the local `claude` binary (ENG-135). Semantics:
344
+ * - api-key mode (or unset): SKIP — no `claude` needed, so this never
345
+ * affects the exit code.
346
+ * - claude-subscription + probe `ok`: PASS, echoing the version.
347
+ * - claude-subscription + probe `not-found`/`error`: FAIL with a remediation
348
+ * that lists the searched install locations (WELL_KNOWN_DIRS /
349
+ * claudeNotFoundMessage), the install link, and a note to re-run doctor.
350
+ * The probe is injectable (defaults to ENG-135 probeAgentRuntime) so every
351
+ * branch is unit-testable without spawning a real `claude`.
352
+ */
353
+ export async function agentRuntimeCheck(config, deps = {}) {
354
+ const name = 'Agent runtime (claude CLI)';
355
+ if (config.aiMode !== 'claude-subscription') {
356
+ return {
357
+ name,
358
+ passed: true,
359
+ skipped: true,
360
+ detail: 'Skipped — only relevant in claude-subscription mode.',
361
+ };
362
+ }
363
+ const probe = deps.probe ?? probeAgentRuntime;
364
+ const result = await probe();
365
+ if (result.status === 'ok') {
366
+ return {
367
+ name,
368
+ passed: true,
369
+ detail: `The \`claude\` CLI is installed and invocable (${result.detail}).`,
370
+ };
371
+ }
372
+ // not-found: claudeNotFoundMessage already lists every searched location plus
373
+ // the install link. error: the binary was found but failed to run, so lead
374
+ // with the concrete reason, then still point at the install link + locations.
375
+ const reRun = 'Re-run `compbox doctor` after installing.';
376
+ if (result.status === 'error') {
377
+ const searched = WELL_KNOWN_DIRS.map((d) => ` - ${d}`).join('\n');
378
+ return {
379
+ name,
380
+ passed: false,
381
+ detail: `The \`claude\` CLI was found but failed to run: ${result.detail}. Reinstall Claude Code (https://code.claude.com) and re-run \`compbox doctor\`. Searched install locations:\n${searched}`,
382
+ };
383
+ }
384
+ return {
385
+ name,
386
+ passed: false,
387
+ detail: `${claudeNotFoundMessage()}\n${reRun}`,
388
+ };
389
+ }
390
+ export const doctorCommand = new Command('doctor')
391
+ .description('Diagnose config, connectivity, machine pairing, MCP config, AI mode, and the service')
392
+ .option('--mcp-config <path>', 'Path to the MCP config to check (default: ./.mcp.json)')
393
+ .action(async (options) => {
394
+ console.log(chalk.bold('\nCompBox setup diagnostics\n'));
395
+ const results = [];
396
+ const config = readConfig();
397
+ // Check 1: local config present.
398
+ const hasConfig = Boolean(config.apiBaseUrl && config.apiToken);
399
+ results.push({
400
+ name: 'Local config present',
401
+ passed: hasConfig,
402
+ detail: hasConfig
403
+ ? `Central URL: ${config.apiBaseUrl ?? ''}`
404
+ : 'Run `compbox login` to pair this machine.',
405
+ });
406
+ if (!config.apiBaseUrl || !config.apiToken) {
407
+ results.forEach(printResult);
408
+ console.log(chalk.red('\n✖ Setup incomplete. Run `compbox login` first.'));
409
+ process.exit(1);
410
+ return;
411
+ }
412
+ const baseUrl = config.apiBaseUrl;
413
+ const token = config.apiToken;
414
+ const client = new AuthClient(baseUrl);
415
+ // Check 2: reachability.
416
+ const reachable = await client.isReachable();
417
+ results.push({
418
+ name: 'Central API reachable',
419
+ passed: reachable,
420
+ detail: reachable
421
+ ? `Reached ${baseUrl}`
422
+ : `Could not reach ${baseUrl} — check the URL and your network, then re-run \`compbox doctor\`.`,
423
+ });
424
+ // Check 3: token authenticates.
425
+ let authedUserId = null;
426
+ if (reachable) {
427
+ try {
428
+ const me = await client.getMe(token);
429
+ authedUserId = me.id;
430
+ results.push({
431
+ name: 'Token authenticates',
432
+ passed: true,
433
+ detail: `Authenticated as ${me.name} <${me.email}>`,
434
+ });
435
+ }
436
+ catch (error) {
437
+ const message = error instanceof AuthClientError ? error.message : 'Token did not authenticate';
438
+ results.push({
439
+ name: 'Token authenticates',
440
+ passed: false,
441
+ detail: `${message} — try re-running \`compbox login\`.`,
442
+ });
443
+ }
444
+ }
445
+ else {
446
+ results.push({
447
+ name: 'Token authenticates',
448
+ passed: false,
449
+ detail: 'Skipped — central not reachable.',
450
+ });
451
+ }
452
+ // Check 4: attribution — the write path resolves to the expected user.
453
+ if (authedUserId) {
454
+ try {
455
+ const scope = await client.getPersonalScope(token);
456
+ const attributedCorrectly = !config.userId || scope.userId === config.userId;
457
+ const matchesAuth = scope.userId === authedUserId;
458
+ const passed = matchesAuth && attributedCorrectly;
459
+ results.push({
460
+ name: 'Write attributed to you',
461
+ passed,
462
+ detail: passed
463
+ ? `A test write was attributed to user ${scope.userId}.`
464
+ : `Write attributed to ${scope.userId}, expected ${config.userId ?? authedUserId} — re-run \`compbox login\`.`,
465
+ });
466
+ }
467
+ catch (error) {
468
+ const message = error instanceof AuthClientError ? error.message : 'Attribution probe failed';
469
+ results.push({
470
+ name: 'Write attributed to you',
471
+ passed: false,
472
+ detail: `${message} — re-run \`compbox login\`.`,
473
+ });
474
+ }
475
+ }
476
+ else {
477
+ results.push({
478
+ name: 'Write attributed to you',
479
+ passed: false,
480
+ detail: 'Skipped — token did not authenticate.',
481
+ });
482
+ }
483
+ // Check 5: machine paired — the stored machine token resolves against
484
+ // central. We verify presence locally, then confirm it authenticates to the
485
+ // daemon-only mailbox endpoint (heartbeat). The token value is NEVER printed.
486
+ if (config.machineId) {
487
+ const { value: machineToken } = await retrieveSecret(MACHINE_TOKEN_ACCOUNT);
488
+ const present = machineToken !== null && machineToken.length > 0;
489
+ if (!present) {
490
+ results.push({
491
+ name: 'Machine paired',
492
+ passed: false,
493
+ detail: 'Machine record exists but its token is missing from this machine — run `compbox configure` again to re-pair.',
494
+ });
495
+ }
496
+ else if (!reachable) {
497
+ results.push({
498
+ name: 'Machine paired',
499
+ passed: true,
500
+ skipped: true,
501
+ detail: 'Machine token present locally; could not verify against central (unreachable).',
502
+ });
503
+ }
504
+ else {
505
+ try {
506
+ const mailbox = new MailboxClient(baseUrl);
507
+ await mailbox.heartbeat(machineToken);
508
+ results.push({
509
+ name: 'Machine paired',
510
+ passed: true,
511
+ detail: `Machine token is valid and resolves against central (paired as "${config.machineName ?? config.machineId}").`,
512
+ });
513
+ }
514
+ catch (error) {
515
+ const message = error instanceof MailboxClientError ? error.message : 'Machine token check failed';
516
+ results.push({
517
+ name: 'Machine paired',
518
+ passed: false,
519
+ detail: `Stored machine token did not resolve against central: ${message} — run \`compbox configure\` to re-pair.`,
520
+ });
521
+ }
522
+ }
523
+ }
524
+ else {
525
+ results.push({
526
+ name: 'Machine paired',
527
+ passed: false,
528
+ detail: 'Not paired — run `compbox configure` to pair this device before starting the service.',
529
+ });
530
+ }
531
+ // Check 6: MCP config written at the expected path. This verifies the config
532
+ // FILE `configure` wrote — the MCP server itself is not installed locally; the
533
+ // written entry launches it via `npx` on first use.
534
+ const mcpConfigPath = options.mcpConfig ?? defaultMcpConfigPath();
535
+ const mcpStatus = inspectMcpConfig(mcpConfigPath);
536
+ const mcpOk = mcpStatus.fileExists && mcpStatus.entryPresent;
537
+ results.push({
538
+ name: 'MCP config written',
539
+ passed: mcpOk,
540
+ detail: mcpOk
541
+ ? `CompBox MCP entry present at ${mcpStatus.configPath} (server auto-installs via npx on first use).`
542
+ : mcpStatus.fileExists
543
+ ? `Config at ${mcpStatus.configPath} has no CompBox entry — run \`compbox configure\` to write it.`
544
+ : `No MCP config at ${mcpStatus.configPath} — run \`compbox configure\` to write it.`,
545
+ });
546
+ // Check 6.5: Central target — WARN-level guardrail (see centralTargetCheck).
547
+ results.push(centralTargetCheck(mcpStatus, config.apiBaseUrl));
548
+ // Check 6.7: MCP launch target — the written entry must actually be
549
+ // launchable: exists on disk / answers a startup probe (see
550
+ // launchTargetCheck). Hard 5s timeout, so doctor can never hang here.
551
+ results.push(await launchTargetCheck(mcpStatus));
552
+ // Check 7: AI credential for the selected mode.
553
+ if (config.aiMode === 'api-key') {
554
+ const { value, backend } = await retrieveSecret(AI_KEY_ACCOUNT);
555
+ const present = value !== null && value.length > 0;
556
+ results.push({
557
+ name: 'AI mode configured',
558
+ passed: present,
559
+ detail: present
560
+ ? `API key found in ${backend === 'keychain' ? 'OS keychain' : 'local file store'}.`
561
+ : 'No API key found — run `compbox configure`.',
562
+ });
563
+ }
564
+ else if (config.aiMode === 'claude-subscription') {
565
+ results.push({
566
+ name: 'AI mode configured',
567
+ passed: config.agentModeAcknowledged === true,
568
+ detail: config.agentModeAcknowledged === true
569
+ ? 'Claude Code CLI subscription — no API key required; entitlement acknowledged.'
570
+ : 'Claude Code CLI subscription selected but not acknowledged — run `compbox configure`.',
571
+ });
572
+ }
573
+ else {
574
+ results.push({
575
+ name: 'AI mode configured',
576
+ passed: false,
577
+ detail: 'AI mode not selected — run `compbox configure`.',
578
+ });
579
+ }
580
+ // Check 7.5: Agent runtime (claude CLI) — only relevant in
581
+ // claude-subscription mode; SKIP in api-key mode so it never affects the
582
+ // exit code (see agentRuntimeCheck).
583
+ results.push(await agentRuntimeCheck(config));
584
+ // Check 8: macOS only — the Homebrew-managed service is running.
585
+ if (process.platform === 'darwin') {
586
+ results.push(checkBrewService());
587
+ }
588
+ // Check 9: pxpipe token proxy (ENG-138) — informational when disabled.
589
+ results.push(await checkPxpipe());
590
+ results.forEach(printResult);
591
+ const failedCount = countFailures(results);
592
+ if (failedCount === 0) {
593
+ const warnCount = results.filter((r) => r.warning === true).length;
594
+ if (warnCount > 0) {
595
+ console.log(chalk.yellow(`\n✔ Passed with ${String(warnCount)} warning(s) — see above.`));
596
+ }
597
+ else {
598
+ console.log(chalk.green('\n✔ All checks passed. You are ready to go.'));
599
+ }
600
+ }
601
+ else {
602
+ console.log(chalk.red(`\n✖ ${String(failedCount)} check(s) failed. See the tips above.`));
603
+ process.exit(1);
604
+ }
605
+ });
606
+ //# sourceMappingURL=doctor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doctor.js","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAC/E,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,qBAAqB,GACtB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,cAAc,EACd,cAAc,EACd,qBAAqB,GACtB,MAAM,sBAAsB,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,CAAC,CAAC;IAC3C,IAAI,WAAW,KAAK,CAAC,EAAE,CAAC;QACtB,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,IAAI,CAAC,CAAC,MAAM,CAAC;QACnE,IAAI,SAAS,GAAG,CAAC,EAAE,CAAC;YAClB,OAAO,CAAC,GAAG,CACT,KAAK,CAAC,MAAM,CAAC,mBAAmB,MAAM,CAAC,SAAS,CAAC,0BAA0B,CAAC,CAC7E,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,6CAA6C,CAAC,CAAC,CAAC;QAC1E,CAAC;IACH,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CACT,KAAK,CAAC,GAAG,CAAC,OAAO,MAAM,CAAC,WAAW,CAAC,uCAAuC,CAAC,CAC7E,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare const installCommand: Command;
3
+ //# sourceMappingURL=install.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../src/commands/install.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAapC,eAAO,MAAM,cAAc,SAgGvB,CAAC"}