MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / roomFor

Function roomFor

__tests__/explore-completeness-note.test.ts:205–209  ·  view source on GitHub ↗
(k: number, withNote: readonly string[] = [])

Source from the content-addressed store, hash-verified

203 const entriesIn = (block: readonly string[]) => block.filter((l) => l.startsWith('- src/')).length;
204 /** Room for exactly `k` pointer entries (header, entries and tail) beside `withNote`. */
205 const roomFor = (k: number, withNote: readonly string[] = []) => {
206 const full = fit(1e6, [], false).pointers;
207 const header = full.slice(0, 2);
208 return cost(withNote) + cost([...header, ...entries.slice(0, k), `- ... and ${entries.length - k + 20} more files`]);
209 };
210
211 it('a complete-source note keeps its precedence over the pointer list', () => {
212 const complete = note(330);

Callers 2

handleExploreMethod · 0.85

Calls 2

fitFunction · 0.85
costFunction · 0.70

Tested by

no test coverage detected