@namzu/cli 0.0.2

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 (58) hide show
  1. package/README.md +79 -0
  2. package/dist/bin.d.ts +3 -0
  3. package/dist/bin.d.ts.map +1 -0
  4. package/dist/bin.js +38 -0
  5. package/dist/bin.js.map +1 -0
  6. package/dist/commands/doctor.d.ts +2 -0
  7. package/dist/commands/doctor.d.ts.map +1 -0
  8. package/dist/commands/doctor.js +201 -0
  9. package/dist/commands/doctor.js.map +1 -0
  10. package/dist/commands/doctor.test.d.ts +2 -0
  11. package/dist/commands/doctor.test.d.ts.map +1 -0
  12. package/dist/commands/doctor.test.js +82 -0
  13. package/dist/commands/doctor.test.js.map +1 -0
  14. package/dist/doctor/checks/index.d.ts +9 -0
  15. package/dist/doctor/checks/index.d.ts.map +1 -0
  16. package/dist/doctor/checks/index.js +15 -0
  17. package/dist/doctor/checks/index.js.map +1 -0
  18. package/dist/doctor/checks/providers.d.ts +19 -0
  19. package/dist/doctor/checks/providers.d.ts.map +1 -0
  20. package/dist/doctor/checks/providers.js +25 -0
  21. package/dist/doctor/checks/providers.js.map +1 -0
  22. package/dist/doctor/checks/runtime.d.ts +4 -0
  23. package/dist/doctor/checks/runtime.d.ts.map +1 -0
  24. package/dist/doctor/checks/runtime.js +40 -0
  25. package/dist/doctor/checks/runtime.js.map +1 -0
  26. package/dist/doctor/checks/sandbox.d.ts +3 -0
  27. package/dist/doctor/checks/sandbox.d.ts.map +1 -0
  28. package/dist/doctor/checks/sandbox.js +42 -0
  29. package/dist/doctor/checks/sandbox.js.map +1 -0
  30. package/dist/doctor/checks/telemetry.d.ts +12 -0
  31. package/dist/doctor/checks/telemetry.d.ts.map +1 -0
  32. package/dist/doctor/checks/telemetry.js +27 -0
  33. package/dist/doctor/checks/telemetry.js.map +1 -0
  34. package/dist/doctor/checks/vault.d.ts +13 -0
  35. package/dist/doctor/checks/vault.d.ts.map +1 -0
  36. package/dist/doctor/checks/vault.js +19 -0
  37. package/dist/doctor/checks/vault.js.map +1 -0
  38. package/dist/doctor/index.d.ts +4 -0
  39. package/dist/doctor/index.d.ts.map +1 -0
  40. package/dist/doctor/index.js +3 -0
  41. package/dist/doctor/index.js.map +1 -0
  42. package/dist/doctor/registry.d.ts +55 -0
  43. package/dist/doctor/registry.d.ts.map +1 -0
  44. package/dist/doctor/registry.js +197 -0
  45. package/dist/doctor/registry.js.map +1 -0
  46. package/dist/doctor/registry.test.d.ts +7 -0
  47. package/dist/doctor/registry.test.d.ts.map +1 -0
  48. package/dist/doctor/registry.test.js +376 -0
  49. package/dist/doctor/registry.test.js.map +1 -0
  50. package/dist/exit-codes.d.ts +16 -0
  51. package/dist/exit-codes.d.ts.map +1 -0
  52. package/dist/exit-codes.js +15 -0
  53. package/dist/exit-codes.js.map +1 -0
  54. package/dist/index.d.ts +10 -0
  55. package/dist/index.d.ts.map +1 -0
  56. package/dist/index.js +9 -0
  57. package/dist/index.js.map +1 -0
  58. package/package.json +58 -0
package/README.md ADDED
@@ -0,0 +1,79 @@
1
+ # @namzu/cli
2
+
3
+ Operator CLI for the [Namzu](https://namzu.ai) agent platform.
4
+
5
+ Dual-purpose:
6
+ - **Standalone bin** — `npx @namzu/cli doctor` (or after install: `namzu doctor`).
7
+ - **Library** — `import { runDoctor, registerDoctorCheck } from '@namzu/cli'` for embedded usage where consumer code wants to invoke the doctor in its own process so app-registered checks are visible.
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ pnpm add -D @namzu/cli
13
+ # or, for one-off invocations:
14
+ pnpm dlx @namzu/cli doctor
15
+ ```
16
+
17
+ ## Commands
18
+
19
+ ### `namzu doctor`
20
+
21
+ Run health checks against the local Namzu environment.
22
+
23
+ ```
24
+ namzu doctor # human-readable, all categories
25
+ namzu doctor --json # machine-readable JSON
26
+ namzu doctor --category sandbox,runtime # filter by category
27
+ namzu doctor --per-check-timeout 8000 # raise per-check timeout
28
+ namzu doctor --verbose # include failure detail
29
+ ```
30
+
31
+ **Exit codes** (sysexits-aligned):
32
+
33
+ | Code | Name | Meaning |
34
+ | ---: | --------------------- | ------------------------------------------- |
35
+ | `0` | `EXIT_OK` | All checks passed (or no failure produced). |
36
+ | `1` | `EXIT_FAIL` | One or more checks reported `fail`. |
37
+ | `2` | `EXIT_NO_CONFIG` | No checks registered (Namzu not set up). |
38
+ | `70` | `EXIT_INTERNAL_ERROR` | sysexits `EX_SOFTWARE`; CLI bug. |
39
+
40
+ **Built-in checks** ship intentionally conservative; consumers register their own via `registerDoctorCheck()`:
41
+
42
+ - `sandbox.platform` — darwin sandbox-exec presence; warn on win32; inconclusive on linux.
43
+ - `runtime.cwd-writable`, `runtime.tmpdir-writable` — `fs.access(W_OK)` probes.
44
+ - `telemetry.installed` — pass if `@namzu/telemetry` is dynamically importable.
45
+ - `vault.registered`, `providers.registered` — inconclusive with "register your own" guidance.
46
+
47
+ ## Library API
48
+
49
+ ```ts
50
+ import { runDoctor, registerDoctorCheck, builtInDoctorChecks } from '@namzu/cli'
51
+ import { ProviderRegistry } from '@namzu/sdk'
52
+
53
+ // Register a custom check that walks YOUR provider registry
54
+ registerDoctorCheck({
55
+ id: 'app.providers.reachable',
56
+ category: 'providers',
57
+ run: async () => {
58
+ const providers = ProviderRegistry.getAll()
59
+ const results = await Promise.all(
60
+ providers.map((p) => p.doctorCheck?.() ?? { status: 'inconclusive' as const }),
61
+ )
62
+ const failed = results.filter((r) => r.status === 'fail')
63
+ return failed.length > 0
64
+ ? { status: 'fail', message: `${failed.length} provider(s) failed reachability` }
65
+ : { status: 'pass', message: `${providers.length} provider(s) reachable` }
66
+ },
67
+ })
68
+
69
+ const report = await runDoctor()
70
+ process.exit(report.exit)
71
+ ```
72
+
73
+ ## Architecture
74
+
75
+ The doctor's protocol types (`DoctorCheck`, `DoctorCheckResult`, `DoctorReport`, `DoctorStatus`) live in `@namzu/sdk` so kernel components (providers, vaults, sandboxes) can implement `doctorCheck?()` hooks against them. The runtime (registry, runner, output formatting, exit codes) lives here in `@namzu/cli` because it's operator-facing concerns. This is the [`ses_007-probe-and-doctor`](https://github.com/cogitave/namzu/tree/main/docs.local/sessions/ses_007-probe-and-doctor) split.
76
+
77
+ ## License
78
+
79
+ MIT
package/dist/bin.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=bin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":""}
package/dist/bin.js ADDED
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env node
2
+ import { runDoctorCommand } from './commands/doctor.js';
3
+ const HELP = `namzu — operator CLI for the Namzu agent platform
4
+
5
+ Usage:
6
+ namzu <command> [options]
7
+
8
+ Commands:
9
+ doctor Run health checks against the local environment
10
+ help Show this help
11
+
12
+ Examples:
13
+ namzu doctor
14
+ namzu doctor --json
15
+ namzu doctor --category sandbox,runtime
16
+ namzu doctor --per-check-timeout 8000
17
+ `;
18
+ async function main() {
19
+ const [, , command, ...rest] = process.argv;
20
+ if (!command || command === 'help' || command === '--help' || command === '-h') {
21
+ process.stdout.write(`${HELP}\n`);
22
+ return 0;
23
+ }
24
+ switch (command) {
25
+ case 'doctor':
26
+ return runDoctorCommand(rest);
27
+ default:
28
+ process.stderr.write(`Unknown command: ${command}\n\n${HELP}\n`);
29
+ return 64; // EX_USAGE per sysexits
30
+ }
31
+ }
32
+ main().then((code) => {
33
+ process.exit(code);
34
+ }, (err) => {
35
+ process.stderr.write(`Fatal: ${err instanceof Error ? (err.stack ?? err.message) : String(err)}\n`);
36
+ process.exit(70); // EX_SOFTWARE per sysexits
37
+ });
38
+ //# sourceMappingURL=bin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAEvD,MAAM,IAAI,GAAG;;;;;;;;;;;;;;CAcZ,CAAA;AAED,KAAK,UAAU,IAAI;IAClB,MAAM,CAAC,EAAE,AAAD,EAAG,OAAO,EAAE,GAAG,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAA;IAE3C,IAAI,CAAC,OAAO,IAAI,OAAO,KAAK,MAAM,IAAI,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QAChF,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,IAAI,CAAC,CAAA;QACjC,OAAO,CAAC,CAAA;IACT,CAAC;IAED,QAAQ,OAAO,EAAE,CAAC;QACjB,KAAK,QAAQ;YACZ,OAAO,gBAAgB,CAAC,IAAI,CAAC,CAAA;QAC9B;YACC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,oBAAoB,OAAO,OAAO,IAAI,IAAI,CAAC,CAAA;YAChE,OAAO,EAAE,CAAA,CAAC,wBAAwB;IACpC,CAAC;AACF,CAAC;AAED,IAAI,EAAE,CAAC,IAAI,CACV,CAAC,IAAI,EAAE,EAAE;IACR,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACnB,CAAC,EACD,CAAC,GAAG,EAAE,EAAE;IACP,OAAO,CAAC,MAAM,CAAC,KAAK,CACnB,UAAU,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAC7E,CAAA;IACD,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA,CAAC,2BAA2B;AAC7C,CAAC,CACD,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare function runDoctorCommand(args: readonly string[]): Promise<number>;
2
+ //# sourceMappingURL=doctor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAkMA,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CA8B/E"}
@@ -0,0 +1,201 @@
1
+ import { builtInDoctorChecks } from '../doctor/checks/index.js';
2
+ import { createDoctorRegistry, runDoctor } from '../doctor/registry.js';
3
+ import { EXIT_INTERNAL_ERROR } from '../exit-codes.js';
4
+ const VALID_CATEGORIES = [
5
+ 'sandbox',
6
+ 'providers',
7
+ 'vault',
8
+ 'telemetry',
9
+ 'runtime',
10
+ 'plugins',
11
+ 'custom',
12
+ ];
13
+ const HELP = `namzu doctor — health checks for the local Namzu environment
14
+
15
+ Usage:
16
+ namzu doctor [options]
17
+
18
+ Options:
19
+ --json Emit a machine-readable JSON report
20
+ --verbose Include stack traces on failures
21
+ --category <a,b,c> Comma-separated category filter
22
+ (sandbox, providers, vault, telemetry,
23
+ runtime, plugins, custom)
24
+ --per-check-timeout <ms> Per-check timeout (default 5000)
25
+ --wall-clock-timeout <ms> Total wall-clock timeout (default 10000)
26
+ -h, --help Show this help
27
+
28
+ Exit codes:
29
+ 0 all checks passed (or no failure produced)
30
+ 1 one or more checks reported \`fail\`
31
+ 2 no checks registered (Namzu not configured here)
32
+ 70 internal CLI error (sysexits EX_SOFTWARE)
33
+ `;
34
+ function parseArgs(args) {
35
+ let json = false;
36
+ let verbose = false;
37
+ let help = false;
38
+ let categories;
39
+ let perCheckTimeoutMs;
40
+ let wallClockTimeoutMs;
41
+ for (let i = 0; i < args.length; i++) {
42
+ const arg = args[i];
43
+ switch (arg) {
44
+ case '--json':
45
+ json = true;
46
+ break;
47
+ case '--verbose':
48
+ verbose = true;
49
+ break;
50
+ case '-h':
51
+ case '--help':
52
+ help = true;
53
+ break;
54
+ case '--category': {
55
+ const value = args[++i];
56
+ if (!value)
57
+ return { json, verbose, help, error: '--category requires a value' };
58
+ const parts = value
59
+ .split(',')
60
+ .map((p) => p.trim())
61
+ .filter(Boolean);
62
+ const invalid = parts.filter((p) => !VALID_CATEGORIES.includes(p));
63
+ if (invalid.length > 0) {
64
+ return {
65
+ json,
66
+ verbose,
67
+ help,
68
+ error: `unknown category: ${invalid.join(', ')} (valid: ${VALID_CATEGORIES.join(', ')})`,
69
+ };
70
+ }
71
+ categories = parts;
72
+ break;
73
+ }
74
+ case '--per-check-timeout': {
75
+ const value = args[++i];
76
+ if (!value)
77
+ return {
78
+ json,
79
+ verbose,
80
+ help,
81
+ error: '--per-check-timeout requires a value',
82
+ };
83
+ const n = Number.parseInt(value, 10);
84
+ if (!Number.isFinite(n) || n <= 0) {
85
+ return {
86
+ json,
87
+ verbose,
88
+ help,
89
+ error: `--per-check-timeout must be a positive integer; got ${value}`,
90
+ };
91
+ }
92
+ perCheckTimeoutMs = n;
93
+ break;
94
+ }
95
+ case '--wall-clock-timeout': {
96
+ const value = args[++i];
97
+ if (!value)
98
+ return {
99
+ json,
100
+ verbose,
101
+ help,
102
+ error: '--wall-clock-timeout requires a value',
103
+ };
104
+ const n = Number.parseInt(value, 10);
105
+ if (!Number.isFinite(n) || n <= 0) {
106
+ return {
107
+ json,
108
+ verbose,
109
+ help,
110
+ error: `--wall-clock-timeout must be a positive integer; got ${value}`,
111
+ };
112
+ }
113
+ wallClockTimeoutMs = n;
114
+ break;
115
+ }
116
+ default:
117
+ return { json, verbose, help, error: `unknown option: ${arg}` };
118
+ }
119
+ }
120
+ return {
121
+ json,
122
+ verbose,
123
+ help,
124
+ categories,
125
+ perCheckTimeoutMs,
126
+ wallClockTimeoutMs,
127
+ };
128
+ }
129
+ function statusGlyph(status) {
130
+ switch (status) {
131
+ case 'pass':
132
+ return '✓';
133
+ case 'fail':
134
+ return '✗';
135
+ case 'inconclusive':
136
+ return '⊘';
137
+ case 'warn':
138
+ return '!';
139
+ }
140
+ }
141
+ function formatHumanReport(report, verbose) {
142
+ const lines = [];
143
+ lines.push(`namzu doctor — ${report.timestamp}`);
144
+ lines.push('');
145
+ const widestCategory = report.checks.reduce((w, c) => Math.max(w, c.category.length), 'category'.length);
146
+ for (const record of report.checks) {
147
+ const glyph = statusGlyph(record.status);
148
+ const category = record.category.padEnd(widestCategory);
149
+ const dur = `${record.durationMs}ms`;
150
+ const head = ` ${glyph} ${category} ${record.id} ${dur}`;
151
+ lines.push(head);
152
+ if (record.message)
153
+ lines.push(` ${record.message}`);
154
+ if (record.remediation)
155
+ lines.push(` → ${record.remediation}`);
156
+ }
157
+ lines.push('');
158
+ const s = report.summary;
159
+ lines.push(` pass: ${s.pass} fail: ${s.fail} warn: ${s.warn} inconc: ${s.inconclusive} total: ${s.total}`);
160
+ lines.push(` exit: ${report.exit}`);
161
+ if (verbose) {
162
+ const failed = report.checks.filter((c) => c.status === 'fail');
163
+ if (failed.length > 0) {
164
+ lines.push('');
165
+ lines.push('Failures:');
166
+ for (const f of failed) {
167
+ lines.push(` ${f.id}: ${f.message ?? '(no message)'}`);
168
+ }
169
+ }
170
+ }
171
+ return lines.join('\n');
172
+ }
173
+ export async function runDoctorCommand(args) {
174
+ const parsed = parseArgs(args);
175
+ if (parsed.error) {
176
+ process.stderr.write(`Error: ${parsed.error}\n\n${HELP}\n`);
177
+ return EXIT_INTERNAL_ERROR;
178
+ }
179
+ if (parsed.help) {
180
+ process.stdout.write(`${HELP}\n`);
181
+ return 0;
182
+ }
183
+ const registry = createDoctorRegistry();
184
+ for (const check of builtInDoctorChecks)
185
+ registry.register(check);
186
+ const opts = {
187
+ registry,
188
+ categories: parsed.categories,
189
+ perCheckTimeoutMs: parsed.perCheckTimeoutMs,
190
+ wallClockTimeoutMs: parsed.wallClockTimeoutMs,
191
+ };
192
+ const report = await runDoctor(opts);
193
+ if (parsed.json) {
194
+ process.stdout.write(`${JSON.stringify(report, null, 2)}\n`);
195
+ }
196
+ else {
197
+ process.stdout.write(`${formatHumanReport(report, parsed.verbose)}\n`);
198
+ }
199
+ return report.exit;
200
+ }
201
+ //# sourceMappingURL=doctor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doctor.js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AAS,CAAC,IAAI,CAAC,CAAA;IAEpC,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;QACjB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAA;IAC7D,CAAC;SAAM,CAAC;QACP,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IACvE,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,CAAA;AACnB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=doctor.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doctor.test.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,82 @@
1
+ import { afterEach, beforeEach, describe, expect, it } from 'vitest';
2
+ import { runDoctorCommand } from './doctor.js';
3
+ describe('runDoctorCommand', () => {
4
+ let captured;
5
+ let originalStdoutWrite;
6
+ let originalStderrWrite;
7
+ beforeEach(() => {
8
+ captured = '';
9
+ originalStdoutWrite = process.stdout.write.bind(process.stdout);
10
+ originalStderrWrite = process.stderr.write.bind(process.stderr);
11
+ process.stdout.write = ((chunk) => {
12
+ captured += typeof chunk === 'string' ? chunk : Buffer.from(chunk).toString('utf8');
13
+ return true;
14
+ });
15
+ process.stderr.write = ((chunk) => {
16
+ captured += typeof chunk === 'string' ? chunk : Buffer.from(chunk).toString('utf8');
17
+ return true;
18
+ });
19
+ });
20
+ afterEach(() => {
21
+ process.stdout.write = originalStdoutWrite;
22
+ process.stderr.write = originalStderrWrite;
23
+ });
24
+ it('--help returns 0 and prints usage', async () => {
25
+ const code = await runDoctorCommand(['--help']);
26
+ expect(code).toBe(0);
27
+ expect(captured).toContain('namzu doctor');
28
+ expect(captured).toContain('--json');
29
+ expect(captured).toContain('--category');
30
+ });
31
+ it('rejects unknown options with EXIT_INTERNAL_ERROR (70)', async () => {
32
+ const code = await runDoctorCommand(['--frobnicate']);
33
+ expect(code).toBe(70);
34
+ expect(captured).toContain('unknown option: --frobnicate');
35
+ });
36
+ it('--category accepts a valid comma-separated list', async () => {
37
+ const code = await runDoctorCommand(['--category', 'sandbox,runtime', '--json']);
38
+ expect([0, 1]).toContain(code);
39
+ const json = JSON.parse(captured);
40
+ expect(json.checks.every((c) => ['sandbox', 'runtime'].includes(c.category))).toBe(true);
41
+ });
42
+ it('--category rejects an invalid name', async () => {
43
+ const code = await runDoctorCommand(['--category', 'sandbox,wat']);
44
+ expect(code).toBe(70);
45
+ expect(captured).toContain('unknown category: wat');
46
+ });
47
+ it('--per-check-timeout requires a positive integer', async () => {
48
+ const code = await runDoctorCommand(['--per-check-timeout', '-5']);
49
+ expect(code).toBe(70);
50
+ expect(captured).toContain('--per-check-timeout must be a positive integer');
51
+ });
52
+ it('--json emits valid JSON conforming to DoctorReport', async () => {
53
+ const code = await runDoctorCommand(['--json']);
54
+ expect([0, 1]).toContain(code);
55
+ const json = JSON.parse(captured);
56
+ expect(json).toHaveProperty('version');
57
+ expect(json).toHaveProperty('timestamp');
58
+ expect(Array.isArray(json.checks)).toBe(true);
59
+ expect(json).toHaveProperty('summary.total');
60
+ expect(json).toHaveProperty('exit');
61
+ });
62
+ it('default human output includes the summary line', async () => {
63
+ const code = await runDoctorCommand([]);
64
+ expect([0, 1]).toContain(code);
65
+ expect(captured).toContain('namzu doctor —');
66
+ expect(captured).toMatch(/pass: \d+ {2}fail: \d+/);
67
+ expect(captured).toMatch(/exit: \d+/);
68
+ });
69
+ it('built-in checks register with stable ids', async () => {
70
+ const code = await runDoctorCommand(['--json']);
71
+ expect([0, 1]).toContain(code);
72
+ const json = JSON.parse(captured);
73
+ const ids = json.checks.map((c) => c.id).sort();
74
+ expect(ids).toContain('sandbox.platform');
75
+ expect(ids).toContain('runtime.cwd-writable');
76
+ expect(ids).toContain('runtime.tmpdir-writable');
77
+ expect(ids).toContain('telemetry.installed');
78
+ expect(ids).toContain('vault.registered');
79
+ expect(ids).toContain('providers.registered');
80
+ });
81
+ });
82
+ //# sourceMappingURL=doctor.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doctor.test.js","sourceRoot":"","sources":["../../src/commands/doctor.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAEpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAE9C,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IACjC,IAAI,QAAgB,CAAA;IACpB,IAAI,mBAAgD,CAAA;IACpD,IAAI,mBAAgD,CAAA;IAEpD,UAAU,CAAC,GAAG,EAAE;QACf,QAAQ,GAAG,EAAE,CAAA;QACb,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QAC/D,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QAC/D,OAAO,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,KAA0B,EAAW,EAAE;YAC/D,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;YACnF,OAAO,IAAI,CAAA;QACZ,CAAC,CAAgC,CAAA;QACjC,OAAO,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,KAA0B,EAAW,EAAE;YAC/D,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CA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AE,CAAA;QAC/D,MAAM,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAA;QACzC,MAAM,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,sBAAsB,CAAC,CAAA;QAC7C,MAAM,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,yBAAyB,CAAC,CAAA;QAChD,MAAM,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,qBAAqB,CAAC,CAAA;QAC5C,MAAM,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAA;QACzC,MAAM,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,sBAAsB,CAAC,CAAA;IAC9C,CAAC,CAAC,CAAA;AACH,CAAC,CAAC,CAAA"}
@@ -0,0 +1,9 @@
1
+ import type { DoctorCheck } from '@namzu/sdk';
2
+ import { providersRegisteredCheck } from './providers.js';
3
+ import { cwdWritableCheck, tmpdirWritableCheck } from './runtime.js';
4
+ import { sandboxPlatformCheck } from './sandbox.js';
5
+ import { telemetryInstalledCheck } from './telemetry.js';
6
+ import { vaultRegisteredCheck } from './vault.js';
7
+ export { providersRegisteredCheck, cwdWritableCheck, tmpdirWritableCheck, sandboxPlatformCheck, telemetryInstalledCheck, vaultRegisteredCheck, };
8
+ export declare const builtInDoctorChecks: readonly DoctorCheck[];
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/doctor/checks/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAE7C,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAA;AACzD,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAA;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAEjD,OAAO,EACN,wBAAwB,EACxB,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EACpB,uBAAuB,EACvB,oBAAoB,GACpB,CAAA;AAED,eAAO,MAAM,mBAAmB,EAAE,SAAS,WAAW,EAOrD,CAAA"}
@@ -0,0 +1,15 @@
1
+ import { providersRegisteredCheck } from './providers.js';
2
+ import { cwdWritableCheck, tmpdirWritableCheck } from './runtime.js';
3
+ import { sandboxPlatformCheck } from './sandbox.js';
4
+ import { telemetryInstalledCheck } from './telemetry.js';
5
+ import { vaultRegisteredCheck } from './vault.js';
6
+ export { providersRegisteredCheck, cwdWritableCheck, tmpdirWritableCheck, sandboxPlatformCheck, telemetryInstalledCheck, vaultRegisteredCheck, };
7
+ export const builtInDoctorChecks = [
8
+ sandboxPlatformCheck,
9
+ cwdWritableCheck,
10
+ tmpdirWritableCheck,
11
+ providersRegisteredCheck,
12
+ vaultRegisteredCheck,
13
+ telemetryInstalledCheck,
14
+ ];
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/doctor/checks/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAA;AACzD,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAA;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAEjD,OAAO,EACN,wBAAwB,EACxB,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EACpB,uBAAuB,EACvB,oBAAoB,GACpB,CAAA;AAED,MAAM,CAAC,MAAM,mBAAmB,GAA2B;IAC1D,oBAAoB;IACpB,gBAAgB;IAChB,mBAAmB;IACnB,wBAAwB;IACxB,oBAAoB;IACpB,uBAAuB;CACvB,CAAA"}
@@ -0,0 +1,19 @@
1
+ import type { DoctorCheck } from '@namzu/sdk';
2
+ /**
3
+ * Built-in provider probe is intentionally inconclusive in v1.
4
+ *
5
+ * Provider auto-discovery requires walking `ProviderRegistry`, which is
6
+ * a module-private map populated by side-effecting calls in consumer
7
+ * code. Standalone `runDoctor()` invoked from a different process won't
8
+ * see those registrations. Two consumer paths:
9
+ *
10
+ * 1. Consumers running doctor in their own process via `runDoctor()`
11
+ * can register a custom provider check that iterates their
12
+ * `ProviderRegistry.getAll()` and calls `provider.doctorCheck?.()`
13
+ * on each.
14
+ * 2. The standalone `namzu doctor` CLI command (Phase 5) inherits
15
+ * this same behavior — it can only check providers that are visible
16
+ * to its process. Plugin-registered providers ARE visible.
17
+ */
18
+ export declare const providersRegisteredCheck: DoctorCheck;
19
+ //# sourceMappingURL=providers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../../../src/doctor/checks/providers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAqB,MAAM,YAAY,CAAA;AAEhE;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,wBAAwB,EAAE,WAQtC,CAAA"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Built-in provider probe is intentionally inconclusive in v1.
3
+ *
4
+ * Provider auto-discovery requires walking `ProviderRegistry`, which is
5
+ * a module-private map populated by side-effecting calls in consumer
6
+ * code. Standalone `runDoctor()` invoked from a different process won't
7
+ * see those registrations. Two consumer paths:
8
+ *
9
+ * 1. Consumers running doctor in their own process via `runDoctor()`
10
+ * can register a custom provider check that iterates their
11
+ * `ProviderRegistry.getAll()` and calls `provider.doctorCheck?.()`
12
+ * on each.
13
+ * 2. The standalone `namzu doctor` CLI command (Phase 5) inherits
14
+ * this same behavior — it can only check providers that are visible
15
+ * to its process. Plugin-registered providers ARE visible.
16
+ */
17
+ export const providersRegisteredCheck = {
18
+ id: 'providers.registered',
19
+ category: 'providers',
20
+ run: async () => ({
21
+ status: 'inconclusive',
22
+ message: 'no provider auto-discovery in v1; register a provider check via registerDoctorCheck for your specific provider configuration (call provider.doctorCheck?() per registered provider)',
23
+ }),
24
+ };
25
+ //# sourceMappingURL=providers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"providers.js","sourceRoot":"","sources":["../../../src/doctor/checks/providers.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAgB;IACpD,EAAE,EAAE,sBAAsB;IAC1B,QAAQ,EAAE,WAAW;IACrB,GAAG,EAAE,KAAK,IAAgC,EAAE,CAAC,CAAC;QAC7C,MAAM,EAAE,cAAc;QACtB,OAAO,EACN,qLAAqL;KACtL,CAAC;CACF,CAAA"}
@@ -0,0 +1,4 @@
1
+ import type { DoctorCheck } from '@namzu/sdk';
2
+ export declare const cwdWritableCheck: DoctorCheck;
3
+ export declare const tmpdirWritableCheck: DoctorCheck;
4
+ //# sourceMappingURL=runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../src/doctor/checks/runtime.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAyC,MAAM,YAAY,CAAA;AAEpF,eAAO,MAAM,gBAAgB,EAAE,WAgB9B,CAAA;AAED,eAAO,MAAM,mBAAmB,EAAE,WAiBjC,CAAA"}
@@ -0,0 +1,40 @@
1
+ import { constants, access } from 'node:fs/promises';
2
+ import { tmpdir } from 'node:os';
3
+ export const cwdWritableCheck = {
4
+ id: 'runtime.cwd-writable',
5
+ category: 'runtime',
6
+ run: async (ctx) => {
7
+ try {
8
+ await access(ctx.cwd, constants.W_OK);
9
+ return { status: 'pass', message: `cwd writable: ${ctx.cwd}` };
10
+ }
11
+ catch (error) {
12
+ const message = error instanceof Error ? error.message : String(error);
13
+ return {
14
+ status: 'fail',
15
+ message: `cwd not writable: ${ctx.cwd} (${message})`,
16
+ remediation: 'Run from a directory you have write access to, or pass an explicit cwd.',
17
+ };
18
+ }
19
+ },
20
+ };
21
+ export const tmpdirWritableCheck = {
22
+ id: 'runtime.tmpdir-writable',
23
+ category: 'runtime',
24
+ run: async () => {
25
+ const dir = tmpdir();
26
+ try {
27
+ await access(dir, constants.W_OK);
28
+ return { status: 'pass', message: `tmpdir writable: ${dir}` };
29
+ }
30
+ catch (error) {
31
+ const message = error instanceof Error ? error.message : String(error);
32
+ return {
33
+ status: 'fail',
34
+ message: `tmpdir not writable: ${dir} (${message})`,
35
+ remediation: 'Set TMPDIR / TMP / TEMP to a writable location.',
36
+ };
37
+ }
38
+ },
39
+ };
40
+ //# sourceMappingURL=runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../../src/doctor/checks/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAIhC,MAAM,CAAC,MAAM,gBAAgB,GAAgB;IAC5C,EAAE,EAAE,sBAAsB;IAC1B,QAAQ,EAAE,SAAS;IACnB,GAAG,EAAE,KAAK,EAAE,GAAuB,EAA8B,EAAE;QAClE,IAAI,CAAC;YACJ,MAAM,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,SAAS,CAAC,IAAI,CAAC,CAAA;YACrC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,GAAG,CAAC,GAAG,EAAE,EAAE,CAAA;QAC/D,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;YACtE,OAAO;gBACN,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE,qBAAqB,GAAG,CAAC,GAAG,KAAK,OAAO,GAAG;gBACpD,WAAW,EAAE,yEAAyE;aACtF,CAAA;QACF,CAAC;IACF,CAAC;CACD,CAAA;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAgB;IAC/C,EAAE,EAAE,yBAAyB;IAC7B,QAAQ,EAAE,SAAS;IACnB,GAAG,EAAE,KAAK,IAAgC,EAAE;QAC3C,MAAM,GAAG,GAAG,MAAM,EAAE,CAAA;QACpB,IAAI,CAAC;YACJ,MAAM,MAAM,CAAC,GAAG,EAAE,SAAS,CAAC,IAAI,CAAC,CAAA;YACjC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,oBAAoB,GAAG,EAAE,EAAE,CAAA;QAC9D,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;YACtE,OAAO;gBACN,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE,wBAAwB,GAAG,KAAK,OAAO,GAAG;gBACnD,WAAW,EAAE,iDAAiD;aAC9D,CAAA;QACF,CAAC;IACF,CAAC;CACD,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { DoctorCheck } from '@namzu/sdk';
2
+ export declare const sandboxPlatformCheck: DoctorCheck;
3
+ //# sourceMappingURL=sandbox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sandbox.d.ts","sourceRoot":"","sources":["../../../src/doctor/checks/sandbox.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAqB,MAAM,YAAY,CAAA;AAIhE,eAAO,MAAM,oBAAoB,EAAE,WAsClC,CAAA"}
@@ -0,0 +1,42 @@
1
+ import { constants, access } from 'node:fs/promises';
2
+ const DARWIN_SANDBOX_EXEC = '/usr/bin/sandbox-exec';
3
+ export const sandboxPlatformCheck = {
4
+ id: 'sandbox.platform',
5
+ category: 'sandbox',
6
+ run: async () => {
7
+ const platform = process.platform;
8
+ switch (platform) {
9
+ case 'darwin':
10
+ try {
11
+ await access(DARWIN_SANDBOX_EXEC, constants.X_OK);
12
+ return {
13
+ status: 'pass',
14
+ message: `darwin / ${DARWIN_SANDBOX_EXEC} present and executable`,
15
+ };
16
+ }
17
+ catch {
18
+ return {
19
+ status: 'fail',
20
+ message: `darwin / ${DARWIN_SANDBOX_EXEC} not executable`,
21
+ remediation: 'macOS sandboxing requires sandbox-exec; check system integrity.',
22
+ };
23
+ }
24
+ case 'linux':
25
+ return {
26
+ status: 'inconclusive',
27
+ message: 'linux sandbox capability probe (unshare + namespaces) not implemented in v1; register a custom check via registerDoctorCheck if you need it',
28
+ };
29
+ case 'win32':
30
+ return {
31
+ status: 'warn',
32
+ message: 'windows sandbox is not supported by @namzu/sdk today',
33
+ };
34
+ default:
35
+ return {
36
+ status: 'inconclusive',
37
+ message: `unrecognized platform "${platform}"`,
38
+ };
39
+ }
40
+ },
41
+ };
42
+ //# sourceMappingURL=sandbox.js.map