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,1110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vibecheck Context Generator v3.0 - AI Memory & Shared Context Engine
|
|
3
|
+
*
|
|
4
|
+
* Modular architecture for AI context generation across multiple platforms.
|
|
5
|
+
*
|
|
6
|
+
* @module context
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
const fs = require("fs");
|
|
10
|
+
const path = require("path");
|
|
11
|
+
|
|
12
|
+
// Import modules
|
|
13
|
+
const { analyzeProject, findFilesRecursive } = require("./analyzer");
|
|
14
|
+
const { detectPatterns, detectAntiPatterns } = require("./patterns");
|
|
15
|
+
const { loadMemory, saveMemory, learnFromProject, getRecommendations, initializeMemory, VIBECHECK_HOME } = require("./memory");
|
|
16
|
+
const { trackInsight, getInsightsSummary } = require("./insights");
|
|
17
|
+
const { detectMonorepo } = require("./monorepo");
|
|
18
|
+
const { loadSnapshot, saveSnapshot, generateContextDiff, saveDiffReport } = require("./context-diff");
|
|
19
|
+
const { generatePrunedContext, getContextForFile, pruneContext } = require("./context-pruner");
|
|
20
|
+
const { generateDependencyGraph, buildDependencyGraph, generateMermaidDiagram, generateHtmlVisualization } = require("./dependency-graph");
|
|
21
|
+
const { generateGitContext, getGitContext } = require("./git-context");
|
|
22
|
+
const { extractAPIContracts, generateAPIContext } = require("./api-contracts");
|
|
23
|
+
const { analyzeTeamConventions, generateTeamReport } = require("./team-conventions");
|
|
24
|
+
const { buildSearchIndex, saveSearchIndex, loadSearchIndex, semanticSearch, generateSearchReport } = require("./semantic-search");
|
|
25
|
+
const { scanProject, generateSecurityReport } = require("./security-scanner");
|
|
26
|
+
const { decomposeTask, generateDecompositionReport } = require("./ai-task-decomposer");
|
|
27
|
+
const { registerRepository, createGroup, getSharedArtifacts, generateFederatedContext, findRelatedRepositories, syncFederation, generateFederationReport } = require("./multi-repo-federation");
|
|
28
|
+
const { registerSharedContext } = require("./shared");
|
|
29
|
+
|
|
30
|
+
// Import CLI utilities for professional styling
|
|
31
|
+
const {
|
|
32
|
+
colors: c,
|
|
33
|
+
printBanner,
|
|
34
|
+
printCompactBanner,
|
|
35
|
+
printCommandHeader,
|
|
36
|
+
printSectionHeader,
|
|
37
|
+
printSectionFooter,
|
|
38
|
+
printListItem,
|
|
39
|
+
printBulletedList,
|
|
40
|
+
printTable,
|
|
41
|
+
highlight,
|
|
42
|
+
highlightCode,
|
|
43
|
+
highlightPath,
|
|
44
|
+
printError,
|
|
45
|
+
printWarning,
|
|
46
|
+
printSuccess,
|
|
47
|
+
printSummaryCard,
|
|
48
|
+
gradientText,
|
|
49
|
+
formatNumber,
|
|
50
|
+
formatBytes,
|
|
51
|
+
statusIcon,
|
|
52
|
+
progressBar,
|
|
53
|
+
} = require("../cli-utils");
|
|
54
|
+
|
|
55
|
+
// Platform generators
|
|
56
|
+
const { generateCursorRules, generateCursorModularRules } = require("./generators/cursor");
|
|
57
|
+
const { generateWindsurfRules } = require("./generators/windsurf");
|
|
58
|
+
const { generateCopilotInstructions } = require("./generators/copilot");
|
|
59
|
+
const { generateClaudeConfig } = require("./generators/claude");
|
|
60
|
+
const { generateCodexConfig } = require("./generators/codex");
|
|
61
|
+
const { generateContextJson } = require("./generators/mcp");
|
|
62
|
+
let enhancedContextEngine = null;
|
|
63
|
+
const enhancedCandidates = [
|
|
64
|
+
path.join(__dirname, "..", "..", "..", "src", "lib", "context", "enhanced-context-engine.js"),
|
|
65
|
+
path.join(__dirname, "..", "..", "..", "..", "..", "src", "lib", "context", "enhanced-context-engine.js"),
|
|
66
|
+
];
|
|
67
|
+
for (const candidate of enhancedCandidates) {
|
|
68
|
+
try {
|
|
69
|
+
if (fs.existsSync(candidate)) {
|
|
70
|
+
({ enhancedContextEngine } = require(candidate));
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
} catch {}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
async function emitGuardrailMetric(projectPath, metric) {
|
|
77
|
+
try {
|
|
78
|
+
const auditDir = path.join(projectPath, ".vibecheck", "audit");
|
|
79
|
+
fs.mkdirSync(auditDir, { recursive: true });
|
|
80
|
+
const record = JSON.stringify({ ...metric, timestamp: new Date().toISOString() });
|
|
81
|
+
fs.appendFileSync(path.join(auditDir, "guardrail-metrics.jsonl"), `${record}\n`);
|
|
82
|
+
} catch {
|
|
83
|
+
// ignore metrics write failures
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
async function applyContextValidation(projectPath, analysis, opts) {
|
|
88
|
+
if (!enhancedContextEngine) return analysis;
|
|
89
|
+
|
|
90
|
+
const { context, validation, drift } = await enhancedContextEngine.getValidatedContext(projectPath, {
|
|
91
|
+
file: opts.currentFile || undefined,
|
|
92
|
+
purpose: opts.task || "general",
|
|
93
|
+
checkDrift: true,
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
analysis.contextValidation = validation;
|
|
97
|
+
analysis.contextDrift = drift;
|
|
98
|
+
analysis.contextSummary = {
|
|
99
|
+
confidence: validation?.confidence ?? context?.confidence ?? 0,
|
|
100
|
+
freshness: context?.freshness ?? null,
|
|
101
|
+
issues: validation?.issues?.length || 0,
|
|
102
|
+
driftScore: drift?.score ?? 0,
|
|
103
|
+
blocked: validation?.valid === false,
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
await emitGuardrailMetric(projectPath, {
|
|
107
|
+
event: "context_validation",
|
|
108
|
+
confidence: analysis.contextSummary.confidence,
|
|
109
|
+
freshness: analysis.contextSummary.freshness,
|
|
110
|
+
issues: analysis.contextSummary.issues,
|
|
111
|
+
driftScore: analysis.contextSummary.driftScore,
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
const vibecheckDir = path.join(projectPath, ".vibecheck");
|
|
115
|
+
fs.mkdirSync(vibecheckDir, { recursive: true });
|
|
116
|
+
fs.writeFileSync(
|
|
117
|
+
path.join(vibecheckDir, "context-validation.json"),
|
|
118
|
+
JSON.stringify({ validation, drift }, null, 2),
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
return analysis;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Parse command line arguments
|
|
126
|
+
*/
|
|
127
|
+
function parseArgs(args) {
|
|
128
|
+
const opts = {
|
|
129
|
+
path: ".",
|
|
130
|
+
platform: "all",
|
|
131
|
+
watch: false,
|
|
132
|
+
verbose: false,
|
|
133
|
+
help: false,
|
|
134
|
+
diff: false,
|
|
135
|
+
prune: false,
|
|
136
|
+
maxTokens: 8000,
|
|
137
|
+
currentFile: "",
|
|
138
|
+
task: "general",
|
|
139
|
+
json: false,
|
|
140
|
+
search: "",
|
|
141
|
+
scan: false,
|
|
142
|
+
decompose: "",
|
|
143
|
+
federate: false,
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
for (let i = 0; i < args.length; i++) {
|
|
147
|
+
const a = args[i];
|
|
148
|
+
if (a === "--help" || a === "-h") opts.help = true;
|
|
149
|
+
if (a.startsWith("--path=")) opts.path = a.split("=")[1];
|
|
150
|
+
if (a === "--path" || a === "-p") opts.path = args[++i];
|
|
151
|
+
if (a.startsWith("--platform=")) opts.platform = a.split("=")[1];
|
|
152
|
+
if (a === "--platform") opts.platform = args[++i];
|
|
153
|
+
if (a === "--watch" || a === "-w") opts.watch = true;
|
|
154
|
+
if (a === "--verbose" || a === "-v") opts.verbose = true;
|
|
155
|
+
if (a === "--diff" || a === "-d") opts.diff = true;
|
|
156
|
+
if (a === "--prune") opts.prune = true;
|
|
157
|
+
if (a === "--json" || a === "-j") opts.json = true;
|
|
158
|
+
if (a === "--scan" || a === "-s") opts.scan = true;
|
|
159
|
+
if (a === "--federate" || a === "-f") opts.federate = true;
|
|
160
|
+
if (a.startsWith("--max-tokens=")) opts.maxTokens = parseInt(a.split("=")[1]);
|
|
161
|
+
if (a.startsWith("--file=")) opts.currentFile = a.split("=")[1];
|
|
162
|
+
if (a.startsWith("--task=")) opts.task = a.split("=")[1];
|
|
163
|
+
if (a.startsWith("--search=")) opts.search = a.split("=")[1];
|
|
164
|
+
if (a.startsWith("--decompose=")) opts.decompose = a.split("=")[1];
|
|
165
|
+
if (["cursor", "windsurf", "copilot", "claude", "codex"].includes(a)) {
|
|
166
|
+
opts.platform = a;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return opts;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Print help message
|
|
174
|
+
*/
|
|
175
|
+
function printHelp() {
|
|
176
|
+
console.log();
|
|
177
|
+
printBanner();
|
|
178
|
+
printCommandHeader("CONTEXT", "AI Memory & Shared Context Engine v3.1");
|
|
179
|
+
|
|
180
|
+
console.log(`${c.yellow}USAGE${c.reset}`);
|
|
181
|
+
console.log(` ${c.cyan}vibecheck context${c.reset} ${c.dim}[options]${c.reset}`);
|
|
182
|
+
console.log(` ${c.cyan}vibecheck context cursor${c.reset} ${c.dim}# Generate Cursor rules only${c.reset}`);
|
|
183
|
+
console.log(` ${c.cyan}vibecheck context windsurf${c.reset} ${c.dim}# Generate Windsurf rules only${c.reset}`);
|
|
184
|
+
console.log(` ${c.cyan}vibecheck context codex${c.reset} ${c.dim}# Generate Codex/ChatGPT rules${c.reset}`);
|
|
185
|
+
console.log();
|
|
186
|
+
|
|
187
|
+
console.log(`${c.yellow}OPTIONS${c.reset}`);
|
|
188
|
+
const options = [
|
|
189
|
+
['--platform <name>', 'Platform: cursor, windsurf, copilot, claude, codex, all'],
|
|
190
|
+
['--path <dir>', 'Project directory (default: current)'],
|
|
191
|
+
['--watch', 'Watch for changes and regenerate'],
|
|
192
|
+
['--verbose', 'Show detailed output'],
|
|
193
|
+
['--diff', 'Show changes since last generation'],
|
|
194
|
+
['--prune', 'Generate pruned context (reduced tokens)'],
|
|
195
|
+
['--max-tokens <n>', 'Max tokens for pruned context (default: 8000)'],
|
|
196
|
+
['--file <path>', 'Current file for context relevance'],
|
|
197
|
+
['--task <type>', 'Task type: general, api, utility, component'],
|
|
198
|
+
['--json', 'Output JSON for CI/programmatic use'],
|
|
199
|
+
['--search <query>', 'Semantic code search'],
|
|
200
|
+
['--scan', 'Security scan for secrets and vulnerabilities'],
|
|
201
|
+
['--decompose <task>', 'AI task decomposition for smart context'],
|
|
202
|
+
['--federate', 'Multi-repo context federation'],
|
|
203
|
+
['--help', 'Show this help'],
|
|
204
|
+
];
|
|
205
|
+
|
|
206
|
+
printTable(['Option', 'Description'], options);
|
|
207
|
+
console.log();
|
|
208
|
+
|
|
209
|
+
console.log(`${c.yellow}SUPPORTED PLATFORMS${c.reset}`);
|
|
210
|
+
console.log();
|
|
211
|
+
const platforms = [
|
|
212
|
+
['Cursor', '.cursorrules, .cursor/rules/*.mdc'],
|
|
213
|
+
['Windsurf', '.windsurf/rules/*.md'],
|
|
214
|
+
['Copilot', '.github/copilot-instructions.md'],
|
|
215
|
+
['Claude Code', '.claude/project-context.md, .claude/mcp-config.json'],
|
|
216
|
+
['Codex/ChatGPT', '.codex-instructions.md'],
|
|
217
|
+
['MCP (Universal)', '.vibecheck/context.json, .vibecheck/memory.json'],
|
|
218
|
+
];
|
|
219
|
+
|
|
220
|
+
printTable(['Platform', 'Generated Files'], platforms);
|
|
221
|
+
console.log();
|
|
222
|
+
|
|
223
|
+
console.log(`${gradientText('v3.1 FEATURES', [c.cyan, c.blue, c.magenta])}${c.reset}`);
|
|
224
|
+
console.log();
|
|
225
|
+
|
|
226
|
+
const features = [
|
|
227
|
+
{
|
|
228
|
+
icon: '🧠',
|
|
229
|
+
title: 'Self-Learning AI Memory',
|
|
230
|
+
items: [
|
|
231
|
+
'• Learns from all your projects',
|
|
232
|
+
'• Recommends patterns you use frequently',
|
|
233
|
+
'• Stored in ~/.vibecheck/global-memory.json',
|
|
234
|
+
]
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
icon: '🔍',
|
|
238
|
+
title: 'Semantic Code Search',
|
|
239
|
+
items: [
|
|
240
|
+
'• Natural language code search',
|
|
241
|
+
'• TF-IDF vectorization for accuracy',
|
|
242
|
+
'• Ranked results with similarity scores',
|
|
243
|
+
]
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
icon: '🔒',
|
|
247
|
+
title: 'Security Scanner',
|
|
248
|
+
items: [
|
|
249
|
+
'• Detect secrets and API keys',
|
|
250
|
+
'• Find vulnerabilities before production',
|
|
251
|
+
'• Detailed security reports',
|
|
252
|
+
]
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
icon: '🎯',
|
|
256
|
+
title: 'AI Task Decomposition',
|
|
257
|
+
items: [
|
|
258
|
+
'• Smart context selection for tasks',
|
|
259
|
+
'• Token estimation to stay under limits',
|
|
260
|
+
'• Implementation recommendations',
|
|
261
|
+
]
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
icon: '🌐',
|
|
265
|
+
title: 'Multi-Repo Federation',
|
|
266
|
+
items: [
|
|
267
|
+
'• Unify context across repositories',
|
|
268
|
+
'• Detect shared components and patterns',
|
|
269
|
+
'• Cross-project knowledge sharing',
|
|
270
|
+
]
|
|
271
|
+
},
|
|
272
|
+
];
|
|
273
|
+
|
|
274
|
+
features.forEach(feature => {
|
|
275
|
+
console.log(`${c.magenta}${feature.icon} ${feature.title}${c.reset}`);
|
|
276
|
+
feature.items.forEach(item => {
|
|
277
|
+
console.log(` ${c.dim}${item}${c.reset}`);
|
|
278
|
+
});
|
|
279
|
+
console.log();
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
console.log(`${c.yellow}EXAMPLES${c.reset}`);
|
|
283
|
+
console.log();
|
|
284
|
+
const examples = [
|
|
285
|
+
['vibecheck context', 'Generate all rules files'],
|
|
286
|
+
['vibecheck context cursor', 'Cursor only'],
|
|
287
|
+
['vibecheck context codex', 'Codex/ChatGPT only'],
|
|
288
|
+
['vibecheck context --watch', 'Watch mode - auto-regenerate'],
|
|
289
|
+
['vibecheck context --diff', 'Show changes since last generation'],
|
|
290
|
+
['vibecheck context --prune', 'Generate reduced context for tokens'],
|
|
291
|
+
['vibecheck context --file src/App.tsx --prune', 'Context for specific file'],
|
|
292
|
+
['vibecheck context --search "auth hook"', 'Semantic code search'],
|
|
293
|
+
['vibecheck context --scan', 'Security scan'],
|
|
294
|
+
['vibecheck context --decompose "create user profile"', 'AI task analysis'],
|
|
295
|
+
['vibecheck context --federate', 'Multi-repo federation'],
|
|
296
|
+
];
|
|
297
|
+
|
|
298
|
+
examples.forEach(([cmd, desc]) => {
|
|
299
|
+
console.log(` ${c.cyan}${cmd}${c.reset}`);
|
|
300
|
+
console.log(` ${c.dim}${desc}${c.reset}`);
|
|
301
|
+
console.log();
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* Write all generated files to disk
|
|
307
|
+
*/
|
|
308
|
+
function writeFiles(projectPath, platform, analysis, verbose) {
|
|
309
|
+
const written = [];
|
|
310
|
+
|
|
311
|
+
// Cursor files
|
|
312
|
+
if (platform === "all" || platform === "cursor") {
|
|
313
|
+
const cursorRules = generateCursorRules(analysis);
|
|
314
|
+
fs.writeFileSync(path.join(projectPath, ".cursorrules"), cursorRules);
|
|
315
|
+
written.push(".cursorrules");
|
|
316
|
+
|
|
317
|
+
const cursorDir = path.join(projectPath, ".cursor", "rules");
|
|
318
|
+
fs.mkdirSync(cursorDir, { recursive: true });
|
|
319
|
+
|
|
320
|
+
const modularRules = generateCursorModularRules(analysis);
|
|
321
|
+
for (const [name, content] of Object.entries(modularRules)) {
|
|
322
|
+
fs.writeFileSync(path.join(cursorDir, `${name}.mdc`), content);
|
|
323
|
+
written.push(`.cursor/rules/${name}.mdc`);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
// Windsurf files
|
|
328
|
+
if (platform === "all" || platform === "windsurf") {
|
|
329
|
+
const windsurfDir = path.join(projectPath, ".windsurf", "rules");
|
|
330
|
+
fs.mkdirSync(windsurfDir, { recursive: true });
|
|
331
|
+
|
|
332
|
+
const windsurfRules = generateWindsurfRules(analysis);
|
|
333
|
+
for (const [name, content] of Object.entries(windsurfRules)) {
|
|
334
|
+
fs.writeFileSync(path.join(windsurfDir, `${name}.md`), content);
|
|
335
|
+
written.push(`.windsurf/rules/${name}.md`);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
// Copilot instructions
|
|
340
|
+
if (platform === "all" || platform === "copilot") {
|
|
341
|
+
const githubDir = path.join(projectPath, ".github");
|
|
342
|
+
fs.mkdirSync(githubDir, { recursive: true });
|
|
343
|
+
|
|
344
|
+
const copilotInstructions = generateCopilotInstructions(analysis);
|
|
345
|
+
fs.writeFileSync(path.join(githubDir, "copilot-instructions.md"), copilotInstructions);
|
|
346
|
+
written.push(".github/copilot-instructions.md");
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
// Claude Desktop config
|
|
350
|
+
if (platform === "all" || platform === "claude") {
|
|
351
|
+
const claudeDir = path.join(projectPath, ".claude");
|
|
352
|
+
fs.mkdirSync(claudeDir, { recursive: true });
|
|
353
|
+
|
|
354
|
+
const { config, instructions } = generateClaudeConfig(analysis, projectPath);
|
|
355
|
+
fs.writeFileSync(path.join(claudeDir, "mcp-config.json"), JSON.stringify(config, null, 2));
|
|
356
|
+
fs.writeFileSync(path.join(claudeDir, "project-context.md"), instructions);
|
|
357
|
+
written.push(".claude/mcp-config.json");
|
|
358
|
+
written.push(".claude/project-context.md");
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
// Codex / ChatGPT instructions
|
|
362
|
+
if (platform === "all" || platform === "codex") {
|
|
363
|
+
const codexConfig = generateCodexConfig(analysis, projectPath);
|
|
364
|
+
fs.writeFileSync(path.join(projectPath, ".codex-instructions.md"), codexConfig);
|
|
365
|
+
written.push(".codex-instructions.md");
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
// Universal context (always generated)
|
|
369
|
+
const vibecheckDir = path.join(projectPath, ".vibecheck");
|
|
370
|
+
fs.mkdirSync(vibecheckDir, { recursive: true });
|
|
371
|
+
|
|
372
|
+
const contextJson = generateContextJson(analysis, projectPath);
|
|
373
|
+
fs.writeFileSync(path.join(vibecheckDir, "context.json"), contextJson);
|
|
374
|
+
written.push(".vibecheck/context.json");
|
|
375
|
+
|
|
376
|
+
fs.writeFileSync(path.join(vibecheckDir, "project-map.json"), JSON.stringify(analysis, null, 2));
|
|
377
|
+
written.push(".vibecheck/project-map.json");
|
|
378
|
+
|
|
379
|
+
// Generate AI memory file
|
|
380
|
+
const memory = learnFromProject(projectPath, analysis);
|
|
381
|
+
const projectId = Object.keys(memory.projects).find(k => memory.projects[k].path === projectPath);
|
|
382
|
+
fs.writeFileSync(path.join(vibecheckDir, "memory.json"), JSON.stringify({
|
|
383
|
+
projectMemory: memory.projects[projectId] || {},
|
|
384
|
+
globalPatterns: memory.patterns,
|
|
385
|
+
recommendations: getRecommendations(analysis),
|
|
386
|
+
lastUpdated: new Date().toISOString(),
|
|
387
|
+
}, null, 2));
|
|
388
|
+
written.push(".vibecheck/memory.json");
|
|
389
|
+
|
|
390
|
+
// Generate insights file
|
|
391
|
+
const insights = trackInsight(projectPath, "context_generated", {
|
|
392
|
+
files: analysis.stats?.totalFiles || 0,
|
|
393
|
+
components: analysis.components?.length || 0,
|
|
394
|
+
platform: platform,
|
|
395
|
+
});
|
|
396
|
+
const insightsSummary = getInsightsSummary();
|
|
397
|
+
fs.writeFileSync(path.join(vibecheckDir, "insights.json"), JSON.stringify({
|
|
398
|
+
session: insights.sessions?.slice(-1)[0] || {},
|
|
399
|
+
summary: insightsSummary,
|
|
400
|
+
lastUpdated: new Date().toISOString(),
|
|
401
|
+
}, null, 2));
|
|
402
|
+
written.push(".vibecheck/insights.json");
|
|
403
|
+
|
|
404
|
+
// Register in shared context
|
|
405
|
+
registerSharedContext(projectPath, analysis);
|
|
406
|
+
|
|
407
|
+
return written;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* Watch mode - regenerate on file changes
|
|
412
|
+
*/
|
|
413
|
+
function startWatchMode(projectPath, platform, verbose) {
|
|
414
|
+
console.log(`${c.cyan}👁 Watch mode enabled${c.reset} - regenerating on file changes\n`);
|
|
415
|
+
console.log(`${c.dim}Watching: ${projectPath}${c.reset}`);
|
|
416
|
+
console.log(`${c.dim}Press Ctrl+C to stop${c.reset}\n`);
|
|
417
|
+
|
|
418
|
+
let debounceTimer = null;
|
|
419
|
+
const watchDirs = ["src", "app", "pages", "components", "lib", "server"];
|
|
420
|
+
|
|
421
|
+
const regenerate = async () => {
|
|
422
|
+
console.log(`\n${c.yellow}⟳ Change detected, regenerating...${c.reset}\n`);
|
|
423
|
+
try {
|
|
424
|
+
let analysis = analyzeProject(projectPath);
|
|
425
|
+
analysis = await applyContextValidation(projectPath, analysis, {
|
|
426
|
+
currentFile: "",
|
|
427
|
+
task: "general",
|
|
428
|
+
});
|
|
429
|
+
writeFiles(projectPath, platform, analysis, verbose);
|
|
430
|
+
console.log(`${c.green}✓ Rules regenerated${c.reset} at ${new Date().toLocaleTimeString()}\n`);
|
|
431
|
+
} catch (err) {
|
|
432
|
+
console.log(`${c.red}✗ Regeneration failed:${c.reset} ${err.message}\n`);
|
|
433
|
+
}
|
|
434
|
+
};
|
|
435
|
+
|
|
436
|
+
for (const dir of watchDirs) {
|
|
437
|
+
const watchPath = path.join(projectPath, dir);
|
|
438
|
+
if (fs.existsSync(watchPath)) {
|
|
439
|
+
try {
|
|
440
|
+
fs.watch(watchPath, { recursive: true }, (eventType, filename) => {
|
|
441
|
+
if (filename && (filename.endsWith(".ts") || filename.endsWith(".tsx") || filename.endsWith(".js") || filename.endsWith(".jsx"))) {
|
|
442
|
+
if (debounceTimer) clearTimeout(debounceTimer);
|
|
443
|
+
debounceTimer = setTimeout(() => {
|
|
444
|
+
void regenerate();
|
|
445
|
+
}, 500);
|
|
446
|
+
}
|
|
447
|
+
});
|
|
448
|
+
console.log(`${c.dim} Watching: ${dir}/${c.reset}`);
|
|
449
|
+
} catch {}
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
process.on("SIGINT", () => {
|
|
454
|
+
console.log(`\n${c.cyan}Watch mode stopped${c.reset}\n`);
|
|
455
|
+
process.exit(0);
|
|
456
|
+
});
|
|
457
|
+
|
|
458
|
+
setInterval(() => {}, 1000);
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
/**
|
|
462
|
+
* Main entry point
|
|
463
|
+
*/
|
|
464
|
+
async function runContext(args) {
|
|
465
|
+
const opts = parseArgs(args);
|
|
466
|
+
|
|
467
|
+
if (opts.help) {
|
|
468
|
+
printHelp();
|
|
469
|
+
return 0;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
const projectPath = path.resolve(opts.path);
|
|
473
|
+
|
|
474
|
+
// Handle search mode first (before any other output)
|
|
475
|
+
if (opts.search) {
|
|
476
|
+
printBanner();
|
|
477
|
+
printCommandHeader("SEMANTIC SEARCH", "Natural Language Code Search");
|
|
478
|
+
console.log(`${c.dim}Query:${c.reset} ${highlightCode(`"${opts.search}"`)}\n`);
|
|
479
|
+
|
|
480
|
+
console.log(`${c.dim}🔍 Building search index...${c.reset}`, '\r');
|
|
481
|
+
let searchIndex = loadSearchIndex(projectPath);
|
|
482
|
+
if (!searchIndex) {
|
|
483
|
+
console.log(`${c.yellow}🔍 Building search index...${c.reset}`, '\r');
|
|
484
|
+
searchIndex = buildSearchIndex(projectPath);
|
|
485
|
+
saveSearchIndex(projectPath, searchIndex);
|
|
486
|
+
console.log(`${c.green}✓ Search index built${c.reset} \n`);
|
|
487
|
+
} else {
|
|
488
|
+
console.log(`${c.green}✓ Search index loaded${c.reset} \n`);
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
console.log(`${c.dim}🔍 Searching code...${c.reset}`, '\r');
|
|
492
|
+
const results = semanticSearch(searchIndex, opts.search, 10);
|
|
493
|
+
console.log(`${c.green}✓ Search complete${c.reset} \n`);
|
|
494
|
+
|
|
495
|
+
if (results.length === 0) {
|
|
496
|
+
console.log(`${c.yellow}⚠ No results found for "${opts.search}"${c.reset}\n`);
|
|
497
|
+
} else {
|
|
498
|
+
console.log(`${c.green}Found ${formatNumber(results.length)} results:${c.reset}\n`);
|
|
499
|
+
|
|
500
|
+
printTable(['File', 'Lines', 'Match', 'Type'],
|
|
501
|
+
results.map(r => [
|
|
502
|
+
highlightPath(r.file),
|
|
503
|
+
`${r.startLine}-${r.endLine}`,
|
|
504
|
+
`${(r.similarity * 100).toFixed(1)}%`,
|
|
505
|
+
r.type || 'code'
|
|
506
|
+
])
|
|
507
|
+
);
|
|
508
|
+
|
|
509
|
+
// Save report
|
|
510
|
+
const report = generateSearchReport(results, opts.search);
|
|
511
|
+
const reportFile = path.join(projectPath, ".vibecheck", "search-report.md");
|
|
512
|
+
fs.writeFileSync(reportFile, report);
|
|
513
|
+
console.log(`\n${c.dim}📄 Full report saved to:${c.reset} ${highlightPath(reportFile)}\n`);
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
return 0;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
// Handle scan mode
|
|
520
|
+
if (opts.scan) {
|
|
521
|
+
printBanner();
|
|
522
|
+
printCommandHeader("SECURITY SCAN", "Detect Secrets & Vulnerabilities");
|
|
523
|
+
console.log(`${c.dim}Scanning project for security issues...${c.reset}\n`);
|
|
524
|
+
|
|
525
|
+
const scanResults = scanProject(projectPath);
|
|
526
|
+
|
|
527
|
+
printSectionHeader('SCAN RESULTS');
|
|
528
|
+
console.log(`${c.dim}Files Scanned:${c.reset} ${formatNumber(scanResults.stats.totalFiles)}`);
|
|
529
|
+
console.log(`${c.dim}Critical Issues:${c.reset} ${c.red}${scanResults.stats.criticalIssues}${c.reset}`);
|
|
530
|
+
console.log(`${c.dim}High Issues:${c.reset} ${c.yellow}${scanResults.stats.highIssues}${c.reset}`);
|
|
531
|
+
console.log(`${c.dim}Medium Issues:${c.reset} ${scanResults.stats.mediumIssues}`);
|
|
532
|
+
console.log(`${c.dim}Secrets Found:${c.reset} ${scanResults.secrets.length}`);
|
|
533
|
+
console.log(`${c.dim}Vulnerabilities:${c.reset} ${scanResults.vulnerabilities.length}\n`);
|
|
534
|
+
|
|
535
|
+
if (scanResults.secrets.length > 0 || scanResults.vulnerabilities.length > 0) {
|
|
536
|
+
console.log(`${c.bgRed}${c.white} ⚠ SECURITY ISSUES DETECTED ${c.reset}\n`);
|
|
537
|
+
|
|
538
|
+
// Show critical issues
|
|
539
|
+
const criticalIssues = [...scanResults.secrets, ...scanResults.vulnerabilities]
|
|
540
|
+
.filter(i => i.severity === "critical" || i.severity === "high")
|
|
541
|
+
.slice(0, 5);
|
|
542
|
+
|
|
543
|
+
console.log(`${c.bold}Critical Issues:${c.reset}\n`);
|
|
544
|
+
criticalIssues.forEach((issue, idx) => {
|
|
545
|
+
const severityColor = issue.severity === 'critical' ? c.red : c.yellow;
|
|
546
|
+
console.log(`${idx + 1}. ${severityColor}${issue.type}${c.reset} in ${highlightPath(issue.file)}:${issue.line}`);
|
|
547
|
+
if (issue.description) {
|
|
548
|
+
console.log(` ${c.dim}${issue.description}${c.reset}`);
|
|
549
|
+
}
|
|
550
|
+
});
|
|
551
|
+
|
|
552
|
+
// Save report
|
|
553
|
+
const report = generateSecurityReport(scanResults);
|
|
554
|
+
const reportFile = path.join(projectPath, ".vibecheck", "security-report.md");
|
|
555
|
+
fs.writeFileSync(reportFile, report);
|
|
556
|
+
console.log(`\n${c.dim}📄 Full report saved to:${c.reset} ${highlightPath(reportFile)}\n`);
|
|
557
|
+
} else {
|
|
558
|
+
console.log(`${c.bgGreen}${c.black} ✓ NO SECURITY ISSUES FOUND ${c.reset}\n`);
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
return 0;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
// Handle decompose mode
|
|
565
|
+
if (opts.decompose) {
|
|
566
|
+
printBanner();
|
|
567
|
+
printCommandHeader("AI TASK DECOMPOSITION", "Smart Context Selection");
|
|
568
|
+
console.log(`${c.dim}Task:${c.reset} ${highlightCode(`"${opts.decompose}"`)}\n`);
|
|
569
|
+
|
|
570
|
+
console.log(`${c.dim}🧠 Analyzing task...${c.reset}`, '\r');
|
|
571
|
+
const plan = decomposeTask(opts.decompose, projectPath);
|
|
572
|
+
console.log(`${c.green}✓ Task analyzed${c.reset} \n`);
|
|
573
|
+
|
|
574
|
+
printSectionHeader('TASK ANALYSIS');
|
|
575
|
+
console.log(`${c.dim}Task Type:${c.reset} ${highlight(plan.taskType)}`);
|
|
576
|
+
console.log(`${c.dim}Search Query:${c.reset} ${highlightCode(`"${plan.searchQuery}"`)}`);
|
|
577
|
+
console.log(`${c.dim}Context Files:${c.reset} ${formatNumber(plan.context.files.length)}`);
|
|
578
|
+
console.log(`${c.dim}Estimated Tokens:${c.reset} ${formatNumber(plan.context.totalTokens)}\n`);
|
|
579
|
+
|
|
580
|
+
if (plan.context.files.length > 0) {
|
|
581
|
+
console.log(`${c.bold}Selected Context:${c.reset}\n`);
|
|
582
|
+
printTable(['File', 'Tokens', 'Relevance'],
|
|
583
|
+
plan.context.files.slice(0, 10).map(f => [
|
|
584
|
+
highlightPath(f.file),
|
|
585
|
+
formatNumber(f.tokens),
|
|
586
|
+
`${(f.relevance * 100).toFixed(1)}%`
|
|
587
|
+
])
|
|
588
|
+
);
|
|
589
|
+
if (plan.context.files.length > 10) {
|
|
590
|
+
console.log(`${c.dim}... and ${plan.context.files.length - 10} more files${c.reset}\n`);
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
if (plan.recommendations.length > 0) {
|
|
595
|
+
console.log(`${c.bold}Recommendations:${c.reset}\n`);
|
|
596
|
+
plan.recommendations.forEach((rec, idx) => {
|
|
597
|
+
console.log(`${idx + 1}. ${c.cyan}•${c.reset} ${rec}`);
|
|
598
|
+
});
|
|
599
|
+
console.log();
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
// Save report
|
|
603
|
+
const report = generateDecompositionReport(plan);
|
|
604
|
+
const reportFile = path.join(projectPath, ".vibecheck", "task-decomposition.md");
|
|
605
|
+
fs.writeFileSync(reportFile, report);
|
|
606
|
+
console.log(`${c.dim}📄 Full report saved to:${c.reset} ${highlightPath(reportFile)}\n`);
|
|
607
|
+
|
|
608
|
+
return 0;
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
// Handle federation mode
|
|
612
|
+
if (opts.federate) {
|
|
613
|
+
printBanner();
|
|
614
|
+
printCommandHeader("MULTI-REPO FEDERATION", "Cross-Repository Context");
|
|
615
|
+
console.log(`${c.dim}Initializing federation...${c.reset}\n`);
|
|
616
|
+
|
|
617
|
+
// Register current repo
|
|
618
|
+
console.log(`${c.dim}📋 Registering repository...${c.reset}`, '\r');
|
|
619
|
+
const repoInfo = registerRepository(projectPath);
|
|
620
|
+
console.log(`${c.green}✓ Repository registered${c.reset} \n`);
|
|
621
|
+
console.log(`${c.dim}Name:${c.reset} ${highlight(repoInfo.name || repoInfo.id)}\n`);
|
|
622
|
+
|
|
623
|
+
// Find related repos
|
|
624
|
+
console.log(`${c.dim}🔍 Finding related repositories...${c.reset}`, '\r');
|
|
625
|
+
const related = findRelatedRepositories(projectPath, 5);
|
|
626
|
+
console.log(`${c.green}✓ Found ${related.length} related repos${c.reset}\n`);
|
|
627
|
+
|
|
628
|
+
if (related.length > 0) {
|
|
629
|
+
console.log(`${c.bold}Related Repositories:${c.reset}\n`);
|
|
630
|
+
printTable(['Repository', 'Framework', 'Similarity'],
|
|
631
|
+
related.map(r => [
|
|
632
|
+
highlight(r.name || r.id),
|
|
633
|
+
r.framework || "Unknown",
|
|
634
|
+
`${(r.similarity * 100).toFixed(0)}%`
|
|
635
|
+
])
|
|
636
|
+
);
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
// Generate federated context
|
|
640
|
+
console.log(`\n${c.dim}🌐 Generating federated context...${c.reset}`, '\r');
|
|
641
|
+
const federated = generateFederatedContext();
|
|
642
|
+
console.log(`${c.green}✓ Federation complete${c.reset} \n`);
|
|
643
|
+
|
|
644
|
+
printSectionHeader('FEDERATION SUMMARY');
|
|
645
|
+
console.log(`${c.dim}Total Repositories:${c.reset} ${formatNumber(federated.stats.totalRepos)}`);
|
|
646
|
+
console.log(`${c.dim}Shared Components:${c.reset} ${formatNumber(federated.stats.sharedComponents)}`);
|
|
647
|
+
console.log(`${c.dim}Shared Hooks:${c.reset} ${formatNumber(federated.stats.sharedHooks)}`);
|
|
648
|
+
console.log(`${c.dim}Shared Patterns:${c.reset} ${formatNumber(federated.stats.sharedPatterns)}\n`);
|
|
649
|
+
|
|
650
|
+
// Save report
|
|
651
|
+
const report = generateFederationReport(federated);
|
|
652
|
+
const reportFile = path.join(projectPath, ".vibecheck", "federation-report.md");
|
|
653
|
+
fs.writeFileSync(reportFile, report);
|
|
654
|
+
console.log(`${c.dim}📄 Full report saved to:${c.reset} ${highlightPath(reportFile)}\n`);
|
|
655
|
+
|
|
656
|
+
return 0;
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
// Default context generation
|
|
660
|
+
printBanner();
|
|
661
|
+
printCommandHeader("CONTEXT", "AI Memory & Shared Context Engine");
|
|
662
|
+
console.log(`${c.dim}Analyzing project:${c.reset} ${highlightPath(projectPath)}\n`);
|
|
663
|
+
|
|
664
|
+
// Handle diff mode
|
|
665
|
+
if (opts.diff) {
|
|
666
|
+
const previous = loadSnapshot(projectPath);
|
|
667
|
+
if (!previous) {
|
|
668
|
+
console.log(`${c.yellow}No previous context generation found.${c.reset}\n`);
|
|
669
|
+
console.log(`Run ${c.cyan}vibecheck context${c.reset} first to generate baseline.\n`);
|
|
670
|
+
return 1;
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
console.log(`${c.dim}Loading previous context...${c.reset}\n`);
|
|
674
|
+
const analysis = analyzeProject(projectPath);
|
|
675
|
+
const diff = generateContextDiff(previous, analysis);
|
|
676
|
+
|
|
677
|
+
console.log(`${c.green}Context Changes:${c.reset}\n`);
|
|
678
|
+
console.log(`- Total Changes: ${diff.summary.totalChanges}`);
|
|
679
|
+
console.log(`- Additions: ${diff.summary.additions}`);
|
|
680
|
+
console.log(`- Removals: ${diff.summary.removals}`);
|
|
681
|
+
console.log(`- Breaking Changes: ${diff.summary.breakingChanges}\n`);
|
|
682
|
+
|
|
683
|
+
if (diff.summary.totalChanges > 0) {
|
|
684
|
+
console.log(`${c.yellow}Changes detected:${c.reset}\n`);
|
|
685
|
+
for (const change of diff.changes.added.slice(0, 10)) {
|
|
686
|
+
console.log(` ${c.green}+${c.reset} ${change.type}: ${change.name}`);
|
|
687
|
+
}
|
|
688
|
+
for (const change of diff.changes.removed.slice(0, 10)) {
|
|
689
|
+
console.log(` ${c.red}-${c.reset} ${change.type}: ${change.name}`);
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
const reportFile = saveDiffReport(projectPath, diff);
|
|
693
|
+
console.log(`\n${c.dim}Full report saved to: ${reportFile}${c.reset}\n`);
|
|
694
|
+
} else {
|
|
695
|
+
console.log(`${c.green}No changes detected since last generation.${c.reset}\n`);
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
return 0;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
// Handle prune mode
|
|
702
|
+
if (opts.prune) {
|
|
703
|
+
console.log(`${c.dim}Analyzing project for pruning...${c.reset}\n`);
|
|
704
|
+
const analysis = analyzeProject(projectPath);
|
|
705
|
+
|
|
706
|
+
const pruned = opts.currentFile
|
|
707
|
+
? getContextForFile(path.join(projectPath, opts.currentFile), analysis)
|
|
708
|
+
: pruneContext(analysis, {
|
|
709
|
+
maxTokens: opts.maxTokens,
|
|
710
|
+
task: opts.task,
|
|
711
|
+
});
|
|
712
|
+
|
|
713
|
+
console.log(`${c.green}Pruned Context Generated:${c.reset}\n`);
|
|
714
|
+
console.log(`- Total Files: ${pruned.totalCount || 0}`);
|
|
715
|
+
console.log(`- Included Files: ${pruned.includedCount || 0}`);
|
|
716
|
+
console.log(`- Pruned Files: ${pruned.pruned || 0}`);
|
|
717
|
+
console.log(`- Estimated Tokens: ${pruned.totalTokens || 0} / ${pruned.maxTokens || opts.maxTokens}\n`);
|
|
718
|
+
|
|
719
|
+
console.log(`${c.dim}Top files by relevance:${c.reset}\n`);
|
|
720
|
+
for (const file of pruned.files.slice(0, 10)) {
|
|
721
|
+
console.log(` ${c.cyan}•${c.reset} ${file.path} (score: ${file.score}, tokens: ${file.tokens})`);
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
// Save pruned context
|
|
725
|
+
const vibecheckDir = path.join(projectPath, ".vibecheck");
|
|
726
|
+
if (!fs.existsSync(vibecheckDir)) {
|
|
727
|
+
fs.mkdirSync(vibecheckDir, { recursive: true });
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
const outputPath = path.join(vibecheckDir, "context-pruned.json");
|
|
731
|
+
const outputData = opts.currentFile ? pruned : generatePrunedContext(analysis, {
|
|
732
|
+
maxTokens: opts.maxTokens,
|
|
733
|
+
task: opts.task,
|
|
734
|
+
});
|
|
735
|
+
|
|
736
|
+
fs.writeFileSync(outputPath, JSON.stringify(outputData, null, 2));
|
|
737
|
+
console.log(`\n${c.dim}Saved to: .vibecheck/context-pruned.json${c.reset}\n`);
|
|
738
|
+
|
|
739
|
+
return 0;
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
// Handle search mode first (before any other output)
|
|
743
|
+
if (opts.search) {
|
|
744
|
+
console.log(`
|
|
745
|
+
${c.cyan}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${c.reset}
|
|
746
|
+
${c.bold}vibecheck CONTEXT v3.0${c.reset} - Semantic Code Search
|
|
747
|
+
${c.cyan}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${c.reset}
|
|
748
|
+
`);
|
|
749
|
+
console.log(`${c.dim}Searching code...${c.reset}\n`);
|
|
750
|
+
|
|
751
|
+
let searchIndex = loadSearchIndex(projectPath);
|
|
752
|
+
if (!searchIndex) {
|
|
753
|
+
console.log(`${c.yellow}Building search index...${c.reset}\n`);
|
|
754
|
+
searchIndex = buildSearchIndex(projectPath);
|
|
755
|
+
saveSearchIndex(projectPath, searchIndex);
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
const results = semanticSearch(searchIndex, opts.search, 10);
|
|
759
|
+
|
|
760
|
+
if (results.length === 0) {
|
|
761
|
+
console.log(`${c.yellow}No results found for "${opts.search}"${c.reset}\n`);
|
|
762
|
+
} else {
|
|
763
|
+
console.log(`${c.green}Found ${results.length} results:${c.reset}\n`);
|
|
764
|
+
for (const result of results) {
|
|
765
|
+
console.log(` ${c.cyan}•${c.reset} ${result.file}:${result.startLine}-${result.endLine} (${(result.similarity * 100).toFixed(1)}% match)`);
|
|
766
|
+
console.log(` ${c.dim}${result.type}${c.reset}`);
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
// Save report
|
|
770
|
+
const report = generateSearchReport(results, opts.search);
|
|
771
|
+
const reportFile = path.join(projectPath, ".vibecheck", "search-report.md");
|
|
772
|
+
fs.writeFileSync(reportFile, report);
|
|
773
|
+
console.log(`\n${c.dim}Full report saved to: ${reportFile}${c.reset}\n`);
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
return 0;
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
// Handle scan mode
|
|
780
|
+
if (opts.scan) {
|
|
781
|
+
console.log(`
|
|
782
|
+
${c.cyan}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${c.reset}
|
|
783
|
+
${c.bold}vibecheck CONTEXT v3.0${c.reset} - Security Scanner
|
|
784
|
+
${c.cyan}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${c.reset}
|
|
785
|
+
`);
|
|
786
|
+
console.log(`${c.dim}Scanning for security issues...${c.reset}\n`);
|
|
787
|
+
|
|
788
|
+
const scanResults = scanProject(projectPath);
|
|
789
|
+
|
|
790
|
+
console.log(`${c.green}Security Scan Results:${c.reset}\n`);
|
|
791
|
+
console.log(`- Files Scanned: ${scanResults.stats.totalFiles}`);
|
|
792
|
+
console.log(`- Critical Issues: ${scanResults.stats.criticalIssues}`);
|
|
793
|
+
console.log(`- High Issues: ${scanResults.stats.highIssues}`);
|
|
794
|
+
console.log(`- Medium Issues: ${scanResults.stats.mediumIssues}`);
|
|
795
|
+
console.log(`- Secrets Found: ${scanResults.secrets.length}`);
|
|
796
|
+
console.log(`- Vulnerabilities: ${scanResults.vulnerabilities.length}\n`);
|
|
797
|
+
|
|
798
|
+
if (scanResults.secrets.length > 0 || scanResults.vulnerabilities.length > 0) {
|
|
799
|
+
console.log(`${c.red}⚠ Security issues detected!${c.reset}\n`);
|
|
800
|
+
|
|
801
|
+
// Show critical issues
|
|
802
|
+
const criticalIssues = [...scanResults.secrets, ...scanResults.vulnerabilities]
|
|
803
|
+
.filter(i => i.severity === "critical" || i.severity === "high")
|
|
804
|
+
.slice(0, 5);
|
|
805
|
+
|
|
806
|
+
for (const issue of criticalIssues) {
|
|
807
|
+
console.log(` ${c.red}•${c.reset} ${issue.type} in ${issue.file}:${issue.line}`);
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
// Save report
|
|
811
|
+
const report = generateSecurityReport(scanResults);
|
|
812
|
+
const reportFile = path.join(projectPath, ".vibecheck", "security-report.md");
|
|
813
|
+
fs.writeFileSync(reportFile, report);
|
|
814
|
+
console.log(`\n${c.dim}Full report saved to: ${reportFile}${c.reset}\n`);
|
|
815
|
+
} else {
|
|
816
|
+
console.log(`${c.green}✅ No security issues found!${c.reset}\n`);
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
return 0;
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
// Handle decompose mode
|
|
823
|
+
if (opts.decompose) {
|
|
824
|
+
console.log(`
|
|
825
|
+
${c.cyan}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${c.reset}
|
|
826
|
+
${c.bold}vibecheck CONTEXT v3.0${c.reset} - AI Task Decomposition
|
|
827
|
+
${c.cyan}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${c.reset}
|
|
828
|
+
`);
|
|
829
|
+
console.log(`${c.dim}Decomposing task...${c.reset}\n`);
|
|
830
|
+
|
|
831
|
+
const plan = decomposeTask(opts.decompose, projectPath);
|
|
832
|
+
|
|
833
|
+
console.log(`${c.green}Task Analysis:${c.reset}\n`);
|
|
834
|
+
console.log(`- Task Type: ${plan.taskType}`);
|
|
835
|
+
console.log(`- Search Query: "${plan.searchQuery}"`);
|
|
836
|
+
console.log(`- Context Files: ${plan.context.files.length}`);
|
|
837
|
+
console.log(`- Estimated Tokens: ${plan.context.totalTokens}\n`);
|
|
838
|
+
|
|
839
|
+
if (plan.context.files.length > 0) {
|
|
840
|
+
console.log(`${c.dim}Selected Context:${c.reset}\n`);
|
|
841
|
+
for (const file of plan.context.files.slice(0, 5)) {
|
|
842
|
+
console.log(` ${c.cyan}•${c.reset} ${file.file} (${file.tokens} tokens)`);
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
if (plan.recommendations.length > 0) {
|
|
847
|
+
console.log(`\n${c.magenta}Recommendations:${c.reset}\n`);
|
|
848
|
+
for (const rec of plan.recommendations) {
|
|
849
|
+
console.log(` • ${rec}`);
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
// Save report
|
|
854
|
+
const report = generateDecompositionReport(plan);
|
|
855
|
+
const reportFile = path.join(projectPath, ".vibecheck", "task-decomposition.md");
|
|
856
|
+
fs.writeFileSync(reportFile, report);
|
|
857
|
+
console.log(`\n${c.dim}Full report saved to: ${reportFile}${c.reset}\n`);
|
|
858
|
+
|
|
859
|
+
return 0;
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
// Handle federation mode
|
|
863
|
+
if (opts.federate) {
|
|
864
|
+
console.log(`
|
|
865
|
+
${c.cyan}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${c.reset}
|
|
866
|
+
${c.bold}vibecheck CONTEXT v3.0${c.reset} - Multi-Repo Federation
|
|
867
|
+
${c.cyan}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${c.reset}
|
|
868
|
+
`);
|
|
869
|
+
console.log(`${c.dim}Initializing federation...${c.reset}\n`);
|
|
870
|
+
|
|
871
|
+
// Register current repo
|
|
872
|
+
const repoInfo = registerRepository(projectPath);
|
|
873
|
+
console.log(`${c.green}Registered repository:${c.reset} ${repoInfo.name || repoInfo.id}\n`);
|
|
874
|
+
|
|
875
|
+
// Find related repos
|
|
876
|
+
const related = findRelatedRepositories(projectPath, 5);
|
|
877
|
+
if (related.length > 0) {
|
|
878
|
+
console.log(`${c.cyan}Related repositories:${c.reset}\n`);
|
|
879
|
+
for (const repo of related) {
|
|
880
|
+
console.log(` • ${repo.name || repo.id} (${repo.framework || "Unknown"}) - ${(repo.similarity * 100).toFixed(0)}% similar`);
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
// Generate federated context
|
|
885
|
+
const federated = generateFederatedContext();
|
|
886
|
+
console.log(`\n${c.green}Federation Summary:${c.reset}\n`);
|
|
887
|
+
console.log(`- Total Repositories: ${federated.stats.totalRepos}`);
|
|
888
|
+
console.log(`- Shared Components: ${federated.stats.sharedComponents}`);
|
|
889
|
+
console.log(`- Shared Hooks: ${federated.stats.sharedHooks}`);
|
|
890
|
+
console.log(`- Shared Patterns: ${federated.stats.sharedPatterns}\n`);
|
|
891
|
+
|
|
892
|
+
// Save report
|
|
893
|
+
const report = generateFederationReport(federated);
|
|
894
|
+
const reportFile = path.join(projectPath, ".vibecheck", "federation-report.md");
|
|
895
|
+
fs.writeFileSync(reportFile, report);
|
|
896
|
+
console.log(`${c.dim}Full report saved to: ${reportFile}${c.reset}\n`);
|
|
897
|
+
|
|
898
|
+
return 0;
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
// Default header for other modes
|
|
902
|
+
console.log(`
|
|
903
|
+
${c.cyan}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${c.reset}
|
|
904
|
+
${c.bold}vibecheck CONTEXT v3.0${c.reset} - AI Memory & Shared Context Engine
|
|
905
|
+
${c.cyan}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${c.reset}
|
|
906
|
+
`);
|
|
907
|
+
|
|
908
|
+
// Analyze project
|
|
909
|
+
let analysis = analyzeProject(projectPath);
|
|
910
|
+
analysis = await applyContextValidation(projectPath, analysis, opts);
|
|
911
|
+
const p = analysis.patterns || {};
|
|
912
|
+
|
|
913
|
+
// Display analysis - Basic info
|
|
914
|
+
printSectionHeader('PROJECT ANALYSIS');
|
|
915
|
+
console.log(`${c.dim}Project:${c.reset} ${highlight(analysis.name)}`);
|
|
916
|
+
console.log(`${c.dim}Framework:${c.reset} ${analysis.framework || "Unknown"}`);
|
|
917
|
+
console.log(`${c.dim}Language:${c.reset} ${analysis.language || "JavaScript"}`);
|
|
918
|
+
console.log(`${c.dim}Architecture:${c.reset} ${analysis.architecture}`);
|
|
919
|
+
|
|
920
|
+
const s = analysis.stats || {};
|
|
921
|
+
if (s.totalFiles) {
|
|
922
|
+
console.log(`${c.dim}Size:${c.reset} ${formatNumber(s.totalFiles)} files, ~${formatNumber(Math.round(s.totalLines / 1000))}k lines`);
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
// Structure
|
|
926
|
+
console.log(`\n${c.blue}Structure:${c.reset}`);
|
|
927
|
+
console.log(` ${c.dim}Directories:${c.reset} ${analysis.directories.length} | ${c.dim}Components:${c.reset} ${analysis.components.length} | ${c.dim}API Routes:${c.reset} ${analysis.apiRoutes.length} | ${c.dim}Models:${c.reset} ${analysis.models.length}`);
|
|
928
|
+
|
|
929
|
+
const t = analysis.types || {};
|
|
930
|
+
if (t.interfaces?.length || t.types?.length) {
|
|
931
|
+
console.log(` ${c.dim}Interfaces:${c.reset} ${t.interfaces?.length || 0} | ${c.dim}Types:${c.reset} ${t.types?.length || 0} | ${c.dim}Enums:${c.reset} ${t.enums?.length || 0}`);
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
const env = analysis.envVars || {};
|
|
935
|
+
if (env.variables?.length) {
|
|
936
|
+
console.log(` ${c.dim}Env Vars:${c.reset} ${env.variables.length} detected`);
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
// Patterns
|
|
940
|
+
if (p.hooks?.length || p.stateManagement || p.dataFetching?.length || p.styling?.length) {
|
|
941
|
+
console.log(`\n${c.magenta}Patterns Detected:${c.reset}`);
|
|
942
|
+
if (p.hooks?.length) console.log(` ${c.dim}Custom Hooks:${c.reset} ${p.hooks.length} (${p.hooks.slice(0, 3).join(", ")}${p.hooks.length > 3 ? "..." : ""})`);
|
|
943
|
+
if (p.stateManagement) console.log(` ${c.dim}State:${c.reset} ${p.stateManagement}`);
|
|
944
|
+
if (p.dataFetching?.length) console.log(` ${c.dim}Data Fetching:${c.reset} ${p.dataFetching.join(", ")}`);
|
|
945
|
+
if (p.styling?.length) console.log(` ${c.dim}Styling:${c.reset} ${p.styling.join(", ")}`);
|
|
946
|
+
if (p.validation) console.log(` ${c.dim}Validation:${c.reset} ${p.validation}`);
|
|
947
|
+
if (p.authentication) console.log(` ${c.dim}Auth:${c.reset} ${p.authentication}`);
|
|
948
|
+
if (p.testing?.length) console.log(` ${c.dim}Testing:${c.reset} ${p.testing.join(", ")}`);
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
// Anti-patterns
|
|
952
|
+
if (p.antiPatterns?.length > 0) {
|
|
953
|
+
console.log(`\n${c.yellow}⚠ Anti-Patterns Found:${c.reset}`);
|
|
954
|
+
for (const ap of p.antiPatterns) {
|
|
955
|
+
const icon = ap.severity === 'error' ? `${c.red}✗${c.reset}` : ap.severity === 'warning' ? `${c.yellow}!${c.reset}` : `${c.blue}i${c.reset}`;
|
|
956
|
+
console.log(` ${icon} ${ap.message}`);
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
// Monorepo
|
|
961
|
+
const mono = analysis.monorepo || {};
|
|
962
|
+
if (mono.isMonorepo) {
|
|
963
|
+
console.log(`\n${c.cyan}📦 Monorepo Detected:${c.reset} ${mono.type}`);
|
|
964
|
+
console.log(` ${c.dim}Workspaces:${c.reset} ${mono.workspaces?.length || 0}`);
|
|
965
|
+
if (mono.sharedPackages?.length > 0) {
|
|
966
|
+
console.log(` ${c.dim}Shared packages:${c.reset} ${mono.sharedPackages.slice(0, 3).map(p => p.name).join(", ")}...`);
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
// AI Memory
|
|
971
|
+
const memoryStatus = loadMemory();
|
|
972
|
+
const projectCount = Object.keys(memoryStatus.projects || {}).length;
|
|
973
|
+
if (projectCount > 0) {
|
|
974
|
+
console.log(`\n${c.magenta}🧠 AI Memory:${c.reset}`);
|
|
975
|
+
console.log(` ${c.dim}Projects learned:${c.reset} ${projectCount}`);
|
|
976
|
+
console.log(` ${c.dim}Total learnings:${c.reset} ${memoryStatus.learnings?.length || 0}`);
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
// Recommendations
|
|
980
|
+
const recommendations = getRecommendations(analysis);
|
|
981
|
+
if (recommendations.length > 0) {
|
|
982
|
+
console.log(`\n${c.green}💡 Recommendations:${c.reset}`);
|
|
983
|
+
for (const rec of recommendations) {
|
|
984
|
+
console.log(` ${c.dim}•${c.reset} ${rec.message}`);
|
|
985
|
+
}
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
console.log(`\n${c.dim}Generating rules files...${c.reset}\n`);
|
|
989
|
+
|
|
990
|
+
// Write files
|
|
991
|
+
const written = writeFiles(projectPath, opts.platform, analysis, opts.verbose);
|
|
992
|
+
|
|
993
|
+
// Generate additional enhanced files
|
|
994
|
+
const vibecheckDir = path.join(projectPath, ".vibecheck");
|
|
995
|
+
|
|
996
|
+
// Dependency graph
|
|
997
|
+
if (opts.verbose) {
|
|
998
|
+
console.log(`${c.dim}Generating dependency graph...${c.reset}`);
|
|
999
|
+
}
|
|
1000
|
+
const depGraph = buildDependencyGraph(projectPath);
|
|
1001
|
+
const mermaidDiagram = generateMermaidDiagram(depGraph, { maxNodes: 50 });
|
|
1002
|
+
fs.writeFileSync(path.join(vibecheckDir, "dependency-graph.mmd"), mermaidDiagram);
|
|
1003
|
+
written.push(".vibecheck/dependency-graph.mmd");
|
|
1004
|
+
|
|
1005
|
+
// HTML visualization
|
|
1006
|
+
const htmlViz = generateHtmlVisualization(depGraph, { maxNodes: 100 });
|
|
1007
|
+
fs.writeFileSync(path.join(vibecheckDir, "dependency-graph.html"), htmlViz);
|
|
1008
|
+
written.push(".vibecheck/dependency-graph.html");
|
|
1009
|
+
|
|
1010
|
+
// Git context
|
|
1011
|
+
const gitContext = getGitContext(projectPath);
|
|
1012
|
+
if (gitContext?.isRepo) {
|
|
1013
|
+
fs.writeFileSync(
|
|
1014
|
+
path.join(vibecheckDir, "git-context.json"),
|
|
1015
|
+
JSON.stringify(gitContext, null, 2)
|
|
1016
|
+
);
|
|
1017
|
+
written.push(".vibecheck/git-context.json");
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
// API contracts
|
|
1021
|
+
const apiContext = generateAPIContext(projectPath);
|
|
1022
|
+
fs.writeFileSync(
|
|
1023
|
+
path.join(vibecheckDir, "api-contracts.json"),
|
|
1024
|
+
JSON.stringify(apiContext, null, 2)
|
|
1025
|
+
);
|
|
1026
|
+
written.push(".vibecheck/api-contracts.json");
|
|
1027
|
+
|
|
1028
|
+
// Team conventions
|
|
1029
|
+
const teamReport = generateTeamReport(projectPath);
|
|
1030
|
+
if (teamReport.available) {
|
|
1031
|
+
fs.writeFileSync(
|
|
1032
|
+
path.join(vibecheckDir, "team-conventions.json"),
|
|
1033
|
+
JSON.stringify(teamReport, null, 2)
|
|
1034
|
+
);
|
|
1035
|
+
written.push(".vibecheck/team-conventions.json");
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
// Save snapshot for diff tracking
|
|
1039
|
+
const snapshot = saveSnapshot(projectPath, analysis);
|
|
1040
|
+
|
|
1041
|
+
// Display results
|
|
1042
|
+
printSectionHeader('GENERATION COMPLETE');
|
|
1043
|
+
console.log(`${c.green}✓ Generated ${written.length} files:${c.reset}\n`);
|
|
1044
|
+
|
|
1045
|
+
written.forEach((file, idx) => {
|
|
1046
|
+
console.log(` ${c.cyan}${idx + 1}.${c.reset} ${highlightPath(file)}`);
|
|
1047
|
+
});
|
|
1048
|
+
|
|
1049
|
+
// Enhancements summary
|
|
1050
|
+
const enhancements = [];
|
|
1051
|
+
if (p.hooks?.length) enhancements.push("custom hooks");
|
|
1052
|
+
if (p.stateManagement) enhancements.push("state patterns");
|
|
1053
|
+
if (p.codeExamples?.hooks) enhancements.push("code examples");
|
|
1054
|
+
if (p.antiPatterns?.length) enhancements.push("anti-pattern warnings");
|
|
1055
|
+
if (p.testing?.length) enhancements.push("testing patterns");
|
|
1056
|
+
if (analysis.types?.interfaces?.length) enhancements.push("type definitions");
|
|
1057
|
+
if (analysis.envVars?.variables?.length) enhancements.push("env vars");
|
|
1058
|
+
if (analysis.stats?.totalFiles) enhancements.push("file statistics");
|
|
1059
|
+
if (analysis.monorepo?.isMonorepo) enhancements.push("monorepo workspaces");
|
|
1060
|
+
enhancements.push("AI memory");
|
|
1061
|
+
enhancements.push("chat insights");
|
|
1062
|
+
enhancements.push("dependency graphs");
|
|
1063
|
+
if (gitContext?.isRepo) enhancements.push("git context");
|
|
1064
|
+
enhancements.push("API contracts");
|
|
1065
|
+
if (teamReport.available) enhancements.push("team conventions");
|
|
1066
|
+
|
|
1067
|
+
console.log();
|
|
1068
|
+
console.log(`${c.bgGreen}${c.black} ✓ CONTEXT GENERATION COMPLETE ${c.reset}\n`);
|
|
1069
|
+
|
|
1070
|
+
console.log(`${c.bold}Your AI coding assistants now have full project awareness:${c.reset}\n`);
|
|
1071
|
+
|
|
1072
|
+
const platforms = [
|
|
1073
|
+
['Cursor', '.cursorrules and .cursor/rules/'],
|
|
1074
|
+
['Windsurf', '.windsurf/rules/'],
|
|
1075
|
+
['Copilot', '.github/copilot-instructions.md'],
|
|
1076
|
+
['Claude Code', '.claude/project-context.md'],
|
|
1077
|
+
['Codex/ChatGPT', '.codex-instructions.md'],
|
|
1078
|
+
['MCP', '.vibecheck/context.json'],
|
|
1079
|
+
];
|
|
1080
|
+
|
|
1081
|
+
platforms.forEach(([name, files]) => {
|
|
1082
|
+
console.log(` ${c.cyan}•${c.reset} ${name.padEnd(14)} ${c.dim}will read${c.reset} ${files}`);
|
|
1083
|
+
});
|
|
1084
|
+
|
|
1085
|
+
console.log(`\n${c.magenta}🧠 AI Memory active:${c.reset} Learning from your projects to give better recommendations\n`);
|
|
1086
|
+
|
|
1087
|
+
if (enhancements.length > 0) {
|
|
1088
|
+
console.log(`${c.magenta}Enhanced with:${c.reset} ${enhancements.join(", ")}\n`);
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
console.log(`${c.dim}Next steps:${c.reset}`);
|
|
1092
|
+
console.log(` • Regenerate after major changes: ${highlightCode('vibecheck context')}`);
|
|
1093
|
+
console.log(` • Track changes: ${highlightCode('vibecheck context --diff')}`);
|
|
1094
|
+
console.log(` • Generate pruned context: ${highlightCode('vibecheck context --prune')}`);
|
|
1095
|
+
console.log(` • Semantic search: ${highlightCode('vibecheck context --search "query"')}`);
|
|
1096
|
+
console.log(` • Security scan: ${highlightCode('vibecheck context --scan')}`);
|
|
1097
|
+
console.log(` • AI task analysis: ${highlightCode('vibecheck context --decompose "task"')}`);
|
|
1098
|
+
console.log(` • Multi-repo federation: ${highlightCode('vibecheck context --federate')}`);
|
|
1099
|
+
console.log();
|
|
1100
|
+
|
|
1101
|
+
// Watch mode
|
|
1102
|
+
if (opts.watch) {
|
|
1103
|
+
startWatchMode(projectPath, opts.platform, opts.verbose);
|
|
1104
|
+
return new Promise(() => {});
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
return 0;
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1110
|
+
module.exports = { runContext };
|