MCPcopy Index your code
hub / github.com/garrytan/gstack / filterByScope

Function filterByScope

lib/gstack-decision.ts:202–209  ·  view source on GitHub ↗
(active: ActiveDecision[], ctx: { branch?: string; issue?: string })

Source from the content-addressed store, hash-verified

200 * issue matches. (Recency != relevance — callers filter by scope, not just date.)
201 */
202export function filterByScope(active: ActiveDecision[], ctx: { branch?: string; issue?: string }): ActiveDecision[] {
203 return active.filter((d) => {
204 if (d.scope === "repo") return true;
205 if (d.scope === "branch") return !!ctx.branch && d.branch === ctx.branch;
206 if (d.scope === "issue") return !!ctx.issue && d.issue === ctx.issue;
207 return false; // unknown/garbage scope: fail conservative, don't leak into every context
208 });
209}
210
211/** Append a validated event atomically (single-line, concurrency-safe). */
212export function appendEvent(paths: DecisionPaths, event: DecisionEvent): void {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected