MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / read

Function read

graph-ui/src/architecture/container-source.ts:146–165  ·  view source on GitHub ↗
(index: number, paths: string[])

Source from the content-addressed store, hash-verified

144 }));
145 if (selections.length > 4) warnings.push('Compare at most four indexed projects at once.');
146 const read = async (index: number, paths: string[]) => {
147 const inventory = selections[index].inventory;
148 // Four requests at a time keep a large repo from monopolizing the daemon.
149 for (let offset = 0; offset < paths.length; offset += 4) {
150 checkAbort(signal);
151 if (sourceChars >= 4_000_000) { warnings.push('Source inspection reached the four-million-character budget.'); break; }
152 await Promise.all(paths.slice(offset, offset + 4).map(async path => {
153 try {
154 const source = await readContainerSource(inventory, path, client, signal);
155 if (sourceChars + source.length > 4_000_000) { sourceChars = 4_000_000; warnings.push('Source inspection reached the four-million-character budget.'); return; }
156 sourceChars += source.length;
157 (projects[index].sources as Map<string, string>).set(path, source); filesRead++;
158 if (inventory.sourceSpans?.has(path) && !inventory.sourceEnds?.has(path)) rangeFiles.add(`${inventory.project}:${path}`);
159 } catch {
160 checkAbort(signal);
161 warnings.push(`${inventory.project}: ${path} was unavailable, incomplete, or exceeded the source limit.`);
162 }
163 }));
164 }
165 };
166 for (let index = 0; index < projects.length; index++) {
167 warnings.push(...selections[index].inventory.warnings);
168 if (projects[index].manifest) await read(index, [projects[index].manifest]);

Callers 1

loadContainerTopologyFunction · 0.70

Calls 3

checkAbortFunction · 0.85
readContainerSourceFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected