(env: Record<string, string | undefined>)
| 11 | const CODE_ROOT = join(import.meta.dir, '../..') |
| 12 | |
| 13 | function probeReport(env: Record<string, string | undefined>): ToolInventoryReport { |
| 14 | const script = [ |
| 15 | 'process.env.NCODE_BUILD_MODE = "noumena";', |
| 16 | 'process.env.CLAUDE_CODE_ENTRYPOINT = "cli";', |
| 17 | 'delete process.env.NODE_ENV;', |
| 18 | 'delete process.env.EMBEDDED_SEARCH_TOOLS;', |
| 19 | 'delete process.env.NCODE_REPL;', |
| 20 | 'delete process.env.CLAUDE_CODE_REPL;', |
| 21 | 'delete process.env.CLAUDE_REPL_MODE;', |
| 22 | 'delete process.env.NCODE_JS_REPL;', |
| 23 | 'delete process.env.CLAUDE_CODE_JS_REPL;', |
| 24 | 'delete process.env.NCODE_PY_REPL;', |
| 25 | 'delete process.env.CLAUDE_CODE_PY_REPL;', |
| 26 | 'delete process.env.ENABLE_LSP_TOOL;', |
| 27 | ...Object.entries(env).map(([key, value]) => |
| 28 | value === undefined |
| 29 | ? `delete process.env.${key};` |
| 30 | : `process.env.${key} = ${JSON.stringify(value)};`, |
| 31 | ), |
| 32 | 'const { collectToolInventory } = await import("./src/tools/toolInventory.js");', |
| 33 | 'const { buildToolInventoryReport } = await import("./src/tools/toolInventoryReport.js");', |
| 34 | 'const entries = collectToolInventory();', |
| 35 | 'console.log(JSON.stringify(buildToolInventoryReport(entries)));', |
| 36 | ].join('\n') |
| 37 | |
| 38 | const result = Bun.spawnSync({ |
| 39 | cmd: [BUN_BIN, '-e', script], |
| 40 | cwd: CODE_ROOT, |
| 41 | stdout: 'pipe', |
| 42 | stderr: 'pipe', |
| 43 | env: process.env, |
| 44 | }) |
| 45 | |
| 46 | expect(result.exitCode).toBe(0) |
| 47 | return JSON.parse(result.stdout.toString()) as ToolInventoryReport |
| 48 | } |
| 49 | |
| 50 | const DEFAULT_INTERNAL_CLI_REPORT = probeReport({}) |
| 51 | const SDK_CLI_REPL_REPORT = probeReport({ |
no test coverage detected