(profile: ToolImplementationProfile)
| 271 | } |
| 272 | |
| 273 | function probeProfileBaseTools(profile: ToolImplementationProfile): Set<string> { |
| 274 | const script = [ |
| 275 | 'delete process.env.NODE_ENV;', |
| 276 | ...PROBE_ENV_KEYS.map(key => |
| 277 | profile.env[key] === undefined |
| 278 | ? `delete process.env.${key};` |
| 279 | : `process.env.${key} = ${JSON.stringify(profile.env[key])};`, |
| 280 | ), |
| 281 | 'const { getAllBaseTools } = await import("./src/tools.js");', |
| 282 | 'console.log(JSON.stringify(getAllBaseTools().map(tool => tool.name).sort()));', |
| 283 | ].join('\n') |
| 284 | |
| 285 | const result = Bun.spawnSync({ |
| 286 | cmd: [BUN_BIN, '-e', script], |
| 287 | cwd: CODE_ROOT, |
| 288 | stdout: 'pipe', |
| 289 | stderr: 'pipe', |
| 290 | env: process.env, |
| 291 | }) |
| 292 | |
| 293 | if (result.exitCode !== 0) { |
| 294 | throw new Error( |
| 295 | `Failed to probe tool profile ${profile.id}.\nSTDOUT:\n${result.stdout.toString()}\nSTDERR:\n${result.stderr.toString()}`, |
| 296 | ) |
| 297 | } |
| 298 | |
| 299 | return new Set(JSON.parse(result.stdout.toString()) as string[]) |
| 300 | } |
| 301 | |
| 302 | function compareEntries( |
| 303 | left: ToolImplementationEntry, |
no test coverage detected