fix(explore): reliably pin extension-less kebab-case file basenames in queries

Previously, naming a kebab-case file without its extension (e.g., `background-image-table` vs. `background-image-table.tsx`) in a `codegraph_explore` query would shred the name into fragments (`background`, `image`, `table`), admitting irrelevant sibling files and crowding out the intended target.

This change introduces a new resolution pass in `extractQueryPaths` specifically for extension-less kebab basenames. Queries now accurately identify and pin these files. Unresolved hyphenated prose (e.g., `cross-call`) is left in the query for FTS without being flagged as an unknown path. Resolution prioritizes explicit slashed/dotted paths and respects an ambiguity budget for common stems to prevent over-pinning.
This commit is contained in:
Colby McHenry
2026-08-22 09:05:30 -07:00
parent 81e1f4a92f
commit ccb0295259
6 changed files with 241 additions and 8 deletions
@@ -0,0 +1,21 @@
/** Table of background images for a training set — source-column rendering. */
export interface BackgroundImageRow {
id: string;
sourceUrl: string;
label: string;
}
let tableRows: BackgroundImageRow[] = [];
export function loadTableRows(rows: BackgroundImageRow[]): void {
tableRows = rows;
}
export function renderSourceColumn(row: BackgroundImageRow): string {
return `${row.label}: ${row.sourceUrl}`;
}
export function sortRowsBySource(): BackgroundImageRow[] {
return [...tableRows].sort((a, b) => a.sourceUrl.localeCompare(b.sourceUrl));
}
@@ -0,0 +1,11 @@
/** Uploaded-background registry — shares the `background` fragment with the table file. */
let backgrounds: string[] = [];
export function addBackground(url: string): void {
backgrounds.push(url);
}
export function listBackgrounds(): string[] {
return [...backgrounds];
}