@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,308 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Init Wizard — Beautiful Guided Setup
|
|
3
|
+
*
|
|
4
|
+
* Interactive setup wizard with:
|
|
5
|
+
* - Step-by-step configuration
|
|
6
|
+
* - Project type detection
|
|
7
|
+
* - Beautiful progress indicators
|
|
8
|
+
* - Smart defaults
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const fs = require('fs');
|
|
12
|
+
const path = require('path');
|
|
13
|
+
const readline = require('readline');
|
|
14
|
+
|
|
15
|
+
// Colors
|
|
16
|
+
const c = {
|
|
17
|
+
reset: '\x1b[0m',
|
|
18
|
+
bold: '\x1b[1m',
|
|
19
|
+
dim: '\x1b[2m',
|
|
20
|
+
red: '\x1b[31m',
|
|
21
|
+
green: '\x1b[32m',
|
|
22
|
+
yellow: '\x1b[33m',
|
|
23
|
+
blue: '\x1b[34m',
|
|
24
|
+
cyan: '\x1b[36m',
|
|
25
|
+
magenta: '\x1b[35m',
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
// Project types with smart detection
|
|
29
|
+
const PROJECT_TYPES = {
|
|
30
|
+
nextjs: {
|
|
31
|
+
name: 'Next.js',
|
|
32
|
+
icon: '▲',
|
|
33
|
+
detect: (dir) => fs.existsSync(path.join(dir, 'next.config.js')) ||
|
|
34
|
+
fs.existsSync(path.join(dir, 'next.config.mjs')) ||
|
|
35
|
+
fs.existsSync(path.join(dir, 'next.config.ts')),
|
|
36
|
+
config: { framework: 'nextjs', checks: ['routes', 'auth', 'api', 'security'] },
|
|
37
|
+
},
|
|
38
|
+
react: {
|
|
39
|
+
name: 'React',
|
|
40
|
+
icon: '⚛️',
|
|
41
|
+
detect: (dir) => {
|
|
42
|
+
const pkg = loadPackageJson(dir);
|
|
43
|
+
return pkg?.dependencies?.react && !PROJECT_TYPES.nextjs.detect(dir);
|
|
44
|
+
},
|
|
45
|
+
config: { framework: 'react', checks: ['components', 'api', 'security'] },
|
|
46
|
+
},
|
|
47
|
+
fastify: {
|
|
48
|
+
name: 'Fastify',
|
|
49
|
+
icon: '⚡',
|
|
50
|
+
detect: (dir) => {
|
|
51
|
+
const pkg = loadPackageJson(dir);
|
|
52
|
+
return pkg?.dependencies?.fastify;
|
|
53
|
+
},
|
|
54
|
+
config: { framework: 'fastify', checks: ['routes', 'auth', 'api', 'security'] },
|
|
55
|
+
},
|
|
56
|
+
express: {
|
|
57
|
+
name: 'Express',
|
|
58
|
+
icon: '🚂',
|
|
59
|
+
detect: (dir) => {
|
|
60
|
+
const pkg = loadPackageJson(dir);
|
|
61
|
+
return pkg?.dependencies?.express;
|
|
62
|
+
},
|
|
63
|
+
config: { framework: 'express', checks: ['routes', 'auth', 'api', 'security'] },
|
|
64
|
+
},
|
|
65
|
+
node: {
|
|
66
|
+
name: 'Node.js',
|
|
67
|
+
icon: '🟢',
|
|
68
|
+
detect: (dir) => fs.existsSync(path.join(dir, 'package.json')),
|
|
69
|
+
config: { framework: 'node', checks: ['security', 'quality'] },
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
function loadPackageJson(dir) {
|
|
74
|
+
try {
|
|
75
|
+
return JSON.parse(fs.readFileSync(path.join(dir, 'package.json'), 'utf8'));
|
|
76
|
+
} catch {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
class InitWizard {
|
|
82
|
+
constructor(projectPath, options = {}) {
|
|
83
|
+
this.projectPath = projectPath;
|
|
84
|
+
this.options = options;
|
|
85
|
+
this.answers = {};
|
|
86
|
+
this.detectedType = null;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
async run() {
|
|
90
|
+
this.printHeader();
|
|
91
|
+
|
|
92
|
+
// Step 1: Detect project type
|
|
93
|
+
await this.detectProject();
|
|
94
|
+
|
|
95
|
+
// Step 2: Configure checks
|
|
96
|
+
await this.configureChecks();
|
|
97
|
+
|
|
98
|
+
// Step 3: Setup files
|
|
99
|
+
await this.setupFiles();
|
|
100
|
+
|
|
101
|
+
// Step 4: Print next steps
|
|
102
|
+
this.printNextSteps();
|
|
103
|
+
|
|
104
|
+
return 0;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
printHeader() {
|
|
108
|
+
console.log('');
|
|
109
|
+
console.log(`${c.cyan}╔══════════════════════════════════════════════════════════════════════╗${c.reset}`);
|
|
110
|
+
console.log(`${c.cyan}║${c.reset} ${c.cyan}║${c.reset}`);
|
|
111
|
+
console.log(`${c.cyan}║${c.reset} ${c.bold}⚡ VIBECHECK SETUP WIZARD${c.reset} ${c.cyan}║${c.reset}`);
|
|
112
|
+
console.log(`${c.cyan}║${c.reset} ${c.dim}Configure your project for production readiness checks${c.reset} ${c.cyan}║${c.reset}`);
|
|
113
|
+
console.log(`${c.cyan}║${c.reset} ${c.cyan}║${c.reset}`);
|
|
114
|
+
console.log(`${c.cyan}╚══════════════════════════════════════════════════════════════════════╝${c.reset}`);
|
|
115
|
+
console.log('');
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
async detectProject() {
|
|
119
|
+
console.log(`${c.cyan}┌─ Step 1: Project Detection ─────────────────────────────────────────┐${c.reset}`);
|
|
120
|
+
console.log(`${c.cyan}│${c.reset}`);
|
|
121
|
+
|
|
122
|
+
// Auto-detect project type
|
|
123
|
+
for (const [key, type] of Object.entries(PROJECT_TYPES)) {
|
|
124
|
+
if (type.detect(this.projectPath)) {
|
|
125
|
+
this.detectedType = { key, ...type };
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (this.detectedType) {
|
|
131
|
+
console.log(`${c.cyan}│${c.reset} ${c.green}✓${c.reset} Detected: ${c.bold}${this.detectedType.icon} ${this.detectedType.name}${c.reset}`);
|
|
132
|
+
} else {
|
|
133
|
+
console.log(`${c.cyan}│${c.reset} ${c.yellow}!${c.reset} Could not auto-detect project type`);
|
|
134
|
+
this.detectedType = { key: 'node', ...PROJECT_TYPES.node };
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// Check for package.json
|
|
138
|
+
const pkg = loadPackageJson(this.projectPath);
|
|
139
|
+
if (pkg) {
|
|
140
|
+
console.log(`${c.cyan}│${c.reset} ${c.green}✓${c.reset} Package: ${c.bold}${pkg.name || 'unnamed'}${c.reset} v${pkg.version || '0.0.0'}`);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// Check for existing config
|
|
144
|
+
const configPath = path.join(this.projectPath, '.vibecheckrc');
|
|
145
|
+
if (fs.existsSync(configPath)) {
|
|
146
|
+
console.log(`${c.cyan}│${c.reset} ${c.yellow}!${c.reset} Existing config found (will be updated)`);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
console.log(`${c.cyan}│${c.reset}`);
|
|
150
|
+
console.log(`${c.cyan}└──────────────────────────────────────────────────────────────────────┘${c.reset}`);
|
|
151
|
+
console.log('');
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
async configureChecks() {
|
|
155
|
+
console.log(`${c.cyan}┌─ Step 2: Configuration ─────────────────────────────────────────────┐${c.reset}`);
|
|
156
|
+
console.log(`${c.cyan}│${c.reset}`);
|
|
157
|
+
|
|
158
|
+
// Use detected config as base
|
|
159
|
+
const config = this.detectedType?.config || PROJECT_TYPES.node.config;
|
|
160
|
+
|
|
161
|
+
console.log(`${c.cyan}│${c.reset} ${c.bold}Enabled checks:${c.reset}`);
|
|
162
|
+
|
|
163
|
+
const allChecks = [
|
|
164
|
+
{ id: 'routes', name: 'Route Integrity', desc: 'Dead links, orphan routes' },
|
|
165
|
+
{ id: 'auth', name: 'Authentication', desc: 'Auth coverage, ghost auth' },
|
|
166
|
+
{ id: 'api', name: 'API Verification', desc: 'Endpoint validation' },
|
|
167
|
+
{ id: 'security', name: 'Security', desc: 'Secrets, vulnerabilities' },
|
|
168
|
+
{ id: 'quality', name: 'Code Quality', desc: 'Mocks, placeholders' },
|
|
169
|
+
{ id: 'billing', name: 'Billing Gates', desc: 'Payment flow verification' },
|
|
170
|
+
];
|
|
171
|
+
|
|
172
|
+
for (const check of allChecks) {
|
|
173
|
+
const enabled = config.checks.includes(check.id);
|
|
174
|
+
const icon = enabled ? `${c.green}✓${c.reset}` : `${c.dim}○${c.reset}`;
|
|
175
|
+
const color = enabled ? '' : c.dim;
|
|
176
|
+
console.log(`${c.cyan}│${c.reset} ${icon} ${color}${check.name}${c.reset} ${c.dim}— ${check.desc}${c.reset}`);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
this.answers.config = {
|
|
180
|
+
version: '1.0.0',
|
|
181
|
+
framework: config.framework,
|
|
182
|
+
checks: config.checks,
|
|
183
|
+
output: '.vibecheck',
|
|
184
|
+
policy: {
|
|
185
|
+
strict: false,
|
|
186
|
+
allowlist: { domains: [], packages: [] },
|
|
187
|
+
ignore: { paths: ['node_modules', '__tests__', '*.test.*', '*.spec.*'] },
|
|
188
|
+
},
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
console.log(`${c.cyan}│${c.reset}`);
|
|
192
|
+
console.log(`${c.cyan}└──────────────────────────────────────────────────────────────────────┘${c.reset}`);
|
|
193
|
+
console.log('');
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
async setupFiles() {
|
|
197
|
+
console.log(`${c.cyan}┌─ Step 3: Setup ─────────────────────────────────────────────────────┐${c.reset}`);
|
|
198
|
+
console.log(`${c.cyan}│${c.reset}`);
|
|
199
|
+
|
|
200
|
+
const tasks = [
|
|
201
|
+
{ name: 'Creating .vibecheckrc', fn: () => this.createConfig() },
|
|
202
|
+
{ name: 'Creating .vibecheck/ directory', fn: () => this.createOutputDir() },
|
|
203
|
+
{ name: 'Updating .gitignore', fn: () => this.updateGitignore() },
|
|
204
|
+
{ name: 'Creating schemas/', fn: () => this.createSchemas() },
|
|
205
|
+
];
|
|
206
|
+
|
|
207
|
+
for (const task of tasks) {
|
|
208
|
+
process.stdout.write(`${c.cyan}│${c.reset} ○ ${task.name}...`);
|
|
209
|
+
try {
|
|
210
|
+
const result = await task.fn();
|
|
211
|
+
process.stdout.write(`\r${c.cyan}│${c.reset} ${c.green}✓${c.reset} ${task.name} ${c.dim}${result || ''}${c.reset}\n`);
|
|
212
|
+
} catch (err) {
|
|
213
|
+
process.stdout.write(`\r${c.cyan}│${c.reset} ${c.red}✗${c.reset} ${task.name} ${c.red}${err.message}${c.reset}\n`);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
console.log(`${c.cyan}│${c.reset}`);
|
|
218
|
+
console.log(`${c.cyan}└──────────────────────────────────────────────────────────────────────┘${c.reset}`);
|
|
219
|
+
console.log('');
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
createConfig() {
|
|
223
|
+
const configPath = path.join(this.projectPath, '.vibecheckrc');
|
|
224
|
+
fs.writeFileSync(configPath, JSON.stringify(this.answers.config, null, 2));
|
|
225
|
+
return '';
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
createOutputDir() {
|
|
229
|
+
const outputDir = path.join(this.projectPath, '.vibecheck');
|
|
230
|
+
if (!fs.existsSync(outputDir)) {
|
|
231
|
+
fs.mkdirSync(outputDir, { recursive: true });
|
|
232
|
+
}
|
|
233
|
+
return '';
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
updateGitignore() {
|
|
237
|
+
const gitignorePath = path.join(this.projectPath, '.gitignore');
|
|
238
|
+
const entry = '\n# vibecheck\n.vibecheck/\n';
|
|
239
|
+
|
|
240
|
+
if (fs.existsSync(gitignorePath)) {
|
|
241
|
+
const content = fs.readFileSync(gitignorePath, 'utf8');
|
|
242
|
+
if (!content.includes('.vibecheck/')) {
|
|
243
|
+
fs.appendFileSync(gitignorePath, entry);
|
|
244
|
+
return 'updated';
|
|
245
|
+
}
|
|
246
|
+
return 'already configured';
|
|
247
|
+
} else {
|
|
248
|
+
fs.writeFileSync(gitignorePath, entry.trim() + '\n');
|
|
249
|
+
return 'created';
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
createSchemas() {
|
|
254
|
+
const schemasDir = path.join(this.projectPath, '.vibecheck', 'schemas');
|
|
255
|
+
if (!fs.existsSync(schemasDir)) {
|
|
256
|
+
fs.mkdirSync(schemasDir, { recursive: true });
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
// Create truthpack schema
|
|
260
|
+
const truthpackSchema = {
|
|
261
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
262
|
+
"$id": "https://vibecheck.dev/schemas/truthpack.json",
|
|
263
|
+
"title": "Vibecheck Truthpack",
|
|
264
|
+
"type": "object",
|
|
265
|
+
"properties": {
|
|
266
|
+
"version": { "type": "string" },
|
|
267
|
+
"generatedAt": { "type": "string", "format": "date-time" },
|
|
268
|
+
"routes": { "type": "object" },
|
|
269
|
+
"env": { "type": "object" },
|
|
270
|
+
"auth": { "type": "object" },
|
|
271
|
+
},
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
fs.writeFileSync(
|
|
275
|
+
path.join(schemasDir, 'truthpack.schema.json'),
|
|
276
|
+
JSON.stringify(truthpackSchema, null, 2)
|
|
277
|
+
);
|
|
278
|
+
|
|
279
|
+
return '';
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
printNextSteps() {
|
|
283
|
+
console.log(`${c.green}${c.bold}✓ Vibecheck initialized successfully!${c.reset}`);
|
|
284
|
+
console.log('');
|
|
285
|
+
console.log(`${c.cyan}╔══════════════════════════════════════════════════════════════════════╗${c.reset}`);
|
|
286
|
+
console.log(`${c.cyan}║${c.reset} ${c.bold}Next Steps${c.reset} ${c.cyan}║${c.reset}`);
|
|
287
|
+
console.log(`${c.cyan}╠══════════════════════════════════════════════════════════════════════╣${c.reset}`);
|
|
288
|
+
console.log(`${c.cyan}║${c.reset} ${c.cyan}║${c.reset}`);
|
|
289
|
+
console.log(`${c.cyan}║${c.reset} ${c.bold}1.${c.reset} Run your first scan: ${c.cyan}║${c.reset}`);
|
|
290
|
+
console.log(`${c.cyan}║${c.reset} ${c.cyan}vibecheck ship${c.reset} ${c.cyan}║${c.reset}`);
|
|
291
|
+
console.log(`${c.cyan}║${c.reset} ${c.cyan}║${c.reset}`);
|
|
292
|
+
console.log(`${c.cyan}║${c.reset} ${c.bold}2.${c.reset} Review the report: ${c.cyan}║${c.reset}`);
|
|
293
|
+
console.log(`${c.cyan}║${c.reset} ${c.dim}Open .vibecheck/report.html in your browser${c.reset} ${c.cyan}║${c.reset}`);
|
|
294
|
+
console.log(`${c.cyan}║${c.reset} ${c.cyan}║${c.reset}`);
|
|
295
|
+
console.log(`${c.cyan}║${c.reset} ${c.bold}3.${c.reset} Fix issues and re-scan: ${c.cyan}║${c.reset}`);
|
|
296
|
+
console.log(`${c.cyan}║${c.reset} ${c.cyan}vibecheck ship --fix${c.reset} ${c.cyan}║${c.reset}`);
|
|
297
|
+
console.log(`${c.cyan}║${c.reset} ${c.cyan}║${c.reset}`);
|
|
298
|
+
console.log(`${c.cyan}║${c.reset} ${c.bold}4.${c.reset} Generate a client report: ${c.cyan}║${c.reset}`);
|
|
299
|
+
console.log(`${c.cyan}║${c.reset} ${c.cyan}vibecheck report --type=executive${c.reset} ${c.cyan}║${c.reset}`);
|
|
300
|
+
console.log(`${c.cyan}║${c.reset} ${c.cyan}║${c.reset}`);
|
|
301
|
+
console.log(`${c.cyan}╚══════════════════════════════════════════════════════════════════════╝${c.reset}`);
|
|
302
|
+
console.log('');
|
|
303
|
+
console.log(`${c.dim}Tip: Run ${c.cyan}vibecheck --help${c.dim} to see all available commands.${c.reset}`);
|
|
304
|
+
console.log('');
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
module.exports = { InitWizard };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSON Output Utilities
|
|
3
|
+
*
|
|
4
|
+
* Provides versioned JSON output schema helpers for CLI commands
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const VERSION = "1.0.0";
|
|
8
|
+
const SCHEMA_BASE = "vibecheck-cli-tool/v1";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Create a versioned JSON output envelope
|
|
12
|
+
* @param {Object} data - The actual output data
|
|
13
|
+
* @param {string} schemaType - Schema type (e.g., "scan", "gate", "ship")
|
|
14
|
+
* @returns {Object} Versioned output object
|
|
15
|
+
*/
|
|
16
|
+
function createVersionedOutput(data, schemaType = "generic") {
|
|
17
|
+
return {
|
|
18
|
+
version: VERSION,
|
|
19
|
+
schema: `${SCHEMA_BASE}/${schemaType}`,
|
|
20
|
+
timestamp: new Date().toISOString(),
|
|
21
|
+
...data,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Create a versioned error output
|
|
27
|
+
* @param {string|Error} error - Error message or Error object
|
|
28
|
+
* @param {Object} metadata - Additional error metadata
|
|
29
|
+
* @returns {Object} Versioned error output
|
|
30
|
+
*/
|
|
31
|
+
function createErrorOutput(error, metadata = {}) {
|
|
32
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
33
|
+
const errorOutput = {
|
|
34
|
+
version: VERSION,
|
|
35
|
+
schema: `${SCHEMA_BASE}/error`,
|
|
36
|
+
timestamp: new Date().toISOString(),
|
|
37
|
+
success: false,
|
|
38
|
+
error: errorMessage,
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
if (metadata.receipt) {
|
|
42
|
+
errorOutput.receipt = metadata.receipt;
|
|
43
|
+
}
|
|
44
|
+
if (metadata.code) {
|
|
45
|
+
errorOutput.code = metadata.code;
|
|
46
|
+
}
|
|
47
|
+
if (metadata.exitCode) {
|
|
48
|
+
errorOutput.exitCode = metadata.exitCode;
|
|
49
|
+
}
|
|
50
|
+
if (metadata.verifyCommand) {
|
|
51
|
+
errorOutput.verifyCommand = metadata.verifyCommand;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return errorOutput;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Create a versioned success output
|
|
59
|
+
* @param {Object} data - Success data
|
|
60
|
+
* @param {string} schemaType - Schema type
|
|
61
|
+
* @returns {Object} Versioned success output
|
|
62
|
+
*/
|
|
63
|
+
function createSuccessOutput(data, schemaType = "generic") {
|
|
64
|
+
return createVersionedOutput({
|
|
65
|
+
success: true,
|
|
66
|
+
...data,
|
|
67
|
+
}, schemaType);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
module.exports = {
|
|
71
|
+
VERSION,
|
|
72
|
+
SCHEMA_BASE,
|
|
73
|
+
createVersionedOutput,
|
|
74
|
+
createErrorOutput,
|
|
75
|
+
createSuccessOutput,
|
|
76
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// bin/runners/lib/llm.js
|
|
2
|
+
const https = require("https");
|
|
3
|
+
const http = require("http");
|
|
4
|
+
const { URL } = require("url");
|
|
5
|
+
|
|
6
|
+
function postJson(urlStr, headers, bodyObj) {
|
|
7
|
+
const url = new URL(urlStr);
|
|
8
|
+
const lib = url.protocol === "https:" ? https : http;
|
|
9
|
+
|
|
10
|
+
const data = JSON.stringify(bodyObj);
|
|
11
|
+
|
|
12
|
+
return new Promise((resolve, reject) => {
|
|
13
|
+
const req = lib.request(
|
|
14
|
+
{
|
|
15
|
+
method: "POST",
|
|
16
|
+
hostname: url.hostname,
|
|
17
|
+
port: url.port || (url.protocol === "https:" ? 443 : 80),
|
|
18
|
+
path: url.pathname,
|
|
19
|
+
headers: {
|
|
20
|
+
"Content-Type": "application/json",
|
|
21
|
+
"Content-Length": Buffer.byteLength(data),
|
|
22
|
+
...headers
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
(res) => {
|
|
26
|
+
let buf = "";
|
|
27
|
+
res.on("data", (d) => (buf += d));
|
|
28
|
+
res.on("end", () => {
|
|
29
|
+
try {
|
|
30
|
+
const json = JSON.parse(buf);
|
|
31
|
+
resolve({ status: res.statusCode, json, raw: buf });
|
|
32
|
+
} catch (e) {
|
|
33
|
+
reject(new Error(`LLM response not JSON (status ${res.statusCode}): ${buf.slice(0, 400)}`));
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
req.on("error", reject);
|
|
40
|
+
req.write(data);
|
|
41
|
+
req.end();
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
async function generatePatchJson(prompt) {
|
|
46
|
+
const baseUrl = process.env.VIBECHECK_LLM_BASE_URL;
|
|
47
|
+
const apiKey = process.env.VIBECHECK_LLM_API_KEY;
|
|
48
|
+
const model = process.env.VIBECHECK_LLM_MODEL || "gpt-4.1-mini";
|
|
49
|
+
|
|
50
|
+
if (!baseUrl || !apiKey) {
|
|
51
|
+
const err = new Error("LLM not configured: set VIBECHECK_LLM_BASE_URL and VIBECHECK_LLM_API_KEY");
|
|
52
|
+
err.code = "VIBECHECK_LLM_NOT_CONFIGURED";
|
|
53
|
+
throw err;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const headers = { Authorization: `Bearer ${apiKey}` };
|
|
57
|
+
|
|
58
|
+
const body = {
|
|
59
|
+
model,
|
|
60
|
+
temperature: 0.1,
|
|
61
|
+
messages: [
|
|
62
|
+
{ role: "system", content: "Return JSON only." },
|
|
63
|
+
{ role: "user", content: prompt }
|
|
64
|
+
]
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const r = await postJson(baseUrl, headers, body);
|
|
68
|
+
|
|
69
|
+
const content = r.json?.choices?.[0]?.message?.content;
|
|
70
|
+
if (!content) throw new Error("LLM response missing choices[0].message.content");
|
|
71
|
+
|
|
72
|
+
return JSON.parse(content);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
module.exports = { generatePatchJson };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// bin/runners/lib/meter.js
|
|
2
|
+
const fs = require("fs");
|
|
3
|
+
const path = require("path");
|
|
4
|
+
const os = require("os");
|
|
5
|
+
|
|
6
|
+
function monthKey(d = new Date()) {
|
|
7
|
+
const y = d.getUTCFullYear();
|
|
8
|
+
const m = String(d.getUTCMonth() + 1).padStart(2, "0");
|
|
9
|
+
return `${y}-${m}`;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function ensureDir(p) {
|
|
13
|
+
fs.mkdirSync(p, { recursive: true });
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function readJson(p, fallback) {
|
|
17
|
+
try { return JSON.parse(fs.readFileSync(p, "utf8")); } catch { return fallback; }
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function writeJson(p, obj) {
|
|
21
|
+
fs.writeFileSync(p, JSON.stringify(obj, null, 2));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function defaultStorePath() {
|
|
25
|
+
return path.join(os.homedir(), ".vibecheck", "usage.json");
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Local meter:
|
|
30
|
+
* - Free tier: 10 ship checks per calendar month
|
|
31
|
+
* - Paid tiers: unlimited (you can override tier via env while developing)
|
|
32
|
+
*/
|
|
33
|
+
function consumeShipCheckOrThrow({ tier, limitFree = 10 } = {}) {
|
|
34
|
+
const effectiveTier = (tier || process.env.VIBECHECK_TIER || "free").toLowerCase();
|
|
35
|
+
|
|
36
|
+
if (effectiveTier !== "free") {
|
|
37
|
+
return { ok: true, remaining: Infinity, tier: effectiveTier };
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const storePath = process.env.VIBECHECK_USAGE_PATH || defaultStorePath();
|
|
41
|
+
ensureDir(path.dirname(storePath));
|
|
42
|
+
const store = readJson(storePath, { months: {} });
|
|
43
|
+
|
|
44
|
+
const key = monthKey();
|
|
45
|
+
const used = store.months[key]?.shipChecks || 0;
|
|
46
|
+
|
|
47
|
+
if (used >= limitFree) {
|
|
48
|
+
const err = new Error(`Free tier limit reached: ${limitFree} full ship checks/month. Upgrade to continue.`);
|
|
49
|
+
err.code = "VIBECHECK_LIMIT_REACHED";
|
|
50
|
+
err.meta = { used, limitFree, month: key };
|
|
51
|
+
throw err;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
store.months[key] = store.months[key] || {};
|
|
55
|
+
store.months[key].shipChecks = used + 1;
|
|
56
|
+
writeJson(storePath, store);
|
|
57
|
+
|
|
58
|
+
return { ok: true, remaining: limitFree - (used + 1), tier: effectiveTier };
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
module.exports = { consumeShipCheckOrThrow };
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
// bin/runners/lib/missions/evidence.js
|
|
2
|
+
const fg = require("fast-glob");
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const { collectEvidenceSnippets, collectRegexSnippets } = require("../snippets");
|
|
6
|
+
|
|
7
|
+
async function findFiles(repoRoot, patterns, limit = 12) {
|
|
8
|
+
const files = await fg(patterns, {
|
|
9
|
+
cwd: repoRoot,
|
|
10
|
+
onlyFiles: true,
|
|
11
|
+
absolute: false,
|
|
12
|
+
ignore: ["**/node_modules/**","**/.next/**","**/dist/**","**/build/**"]
|
|
13
|
+
});
|
|
14
|
+
return files.slice(0, limit);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function uniq(arr) {
|
|
18
|
+
return Array.from(new Set((arr || []).filter(Boolean)));
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function evidenceFilesFromFindings(findings) {
|
|
22
|
+
const files = [];
|
|
23
|
+
for (const f of findings || []) {
|
|
24
|
+
for (const ev of (f.evidence || [])) {
|
|
25
|
+
if (ev.file) files.push(ev.file);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return uniq(files);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function handlerFilesFromTruthpack(truthpack) {
|
|
32
|
+
const server = truthpack?.routes?.server || [];
|
|
33
|
+
return uniq(server.map(r => r.handler).filter(Boolean));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function enforcementHandlerFiles(truthpack) {
|
|
37
|
+
const checks = truthpack?.enforcement?.checks || [];
|
|
38
|
+
return uniq(checks.map(c => c.handler).filter(Boolean));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function stripeWebhookFiles(truthpack) {
|
|
42
|
+
const c = truthpack?.billing?.webhookCandidates || [];
|
|
43
|
+
return uniq(c.map(x => x.file).filter(Boolean));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function middlewareFiles(truthpack) {
|
|
47
|
+
const m = truthpack?.auth?.nextMiddleware || [];
|
|
48
|
+
return uniq(m.map(x => x.file).filter(Boolean));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
async function expandEvidence({ repoRoot, truthpack, mission, targetFindings }) {
|
|
52
|
+
const type = mission?.type || "GENERIC_FIX";
|
|
53
|
+
|
|
54
|
+
let allowedFiles = evidenceFilesFromFindings(targetFindings);
|
|
55
|
+
|
|
56
|
+
if (type === "FIX_ENV_CONTRACT") {
|
|
57
|
+
allowedFiles = uniq([
|
|
58
|
+
...allowedFiles,
|
|
59
|
+
".env.example", ".env.template", ".env.sample", ".env"
|
|
60
|
+
]);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (type === "FIX_MISSING_ROUTE") {
|
|
64
|
+
allowedFiles = uniq([
|
|
65
|
+
...allowedFiles,
|
|
66
|
+
...handlerFilesFromTruthpack(truthpack)
|
|
67
|
+
]);
|
|
68
|
+
const nextApiFiles = await findFiles(repoRoot, ["app/api/**/route.@(ts|js)", "pages/api/**/*.@(ts|js)"], 24);
|
|
69
|
+
allowedFiles = uniq([...allowedFiles, ...nextApiFiles]);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (type === "ADD_SERVER_AUTH") {
|
|
73
|
+
allowedFiles = uniq([
|
|
74
|
+
...allowedFiles,
|
|
75
|
+
...middlewareFiles(truthpack),
|
|
76
|
+
...handlerFilesFromTruthpack(truthpack)
|
|
77
|
+
]);
|
|
78
|
+
const authLibs = await findFiles(repoRoot, ["**/*auth*.@(ts|js)","**/*session*.@(ts|js)","**/*jwt*.@(ts|js)"], 12);
|
|
79
|
+
allowedFiles = uniq([...allowedFiles, ...authLibs]);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (type === "FIX_STRIPE_WEBHOOKS") {
|
|
83
|
+
allowedFiles = uniq([...allowedFiles, ...stripeWebhookFiles(truthpack)]);
|
|
84
|
+
const billingLibs = await findFiles(repoRoot, ["**/*stripe*.@(ts|js)","**/*billing*.@(ts|js)","**/*webhook*.@(ts|js)"], 12);
|
|
85
|
+
allowedFiles = uniq([...allowedFiles, ...billingLibs]);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (type === "ENFORCE_PAID_SURFACE") {
|
|
89
|
+
allowedFiles = uniq([...allowedFiles, ...enforcementHandlerFiles(truthpack)]);
|
|
90
|
+
const entitlementLibs = await findFiles(repoRoot, ["**/*entitlement*.@(ts|js)","**/*plan*.@(ts|js)","**/*tier*.@(ts|js)"], 12);
|
|
91
|
+
allowedFiles = uniq([...allowedFiles, ...entitlementLibs]);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (type === "REMOVE_OWNER_MODE") {
|
|
95
|
+
const bypassFiles = await findFiles(repoRoot, ["**/*owner*mode*.@(ts|js)","**/*entitlement*.@(ts|js)","**/*auth*.@(ts|js)"], 20);
|
|
96
|
+
allowedFiles = uniq([...allowedFiles, ...bypassFiles]);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (type === "FIX_FAKE_SUCCESS") {
|
|
100
|
+
const uiFiles = await findFiles(repoRoot, ["app/**/*.@(ts|tsx|js|jsx)","src/**/*.@(ts|tsx|js|jsx)"], 20);
|
|
101
|
+
allowedFiles = uniq([...allowedFiles, ...uiFiles]);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const evidenceSnips = collectEvidenceSnippets(repoRoot, targetFindings, 12);
|
|
105
|
+
|
|
106
|
+
const regexByType = {
|
|
107
|
+
FIX_STRIPE_WEBHOOKS: /(constructEvent|stripe-signature|bodyParser\s*:\s*false|req\.(text|arrayBuffer)\(|event\.id|idempotenc)/i,
|
|
108
|
+
ENFORCE_PAID_SURFACE: /(enforceFeature|enforceLimit|getEntitlements|tier|plan|subscription|credits)/i,
|
|
109
|
+
ADD_SERVER_AUTH: /(authorization|bearer|jwtVerify|getServerSession|clerk|supabase|preHandler|onRequest|rbac|permissions)/i,
|
|
110
|
+
REMOVE_OWNER_MODE: /(OWNER_MODE|GUARDRAIL_OWNER_MODE|VIBECHECK_OWNER_MODE)/i,
|
|
111
|
+
FIX_FAKE_SUCCESS: /(toast\.success|router\.push|navigate\(|fetch\(|axios\.)/i,
|
|
112
|
+
FIX_ENV_CONTRACT: /(^|\s)(export\s+)?[A-Z0-9_]+\s*=/,
|
|
113
|
+
FIX_MISSING_ROUTE: /(\/api\/|fetch\(|axios\.)/i,
|
|
114
|
+
FIX_DEAD_UI: /(onClick|onclick|router\.push|navigate\(|toast\.success|fetch\(|axios\.|\/api\/)/i
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
const rx = regexByType[type];
|
|
118
|
+
const regexSnips = rx ? collectRegexSnippets(repoRoot, allowedFiles, rx, { pad: 4, limit: 10 }) : [];
|
|
119
|
+
|
|
120
|
+
return {
|
|
121
|
+
allowedFiles,
|
|
122
|
+
snippets: [...evidenceSnips, ...regexSnips]
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
module.exports = { expandEvidence };
|