codegraph
codegraph copied to clipboard
Add source string index for code-like literals
Summary
- add a
source_stringsside-table plus FTS5 index for compact code-like string literals such as route keys, collection names, event names, and config keys - index exact literal sites during extraction, attaching each hit to its smallest enclosing symbol and file:line location
- expose
searchSourceStrings()for direct literal lookups, and use source-string hits as entry points forquery,explore, CLI, and MCP search/context paths - preserve exact literal semantics for single code-like strings while allowing multi-term FTS lookup, and keep natural-language context ranking stable by only seeding source-string results for code-like queries
- replace rows on sync/delete/clear so the side-table stays aligned with the graph
This is the larger follow-up to the source-string use case discussed on #451: route paths, Directus collection names, RN/Unity bridge event names, and similar cross-repo string contracts are not symbols, but they still need a queryable source surface.
Validation
npx vitest run __tests__/source-strings.test.ts __tests__/context.test.ts __tests__/context-ranking.test.ts __tests__/mcp-tool-allowlist.test.ts __tests__/security.test.ts— 87 passed, 2 skippednpm run build- CLI smoke test against a temp TypeScript project:
init,query '/live-scoring/append-event', andexplore 'unity.score.updated'