MCPcopy Create free account
hub / github.com/SethGammon/Citadel / applyStackDecision

Function applyStackDecision

scripts/operator-console.js:171–211  ·  view source on GitHub ↗
(consoleState, stack)

Source from the content-addressed store, hash-verified

169}
170
171function applyStackDecision(consoleState, stack) {
172 consoleState.stack = stack ? {
173 status: stack.status,
174 ready: stack.ready,
175 prCount: stack.reports.length,
176 blockedCount: stack.blocked.length,
177 nextAction: stack.nextAction,
178 reportPath: stack.reportPath,
179 approvalCapsulePath: stack.approvalCapsule?.path || null,
180 latestApprovalCapsulePath: stack.approvalCapsule?.latestPath || null,
181 reports: stack.reports.map((report) => ({
182 branch: report.branch,
183 pr: report.pr,
184 head: report.head,
185 currentHead: report.currentHead || null,
186 status: report.status,
187 path: report.path,
188 })),
189 } : null;
190
191 if (
192 consoleState.mode !== 'run' &&
193 consoleState.status === 'idle' &&
194 stack &&
195 stack.reports.length > 0 &&
196 (stack.status === 'approval-needed' || stack.status === 'blocked')
197 ) {
198 consoleState.status = stack.status === 'blocked' ? 'needs-review' : 'approval-needed';
199 consoleState.nextAction = {
200 label: stack.nextAction.label,
201 command: stack.nextAction.command,
202 why: stack.nextAction.why,
203 confidence: 'high',
204 runbook: 'docs/CAMPAIGNS.md',
205 canRunNow: false,
206 };
207 consoleState.boundary = boundaryForStack(stack);
208 }
209
210 return consoleState;
211}
212
213function compactConsoleSummary(consoleState) {
214 const artifacts = consoleState.dashboard.artifacts;

Callers 2

buildConsoleFunction · 0.85

Calls 1

boundaryForStackFunction · 0.85

Tested by

no test coverage detected