vibecheck-ai 2.0.2 â 5.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/bin/.generated +25 -0
- package/bin/_deprecations.js +463 -0
- package/bin/_router.js +46 -0
- package/bin/cli-hygiene.js +241 -0
- package/bin/dev/run-v2-torture.js +30 -0
- package/bin/registry.js +656 -0
- package/bin/runners/CLI_REFACTOR_SUMMARY.md +229 -0
- package/bin/runners/ENHANCEMENT_GUIDE.md +121 -0
- package/bin/runners/REPORT_AUDIT.md +64 -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 +513 -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-enhanced.js +2525 -0
- package/bin/runners/context/generators/cursor.js +514 -0
- package/bin/runners/context/generators/mcp.js +169 -0
- package/bin/runners/context/generators/windsurf.js +180 -0
- package/bin/runners/context/git-context.js +304 -0
- package/bin/runners/context/index.js +1110 -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 +1264 -0
- package/bin/runners/context/security-scanner.js +541 -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 +336 -0
- package/bin/runners/lib/__tests__/entitlements-v2.test.js +295 -0
- package/bin/runners/lib/agent-firewall/ai/false-positive-analyzer.js +474 -0
- package/bin/runners/lib/agent-firewall/change-packet/builder.js +488 -0
- package/bin/runners/lib/agent-firewall/change-packet/schema.json +228 -0
- package/bin/runners/lib/agent-firewall/change-packet/store.js +200 -0
- package/bin/runners/lib/agent-firewall/claims/claim-types.js +21 -0
- package/bin/runners/lib/agent-firewall/claims/extractor.js +303 -0
- package/bin/runners/lib/agent-firewall/claims/patterns.js +24 -0
- package/bin/runners/lib/agent-firewall/critic/index.js +151 -0
- package/bin/runners/lib/agent-firewall/critic/judge.js +432 -0
- package/bin/runners/lib/agent-firewall/critic/prompts.js +305 -0
- package/bin/runners/lib/agent-firewall/enforcement/gateway.js +1059 -0
- package/bin/runners/lib/agent-firewall/enforcement/index.js +98 -0
- package/bin/runners/lib/agent-firewall/enforcement/mode.js +318 -0
- package/bin/runners/lib/agent-firewall/enforcement/orchestrator.js +484 -0
- package/bin/runners/lib/agent-firewall/enforcement/proof-artifact.js +418 -0
- package/bin/runners/lib/agent-firewall/enforcement/schemas/change-event.schema.json +173 -0
- package/bin/runners/lib/agent-firewall/enforcement/schemas/intent.schema.json +181 -0
- package/bin/runners/lib/agent-firewall/enforcement/schemas/verdict.schema.json +222 -0
- package/bin/runners/lib/agent-firewall/enforcement/verdict-v2.js +333 -0
- package/bin/runners/lib/agent-firewall/evidence/auth-evidence.js +88 -0
- package/bin/runners/lib/agent-firewall/evidence/contract-evidence.js +75 -0
- package/bin/runners/lib/agent-firewall/evidence/env-evidence.js +127 -0
- package/bin/runners/lib/agent-firewall/evidence/resolver.js +102 -0
- package/bin/runners/lib/agent-firewall/evidence/route-evidence.js +213 -0
- package/bin/runners/lib/agent-firewall/evidence/side-effect-evidence.js +145 -0
- package/bin/runners/lib/agent-firewall/fs-hook/daemon.js +19 -0
- package/bin/runners/lib/agent-firewall/fs-hook/installer.js +87 -0
- package/bin/runners/lib/agent-firewall/fs-hook/watcher.js +184 -0
- package/bin/runners/lib/agent-firewall/git-hook/pre-commit.js +163 -0
- package/bin/runners/lib/agent-firewall/ide-extension/cursor.js +107 -0
- package/bin/runners/lib/agent-firewall/ide-extension/vscode.js +68 -0
- package/bin/runners/lib/agent-firewall/ide-extension/windsurf.js +66 -0
- package/bin/runners/lib/agent-firewall/index.js +200 -0
- package/bin/runners/lib/agent-firewall/integration/index.js +20 -0
- package/bin/runners/lib/agent-firewall/integration/ship-gate.js +437 -0
- package/bin/runners/lib/agent-firewall/intent/alignment-engine.js +634 -0
- package/bin/runners/lib/agent-firewall/intent/auto-detect.js +426 -0
- package/bin/runners/lib/agent-firewall/intent/index.js +102 -0
- package/bin/runners/lib/agent-firewall/intent/schema.js +352 -0
- package/bin/runners/lib/agent-firewall/intent/store.js +283 -0
- package/bin/runners/lib/agent-firewall/interception/fs-interceptor.js +502 -0
- package/bin/runners/lib/agent-firewall/interception/index.js +23 -0
- package/bin/runners/lib/agent-firewall/interceptor/base.js +308 -0
- package/bin/runners/lib/agent-firewall/interceptor/cursor.js +35 -0
- package/bin/runners/lib/agent-firewall/interceptor/vscode.js +35 -0
- package/bin/runners/lib/agent-firewall/interceptor/windsurf.js +34 -0
- package/bin/runners/lib/agent-firewall/lawbook/distributor.js +465 -0
- package/bin/runners/lib/agent-firewall/lawbook/evaluator.js +604 -0
- package/bin/runners/lib/agent-firewall/lawbook/index.js +304 -0
- package/bin/runners/lib/agent-firewall/lawbook/registry.js +514 -0
- package/bin/runners/lib/agent-firewall/lawbook/schema.js +420 -0
- package/bin/runners/lib/agent-firewall/logger.js +141 -0
- package/bin/runners/lib/agent-firewall/policy/default-policy.json +90 -0
- package/bin/runners/lib/agent-firewall/policy/engine.js +103 -0
- package/bin/runners/lib/agent-firewall/policy/loader.js +451 -0
- package/bin/runners/lib/agent-firewall/policy/rules/auth-drift.js +50 -0
- package/bin/runners/lib/agent-firewall/policy/rules/contract-drift.js +50 -0
- package/bin/runners/lib/agent-firewall/policy/rules/fake-success.js +79 -0
- package/bin/runners/lib/agent-firewall/policy/rules/ghost-env.js +227 -0
- package/bin/runners/lib/agent-firewall/policy/rules/ghost-route.js +191 -0
- package/bin/runners/lib/agent-firewall/policy/rules/scope.js +93 -0
- package/bin/runners/lib/agent-firewall/policy/rules/unsafe-side-effect.js +57 -0
- package/bin/runners/lib/agent-firewall/policy/schema.json +183 -0
- package/bin/runners/lib/agent-firewall/policy/verdict.js +54 -0
- package/bin/runners/lib/agent-firewall/proposal/extractor.js +394 -0
- package/bin/runners/lib/agent-firewall/proposal/index.js +212 -0
- package/bin/runners/lib/agent-firewall/proposal/schema.js +251 -0
- package/bin/runners/lib/agent-firewall/proposal/validator.js +386 -0
- package/bin/runners/lib/agent-firewall/reality/index.js +332 -0
- package/bin/runners/lib/agent-firewall/reality/state.js +625 -0
- package/bin/runners/lib/agent-firewall/reality/watcher.js +322 -0
- package/bin/runners/lib/agent-firewall/risk/index.js +173 -0
- package/bin/runners/lib/agent-firewall/risk/scorer.js +328 -0
- package/bin/runners/lib/agent-firewall/risk/thresholds.js +322 -0
- package/bin/runners/lib/agent-firewall/risk/vectors.js +421 -0
- package/bin/runners/lib/agent-firewall/session/collector.js +451 -0
- package/bin/runners/lib/agent-firewall/session/index.js +26 -0
- package/bin/runners/lib/agent-firewall/simulator/diff-simulator.js +472 -0
- package/bin/runners/lib/agent-firewall/simulator/import-resolver.js +346 -0
- package/bin/runners/lib/agent-firewall/simulator/index.js +181 -0
- package/bin/runners/lib/agent-firewall/simulator/route-validator.js +380 -0
- package/bin/runners/lib/agent-firewall/time-machine/incident-correlator.js +661 -0
- package/bin/runners/lib/agent-firewall/time-machine/index.js +267 -0
- package/bin/runners/lib/agent-firewall/time-machine/replay-engine.js +436 -0
- package/bin/runners/lib/agent-firewall/time-machine/state-reconstructor.js +490 -0
- package/bin/runners/lib/agent-firewall/time-machine/timeline-builder.js +530 -0
- package/bin/runners/lib/agent-firewall/truthpack/index.js +67 -0
- package/bin/runners/lib/agent-firewall/truthpack/loader.js +137 -0
- package/bin/runners/lib/agent-firewall/unblock/planner.js +337 -0
- package/bin/runners/lib/agent-firewall/utils/ignore-checker.js +118 -0
- package/bin/runners/lib/ai-bridge.js +416 -0
- package/bin/runners/lib/analysis-core.js +309 -0
- package/bin/runners/lib/analyzers.js +2500 -0
- package/bin/runners/lib/api-client.js +269 -0
- package/bin/runners/lib/approve-output.js +235 -0
- package/bin/runners/lib/artifact-envelope.js +540 -0
- package/bin/runners/lib/assets/vibecheck-logo.png +0 -0
- package/bin/runners/lib/audit-bridge.js +391 -0
- package/bin/runners/lib/auth-shared.js +977 -0
- package/bin/runners/lib/auth-truth.js +193 -0
- package/bin/runners/lib/auth.js +215 -0
- package/bin/runners/lib/authority-badge.js +425 -0
- package/bin/runners/lib/backup.js +62 -0
- package/bin/runners/lib/billing.js +107 -0
- package/bin/runners/lib/checkpoint.js +941 -0
- package/bin/runners/lib/claims.js +118 -0
- package/bin/runners/lib/classify-output.js +204 -0
- package/bin/runners/lib/cleanup/engine.js +571 -0
- package/bin/runners/lib/cleanup/index.js +53 -0
- package/bin/runners/lib/cleanup/output.js +375 -0
- package/bin/runners/lib/cleanup/rules.js +1060 -0
- package/bin/runners/lib/cli-output.js +400 -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 +202 -0
- package/bin/runners/lib/contracts/env-contract.js +181 -0
- package/bin/runners/lib/contracts/external-contract.js +206 -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 +199 -0
- package/bin/runners/lib/contracts.js +804 -0
- package/bin/runners/lib/default-config.js +127 -0
- package/bin/runners/lib/detect.js +89 -0
- package/bin/runners/lib/detectors-v2.js +622 -0
- package/bin/runners/lib/doctor/autofix.js +254 -0
- package/bin/runners/lib/doctor/diagnosis-receipt.js +454 -0
- package/bin/runners/lib/doctor/failure-signatures.js +526 -0
- package/bin/runners/lib/doctor/fix-script.js +336 -0
- package/bin/runners/lib/doctor/index.js +37 -0
- package/bin/runners/lib/doctor/modules/build-tools.js +453 -0
- package/bin/runners/lib/doctor/modules/dependencies.js +325 -0
- package/bin/runners/lib/doctor/modules/index.js +105 -0
- package/bin/runners/lib/doctor/modules/network.js +250 -0
- package/bin/runners/lib/doctor/modules/os-quirks.js +706 -0
- package/bin/runners/lib/doctor/modules/project.js +312 -0
- package/bin/runners/lib/doctor/modules/repo-integrity.js +485 -0
- package/bin/runners/lib/doctor/modules/runtime.js +224 -0
- package/bin/runners/lib/doctor/modules/security.js +350 -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/safe-repair.js +384 -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-output.js +226 -0
- package/bin/runners/lib/doctor-v2.js +608 -0
- package/bin/runners/lib/drift.js +425 -0
- package/bin/runners/lib/enforcement.js +72 -0
- package/bin/runners/lib/engine/ast-cache.js +210 -0
- package/bin/runners/lib/engine/auth-extractor.js +211 -0
- package/bin/runners/lib/engine/billing-extractor.js +112 -0
- package/bin/runners/lib/engine/enforcement-extractor.js +100 -0
- package/bin/runners/lib/engine/env-extractor.js +207 -0
- package/bin/runners/lib/engine/express-extractor.js +208 -0
- package/bin/runners/lib/engine/extractors.js +849 -0
- package/bin/runners/lib/engine/index.js +207 -0
- package/bin/runners/lib/engine/repo-index.js +514 -0
- package/bin/runners/lib/engine/types.js +124 -0
- package/bin/runners/lib/engines/accessibility-engine.js +190 -0
- package/bin/runners/lib/engines/api-consistency-engine.js +162 -0
- package/bin/runners/lib/engines/ast-cache.js +99 -0
- package/bin/runners/lib/engines/attack-detector.js +1192 -0
- package/bin/runners/lib/engines/code-quality-engine.js +255 -0
- package/bin/runners/lib/engines/console-logs-engine.js +115 -0
- package/bin/runners/lib/engines/cross-file-analysis-engine.js +268 -0
- package/bin/runners/lib/engines/dead-code-engine.js +198 -0
- package/bin/runners/lib/engines/deprecated-api-engine.js +226 -0
- package/bin/runners/lib/engines/empty-catch-engine.js +150 -0
- package/bin/runners/lib/engines/file-filter.js +131 -0
- package/bin/runners/lib/engines/hardcoded-secrets-engine.js +251 -0
- package/bin/runners/lib/engines/mock-data-engine.js +272 -0
- package/bin/runners/lib/engines/parallel-processor.js +71 -0
- package/bin/runners/lib/engines/performance-issues-engine.js +265 -0
- package/bin/runners/lib/engines/security-vulnerabilities-engine.js +243 -0
- package/bin/runners/lib/engines/todo-fixme-engine.js +115 -0
- package/bin/runners/lib/engines/type-aware-engine.js +152 -0
- package/bin/runners/lib/engines/unsafe-regex-engine.js +225 -0
- package/bin/runners/lib/engines/vibecheck-engines/README.md +53 -0
- package/bin/runners/lib/engines/vibecheck-engines/index.js +15 -0
- package/bin/runners/lib/engines/vibecheck-engines/lib/ast-cache.js +164 -0
- package/bin/runners/lib/engines/vibecheck-engines/lib/code-quality-engine.js +291 -0
- package/bin/runners/lib/engines/vibecheck-engines/lib/console-logs-engine.js +83 -0
- package/bin/runners/lib/engines/vibecheck-engines/lib/dead-code-engine.js +198 -0
- package/bin/runners/lib/engines/vibecheck-engines/lib/deprecated-api-engine.js +275 -0
- package/bin/runners/lib/engines/vibecheck-engines/lib/empty-catch-engine.js +167 -0
- package/bin/runners/lib/engines/vibecheck-engines/lib/file-filter.js +217 -0
- package/bin/runners/lib/engines/vibecheck-engines/lib/hardcoded-secrets-engine.js +139 -0
- package/bin/runners/lib/engines/vibecheck-engines/lib/mock-data-engine.js +140 -0
- package/bin/runners/lib/engines/vibecheck-engines/lib/parallel-processor.js +164 -0
- package/bin/runners/lib/engines/vibecheck-engines/lib/performance-issues-engine.js +234 -0
- package/bin/runners/lib/engines/vibecheck-engines/lib/type-aware-engine.js +217 -0
- package/bin/runners/lib/engines/vibecheck-engines/lib/unsafe-regex-engine.js +78 -0
- package/bin/runners/lib/engines/vibecheck-engines/package.json +13 -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 +265 -0
- package/bin/runners/lib/entitlements.generated.js +0 -0
- package/bin/runners/lib/entitlements.js +340 -0
- package/bin/runners/lib/env-resolver.js +417 -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 +368 -0
- package/bin/runners/lib/error-messages.js +289 -0
- package/bin/runners/lib/evidence-pack.js +684 -0
- package/bin/runners/lib/exit-codes.js +275 -0
- package/bin/runners/lib/extractors/client-calls.js +990 -0
- package/bin/runners/lib/extractors/fastify-route-dump.js +573 -0
- package/bin/runners/lib/extractors/fastify-routes.js +426 -0
- package/bin/runners/lib/extractors/index.js +363 -0
- package/bin/runners/lib/extractors/next-routes.js +524 -0
- package/bin/runners/lib/extractors/proof-graph.js +431 -0
- package/bin/runners/lib/extractors/route-matcher.js +451 -0
- package/bin/runners/lib/extractors/truthpack-v2.js +377 -0
- package/bin/runners/lib/extractors/ui-bindings.js +547 -0
- package/bin/runners/lib/finding-id.js +69 -0
- package/bin/runners/lib/finding-sorter.js +89 -0
- package/bin/runners/lib/findings-schema.js +281 -0
- package/bin/runners/lib/fingerprint.js +377 -0
- package/bin/runners/lib/firewall-prompt.js +50 -0
- package/bin/runners/lib/fix-output.js +228 -0
- package/bin/runners/lib/global-flags.js +250 -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/help-formatter.js +413 -0
- package/bin/runners/lib/html-proof-report.js +913 -0
- package/bin/runners/lib/html-report.js +650 -0
- package/bin/runners/lib/init-wizard.js +601 -0
- package/bin/runners/lib/interactive-menu.js +1496 -0
- package/bin/runners/lib/json-output.js +76 -0
- package/bin/runners/lib/llm.js +75 -0
- package/bin/runners/lib/logger.js +38 -0
- package/bin/runners/lib/meter.js +61 -0
- package/bin/runners/lib/missions/briefing.js +427 -0
- package/bin/runners/lib/missions/checkpoint.js +753 -0
- package/bin/runners/lib/missions/evidence.js +126 -0
- package/bin/runners/lib/missions/hardening.js +851 -0
- package/bin/runners/lib/missions/plan.js +648 -0
- package/bin/runners/lib/missions/safety-gates.js +645 -0
- package/bin/runners/lib/missions/schema.js +478 -0
- package/bin/runners/lib/missions/templates.js +317 -0
- package/bin/runners/lib/next-action.js +560 -0
- package/bin/runners/lib/packs/bundle.js +675 -0
- package/bin/runners/lib/packs/evidence-pack.js +671 -0
- package/bin/runners/lib/packs/pack-factory.js +837 -0
- package/bin/runners/lib/packs/permissions-pack.js +686 -0
- package/bin/runners/lib/packs/proof-graph-pack.js +779 -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/policy.js +295 -0
- package/bin/runners/lib/polish/accessibility.js +62 -0
- package/bin/runners/lib/polish/analyzer.js +93 -0
- package/bin/runners/lib/polish/backend.js +87 -0
- package/bin/runners/lib/polish/configuration.js +83 -0
- package/bin/runners/lib/polish/documentation.js +83 -0
- package/bin/runners/lib/polish/frontend.js +817 -0
- package/bin/runners/lib/polish/index.js +27 -0
- package/bin/runners/lib/polish/infrastructure.js +80 -0
- package/bin/runners/lib/polish/internationalization.js +85 -0
- package/bin/runners/lib/polish/libraries.js +180 -0
- package/bin/runners/lib/polish/observability.js +75 -0
- package/bin/runners/lib/polish/performance.js +64 -0
- package/bin/runners/lib/polish/privacy.js +110 -0
- package/bin/runners/lib/polish/resilience.js +92 -0
- package/bin/runners/lib/polish/security.js +78 -0
- package/bin/runners/lib/polish/seo.js +71 -0
- package/bin/runners/lib/polish/styles.js +62 -0
- package/bin/runners/lib/polish/utils.js +104 -0
- package/bin/runners/lib/preflight.js +142 -0
- package/bin/runners/lib/prerequisites.js +149 -0
- package/bin/runners/lib/prove-output.js +220 -0
- package/bin/runners/lib/reality/correlation-detectors.js +359 -0
- package/bin/runners/lib/reality/index.js +318 -0
- package/bin/runners/lib/reality/request-hashing.js +416 -0
- package/bin/runners/lib/reality/request-mapper.js +453 -0
- package/bin/runners/lib/reality/safety-rails.js +463 -0
- package/bin/runners/lib/reality/semantic-snapshot.js +408 -0
- package/bin/runners/lib/reality/toast-detector.js +393 -0
- package/bin/runners/lib/reality-findings.js +84 -0
- package/bin/runners/lib/reality-output.js +231 -0
- package/bin/runners/lib/receipts.js +179 -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 +626 -0
- package/bin/runners/lib/report-html.js +1233 -0
- package/bin/runners/lib/report-output.js +366 -0
- package/bin/runners/lib/report-templates.js +967 -0
- package/bin/runners/lib/report.js +135 -0
- package/bin/runners/lib/route-detection.js +1209 -0
- package/bin/runners/lib/route-truth.js +1322 -0
- package/bin/runners/lib/safelist/index.js +96 -0
- package/bin/runners/lib/safelist/integration.js +334 -0
- package/bin/runners/lib/safelist/matcher.js +696 -0
- package/bin/runners/lib/safelist/schema.js +948 -0
- package/bin/runners/lib/safelist/store.js +438 -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/scan-output.js +631 -0
- package/bin/runners/lib/scan-runner.js +135 -0
- package/bin/runners/lib/schema-validator.js +350 -0
- package/bin/runners/lib/schemas/ajv-validator.js +464 -0
- package/bin/runners/lib/schemas/contracts.schema.json +160 -0
- package/bin/runners/lib/schemas/error-envelope.schema.json +105 -0
- package/bin/runners/lib/schemas/finding-v3.schema.json +151 -0
- package/bin/runners/lib/schemas/finding.schema.json +100 -0
- package/bin/runners/lib/schemas/mission-pack.schema.json +206 -0
- package/bin/runners/lib/schemas/proof-graph.schema.json +176 -0
- package/bin/runners/lib/schemas/reality-report.schema.json +162 -0
- package/bin/runners/lib/schemas/report-artifact.schema.json +120 -0
- package/bin/runners/lib/schemas/run-request.schema.json +108 -0
- package/bin/runners/lib/schemas/share-pack.schema.json +180 -0
- package/bin/runners/lib/schemas/ship-manifest.schema.json +251 -0
- package/bin/runners/lib/schemas/ship-report.schema.json +117 -0
- package/bin/runners/lib/schemas/truthpack-v2.schema.json +303 -0
- package/bin/runners/lib/schemas/validator.js +465 -0
- package/bin/runners/lib/schemas/verdict.schema.json +140 -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/ship-gate.js +832 -0
- package/bin/runners/lib/ship-manifest.js +1153 -0
- package/bin/runners/lib/ship-output-enterprise.js +239 -0
- package/bin/runners/lib/ship-output.js +1128 -0
- package/bin/runners/lib/snippets.js +67 -0
- package/bin/runners/lib/status-output.js +340 -0
- package/bin/runners/lib/terminal-ui.js +356 -0
- package/bin/runners/lib/truth.js +1691 -0
- package/bin/runners/lib/ui.js +562 -0
- package/bin/runners/lib/unified-cli-output.js +947 -0
- package/bin/runners/lib/unified-output.js +197 -0
- package/bin/runners/lib/upsell.js +410 -0
- package/bin/runners/lib/usage.js +153 -0
- package/bin/runners/lib/validate-patch.js +156 -0
- package/bin/runners/lib/verdict-engine.js +628 -0
- package/bin/runners/lib/verification.js +345 -0
- package/bin/runners/lib/why-tree.js +650 -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 +229 -0
- package/bin/runners/runAgent.d.ts +5 -0
- package/bin/runners/runAgent.js +161 -0
- package/bin/runners/runAllowlist.js +418 -0
- package/bin/runners/runApprove.js +320 -0
- package/bin/runners/runAudit.js +692 -0
- package/bin/runners/runAuth.js +731 -0
- package/bin/runners/runCI.js +353 -0
- package/bin/runners/runCheckpoint.js +530 -0
- package/bin/runners/runClassify.js +928 -0
- package/bin/runners/runCleanup.js +343 -0
- package/bin/runners/runContext.d.ts +4 -0
- package/bin/runners/runContext.js +175 -0
- package/bin/runners/runDoctor.js +877 -0
- package/bin/runners/runEvidencePack.js +362 -0
- package/bin/runners/runFirewall.d.ts +5 -0
- package/bin/runners/runFirewall.js +134 -0
- package/bin/runners/runFirewallHook.d.ts +5 -0
- package/bin/runners/runFirewallHook.js +56 -0
- package/bin/runners/runFix.js +1355 -0
- package/bin/runners/runForge.js +451 -0
- package/bin/runners/runGuard.js +262 -0
- package/bin/runners/runInit.js +1927 -0
- package/bin/runners/runIntent.js +906 -0
- package/bin/runners/runKickoff.js +878 -0
- package/bin/runners/runLabs.js +424 -0
- package/bin/runners/runLaunch.js +2000 -0
- package/bin/runners/runLink.js +785 -0
- package/bin/runners/runMcp.js +1875 -0
- package/bin/runners/runPacks.js +2089 -0
- package/bin/runners/runPolish.d.ts +4 -0
- package/bin/runners/runPolish.js +390 -0
- package/bin/runners/runPromptFirewall.js +211 -0
- package/bin/runners/runProve.js +1411 -0
- package/bin/runners/runQuickstart.js +531 -0
- package/bin/runners/runReality.js +2260 -0
- package/bin/runners/runReport.js +726 -0
- package/bin/runners/runRuntime.js +110 -0
- package/bin/runners/runSafelist.js +1190 -0
- package/bin/runners/runScan.js +688 -0
- package/bin/runners/runShield.js +1282 -0
- package/bin/runners/runShip.js +1660 -0
- package/bin/runners/runTruth.d.ts +5 -0
- package/bin/runners/runTruth.js +101 -0
- package/bin/runners/runValidate.js +179 -0
- package/bin/runners/runWatch.js +478 -0
- package/bin/runners/utils.js +360 -0
- package/bin/scan.js +617 -0
- package/bin/vibecheck.js +1617 -0
- package/dist/guardrail/index.d.ts +2405 -0
- package/dist/guardrail/index.js +9747 -0
- package/dist/guardrail/index.js.map +1 -0
- package/dist/scanner/index.d.ts +282 -0
- package/dist/scanner/index.js +3395 -0
- package/dist/scanner/index.js.map +1 -0
- package/package.json +123 -104
- package/README.md +0 -491
- package/dist/index.js +0 -99711
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,684 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Evidence Pack Builder
|
|
3
|
+
*
|
|
4
|
+
* Creates shareable "evidence packs" from vibecheck proof runs.
|
|
5
|
+
* Bundles videos, traces, screenshots, and findings into a single artifact.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* const { buildEvidencePack } = require('./lib/evidence-pack');
|
|
9
|
+
* const pack = await buildEvidencePack(projectRoot, { includeVideos: true });
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
"use strict";
|
|
13
|
+
|
|
14
|
+
const fs = require("fs");
|
|
15
|
+
const path = require("path");
|
|
16
|
+
const crypto = require("crypto");
|
|
17
|
+
// Make archiver optional - only required for zip creation
|
|
18
|
+
let archiver;
|
|
19
|
+
try {
|
|
20
|
+
archiver = require("archiver");
|
|
21
|
+
} catch {
|
|
22
|
+
archiver = null;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
|
|
26
|
+
// EVIDENCE PACK SCHEMA
|
|
27
|
+
// âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Evidence Pack Structure:
|
|
31
|
+
* {
|
|
32
|
+
* meta: { ... },
|
|
33
|
+
* summary: { ... },
|
|
34
|
+
* findings: [...],
|
|
35
|
+
* allowlist: { ... },
|
|
36
|
+
* artifacts: { ... }
|
|
37
|
+
* }
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
const EVIDENCE_PACK_VERSION = "1.0.0";
|
|
41
|
+
|
|
42
|
+
// âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
|
|
43
|
+
// ALLOWLIST SCHEMA
|
|
44
|
+
// âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Allowlist Entry Structure:
|
|
48
|
+
* {
|
|
49
|
+
* id: string,
|
|
50
|
+
* findingId: string,
|
|
51
|
+
* pattern: string | RegExp,
|
|
52
|
+
* reason: string, // Why this is allowed
|
|
53
|
+
* addedAt: ISO timestamp,
|
|
54
|
+
* addedBy: string, // user/ci/auto
|
|
55
|
+
* expiresAt?: ISO timestamp,
|
|
56
|
+
* scope: 'global' | 'file' | 'line',
|
|
57
|
+
* file?: string,
|
|
58
|
+
* lines?: [start, end]
|
|
59
|
+
* }
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
const DEFAULT_ALLOWLIST_PATH = ".vibecheck/allowlist.json";
|
|
63
|
+
|
|
64
|
+
function loadAllowlist(projectRoot) {
|
|
65
|
+
const allowlistPath = path.join(projectRoot, DEFAULT_ALLOWLIST_PATH);
|
|
66
|
+
try {
|
|
67
|
+
return JSON.parse(fs.readFileSync(allowlistPath, "utf8"));
|
|
68
|
+
} catch {
|
|
69
|
+
return { version: "1.0.0", entries: [], lastUpdated: null };
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function saveAllowlist(projectRoot, allowlist) {
|
|
74
|
+
const allowlistPath = path.join(projectRoot, DEFAULT_ALLOWLIST_PATH);
|
|
75
|
+
fs.mkdirSync(path.dirname(allowlistPath), { recursive: true });
|
|
76
|
+
allowlist.lastUpdated = new Date().toISOString();
|
|
77
|
+
fs.writeFileSync(allowlistPath, JSON.stringify(allowlist, null, 2), "utf8");
|
|
78
|
+
return allowlistPath;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function addToAllowlist(projectRoot, entry) {
|
|
82
|
+
const allowlist = loadAllowlist(projectRoot);
|
|
83
|
+
|
|
84
|
+
// Generate ID if not provided
|
|
85
|
+
if (!entry.id) {
|
|
86
|
+
entry.id = `AL_${crypto.randomBytes(4).toString("hex")}`;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Set defaults
|
|
90
|
+
entry.addedAt = entry.addedAt || new Date().toISOString();
|
|
91
|
+
entry.addedBy = entry.addedBy || "user";
|
|
92
|
+
entry.scope = entry.scope || "global";
|
|
93
|
+
|
|
94
|
+
// Check for duplicates
|
|
95
|
+
const existing = allowlist.entries.find(e =>
|
|
96
|
+
e.pattern === entry.pattern && e.scope === entry.scope
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
if (existing) {
|
|
100
|
+
// Update existing entry
|
|
101
|
+
Object.assign(existing, entry);
|
|
102
|
+
} else {
|
|
103
|
+
allowlist.entries.push(entry);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
saveAllowlist(projectRoot, allowlist);
|
|
107
|
+
return entry;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function isAllowlisted(finding, allowlist) {
|
|
111
|
+
if (!allowlist || !allowlist.entries) return false;
|
|
112
|
+
|
|
113
|
+
const now = new Date();
|
|
114
|
+
|
|
115
|
+
for (const entry of allowlist.entries) {
|
|
116
|
+
// Check expiration
|
|
117
|
+
if (entry.expiresAt && new Date(entry.expiresAt) < now) {
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// Check by finding ID
|
|
122
|
+
if (entry.findingId && entry.findingId === finding.id) {
|
|
123
|
+
return { allowed: true, reason: entry.reason, entry };
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Check by pattern
|
|
127
|
+
if (entry.pattern) {
|
|
128
|
+
const pattern = typeof entry.pattern === 'string'
|
|
129
|
+
? new RegExp(entry.pattern, 'i')
|
|
130
|
+
: entry.pattern;
|
|
131
|
+
|
|
132
|
+
// Match against finding title, page, or file
|
|
133
|
+
if (
|
|
134
|
+
pattern.test(finding.title || '') ||
|
|
135
|
+
pattern.test(finding.page || '') ||
|
|
136
|
+
pattern.test(finding.file || '') ||
|
|
137
|
+
(finding.evidence && finding.evidence.some(e => pattern.test(e.file || '')))
|
|
138
|
+
) {
|
|
139
|
+
// Check scope
|
|
140
|
+
if (entry.scope === 'global') {
|
|
141
|
+
return { allowed: true, reason: entry.reason, entry };
|
|
142
|
+
}
|
|
143
|
+
if (entry.scope === 'file' && entry.file === finding.file) {
|
|
144
|
+
return { allowed: true, reason: entry.reason, entry };
|
|
145
|
+
}
|
|
146
|
+
if (entry.scope === 'line' && entry.file === finding.file) {
|
|
147
|
+
const findingLine = finding.line || (finding.evidence?.[0]?.line);
|
|
148
|
+
if (findingLine && entry.lines) {
|
|
149
|
+
const [start, end] = entry.lines;
|
|
150
|
+
if (findingLine >= start && findingLine <= end) {
|
|
151
|
+
return { allowed: true, reason: entry.reason, entry };
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return { allowed: false };
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function filterByAllowlist(findings, allowlist) {
|
|
163
|
+
const filtered = [];
|
|
164
|
+
const allowed = [];
|
|
165
|
+
|
|
166
|
+
for (const finding of findings) {
|
|
167
|
+
const result = isAllowlisted(finding, allowlist);
|
|
168
|
+
if (result.allowed) {
|
|
169
|
+
allowed.push({
|
|
170
|
+
finding,
|
|
171
|
+
reason: result.reason,
|
|
172
|
+
entryId: result.entry?.id
|
|
173
|
+
});
|
|
174
|
+
} else {
|
|
175
|
+
filtered.push(finding);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
return { filtered, allowed };
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
|
|
183
|
+
// EVIDENCE STRUCTURE (What, Where, Why)
|
|
184
|
+
// âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Enhanced Evidence Structure:
|
|
188
|
+
* {
|
|
189
|
+
* what: string, // What was found
|
|
190
|
+
* where: { // Where it was found
|
|
191
|
+
* file: string,
|
|
192
|
+
* line: number,
|
|
193
|
+
* column?: number,
|
|
194
|
+
* snippet?: string,
|
|
195
|
+
* url?: string // For runtime findings
|
|
196
|
+
* },
|
|
197
|
+
* why: string, // Why this is a problem
|
|
198
|
+
* confidence: number, // 0.0 - 1.0
|
|
199
|
+
* category: string,
|
|
200
|
+
* severity: 'BLOCK' | 'WARN' | 'INFO',
|
|
201
|
+
* fixHint?: string,
|
|
202
|
+
* related?: Evidence[]
|
|
203
|
+
* }
|
|
204
|
+
*/
|
|
205
|
+
|
|
206
|
+
function enrichEvidence(finding) {
|
|
207
|
+
const evidence = {
|
|
208
|
+
what: finding.title || finding.message || 'Unknown finding',
|
|
209
|
+
where: {},
|
|
210
|
+
why: finding.reason || finding.why || 'Potential issue detected',
|
|
211
|
+
confidence: finding.confidence || 0.8,
|
|
212
|
+
category: finding.category || 'Unknown',
|
|
213
|
+
severity: finding.severity || 'WARN'
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
// Populate where
|
|
217
|
+
if (finding.file) {
|
|
218
|
+
evidence.where.file = finding.file;
|
|
219
|
+
}
|
|
220
|
+
if (finding.line) {
|
|
221
|
+
evidence.where.line = finding.line;
|
|
222
|
+
}
|
|
223
|
+
if (finding.page || finding.url) {
|
|
224
|
+
evidence.where.url = finding.page || finding.url;
|
|
225
|
+
}
|
|
226
|
+
if (finding.snippet || finding.code) {
|
|
227
|
+
evidence.where.snippet = finding.snippet || finding.code;
|
|
228
|
+
}
|
|
229
|
+
if (finding.screenshot) {
|
|
230
|
+
evidence.where.screenshot = finding.screenshot;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// Add legacy evidence array if present
|
|
234
|
+
if (finding.evidence && Array.isArray(finding.evidence)) {
|
|
235
|
+
evidence.where.file = evidence.where.file || finding.evidence[0]?.file;
|
|
236
|
+
evidence.where.line = evidence.where.line || finding.evidence[0]?.line;
|
|
237
|
+
evidence.where.snippet = evidence.where.snippet || finding.evidence[0]?.snippet;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// Add fix hint
|
|
241
|
+
if (finding.fixHints && finding.fixHints.length > 0) {
|
|
242
|
+
evidence.fixHint = finding.fixHints[0];
|
|
243
|
+
} else if (finding.fix) {
|
|
244
|
+
evidence.fixHint = finding.fix;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
return evidence;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
|
|
251
|
+
// EVIDENCE PACK BUILDER
|
|
252
|
+
// âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
|
|
253
|
+
|
|
254
|
+
async function buildEvidencePack(projectRoot, options = {}) {
|
|
255
|
+
const {
|
|
256
|
+
includeVideos = true,
|
|
257
|
+
includeTraces = true,
|
|
258
|
+
includeScreenshots = true,
|
|
259
|
+
includeHar = true,
|
|
260
|
+
outputPath = null,
|
|
261
|
+
proveDir = null,
|
|
262
|
+
realityDir = null,
|
|
263
|
+
applyAllowlist = true
|
|
264
|
+
} = options;
|
|
265
|
+
|
|
266
|
+
const outDir = path.join(projectRoot, ".vibecheck", "evidence-packs");
|
|
267
|
+
fs.mkdirSync(outDir, { recursive: true });
|
|
268
|
+
|
|
269
|
+
// Load latest reports
|
|
270
|
+
const proveReportPath = proveDir
|
|
271
|
+
? path.join(proveDir, "prove_report.json")
|
|
272
|
+
: findLatestReport(projectRoot, "prove");
|
|
273
|
+
const realityReportPath = realityDir
|
|
274
|
+
? path.join(realityDir, "reality_report.json")
|
|
275
|
+
: findLatestReport(projectRoot, "reality");
|
|
276
|
+
const shipReportPath = path.join(projectRoot, ".vibecheck", "last_ship.json");
|
|
277
|
+
|
|
278
|
+
let proveReport = null;
|
|
279
|
+
let realityReport = null;
|
|
280
|
+
let shipReport = null;
|
|
281
|
+
|
|
282
|
+
try { proveReport = JSON.parse(fs.readFileSync(proveReportPath, "utf8")); } catch {}
|
|
283
|
+
try { realityReport = JSON.parse(fs.readFileSync(realityReportPath, "utf8")); } catch {}
|
|
284
|
+
try { shipReport = JSON.parse(fs.readFileSync(shipReportPath, "utf8")); } catch {}
|
|
285
|
+
|
|
286
|
+
if (!proveReport && !realityReport && !shipReport) {
|
|
287
|
+
throw new Error("No proof reports found. Run vibecheck prove or reality first.");
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
// Load allowlist
|
|
291
|
+
const allowlist = applyAllowlist ? loadAllowlist(projectRoot) : null;
|
|
292
|
+
|
|
293
|
+
// Collect all findings
|
|
294
|
+
let allFindings = [];
|
|
295
|
+
if (proveReport?.findings) allFindings.push(...proveReport.findings);
|
|
296
|
+
if (realityReport?.findings) allFindings.push(...realityReport.findings);
|
|
297
|
+
if (shipReport?.findings) allFindings.push(...shipReport.findings);
|
|
298
|
+
|
|
299
|
+
// Dedupe findings by ID
|
|
300
|
+
const seenIds = new Set();
|
|
301
|
+
allFindings = allFindings.filter(f => {
|
|
302
|
+
if (seenIds.has(f.id)) return false;
|
|
303
|
+
seenIds.add(f.id);
|
|
304
|
+
return true;
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
// Apply allowlist filtering
|
|
308
|
+
let findings = allFindings;
|
|
309
|
+
let allowedFindings = [];
|
|
310
|
+
if (allowlist) {
|
|
311
|
+
const result = filterByAllowlist(allFindings, allowlist);
|
|
312
|
+
findings = result.filtered;
|
|
313
|
+
allowedFindings = result.allowed;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
// Enrich evidence
|
|
317
|
+
const enrichedFindings = findings.map(enrichEvidence);
|
|
318
|
+
|
|
319
|
+
// Build summary
|
|
320
|
+
const summary = {
|
|
321
|
+
totalFindings: allFindings.length,
|
|
322
|
+
filteredFindings: findings.length,
|
|
323
|
+
allowlistedCount: allowedFindings.length,
|
|
324
|
+
blocks: findings.filter(f => f.severity === 'BLOCK').length,
|
|
325
|
+
warns: findings.filter(f => f.severity === 'WARN').length,
|
|
326
|
+
verdict: proveReport?.verdict || shipReport?.meta?.verdict || 'UNKNOWN',
|
|
327
|
+
coverage: realityReport?.coverage || null
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
// Collect artifacts
|
|
331
|
+
const artifacts = {
|
|
332
|
+
screenshots: [],
|
|
333
|
+
videos: [],
|
|
334
|
+
traces: [],
|
|
335
|
+
har: []
|
|
336
|
+
};
|
|
337
|
+
|
|
338
|
+
// Find artifact directories
|
|
339
|
+
const realityBase = realityReportPath ? path.dirname(realityReportPath) : null;
|
|
340
|
+
|
|
341
|
+
if (realityBase) {
|
|
342
|
+
// Screenshots
|
|
343
|
+
if (includeScreenshots) {
|
|
344
|
+
const shotsDir = path.join(realityBase, "screenshots");
|
|
345
|
+
if (fs.existsSync(shotsDir)) {
|
|
346
|
+
artifacts.screenshots = fs.readdirSync(shotsDir)
|
|
347
|
+
.filter(f => /\.(png|jpg|jpeg)$/i.test(f))
|
|
348
|
+
.map(f => path.join(shotsDir, f));
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
// Videos
|
|
353
|
+
if (includeVideos) {
|
|
354
|
+
const videosDir = path.join(realityBase, "videos");
|
|
355
|
+
if (fs.existsSync(videosDir)) {
|
|
356
|
+
artifacts.videos = fs.readdirSync(videosDir)
|
|
357
|
+
.filter(f => /\.(webm|mp4)$/i.test(f))
|
|
358
|
+
.map(f => path.join(videosDir, f));
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
// Traces
|
|
363
|
+
if (includeTraces) {
|
|
364
|
+
const tracesDir = path.join(realityBase, "traces");
|
|
365
|
+
if (fs.existsSync(tracesDir)) {
|
|
366
|
+
artifacts.traces = fs.readdirSync(tracesDir)
|
|
367
|
+
.filter(f => /\.zip$/i.test(f))
|
|
368
|
+
.map(f => path.join(tracesDir, f));
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
// HAR
|
|
373
|
+
if (includeHar) {
|
|
374
|
+
const harDir = path.join(realityBase, "har");
|
|
375
|
+
if (fs.existsSync(harDir)) {
|
|
376
|
+
artifacts.har = fs.readdirSync(harDir)
|
|
377
|
+
.filter(f => /\.har$/i.test(f))
|
|
378
|
+
.map(f => path.join(harDir, f));
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
// Build evidence pack manifest
|
|
384
|
+
const packId = `EP_${Date.now()}_${crypto.randomBytes(4).toString("hex")}`;
|
|
385
|
+
const manifest = {
|
|
386
|
+
id: packId,
|
|
387
|
+
version: EVIDENCE_PACK_VERSION,
|
|
388
|
+
meta: {
|
|
389
|
+
createdAt: new Date().toISOString(),
|
|
390
|
+
projectName: path.basename(projectRoot),
|
|
391
|
+
projectRoot: projectRoot,
|
|
392
|
+
proveReport: proveReportPath ? path.relative(projectRoot, proveReportPath) : null,
|
|
393
|
+
realityReport: realityReportPath ? path.relative(projectRoot, realityReportPath) : null,
|
|
394
|
+
shipReport: shipReportPath && fs.existsSync(shipReportPath) ? path.relative(projectRoot, shipReportPath) : null
|
|
395
|
+
},
|
|
396
|
+
summary,
|
|
397
|
+
findings: enrichedFindings,
|
|
398
|
+
allowlist: allowlist ? {
|
|
399
|
+
applied: true,
|
|
400
|
+
entriesCount: allowlist.entries?.length || 0,
|
|
401
|
+
allowedFindings: allowedFindings.map(a => ({
|
|
402
|
+
findingId: a.finding.id,
|
|
403
|
+
reason: a.reason
|
|
404
|
+
}))
|
|
405
|
+
} : { applied: false },
|
|
406
|
+
artifacts: {
|
|
407
|
+
screenshots: artifacts.screenshots.map(p => path.relative(projectRoot, p)),
|
|
408
|
+
videos: artifacts.videos.map(p => path.relative(projectRoot, p)),
|
|
409
|
+
traces: artifacts.traces.map(p => path.relative(projectRoot, p)),
|
|
410
|
+
har: artifacts.har.map(p => path.relative(projectRoot, p))
|
|
411
|
+
}
|
|
412
|
+
};
|
|
413
|
+
|
|
414
|
+
// Write manifest
|
|
415
|
+
const manifestPath = path.join(outDir, `${packId}_manifest.json`);
|
|
416
|
+
fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2), "utf8");
|
|
417
|
+
|
|
418
|
+
// Create zip bundle if requested
|
|
419
|
+
let zipPath = null;
|
|
420
|
+
if (outputPath || artifacts.videos.length > 0 || artifacts.traces.length > 0) {
|
|
421
|
+
zipPath = outputPath || path.join(outDir, `${packId}.zip`);
|
|
422
|
+
await createEvidenceZip(projectRoot, manifest, artifacts, zipPath);
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
return {
|
|
426
|
+
id: packId,
|
|
427
|
+
manifest,
|
|
428
|
+
manifestPath,
|
|
429
|
+
zipPath,
|
|
430
|
+
summary
|
|
431
|
+
};
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
async function createEvidenceZip(projectRoot, manifest, artifacts, outputPath) {
|
|
435
|
+
return new Promise((resolve, reject) => {
|
|
436
|
+
// Check if archiver is available, otherwise skip zip creation
|
|
437
|
+
let archiver;
|
|
438
|
+
try {
|
|
439
|
+
archiver = require("archiver");
|
|
440
|
+
} catch {
|
|
441
|
+
// archiver not installed, skip zip creation
|
|
442
|
+
resolve({ skipped: true, reason: "archiver not installed" });
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
const output = fs.createWriteStream(outputPath);
|
|
447
|
+
const archive = archiver("zip", { zlib: { level: 9 } });
|
|
448
|
+
|
|
449
|
+
output.on("close", () => resolve({ path: outputPath, size: archive.pointer() }));
|
|
450
|
+
archive.on("error", reject);
|
|
451
|
+
|
|
452
|
+
archive.pipe(output);
|
|
453
|
+
|
|
454
|
+
// Add manifest
|
|
455
|
+
archive.append(JSON.stringify(manifest, null, 2), { name: "manifest.json" });
|
|
456
|
+
|
|
457
|
+
// Add artifacts
|
|
458
|
+
for (const screenshot of artifacts.screenshots) {
|
|
459
|
+
if (fs.existsSync(screenshot)) {
|
|
460
|
+
archive.file(screenshot, { name: `screenshots/${path.basename(screenshot)}` });
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
for (const video of artifacts.videos) {
|
|
465
|
+
if (fs.existsSync(video)) {
|
|
466
|
+
archive.file(video, { name: `videos/${path.basename(video)}` });
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
for (const trace of artifacts.traces) {
|
|
471
|
+
if (fs.existsSync(trace)) {
|
|
472
|
+
archive.file(trace, { name: `traces/${path.basename(trace)}` });
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
for (const har of artifacts.har) {
|
|
477
|
+
if (fs.existsSync(har)) {
|
|
478
|
+
archive.file(har, { name: `har/${path.basename(har)}` });
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
archive.finalize();
|
|
483
|
+
});
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
function findLatestReport(projectRoot, type) {
|
|
487
|
+
const baseDir = path.join(projectRoot, ".vibecheck", type);
|
|
488
|
+
|
|
489
|
+
// Check for latest.json pointer
|
|
490
|
+
const latestPath = path.join(baseDir, "latest.json");
|
|
491
|
+
try {
|
|
492
|
+
const latest = JSON.parse(fs.readFileSync(latestPath, "utf8"));
|
|
493
|
+
const reportPath = path.join(projectRoot, latest.latest, `${type}_report.json`);
|
|
494
|
+
if (fs.existsSync(reportPath)) return reportPath;
|
|
495
|
+
} catch {}
|
|
496
|
+
|
|
497
|
+
// Fall back to scanning directories
|
|
498
|
+
try {
|
|
499
|
+
const dirs = fs.readdirSync(baseDir)
|
|
500
|
+
.filter(d => /^\d{8}_\d{6}$/.test(d))
|
|
501
|
+
.sort()
|
|
502
|
+
.reverse();
|
|
503
|
+
|
|
504
|
+
for (const dir of dirs) {
|
|
505
|
+
const reportPath = path.join(baseDir, dir, `${type}_report.json`);
|
|
506
|
+
if (fs.existsSync(reportPath)) return reportPath;
|
|
507
|
+
}
|
|
508
|
+
} catch {}
|
|
509
|
+
|
|
510
|
+
return null;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
// âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
|
|
514
|
+
// MARKDOWN REPORT GENERATOR
|
|
515
|
+
// âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
|
|
516
|
+
|
|
517
|
+
function generateMarkdownReport(pack) {
|
|
518
|
+
const { manifest, summary } = pack;
|
|
519
|
+
const verdict = summary.verdict;
|
|
520
|
+
const verdictEmoji = verdict === 'SHIP' ? 'â
' : verdict === 'WARN' ? 'â ī¸' : 'đ';
|
|
521
|
+
|
|
522
|
+
let md = `# Evidence Pack Report
|
|
523
|
+
|
|
524
|
+
## ${verdictEmoji} Verdict: ${verdict}
|
|
525
|
+
|
|
526
|
+
**Generated:** ${manifest.meta.createdAt}
|
|
527
|
+
**Project:** ${manifest.meta.projectName}
|
|
528
|
+
|
|
529
|
+
---
|
|
530
|
+
|
|
531
|
+
## Summary
|
|
532
|
+
|
|
533
|
+
| Metric | Value |
|
|
534
|
+
|--------|-------|
|
|
535
|
+
| Total Findings | ${summary.totalFindings} |
|
|
536
|
+
| Filtered (after allowlist) | ${summary.filteredFindings} |
|
|
537
|
+
| Allowlisted | ${summary.allowlistedCount} |
|
|
538
|
+
| **BLOCK** | ${summary.blocks} |
|
|
539
|
+
| **WARN** | ${summary.warns} |
|
|
540
|
+
|
|
541
|
+
`;
|
|
542
|
+
|
|
543
|
+
if (summary.coverage) {
|
|
544
|
+
md += `
|
|
545
|
+
### Coverage
|
|
546
|
+
|
|
547
|
+
- **Pages Hit:** ${summary.coverage.hit} / ${summary.coverage.total}
|
|
548
|
+
- **Coverage:** ${summary.coverage.percent}%
|
|
549
|
+
|
|
550
|
+
`;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
if (manifest.findings.length > 0) {
|
|
554
|
+
md += `
|
|
555
|
+
---
|
|
556
|
+
|
|
557
|
+
## Findings
|
|
558
|
+
|
|
559
|
+
`;
|
|
560
|
+
|
|
561
|
+
for (const finding of manifest.findings.slice(0, 20)) {
|
|
562
|
+
const severityIcon = finding.severity === 'BLOCK' ? 'đ' : finding.severity === 'WARN' ? 'â ī¸' : 'âšī¸';
|
|
563
|
+
|
|
564
|
+
md += `### ${severityIcon} ${finding.what}
|
|
565
|
+
|
|
566
|
+
- **Category:** ${finding.category}
|
|
567
|
+
- **Confidence:** ${Math.round(finding.confidence * 100)}%
|
|
568
|
+
`;
|
|
569
|
+
|
|
570
|
+
if (finding.where.file) {
|
|
571
|
+
md += `- **File:** \`${finding.where.file}\``;
|
|
572
|
+
if (finding.where.line) md += `:${finding.where.line}`;
|
|
573
|
+
md += '\n';
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
if (finding.where.url) {
|
|
577
|
+
md += `- **URL:** ${finding.where.url}\n`;
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
if (finding.where.screenshot) {
|
|
581
|
+
md += `- **Screenshot:** ${finding.where.screenshot}\n`;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
md += `
|
|
585
|
+
**Why:** ${finding.why}
|
|
586
|
+
`;
|
|
587
|
+
|
|
588
|
+
if (finding.fixHint) {
|
|
589
|
+
md += `
|
|
590
|
+
**Fix:** ${finding.fixHint}
|
|
591
|
+
`;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
md += '\n';
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
if (manifest.findings.length > 20) {
|
|
598
|
+
md += `\n_...and ${manifest.findings.length - 20} more findings. See manifest.json for full details._\n`;
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
if (manifest.artifacts.videos.length > 0 || manifest.artifacts.traces.length > 0) {
|
|
603
|
+
md += `
|
|
604
|
+
---
|
|
605
|
+
|
|
606
|
+
## Visual Artifacts
|
|
607
|
+
|
|
608
|
+
`;
|
|
609
|
+
|
|
610
|
+
if (manifest.artifacts.videos.length > 0) {
|
|
611
|
+
md += `### Videos
|
|
612
|
+
|
|
613
|
+
`;
|
|
614
|
+
for (const video of manifest.artifacts.videos) {
|
|
615
|
+
md += `- [${path.basename(video)}](${video})\n`;
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
if (manifest.artifacts.traces.length > 0) {
|
|
620
|
+
md += `
|
|
621
|
+
### Traces
|
|
622
|
+
|
|
623
|
+
View traces at [trace.playwright.dev](https://trace.playwright.dev)
|
|
624
|
+
|
|
625
|
+
`;
|
|
626
|
+
for (const trace of manifest.artifacts.traces) {
|
|
627
|
+
md += `- [${path.basename(trace)}](${trace})\n`;
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
if (manifest.allowlist.applied && manifest.allowlist.allowedFindings.length > 0) {
|
|
633
|
+
md += `
|
|
634
|
+
---
|
|
635
|
+
|
|
636
|
+
## Allowlisted Findings
|
|
637
|
+
|
|
638
|
+
The following findings were filtered by the allowlist:
|
|
639
|
+
|
|
640
|
+
| Finding ID | Reason |
|
|
641
|
+
|------------|--------|
|
|
642
|
+
`;
|
|
643
|
+
|
|
644
|
+
for (const allowed of manifest.allowlist.allowedFindings.slice(0, 10)) {
|
|
645
|
+
md += `| \`${allowed.findingId}\` | ${allowed.reason || 'No reason provided'} |\n`;
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
if (manifest.allowlist.allowedFindings.length > 10) {
|
|
649
|
+
md += `\n_...and ${manifest.allowlist.allowedFindings.length - 10} more._\n`;
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
md += `
|
|
654
|
+
---
|
|
655
|
+
|
|
656
|
+
_Generated by vibecheck evidence-pack v${EVIDENCE_PACK_VERSION}_
|
|
657
|
+
`;
|
|
658
|
+
|
|
659
|
+
return md;
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
// âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
|
|
663
|
+
// EXPORTS
|
|
664
|
+
// âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
|
|
665
|
+
|
|
666
|
+
module.exports = {
|
|
667
|
+
// Core functions
|
|
668
|
+
buildEvidencePack,
|
|
669
|
+
generateMarkdownReport,
|
|
670
|
+
|
|
671
|
+
// Allowlist functions
|
|
672
|
+
loadAllowlist,
|
|
673
|
+
saveAllowlist,
|
|
674
|
+
addToAllowlist,
|
|
675
|
+
isAllowlisted,
|
|
676
|
+
filterByAllowlist,
|
|
677
|
+
|
|
678
|
+
// Evidence helpers
|
|
679
|
+
enrichEvidence,
|
|
680
|
+
|
|
681
|
+
// Constants
|
|
682
|
+
EVIDENCE_PACK_VERSION,
|
|
683
|
+
DEFAULT_ALLOWLIST_PATH
|
|
684
|
+
};
|