- tool-stubs.test.ts: 旧 cpp.cmake.configure/static.cppcheck/clangd.query 名字已删,改为验证 CppToolRegistrar 独立注册 - release-critical-gates.test.ts: cpp.detect 不再由 BuiltInToolRegistrar 注册,从 built-in envelope 测试移除 - .dependency-cruiser.js: 允许 runtime → toolchain-cpp (capability registration boundary, INV-4 compliant) e2e: 14/14 gates passed Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
74 lines
2.7 KiB
TypeScript
Executable File
74 lines
2.7 KiB
TypeScript
Executable File
/**
|
|
* C7 regression: All MVP tools registered
|
|
* Validates that BuiltInToolRegistrar registers built-in tools (non-cpp)
|
|
* and that CppToolRegistrar registers cpp.* tools separately.
|
|
*
|
|
* Tests actual ToolRegistry state rather than source text inspection.
|
|
*/
|
|
|
|
import { describe, it, expect } from 'bun:test'
|
|
import { ToolRegistry } from '../../src/tools/ToolRegistry.js'
|
|
import { BuiltInToolRegistrar } from '../../src/tools/BuiltInToolRegistrar.js'
|
|
|
|
const registry = new ToolRegistry('/tmp/test-air')
|
|
const registrar = new BuiltInToolRegistrar(registry)
|
|
registrar.register_all('/tmp/test-air')
|
|
const tools = registry.list()
|
|
|
|
// Built-in tools (non-cpp, registered by BuiltInToolRegistrar)
|
|
const BUILTIN_TOOLS = [
|
|
'fs.list', 'fs.read', 'fs.write', 'fs.edit', 'fs.patch', 'fs.stat',
|
|
'shell.run', 'process.kill',
|
|
'git.status', 'git.diff', 'git.worktree.create', 'git.merge_workspace',
|
|
'project.scan', 'project.profile.write',
|
|
'debug.run', 'debug.parse_logs',
|
|
'gui.screenshot', 'network.capture',
|
|
'artifact.create', 'context.assemble',
|
|
'permission.request', 'doctor.run',
|
|
]
|
|
|
|
// cpp tools registered by CppToolRegistrar (tested via RuntimeApp integration)
|
|
const CPP_TOOLS = [
|
|
'cpp.detect', 'cpp.configure', 'cpp.build', 'cpp.test',
|
|
'cpp.cppcheck', 'cpp.clangd',
|
|
]
|
|
|
|
describe('C7: MVP tool registrations', () => {
|
|
for (const tool_name of BUILTIN_TOOLS) {
|
|
it(`registers ${tool_name}`, () => {
|
|
const found = tools.find(t => t.name === tool_name)
|
|
expect(found).toBeDefined()
|
|
expect(found?.name).toBe(tool_name)
|
|
})
|
|
}
|
|
|
|
it('has at least 22 built-in tools registered', () => {
|
|
expect(tools.length).toBeGreaterThanOrEqual(22)
|
|
})
|
|
|
|
it('stub tools produce structured envelope', async () => {
|
|
const stub_names = ['process.kill', 'gui.screenshot', 'network.capture']
|
|
for (const name of stub_names) {
|
|
const tool = tools.find(t => t.name === name)
|
|
expect(tool).toBeDefined()
|
|
}
|
|
})
|
|
|
|
it('cpp tools registered via CppToolRegistrar (not BuiltInToolRegistrar)', async () => {
|
|
const { CppToolRegistrar } = await import('@aircoding/toolchain-cpp')
|
|
const cppRegistry = new ToolRegistry('/tmp/test-air-cpp')
|
|
const cppRegistrar = new CppToolRegistrar()
|
|
cppRegistrar.register(cppRegistry, '/tmp/test-air-cpp')
|
|
const cppTools = cppRegistry.list()
|
|
for (const name of CPP_TOOLS) {
|
|
const found = cppTools.find((t: any) => t.name === name)
|
|
expect(found).toBeDefined()
|
|
}
|
|
})
|
|
|
|
it('create_stub_definitions and create_real_executor exist', () => {
|
|
expect(typeof (BuiltInToolRegistrar.prototype as any).create_stub_definitions).toBe('function')
|
|
expect(typeof (BuiltInToolRegistrar.prototype as any).create_real_executor).toBe('function')
|
|
})
|
|
})
|