diff --git a/README.md b/README.md index 0b348cb8..9d1bafe9 100644 --- a/README.md +++ b/README.md @@ -240,10 +240,12 @@ npm install -g @colbymchenry/codegraph "allow": [ "mcp__codegraph__codegraph_search", "mcp__codegraph__codegraph_context", + "mcp__codegraph__codegraph_trace", "mcp__codegraph__codegraph_callers", "mcp__codegraph__codegraph_callees", "mcp__codegraph__codegraph_impact", "mcp__codegraph__codegraph_node", + "mcp__codegraph__codegraph_explore", "mcp__codegraph__codegraph_status", "mcp__codegraph__codegraph_files" ] diff --git a/__tests__/tool-list-consistency.test.ts b/__tests__/tool-list-consistency.test.ts new file mode 100644 index 00000000..3c12beda --- /dev/null +++ b/__tests__/tool-list-consistency.test.ts @@ -0,0 +1,50 @@ +import { describe, expect, it } from 'vitest'; +import * as fs from 'fs'; +import * as path from 'path'; + +const repoRoot = path.resolve(__dirname, '..'); +const MCP_TOOLS = [ + 'codegraph_search', + 'codegraph_context', + 'codegraph_trace', + 'codegraph_callers', + 'codegraph_callees', + 'codegraph_impact', + 'codegraph_node', + 'codegraph_explore', + 'codegraph_files', + 'codegraph_status', +]; + +describe('MCP tool list docs stay in sync', () => { + it('serve help lists every MCP tool named in the README table', () => { + const readme = fs.readFileSync(path.join(repoRoot, 'README.md'), 'utf-8'); + const cli = fs.readFileSync(path.join(repoRoot, 'src/bin/codegraph.ts'), 'utf-8'); + + const table = readme.match(/## MCP Tools[\s\S]*?\| `codegraph_search`[\s\S]*?\| `codegraph_status`[^\n]*\n/); + expect(table).not.toBeNull(); + + const helpBlock = cli.match(/console\.error\('Available tools:'\);[\s\S]*?\n \}/); + expect(helpBlock).not.toBeNull(); + + for (const tool of MCP_TOOLS) { + expect(table![0]).toContain(`\`${tool}\``); + expect(helpBlock![0]).toContain(` ${tool}`); + } + }); + + it('Claude permission example covers every README-listed MCP tool', () => { + const readme = fs.readFileSync(path.join(repoRoot, 'README.md'), 'utf-8'); + + const permissionBlock = readme.match(/"allow": \[[\s\S]*?\]/); + expect(permissionBlock).not.toBeNull(); + + const table = readme.match(/## MCP Tools[\s\S]*?\| `codegraph_search`[\s\S]*?\| `codegraph_status`[^\n]*\n/); + expect(table).not.toBeNull(); + + for (const tool of MCP_TOOLS) { + expect(table![0]).toContain(`\`${tool}\``); + expect(permissionBlock![0]).toContain(`mcp__codegraph__${tool}`); + } + }); +}); diff --git a/src/bin/codegraph.ts b/src/bin/codegraph.ts index 6bc63b3f..a532f6e0 100644 --- a/src/bin/codegraph.ts +++ b/src/bin/codegraph.ts @@ -1167,10 +1167,12 @@ program console.error('Available tools:'); console.error(chalk.cyan(' codegraph_search') + ' - Search for code symbols'); console.error(chalk.cyan(' codegraph_context') + ' - Build context for a task'); + console.error(chalk.cyan(' codegraph_trace') + ' - Trace call paths between symbols'); console.error(chalk.cyan(' codegraph_callers') + ' - Find callers of a symbol'); console.error(chalk.cyan(' codegraph_callees') + ' - Find what a symbol calls'); console.error(chalk.cyan(' codegraph_impact') + ' - Analyze impact of changes'); console.error(chalk.cyan(' codegraph_node') + ' - Get symbol details'); + console.error(chalk.cyan(' codegraph_explore') + ' - Explore related source'); console.error(chalk.cyan(' codegraph_files') + ' - Get project file structure'); console.error(chalk.cyan(' codegraph_status') + ' - Get index status'); }