vibecheck-ai 2.0.1 → 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,837 @@
|
|
|
1
|
+
// bin/runners/lib/packs/pack-factory.js
|
|
2
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
3
|
+
// PACK FACTORY - Unified artifact factory for shareable evidence bundles
|
|
4
|
+
// "One command to produce ZIP + manifest + HTML index"
|
|
5
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
6
|
+
|
|
7
|
+
const fs = require('fs');
|
|
8
|
+
const path = require('path');
|
|
9
|
+
const crypto = require('crypto');
|
|
10
|
+
const { execSync } = require('child_process');
|
|
11
|
+
|
|
12
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
13
|
+
// CONSTANTS
|
|
14
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
15
|
+
|
|
16
|
+
const PACK_SCHEMA_VERSION = '1.0.0';
|
|
17
|
+
const MANIFEST_SCHEMA = 'vibecheck/pack-manifest/v1';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Pack types
|
|
21
|
+
*/
|
|
22
|
+
const PACK_TYPE = {
|
|
23
|
+
EVIDENCE: 'evidence',
|
|
24
|
+
PERMISSIONS: 'permissions',
|
|
25
|
+
PROOF_GRAPH: 'proof-graph',
|
|
26
|
+
REPORT: 'report',
|
|
27
|
+
LAUNCH: 'launch',
|
|
28
|
+
BUNDLE: 'bundle', // All-in-one bundle
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Artifact types
|
|
33
|
+
*/
|
|
34
|
+
const ARTIFACT_TYPE = {
|
|
35
|
+
JSON: 'json',
|
|
36
|
+
HTML: 'html',
|
|
37
|
+
MARKDOWN: 'markdown',
|
|
38
|
+
PDF: 'pdf',
|
|
39
|
+
SARIF: 'sarif',
|
|
40
|
+
CSV: 'csv',
|
|
41
|
+
DOT: 'dot',
|
|
42
|
+
MERMAID: 'mermaid',
|
|
43
|
+
PNG: 'png',
|
|
44
|
+
SVG: 'svg',
|
|
45
|
+
ZIP: 'zip',
|
|
46
|
+
VIDEO: 'video',
|
|
47
|
+
TRACE: 'trace',
|
|
48
|
+
HAR: 'har',
|
|
49
|
+
SCREENSHOT: 'screenshot',
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
53
|
+
// STABLE NAMING SCHEME
|
|
54
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Generate deterministic content hash
|
|
58
|
+
* @param {string|Buffer} content - Content to hash
|
|
59
|
+
* @returns {string} First 12 chars of SHA256
|
|
60
|
+
*/
|
|
61
|
+
function contentHash(content) {
|
|
62
|
+
return crypto.createHash('sha256').update(content).digest('hex').slice(0, 12);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Generate stable pack ID
|
|
67
|
+
* Format: {type}_{projectName}_{date}_{contentHash}
|
|
68
|
+
* @param {string} packType - Pack type
|
|
69
|
+
* @param {string} projectName - Project name
|
|
70
|
+
* @param {string} [hashSeed] - Optional content for hash
|
|
71
|
+
* @returns {string} Stable pack ID
|
|
72
|
+
*/
|
|
73
|
+
function generatePackId(packType, projectName, hashSeed = '') {
|
|
74
|
+
const sanitizedProject = (projectName || 'project')
|
|
75
|
+
.toLowerCase()
|
|
76
|
+
.replace(/[^a-z0-9]/g, '-')
|
|
77
|
+
.slice(0, 20);
|
|
78
|
+
|
|
79
|
+
const date = new Date().toISOString().split('T')[0].replace(/-/g, '');
|
|
80
|
+
const hash = contentHash(`${packType}:${projectName}:${hashSeed}:${Date.now()}`);
|
|
81
|
+
|
|
82
|
+
return `${packType}_${sanitizedProject}_${date}_${hash}`;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Generate stable artifact filename
|
|
87
|
+
* Format: {packId}_{artifactType}.{extension}
|
|
88
|
+
* @param {string} packId - Pack ID
|
|
89
|
+
* @param {string} artifactType - Artifact type
|
|
90
|
+
* @param {string} extension - File extension
|
|
91
|
+
* @returns {string} Artifact filename
|
|
92
|
+
*/
|
|
93
|
+
function generateArtifactFilename(packId, artifactType, extension) {
|
|
94
|
+
return `${packId}_${artifactType}.${extension}`;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Generate reproducible build fingerprint
|
|
99
|
+
* @param {object} data - Data to fingerprint
|
|
100
|
+
* @returns {string} Fingerprint hash
|
|
101
|
+
*/
|
|
102
|
+
function generateFingerprint(data) {
|
|
103
|
+
const normalized = JSON.stringify(data, Object.keys(data).sort());
|
|
104
|
+
return crypto.createHash('sha256').update(normalized).digest('hex');
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
108
|
+
// GIT INFO
|
|
109
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Get git info for manifest
|
|
113
|
+
* @param {string} repoRoot - Repository root
|
|
114
|
+
* @returns {object} Git info
|
|
115
|
+
*/
|
|
116
|
+
function getGitInfo(repoRoot) {
|
|
117
|
+
try {
|
|
118
|
+
const commit = execSync('git rev-parse HEAD', { cwd: repoRoot, encoding: 'utf8', stdio: ['pipe', 'pipe', 'pipe'] }).trim();
|
|
119
|
+
const branch = execSync('git rev-parse --abbrev-ref HEAD', { cwd: repoRoot, encoding: 'utf8', stdio: ['pipe', 'pipe', 'pipe'] }).trim();
|
|
120
|
+
const dirty = execSync('git status --porcelain', { cwd: repoRoot, encoding: 'utf8', stdio: ['pipe', 'pipe', 'pipe'] }).trim().length > 0;
|
|
121
|
+
|
|
122
|
+
let remoteUrl = null;
|
|
123
|
+
try {
|
|
124
|
+
remoteUrl = execSync('git remote get-url origin', { cwd: repoRoot, encoding: 'utf8', stdio: ['pipe', 'pipe', 'pipe'] }).trim();
|
|
125
|
+
} catch (e) {
|
|
126
|
+
// No remote
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return { commit, branch, dirty, remoteUrl };
|
|
130
|
+
} catch (e) {
|
|
131
|
+
return { commit: null, branch: null, dirty: false, remoteUrl: null };
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
136
|
+
// RECEIPT CROSS-LINKING
|
|
137
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Load receipt if it exists
|
|
141
|
+
* @param {string} repoRoot - Repository root
|
|
142
|
+
* @param {string} receiptPath - Relative path to receipt
|
|
143
|
+
* @returns {object|null} Receipt or null
|
|
144
|
+
*/
|
|
145
|
+
function loadReceipt(repoRoot, receiptPath) {
|
|
146
|
+
const fullPath = path.join(repoRoot, receiptPath);
|
|
147
|
+
if (!fs.existsSync(fullPath)) return null;
|
|
148
|
+
|
|
149
|
+
try {
|
|
150
|
+
return JSON.parse(fs.readFileSync(fullPath, 'utf8'));
|
|
151
|
+
} catch (e) {
|
|
152
|
+
return null;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Collect all available receipts
|
|
158
|
+
* @param {string} repoRoot - Repository root
|
|
159
|
+
* @returns {object} Receipt references
|
|
160
|
+
*/
|
|
161
|
+
function collectReceiptReferences(repoRoot) {
|
|
162
|
+
const references = {
|
|
163
|
+
ship: null,
|
|
164
|
+
reality: null,
|
|
165
|
+
shield: null,
|
|
166
|
+
diagnosis: null,
|
|
167
|
+
scan: null,
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
// Ship receipt
|
|
171
|
+
const shipManifest = loadReceipt(repoRoot, '.vibecheck/ship/manifest.json');
|
|
172
|
+
if (shipManifest) {
|
|
173
|
+
references.ship = {
|
|
174
|
+
path: '.vibecheck/ship/manifest.json',
|
|
175
|
+
verdict: shipManifest.verdict?.status,
|
|
176
|
+
timestamp: shipManifest.generatedAt,
|
|
177
|
+
fingerprint: shipManifest.fingerprint,
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// Reality receipt (find latest)
|
|
182
|
+
const receiptsDir = path.join(repoRoot, '.vibecheck/receipts');
|
|
183
|
+
if (fs.existsSync(receiptsDir)) {
|
|
184
|
+
const receipts = fs.readdirSync(receiptsDir, { withFileTypes: true })
|
|
185
|
+
.filter(d => d.isDirectory())
|
|
186
|
+
.map(d => d.name)
|
|
187
|
+
.sort()
|
|
188
|
+
.reverse();
|
|
189
|
+
|
|
190
|
+
if (receipts.length > 0) {
|
|
191
|
+
const latestReceipt = loadReceipt(repoRoot, `.vibecheck/receipts/${receipts[0]}/manifest.json`);
|
|
192
|
+
if (latestReceipt) {
|
|
193
|
+
references.reality = {
|
|
194
|
+
path: `.vibecheck/receipts/${receipts[0]}/manifest.json`,
|
|
195
|
+
runId: receipts[0],
|
|
196
|
+
verdict: latestReceipt.verdict,
|
|
197
|
+
timestamp: latestReceipt.createdAt,
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// Scan results
|
|
204
|
+
const scanResults = loadReceipt(repoRoot, '.vibecheck/results/latest.json');
|
|
205
|
+
if (scanResults) {
|
|
206
|
+
references.scan = {
|
|
207
|
+
path: '.vibecheck/results/latest.json',
|
|
208
|
+
findingCount: scanResults.findings?.length || 0,
|
|
209
|
+
timestamp: scanResults.timestamp,
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
return references;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
217
|
+
// MANIFEST SCHEMA
|
|
218
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Create pack manifest
|
|
222
|
+
* @param {object} options - Manifest options
|
|
223
|
+
* @returns {object} Manifest object
|
|
224
|
+
*/
|
|
225
|
+
function createManifest(options) {
|
|
226
|
+
const {
|
|
227
|
+
packId,
|
|
228
|
+
packType,
|
|
229
|
+
projectName,
|
|
230
|
+
repoRoot,
|
|
231
|
+
artifacts = [],
|
|
232
|
+
metadata = {},
|
|
233
|
+
} = options;
|
|
234
|
+
|
|
235
|
+
const gitInfo = getGitInfo(repoRoot);
|
|
236
|
+
const receipts = collectReceiptReferences(repoRoot);
|
|
237
|
+
|
|
238
|
+
const manifest = {
|
|
239
|
+
$schema: MANIFEST_SCHEMA,
|
|
240
|
+
schemaVersion: PACK_SCHEMA_VERSION,
|
|
241
|
+
|
|
242
|
+
// Identity
|
|
243
|
+
id: packId,
|
|
244
|
+
type: packType,
|
|
245
|
+
|
|
246
|
+
// Timestamps
|
|
247
|
+
generatedAt: new Date().toISOString(),
|
|
248
|
+
expiresAt: null, // Optional TTL
|
|
249
|
+
|
|
250
|
+
// Project info
|
|
251
|
+
project: {
|
|
252
|
+
name: projectName,
|
|
253
|
+
root: repoRoot,
|
|
254
|
+
},
|
|
255
|
+
|
|
256
|
+
// Git info
|
|
257
|
+
git: gitInfo,
|
|
258
|
+
|
|
259
|
+
// Build info (for reproducibility)
|
|
260
|
+
build: {
|
|
261
|
+
fingerprint: generateFingerprint({
|
|
262
|
+
packId,
|
|
263
|
+
packType,
|
|
264
|
+
projectName,
|
|
265
|
+
artifacts: artifacts.map(a => a.hash),
|
|
266
|
+
gitCommit: gitInfo.commit,
|
|
267
|
+
}),
|
|
268
|
+
reproducible: !gitInfo.dirty,
|
|
269
|
+
nodeVersion: process.version,
|
|
270
|
+
platform: process.platform,
|
|
271
|
+
},
|
|
272
|
+
|
|
273
|
+
// Cross-references to receipts
|
|
274
|
+
receipts,
|
|
275
|
+
|
|
276
|
+
// Artifacts in this pack
|
|
277
|
+
artifacts: artifacts.map(a => ({
|
|
278
|
+
filename: a.filename,
|
|
279
|
+
type: a.type,
|
|
280
|
+
size: a.size,
|
|
281
|
+
hash: a.hash,
|
|
282
|
+
description: a.description,
|
|
283
|
+
})),
|
|
284
|
+
|
|
285
|
+
// Pack-specific metadata
|
|
286
|
+
metadata,
|
|
287
|
+
|
|
288
|
+
// Summary
|
|
289
|
+
summary: {
|
|
290
|
+
artifactCount: artifacts.length,
|
|
291
|
+
totalSize: artifacts.reduce((sum, a) => sum + (a.size || 0), 0),
|
|
292
|
+
},
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
return manifest;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Validate manifest against schema
|
|
300
|
+
* @param {object} manifest - Manifest to validate
|
|
301
|
+
* @returns {{ valid: boolean, errors: string[] }}
|
|
302
|
+
*/
|
|
303
|
+
function validateManifest(manifest) {
|
|
304
|
+
const errors = [];
|
|
305
|
+
|
|
306
|
+
if (!manifest.$schema) errors.push('Missing $schema');
|
|
307
|
+
if (!manifest.id) errors.push('Missing id');
|
|
308
|
+
if (!manifest.type) errors.push('Missing type');
|
|
309
|
+
if (!manifest.generatedAt) errors.push('Missing generatedAt');
|
|
310
|
+
if (!manifest.project?.name) errors.push('Missing project.name');
|
|
311
|
+
if (!manifest.build?.fingerprint) errors.push('Missing build.fingerprint');
|
|
312
|
+
if (!Array.isArray(manifest.artifacts)) errors.push('Missing artifacts array');
|
|
313
|
+
|
|
314
|
+
return { valid: errors.length === 0, errors };
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
318
|
+
// HTML INDEX GENERATION
|
|
319
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* Generate HTML index for pack
|
|
323
|
+
* @param {object} manifest - Pack manifest
|
|
324
|
+
* @param {object} options - Generation options
|
|
325
|
+
* @returns {string} HTML content
|
|
326
|
+
*/
|
|
327
|
+
function generateHtmlIndex(manifest, options = {}) {
|
|
328
|
+
const { includeEmbeddedData = true } = options;
|
|
329
|
+
|
|
330
|
+
const artifactRows = manifest.artifacts.map(a => `
|
|
331
|
+
<tr>
|
|
332
|
+
<td><a href="${a.filename}" class="artifact-link">${a.filename}</a></td>
|
|
333
|
+
<td><span class="badge badge-${a.type}">${a.type}</span></td>
|
|
334
|
+
<td>${formatSize(a.size)}</td>
|
|
335
|
+
<td class="hash">${a.hash?.slice(0, 12) || 'N/A'}...</td>
|
|
336
|
+
</tr>
|
|
337
|
+
`).join('');
|
|
338
|
+
|
|
339
|
+
const receiptLinks = [];
|
|
340
|
+
if (manifest.receipts?.ship) {
|
|
341
|
+
receiptLinks.push(`<a href="#" class="receipt-link ship">Ship: ${manifest.receipts.ship.verdict || 'N/A'}</a>`);
|
|
342
|
+
}
|
|
343
|
+
if (manifest.receipts?.reality) {
|
|
344
|
+
receiptLinks.push(`<a href="#" class="receipt-link reality">Reality: ${manifest.receipts.reality.verdict || 'N/A'}</a>`);
|
|
345
|
+
}
|
|
346
|
+
if (manifest.receipts?.scan) {
|
|
347
|
+
receiptLinks.push(`<a href="#" class="receipt-link scan">Scan: ${manifest.receipts.scan.findingCount} findings</a>`);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
return `<!DOCTYPE html>
|
|
351
|
+
<html lang="en">
|
|
352
|
+
<head>
|
|
353
|
+
<meta charset="UTF-8">
|
|
354
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
355
|
+
<title>Vibecheck Pack: ${manifest.id}</title>
|
|
356
|
+
<style>
|
|
357
|
+
:root {
|
|
358
|
+
--bg: #0d1117;
|
|
359
|
+
--surface: #161b22;
|
|
360
|
+
--border: #30363d;
|
|
361
|
+
--text: #c9d1d9;
|
|
362
|
+
--text-muted: #8b949e;
|
|
363
|
+
--accent: #ff9650;
|
|
364
|
+
--success: #3fb950;
|
|
365
|
+
--warning: #d29922;
|
|
366
|
+
--danger: #f85149;
|
|
367
|
+
--info: #58a6ff;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
* { box-sizing: border-box; margin: 0; padding: 0; }
|
|
371
|
+
|
|
372
|
+
body {
|
|
373
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
|
|
374
|
+
background: var(--bg);
|
|
375
|
+
color: var(--text);
|
|
376
|
+
line-height: 1.6;
|
|
377
|
+
padding: 2rem;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
.container { max-width: 1200px; margin: 0 auto; }
|
|
381
|
+
|
|
382
|
+
header {
|
|
383
|
+
background: var(--surface);
|
|
384
|
+
border: 1px solid var(--border);
|
|
385
|
+
border-radius: 8px;
|
|
386
|
+
padding: 2rem;
|
|
387
|
+
margin-bottom: 2rem;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
h1 {
|
|
391
|
+
font-size: 1.5rem;
|
|
392
|
+
color: var(--accent);
|
|
393
|
+
margin-bottom: 0.5rem;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
.pack-id {
|
|
397
|
+
font-family: monospace;
|
|
398
|
+
font-size: 0.875rem;
|
|
399
|
+
color: var(--text-muted);
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
.meta-grid {
|
|
403
|
+
display: grid;
|
|
404
|
+
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
405
|
+
gap: 1rem;
|
|
406
|
+
margin-top: 1.5rem;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
.meta-item {
|
|
410
|
+
background: var(--bg);
|
|
411
|
+
border-radius: 6px;
|
|
412
|
+
padding: 1rem;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
.meta-label {
|
|
416
|
+
font-size: 0.75rem;
|
|
417
|
+
color: var(--text-muted);
|
|
418
|
+
text-transform: uppercase;
|
|
419
|
+
letter-spacing: 0.05em;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
.meta-value {
|
|
423
|
+
font-size: 1rem;
|
|
424
|
+
margin-top: 0.25rem;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
section {
|
|
428
|
+
background: var(--surface);
|
|
429
|
+
border: 1px solid var(--border);
|
|
430
|
+
border-radius: 8px;
|
|
431
|
+
padding: 1.5rem;
|
|
432
|
+
margin-bottom: 1.5rem;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
h2 {
|
|
436
|
+
font-size: 1.125rem;
|
|
437
|
+
margin-bottom: 1rem;
|
|
438
|
+
padding-bottom: 0.5rem;
|
|
439
|
+
border-bottom: 1px solid var(--border);
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
table {
|
|
443
|
+
width: 100%;
|
|
444
|
+
border-collapse: collapse;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
th, td {
|
|
448
|
+
padding: 0.75rem;
|
|
449
|
+
text-align: left;
|
|
450
|
+
border-bottom: 1px solid var(--border);
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
th {
|
|
454
|
+
font-size: 0.75rem;
|
|
455
|
+
color: var(--text-muted);
|
|
456
|
+
text-transform: uppercase;
|
|
457
|
+
letter-spacing: 0.05em;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
.artifact-link {
|
|
461
|
+
color: var(--info);
|
|
462
|
+
text-decoration: none;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
.artifact-link:hover {
|
|
466
|
+
text-decoration: underline;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
.badge {
|
|
470
|
+
display: inline-block;
|
|
471
|
+
padding: 0.25rem 0.5rem;
|
|
472
|
+
border-radius: 4px;
|
|
473
|
+
font-size: 0.75rem;
|
|
474
|
+
font-weight: 500;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
.badge-json { background: #1f6feb33; color: #58a6ff; }
|
|
478
|
+
.badge-html { background: #8957e533; color: #d2a8ff; }
|
|
479
|
+
.badge-markdown { background: #3fb95033; color: #56d364; }
|
|
480
|
+
.badge-pdf { background: #f8514933; color: #ff7b72; }
|
|
481
|
+
.badge-sarif { background: #d2992233; color: #e3b341; }
|
|
482
|
+
.badge-screenshot { background: #a371f733; color: #d2a8ff; }
|
|
483
|
+
.badge-video { background: #f778ba33; color: #ff9bce; }
|
|
484
|
+
.badge-trace { background: #79c0ff33; color: #a5d6ff; }
|
|
485
|
+
|
|
486
|
+
.hash {
|
|
487
|
+
font-family: monospace;
|
|
488
|
+
font-size: 0.8rem;
|
|
489
|
+
color: var(--text-muted);
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
.receipts {
|
|
493
|
+
display: flex;
|
|
494
|
+
gap: 0.5rem;
|
|
495
|
+
flex-wrap: wrap;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
.receipt-link {
|
|
499
|
+
display: inline-block;
|
|
500
|
+
padding: 0.5rem 1rem;
|
|
501
|
+
border-radius: 6px;
|
|
502
|
+
text-decoration: none;
|
|
503
|
+
font-size: 0.875rem;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
.receipt-link.ship { background: var(--success)22; color: var(--success); }
|
|
507
|
+
.receipt-link.reality { background: var(--info)22; color: var(--info); }
|
|
508
|
+
.receipt-link.scan { background: var(--warning)22; color: var(--warning); }
|
|
509
|
+
|
|
510
|
+
footer {
|
|
511
|
+
text-align: center;
|
|
512
|
+
color: var(--text-muted);
|
|
513
|
+
font-size: 0.875rem;
|
|
514
|
+
margin-top: 2rem;
|
|
515
|
+
padding-top: 2rem;
|
|
516
|
+
border-top: 1px solid var(--border);
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
.fingerprint {
|
|
520
|
+
font-family: monospace;
|
|
521
|
+
font-size: 0.75rem;
|
|
522
|
+
color: var(--text-muted);
|
|
523
|
+
word-break: break-all;
|
|
524
|
+
}
|
|
525
|
+
</style>
|
|
526
|
+
</head>
|
|
527
|
+
<body>
|
|
528
|
+
<div class="container">
|
|
529
|
+
<header>
|
|
530
|
+
<h1>${manifest.type.toUpperCase()} PACK</h1>
|
|
531
|
+
<div class="pack-id">${manifest.id}</div>
|
|
532
|
+
|
|
533
|
+
<div class="meta-grid">
|
|
534
|
+
<div class="meta-item">
|
|
535
|
+
<div class="meta-label">Project</div>
|
|
536
|
+
<div class="meta-value">${manifest.project.name}</div>
|
|
537
|
+
</div>
|
|
538
|
+
<div class="meta-item">
|
|
539
|
+
<div class="meta-label">Generated</div>
|
|
540
|
+
<div class="meta-value">${new Date(manifest.generatedAt).toLocaleString()}</div>
|
|
541
|
+
</div>
|
|
542
|
+
<div class="meta-item">
|
|
543
|
+
<div class="meta-label">Artifacts</div>
|
|
544
|
+
<div class="meta-value">${manifest.summary.artifactCount} files (${formatSize(manifest.summary.totalSize)})</div>
|
|
545
|
+
</div>
|
|
546
|
+
<div class="meta-item">
|
|
547
|
+
<div class="meta-label">Git</div>
|
|
548
|
+
<div class="meta-value">${manifest.git.branch || 'N/A'} @ ${manifest.git.commit?.slice(0, 7) || 'N/A'}${manifest.git.dirty ? ' (dirty)' : ''}</div>
|
|
549
|
+
</div>
|
|
550
|
+
</div>
|
|
551
|
+
</header>
|
|
552
|
+
|
|
553
|
+
${receiptLinks.length > 0 ? `
|
|
554
|
+
<section>
|
|
555
|
+
<h2>Cross-References</h2>
|
|
556
|
+
<div class="receipts">
|
|
557
|
+
${receiptLinks.join('')}
|
|
558
|
+
</div>
|
|
559
|
+
</section>
|
|
560
|
+
` : ''}
|
|
561
|
+
|
|
562
|
+
<section>
|
|
563
|
+
<h2>Artifacts</h2>
|
|
564
|
+
<table>
|
|
565
|
+
<thead>
|
|
566
|
+
<tr>
|
|
567
|
+
<th>Filename</th>
|
|
568
|
+
<th>Type</th>
|
|
569
|
+
<th>Size</th>
|
|
570
|
+
<th>Hash</th>
|
|
571
|
+
</tr>
|
|
572
|
+
</thead>
|
|
573
|
+
<tbody>
|
|
574
|
+
${artifactRows}
|
|
575
|
+
</tbody>
|
|
576
|
+
</table>
|
|
577
|
+
</section>
|
|
578
|
+
|
|
579
|
+
<section>
|
|
580
|
+
<h2>Build Info</h2>
|
|
581
|
+
<p><strong>Reproducible:</strong> ${manifest.build.reproducible ? 'Yes' : 'No (dirty working tree)'}</p>
|
|
582
|
+
<p><strong>Node:</strong> ${manifest.build.nodeVersion}</p>
|
|
583
|
+
<p><strong>Platform:</strong> ${manifest.build.platform}</p>
|
|
584
|
+
<p class="fingerprint"><strong>Fingerprint:</strong> ${manifest.build.fingerprint}</p>
|
|
585
|
+
</section>
|
|
586
|
+
|
|
587
|
+
<footer>
|
|
588
|
+
<p>Generated by <strong>Vibecheck</strong> v${PACK_SCHEMA_VERSION}</p>
|
|
589
|
+
<p>Schema: ${manifest.$schema}</p>
|
|
590
|
+
</footer>
|
|
591
|
+
</div>
|
|
592
|
+
|
|
593
|
+
${includeEmbeddedData ? `
|
|
594
|
+
<script>
|
|
595
|
+
// Embedded manifest data for programmatic access
|
|
596
|
+
window.VIBECHECK_MANIFEST = ${JSON.stringify(manifest, null, 2)};
|
|
597
|
+
</script>
|
|
598
|
+
` : ''}
|
|
599
|
+
</body>
|
|
600
|
+
</html>`;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
/**
|
|
604
|
+
* Format file size for display
|
|
605
|
+
* @param {number} bytes - Size in bytes
|
|
606
|
+
* @returns {string} Formatted size
|
|
607
|
+
*/
|
|
608
|
+
function formatSize(bytes) {
|
|
609
|
+
if (!bytes || bytes === 0) return '0 B';
|
|
610
|
+
const units = ['B', 'KB', 'MB', 'GB'];
|
|
611
|
+
const i = Math.floor(Math.log(bytes) / Math.log(1024));
|
|
612
|
+
return `${(bytes / Math.pow(1024, i)).toFixed(1)} ${units[i]}`;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
616
|
+
// PACK BUILDER
|
|
617
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
618
|
+
|
|
619
|
+
/**
|
|
620
|
+
* Pack builder class - fluent API for building packs
|
|
621
|
+
*/
|
|
622
|
+
class PackBuilder {
|
|
623
|
+
constructor(packType, repoRoot) {
|
|
624
|
+
this.packType = packType;
|
|
625
|
+
this.repoRoot = repoRoot;
|
|
626
|
+
this.projectName = path.basename(repoRoot);
|
|
627
|
+
this.artifacts = [];
|
|
628
|
+
this.metadata = {};
|
|
629
|
+
this.packId = null;
|
|
630
|
+
this.outputDir = null;
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
/**
|
|
634
|
+
* Set pack ID (or auto-generate)
|
|
635
|
+
*/
|
|
636
|
+
withId(id) {
|
|
637
|
+
this.packId = id;
|
|
638
|
+
return this;
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
/**
|
|
642
|
+
* Set output directory
|
|
643
|
+
*/
|
|
644
|
+
outputTo(dir) {
|
|
645
|
+
this.outputDir = dir;
|
|
646
|
+
return this;
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
/**
|
|
650
|
+
* Add artifact to pack
|
|
651
|
+
*/
|
|
652
|
+
addArtifact(filename, content, type, description = '') {
|
|
653
|
+
const contentBuffer = typeof content === 'string' ? Buffer.from(content, 'utf8') : content;
|
|
654
|
+
const hash = crypto.createHash('sha256').update(contentBuffer).digest('hex');
|
|
655
|
+
|
|
656
|
+
this.artifacts.push({
|
|
657
|
+
filename,
|
|
658
|
+
content: contentBuffer,
|
|
659
|
+
type,
|
|
660
|
+
size: contentBuffer.length,
|
|
661
|
+
hash,
|
|
662
|
+
description,
|
|
663
|
+
});
|
|
664
|
+
|
|
665
|
+
return this;
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
/**
|
|
669
|
+
* Add file from disk to pack
|
|
670
|
+
*/
|
|
671
|
+
addFile(srcPath, destFilename, type, description = '') {
|
|
672
|
+
const fullPath = path.isAbsolute(srcPath) ? srcPath : path.join(this.repoRoot, srcPath);
|
|
673
|
+
|
|
674
|
+
if (!fs.existsSync(fullPath)) {
|
|
675
|
+
console.warn(`File not found, skipping: ${srcPath}`);
|
|
676
|
+
return this;
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
const content = fs.readFileSync(fullPath);
|
|
680
|
+
const hash = crypto.createHash('sha256').update(content).digest('hex');
|
|
681
|
+
|
|
682
|
+
this.artifacts.push({
|
|
683
|
+
filename: destFilename || path.basename(srcPath),
|
|
684
|
+
content,
|
|
685
|
+
type,
|
|
686
|
+
size: content.length,
|
|
687
|
+
hash,
|
|
688
|
+
description,
|
|
689
|
+
sourcePath: srcPath,
|
|
690
|
+
});
|
|
691
|
+
|
|
692
|
+
return this;
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
/**
|
|
696
|
+
* Add metadata
|
|
697
|
+
*/
|
|
698
|
+
withMetadata(metadata) {
|
|
699
|
+
this.metadata = { ...this.metadata, ...metadata };
|
|
700
|
+
return this;
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
/**
|
|
704
|
+
* Build the pack
|
|
705
|
+
*/
|
|
706
|
+
build() {
|
|
707
|
+
// Generate pack ID if not set
|
|
708
|
+
if (!this.packId) {
|
|
709
|
+
const hashSeed = this.artifacts.map(a => a.hash).join(':');
|
|
710
|
+
this.packId = generatePackId(this.packType, this.projectName, hashSeed);
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
// Determine output directory
|
|
714
|
+
if (!this.outputDir) {
|
|
715
|
+
this.outputDir = path.join(this.repoRoot, '.vibecheck', 'packs', this.packId);
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
// Ensure output directory exists
|
|
719
|
+
fs.mkdirSync(this.outputDir, { recursive: true });
|
|
720
|
+
|
|
721
|
+
// Write artifacts
|
|
722
|
+
for (const artifact of this.artifacts) {
|
|
723
|
+
const destPath = path.join(this.outputDir, artifact.filename);
|
|
724
|
+
fs.mkdirSync(path.dirname(destPath), { recursive: true });
|
|
725
|
+
fs.writeFileSync(destPath, artifact.content);
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
// Create manifest
|
|
729
|
+
const manifest = createManifest({
|
|
730
|
+
packId: this.packId,
|
|
731
|
+
packType: this.packType,
|
|
732
|
+
projectName: this.projectName,
|
|
733
|
+
repoRoot: this.repoRoot,
|
|
734
|
+
artifacts: this.artifacts,
|
|
735
|
+
metadata: this.metadata,
|
|
736
|
+
});
|
|
737
|
+
|
|
738
|
+
// Write manifest
|
|
739
|
+
const manifestPath = path.join(this.outputDir, 'manifest.json');
|
|
740
|
+
fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2), 'utf8');
|
|
741
|
+
|
|
742
|
+
// Generate and write HTML index
|
|
743
|
+
const htmlIndex = generateHtmlIndex(manifest);
|
|
744
|
+
const indexPath = path.join(this.outputDir, 'index.html');
|
|
745
|
+
fs.writeFileSync(indexPath, htmlIndex, 'utf8');
|
|
746
|
+
|
|
747
|
+
return {
|
|
748
|
+
packId: this.packId,
|
|
749
|
+
outputDir: this.outputDir,
|
|
750
|
+
manifest,
|
|
751
|
+
artifactCount: this.artifacts.length,
|
|
752
|
+
manifestPath,
|
|
753
|
+
indexPath,
|
|
754
|
+
};
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
/**
|
|
758
|
+
* Build and create ZIP bundle
|
|
759
|
+
*/
|
|
760
|
+
async buildZip() {
|
|
761
|
+
const result = this.build();
|
|
762
|
+
|
|
763
|
+
// Try to create ZIP
|
|
764
|
+
try {
|
|
765
|
+
const archiver = require('archiver');
|
|
766
|
+
const zipPath = `${result.outputDir}.zip`;
|
|
767
|
+
|
|
768
|
+
const output = fs.createWriteStream(zipPath);
|
|
769
|
+
const archive = archiver('zip', { zlib: { level: 9 } });
|
|
770
|
+
|
|
771
|
+
return new Promise((resolve, reject) => {
|
|
772
|
+
output.on('close', () => {
|
|
773
|
+
resolve({
|
|
774
|
+
...result,
|
|
775
|
+
zipPath,
|
|
776
|
+
zipSize: archive.pointer(),
|
|
777
|
+
});
|
|
778
|
+
});
|
|
779
|
+
|
|
780
|
+
archive.on('error', reject);
|
|
781
|
+
archive.pipe(output);
|
|
782
|
+
archive.directory(result.outputDir, false);
|
|
783
|
+
archive.finalize();
|
|
784
|
+
});
|
|
785
|
+
} catch (e) {
|
|
786
|
+
// archiver not available - return directory result
|
|
787
|
+
return result;
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
/**
|
|
793
|
+
* Create a new pack builder
|
|
794
|
+
* @param {string} packType - Pack type
|
|
795
|
+
* @param {string} repoRoot - Repository root
|
|
796
|
+
* @returns {PackBuilder}
|
|
797
|
+
*/
|
|
798
|
+
function createPackBuilder(packType, repoRoot) {
|
|
799
|
+
return new PackBuilder(packType, repoRoot);
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
803
|
+
// EXPORTS
|
|
804
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
805
|
+
|
|
806
|
+
module.exports = {
|
|
807
|
+
// Constants
|
|
808
|
+
PACK_SCHEMA_VERSION,
|
|
809
|
+
MANIFEST_SCHEMA,
|
|
810
|
+
PACK_TYPE,
|
|
811
|
+
ARTIFACT_TYPE,
|
|
812
|
+
|
|
813
|
+
// Naming
|
|
814
|
+
generatePackId,
|
|
815
|
+
generateArtifactFilename,
|
|
816
|
+
generateFingerprint,
|
|
817
|
+
contentHash,
|
|
818
|
+
|
|
819
|
+
// Manifest
|
|
820
|
+
createManifest,
|
|
821
|
+
validateManifest,
|
|
822
|
+
|
|
823
|
+
// HTML
|
|
824
|
+
generateHtmlIndex,
|
|
825
|
+
formatSize,
|
|
826
|
+
|
|
827
|
+
// Receipts
|
|
828
|
+
loadReceipt,
|
|
829
|
+
collectReceiptReferences,
|
|
830
|
+
|
|
831
|
+
// Git
|
|
832
|
+
getGitInfo,
|
|
833
|
+
|
|
834
|
+
// Builder
|
|
835
|
+
PackBuilder,
|
|
836
|
+
createPackBuilder,
|
|
837
|
+
};
|