@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,106 @@
|
|
|
1
|
+
const readline = require("readline");
|
|
2
|
+
const {
|
|
3
|
+
saveApiKey,
|
|
4
|
+
deleteApiKey,
|
|
5
|
+
getApiKey,
|
|
6
|
+
getEntitlements,
|
|
7
|
+
} = require("./lib/auth");
|
|
8
|
+
|
|
9
|
+
async function prompt(question) {
|
|
10
|
+
const rl = readline.createInterface({
|
|
11
|
+
input: process.stdin,
|
|
12
|
+
output: process.stdout,
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
return new Promise((resolve) => {
|
|
16
|
+
rl.question(question, (answer) => {
|
|
17
|
+
rl.close();
|
|
18
|
+
resolve(answer.trim());
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
async function runLogin(args) {
|
|
24
|
+
console.log("\n 🔐 vibecheck LOGIN\n");
|
|
25
|
+
|
|
26
|
+
const existing = getApiKey();
|
|
27
|
+
if (existing.key) {
|
|
28
|
+
console.log(` Already logged in (source: ${existing.source}).`);
|
|
29
|
+
const answer = await prompt(" Do you want to overwrite? (y/N) ");
|
|
30
|
+
if (answer.toLowerCase() !== "y") {
|
|
31
|
+
console.log(" Cancelled.");
|
|
32
|
+
return 0;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
console.log(
|
|
37
|
+
" Paste your API key from https://vibecheckai.dev/settings/keys",
|
|
38
|
+
);
|
|
39
|
+
const key = await prompt(" API Key: ");
|
|
40
|
+
|
|
41
|
+
if (!key) {
|
|
42
|
+
console.error(" ❌ No key provided.");
|
|
43
|
+
return 1;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Validate key by fetching entitlements
|
|
47
|
+
console.log(" Verifying...");
|
|
48
|
+
const entitlements = await getEntitlements(key);
|
|
49
|
+
|
|
50
|
+
if (
|
|
51
|
+
!entitlements ||
|
|
52
|
+
(entitlements.plan === "free" && !key.startsWith("gr_"))
|
|
53
|
+
) {
|
|
54
|
+
// If mocking, we might accept anything, but let's pretend valid keys start with gr_
|
|
55
|
+
// For now, since it's a mock, we just check if we got entitlements back.
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
saveApiKey(key);
|
|
59
|
+
console.log(
|
|
60
|
+
` ✅ Successfully logged in as ${entitlements?.user?.name || "User"}`,
|
|
61
|
+
);
|
|
62
|
+
console.log(` Plan: ${entitlements?.plan || "Free"}`);
|
|
63
|
+
|
|
64
|
+
return 0;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
async function runLogout(args) {
|
|
68
|
+
console.log("\n 🔓 vibecheck LOGOUT\n");
|
|
69
|
+
deleteApiKey();
|
|
70
|
+
console.log(" ✅ API key removed from local config.");
|
|
71
|
+
return 0;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
async function runWhoami(args) {
|
|
75
|
+
console.log("\n 👤 vibecheck WHOAMI\n");
|
|
76
|
+
|
|
77
|
+
const { key, source } = getApiKey();
|
|
78
|
+
|
|
79
|
+
if (!key) {
|
|
80
|
+
console.log(" Not logged in.");
|
|
81
|
+
console.log(' Run "vibecheck login" or set VIBECHECK_API_KEY.');
|
|
82
|
+
return 1;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
console.log(
|
|
86
|
+
` Source: ${source === "env" ? "Environment Variable" : "Local Config"}`,
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
const entitlements = await getEntitlements(key);
|
|
90
|
+
if (!entitlements) {
|
|
91
|
+
console.log(" ⚠️ Invalid API Key or server unreachable.");
|
|
92
|
+
return 1;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
console.log(` User: ${entitlements.user.name} (${entitlements.user.id})`);
|
|
96
|
+
console.log(` Plan: ${entitlements.plan.toUpperCase()}`);
|
|
97
|
+
console.log(` Limits: ${entitlements.limits.runsPerMonth} runs/month`);
|
|
98
|
+
console.log("");
|
|
99
|
+
console.log(" Scopes:");
|
|
100
|
+
entitlements.scopes.forEach((s) => console.log(` - ${s}`));
|
|
101
|
+
console.log("");
|
|
102
|
+
|
|
103
|
+
return 0;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
module.exports = { runLogin, runLogout, runWhoami };
|
|
@@ -0,0 +1,483 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Claim Verifier v1
|
|
4
|
+
*
|
|
5
|
+
* Validates claims against the Truth Pack.
|
|
6
|
+
* Returns: true | false | unknown
|
|
7
|
+
*
|
|
8
|
+
* CRITICAL: If 'unknown', the agent MUST NOT proceed with actions that depend on this claim.
|
|
9
|
+
*
|
|
10
|
+
* Usage:
|
|
11
|
+
* validateClaim({ type: 'route_exists', subject: { method: 'POST', path: '/api/login' } })
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import fs from 'fs/promises';
|
|
15
|
+
import path from 'path';
|
|
16
|
+
import crypto from 'crypto';
|
|
17
|
+
import { RouteIndex, validateRouteExists as validateRouteFromIndex } from './lib/route-truth.js';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Load the truth pack from disk
|
|
21
|
+
*/
|
|
22
|
+
async function loadTruthpack(projectPath) {
|
|
23
|
+
const truthpackPath = path.join(projectPath, '.vibecheck', 'truth', 'truthpack.json');
|
|
24
|
+
try {
|
|
25
|
+
const content = await fs.readFile(truthpackPath, 'utf8');
|
|
26
|
+
return JSON.parse(content);
|
|
27
|
+
} catch (err) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Validate a claim against the truth pack
|
|
34
|
+
*
|
|
35
|
+
* @param {Object} claim - The claim to validate
|
|
36
|
+
* @param {string} claim.type - Type of claim (route_exists, env_var_exists, auth_enforced, etc.)
|
|
37
|
+
* @param {Object} claim.subject - What the claim is about
|
|
38
|
+
* @param {boolean} claim.expected - Expected result (default: true)
|
|
39
|
+
* @param {Object} claim.context - Optional context (task, scopeFiles)
|
|
40
|
+
* @param {string} projectPath - Project root path
|
|
41
|
+
* @returns {Object} Claim result with evidence
|
|
42
|
+
*/
|
|
43
|
+
export async function validateClaim(claim, projectPath = process.cwd()) {
|
|
44
|
+
const claimId = generateClaimId(claim);
|
|
45
|
+
const truthpack = await loadTruthpack(projectPath);
|
|
46
|
+
|
|
47
|
+
if (!truthpack) {
|
|
48
|
+
return {
|
|
49
|
+
id: claimId,
|
|
50
|
+
result: 'unknown',
|
|
51
|
+
confidence: 'low',
|
|
52
|
+
evidence: [],
|
|
53
|
+
assumptions: [],
|
|
54
|
+
gaps: [{ title: 'No truth pack found', severity: 'block', confidence: 'high' }],
|
|
55
|
+
nextSteps: ['Run `vibecheck ctx` to generate truth pack'],
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
let result;
|
|
60
|
+
|
|
61
|
+
switch (claim.type) {
|
|
62
|
+
case 'route_exists':
|
|
63
|
+
result = await verifyRouteExists(claim, truthpack, projectPath);
|
|
64
|
+
break;
|
|
65
|
+
|
|
66
|
+
case 'env_var_exists':
|
|
67
|
+
result = verifyEnvVarExists(claim, truthpack);
|
|
68
|
+
break;
|
|
69
|
+
|
|
70
|
+
case 'env_var_used':
|
|
71
|
+
result = verifyEnvVarUsed(claim, truthpack);
|
|
72
|
+
break;
|
|
73
|
+
|
|
74
|
+
case 'auth_enforced':
|
|
75
|
+
case 'auth_enforced_on_surface':
|
|
76
|
+
result = verifyAuthEnforced(claim, truthpack);
|
|
77
|
+
break;
|
|
78
|
+
|
|
79
|
+
case 'route_guarded':
|
|
80
|
+
result = verifyRouteGuarded(claim, truthpack);
|
|
81
|
+
break;
|
|
82
|
+
|
|
83
|
+
case 'file_exists':
|
|
84
|
+
result = await verifyFileExists(claim, projectPath);
|
|
85
|
+
break;
|
|
86
|
+
|
|
87
|
+
case 'integration_exists':
|
|
88
|
+
result = verifyIntegrationExists(claim, truthpack);
|
|
89
|
+
break;
|
|
90
|
+
|
|
91
|
+
default:
|
|
92
|
+
result = {
|
|
93
|
+
result: 'unknown',
|
|
94
|
+
confidence: 'low',
|
|
95
|
+
evidence: [],
|
|
96
|
+
assumptions: [],
|
|
97
|
+
gaps: [],
|
|
98
|
+
nextSteps: [`Claim type "${claim.type}" not yet implemented`],
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Add warning for unknown results
|
|
103
|
+
if (result.result === 'unknown') {
|
|
104
|
+
result.warning = '⚠️ UNKNOWN claims BLOCK dependent actions. Verify before proceeding.';
|
|
105
|
+
if (!result.nextSteps) result.nextSteps = [];
|
|
106
|
+
result.nextSteps.push(
|
|
107
|
+
'Use vibecheck.search_evidence to find related code',
|
|
108
|
+
'Check if the feature is implemented yet'
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return {
|
|
113
|
+
id: claimId,
|
|
114
|
+
...result,
|
|
115
|
+
timestamp: new Date().toISOString(),
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Verify route_exists claim using Route Truth v1
|
|
121
|
+
*/
|
|
122
|
+
async function verifyRouteExists(claim, truthpack, projectPath) {
|
|
123
|
+
const { method, path: routePath } = claim.subject;
|
|
124
|
+
|
|
125
|
+
// Use Route Truth for live verification (more accurate than cached truthpack)
|
|
126
|
+
if (projectPath) {
|
|
127
|
+
try {
|
|
128
|
+
const result = await validateRouteFromIndex({ method, path: routePath }, projectPath);
|
|
129
|
+
return {
|
|
130
|
+
result: result.result,
|
|
131
|
+
confidence: result.confidence,
|
|
132
|
+
evidence: result.evidence || [],
|
|
133
|
+
assumptions: [],
|
|
134
|
+
gaps: result.gaps || [],
|
|
135
|
+
nextSteps: result.nextSteps || [],
|
|
136
|
+
matchedRoute: result.matchedRoute,
|
|
137
|
+
closestRoutes: result.closestRoutes,
|
|
138
|
+
};
|
|
139
|
+
} catch {
|
|
140
|
+
// Fall back to truthpack if Route Truth fails
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// Fallback: use cached truthpack
|
|
145
|
+
const routes = truthpack?.routes?.server || [];
|
|
146
|
+
|
|
147
|
+
// Find matching route
|
|
148
|
+
const match = routes.find(r => {
|
|
149
|
+
const methodMatch = !method || r.method === '*' || r.method.toUpperCase() === method.toUpperCase();
|
|
150
|
+
const pathMatch = r.path === routePath || pathMatches(r.path, routePath);
|
|
151
|
+
return methodMatch && pathMatch;
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
if (match) {
|
|
155
|
+
return {
|
|
156
|
+
result: 'true',
|
|
157
|
+
confidence: match.confidence,
|
|
158
|
+
evidence: match.evidence || [],
|
|
159
|
+
assumptions: [],
|
|
160
|
+
gaps: [],
|
|
161
|
+
nextSteps: [],
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// Check if it's referenced but not defined (gap)
|
|
166
|
+
const clientRef = truthpack?.routes?.clientRefs?.find(r => r.path === routePath);
|
|
167
|
+
if (clientRef) {
|
|
168
|
+
return {
|
|
169
|
+
result: 'false',
|
|
170
|
+
confidence: 'high',
|
|
171
|
+
evidence: clientRef.evidence || [],
|
|
172
|
+
assumptions: [],
|
|
173
|
+
gaps: [{
|
|
174
|
+
title: `Route ${routePath} referenced in UI but not found on server`,
|
|
175
|
+
severity: 'block',
|
|
176
|
+
confidence: 'high',
|
|
177
|
+
suggestion: 'Create the server route or fix the client reference',
|
|
178
|
+
}],
|
|
179
|
+
nextSteps: ['Check server route definitions', 'Verify the intended endpoint path'],
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
return {
|
|
184
|
+
result: 'false',
|
|
185
|
+
confidence: 'high',
|
|
186
|
+
evidence: [],
|
|
187
|
+
assumptions: [],
|
|
188
|
+
gaps: [],
|
|
189
|
+
nextSteps: [`Route ${method || 'ANY'} ${routePath} not found in truth pack`],
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Verify env_var_exists claim
|
|
195
|
+
*/
|
|
196
|
+
function verifyEnvVarExists(claim, truthpack) {
|
|
197
|
+
const { name } = claim.subject;
|
|
198
|
+
const vars = truthpack.env?.vars || [];
|
|
199
|
+
|
|
200
|
+
const match = vars.find(v => v.name === name);
|
|
201
|
+
|
|
202
|
+
if (match) {
|
|
203
|
+
return {
|
|
204
|
+
result: 'true',
|
|
205
|
+
confidence: 'high',
|
|
206
|
+
evidence: match.references || [],
|
|
207
|
+
assumptions: [],
|
|
208
|
+
gaps: [],
|
|
209
|
+
nextSteps: [],
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
return {
|
|
214
|
+
result: 'unknown',
|
|
215
|
+
confidence: 'low',
|
|
216
|
+
evidence: [],
|
|
217
|
+
assumptions: [],
|
|
218
|
+
gaps: [],
|
|
219
|
+
nextSteps: [`Check .env.example for ${name}`, `Search for process.env.${name} in code`],
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Verify env_var_used claim
|
|
225
|
+
*/
|
|
226
|
+
function verifyEnvVarUsed(claim, truthpack) {
|
|
227
|
+
const { name } = claim.subject;
|
|
228
|
+
const vars = truthpack.env?.vars || [];
|
|
229
|
+
|
|
230
|
+
const match = vars.find(v => v.name === name);
|
|
231
|
+
|
|
232
|
+
if (match && match.references && match.references.length > 0) {
|
|
233
|
+
return {
|
|
234
|
+
result: 'true',
|
|
235
|
+
confidence: 'high',
|
|
236
|
+
evidence: match.references,
|
|
237
|
+
assumptions: [],
|
|
238
|
+
gaps: [],
|
|
239
|
+
nextSteps: [],
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
if (match) {
|
|
244
|
+
return {
|
|
245
|
+
result: 'false',
|
|
246
|
+
confidence: 'med',
|
|
247
|
+
evidence: [],
|
|
248
|
+
assumptions: [],
|
|
249
|
+
gaps: [{
|
|
250
|
+
title: `${name} declared but not used in code`,
|
|
251
|
+
severity: 'warn',
|
|
252
|
+
confidence: 'med',
|
|
253
|
+
}],
|
|
254
|
+
nextSteps: [],
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
return {
|
|
259
|
+
result: 'false',
|
|
260
|
+
confidence: 'high',
|
|
261
|
+
evidence: [],
|
|
262
|
+
assumptions: [],
|
|
263
|
+
gaps: [],
|
|
264
|
+
nextSteps: [],
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Verify auth_enforced claim
|
|
270
|
+
*/
|
|
271
|
+
function verifyAuthEnforced(claim, truthpack) {
|
|
272
|
+
const { path: surfacePath, surface } = claim.subject;
|
|
273
|
+
const targetPath = surfacePath || surface;
|
|
274
|
+
|
|
275
|
+
const protectedSurfaces = truthpack.auth?.protectedSurfaces || [];
|
|
276
|
+
const match = protectedSurfaces.find(s =>
|
|
277
|
+
s.surface === targetPath || pathMatches(s.surface, targetPath)
|
|
278
|
+
);
|
|
279
|
+
|
|
280
|
+
if (match) {
|
|
281
|
+
return {
|
|
282
|
+
result: 'true',
|
|
283
|
+
confidence: 'high',
|
|
284
|
+
evidence: match.evidence || [],
|
|
285
|
+
assumptions: [],
|
|
286
|
+
gaps: [],
|
|
287
|
+
nextSteps: [],
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
// Check if route exists but isn't protected
|
|
292
|
+
const routes = truthpack.routes?.server || [];
|
|
293
|
+
const routeMatch = routes.find(r => r.path === targetPath);
|
|
294
|
+
|
|
295
|
+
if (routeMatch) {
|
|
296
|
+
if (routeMatch.authRequired === 'yes') {
|
|
297
|
+
return {
|
|
298
|
+
result: 'true',
|
|
299
|
+
confidence: 'med',
|
|
300
|
+
evidence: routeMatch.evidence || [],
|
|
301
|
+
assumptions: [{ description: 'Auth detected via pattern matching, not explicit middleware check' }],
|
|
302
|
+
gaps: [],
|
|
303
|
+
nextSteps: ['Verify middleware is correctly applied'],
|
|
304
|
+
};
|
|
305
|
+
} else if (routeMatch.authRequired === 'no') {
|
|
306
|
+
return {
|
|
307
|
+
result: 'false',
|
|
308
|
+
confidence: 'high',
|
|
309
|
+
evidence: routeMatch.evidence || [],
|
|
310
|
+
assumptions: [],
|
|
311
|
+
gaps: [],
|
|
312
|
+
nextSteps: [],
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
return {
|
|
318
|
+
result: 'unknown',
|
|
319
|
+
confidence: 'low',
|
|
320
|
+
evidence: [],
|
|
321
|
+
assumptions: [],
|
|
322
|
+
gaps: [],
|
|
323
|
+
nextSteps: ['Check middleware configuration', 'Look for auth guards on this route'],
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Verify route_guarded claim
|
|
329
|
+
*/
|
|
330
|
+
function verifyRouteGuarded(claim, truthpack) {
|
|
331
|
+
const { path: routePath } = claim.subject;
|
|
332
|
+
const routes = truthpack.routes?.server || [];
|
|
333
|
+
|
|
334
|
+
const match = routes.find(r => r.path === routePath);
|
|
335
|
+
|
|
336
|
+
if (match && match.middlewares && match.middlewares.length > 0) {
|
|
337
|
+
return {
|
|
338
|
+
result: 'true',
|
|
339
|
+
confidence: 'high',
|
|
340
|
+
evidence: match.evidence || [],
|
|
341
|
+
assumptions: [],
|
|
342
|
+
gaps: [],
|
|
343
|
+
nextSteps: [],
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
if (match) {
|
|
348
|
+
return {
|
|
349
|
+
result: 'false',
|
|
350
|
+
confidence: 'med',
|
|
351
|
+
evidence: match.evidence || [],
|
|
352
|
+
assumptions: [],
|
|
353
|
+
gaps: [{
|
|
354
|
+
title: `Route ${routePath} has no detected middleware`,
|
|
355
|
+
severity: 'warn',
|
|
356
|
+
confidence: 'med',
|
|
357
|
+
}],
|
|
358
|
+
nextSteps: [],
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
return {
|
|
363
|
+
result: 'unknown',
|
|
364
|
+
confidence: 'low',
|
|
365
|
+
evidence: [],
|
|
366
|
+
assumptions: [],
|
|
367
|
+
gaps: [],
|
|
368
|
+
nextSteps: [`Route ${routePath} not found in truth pack`],
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* Verify file_exists claim
|
|
374
|
+
*/
|
|
375
|
+
async function verifyFileExists(claim, projectPath) {
|
|
376
|
+
const { path: filePath, name } = claim.subject;
|
|
377
|
+
const targetPath = path.join(projectPath, filePath || name);
|
|
378
|
+
|
|
379
|
+
try {
|
|
380
|
+
await fs.access(targetPath);
|
|
381
|
+
return {
|
|
382
|
+
result: 'true',
|
|
383
|
+
confidence: 'high',
|
|
384
|
+
evidence: [{ id: 'file_check', file: filePath || name, lines: '1', snippetHash: '', reason: 'File exists' }],
|
|
385
|
+
assumptions: [],
|
|
386
|
+
gaps: [],
|
|
387
|
+
nextSteps: [],
|
|
388
|
+
};
|
|
389
|
+
} catch {
|
|
390
|
+
return {
|
|
391
|
+
result: 'false',
|
|
392
|
+
confidence: 'high',
|
|
393
|
+
evidence: [],
|
|
394
|
+
assumptions: [],
|
|
395
|
+
gaps: [],
|
|
396
|
+
nextSteps: [],
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* Verify integration_exists claim
|
|
403
|
+
*/
|
|
404
|
+
function verifyIntegrationExists(claim, truthpack) {
|
|
405
|
+
const { name } = claim.subject;
|
|
406
|
+
const services = truthpack.integrations?.services || [];
|
|
407
|
+
|
|
408
|
+
const match = services.find(s => s.name.toLowerCase() === name.toLowerCase());
|
|
409
|
+
|
|
410
|
+
if (match) {
|
|
411
|
+
return {
|
|
412
|
+
result: 'true',
|
|
413
|
+
confidence: 'high',
|
|
414
|
+
evidence: match.evidence || [],
|
|
415
|
+
assumptions: [],
|
|
416
|
+
gaps: [],
|
|
417
|
+
nextSteps: [],
|
|
418
|
+
};
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
return {
|
|
422
|
+
result: 'false',
|
|
423
|
+
confidence: 'med',
|
|
424
|
+
evidence: [],
|
|
425
|
+
assumptions: [],
|
|
426
|
+
gaps: [],
|
|
427
|
+
nextSteps: [`Search for ${name} imports or SDK usage`],
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
// =============================================================================
|
|
432
|
+
// HELPERS
|
|
433
|
+
// =============================================================================
|
|
434
|
+
|
|
435
|
+
function generateClaimId(claim) {
|
|
436
|
+
const payload = JSON.stringify({ type: claim.type, subject: claim.subject });
|
|
437
|
+
return `clm_${crypto.createHash('sha256').update(payload).digest('hex').slice(0, 8)}`;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
function pathMatches(pattern, path) {
|
|
441
|
+
// Handle Express-style path params (:id, :userId, etc.)
|
|
442
|
+
const patternParts = pattern.split('/');
|
|
443
|
+
const pathParts = path.split('/');
|
|
444
|
+
|
|
445
|
+
if (patternParts.length !== pathParts.length) return false;
|
|
446
|
+
|
|
447
|
+
return patternParts.every((part, i) => {
|
|
448
|
+
if (part.startsWith(':')) return true; // Param placeholder
|
|
449
|
+
if (part === '*') return true; // Wildcard
|
|
450
|
+
return part === pathParts[i];
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
/**
|
|
455
|
+
* Batch validate multiple claims
|
|
456
|
+
*/
|
|
457
|
+
export async function validateClaims(claims, projectPath = process.cwd()) {
|
|
458
|
+
const results = [];
|
|
459
|
+
|
|
460
|
+
for (const claim of claims) {
|
|
461
|
+
const result = await validateClaim(claim, projectPath);
|
|
462
|
+
results.push(result);
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
// Check if any claims are unknown - blocks dependent actions
|
|
466
|
+
const hasUnknown = results.some(r => r.result === 'unknown');
|
|
467
|
+
const hasFalse = results.some(r => r.result === 'false');
|
|
468
|
+
|
|
469
|
+
return {
|
|
470
|
+
claims: results,
|
|
471
|
+
allVerified: !hasUnknown && !hasFalse,
|
|
472
|
+
hasUnknown,
|
|
473
|
+
hasFalse,
|
|
474
|
+
canProceed: !hasUnknown,
|
|
475
|
+
message: hasUnknown
|
|
476
|
+
? '⚠️ Cannot proceed: some claims are unknown. Verify or provide more evidence.'
|
|
477
|
+
: hasFalse
|
|
478
|
+
? '❌ Some claims are false. Review and correct before proceeding.'
|
|
479
|
+
: '✅ All claims verified.',
|
|
480
|
+
};
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
export default { validateClaim, validateClaims };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* runContext.js - AI Rules Generator
|
|
3
|
+
*
|
|
4
|
+
* Generates .cursorrules, .windsurf/rules, and other AI context files.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const path = require("path");
|
|
8
|
+
const { runContext: contextRunner } = require("./context");
|
|
9
|
+
|
|
10
|
+
async function runContext(args) {
|
|
11
|
+
const root = process.cwd();
|
|
12
|
+
|
|
13
|
+
// Parse args
|
|
14
|
+
const opts = {
|
|
15
|
+
output: null,
|
|
16
|
+
format: "all",
|
|
17
|
+
help: false
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
for (let i = 0; i < args.length; i++) {
|
|
21
|
+
const arg = args[i];
|
|
22
|
+
if (arg === "--help" || arg === "-h") opts.help = true;
|
|
23
|
+
else if (arg === "--output" || arg === "-o") opts.output = args[++i];
|
|
24
|
+
else if (arg === "--format" || arg === "-f") opts.format = args[++i];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (opts.help) {
|
|
28
|
+
console.log(`
|
|
29
|
+
vibecheck context - Generate AI rules files
|
|
30
|
+
|
|
31
|
+
USAGE
|
|
32
|
+
vibecheck context Generate all AI rules files
|
|
33
|
+
vibecheck context --format X Generate specific format (cursor, windsurf, all)
|
|
34
|
+
|
|
35
|
+
OPTIONS
|
|
36
|
+
-o, --output <dir> Output directory (default: project root)
|
|
37
|
+
-f, --format <fmt> Format: cursor, windsurf, all (default: all)
|
|
38
|
+
-h, --help Show this help
|
|
39
|
+
`);
|
|
40
|
+
return 0;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
try {
|
|
44
|
+
await contextRunner({
|
|
45
|
+
repoRoot: root,
|
|
46
|
+
output: opts.output,
|
|
47
|
+
format: opts.format
|
|
48
|
+
});
|
|
49
|
+
return 0;
|
|
50
|
+
} catch (error) {
|
|
51
|
+
console.error("Error generating context:", error.message);
|
|
52
|
+
return 1;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
module.exports = { runContext };
|