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

Function readImpact

graph-ui/src/impact/impact-source.ts:144–185  ·  view source on GitHub ↗
(
    source: ImpactSource,
    root: string,
    options: ImpactReadOptions,
)

Source from the content-addressed store, hash-verified

142
143/** The whole assessment, from the four readings. */
144export async function readImpact(
145 source: ImpactSource,
146 root: string,
147 options: ImpactReadOptions,
148): Promise<ImpactReading> {
149 const opts: ProviderQueryOptions = {
150 ...(options.projectName === undefined ? {} : { projectName: options.projectName }),
151 ...(options.generation === undefined ? {} : { generation: options.generation }),
152 };
153 const cap = options.testCap ?? IMPACT_TEST_LOOKUP_CAP;
154
155 const change = await source.changeImpact(root, options.sinceRef, opts);
156 const overview = await source.architectureOverview(root, opts);
157
158 const scan = await scanRoutes(overview.files, options.readSource);
159 const architecture: ArchitectureOverviewDto = {
160 ...overview,
161 routes: mergeRoutes(scan.routes, overview.routes),
162 };
163
164 const qualifiedNames = [
165 ...new Set(
166 change.symbols
167 .filter((symbol) => symbol.changeKind !== 'module')
168 .map((symbol) => symbol.qualifiedName)
169 .filter((name): name is string => name !== undefined),
170 ),
171 ];
172 const complexity = qualifiedNames.length === 0
173 ? []
174 : await source.getComplexity(root, qualifiedNames, opts).catch(() => []);
175
176 const tests = await testLookup(source, root, change.symbols, cap, opts);
177
178 return {
179 model: mapChangeImpact(change, architecture, buildComplexityLookup(complexity, architecture), tests),
180 routeNote: scan.scanned === 0 && scan.cappedAt === undefined
181 ? ''
182 : impactRouteScanNote(scan.scanned, scan.cappedAt, scan.truncatedFiles),
183 change,
184 };
185}

Callers 1

Calls 9

scanRoutesFunction · 0.90
mergeRoutesFunction · 0.90
mapChangeImpactFunction · 0.90
buildComplexityLookupFunction · 0.90
impactRouteScanNoteFunction · 0.90
testLookupFunction · 0.85
changeImpactMethod · 0.65
architectureOverviewMethod · 0.65
getComplexityMethod · 0.65

Tested by

no test coverage detected