(projectRoot, snapshot, generatedAt)
| 209 | } |
| 210 | |
| 211 | function 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 | |
| 243 | function resolveNext(projectRoot, options = {}) { |
| 244 | const root = path.resolve(projectRoot || process.cwd()); |
no test coverage detected