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

Function affectedEndpoints

graph-ui/src/impact/impact-model.ts:476–527  ·  view source on GitHub ↗
(
    change: ChangeImpactDto | undefined,
    architecture: ArchitectureOverviewDto | undefined,
)

Source from the content-addressed store, hash-verified

474 * is the claim that says which function answers the address.
475 */
476export function affectedEndpoints(
477 change: ChangeImpactDto | undefined,
478 architecture: ArchitectureOverviewDto | undefined,
479): ImpactEndpoint[] {
480 const routes = architecture?.routes ?? [];
481 if (routes.length === 0 || change === undefined) {
482 return [];
483 }
484 const symbolNames = new Set<string>();
485 const reachedFiles = new Set<string>(change.changedFiles);
486 for (const symbol of change.symbols) {
487 if (symbol.changeKind === 'module') {
488 continue;
489 }
490 symbolNames.add(symbol.name);
491 if (symbol.qualifiedName) {
492 symbolNames.add(symbol.qualifiedName);
493 }
494 if (symbol.filePath) {
495 reachedFiles.add(symbol.filePath);
496 }
497 }
498
499 const seen = new Set<string>();
500 const out: ImpactEndpoint[] = [];
501 const add = (route: RouteRef, via: 'handler' | 'file'): void => {
502 const key = `${route.method ?? ''} ${route.path}`;
503 if (seen.has(key)) {
504 return;
505 }
506 seen.add(key);
507 out.push({
508 routePath: route.path,
509 method: route.method,
510 via,
511 filePath: route.filePath,
512 line: route.line,
513 origin: route.origin,
514 });
515 };
516 for (const route of routes) {
517 if (route.handler && symbolNames.has(route.handler)) {
518 add(route, 'handler');
519 }
520 }
521 for (const route of routes) {
522 if (route.filePath && reachedFiles.has(route.filePath)) {
523 add(route, 'file');
524 }
525 }
526 return out;
527}
528
529// Tests -----------------------------------------------------------------------
530

Callers 2

mapChangeImpactFunction · 0.85

Calls 1

addFunction · 0.70

Tested by

no test coverage detected