@vibecheckai/cli 2.8.2 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -8
- package/bin/_deprecations.js +35 -0
- package/bin/_router.js +46 -0
- package/bin/cli-hygiene.js +241 -0
- package/bin/guardrail.js +834 -0
- package/bin/runners/cli-utils.js +1070 -0
- package/bin/runners/context/ai-task-decomposer.js +337 -0
- package/bin/runners/context/analyzer.js +462 -0
- package/bin/runners/context/api-contracts.js +427 -0
- package/bin/runners/context/context-diff.js +342 -0
- package/bin/runners/context/context-pruner.js +291 -0
- package/bin/runners/context/dependency-graph.js +414 -0
- package/bin/runners/context/generators/claude.js +107 -0
- package/bin/runners/context/generators/codex.js +108 -0
- package/bin/runners/context/generators/copilot.js +119 -0
- package/bin/runners/context/generators/cursor.js +514 -0
- package/bin/runners/context/generators/mcp.js +151 -0
- package/bin/runners/context/generators/windsurf.js +180 -0
- package/bin/runners/context/git-context.js +302 -0
- package/bin/runners/context/index.js +1042 -0
- package/bin/runners/context/insights.js +173 -0
- package/bin/runners/context/mcp-server/generate-rules.js +337 -0
- package/bin/runners/context/mcp-server/index.js +1176 -0
- package/bin/runners/context/mcp-server/package.json +24 -0
- package/bin/runners/context/memory.js +200 -0
- package/bin/runners/context/monorepo.js +215 -0
- package/bin/runners/context/multi-repo-federation.js +404 -0
- package/bin/runners/context/patterns.js +253 -0
- package/bin/runners/context/proof-context.js +972 -0
- package/bin/runners/context/security-scanner.js +303 -0
- package/bin/runners/context/semantic-search.js +350 -0
- package/bin/runners/context/shared.js +264 -0
- package/bin/runners/context/team-conventions.js +310 -0
- package/bin/runners/lib/ai-bridge.js +416 -0
- package/bin/runners/lib/analysis-core.js +271 -0
- package/bin/runners/lib/analyzers.js +541 -0
- package/bin/runners/lib/audit-bridge.js +391 -0
- package/bin/runners/lib/auth-truth.js +193 -0
- package/bin/runners/lib/auth.js +215 -0
- package/bin/runners/lib/backup.js +62 -0
- package/bin/runners/lib/billing.js +107 -0
- package/bin/runners/lib/claims.js +118 -0
- package/bin/runners/lib/cli-ui.js +540 -0
- package/bin/runners/lib/compliance-bridge-new.js +0 -0
- package/bin/runners/lib/compliance-bridge.js +165 -0
- package/bin/runners/lib/contracts/auth-contract.js +194 -0
- package/bin/runners/lib/contracts/env-contract.js +178 -0
- package/bin/runners/lib/contracts/external-contract.js +198 -0
- package/bin/runners/lib/contracts/guard.js +168 -0
- package/bin/runners/lib/contracts/index.js +89 -0
- package/bin/runners/lib/contracts/plan-validator.js +311 -0
- package/bin/runners/lib/contracts/route-contract.js +192 -0
- package/bin/runners/lib/detect.js +89 -0
- package/bin/runners/lib/doctor/autofix.js +254 -0
- package/bin/runners/lib/doctor/index.js +37 -0
- package/bin/runners/lib/doctor/modules/dependencies.js +325 -0
- package/bin/runners/lib/doctor/modules/index.js +46 -0
- package/bin/runners/lib/doctor/modules/network.js +250 -0
- package/bin/runners/lib/doctor/modules/project.js +312 -0
- package/bin/runners/lib/doctor/modules/runtime.js +224 -0
- package/bin/runners/lib/doctor/modules/security.js +348 -0
- package/bin/runners/lib/doctor/modules/system.js +213 -0
- package/bin/runners/lib/doctor/modules/vibecheck.js +394 -0
- package/bin/runners/lib/doctor/reporter.js +262 -0
- package/bin/runners/lib/doctor/service.js +262 -0
- package/bin/runners/lib/doctor/types.js +113 -0
- package/bin/runners/lib/doctor/ui.js +263 -0
- package/bin/runners/lib/doctor-enhanced.js +233 -0
- package/bin/runners/lib/doctor-v2.js +608 -0
- package/bin/runners/lib/enforcement.js +72 -0
- package/bin/runners/lib/enterprise-detect.js +603 -0
- package/bin/runners/lib/enterprise-init.js +942 -0
- package/bin/runners/lib/entitlements-v2.js +381 -0
- package/bin/runners/lib/entitlements.generated.js +0 -0
- package/bin/runners/lib/entitlements.js +332 -0
- package/bin/runners/lib/env-template.js +66 -0
- package/bin/runners/lib/env.js +189 -0
- package/bin/runners/lib/error-handler.js +320 -0
- package/bin/runners/lib/firewall-prompt.js +50 -0
- package/bin/runners/lib/graph/graph-builder.js +265 -0
- package/bin/runners/lib/graph/html-renderer.js +413 -0
- package/bin/runners/lib/graph/index.js +32 -0
- package/bin/runners/lib/graph/runtime-collector.js +215 -0
- package/bin/runners/lib/graph/static-extractor.js +518 -0
- package/bin/runners/lib/init-wizard.js +308 -0
- package/bin/runners/lib/json-output.js +76 -0
- package/bin/runners/lib/llm.js +75 -0
- package/bin/runners/lib/meter.js +61 -0
- package/bin/runners/lib/missions/evidence.js +126 -0
- package/bin/runners/lib/missions/plan.js +69 -0
- package/bin/runners/lib/missions/templates.js +147 -0
- package/bin/runners/lib/patch.js +40 -0
- package/bin/runners/lib/permissions/auth-model.js +213 -0
- package/bin/runners/lib/permissions/idor-prover.js +205 -0
- package/bin/runners/lib/permissions/index.js +45 -0
- package/bin/runners/lib/permissions/matrix-builder.js +198 -0
- package/bin/runners/lib/pkgjson.js +28 -0
- package/bin/runners/lib/preflight.js +142 -0
- package/bin/runners/lib/reality-findings.js +84 -0
- package/bin/runners/lib/redact.js +29 -0
- package/bin/runners/lib/replay/capsule-manager.js +154 -0
- package/bin/runners/lib/replay/index.js +263 -0
- package/bin/runners/lib/replay/player.js +348 -0
- package/bin/runners/lib/replay/recorder.js +331 -0
- package/bin/runners/lib/report-engine.js +447 -0
- package/bin/runners/lib/report-html.js +1117 -0
- package/bin/runners/lib/report-templates.js +964 -0
- package/bin/runners/lib/route-detection.js +1140 -0
- package/bin/runners/lib/route-truth.js +477 -0
- package/bin/runners/lib/sandbox/index.js +59 -0
- package/bin/runners/lib/sandbox/proof-chain.js +399 -0
- package/bin/runners/lib/sandbox/sandbox-runner.js +205 -0
- package/bin/runners/lib/sandbox/worktree.js +174 -0
- package/bin/runners/lib/scan-cache.js +330 -0
- package/bin/runners/lib/scan-output-schema.js +344 -0
- package/bin/runners/lib/score-history.js +282 -0
- package/bin/runners/lib/security-bridge.js +249 -0
- package/bin/runners/lib/server-usage.js +513 -0
- package/bin/runners/lib/share-pack.js +239 -0
- package/bin/runners/lib/snippets.js +67 -0
- package/bin/runners/lib/truth.js +667 -0
- package/bin/runners/lib/unified-output.js +189 -0
- package/bin/runners/lib/validate-patch.js +156 -0
- package/bin/runners/lib/verification.js +345 -0
- package/bin/runners/reality/engine.js +917 -0
- package/bin/runners/reality/flows.js +122 -0
- package/bin/runners/reality/report.js +378 -0
- package/bin/runners/reality/session.js +193 -0
- package/bin/runners/runAIAgent.js +2 -0
- package/bin/runners/runAudit.js +2 -0
- package/bin/runners/runAuth.js +106 -0
- package/bin/runners/runAutopilot.js +2 -0
- package/bin/runners/runBadge.js +2 -0
- package/bin/runners/runCertify.js +2 -0
- package/bin/runners/runClaimVerifier.js +483 -0
- package/bin/runners/runContext.js +56 -0
- package/bin/runners/runContextCompiler.js +385 -0
- package/bin/runners/runCtx.js +187 -0
- package/bin/runners/runCtxGuard.js +176 -0
- package/bin/runners/runCtxSync.js +116 -0
- package/bin/runners/runDashboard.js +10 -0
- package/bin/runners/runDoctor.js +245 -0
- package/bin/runners/runEnhancedShip.js +2 -0
- package/bin/runners/runFix.js +735 -0
- package/bin/runners/runFixPacks.js +2 -0
- package/bin/runners/runGate.js +17 -0
- package/bin/runners/runGraph.js +283 -0
- package/bin/runners/runInit.js +260 -0
- package/bin/runners/runInitGha.js +101 -0
- package/bin/runners/runInstall.js +76 -0
- package/bin/runners/runInteractive.js +388 -0
- package/bin/runners/runLaunch.js +2 -0
- package/bin/runners/runMcp.js +19 -0
- package/bin/runners/runMdc.js +2 -0
- package/bin/runners/runMissionGenerator.js +282 -0
- package/bin/runners/runNaturalLanguage.js +3 -0
- package/bin/runners/runPR.js +96 -0
- package/bin/runners/runPermissions.js +290 -0
- package/bin/runners/runPromptFirewall.js +211 -0
- package/bin/runners/runProof.js +2 -0
- package/bin/runners/runProve.js +392 -0
- package/bin/runners/runReality.js +489 -0
- package/bin/runners/runRealitySniff.js +2 -0
- package/bin/runners/runReplay.js +469 -0
- package/bin/runners/runReport.js +478 -0
- package/bin/runners/runScan.js +835 -0
- package/bin/runners/runShare.js +34 -0
- package/bin/runners/runShip.js +1062 -0
- package/bin/runners/runStatus.js +136 -0
- package/bin/runners/runTruthpack.js +634 -0
- package/bin/runners/runUpgrade.js +2 -0
- package/bin/runners/runValidate.js +2 -0
- package/bin/runners/runVerifyAgentOutput.js +2 -0
- package/bin/runners/runWatch.js +230 -0
- package/bin/runners/utils.js +360 -0
- package/bin/scan.js +612 -0
- package/bin/vibecheck.js +834 -0
- package/package.json +11 -11
- package/dist/autopatch/verified-autopatch.d.ts +0 -111
- package/dist/autopatch/verified-autopatch.d.ts.map +0 -1
- package/dist/autopatch/verified-autopatch.js +0 -503
- package/dist/autopatch/verified-autopatch.js.map +0 -1
- package/dist/bundles/index.js +0 -8
- package/dist/bundles/vibecheck-core.js +0 -25799
- package/dist/bundles/vibecheck-security.js +0 -208693
- package/dist/bundles/vibecheck-ship.js +0 -2318
- package/dist/commands/baseline.d.ts +0 -7
- package/dist/commands/baseline.d.ts.map +0 -1
- package/dist/commands/baseline.js +0 -79
- package/dist/commands/baseline.js.map +0 -1
- package/dist/commands/cache.d.ts +0 -13
- package/dist/commands/cache.d.ts.map +0 -1
- package/dist/commands/cache.js +0 -165
- package/dist/commands/cache.js.map +0 -1
- package/dist/commands/checkpoint.d.ts +0 -8
- package/dist/commands/checkpoint.d.ts.map +0 -1
- package/dist/commands/checkpoint.js +0 -35
- package/dist/commands/checkpoint.js.map +0 -1
- package/dist/commands/doctor.d.ts +0 -17
- package/dist/commands/doctor.d.ts.map +0 -1
- package/dist/commands/doctor.js +0 -226
- package/dist/commands/doctor.js.map +0 -1
- package/dist/commands/evidence.d.ts +0 -45
- package/dist/commands/evidence.d.ts.map +0 -1
- package/dist/commands/evidence.js +0 -197
- package/dist/commands/evidence.js.map +0 -1
- package/dist/commands/explain.d.ts +0 -8
- package/dist/commands/explain.d.ts.map +0 -1
- package/dist/commands/explain.js +0 -52
- package/dist/commands/explain.js.map +0 -1
- package/dist/commands/fix-consolidated.d.ts +0 -19
- package/dist/commands/fix-consolidated.d.ts.map +0 -1
- package/dist/commands/fix-consolidated.js +0 -165
- package/dist/commands/fix-consolidated.js.map +0 -1
- package/dist/commands/index.d.ts +0 -8
- package/dist/commands/index.d.ts.map +0 -1
- package/dist/commands/index.js +0 -15
- package/dist/commands/index.js.map +0 -1
- package/dist/commands/init.d.ts +0 -8
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/init.js +0 -125
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/launcher.d.ts +0 -10
- package/dist/commands/launcher.d.ts.map +0 -1
- package/dist/commands/launcher.js +0 -174
- package/dist/commands/launcher.js.map +0 -1
- package/dist/commands/on.d.ts +0 -8
- package/dist/commands/on.d.ts.map +0 -1
- package/dist/commands/on.js +0 -123
- package/dist/commands/on.js.map +0 -1
- package/dist/commands/replay.d.ts +0 -8
- package/dist/commands/replay.d.ts.map +0 -1
- package/dist/commands/replay.js +0 -52
- package/dist/commands/replay.js.map +0 -1
- package/dist/commands/scan-consolidated.d.ts +0 -61
- package/dist/commands/scan-consolidated.d.ts.map +0 -1
- package/dist/commands/scan-consolidated.js +0 -243
- package/dist/commands/scan-consolidated.js.map +0 -1
- package/dist/commands/scan-secrets.d.ts +0 -47
- package/dist/commands/scan-secrets.d.ts.map +0 -1
- package/dist/commands/scan-secrets.js +0 -225
- package/dist/commands/scan-secrets.js.map +0 -1
- package/dist/commands/scan-vulnerabilities-enhanced.d.ts +0 -41
- package/dist/commands/scan-vulnerabilities-enhanced.d.ts.map +0 -1
- package/dist/commands/scan-vulnerabilities-enhanced.js +0 -368
- package/dist/commands/scan-vulnerabilities-enhanced.js.map +0 -1
- package/dist/commands/scan-vulnerabilities-osv.d.ts +0 -58
- package/dist/commands/scan-vulnerabilities-osv.d.ts.map +0 -1
- package/dist/commands/scan-vulnerabilities-osv.js +0 -722
- package/dist/commands/scan-vulnerabilities-osv.js.map +0 -1
- package/dist/commands/scan-vulnerabilities.d.ts +0 -32
- package/dist/commands/scan-vulnerabilities.d.ts.map +0 -1
- package/dist/commands/scan-vulnerabilities.js +0 -283
- package/dist/commands/scan-vulnerabilities.js.map +0 -1
- package/dist/commands/secrets-allowlist.d.ts +0 -7
- package/dist/commands/secrets-allowlist.d.ts.map +0 -1
- package/dist/commands/secrets-allowlist.js +0 -85
- package/dist/commands/secrets-allowlist.js.map +0 -1
- package/dist/commands/ship-consolidated.d.ts +0 -58
- package/dist/commands/ship-consolidated.d.ts.map +0 -1
- package/dist/commands/ship-consolidated.js +0 -515
- package/dist/commands/ship-consolidated.js.map +0 -1
- package/dist/commands/stats.d.ts +0 -8
- package/dist/commands/stats.d.ts.map +0 -1
- package/dist/commands/stats.js +0 -134
- package/dist/commands/stats.js.map +0 -1
- package/dist/commands/upgrade.d.ts +0 -8
- package/dist/commands/upgrade.d.ts.map +0 -1
- package/dist/commands/upgrade.js +0 -30
- package/dist/commands/upgrade.js.map +0 -1
- package/dist/fix/applicator.d.ts +0 -44
- package/dist/fix/applicator.d.ts.map +0 -1
- package/dist/fix/applicator.js +0 -144
- package/dist/fix/applicator.js.map +0 -1
- package/dist/fix/backup.d.ts +0 -38
- package/dist/fix/backup.d.ts.map +0 -1
- package/dist/fix/backup.js +0 -154
- package/dist/fix/backup.js.map +0 -1
- package/dist/fix/engine.d.ts +0 -55
- package/dist/fix/engine.d.ts.map +0 -1
- package/dist/fix/engine.js +0 -285
- package/dist/fix/engine.js.map +0 -1
- package/dist/fix/index.d.ts +0 -5
- package/dist/fix/index.d.ts.map +0 -1
- package/dist/fix/index.js +0 -12
- package/dist/fix/index.js.map +0 -1
- package/dist/fix/interactive.d.ts +0 -22
- package/dist/fix/interactive.d.ts.map +0 -1
- package/dist/fix/interactive.js +0 -172
- package/dist/fix/interactive.js.map +0 -1
- package/dist/formatters/index.d.ts +0 -6
- package/dist/formatters/index.d.ts.map +0 -1
- package/dist/formatters/index.js +0 -11
- package/dist/formatters/index.js.map +0 -1
- package/dist/formatters/sarif-enhanced.d.ts +0 -78
- package/dist/formatters/sarif-enhanced.d.ts.map +0 -1
- package/dist/formatters/sarif-enhanced.js +0 -144
- package/dist/formatters/sarif-enhanced.js.map +0 -1
- package/dist/formatters/sarif-v2.d.ts +0 -121
- package/dist/formatters/sarif-v2.d.ts.map +0 -1
- package/dist/formatters/sarif-v2.js +0 -356
- package/dist/formatters/sarif-v2.js.map +0 -1
- package/dist/formatters/sarif.d.ts +0 -72
- package/dist/formatters/sarif.d.ts.map +0 -1
- package/dist/formatters/sarif.js +0 -146
- package/dist/formatters/sarif.js.map +0 -1
- package/dist/index.d.ts +0 -61
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -4388
- package/dist/index.js.map +0 -1
- package/dist/init/ci-generator.d.ts +0 -18
- package/dist/init/ci-generator.d.ts.map +0 -1
- package/dist/init/ci-generator.js +0 -317
- package/dist/init/ci-generator.js.map +0 -1
- package/dist/init/detect-framework.d.ts +0 -15
- package/dist/init/detect-framework.d.ts.map +0 -1
- package/dist/init/detect-framework.js +0 -301
- package/dist/init/detect-framework.js.map +0 -1
- package/dist/init/hooks-installer.d.ts +0 -22
- package/dist/init/hooks-installer.d.ts.map +0 -1
- package/dist/init/hooks-installer.js +0 -310
- package/dist/init/hooks-installer.js.map +0 -1
- package/dist/init/index.d.ts +0 -8
- package/dist/init/index.d.ts.map +0 -1
- package/dist/init/index.js +0 -22
- package/dist/init/index.js.map +0 -1
- package/dist/init/templates.d.ts +0 -402
- package/dist/init/templates.d.ts.map +0 -1
- package/dist/init/templates.js +0 -240
- package/dist/init/templates.js.map +0 -1
- package/dist/mcp/server.d.ts +0 -12
- package/dist/mcp/server.d.ts.map +0 -1
- package/dist/mcp/server.js +0 -42
- package/dist/mcp/server.js.map +0 -1
- package/dist/mcp/telemetry.d.ts +0 -40
- package/dist/mcp/telemetry.d.ts.map +0 -1
- package/dist/mcp/telemetry.js +0 -98
- package/dist/mcp/telemetry.js.map +0 -1
- package/dist/reality/no-dead-buttons/button-sweep-generator.d.ts +0 -32
- package/dist/reality/no-dead-buttons/button-sweep-generator.d.ts.map +0 -1
- package/dist/reality/no-dead-buttons/button-sweep-generator.js +0 -236
- package/dist/reality/no-dead-buttons/button-sweep-generator.js.map +0 -1
- package/dist/reality/no-dead-buttons/index.d.ts +0 -11
- package/dist/reality/no-dead-buttons/index.d.ts.map +0 -1
- package/dist/reality/no-dead-buttons/index.js +0 -18
- package/dist/reality/no-dead-buttons/index.js.map +0 -1
- package/dist/reality/no-dead-buttons/static-scanner.d.ts +0 -34
- package/dist/reality/no-dead-buttons/static-scanner.d.ts.map +0 -1
- package/dist/reality/no-dead-buttons/static-scanner.js +0 -230
- package/dist/reality/no-dead-buttons/static-scanner.js.map +0 -1
- package/dist/reality/reality-graph.d.ts +0 -192
- package/dist/reality/reality-graph.d.ts.map +0 -1
- package/dist/reality/reality-graph.js +0 -600
- package/dist/reality/reality-graph.js.map +0 -1
- package/dist/reality/reality-runner.d.ts +0 -89
- package/dist/reality/reality-runner.d.ts.map +0 -1
- package/dist/reality/reality-runner.js +0 -540
- package/dist/reality/reality-runner.js.map +0 -1
- package/dist/reality/receipt-generator.d.ts +0 -152
- package/dist/reality/receipt-generator.d.ts.map +0 -1
- package/dist/reality/receipt-generator.js +0 -495
- package/dist/reality/receipt-generator.js.map +0 -1
- package/dist/reality/runtime-tracer.d.ts +0 -75
- package/dist/reality/runtime-tracer.d.ts.map +0 -1
- package/dist/reality/runtime-tracer.js +0 -109
- package/dist/reality/runtime-tracer.js.map +0 -1
- package/dist/runtime/auth-utils.d.ts +0 -43
- package/dist/runtime/auth-utils.d.ts.map +0 -1
- package/dist/runtime/auth-utils.js +0 -130
- package/dist/runtime/auth-utils.js.map +0 -1
- package/dist/runtime/client.d.ts +0 -74
- package/dist/runtime/client.d.ts.map +0 -1
- package/dist/runtime/client.js +0 -222
- package/dist/runtime/client.js.map +0 -1
- package/dist/runtime/creds.d.ts +0 -48
- package/dist/runtime/creds.d.ts.map +0 -1
- package/dist/runtime/creds.js +0 -245
- package/dist/runtime/creds.js.map +0 -1
- package/dist/runtime/exit-codes.d.ts +0 -49
- package/dist/runtime/exit-codes.d.ts.map +0 -1
- package/dist/runtime/exit-codes.js +0 -93
- package/dist/runtime/exit-codes.js.map +0 -1
- package/dist/runtime/index.d.ts +0 -9
- package/dist/runtime/index.d.ts.map +0 -1
- package/dist/runtime/index.js +0 -25
- package/dist/runtime/index.js.map +0 -1
- package/dist/runtime/json-output.d.ts +0 -42
- package/dist/runtime/json-output.d.ts.map +0 -1
- package/dist/runtime/json-output.js +0 -59
- package/dist/runtime/json-output.js.map +0 -1
- package/dist/runtime/semver.d.ts +0 -37
- package/dist/runtime/semver.d.ts.map +0 -1
- package/dist/runtime/semver.js +0 -110
- package/dist/runtime/semver.js.map +0 -1
- package/dist/scan/dead-ui-detector.d.ts +0 -48
- package/dist/scan/dead-ui-detector.d.ts.map +0 -1
- package/dist/scan/dead-ui-detector.js +0 -170
- package/dist/scan/dead-ui-detector.js.map +0 -1
- package/dist/scan/playwright-sweep.d.ts +0 -40
- package/dist/scan/playwright-sweep.d.ts.map +0 -1
- package/dist/scan/playwright-sweep.js +0 -216
- package/dist/scan/playwright-sweep.js.map +0 -1
- package/dist/scan/proof-bundle.d.ts +0 -25
- package/dist/scan/proof-bundle.d.ts.map +0 -1
- package/dist/scan/proof-bundle.js +0 -203
- package/dist/scan/proof-bundle.js.map +0 -1
- package/dist/scan/proof-graph.d.ts +0 -59
- package/dist/scan/proof-graph.d.ts.map +0 -1
- package/dist/scan/proof-graph.js +0 -64
- package/dist/scan/proof-graph.js.map +0 -1
- package/dist/scan/reality-sniff.d.ts +0 -56
- package/dist/scan/reality-sniff.d.ts.map +0 -1
- package/dist/scan/reality-sniff.js +0 -200
- package/dist/scan/reality-sniff.js.map +0 -1
- package/dist/scan/structural-verifier.d.ts +0 -20
- package/dist/scan/structural-verifier.d.ts.map +0 -1
- package/dist/scan/structural-verifier.js +0 -112
- package/dist/scan/structural-verifier.js.map +0 -1
- package/dist/scan/verification-engine.d.ts +0 -47
- package/dist/scan/verification-engine.d.ts.map +0 -1
- package/dist/scan/verification-engine.js +0 -141
- package/dist/scan/verification-engine.js.map +0 -1
- package/dist/scanner/baseline.d.ts +0 -52
- package/dist/scanner/baseline.d.ts.map +0 -1
- package/dist/scanner/baseline.js +0 -85
- package/dist/scanner/baseline.js.map +0 -1
- package/dist/scanner/incremental.d.ts +0 -30
- package/dist/scanner/incremental.d.ts.map +0 -1
- package/dist/scanner/incremental.js +0 -82
- package/dist/scanner/incremental.js.map +0 -1
- package/dist/scanner/parallel.d.ts +0 -43
- package/dist/scanner/parallel.d.ts.map +0 -1
- package/dist/scanner/parallel.js +0 -99
- package/dist/scanner/parallel.js.map +0 -1
- package/dist/standalone.d.ts +0 -1
- package/dist/standalone.d.ts.map +0 -1
- package/dist/standalone.js +0 -1
- package/dist/standalone.js.map +0 -1
- package/dist/truth-pack/index.d.ts +0 -102
- package/dist/truth-pack/index.d.ts.map +0 -1
- package/dist/truth-pack/index.js +0 -694
- package/dist/truth-pack/index.js.map +0 -1
- package/dist/ui/frame.d.ts +0 -68
- package/dist/ui/frame.d.ts.map +0 -1
- package/dist/ui/frame.js +0 -165
- package/dist/ui/frame.js.map +0 -1
- package/dist/ui/index.d.ts +0 -5
- package/dist/ui/index.d.ts.map +0 -1
- package/dist/ui/index.js +0 -16
- package/dist/ui/index.js.map +0 -1
- package/dist/ui.d.ts +0 -36
- package/dist/ui.d.ts.map +0 -1
- package/dist/ui.js +0 -45
- package/dist/ui.js.map +0 -1
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompt Firewall Runner
|
|
3
|
+
*
|
|
4
|
+
* Processes prompts through the advanced firewall with:
|
|
5
|
+
* - Task breakdown
|
|
6
|
+
* - Verification
|
|
7
|
+
* - Version control integration
|
|
8
|
+
* - Immediate fixes
|
|
9
|
+
* - Future planning
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const path = require("path");
|
|
13
|
+
const readline = require("readline");
|
|
14
|
+
const { withErrorHandling } = require("./lib/error-handler");
|
|
15
|
+
|
|
16
|
+
// ANSI colors
|
|
17
|
+
const c = {
|
|
18
|
+
reset: "\x1b[0m",
|
|
19
|
+
bold: "\x1b[1m",
|
|
20
|
+
dim: "\x1b[2m",
|
|
21
|
+
red: "\x1b[31m",
|
|
22
|
+
green: "\x1b[32m",
|
|
23
|
+
yellow: "\x1b[33m",
|
|
24
|
+
blue: "\x1b[34m",
|
|
25
|
+
magenta: "\x1b[35m",
|
|
26
|
+
cyan: "\x1b[36m",
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
async function runPromptFirewall(args) {
|
|
30
|
+
return withErrorHandling(async () => {
|
|
31
|
+
const projectPath = args.path || process.cwd();
|
|
32
|
+
const json = args.json || false;
|
|
33
|
+
const prompt = args.prompt || args._[0];
|
|
34
|
+
const autoFix = args["auto-fix"] === true;
|
|
35
|
+
const includeVersionControl = args["version-control"] !== false;
|
|
36
|
+
const generatePlan = args.plan !== false;
|
|
37
|
+
|
|
38
|
+
if (!prompt) {
|
|
39
|
+
console.error(`${c.red}Error: Prompt is required${c.reset}`);
|
|
40
|
+
console.error(`Usage: vibecheck prompt-firewall "your prompt here"`);
|
|
41
|
+
console.error(` or: vibecheck prompt-firewall --prompt "your prompt here"`);
|
|
42
|
+
const { EXIT_CODES } = require('./lib/error-handler');
|
|
43
|
+
process.exit(EXIT_CODES.INVALID_INPUT);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Try to load prompt firewall
|
|
47
|
+
let createPromptFirewall;
|
|
48
|
+
try {
|
|
49
|
+
const modulePath = path.resolve(__dirname, "../../packages/ai-vibechecks/dist/firewall/advanced-prompt-firewall.js");
|
|
50
|
+
createPromptFirewall = require(modulePath).createPromptFirewall;
|
|
51
|
+
} catch {
|
|
52
|
+
try {
|
|
53
|
+
const tsModulePath = path.resolve(__dirname, "../../packages/ai-vibechecks/src/firewall/advanced-prompt-firewall.ts");
|
|
54
|
+
require("ts-node/register");
|
|
55
|
+
createPromptFirewall = require(tsModulePath).createPromptFirewall;
|
|
56
|
+
} catch {
|
|
57
|
+
console.error(`${c.red}Error: Prompt firewall not available.${c.reset}`);
|
|
58
|
+
console.error(`Please run: pnpm build in packages/ai-vibechecks`);
|
|
59
|
+
const { EXIT_CODES } = require('./lib/error-handler');
|
|
60
|
+
process.exit(EXIT_CODES.INTERNAL_ERROR);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (!json) {
|
|
65
|
+
console.log(`${c.cyan}${c.bold}━━━ Prompt Firewall Analysis ━━━${c.reset}\n`);
|
|
66
|
+
console.log(`Prompt: ${c.dim}${prompt}${c.reset}\n`);
|
|
67
|
+
console.log(`Project: ${path.relative(process.cwd(), projectPath)}\n`);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Create firewall instance
|
|
71
|
+
const firewall = createPromptFirewall(projectPath);
|
|
72
|
+
|
|
73
|
+
// Process prompt
|
|
74
|
+
const result = await firewall.process(prompt, {
|
|
75
|
+
autoBreakdown: true,
|
|
76
|
+
autoVerify: true,
|
|
77
|
+
autoFix: autoFix,
|
|
78
|
+
includeVersionControl: includeVersionControl,
|
|
79
|
+
generatePlan: generatePlan,
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
// Output results
|
|
83
|
+
if (json) {
|
|
84
|
+
console.log(JSON.stringify(result, null, 2));
|
|
85
|
+
return result.verification.passed ? 0 : 1;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Print formatted report
|
|
89
|
+
printFirewallReport(result);
|
|
90
|
+
|
|
91
|
+
// Ask to apply fixes if available
|
|
92
|
+
if (result.immediateFixes.length > 0 && !autoFix) {
|
|
93
|
+
const shouldApply = await askToApplyFixes(result.immediateFixes.length);
|
|
94
|
+
if (shouldApply) {
|
|
95
|
+
console.log(`\n${c.cyan}Applying fixes...${c.reset}\n`);
|
|
96
|
+
for (const fix of result.immediateFixes) {
|
|
97
|
+
const applyResult = await firewall.applyFix(fix);
|
|
98
|
+
if (applyResult.success) {
|
|
99
|
+
console.log(`${c.green}✅${c.reset} ${applyResult.message}`);
|
|
100
|
+
} else {
|
|
101
|
+
console.log(`${c.red}❌${c.reset} ${applyResult.message}`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return result.verification.passed ? 0 : 1;
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function printFirewallReport(result) {
|
|
112
|
+
// Verification status
|
|
113
|
+
const statusColor = result.verification.passed ? c.green : c.red;
|
|
114
|
+
const statusIcon = result.verification.passed ? "✅" : "❌";
|
|
115
|
+
|
|
116
|
+
console.log(`${statusColor}${c.bold}${statusIcon} VERIFICATION: ${result.verification.passed ? "PASSED" : "FAILED"}${c.reset}`);
|
|
117
|
+
console.log(` Score: ${result.verification.score}/100`);
|
|
118
|
+
console.log();
|
|
119
|
+
|
|
120
|
+
// Verification checks
|
|
121
|
+
console.log(`${c.cyan}${c.bold}🔍 VERIFICATION CHECKS:${c.reset}`);
|
|
122
|
+
for (const check of result.verification.checks) {
|
|
123
|
+
const icon = check.status === "pass" ? "✅" :
|
|
124
|
+
check.status === "fail" ? "❌" : "⚠️";
|
|
125
|
+
const checkColor = check.status === "pass" ? c.green :
|
|
126
|
+
check.status === "fail" ? c.red : c.yellow;
|
|
127
|
+
console.log(` ${icon} ${check.name}: ${checkColor}${check.status.toUpperCase()}${c.reset}`);
|
|
128
|
+
console.log(` ${c.dim}${check.message}${c.reset}`);
|
|
129
|
+
if (check.evidence) {
|
|
130
|
+
console.log(` Evidence: ${c.dim}${check.evidence}${c.reset}`);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
console.log();
|
|
134
|
+
|
|
135
|
+
// Task breakdown
|
|
136
|
+
if (result.taskBreakdown.length > 0) {
|
|
137
|
+
console.log(`${c.cyan}${c.bold}📋 TASK BREAKDOWN:${c.reset}`);
|
|
138
|
+
for (const task of result.taskBreakdown) {
|
|
139
|
+
const priorityColor = task.priority === "critical" ? c.red :
|
|
140
|
+
task.priority === "high" ? c.yellow :
|
|
141
|
+
task.priority === "medium" ? c.blue : c.dim;
|
|
142
|
+
console.log(` ${priorityColor}[${task.priority.toUpperCase()}]${c.reset} ${task.title}`);
|
|
143
|
+
console.log(` ${c.dim}${task.description}${c.reset}`);
|
|
144
|
+
console.log(` Estimated time: ${task.estimatedTime.toFixed(0)} minutes`);
|
|
145
|
+
if (task.dependencies.length > 0) {
|
|
146
|
+
console.log(` Depends on: ${task.dependencies.join(", ")}`);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
console.log();
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// Version control info
|
|
153
|
+
if (result.versionControl && result.versionControl.branch !== "unknown") {
|
|
154
|
+
console.log(`${c.cyan}${c.bold}🔀 VERSION CONTROL:${c.reset}`);
|
|
155
|
+
console.log(` Branch: ${result.versionControl.branch}`);
|
|
156
|
+
console.log(` Commit: ${result.versionControl.commit.substring(0, 8)}`);
|
|
157
|
+
console.log(` Changes: ${result.versionControl.changes.length} file(s)`);
|
|
158
|
+
if (result.versionControl.conflicts.length > 0) {
|
|
159
|
+
console.log(` ${c.red}Conflicts: ${result.versionControl.conflicts.length}${c.reset}`);
|
|
160
|
+
}
|
|
161
|
+
console.log();
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// Immediate fixes
|
|
165
|
+
if (result.immediateFixes.length > 0) {
|
|
166
|
+
console.log(`${c.yellow}${c.bold}🔧 IMMEDIATE FIXES AVAILABLE:${c.reset}`);
|
|
167
|
+
for (const fix of result.immediateFixes) {
|
|
168
|
+
console.log(` • ${fix.description}`);
|
|
169
|
+
console.log(` File: ${fix.file}`);
|
|
170
|
+
console.log(` Confidence: ${(fix.confidence * 100).toFixed(0)}%`);
|
|
171
|
+
}
|
|
172
|
+
console.log();
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// Future plan
|
|
176
|
+
if (result.futurePlan && result.futurePlan.tasks.length > 0) {
|
|
177
|
+
console.log(`${c.cyan}${c.bold}📅 FUTURE PLAN:${c.reset}`);
|
|
178
|
+
console.log(` Phase: ${result.futurePlan.phase}`);
|
|
179
|
+
console.log(` Tasks: ${result.futurePlan.tasks.length}`);
|
|
180
|
+
console.log(` Milestones: ${result.futurePlan.milestones.length}`);
|
|
181
|
+
if (result.futurePlan.risks.length > 0) {
|
|
182
|
+
console.log(` ${c.yellow}Risks: ${result.futurePlan.risks.length}${c.reset}`);
|
|
183
|
+
}
|
|
184
|
+
console.log();
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// Recommendations
|
|
188
|
+
if (result.recommendations.length > 0) {
|
|
189
|
+
console.log(`${c.cyan}${c.bold}💡 RECOMMENDATIONS:${c.reset}`);
|
|
190
|
+
for (const rec of result.recommendations) {
|
|
191
|
+
console.log(` • ${rec}`);
|
|
192
|
+
}
|
|
193
|
+
console.log();
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function askToApplyFixes(fixCount) {
|
|
198
|
+
return new Promise((resolve) => {
|
|
199
|
+
const rl = readline.createInterface({
|
|
200
|
+
input: process.stdin,
|
|
201
|
+
output: process.stdout,
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
rl.question(`${c.yellow}Apply ${fixCount} immediate fix(es)? (y/n): ${c.reset}`, (answer) => {
|
|
205
|
+
rl.close();
|
|
206
|
+
resolve(answer.toLowerCase() === "y" || answer.toLowerCase() === "yes");
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
module.exports = { runPromptFirewall };
|
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vibecheck prove - One Command Reality Proof
|
|
3
|
+
*
|
|
4
|
+
* Orchestrates the complete "make it real" loop:
|
|
5
|
+
* 1. ctx - Refresh truthpack
|
|
6
|
+
* 2. reality --verify-auth - Runtime proof
|
|
7
|
+
* 3. ship - Static + runtime verdict
|
|
8
|
+
* 4. If BLOCK: fix --autopilot --apply
|
|
9
|
+
* 5. Re-run reality + ship to confirm SHIP
|
|
10
|
+
*
|
|
11
|
+
* One command = one outcome: either it's real, or it keeps fixing until it is.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
"use strict";
|
|
15
|
+
|
|
16
|
+
const fs = require("fs");
|
|
17
|
+
const path = require("path");
|
|
18
|
+
const { buildTruthpack, writeTruthpack, detectFastifyEntry } = require("./lib/truth");
|
|
19
|
+
const { shipCore } = require("./runShip");
|
|
20
|
+
|
|
21
|
+
let runReality;
|
|
22
|
+
try {
|
|
23
|
+
runReality = require("./runReality").runReality;
|
|
24
|
+
} catch {
|
|
25
|
+
runReality = null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
let runFixCore;
|
|
29
|
+
try {
|
|
30
|
+
runFixCore = require("./runFix").runFixCore;
|
|
31
|
+
} catch {
|
|
32
|
+
runFixCore = null;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const c = {
|
|
36
|
+
reset: "\x1b[0m",
|
|
37
|
+
bold: "\x1b[1m",
|
|
38
|
+
dim: "\x1b[2m",
|
|
39
|
+
red: "\x1b[31m",
|
|
40
|
+
green: "\x1b[32m",
|
|
41
|
+
yellow: "\x1b[33m",
|
|
42
|
+
cyan: "\x1b[36m",
|
|
43
|
+
blue: "\x1b[34m",
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
function ensureDir(p) {
|
|
47
|
+
fs.mkdirSync(p, { recursive: true });
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function stamp() {
|
|
51
|
+
const d = new Date();
|
|
52
|
+
const z = (n) => String(n).padStart(2, "0");
|
|
53
|
+
return `${d.getFullYear()}${z(d.getMonth() + 1)}${z(d.getDate())}_${z(d.getHours())}${z(d.getMinutes())}${z(d.getSeconds())}`;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async function runProve({
|
|
57
|
+
repoRoot,
|
|
58
|
+
url,
|
|
59
|
+
auth,
|
|
60
|
+
storageState,
|
|
61
|
+
fastifyEntry,
|
|
62
|
+
maxFixRounds = 3,
|
|
63
|
+
maxMissions = 8,
|
|
64
|
+
maxSteps = 10,
|
|
65
|
+
skipReality = false,
|
|
66
|
+
skipFix = false,
|
|
67
|
+
headed = false,
|
|
68
|
+
danger = false,
|
|
69
|
+
maxPages = 18,
|
|
70
|
+
maxDepth = 2,
|
|
71
|
+
timeoutMs = 15000
|
|
72
|
+
} = {}) {
|
|
73
|
+
const root = repoRoot || process.cwd();
|
|
74
|
+
const startTime = Date.now();
|
|
75
|
+
|
|
76
|
+
console.log(`
|
|
77
|
+
${c.cyan}${c.bold}╔════════════════════════════════════════════════════════════╗
|
|
78
|
+
║ 🔬 vibecheck prove ║
|
|
79
|
+
║ One command to make it real ║
|
|
80
|
+
╚════════════════════════════════════════════════════════════╝${c.reset}
|
|
81
|
+
`);
|
|
82
|
+
|
|
83
|
+
const outDir = path.join(root, ".vibecheck", "prove", stamp());
|
|
84
|
+
ensureDir(outDir);
|
|
85
|
+
|
|
86
|
+
const timeline = [];
|
|
87
|
+
let finalVerdict = "UNKNOWN";
|
|
88
|
+
|
|
89
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
90
|
+
// STEP 1: CTX - Refresh truthpack
|
|
91
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
92
|
+
console.log(`${c.cyan}▶ Step 1: Refreshing context (truthpack)...${c.reset}`);
|
|
93
|
+
|
|
94
|
+
try {
|
|
95
|
+
const fastEntry = fastifyEntry || (await detectFastifyEntry(root));
|
|
96
|
+
const truthpack = await buildTruthpack({ repoRoot: root, fastifyEntry: fastEntry });
|
|
97
|
+
writeTruthpack(root, truthpack);
|
|
98
|
+
|
|
99
|
+
timeline.push({
|
|
100
|
+
step: 1,
|
|
101
|
+
action: "ctx",
|
|
102
|
+
status: "ok",
|
|
103
|
+
routes: truthpack.routes?.server?.length || 0,
|
|
104
|
+
envVars: truthpack.env?.vars?.length || 0
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
console.log(` ${c.green}✓${c.reset} Truthpack refreshed (${truthpack.routes?.server?.length || 0} routes, ${truthpack.env?.vars?.length || 0} env vars)`);
|
|
108
|
+
} catch (err) {
|
|
109
|
+
timeline.push({ step: 1, action: "ctx", status: "error", error: err.message });
|
|
110
|
+
console.log(` ${c.yellow}⚠️ Context refresh failed: ${err.message}${c.reset}`);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
114
|
+
// STEP 2: REALITY - Runtime UI proof (if URL provided)
|
|
115
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
116
|
+
if (url && !skipReality && runReality) {
|
|
117
|
+
console.log(`\n${c.cyan}▶ Step 2: Running reality check (${url})...${c.reset}`);
|
|
118
|
+
|
|
119
|
+
try {
|
|
120
|
+
await runReality({
|
|
121
|
+
repoRoot: root,
|
|
122
|
+
url,
|
|
123
|
+
auth,
|
|
124
|
+
storageState,
|
|
125
|
+
verifyAuth: !!auth || !!storageState,
|
|
126
|
+
headed,
|
|
127
|
+
maxPages,
|
|
128
|
+
maxDepth,
|
|
129
|
+
danger,
|
|
130
|
+
timeoutMs
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
// Read reality report for timeline
|
|
134
|
+
const realityPath = path.join(root, ".vibecheck", "reality", "last_reality.json");
|
|
135
|
+
if (fs.existsSync(realityPath)) {
|
|
136
|
+
const reality = JSON.parse(fs.readFileSync(realityPath, "utf8"));
|
|
137
|
+
const blocks = (reality.findings || []).filter(f => f.severity === "BLOCK").length;
|
|
138
|
+
const warns = (reality.findings || []).filter(f => f.severity === "WARN").length;
|
|
139
|
+
|
|
140
|
+
timeline.push({
|
|
141
|
+
step: 2,
|
|
142
|
+
action: "reality",
|
|
143
|
+
status: blocks ? "BLOCK" : warns ? "WARN" : "CLEAN",
|
|
144
|
+
findings: { BLOCK: blocks, WARN: warns },
|
|
145
|
+
pagesVisited: reality.passes?.anon?.pagesVisited?.length || 0,
|
|
146
|
+
coverage: reality.coverage?.percent || null
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
console.log(` ${c.green}✓${c.reset} Reality check complete (${blocks} BLOCK, ${warns} WARN)`);
|
|
150
|
+
if (reality.coverage) {
|
|
151
|
+
console.log(` ${c.dim}Coverage: ${reality.coverage.percent}% of UI paths${c.reset}`);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
} catch (err) {
|
|
155
|
+
timeline.push({ step: 2, action: "reality", status: "error", error: err.message });
|
|
156
|
+
console.log(` ${c.yellow}⚠️ Reality check failed: ${err.message}${c.reset}`);
|
|
157
|
+
}
|
|
158
|
+
} else if (!url) {
|
|
159
|
+
console.log(`\n${c.dim}▶ Step 2: Skipping reality (no --url provided)${c.reset}`);
|
|
160
|
+
timeline.push({ step: 2, action: "reality", status: "skipped", reason: "no URL" });
|
|
161
|
+
} else if (skipReality) {
|
|
162
|
+
console.log(`\n${c.dim}▶ Step 2: Skipping reality (--skip-reality)${c.reset}`);
|
|
163
|
+
timeline.push({ step: 2, action: "reality", status: "skipped", reason: "--skip-reality" });
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
167
|
+
// STEP 3: SHIP - Get initial verdict
|
|
168
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
169
|
+
console.log(`\n${c.cyan}▶ Step 3: Running ship check...${c.reset}`);
|
|
170
|
+
|
|
171
|
+
let shipResult = await shipCore({ repoRoot: root, fastifyEntry, noWrite: false });
|
|
172
|
+
|
|
173
|
+
timeline.push({
|
|
174
|
+
step: 3,
|
|
175
|
+
action: "ship",
|
|
176
|
+
verdict: shipResult.verdict,
|
|
177
|
+
findingsCount: shipResult.report?.findings?.length || 0
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
const verdictColor = shipResult.verdict === "SHIP" ? c.green : shipResult.verdict === "WARN" ? c.yellow : c.red;
|
|
181
|
+
console.log(` ${verdictColor}${shipResult.verdict}${c.reset} (${shipResult.report?.findings?.length || 0} findings)`);
|
|
182
|
+
|
|
183
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
184
|
+
// STEP 4: FIX LOOP - If BLOCK, attempt autopilot fix
|
|
185
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
186
|
+
let fixRound = 0;
|
|
187
|
+
|
|
188
|
+
while (shipResult.verdict === "BLOCK" && !skipFix && fixRound < maxFixRounds) {
|
|
189
|
+
fixRound++;
|
|
190
|
+
console.log(`\n${c.cyan}▶ Step 4.${fixRound}: Fix round ${fixRound}/${maxFixRounds}...${c.reset}`);
|
|
191
|
+
|
|
192
|
+
try {
|
|
193
|
+
// Import fix dependencies lazily
|
|
194
|
+
const { planMissions } = require("./lib/missions/plan");
|
|
195
|
+
const { templateForMissionType } = require("./lib/missions/templates");
|
|
196
|
+
const { expandEvidence } = require("./lib/missions/evidence");
|
|
197
|
+
const { buildRealityFirewall } = require("./lib/firewall-prompt");
|
|
198
|
+
const { generatePatchJson } = require("./lib/llm");
|
|
199
|
+
const { applyUnifiedDiff } = require("./lib/patch");
|
|
200
|
+
const { backupFiles, restoreBackup } = require("./lib/backup");
|
|
201
|
+
const { validatePatchResponse } = require("./lib/validate-patch");
|
|
202
|
+
|
|
203
|
+
const findings = shipResult.report?.findings || [];
|
|
204
|
+
const missions = planMissions(findings, { maxMissions, blocksOnlyFirst: true });
|
|
205
|
+
|
|
206
|
+
if (!missions.length) {
|
|
207
|
+
console.log(` ${c.yellow}No fixable missions found.${c.reset}`);
|
|
208
|
+
timeline.push({ step: `4.${fixRound}`, action: "fix", status: "no_missions" });
|
|
209
|
+
break;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
console.log(` Planning ${missions.length} missions...`);
|
|
213
|
+
|
|
214
|
+
let fixedAny = false;
|
|
215
|
+
|
|
216
|
+
for (const mission of missions.slice(0, 3)) {
|
|
217
|
+
const targetFindings = findings.filter(f => mission.targetFindingIds.includes(f.id));
|
|
218
|
+
const template = templateForMissionType(mission.type);
|
|
219
|
+
|
|
220
|
+
const expanded = await expandEvidence({
|
|
221
|
+
repoRoot: root,
|
|
222
|
+
truthpack: shipResult.truthpack,
|
|
223
|
+
mission,
|
|
224
|
+
targetFindings
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
const prompt = buildRealityFirewall({
|
|
228
|
+
truthpackSummary: {
|
|
229
|
+
serverRoutes: shipResult.truthpack?.routes?.server?.length || 0,
|
|
230
|
+
clientRefs: shipResult.truthpack?.routes?.clientRefs?.length || 0,
|
|
231
|
+
envVars: shipResult.truthpack?.env?.vars?.length || 0
|
|
232
|
+
},
|
|
233
|
+
mission,
|
|
234
|
+
template,
|
|
235
|
+
findings: targetFindings,
|
|
236
|
+
fileSnippets: expanded.snippets,
|
|
237
|
+
allowedFiles: expanded.allowedFiles
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
console.log(` ${c.dim}Mission: ${mission.title}${c.reset}`);
|
|
241
|
+
|
|
242
|
+
try {
|
|
243
|
+
const patchResponse = await generatePatchJson(prompt);
|
|
244
|
+
|
|
245
|
+
if (!patchResponse || patchResponse.status !== "ok" || !patchResponse.edits?.length) {
|
|
246
|
+
console.log(` ${c.yellow}⚠️ No patch generated${c.reset}`);
|
|
247
|
+
continue;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
const validation = validatePatchResponse(patchResponse, {
|
|
251
|
+
allowedFiles: expanded.allowedFiles,
|
|
252
|
+
beforeTruthpack: shipResult.truthpack
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
if (!validation.valid) {
|
|
256
|
+
console.log(` ${c.yellow}⚠️ Patch validation failed: ${validation.reason}${c.reset}`);
|
|
257
|
+
continue;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
// Backup before applying
|
|
261
|
+
const touchedFiles = patchResponse.edits.map(e => e.path).filter(Boolean);
|
|
262
|
+
const backupRoot = path.join(outDir, `backup_${fixRound}_${mission.id}`);
|
|
263
|
+
backupFiles(root, touchedFiles, backupRoot);
|
|
264
|
+
|
|
265
|
+
// Apply patches
|
|
266
|
+
let appliedAny = false;
|
|
267
|
+
for (const edit of patchResponse.edits) {
|
|
268
|
+
if (!edit.diff || !edit.path) continue;
|
|
269
|
+
|
|
270
|
+
try {
|
|
271
|
+
await applyUnifiedDiff(root, edit.diff);
|
|
272
|
+
appliedAny = true;
|
|
273
|
+
console.log(` ${c.green}✓${c.reset} Applied: ${edit.path}`);
|
|
274
|
+
} catch (e) {
|
|
275
|
+
console.log(` ${c.red}✗${c.reset} Failed: ${edit.path} - ${e.message}`);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
if (appliedAny) {
|
|
280
|
+
fixedAny = true;
|
|
281
|
+
}
|
|
282
|
+
} catch (e) {
|
|
283
|
+
console.log(` ${c.yellow}⚠️ LLM error: ${e.message}${c.reset}`);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
timeline.push({
|
|
288
|
+
step: `4.${fixRound}`,
|
|
289
|
+
action: "fix",
|
|
290
|
+
status: fixedAny ? "applied" : "no_changes",
|
|
291
|
+
missionsAttempted: Math.min(missions.length, 3)
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
if (!fixedAny) {
|
|
295
|
+
console.log(` ${c.yellow}No fixes applied this round.${c.reset}`);
|
|
296
|
+
break;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
// Re-run ship to check progress
|
|
300
|
+
console.log(` Re-checking ship verdict...`);
|
|
301
|
+
shipResult = await shipCore({ repoRoot: root, fastifyEntry, noWrite: false });
|
|
302
|
+
|
|
303
|
+
const newVerdictColor = shipResult.verdict === "SHIP" ? c.green : shipResult.verdict === "WARN" ? c.yellow : c.red;
|
|
304
|
+
console.log(` ${newVerdictColor}${shipResult.verdict}${c.reset} (${shipResult.report?.findings?.length || 0} findings)`);
|
|
305
|
+
|
|
306
|
+
} catch (err) {
|
|
307
|
+
console.log(` ${c.red}Fix error: ${err.message}${c.reset}`);
|
|
308
|
+
timeline.push({ step: `4.${fixRound}`, action: "fix", status: "error", error: err.message });
|
|
309
|
+
break;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
314
|
+
// STEP 5: FINAL VERIFICATION - Re-run reality + ship
|
|
315
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
316
|
+
if (url && !skipReality && runReality && fixRound > 0) {
|
|
317
|
+
console.log(`\n${c.cyan}▶ Step 5: Final verification...${c.reset}`);
|
|
318
|
+
|
|
319
|
+
try {
|
|
320
|
+
await runReality({
|
|
321
|
+
repoRoot: root,
|
|
322
|
+
url,
|
|
323
|
+
auth,
|
|
324
|
+
storageState,
|
|
325
|
+
verifyAuth: !!auth || !!storageState,
|
|
326
|
+
headed,
|
|
327
|
+
maxPages,
|
|
328
|
+
maxDepth,
|
|
329
|
+
danger,
|
|
330
|
+
timeoutMs
|
|
331
|
+
});
|
|
332
|
+
|
|
333
|
+
shipResult = await shipCore({ repoRoot: root, fastifyEntry, noWrite: false });
|
|
334
|
+
|
|
335
|
+
timeline.push({
|
|
336
|
+
step: 5,
|
|
337
|
+
action: "verify",
|
|
338
|
+
verdict: shipResult.verdict,
|
|
339
|
+
findingsCount: shipResult.report?.findings?.length || 0
|
|
340
|
+
});
|
|
341
|
+
|
|
342
|
+
const finalColor = shipResult.verdict === "SHIP" ? c.green : shipResult.verdict === "WARN" ? c.yellow : c.red;
|
|
343
|
+
console.log(` Final verdict: ${finalColor}${shipResult.verdict}${c.reset}`);
|
|
344
|
+
} catch (err) {
|
|
345
|
+
console.log(` ${c.yellow}⚠️ Final verification failed: ${err.message}${c.reset}`);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
finalVerdict = shipResult.verdict;
|
|
350
|
+
|
|
351
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
352
|
+
// SUMMARY
|
|
353
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
354
|
+
const duration = Math.round((Date.now() - startTime) / 1000);
|
|
355
|
+
|
|
356
|
+
const report = {
|
|
357
|
+
meta: {
|
|
358
|
+
startedAt: new Date(startTime).toISOString(),
|
|
359
|
+
finishedAt: new Date().toISOString(),
|
|
360
|
+
durationSeconds: duration,
|
|
361
|
+
url: url || null,
|
|
362
|
+
fixRounds: fixRound
|
|
363
|
+
},
|
|
364
|
+
timeline,
|
|
365
|
+
finalVerdict,
|
|
366
|
+
finalFindings: shipResult.report?.findings?.length || 0
|
|
367
|
+
};
|
|
368
|
+
|
|
369
|
+
fs.writeFileSync(path.join(outDir, "prove_report.json"), JSON.stringify(report, null, 2), "utf8");
|
|
370
|
+
|
|
371
|
+
// Also save a stable pointer
|
|
372
|
+
const latestPath = path.join(root, ".vibecheck", "prove", "last_prove.json");
|
|
373
|
+
ensureDir(path.dirname(latestPath));
|
|
374
|
+
fs.writeFileSync(latestPath, JSON.stringify(report, null, 2), "utf8");
|
|
375
|
+
|
|
376
|
+
console.log(`
|
|
377
|
+
${c.cyan}${c.bold}════════════════════════════════════════════════════════════${c.reset}
|
|
378
|
+
${c.bold}PROVE COMPLETE${c.reset}
|
|
379
|
+
|
|
380
|
+
Duration: ${duration}s
|
|
381
|
+
Fix rounds: ${fixRound}
|
|
382
|
+
Final verdict: ${finalVerdict === "SHIP" ? c.green : finalVerdict === "WARN" ? c.yellow : c.red}${finalVerdict}${c.reset}
|
|
383
|
+
Findings: ${shipResult.report?.findings?.length || 0}
|
|
384
|
+
|
|
385
|
+
Report: .vibecheck/prove/${path.basename(outDir)}/prove_report.json
|
|
386
|
+
${c.cyan}════════════════════════════════════════════════════════════${c.reset}
|
|
387
|
+
`);
|
|
388
|
+
|
|
389
|
+
process.exitCode = finalVerdict === "SHIP" ? 0 : finalVerdict === "WARN" ? 1 : 2;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
module.exports = { runProve };
|