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

Function buildApprovalCapsule

scripts/next-action.js:211–241  ·  view source on GitHub ↗
(projectRoot, snapshot, generatedAt)

Source from the content-addressed store, hash-verified

209}
210
211function buildApprovalCapsule(projectRoot, snapshot, generatedAt) {
212 const action = snapshot.nextAction || {};
213 if (!action.command || localRepairFor(action)) return null;
214 if (!snapshot.repairs || snapshot.repairs.length === 0) return null;
215
216 return {
217 generatedAt,
218 projectRoot,
219 boundary: approvalBoundaryFor(action),
220 risk: approvalRiskFor(action),
221 request: approvalRequestFor(action),
222 action: {
223 label: action.label || '(unlabeled)',
224 command: action.command,
225 why: action.why || '',
226 confidence: action.confidence || 'medium',
227 runbook: action.runbook || null,
228 },
229 context: {
230 pending: snapshot.pending || {},
231 gitStatus: snapshot.gitStatus || {},
232 problemSummary: snapshot.problemSummary || {},
233 campaigns: (snapshot.campaigns || []).slice(0, 3).map((campaign) => ({
234 slug: campaign.slug,
235 status: campaign.status,
236 phase: campaign.phase?.label || null,
237 })),
238 },
239 verification: verificationPlanFor(action),
240 };
241}
242
243function resolveNext(projectRoot, options = {}) {
244 const root = path.resolve(projectRoot || process.cwd());

Callers 2

resolveNextFunction · 0.85

Calls 5

localRepairForFunction · 0.85
approvalBoundaryForFunction · 0.85
approvalRiskForFunction · 0.85
approvalRequestForFunction · 0.85
verificationPlanForFunction · 0.85

Tested by

no test coverage detected