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

Function servedRangesForFile

src/mcp/explore-dedup.ts:183–198  ·  view source on GitHub ↗
(
  prior: ExploreProjectState | null,
  filePath: string,
  fingerprint: string,
)

Source from the content-addressed store, hash-verified

181 * exactly the case where re-serving is right.
182 */
183export function servedRangesForFile(
184 prior: ExploreProjectState | null,
185 filePath: string,
186 fingerprint: string,
187): ExploreLineRange[] {
188 if (!prior) return [];
189 const spans: ExploreLineRange[] = [];
190 for (const call of prior.calls) {
191 for (const file of call.files) {
192 if (file.path !== filePath) continue;
193 if (!file.fingerprint || file.fingerprint !== fingerprint) continue;
194 spans.push(...file.ranges);
195 }
196 }
197 return mergeRanges(spans);
198}
199
200/** `L12`, `L12-40`, capped with a `+N more` tail. */
201export function formatSpans(spans: ReadonlyArray<ExploreLineRange>): string {

Callers 2

handleExploreMethod · 0.90

Calls 2

mergeRangesFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected