MCPcopy Create free account
hub / github.com/cursor/plugins / collectCascadeVictims

Function collectCascadeVictims

orchestrate/skills/orchestrate/scripts/cli/util.ts:252–274  ·  view source on GitHub ↗
(
  mgr: AgentManager,
  rootName: string
)

Source from the content-addressed store, hash-verified

250}
251
252export function collectCascadeVictims(
253 mgr: AgentManager,
254 rootName: string
255): TaskState[] {
256 const start = mgr.getTask(rootName);
257 if (!start) return [];
258 const out: TaskState[] = [start];
259 const seen = new Set([rootName]);
260 const frontier = [rootName];
261 while (frontier.length > 0) {
262 const cur = frontier.shift();
263 if (cur === undefined) break;
264 for (const t of mgr.tasks) {
265 if (seen.has(t.name)) continue;
266 if (!t.dependsOn.includes(cur)) continue;
267 if (t.status !== "pending" && t.status !== "running") continue;
268 seen.add(t.name);
269 frontier.push(t.name);
270 out.push(t);
271 }
272 }
273 return out;
274}
275
276export function collect(value: string, previous: string[]): string[] {
277 return [...previous, value];

Callers 1

registerTaskCommandsFunction · 0.90

Calls 1

getTaskMethod · 0.80

Tested by

no test coverage detected