MCPcopy Create free account
hub / github.com/Noumena-Network/code / probeInventory

Function probeInventory

src/tools/toolInventory.test.ts:13–46  ·  view source on GitHub ↗
(env: Record<string, string | undefined>)

Source from the content-addressed store, hash-verified

11const CODE_ROOT = join(import.meta.dir, '../..')
12
13function probeInventory(env: Record<string, string | undefined>): ToolInventoryEntry[] {
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 'console.log(JSON.stringify(collectToolInventory()));',
34 ].join('\n')
35
36 const result = Bun.spawnSync({
37 cmd: [BUN_BIN, '-e', script],
38 cwd: CODE_ROOT,
39 stdout: 'pipe',
40 stderr: 'pipe',
41 env: process.env,
42 })
43
44 expect(result.exitCode).toBe(0)
45 return JSON.parse(result.stdout.toString()) as ToolInventoryEntry[]
46}
47
48const DEFAULT_INTERNAL_CLI_INVENTORY = probeInventory({})
49const SDK_CLI_REPL_INVENTORY = probeInventory({

Callers 1

Calls 2

entriesMethod · 0.80
toStringMethod · 0.65

Tested by

no test coverage detected