Skip to content

Commit 130a52a

Browse files
feat: add graph quality score to stats, --no-tests flag to 4 more commands
Add quality metrics to `statsData()`: caller coverage, call confidence, false-positive warnings for generic function names (run, get, set, etc.) with >20 callers, and a weighted composite score (0-100). Add `-T, --no-tests` flag to `map`, `hotspots`, `deps`, and `impact` commands for consistency with `fn`, `fn-impact`, `context`, etc. Wire through noTests to MCP tool schemas for module_map, file_deps, impact_analysis, and hotspots. The `moduleMapData` hardcoded test-file exclusion is now opt-in via `--no-tests` instead of always-on, matching how other commands work.
1 parent d5af194 commit 130a52a

File tree

5 files changed

+411
-15
lines changed

5 files changed

+411
-15
lines changed

src/cli.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {
2222
moduleMap,
2323
queryName,
2424
stats,
25+
where,
2526
} from './queries.js';
2627
import {
2728
listRepos,
@@ -186,6 +187,22 @@ program
186187
explain(target, opts.db, { noTests: !opts.tests, json: opts.json });
187188
});
188189

190+
program
191+
.command('where [name]')
192+
.description('Find where a symbol is defined and used (minimal, fast lookup)')
193+
.option('-d, --db <path>', 'Path to graph.db')
194+
.option('-f, --file <path>', 'File overview: list symbols, imports, exports')
195+
.option('-T, --no-tests', 'Exclude test/spec files')
196+
.option('-j, --json', 'Output as JSON')
197+
.action((name, opts) => {
198+
if (!name && !opts.file) {
199+
console.error('Provide a symbol name or use --file <path>');
200+
process.exit(1);
201+
}
202+
const target = opts.file || name;
203+
where(target, opts.db, { file: !!opts.file, noTests: !opts.tests, json: opts.json });
204+
});
205+
189206
program
190207
.command('diff-impact [ref]')
191208
.description('Show impact of git changes (unstaged, staged, or vs a ref)')

src/mcp.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,24 @@ const BASE_TOOLS = [
169169
required: ['target'],
170170
},
171171
},
172+
{
173+
name: 'where',
174+
description:
175+
'Find where a symbol is defined and used, or list symbols/imports/exports for a file. Minimal, fast lookup.',
176+
inputSchema: {
177+
type: 'object',
178+
properties: {
179+
target: { type: 'string', description: 'Symbol name or file path' },
180+
file_mode: {
181+
type: 'boolean',
182+
description: 'Treat target as file path (list symbols/imports/exports)',
183+
default: false,
184+
},
185+
no_tests: { type: 'boolean', description: 'Exclude test files', default: false },
186+
},
187+
required: ['target'],
188+
},
189+
},
172190
{
173191
name: 'diff_impact',
174192
description: 'Analyze git diff to find which functions changed and their transitive callers',
@@ -341,6 +359,7 @@ export async function startMCPServer(customDbPath, options = {}) {
341359
fnImpactData,
342360
contextData,
343361
explainData,
362+
whereData,
344363
diffImpactData,
345364
listFunctionsData,
346365
} = await import('./queries.js');
@@ -436,6 +455,12 @@ export async function startMCPServer(customDbPath, options = {}) {
436455
case 'explain':
437456
result = explainData(args.target, dbPath, { noTests: args.no_tests });
438457
break;
458+
case 'where':
459+
result = whereData(args.target, dbPath, {
460+
file: args.file_mode,
461+
noTests: args.no_tests,
462+
});
463+
break;
439464
case 'diff_impact':
440465
result = diffImpactData(dbPath, {
441466
staged: args.staged,

0 commit comments

Comments
 (0)