@vibecheckai/cli 2.8.2 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -8
- package/bin/_deprecations.js +35 -0
- package/bin/_router.js +46 -0
- package/bin/cli-hygiene.js +241 -0
- package/bin/guardrail.js +834 -0
- package/bin/runners/cli-utils.js +1070 -0
- package/bin/runners/context/ai-task-decomposer.js +337 -0
- package/bin/runners/context/analyzer.js +462 -0
- package/bin/runners/context/api-contracts.js +427 -0
- package/bin/runners/context/context-diff.js +342 -0
- package/bin/runners/context/context-pruner.js +291 -0
- package/bin/runners/context/dependency-graph.js +414 -0
- package/bin/runners/context/generators/claude.js +107 -0
- package/bin/runners/context/generators/codex.js +108 -0
- package/bin/runners/context/generators/copilot.js +119 -0
- package/bin/runners/context/generators/cursor.js +514 -0
- package/bin/runners/context/generators/mcp.js +151 -0
- package/bin/runners/context/generators/windsurf.js +180 -0
- package/bin/runners/context/git-context.js +302 -0
- package/bin/runners/context/index.js +1042 -0
- package/bin/runners/context/insights.js +173 -0
- package/bin/runners/context/mcp-server/generate-rules.js +337 -0
- package/bin/runners/context/mcp-server/index.js +1176 -0
- package/bin/runners/context/mcp-server/package.json +24 -0
- package/bin/runners/context/memory.js +200 -0
- package/bin/runners/context/monorepo.js +215 -0
- package/bin/runners/context/multi-repo-federation.js +404 -0
- package/bin/runners/context/patterns.js +253 -0
- package/bin/runners/context/proof-context.js +972 -0
- package/bin/runners/context/security-scanner.js +303 -0
- package/bin/runners/context/semantic-search.js +350 -0
- package/bin/runners/context/shared.js +264 -0
- package/bin/runners/context/team-conventions.js +310 -0
- package/bin/runners/lib/ai-bridge.js +416 -0
- package/bin/runners/lib/analysis-core.js +271 -0
- package/bin/runners/lib/analyzers.js +541 -0
- package/bin/runners/lib/audit-bridge.js +391 -0
- package/bin/runners/lib/auth-truth.js +193 -0
- package/bin/runners/lib/auth.js +215 -0
- package/bin/runners/lib/backup.js +62 -0
- package/bin/runners/lib/billing.js +107 -0
- package/bin/runners/lib/claims.js +118 -0
- package/bin/runners/lib/cli-ui.js +540 -0
- package/bin/runners/lib/compliance-bridge-new.js +0 -0
- package/bin/runners/lib/compliance-bridge.js +165 -0
- package/bin/runners/lib/contracts/auth-contract.js +194 -0
- package/bin/runners/lib/contracts/env-contract.js +178 -0
- package/bin/runners/lib/contracts/external-contract.js +198 -0
- package/bin/runners/lib/contracts/guard.js +168 -0
- package/bin/runners/lib/contracts/index.js +89 -0
- package/bin/runners/lib/contracts/plan-validator.js +311 -0
- package/bin/runners/lib/contracts/route-contract.js +192 -0
- package/bin/runners/lib/detect.js +89 -0
- package/bin/runners/lib/doctor/autofix.js +254 -0
- package/bin/runners/lib/doctor/index.js +37 -0
- package/bin/runners/lib/doctor/modules/dependencies.js +325 -0
- package/bin/runners/lib/doctor/modules/index.js +46 -0
- package/bin/runners/lib/doctor/modules/network.js +250 -0
- package/bin/runners/lib/doctor/modules/project.js +312 -0
- package/bin/runners/lib/doctor/modules/runtime.js +224 -0
- package/bin/runners/lib/doctor/modules/security.js +348 -0
- package/bin/runners/lib/doctor/modules/system.js +213 -0
- package/bin/runners/lib/doctor/modules/vibecheck.js +394 -0
- package/bin/runners/lib/doctor/reporter.js +262 -0
- package/bin/runners/lib/doctor/service.js +262 -0
- package/bin/runners/lib/doctor/types.js +113 -0
- package/bin/runners/lib/doctor/ui.js +263 -0
- package/bin/runners/lib/doctor-enhanced.js +233 -0
- package/bin/runners/lib/doctor-v2.js +608 -0
- package/bin/runners/lib/enforcement.js +72 -0
- package/bin/runners/lib/enterprise-detect.js +603 -0
- package/bin/runners/lib/enterprise-init.js +942 -0
- package/bin/runners/lib/entitlements-v2.js +381 -0
- package/bin/runners/lib/entitlements.generated.js +0 -0
- package/bin/runners/lib/entitlements.js +332 -0
- package/bin/runners/lib/env-template.js +66 -0
- package/bin/runners/lib/env.js +189 -0
- package/bin/runners/lib/error-handler.js +320 -0
- package/bin/runners/lib/firewall-prompt.js +50 -0
- package/bin/runners/lib/graph/graph-builder.js +265 -0
- package/bin/runners/lib/graph/html-renderer.js +413 -0
- package/bin/runners/lib/graph/index.js +32 -0
- package/bin/runners/lib/graph/runtime-collector.js +215 -0
- package/bin/runners/lib/graph/static-extractor.js +518 -0
- package/bin/runners/lib/init-wizard.js +308 -0
- package/bin/runners/lib/json-output.js +76 -0
- package/bin/runners/lib/llm.js +75 -0
- package/bin/runners/lib/meter.js +61 -0
- package/bin/runners/lib/missions/evidence.js +126 -0
- package/bin/runners/lib/missions/plan.js +69 -0
- package/bin/runners/lib/missions/templates.js +147 -0
- package/bin/runners/lib/patch.js +40 -0
- package/bin/runners/lib/permissions/auth-model.js +213 -0
- package/bin/runners/lib/permissions/idor-prover.js +205 -0
- package/bin/runners/lib/permissions/index.js +45 -0
- package/bin/runners/lib/permissions/matrix-builder.js +198 -0
- package/bin/runners/lib/pkgjson.js +28 -0
- package/bin/runners/lib/preflight.js +142 -0
- package/bin/runners/lib/reality-findings.js +84 -0
- package/bin/runners/lib/redact.js +29 -0
- package/bin/runners/lib/replay/capsule-manager.js +154 -0
- package/bin/runners/lib/replay/index.js +263 -0
- package/bin/runners/lib/replay/player.js +348 -0
- package/bin/runners/lib/replay/recorder.js +331 -0
- package/bin/runners/lib/report-engine.js +447 -0
- package/bin/runners/lib/report-html.js +1117 -0
- package/bin/runners/lib/report-templates.js +964 -0
- package/bin/runners/lib/route-detection.js +1140 -0
- package/bin/runners/lib/route-truth.js +477 -0
- package/bin/runners/lib/sandbox/index.js +59 -0
- package/bin/runners/lib/sandbox/proof-chain.js +399 -0
- package/bin/runners/lib/sandbox/sandbox-runner.js +205 -0
- package/bin/runners/lib/sandbox/worktree.js +174 -0
- package/bin/runners/lib/scan-cache.js +330 -0
- package/bin/runners/lib/scan-output-schema.js +344 -0
- package/bin/runners/lib/score-history.js +282 -0
- package/bin/runners/lib/security-bridge.js +249 -0
- package/bin/runners/lib/server-usage.js +513 -0
- package/bin/runners/lib/share-pack.js +239 -0
- package/bin/runners/lib/snippets.js +67 -0
- package/bin/runners/lib/truth.js +667 -0
- package/bin/runners/lib/unified-output.js +189 -0
- package/bin/runners/lib/validate-patch.js +156 -0
- package/bin/runners/lib/verification.js +345 -0
- package/bin/runners/reality/engine.js +917 -0
- package/bin/runners/reality/flows.js +122 -0
- package/bin/runners/reality/report.js +378 -0
- package/bin/runners/reality/session.js +193 -0
- package/bin/runners/runAIAgent.js +2 -0
- package/bin/runners/runAudit.js +2 -0
- package/bin/runners/runAuth.js +106 -0
- package/bin/runners/runAutopilot.js +2 -0
- package/bin/runners/runBadge.js +2 -0
- package/bin/runners/runCertify.js +2 -0
- package/bin/runners/runClaimVerifier.js +483 -0
- package/bin/runners/runContext.js +56 -0
- package/bin/runners/runContextCompiler.js +385 -0
- package/bin/runners/runCtx.js +187 -0
- package/bin/runners/runCtxGuard.js +176 -0
- package/bin/runners/runCtxSync.js +116 -0
- package/bin/runners/runDashboard.js +10 -0
- package/bin/runners/runDoctor.js +245 -0
- package/bin/runners/runEnhancedShip.js +2 -0
- package/bin/runners/runFix.js +735 -0
- package/bin/runners/runFixPacks.js +2 -0
- package/bin/runners/runGate.js +17 -0
- package/bin/runners/runGraph.js +283 -0
- package/bin/runners/runInit.js +260 -0
- package/bin/runners/runInitGha.js +101 -0
- package/bin/runners/runInstall.js +76 -0
- package/bin/runners/runInteractive.js +388 -0
- package/bin/runners/runLaunch.js +2 -0
- package/bin/runners/runMcp.js +19 -0
- package/bin/runners/runMdc.js +2 -0
- package/bin/runners/runMissionGenerator.js +282 -0
- package/bin/runners/runNaturalLanguage.js +3 -0
- package/bin/runners/runPR.js +96 -0
- package/bin/runners/runPermissions.js +290 -0
- package/bin/runners/runPromptFirewall.js +211 -0
- package/bin/runners/runProof.js +2 -0
- package/bin/runners/runProve.js +392 -0
- package/bin/runners/runReality.js +489 -0
- package/bin/runners/runRealitySniff.js +2 -0
- package/bin/runners/runReplay.js +469 -0
- package/bin/runners/runReport.js +478 -0
- package/bin/runners/runScan.js +835 -0
- package/bin/runners/runShare.js +34 -0
- package/bin/runners/runShip.js +1062 -0
- package/bin/runners/runStatus.js +136 -0
- package/bin/runners/runTruthpack.js +634 -0
- package/bin/runners/runUpgrade.js +2 -0
- package/bin/runners/runValidate.js +2 -0
- package/bin/runners/runVerifyAgentOutput.js +2 -0
- package/bin/runners/runWatch.js +230 -0
- package/bin/runners/utils.js +360 -0
- package/bin/scan.js +612 -0
- package/bin/vibecheck.js +834 -0
- package/package.json +11 -11
- package/dist/autopatch/verified-autopatch.d.ts +0 -111
- package/dist/autopatch/verified-autopatch.d.ts.map +0 -1
- package/dist/autopatch/verified-autopatch.js +0 -503
- package/dist/autopatch/verified-autopatch.js.map +0 -1
- package/dist/bundles/index.js +0 -8
- package/dist/bundles/vibecheck-core.js +0 -25799
- package/dist/bundles/vibecheck-security.js +0 -208693
- package/dist/bundles/vibecheck-ship.js +0 -2318
- package/dist/commands/baseline.d.ts +0 -7
- package/dist/commands/baseline.d.ts.map +0 -1
- package/dist/commands/baseline.js +0 -79
- package/dist/commands/baseline.js.map +0 -1
- package/dist/commands/cache.d.ts +0 -13
- package/dist/commands/cache.d.ts.map +0 -1
- package/dist/commands/cache.js +0 -165
- package/dist/commands/cache.js.map +0 -1
- package/dist/commands/checkpoint.d.ts +0 -8
- package/dist/commands/checkpoint.d.ts.map +0 -1
- package/dist/commands/checkpoint.js +0 -35
- package/dist/commands/checkpoint.js.map +0 -1
- package/dist/commands/doctor.d.ts +0 -17
- package/dist/commands/doctor.d.ts.map +0 -1
- package/dist/commands/doctor.js +0 -226
- package/dist/commands/doctor.js.map +0 -1
- package/dist/commands/evidence.d.ts +0 -45
- package/dist/commands/evidence.d.ts.map +0 -1
- package/dist/commands/evidence.js +0 -197
- package/dist/commands/evidence.js.map +0 -1
- package/dist/commands/explain.d.ts +0 -8
- package/dist/commands/explain.d.ts.map +0 -1
- package/dist/commands/explain.js +0 -52
- package/dist/commands/explain.js.map +0 -1
- package/dist/commands/fix-consolidated.d.ts +0 -19
- package/dist/commands/fix-consolidated.d.ts.map +0 -1
- package/dist/commands/fix-consolidated.js +0 -165
- package/dist/commands/fix-consolidated.js.map +0 -1
- package/dist/commands/index.d.ts +0 -8
- package/dist/commands/index.d.ts.map +0 -1
- package/dist/commands/index.js +0 -15
- package/dist/commands/index.js.map +0 -1
- package/dist/commands/init.d.ts +0 -8
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/init.js +0 -125
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/launcher.d.ts +0 -10
- package/dist/commands/launcher.d.ts.map +0 -1
- package/dist/commands/launcher.js +0 -174
- package/dist/commands/launcher.js.map +0 -1
- package/dist/commands/on.d.ts +0 -8
- package/dist/commands/on.d.ts.map +0 -1
- package/dist/commands/on.js +0 -123
- package/dist/commands/on.js.map +0 -1
- package/dist/commands/replay.d.ts +0 -8
- package/dist/commands/replay.d.ts.map +0 -1
- package/dist/commands/replay.js +0 -52
- package/dist/commands/replay.js.map +0 -1
- package/dist/commands/scan-consolidated.d.ts +0 -61
- package/dist/commands/scan-consolidated.d.ts.map +0 -1
- package/dist/commands/scan-consolidated.js +0 -243
- package/dist/commands/scan-consolidated.js.map +0 -1
- package/dist/commands/scan-secrets.d.ts +0 -47
- package/dist/commands/scan-secrets.d.ts.map +0 -1
- package/dist/commands/scan-secrets.js +0 -225
- package/dist/commands/scan-secrets.js.map +0 -1
- package/dist/commands/scan-vulnerabilities-enhanced.d.ts +0 -41
- package/dist/commands/scan-vulnerabilities-enhanced.d.ts.map +0 -1
- package/dist/commands/scan-vulnerabilities-enhanced.js +0 -368
- package/dist/commands/scan-vulnerabilities-enhanced.js.map +0 -1
- package/dist/commands/scan-vulnerabilities-osv.d.ts +0 -58
- package/dist/commands/scan-vulnerabilities-osv.d.ts.map +0 -1
- package/dist/commands/scan-vulnerabilities-osv.js +0 -722
- package/dist/commands/scan-vulnerabilities-osv.js.map +0 -1
- package/dist/commands/scan-vulnerabilities.d.ts +0 -32
- package/dist/commands/scan-vulnerabilities.d.ts.map +0 -1
- package/dist/commands/scan-vulnerabilities.js +0 -283
- package/dist/commands/scan-vulnerabilities.js.map +0 -1
- package/dist/commands/secrets-allowlist.d.ts +0 -7
- package/dist/commands/secrets-allowlist.d.ts.map +0 -1
- package/dist/commands/secrets-allowlist.js +0 -85
- package/dist/commands/secrets-allowlist.js.map +0 -1
- package/dist/commands/ship-consolidated.d.ts +0 -58
- package/dist/commands/ship-consolidated.d.ts.map +0 -1
- package/dist/commands/ship-consolidated.js +0 -515
- package/dist/commands/ship-consolidated.js.map +0 -1
- package/dist/commands/stats.d.ts +0 -8
- package/dist/commands/stats.d.ts.map +0 -1
- package/dist/commands/stats.js +0 -134
- package/dist/commands/stats.js.map +0 -1
- package/dist/commands/upgrade.d.ts +0 -8
- package/dist/commands/upgrade.d.ts.map +0 -1
- package/dist/commands/upgrade.js +0 -30
- package/dist/commands/upgrade.js.map +0 -1
- package/dist/fix/applicator.d.ts +0 -44
- package/dist/fix/applicator.d.ts.map +0 -1
- package/dist/fix/applicator.js +0 -144
- package/dist/fix/applicator.js.map +0 -1
- package/dist/fix/backup.d.ts +0 -38
- package/dist/fix/backup.d.ts.map +0 -1
- package/dist/fix/backup.js +0 -154
- package/dist/fix/backup.js.map +0 -1
- package/dist/fix/engine.d.ts +0 -55
- package/dist/fix/engine.d.ts.map +0 -1
- package/dist/fix/engine.js +0 -285
- package/dist/fix/engine.js.map +0 -1
- package/dist/fix/index.d.ts +0 -5
- package/dist/fix/index.d.ts.map +0 -1
- package/dist/fix/index.js +0 -12
- package/dist/fix/index.js.map +0 -1
- package/dist/fix/interactive.d.ts +0 -22
- package/dist/fix/interactive.d.ts.map +0 -1
- package/dist/fix/interactive.js +0 -172
- package/dist/fix/interactive.js.map +0 -1
- package/dist/formatters/index.d.ts +0 -6
- package/dist/formatters/index.d.ts.map +0 -1
- package/dist/formatters/index.js +0 -11
- package/dist/formatters/index.js.map +0 -1
- package/dist/formatters/sarif-enhanced.d.ts +0 -78
- package/dist/formatters/sarif-enhanced.d.ts.map +0 -1
- package/dist/formatters/sarif-enhanced.js +0 -144
- package/dist/formatters/sarif-enhanced.js.map +0 -1
- package/dist/formatters/sarif-v2.d.ts +0 -121
- package/dist/formatters/sarif-v2.d.ts.map +0 -1
- package/dist/formatters/sarif-v2.js +0 -356
- package/dist/formatters/sarif-v2.js.map +0 -1
- package/dist/formatters/sarif.d.ts +0 -72
- package/dist/formatters/sarif.d.ts.map +0 -1
- package/dist/formatters/sarif.js +0 -146
- package/dist/formatters/sarif.js.map +0 -1
- package/dist/index.d.ts +0 -61
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -4388
- package/dist/index.js.map +0 -1
- package/dist/init/ci-generator.d.ts +0 -18
- package/dist/init/ci-generator.d.ts.map +0 -1
- package/dist/init/ci-generator.js +0 -317
- package/dist/init/ci-generator.js.map +0 -1
- package/dist/init/detect-framework.d.ts +0 -15
- package/dist/init/detect-framework.d.ts.map +0 -1
- package/dist/init/detect-framework.js +0 -301
- package/dist/init/detect-framework.js.map +0 -1
- package/dist/init/hooks-installer.d.ts +0 -22
- package/dist/init/hooks-installer.d.ts.map +0 -1
- package/dist/init/hooks-installer.js +0 -310
- package/dist/init/hooks-installer.js.map +0 -1
- package/dist/init/index.d.ts +0 -8
- package/dist/init/index.d.ts.map +0 -1
- package/dist/init/index.js +0 -22
- package/dist/init/index.js.map +0 -1
- package/dist/init/templates.d.ts +0 -402
- package/dist/init/templates.d.ts.map +0 -1
- package/dist/init/templates.js +0 -240
- package/dist/init/templates.js.map +0 -1
- package/dist/mcp/server.d.ts +0 -12
- package/dist/mcp/server.d.ts.map +0 -1
- package/dist/mcp/server.js +0 -42
- package/dist/mcp/server.js.map +0 -1
- package/dist/mcp/telemetry.d.ts +0 -40
- package/dist/mcp/telemetry.d.ts.map +0 -1
- package/dist/mcp/telemetry.js +0 -98
- package/dist/mcp/telemetry.js.map +0 -1
- package/dist/reality/no-dead-buttons/button-sweep-generator.d.ts +0 -32
- package/dist/reality/no-dead-buttons/button-sweep-generator.d.ts.map +0 -1
- package/dist/reality/no-dead-buttons/button-sweep-generator.js +0 -236
- package/dist/reality/no-dead-buttons/button-sweep-generator.js.map +0 -1
- package/dist/reality/no-dead-buttons/index.d.ts +0 -11
- package/dist/reality/no-dead-buttons/index.d.ts.map +0 -1
- package/dist/reality/no-dead-buttons/index.js +0 -18
- package/dist/reality/no-dead-buttons/index.js.map +0 -1
- package/dist/reality/no-dead-buttons/static-scanner.d.ts +0 -34
- package/dist/reality/no-dead-buttons/static-scanner.d.ts.map +0 -1
- package/dist/reality/no-dead-buttons/static-scanner.js +0 -230
- package/dist/reality/no-dead-buttons/static-scanner.js.map +0 -1
- package/dist/reality/reality-graph.d.ts +0 -192
- package/dist/reality/reality-graph.d.ts.map +0 -1
- package/dist/reality/reality-graph.js +0 -600
- package/dist/reality/reality-graph.js.map +0 -1
- package/dist/reality/reality-runner.d.ts +0 -89
- package/dist/reality/reality-runner.d.ts.map +0 -1
- package/dist/reality/reality-runner.js +0 -540
- package/dist/reality/reality-runner.js.map +0 -1
- package/dist/reality/receipt-generator.d.ts +0 -152
- package/dist/reality/receipt-generator.d.ts.map +0 -1
- package/dist/reality/receipt-generator.js +0 -495
- package/dist/reality/receipt-generator.js.map +0 -1
- package/dist/reality/runtime-tracer.d.ts +0 -75
- package/dist/reality/runtime-tracer.d.ts.map +0 -1
- package/dist/reality/runtime-tracer.js +0 -109
- package/dist/reality/runtime-tracer.js.map +0 -1
- package/dist/runtime/auth-utils.d.ts +0 -43
- package/dist/runtime/auth-utils.d.ts.map +0 -1
- package/dist/runtime/auth-utils.js +0 -130
- package/dist/runtime/auth-utils.js.map +0 -1
- package/dist/runtime/client.d.ts +0 -74
- package/dist/runtime/client.d.ts.map +0 -1
- package/dist/runtime/client.js +0 -222
- package/dist/runtime/client.js.map +0 -1
- package/dist/runtime/creds.d.ts +0 -48
- package/dist/runtime/creds.d.ts.map +0 -1
- package/dist/runtime/creds.js +0 -245
- package/dist/runtime/creds.js.map +0 -1
- package/dist/runtime/exit-codes.d.ts +0 -49
- package/dist/runtime/exit-codes.d.ts.map +0 -1
- package/dist/runtime/exit-codes.js +0 -93
- package/dist/runtime/exit-codes.js.map +0 -1
- package/dist/runtime/index.d.ts +0 -9
- package/dist/runtime/index.d.ts.map +0 -1
- package/dist/runtime/index.js +0 -25
- package/dist/runtime/index.js.map +0 -1
- package/dist/runtime/json-output.d.ts +0 -42
- package/dist/runtime/json-output.d.ts.map +0 -1
- package/dist/runtime/json-output.js +0 -59
- package/dist/runtime/json-output.js.map +0 -1
- package/dist/runtime/semver.d.ts +0 -37
- package/dist/runtime/semver.d.ts.map +0 -1
- package/dist/runtime/semver.js +0 -110
- package/dist/runtime/semver.js.map +0 -1
- package/dist/scan/dead-ui-detector.d.ts +0 -48
- package/dist/scan/dead-ui-detector.d.ts.map +0 -1
- package/dist/scan/dead-ui-detector.js +0 -170
- package/dist/scan/dead-ui-detector.js.map +0 -1
- package/dist/scan/playwright-sweep.d.ts +0 -40
- package/dist/scan/playwright-sweep.d.ts.map +0 -1
- package/dist/scan/playwright-sweep.js +0 -216
- package/dist/scan/playwright-sweep.js.map +0 -1
- package/dist/scan/proof-bundle.d.ts +0 -25
- package/dist/scan/proof-bundle.d.ts.map +0 -1
- package/dist/scan/proof-bundle.js +0 -203
- package/dist/scan/proof-bundle.js.map +0 -1
- package/dist/scan/proof-graph.d.ts +0 -59
- package/dist/scan/proof-graph.d.ts.map +0 -1
- package/dist/scan/proof-graph.js +0 -64
- package/dist/scan/proof-graph.js.map +0 -1
- package/dist/scan/reality-sniff.d.ts +0 -56
- package/dist/scan/reality-sniff.d.ts.map +0 -1
- package/dist/scan/reality-sniff.js +0 -200
- package/dist/scan/reality-sniff.js.map +0 -1
- package/dist/scan/structural-verifier.d.ts +0 -20
- package/dist/scan/structural-verifier.d.ts.map +0 -1
- package/dist/scan/structural-verifier.js +0 -112
- package/dist/scan/structural-verifier.js.map +0 -1
- package/dist/scan/verification-engine.d.ts +0 -47
- package/dist/scan/verification-engine.d.ts.map +0 -1
- package/dist/scan/verification-engine.js +0 -141
- package/dist/scan/verification-engine.js.map +0 -1
- package/dist/scanner/baseline.d.ts +0 -52
- package/dist/scanner/baseline.d.ts.map +0 -1
- package/dist/scanner/baseline.js +0 -85
- package/dist/scanner/baseline.js.map +0 -1
- package/dist/scanner/incremental.d.ts +0 -30
- package/dist/scanner/incremental.d.ts.map +0 -1
- package/dist/scanner/incremental.js +0 -82
- package/dist/scanner/incremental.js.map +0 -1
- package/dist/scanner/parallel.d.ts +0 -43
- package/dist/scanner/parallel.d.ts.map +0 -1
- package/dist/scanner/parallel.js +0 -99
- package/dist/scanner/parallel.js.map +0 -1
- package/dist/standalone.d.ts +0 -1
- package/dist/standalone.d.ts.map +0 -1
- package/dist/standalone.js +0 -1
- package/dist/standalone.js.map +0 -1
- package/dist/truth-pack/index.d.ts +0 -102
- package/dist/truth-pack/index.d.ts.map +0 -1
- package/dist/truth-pack/index.js +0 -694
- package/dist/truth-pack/index.js.map +0 -1
- package/dist/ui/frame.d.ts +0 -68
- package/dist/ui/frame.d.ts.map +0 -1
- package/dist/ui/frame.js +0 -165
- package/dist/ui/frame.js.map +0 -1
- package/dist/ui/index.d.ts +0 -5
- package/dist/ui/index.d.ts.map +0 -1
- package/dist/ui/index.js +0 -16
- package/dist/ui/index.js.map +0 -1
- package/dist/ui.d.ts +0 -36
- package/dist/ui.d.ts.map +0 -1
- package/dist/ui.js +0 -45
- package/dist/ui.js.map +0 -1
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DoctorService — Enterprise-Grade Environment Diagnostics
|
|
3
|
+
*
|
|
4
|
+
* Features:
|
|
5
|
+
* - Pluggable diagnostic modules
|
|
6
|
+
* - Parallel execution for independent checks
|
|
7
|
+
* - Dependency resolution between checks
|
|
8
|
+
* - Auto-fix capability
|
|
9
|
+
* - JSON/Markdown report generation
|
|
10
|
+
* - Health scoring with weighted categories
|
|
11
|
+
* - CI-friendly exit codes
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
const path = require('path');
|
|
15
|
+
const { SEVERITY, CATEGORY, CATEGORY_META } = require('./types');
|
|
16
|
+
const { getAllDiagnostics } = require('./modules');
|
|
17
|
+
const { createSummary, saveReports, generateJsonReport } = require('./reporter');
|
|
18
|
+
const { autoFixAll, getFixCommands } = require('./autofix');
|
|
19
|
+
const ui = require('./ui');
|
|
20
|
+
|
|
21
|
+
class DoctorService {
|
|
22
|
+
constructor(projectPath, options = {}) {
|
|
23
|
+
this.projectPath = path.resolve(projectPath);
|
|
24
|
+
this.options = {
|
|
25
|
+
json: false,
|
|
26
|
+
markdown: false,
|
|
27
|
+
fix: false,
|
|
28
|
+
fixDryRun: false,
|
|
29
|
+
quiet: false,
|
|
30
|
+
verbose: false,
|
|
31
|
+
categories: null, // null = all categories
|
|
32
|
+
skipNetwork: false,
|
|
33
|
+
saveReport: true,
|
|
34
|
+
...options,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
this.diagnostics = [];
|
|
38
|
+
this.results = [];
|
|
39
|
+
this.startTime = null;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async run() {
|
|
43
|
+
this.startTime = Date.now();
|
|
44
|
+
|
|
45
|
+
// Load diagnostics
|
|
46
|
+
this.diagnostics = this.loadDiagnostics();
|
|
47
|
+
|
|
48
|
+
// Filter by category if specified
|
|
49
|
+
if (this.options.categories) {
|
|
50
|
+
this.diagnostics = this.diagnostics.filter(d =>
|
|
51
|
+
this.options.categories.includes(d.category)
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Skip network if requested
|
|
56
|
+
if (this.options.skipNetwork) {
|
|
57
|
+
this.diagnostics = this.diagnostics.filter(d => d.category !== CATEGORY.NETWORK);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Print header (unless quiet or json)
|
|
61
|
+
if (!this.options.quiet && !this.options.json) {
|
|
62
|
+
ui.printHeader();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Run diagnostics
|
|
66
|
+
await this.runDiagnostics();
|
|
67
|
+
|
|
68
|
+
// Calculate summary
|
|
69
|
+
const durationMs = Date.now() - this.startTime;
|
|
70
|
+
const summary = createSummary(this.results);
|
|
71
|
+
|
|
72
|
+
// Output results
|
|
73
|
+
if (this.options.json) {
|
|
74
|
+
// JSON output only
|
|
75
|
+
const report = generateJsonReport(this.results, this.projectPath, durationMs);
|
|
76
|
+
console.log(JSON.stringify(report, null, 2));
|
|
77
|
+
} else if (!this.options.quiet) {
|
|
78
|
+
// Print issues and summary
|
|
79
|
+
ui.printIssuesSummary(this.results);
|
|
80
|
+
ui.printFinalSummary(summary, durationMs);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Save reports
|
|
84
|
+
if (this.options.saveReport && !this.options.json) {
|
|
85
|
+
const outputDir = path.join(this.projectPath, '.vibecheck');
|
|
86
|
+
try {
|
|
87
|
+
const paths = saveReports(this.results, this.projectPath, durationMs, outputDir);
|
|
88
|
+
if (this.options.verbose) {
|
|
89
|
+
console.log(`${ui.c.dim}Reports saved to:${ui.c.reset}`);
|
|
90
|
+
console.log(` ${ui.c.dim}${paths.lastJson}${ui.c.reset}`);
|
|
91
|
+
console.log(` ${ui.c.dim}${paths.lastMd}${ui.c.reset}`);
|
|
92
|
+
}
|
|
93
|
+
} catch (err) {
|
|
94
|
+
if (this.options.verbose) {
|
|
95
|
+
console.log(`${ui.c.dim}Could not save reports: ${err.message}${ui.c.reset}`);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Auto-fix if requested
|
|
101
|
+
if (this.options.fix) {
|
|
102
|
+
const fixResults = await autoFixAll(this.results, this.projectPath, {
|
|
103
|
+
dryRun: this.options.fixDryRun,
|
|
104
|
+
severity: [SEVERITY.CRITICAL, SEVERITY.ERROR],
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
if (!this.options.quiet && !this.options.json) {
|
|
108
|
+
ui.printAutoFixResults(fixResults);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Re-run affected checks after fixing
|
|
112
|
+
if (fixResults.succeeded > 0 && !this.options.fixDryRun) {
|
|
113
|
+
if (!this.options.quiet && !this.options.json) {
|
|
114
|
+
console.log(`${ui.c.cyan}Re-running diagnostics after fixes...${ui.c.reset}\n`);
|
|
115
|
+
}
|
|
116
|
+
return this.run();
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Return exit code
|
|
121
|
+
if (summary.critical > 0) return 3;
|
|
122
|
+
if (summary.errors > 0) return 1;
|
|
123
|
+
if (summary.warnings > 0 && this.options.failOnWarn) return 2;
|
|
124
|
+
return 0;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
loadDiagnostics() {
|
|
128
|
+
return getAllDiagnostics(this.projectPath);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
async runDiagnostics() {
|
|
132
|
+
// Group by category for display
|
|
133
|
+
const byCategory = {};
|
|
134
|
+
for (const d of this.diagnostics) {
|
|
135
|
+
if (!byCategory[d.category]) byCategory[d.category] = [];
|
|
136
|
+
byCategory[d.category].push(d);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// Sort categories
|
|
140
|
+
const sortedCategories = Object.keys(byCategory).sort((a, b) => {
|
|
141
|
+
const orderA = CATEGORY_META[a]?.order || 99;
|
|
142
|
+
const orderB = CATEGORY_META[b]?.order || 99;
|
|
143
|
+
return orderA - orderB;
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
// Track completed diagnostic IDs for dependency resolution
|
|
147
|
+
const completed = new Set();
|
|
148
|
+
const resultMap = new Map();
|
|
149
|
+
|
|
150
|
+
for (const category of sortedCategories) {
|
|
151
|
+
const categoryDiagnostics = byCategory[category];
|
|
152
|
+
|
|
153
|
+
if (!this.options.quiet && !this.options.json) {
|
|
154
|
+
ui.printCategoryHeader(category);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// Separate parallel and sequential diagnostics
|
|
158
|
+
const parallel = categoryDiagnostics.filter(d => d.parallel && !d.dependsOn?.length);
|
|
159
|
+
const sequential = categoryDiagnostics.filter(d => !d.parallel || d.dependsOn?.length);
|
|
160
|
+
|
|
161
|
+
// Run parallel diagnostics
|
|
162
|
+
if (parallel.length > 0) {
|
|
163
|
+
const parallelPromises = parallel.map(d => this.runSingleDiagnostic(d));
|
|
164
|
+
const parallelResults = await Promise.all(parallelPromises);
|
|
165
|
+
|
|
166
|
+
for (let i = 0; i < parallel.length; i++) {
|
|
167
|
+
const diagnostic = parallel[i];
|
|
168
|
+
const result = parallelResults[i];
|
|
169
|
+
|
|
170
|
+
this.results.push(result);
|
|
171
|
+
completed.add(diagnostic.id);
|
|
172
|
+
resultMap.set(diagnostic.id, result);
|
|
173
|
+
|
|
174
|
+
if (!this.options.quiet && !this.options.json) {
|
|
175
|
+
ui.printDiagnostic(result, { showFixes: this.options.verbose });
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// Run sequential diagnostics (respecting dependencies)
|
|
181
|
+
for (const diagnostic of sequential) {
|
|
182
|
+
// Check dependencies
|
|
183
|
+
if (diagnostic.dependsOn) {
|
|
184
|
+
const unmetDeps = diagnostic.dependsOn.filter(dep => !completed.has(dep));
|
|
185
|
+
if (unmetDeps.length > 0) {
|
|
186
|
+
// Skip if dependencies not met
|
|
187
|
+
const skipResult = {
|
|
188
|
+
...diagnostic,
|
|
189
|
+
severity: SEVERITY.INFO,
|
|
190
|
+
message: `Skipped (depends on: ${unmetDeps.join(', ')})`,
|
|
191
|
+
durationMs: 0,
|
|
192
|
+
};
|
|
193
|
+
this.results.push(skipResult);
|
|
194
|
+
if (!this.options.quiet && !this.options.json) {
|
|
195
|
+
ui.printDiagnostic(skipResult);
|
|
196
|
+
}
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
const result = await this.runSingleDiagnostic(diagnostic);
|
|
202
|
+
this.results.push(result);
|
|
203
|
+
completed.add(diagnostic.id);
|
|
204
|
+
resultMap.set(diagnostic.id, result);
|
|
205
|
+
|
|
206
|
+
if (!this.options.quiet && !this.options.json) {
|
|
207
|
+
ui.printDiagnostic(result, { showFixes: this.options.verbose });
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
if (!this.options.quiet && !this.options.json) {
|
|
212
|
+
console.log('');
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
async runSingleDiagnostic(diagnostic) {
|
|
218
|
+
const startTime = Date.now();
|
|
219
|
+
|
|
220
|
+
try {
|
|
221
|
+
const checkResult = await diagnostic.check();
|
|
222
|
+
const durationMs = Date.now() - startTime;
|
|
223
|
+
|
|
224
|
+
return {
|
|
225
|
+
id: diagnostic.id,
|
|
226
|
+
name: diagnostic.name,
|
|
227
|
+
category: diagnostic.category,
|
|
228
|
+
severity: checkResult.severity || SEVERITY.PASS,
|
|
229
|
+
message: checkResult.message || 'OK',
|
|
230
|
+
detail: checkResult.detail,
|
|
231
|
+
durationMs,
|
|
232
|
+
fixes: checkResult.fixes,
|
|
233
|
+
metadata: checkResult.metadata,
|
|
234
|
+
};
|
|
235
|
+
} catch (err) {
|
|
236
|
+
const durationMs = Date.now() - startTime;
|
|
237
|
+
|
|
238
|
+
return {
|
|
239
|
+
id: diagnostic.id,
|
|
240
|
+
name: diagnostic.name,
|
|
241
|
+
category: diagnostic.category,
|
|
242
|
+
severity: SEVERITY.ERROR,
|
|
243
|
+
message: `Check failed: ${err.message}`,
|
|
244
|
+
durationMs,
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
getFixCommands() {
|
|
250
|
+
return getFixCommands(this.results);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
async function diagnose(projectPath, options = {}) {
|
|
255
|
+
const service = new DoctorService(projectPath, options);
|
|
256
|
+
return service.run();
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
module.exports = {
|
|
260
|
+
DoctorService,
|
|
261
|
+
diagnose,
|
|
262
|
+
};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Doctor Service Types
|
|
3
|
+
*
|
|
4
|
+
* Enterprise-grade diagnostic types and constants
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const SEVERITY = {
|
|
8
|
+
CRITICAL: 'critical', // Blocks all operations
|
|
9
|
+
ERROR: 'error', // Must fix before using vibecheck
|
|
10
|
+
WARNING: 'warning', // Recommended to fix
|
|
11
|
+
INFO: 'info', // Informational
|
|
12
|
+
PASS: 'pass', // Check passed
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const SEVERITY_WEIGHT = {
|
|
16
|
+
[SEVERITY.CRITICAL]: 0,
|
|
17
|
+
[SEVERITY.ERROR]: 0.25,
|
|
18
|
+
[SEVERITY.WARNING]: 0.75,
|
|
19
|
+
[SEVERITY.INFO]: 1,
|
|
20
|
+
[SEVERITY.PASS]: 1,
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const CATEGORY = {
|
|
24
|
+
SYSTEM: 'system',
|
|
25
|
+
RUNTIME: 'runtime',
|
|
26
|
+
PROJECT: 'project',
|
|
27
|
+
SECURITY: 'security',
|
|
28
|
+
NETWORK: 'network',
|
|
29
|
+
DEPENDENCIES: 'dependencies',
|
|
30
|
+
VIBECHECK: 'vibecheck',
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const CATEGORY_META = {
|
|
34
|
+
[CATEGORY.SYSTEM]: { name: 'System', icon: '💻', order: 1 },
|
|
35
|
+
[CATEGORY.RUNTIME]: { name: 'Runtime', icon: '🟢', order: 2 },
|
|
36
|
+
[CATEGORY.PROJECT]: { name: 'Project', icon: '📁', order: 3 },
|
|
37
|
+
[CATEGORY.DEPENDENCIES]: { name: 'Dependencies', icon: '📦', order: 4 },
|
|
38
|
+
[CATEGORY.SECURITY]: { name: 'Security', icon: '🔐', order: 5 },
|
|
39
|
+
[CATEGORY.NETWORK]: { name: 'Network', icon: '🌐', order: 6 },
|
|
40
|
+
[CATEGORY.VIBECHECK]: { name: 'Vibecheck', icon: '⚡', order: 7 },
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const FIX_TYPE = {
|
|
44
|
+
COMMAND: 'command', // Run a shell command
|
|
45
|
+
FILE_CREATE: 'file_create',
|
|
46
|
+
FILE_EDIT: 'file_edit',
|
|
47
|
+
MANUAL: 'manual', // User must do manually
|
|
48
|
+
LINK: 'link', // External documentation
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* @typedef {Object} DiagnosticResult
|
|
53
|
+
* @property {string} id - Unique diagnostic ID
|
|
54
|
+
* @property {string} name - Human readable name
|
|
55
|
+
* @property {string} category - Category from CATEGORY enum
|
|
56
|
+
* @property {string} severity - Severity from SEVERITY enum
|
|
57
|
+
* @property {string} message - Short status message
|
|
58
|
+
* @property {string} [detail] - Additional detail
|
|
59
|
+
* @property {number} durationMs - Time taken in milliseconds
|
|
60
|
+
* @property {Fix[]} [fixes] - Available fixes
|
|
61
|
+
* @property {Object} [metadata] - Additional diagnostic data
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* @typedef {Object} Fix
|
|
66
|
+
* @property {string} type - Fix type from FIX_TYPE enum
|
|
67
|
+
* @property {string} description - What the fix does
|
|
68
|
+
* @property {string} [command] - Command to run (for COMMAND type)
|
|
69
|
+
* @property {string} [path] - File path (for FILE_* types)
|
|
70
|
+
* @property {string} [content] - Content (for FILE_CREATE/EDIT)
|
|
71
|
+
* @property {string} [url] - URL (for LINK type)
|
|
72
|
+
* @property {boolean} [dangerous] - Requires confirmation
|
|
73
|
+
* @property {boolean} [autoFixable] - Can be auto-fixed
|
|
74
|
+
*/
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* @typedef {Object} DiagnosticModule
|
|
78
|
+
* @property {string} id - Module ID
|
|
79
|
+
* @property {string} name - Module name
|
|
80
|
+
* @property {string} category - Category
|
|
81
|
+
* @property {function} check - Async check function
|
|
82
|
+
* @property {boolean} [parallel] - Can run in parallel
|
|
83
|
+
* @property {string[]} [dependsOn] - IDs this module depends on
|
|
84
|
+
*/
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* @typedef {Object} DoctorReport
|
|
88
|
+
* @property {string} version - Report format version
|
|
89
|
+
* @property {string} timestamp - ISO timestamp
|
|
90
|
+
* @property {number} durationMs - Total duration
|
|
91
|
+
* @property {string} projectPath - Scanned project
|
|
92
|
+
* @property {DiagnosticResult[]} diagnostics - All results
|
|
93
|
+
* @property {Summary} summary - Summary stats
|
|
94
|
+
*/
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* @typedef {Object} Summary
|
|
98
|
+
* @property {number} total - Total checks
|
|
99
|
+
* @property {number} passed - Passed checks
|
|
100
|
+
* @property {number} warnings - Warning count
|
|
101
|
+
* @property {number} errors - Error count
|
|
102
|
+
* @property {number} critical - Critical count
|
|
103
|
+
* @property {number} healthScore - 0-100 score
|
|
104
|
+
* @property {string} verdict - HEALTHY | DEGRADED | UNHEALTHY | CRITICAL
|
|
105
|
+
*/
|
|
106
|
+
|
|
107
|
+
module.exports = {
|
|
108
|
+
SEVERITY,
|
|
109
|
+
SEVERITY_WEIGHT,
|
|
110
|
+
CATEGORY,
|
|
111
|
+
CATEGORY_META,
|
|
112
|
+
FIX_TYPE,
|
|
113
|
+
};
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Doctor CLI UI Components
|
|
3
|
+
*
|
|
4
|
+
* Beautiful terminal output for the Doctor service
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const { SEVERITY, CATEGORY_META } = require('./types');
|
|
8
|
+
|
|
9
|
+
// ANSI color codes
|
|
10
|
+
const c = {
|
|
11
|
+
reset: '\x1b[0m',
|
|
12
|
+
bold: '\x1b[1m',
|
|
13
|
+
dim: '\x1b[2m',
|
|
14
|
+
italic: '\x1b[3m',
|
|
15
|
+
underline: '\x1b[4m',
|
|
16
|
+
|
|
17
|
+
black: '\x1b[30m',
|
|
18
|
+
red: '\x1b[31m',
|
|
19
|
+
green: '\x1b[32m',
|
|
20
|
+
yellow: '\x1b[33m',
|
|
21
|
+
blue: '\x1b[34m',
|
|
22
|
+
magenta: '\x1b[35m',
|
|
23
|
+
cyan: '\x1b[36m',
|
|
24
|
+
white: '\x1b[37m',
|
|
25
|
+
|
|
26
|
+
bgRed: '\x1b[41m',
|
|
27
|
+
bgGreen: '\x1b[42m',
|
|
28
|
+
bgYellow: '\x1b[43m',
|
|
29
|
+
bgBlue: '\x1b[44m',
|
|
30
|
+
bgMagenta: '\x1b[45m',
|
|
31
|
+
bgCyan: '\x1b[46m',
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const SEVERITY_CONFIG = {
|
|
35
|
+
[SEVERITY.PASS]: { icon: '✓', color: c.green, label: 'PASS' },
|
|
36
|
+
[SEVERITY.INFO]: { icon: 'ℹ', color: c.blue, label: 'INFO' },
|
|
37
|
+
[SEVERITY.WARNING]: { icon: '!', color: c.yellow, label: 'WARN' },
|
|
38
|
+
[SEVERITY.ERROR]: { icon: '✗', color: c.red, label: 'ERROR' },
|
|
39
|
+
[SEVERITY.CRITICAL]: { icon: '⛔', color: `${c.bgRed}${c.white}`, label: 'CRIT' },
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const BOX_CHARS = {
|
|
43
|
+
topLeft: '╔',
|
|
44
|
+
topRight: '╗',
|
|
45
|
+
bottomLeft: '╚',
|
|
46
|
+
bottomRight: '╝',
|
|
47
|
+
horizontal: '═',
|
|
48
|
+
vertical: '║',
|
|
49
|
+
lightHorizontal: '─',
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
function box(width = 74) {
|
|
53
|
+
return {
|
|
54
|
+
top: `${c.cyan}${BOX_CHARS.topLeft}${BOX_CHARS.horizontal.repeat(width)}${BOX_CHARS.topRight}${c.reset}`,
|
|
55
|
+
bottom: `${c.cyan}${BOX_CHARS.bottomLeft}${BOX_CHARS.horizontal.repeat(width)}${BOX_CHARS.bottomRight}${c.reset}`,
|
|
56
|
+
line: (content, align = 'left') => {
|
|
57
|
+
const stripped = stripAnsi(content);
|
|
58
|
+
const padding = width - stripped.length;
|
|
59
|
+
const left = align === 'center' ? Math.floor(padding / 2) : 0;
|
|
60
|
+
const right = padding - left;
|
|
61
|
+
return `${c.cyan}${BOX_CHARS.vertical}${c.reset}${' '.repeat(left)}${content}${' '.repeat(right)}${c.cyan}${BOX_CHARS.vertical}${c.reset}`;
|
|
62
|
+
},
|
|
63
|
+
empty: `${c.cyan}${BOX_CHARS.vertical}${c.reset}${' '.repeat(width)}${c.cyan}${BOX_CHARS.vertical}${c.reset}`,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function stripAnsi(str) {
|
|
68
|
+
return str.replace(/\x1b\[[0-9;]*m/g, '');
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function printHeader() {
|
|
72
|
+
const b = box();
|
|
73
|
+
console.log('');
|
|
74
|
+
console.log(b.top);
|
|
75
|
+
console.log(b.empty);
|
|
76
|
+
console.log(b.line(`${c.bold}🩺 VIBECHECK DOCTOR${c.reset}`, 'center'));
|
|
77
|
+
console.log(b.line(`${c.dim}Enterprise Environment Diagnostics${c.reset}`, 'center'));
|
|
78
|
+
console.log(b.empty);
|
|
79
|
+
console.log(b.bottom);
|
|
80
|
+
console.log('');
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function printCategoryHeader(category) {
|
|
84
|
+
const meta = CATEGORY_META[category] || { name: category, icon: '📋' };
|
|
85
|
+
console.log(`${c.cyan}${meta.icon} ${c.bold}${meta.name}${c.reset}`);
|
|
86
|
+
console.log(`${c.dim}${BOX_CHARS.lightHorizontal.repeat(50)}${c.reset}`);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function printDiagnostic(diagnostic, options = {}) {
|
|
90
|
+
const { showDetail = true, showFixes = true, indent = ' ' } = options;
|
|
91
|
+
const config = SEVERITY_CONFIG[diagnostic.severity] || SEVERITY_CONFIG[SEVERITY.INFO];
|
|
92
|
+
|
|
93
|
+
// Main line
|
|
94
|
+
console.log(`${indent}${config.color}${config.icon}${c.reset} ${diagnostic.message}`);
|
|
95
|
+
|
|
96
|
+
// Detail
|
|
97
|
+
if (showDetail && diagnostic.detail) {
|
|
98
|
+
console.log(`${indent} ${c.dim}${diagnostic.detail}${c.reset}`);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// First fix hint
|
|
102
|
+
if (showFixes && diagnostic.fixes && diagnostic.fixes.length > 0) {
|
|
103
|
+
const fix = diagnostic.fixes[0];
|
|
104
|
+
if (fix.command) {
|
|
105
|
+
console.log(`${indent} ${c.cyan}→ ${fix.command}${c.reset}`);
|
|
106
|
+
} else if (fix.url) {
|
|
107
|
+
console.log(`${indent} ${c.cyan}→ ${fix.url}${c.reset}`);
|
|
108
|
+
} else if (fix.description) {
|
|
109
|
+
console.log(`${indent} ${c.cyan}→ ${fix.description}${c.reset}`);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function printProgress(name, total, current) {
|
|
115
|
+
const percent = Math.round((current / total) * 100);
|
|
116
|
+
const barWidth = 20;
|
|
117
|
+
const filled = Math.round((current / total) * barWidth);
|
|
118
|
+
const bar = '█'.repeat(filled) + '░'.repeat(barWidth - filled);
|
|
119
|
+
|
|
120
|
+
process.stdout.write(`\r${c.dim}${name}${c.reset} [${c.cyan}${bar}${c.reset}] ${percent}%`);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function clearProgress() {
|
|
124
|
+
process.stdout.write('\r' + ' '.repeat(60) + '\r');
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function printSpinner(message, frame = 0) {
|
|
128
|
+
const frames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
|
129
|
+
process.stdout.write(`\r${c.cyan}${frames[frame % frames.length]}${c.reset} ${message}`);
|
|
130
|
+
return (frame + 1) % frames.length;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function printIssuesSummary(diagnostics) {
|
|
134
|
+
const critical = diagnostics.filter(d => d.severity === SEVERITY.CRITICAL);
|
|
135
|
+
const errors = diagnostics.filter(d => d.severity === SEVERITY.ERROR);
|
|
136
|
+
const warnings = diagnostics.filter(d => d.severity === SEVERITY.WARNING);
|
|
137
|
+
|
|
138
|
+
if (critical.length === 0 && errors.length === 0 && warnings.length === 0) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const b = box();
|
|
143
|
+
console.log(b.top);
|
|
144
|
+
console.log(b.line(`${c.bold}ISSUES FOUND${c.reset}`));
|
|
145
|
+
console.log(b.bottom);
|
|
146
|
+
console.log('');
|
|
147
|
+
|
|
148
|
+
if (critical.length > 0) {
|
|
149
|
+
console.log(`${c.bgRed}${c.white}${c.bold} CRITICAL (${critical.length}) ${c.reset} — Must fix immediately\n`);
|
|
150
|
+
for (const d of critical) {
|
|
151
|
+
console.log(` ${c.red}●${c.reset} ${c.bold}${d.name}${c.reset}`);
|
|
152
|
+
console.log(` ${c.dim}${d.message}${c.reset}`);
|
|
153
|
+
if (d.fixes?.[0]?.command) {
|
|
154
|
+
console.log(` ${c.cyan}→ ${d.fixes[0].command}${c.reset}`);
|
|
155
|
+
}
|
|
156
|
+
console.log('');
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
if (errors.length > 0) {
|
|
161
|
+
console.log(`${c.red}${c.bold}❌ ERRORS (${errors.length})${c.reset} — Must fix before using vibecheck\n`);
|
|
162
|
+
for (const d of errors) {
|
|
163
|
+
console.log(` ${c.red}●${c.reset} ${c.bold}${d.name}${c.reset}`);
|
|
164
|
+
console.log(` ${c.dim}${d.message}${c.reset}`);
|
|
165
|
+
if (d.fixes?.[0]?.command) {
|
|
166
|
+
console.log(` ${c.cyan}→ ${d.fixes[0].command}${c.reset}`);
|
|
167
|
+
}
|
|
168
|
+
console.log('');
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
if (warnings.length > 0) {
|
|
173
|
+
console.log(`${c.yellow}${c.bold}⚠️ WARNINGS (${warnings.length})${c.reset} — Recommended fixes\n`);
|
|
174
|
+
for (const d of warnings) {
|
|
175
|
+
console.log(` ${c.yellow}●${c.reset} ${c.bold}${d.name}${c.reset}`);
|
|
176
|
+
console.log(` ${c.dim}${d.message}${c.reset}`);
|
|
177
|
+
if (d.fixes?.[0]?.command) {
|
|
178
|
+
console.log(` ${c.cyan}→ ${d.fixes[0].command}${c.reset}`);
|
|
179
|
+
}
|
|
180
|
+
console.log('');
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function printFinalSummary(summary, durationMs) {
|
|
186
|
+
const b = box();
|
|
187
|
+
|
|
188
|
+
const healthColor = summary.healthScore >= 80 ? c.green
|
|
189
|
+
: summary.healthScore >= 60 ? c.yellow
|
|
190
|
+
: c.red;
|
|
191
|
+
const healthIcon = summary.healthScore >= 80 ? '💚'
|
|
192
|
+
: summary.healthScore >= 60 ? '💛'
|
|
193
|
+
: '❤️';
|
|
194
|
+
|
|
195
|
+
const verdictColor = {
|
|
196
|
+
HEALTHY: c.green,
|
|
197
|
+
DEGRADED: c.yellow,
|
|
198
|
+
UNHEALTHY: c.red,
|
|
199
|
+
CRITICAL: `${c.bgRed}${c.white}`,
|
|
200
|
+
}[summary.verdict] || c.white;
|
|
201
|
+
|
|
202
|
+
console.log(b.top);
|
|
203
|
+
console.log(b.empty);
|
|
204
|
+
console.log(b.line(`${healthIcon} ${c.bold}Health Score: ${healthColor}${summary.healthScore}%${c.reset}`));
|
|
205
|
+
console.log(b.line(` ${c.bold}Verdict: ${verdictColor}${summary.verdict}${c.reset}`));
|
|
206
|
+
console.log(b.empty);
|
|
207
|
+
console.log(b.line(`${c.green}✓ ${summary.passed} passed${c.reset} ${c.blue}ℹ ${summary.info} info${c.reset} ${c.yellow}! ${summary.warnings} warnings${c.reset} ${c.red}✗ ${summary.errors} errors${c.reset} ${summary.critical > 0 ? `${c.bgRed}${c.white}⛔ ${summary.critical}${c.reset}` : ''}`));
|
|
208
|
+
console.log(b.line(`${c.dim}Completed ${summary.total} checks in ${(durationMs / 1000).toFixed(1)}s${c.reset}`));
|
|
209
|
+
console.log(b.empty);
|
|
210
|
+
console.log(b.bottom);
|
|
211
|
+
console.log('');
|
|
212
|
+
|
|
213
|
+
// Final message
|
|
214
|
+
if (summary.critical > 0) {
|
|
215
|
+
console.log(`${c.bgRed}${c.white}${c.bold} ⛔ CRITICAL ISSUES DETECTED ${c.reset}`);
|
|
216
|
+
console.log(`${c.red}Fix critical issues immediately before proceeding.${c.reset}\n`);
|
|
217
|
+
} else if (summary.errors > 0) {
|
|
218
|
+
console.log(`${c.red}${c.bold}⚠ Fix the errors above before running vibecheck.${c.reset}\n`);
|
|
219
|
+
} else if (summary.warnings > 0) {
|
|
220
|
+
console.log(`${c.yellow}Your environment is ready, but consider fixing the warnings.${c.reset}\n`);
|
|
221
|
+
} else {
|
|
222
|
+
console.log(`${c.green}${c.bold}✓ Your environment is perfectly configured!${c.reset}\n`);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
function printAutoFixResults(results) {
|
|
227
|
+
console.log('');
|
|
228
|
+
console.log(`${c.cyan}${c.bold}🔧 Auto-Fix Results${c.reset}`);
|
|
229
|
+
console.log(`${c.dim}${BOX_CHARS.lightHorizontal.repeat(50)}${c.reset}`);
|
|
230
|
+
|
|
231
|
+
console.log(` Attempted: ${results.attempted}`);
|
|
232
|
+
console.log(` ${c.green}Succeeded: ${results.succeeded}${c.reset}`);
|
|
233
|
+
console.log(` ${c.red}Failed: ${results.failed}${c.reset}`);
|
|
234
|
+
console.log(` ${c.dim}Skipped: ${results.skipped}${c.reset}`);
|
|
235
|
+
console.log('');
|
|
236
|
+
|
|
237
|
+
for (const r of results.results) {
|
|
238
|
+
const icon = r.status === 'success' ? `${c.green}✓${c.reset}`
|
|
239
|
+
: r.status === 'failed' ? `${c.red}✗${c.reset}`
|
|
240
|
+
: `${c.dim}○${c.reset}`;
|
|
241
|
+
console.log(` ${icon} ${r.diagnosticName}: ${r.status}`);
|
|
242
|
+
if (r.error) {
|
|
243
|
+
console.log(` ${c.dim}${r.error}${c.reset}`);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
console.log('');
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
module.exports = {
|
|
250
|
+
c,
|
|
251
|
+
SEVERITY_CONFIG,
|
|
252
|
+
box,
|
|
253
|
+
stripAnsi,
|
|
254
|
+
printHeader,
|
|
255
|
+
printCategoryHeader,
|
|
256
|
+
printDiagnostic,
|
|
257
|
+
printProgress,
|
|
258
|
+
clearProgress,
|
|
259
|
+
printSpinner,
|
|
260
|
+
printIssuesSummary,
|
|
261
|
+
printFinalSummary,
|
|
262
|
+
printAutoFixResults,
|
|
263
|
+
};
|