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

Function buildNarrative

graph-ui/src/impact/impact-model.ts:603–666  ·  view source on GitHub ↗
(inputs: NarrativeInputs)

Source from the content-addressed store, hash-verified

601 * at, and they say what.
602 */
603export function buildNarrative(inputs: NarrativeInputs): ImpactNarrative {
604 const evidence: ImpactEvidence[] = [];
605 const changedFiles = inputs.change?.changedFiles.length ?? 0;
606 const reported = inputs.change?.symbols.length ?? 0;
607
608 evidence.push({
609 claim: impactChangedSentence(changedFiles, inputs.declared),
610 source: 'detect_changes',
611 value: `${countOf(changedFiles, 'changed file', 'changed files')}, `
612 + `${countOf(reported, 'symbol', 'symbols')} reported`,
613 });
614 const seeds = inputs.change?.seedSymbols;
615 if (seeds !== undefined && seeds !== inputs.declared) {
616 evidence.push({
617 claim: impactSeedSentence(seeds, inputs.declared),
618 source: 'detect_changes',
619 value: `${countOf(seeds, 'seed declaration', 'seed declarations')} reported, `
620 + `${countOf(inputs.declared, 'symbol', 'symbols')} listed`,
621 });
622 }
623 evidence.push({
624 claim: impactDownstreamSentence(inputs.callers, inputs.walkedDistance),
625 source: 'detect_changes',
626 value: `${countOf(inputs.callers, 'caller', 'callers')} over `
627 + `${countOf(inputs.walkedDistance, 'walked step', 'walked steps')}`,
628 });
629 evidence.push({
630 claim: impactEndpointSentence(inputs.endpoints.map((endpoint) => endpointLabel(endpoint))),
631 source: 'architecture',
632 value: `${countOf(inputs.architecture?.routes.length ?? 0, 'route', 'routes')} recovered, `
633 + `${inputs.endpoints.length} reached`,
634 });
635 evidence.push({
636 claim: impactTestsSentence(inputs.tests.covering.length, inputs.tests.missing.length),
637 source: 'facts',
638 value: `${countOf(inputs.tests.checked, 'symbol', 'symbols')} checked for test callers`,
639 });
640 if (inputs.completeness.unmeasured > 0) {
641 evidence.push({
642 claim: impactUnmeasuredSentence(inputs.completeness.unmeasured),
643 source: 'facts',
644 value: `${inputs.completeness.measured} of ${inputs.completeness.total} symbols carry a complexity reading`,
645 });
646 }
647 if (inputs.tests.cappedAt !== undefined) {
648 evidence.push({
649 claim: impactTestLookupCapped(inputs.tests.cappedAt),
650 source: 'facts',
651 value: `lookup capped at ${inputs.tests.cappedAt} symbols`,
652 });
653 }
654 if (inputs.change?.truncated === true) {
655 evidence.push({
656 claim: IMPACT_WALK_TRUNCATED,
657 source: 'detect_changes',
658 value: `walk stopped after ${inputs.walkedDistance} steps`,
659 });
660 }

Callers 1

mapChangeImpactFunction · 0.85

Calls 10

impactChangedSentenceFunction · 0.90
countOfFunction · 0.90
impactSeedSentenceFunction · 0.90
impactDownstreamSentenceFunction · 0.90
impactEndpointSentenceFunction · 0.90
impactTestsSentenceFunction · 0.90
impactUnmeasuredSentenceFunction · 0.90
impactTestLookupCappedFunction · 0.90
endpointLabelFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected