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

Function parseHandoffBranch

orchestrate/skills/orchestrate/scripts/core/handoff.ts:14–26  ·  view source on GitHub ↗
(handoff: string)

Source from the content-addressed store, hash-verified

12 * Callers fall back to `Run.git.branches[]` then `s.branch`.
13 */
14export function parseHandoffBranch(handoff: string): string | null {
15 const match = /^##\s+Branch\s*\r?\n([^\r\n]*)/m.exec(handoff);
16 if (!match) return null;
17 const raw = match[1].trim();
18 if (raw.length === 0) return null;
19 if (raw.startsWith("##")) return null;
20 // Worker template wraps the value in backticks (`agent/foo-abc1`); the
21 // operator-facing hint also tolerates a bare branch name.
22 const unwrapped = raw.replace(/^`([^`]+)`$/, "$1").trim();
23 if (unwrapped.length === 0) return null;
24 if (/^\(no branch\)$/i.test(unwrapped)) return null;
25 return unwrapped;
26}
27
28/**
29 * Precedence used by `waitAndHandoff`: `## Branch` line wins (SDK leaves

Calls

no outgoing calls

Tested by

no test coverage detected