/** * Neighborhood resolver — answers "which sibling repos belong to the same * conceptual project as cwd?" * * Mechanism: * 1. Tokenize cwd basename on `-`, `_`, `.` (case-insensitive, min length 3) * 2. For each sibling in the parent directory, count how many cwd tokens * appear as case-insensitive substrings in the sibling's name * 3. Weight each match by inverse-document-frequency over siblings — rare * tokens (e.g. `6digit`, `koru`) are strong signal; common tokens * (e.g. `test`, `app`) approach zero * 4. Sum scores per sibling; include those above a threshold * 5. Gate the survivors on recency — siblings whose latest git commit is * older than `maxAgeMs` (default 14d) are dropped. A name match without * recent activity is almost always coincidence (`caption-studio` and * `koru-studio` sharing the `studio` suffix with `6digit-studio` but * living in unrelated project families). Self bypasses the gate. * * Catches `korulang_org` for `koru`, the full active `6digit-*` family for * `6digit-studio`, etc., without any config or manifest — just by reading * the structure the user already encoded into their parent directory and * the recency of their git activity. */ export interface NeighborhoodEntry { /** Absolute path to the sibling repo directory. */ path: string; /** Basename — what we'd display in headers. */ name: string; /** Total IDF-weighted score. Higher = more strongly related. */ score: number; /** Cwd tokens that hit this sibling (for explainability). */ matchedTokens: string[]; } export interface NeighborhoodOptions { /** * Minimum score for a sibling to be included. The cwd itself always * scores against itself (every cwd token matches), so the threshold is * applied to *non-self* siblings; self is always included. * * Default 0.05 — empirically keeps strong-token families together while * filtering out incidental name collisions on common tokens. */ minScore?: number; /** Cap the neighborhood size (after self). Default 30. */ maxSiblings?: number; /** * Recency gate: drop non-self siblings whose latest git commit is older * than this many ms (or whose commit date is unreadable — non-git or * empty repos). Self bypasses the gate. Default 14 days. Pass `Infinity` * to disable. */ maxAgeMs?: number; } /** * Tokenize a basename: lowercase, split on `-`, `_`, `.`, drop tokens * shorter than MIN_TOKEN_LEN. Pure-numeric tokens are kept (e.g. `6digit` * tokenizes to ["6digit"], but "1" alone would be dropped by length). */ export declare function tokenize(name: string): string[]; /** * Resolve the neighborhood for a cwd. Returns the cwd itself plus any * sibling whose IDF-weighted match score exceeds `minScore`. Empty array * if cwd has no readable parent directory. */ export declare function resolveNeighborhood(cwd: string, opts?: NeighborhoodOptions): NeighborhoodEntry[]; //# sourceMappingURL=neighborhood.d.ts.map