codegraph
codegraph copied to clipboard
fix: reduce generic context entry noise
Summary
- Suppress generic split-token entry points such as
get,getDb, andtestCaseswhen a query already has a specific exact compound symbol match. - Keep generic results when they are in the exact-match files, so focused symbol queries still retain local helpers.
- Reduce default context code blocks from 10 to 2, while keeping
--max-codeavailable for callers that need more code. - Avoid emitting full bodies for related classes that are not entry points; their locations remain in Related Symbols instead.
- Skip tiny delegating wrappers when the same symbol has a more useful implementation block.
- Add a compact focused snippet when non-root query terms co-locate with an entry symbol, so queries like
getFileDependents affected testsinclude the CLI connection point without needing a separatequerycall. - Add regression coverage for
getFileDependents affected testsand method-focused context that should not include related class bodies.
Validation
npm run buildnpx vitest run __tests__/context.test.ts(20 passed)node dist\\bin\\codegraph.js context "getFileDependents affected tests" --path .- Token measurement for
repo_get_file_dependents_investigation: CodeGraph output2,512->639approx tokens, changing from+120.0%vs manual to-51.6%. - Expanded combined local branch test with the related affected/class fixes:
14/14smoke accuracy,38,135manual approx tokens vs8,976CodeGraph approx tokens,76.5%total reduction.
Note: full npm test was also run locally before this update; it hit unrelated Windows temp-directory EBUSY cleanup failures in MCP process tests (mcp-initialize, mcp-roots).