(projectRoot, options = {})
| 259 | } |
| 260 | |
| 261 | function buildConsole(projectRoot, options = {}) { |
| 262 | const root = path.resolve(projectRoot || process.cwd()); |
| 263 | const decision = resolveNext(root, { |
| 264 | run: Boolean(options.run), |
| 265 | maxSteps: options.maxSteps || 3, |
| 266 | }); |
| 267 | |
| 268 | if (decision.approvalCapsule) { |
| 269 | writeApprovalCapsule(root, decision.approvalCapsule); |
| 270 | } |
| 271 | decision.reportPath = writeNextReport(root, decision); |
| 272 | |
| 273 | const snapshot = collectDashboard({ projectRoot: root }); |
| 274 | const stack = assessStack(root); |
| 275 | const verificationProfile = selectVerificationProfile(root); |
| 276 | const finalAction = decision.final?.nextAction || decision.initial?.nextAction || {}; |
| 277 | const canRunNow = Boolean(localRepairFor(finalAction)) && !options.run; |
| 278 | const consoleState = { |
| 279 | generatedAt: new Date().toISOString(), |
| 280 | projectRoot: root, |
| 281 | mode: options.run ? 'run' : 'inspect', |
| 282 | status: statusForDecision(decision), |
| 283 | nextAction: { |
| 284 | label: finalAction.label || '(none)', |
| 285 | command: finalAction.command || '(none)', |
| 286 | why: finalAction.why || '(none)', |
| 287 | confidence: finalAction.confidence || 'medium', |
| 288 | runbook: finalAction.runbook || null, |
| 289 | canRunNow, |
| 290 | }, |
| 291 | boundary: boundaryForDecision(decision), |
| 292 | dashboard: summarizeDashboard(snapshot), |
| 293 | verificationProfile, |
| 294 | decision, |
| 295 | }; |
| 296 | applyStackDecision(consoleState, stack); |
| 297 | consoleState.reportPath = writeConsoleReport(root, consoleState); |
| 298 | consoleState.summary = compactConsoleSummary(consoleState); |
| 299 | return consoleState; |
| 300 | } |
| 301 | |
| 302 | function renderArtifact(label, artifact) { |
| 303 | if (!artifact) return [` ${label}: none`]; |
no test coverage detected