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

Function trailDecay

ui/src/lib/trails-model.ts:66–92  ·  view source on GitHub ↗
(trail: WireTrail)

Source from the content-addressed store, hash-verified

64 * meant it to say.
65 */
66export function trailDecay(trail: WireTrail): TrailDecay | null {
67 const missing = trail.hops.filter((hop) => hop.status === 'missing');
68 const ambiguous = trail.hops.filter((hop) => hop.status === 'ambiguous');
69 const moved = trail.hops.filter((hop) => hop.status === 'moved');
70
71 if (missing.length > 0) {
72 return {
73 tone: 'warn',
74 text:
75 `${plural(missing.length, 'hop')} moved or renamed since this was saved — ` +
76 `${nameList(missing)} no longer in the index.`,
77 };
78 }
79 if (ambiguous.length > 0) {
80 return {
81 tone: 'warn',
82 text: `${nameList(ambiguous)} now ${ambiguous.length === 1 ? 'names' : 'name'} more than one symbol — showing the closest match.`,
83 };
84 }
85 if (moved.length > 0) {
86 return {
87 tone: 'note',
88 text: `${nameList(moved)} moved to another file since this was saved.`,
89 };
90 }
91 return null;
92}
93
94/**
95 * How much of the trail can actually be opened, or null when all of it can.

Callers 1

Calls 2

pluralFunction · 0.90
nameListFunction · 0.85

Tested by

no test coverage detected