MCPcopy
hub / github.com/claude-code-best/claude-code / derivePhaseStatus

Function derivePhaseStatus

src/workflow/panel/selectors.ts:32–41  ·  view source on GitHub ↗

* Derive a phase's sidebar status from the actual record + the agents grouped under it. * * The actual record comes from `phase_started`/`phase_done` events. Scripts that follow the * ultracode canonical pipeline pattern pass `opts.phase` directly to `agent()` inside * `pipeline()`/`parallel()`

(
  actual: { status: 'running' | 'done' } | undefined,
  inPhase: AgentProgress[],
)

Source from the content-addressed store, hash-verified

30 * (`running` if `phase()` was called and is still active, else pending).
31 */
32function derivePhaseStatus(
33 actual: { status: 'running' | 'done' } | undefined,
34 inPhase: AgentProgress[],
35): PhaseStatus {
36 if (actual?.status === 'done') return 'done'
37 if (inPhase.length > 0) {
38 return inPhase.every(a => a.status === 'done') ? 'done' : 'running'
39 }
40 return actual?.status === 'running' ? 'running' : 'pending'
41}
42
43/**
44 * Merge declaredPhases (declared by meta), run.phases (actually running/done),

Callers 1

pushFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected