MCPcopy
hub / github.com/garrytan/gstack / computeActive

Function computeActive

lib/gstack-decision.ts:185–195  ·  view source on GitHub ↗
(events: DecisionEvent[])

Source from the content-addressed store, hash-verified

183 * order (oldest first).
184 */
185export function computeActive(events: DecisionEvent[]): ActiveDecision[] {
186 const retired = new Set<string>();
187 for (const e of events) {
188 if ((e.kind === "supersede" || e.kind === "redact") && e.supersedes) {
189 retired.add(e.supersedes); // dangling target id is harmless — just a no-op
190 }
191 }
192 return events
193 .filter((e): e is ActiveDecision => e.kind === "decide" && !retired.has(e.id))
194 .sort((a, b) => (a.date < b.date ? -1 : a.date > b.date ? 1 : 0));
195}
196
197/**
198 * Scope filter for resurfacing: repo-scoped decisions always apply; branch-scoped

Callers 3

rebuildSnapshotFunction · 0.85
compactFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected