(hints: string[], exists: (name: string) => boolean)
| 53 | * Score how many of a skill's identifier hints exist in the codebase. `exists` is injected |
| 54 | * (e.g. name => codeGraph.findSymbolsByName(name).length > 0). PURE. */ |
| 55 | export function codebaseFitScore(hints: string[], exists: (name: string) => boolean): CodebaseFit { |
| 56 | if (hints.length === 0) return { score: 0, matched: [], total: 0, noSignal: true }; |
| 57 | const matched = hints.filter(h => { try { return exists(h); } catch { return false; } }); |
| 58 | return { score: matched.length / hints.length, matched, total: hints.length, noSignal: false }; |
| 59 | } |
| 60 | |
| 61 | /** A one-line note for the judge prompt / candidate metadata. Empty when there's no signal. */ |
| 62 | export function fitNote(fit: CodebaseFit): string { |
no test coverage detected