@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,513 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Server-Authoritative Usage Enforcement (CLI Client)
|
|
3
|
+
*
|
|
4
|
+
* This module handles server-side usage checks and enforcement.
|
|
5
|
+
* Local ~/.vibecheck/usage.json is ONLY a cache - never authoritative.
|
|
6
|
+
*
|
|
7
|
+
* Flow:
|
|
8
|
+
* 1. Check server for usage limits before any quota-limited action
|
|
9
|
+
* 2. If online: server is source of truth
|
|
10
|
+
* 3. If offline: allow 1 action max, require sync next time
|
|
11
|
+
* 4. Cache signed tokens locally for optimization (short TTL)
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
const fs = require('fs');
|
|
15
|
+
const path = require('path');
|
|
16
|
+
const os = require('os');
|
|
17
|
+
const crypto = require('crypto');
|
|
18
|
+
|
|
19
|
+
// ============================================================================
|
|
20
|
+
// CONFIGURATION
|
|
21
|
+
// ============================================================================
|
|
22
|
+
|
|
23
|
+
const CONFIG_DIR = path.join(os.homedir(), '.vibecheck');
|
|
24
|
+
const CACHE_FILE = path.join(CONFIG_DIR, 'usage-cache.json');
|
|
25
|
+
const OFFLINE_FILE = path.join(CONFIG_DIR, 'offline-queue.json');
|
|
26
|
+
|
|
27
|
+
const API_BASE_URL = process.env.VIBECHECK_API_URL || 'https://api.vibecheckai.dev';
|
|
28
|
+
const USAGE_API_PATH = '/api/usage/v2';
|
|
29
|
+
|
|
30
|
+
const OFFLINE_ALLOWANCE = 1; // Max offline actions before sync required
|
|
31
|
+
const TOKEN_GRACE_PERIOD_MS = 30000; // 30 seconds grace period for token expiry
|
|
32
|
+
|
|
33
|
+
// ============================================================================
|
|
34
|
+
// HELPERS
|
|
35
|
+
// ============================================================================
|
|
36
|
+
|
|
37
|
+
async function ensureConfigDir() {
|
|
38
|
+
try {
|
|
39
|
+
await fs.promises.mkdir(CONFIG_DIR, { recursive: true });
|
|
40
|
+
} catch {
|
|
41
|
+
// Directory exists
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function getAuthToken() {
|
|
46
|
+
// Check environment variable first
|
|
47
|
+
if (process.env.VIBECHECK_API_KEY) {
|
|
48
|
+
return process.env.VIBECHECK_API_KEY;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Check license file
|
|
52
|
+
try {
|
|
53
|
+
const licensePath = path.join(CONFIG_DIR, 'license.json');
|
|
54
|
+
const license = JSON.parse(fs.readFileSync(licensePath, 'utf8'));
|
|
55
|
+
return license.apiKey || license.token;
|
|
56
|
+
} catch {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function getMachineId() {
|
|
62
|
+
// Generate a stable machine identifier
|
|
63
|
+
const hostname = os.hostname();
|
|
64
|
+
const platform = os.platform();
|
|
65
|
+
const arch = os.arch();
|
|
66
|
+
const hash = crypto.createHash('sha256');
|
|
67
|
+
hash.update(`${hostname}-${platform}-${arch}`);
|
|
68
|
+
return hash.digest('hex').substring(0, 16);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// ============================================================================
|
|
72
|
+
// CACHE MANAGEMENT
|
|
73
|
+
// ============================================================================
|
|
74
|
+
|
|
75
|
+
async function readCache() {
|
|
76
|
+
try {
|
|
77
|
+
const content = await fs.promises.readFile(CACHE_FILE, 'utf8');
|
|
78
|
+
return JSON.parse(content);
|
|
79
|
+
} catch {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
async function writeCache(data) {
|
|
85
|
+
await ensureConfigDir();
|
|
86
|
+
await fs.promises.writeFile(CACHE_FILE, JSON.stringify(data, null, 2));
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
async function readOfflineQueue() {
|
|
90
|
+
try {
|
|
91
|
+
const content = await fs.promises.readFile(OFFLINE_FILE, 'utf8');
|
|
92
|
+
return JSON.parse(content);
|
|
93
|
+
} catch {
|
|
94
|
+
return { queue: [], lastSync: null };
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
async function writeOfflineQueue(data) {
|
|
99
|
+
await ensureConfigDir();
|
|
100
|
+
await fs.promises.writeFile(OFFLINE_FILE, JSON.stringify(data, null, 2));
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// ============================================================================
|
|
104
|
+
// API CLIENT
|
|
105
|
+
// ============================================================================
|
|
106
|
+
|
|
107
|
+
async function apiRequest(endpoint, method = 'GET', body = null) {
|
|
108
|
+
const token = getAuthToken();
|
|
109
|
+
if (!token) {
|
|
110
|
+
return { success: false, error: 'No API key configured', offline: true };
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const url = `${API_BASE_URL}${USAGE_API_PATH}${endpoint}`;
|
|
114
|
+
const options = {
|
|
115
|
+
method,
|
|
116
|
+
headers: {
|
|
117
|
+
'Authorization': `Bearer ${token}`,
|
|
118
|
+
'Content-Type': 'application/json',
|
|
119
|
+
'X-Machine-Id': getMachineId(),
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
if (body) {
|
|
124
|
+
options.body = JSON.stringify(body);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
try {
|
|
128
|
+
const response = await fetch(url, options);
|
|
129
|
+
const data = await response.json();
|
|
130
|
+
|
|
131
|
+
if (!response.ok) {
|
|
132
|
+
return {
|
|
133
|
+
success: false,
|
|
134
|
+
error: data.error || `HTTP ${response.status}`,
|
|
135
|
+
code: data.code,
|
|
136
|
+
offline: false,
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
return { success: true, ...data, offline: false };
|
|
141
|
+
} catch (error) {
|
|
142
|
+
// Network error - we're offline
|
|
143
|
+
return {
|
|
144
|
+
success: false,
|
|
145
|
+
error: error.message,
|
|
146
|
+
offline: true,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// ============================================================================
|
|
152
|
+
// SERVER-AUTHORITATIVE USAGE ENFORCEMENT
|
|
153
|
+
// ============================================================================
|
|
154
|
+
|
|
155
|
+
class ServerUsageEnforcement {
|
|
156
|
+
/**
|
|
157
|
+
* Check if an action is allowed (server-authoritative)
|
|
158
|
+
* This does NOT increment usage - use recordUsage() after action completes
|
|
159
|
+
*/
|
|
160
|
+
async checkUsage(actionType) {
|
|
161
|
+
// Try server first
|
|
162
|
+
const result = await apiRequest('/check', 'POST', { action: actionType });
|
|
163
|
+
|
|
164
|
+
if (result.offline) {
|
|
165
|
+
return this.handleOfflineCheck(actionType);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if (!result.success) {
|
|
169
|
+
// Server error - check cache as fallback
|
|
170
|
+
return this.checkCachedUsage(actionType, result.error);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// Update cache with server response
|
|
174
|
+
await this.updateCacheFromServer(result);
|
|
175
|
+
|
|
176
|
+
return {
|
|
177
|
+
allowed: result.allowed,
|
|
178
|
+
current: result.current,
|
|
179
|
+
limit: result.limit,
|
|
180
|
+
remaining: result.remaining,
|
|
181
|
+
reason: result.reason,
|
|
182
|
+
source: 'server',
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Record usage after action completes (server-authoritative)
|
|
188
|
+
* This increments the server counter and returns updated usage
|
|
189
|
+
*/
|
|
190
|
+
async recordUsage(actionType, count = 1) {
|
|
191
|
+
// Try server first
|
|
192
|
+
const result = await apiRequest('/increment', 'POST', { action: actionType, count });
|
|
193
|
+
|
|
194
|
+
if (result.offline) {
|
|
195
|
+
return this.handleOfflineRecord(actionType, count);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
if (!result.success) {
|
|
199
|
+
// Server error - queue for later sync
|
|
200
|
+
await this.queueOfflineAction(actionType, count);
|
|
201
|
+
return {
|
|
202
|
+
success: false,
|
|
203
|
+
error: result.error,
|
|
204
|
+
queued: true,
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// Update cache with signed token
|
|
209
|
+
if (result.signedToken) {
|
|
210
|
+
await this.updateCacheWithToken(result.signedToken, result);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
return {
|
|
214
|
+
success: true,
|
|
215
|
+
allowed: result.allowed,
|
|
216
|
+
current: result.current,
|
|
217
|
+
limit: result.limit,
|
|
218
|
+
remaining: result.remaining,
|
|
219
|
+
source: 'server',
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Enforce usage limit (throws if not allowed)
|
|
225
|
+
*/
|
|
226
|
+
async enforceLimit(actionType) {
|
|
227
|
+
const check = await this.checkUsage(actionType);
|
|
228
|
+
|
|
229
|
+
if (!check.allowed) {
|
|
230
|
+
const error = new Error(check.reason || `Monthly ${actionType} limit reached`);
|
|
231
|
+
error.code = 'LIMIT_EXCEEDED';
|
|
232
|
+
error.usage = check.current;
|
|
233
|
+
error.limit = check.limit;
|
|
234
|
+
error.upgradePrompt = this.formatUpgradePrompt(actionType, check);
|
|
235
|
+
throw error;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
return check;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Get full usage summary from server
|
|
243
|
+
*/
|
|
244
|
+
async getUsageSummary() {
|
|
245
|
+
const result = await apiRequest('/summary', 'GET');
|
|
246
|
+
|
|
247
|
+
if (result.offline || !result.success) {
|
|
248
|
+
// Return cached data if available
|
|
249
|
+
const cache = await readCache();
|
|
250
|
+
if (cache?.usage) {
|
|
251
|
+
return { ...cache, source: 'cache' };
|
|
252
|
+
}
|
|
253
|
+
return { error: result.error || 'Unable to fetch usage', source: 'none' };
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
// Update cache
|
|
257
|
+
await this.updateCacheFromServer(result);
|
|
258
|
+
|
|
259
|
+
return { ...result, source: 'server' };
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Sync any pending offline usage to server
|
|
264
|
+
*/
|
|
265
|
+
async syncOfflineUsage() {
|
|
266
|
+
const offline = await readOfflineQueue();
|
|
267
|
+
|
|
268
|
+
if (!offline.queue || offline.queue.length === 0) {
|
|
269
|
+
return { synced: 0, pending: 0 };
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
const result = await apiRequest('/sync', 'POST');
|
|
273
|
+
|
|
274
|
+
if (result.offline || !result.success) {
|
|
275
|
+
return {
|
|
276
|
+
synced: 0,
|
|
277
|
+
pending: offline.queue.length,
|
|
278
|
+
error: result.error || 'Unable to sync',
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
// Clear local queue on successful sync
|
|
283
|
+
await writeOfflineQueue({ queue: [], lastSync: new Date().toISOString() });
|
|
284
|
+
|
|
285
|
+
// Update cache with new token
|
|
286
|
+
if (result.signedToken) {
|
|
287
|
+
await this.updateCacheWithToken(result.signedToken, result);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
return {
|
|
291
|
+
synced: result.synced || offline.queue.length,
|
|
292
|
+
pending: 0,
|
|
293
|
+
usage: result.usage,
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Check if sync is required before any action
|
|
299
|
+
*/
|
|
300
|
+
async requiresSync() {
|
|
301
|
+
const offline = await readOfflineQueue();
|
|
302
|
+
return offline.queue && offline.queue.length >= OFFLINE_ALLOWANCE;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
// ============================================================================
|
|
306
|
+
// OFFLINE HANDLING
|
|
307
|
+
// ============================================================================
|
|
308
|
+
|
|
309
|
+
async handleOfflineCheck(actionType) {
|
|
310
|
+
const offline = await readOfflineQueue();
|
|
311
|
+
const cache = await readCache();
|
|
312
|
+
|
|
313
|
+
// Check if we've exceeded offline allowance
|
|
314
|
+
if (offline.queue && offline.queue.length >= OFFLINE_ALLOWANCE) {
|
|
315
|
+
return {
|
|
316
|
+
allowed: false,
|
|
317
|
+
reason: 'Offline limit reached. Please connect to sync usage.',
|
|
318
|
+
requiresSync: true,
|
|
319
|
+
source: 'offline',
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
// Check cached limits if available
|
|
324
|
+
if (cache?.signedToken && cache?.usage) {
|
|
325
|
+
const tokenExpiry = new Date(cache.signedToken.expiresAt);
|
|
326
|
+
const now = new Date();
|
|
327
|
+
|
|
328
|
+
// Allow some grace period for cached data
|
|
329
|
+
if (tokenExpiry.getTime() + TOKEN_GRACE_PERIOD_MS > now.getTime()) {
|
|
330
|
+
const actionMap = {
|
|
331
|
+
scan: 'scan',
|
|
332
|
+
reality: 'reality',
|
|
333
|
+
agent: 'agent',
|
|
334
|
+
gate: 'gate',
|
|
335
|
+
fix: 'fix',
|
|
336
|
+
};
|
|
337
|
+
const usageKey = actionMap[actionType];
|
|
338
|
+
const current = cache.usage[usageKey] || 0;
|
|
339
|
+
const limit = cache.limits?.[usageKey === 'scan' ? 'scans' : usageKey] || 0;
|
|
340
|
+
|
|
341
|
+
if (limit === -1 || current < limit) {
|
|
342
|
+
return {
|
|
343
|
+
allowed: true,
|
|
344
|
+
current,
|
|
345
|
+
limit,
|
|
346
|
+
remaining: limit === -1 ? -1 : limit - current,
|
|
347
|
+
source: 'cache',
|
|
348
|
+
warning: 'Using cached data (offline)',
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
// Allow one offline action
|
|
355
|
+
return {
|
|
356
|
+
allowed: true,
|
|
357
|
+
source: 'offline',
|
|
358
|
+
warning: 'Offline mode - action will be synced when online',
|
|
359
|
+
offlineAllowance: OFFLINE_ALLOWANCE - (offline.queue?.length || 0),
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
async handleOfflineRecord(actionType, count) {
|
|
364
|
+
const queued = await this.queueOfflineAction(actionType, count);
|
|
365
|
+
|
|
366
|
+
if (!queued) {
|
|
367
|
+
return {
|
|
368
|
+
success: false,
|
|
369
|
+
error: 'Offline limit reached. Please connect to sync usage.',
|
|
370
|
+
requiresSync: true,
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
return {
|
|
375
|
+
success: true,
|
|
376
|
+
queued: true,
|
|
377
|
+
source: 'offline',
|
|
378
|
+
warning: 'Action queued for sync',
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
async queueOfflineAction(actionType, count = 1) {
|
|
383
|
+
const offline = await readOfflineQueue();
|
|
384
|
+
|
|
385
|
+
if (offline.queue && offline.queue.length >= OFFLINE_ALLOWANCE) {
|
|
386
|
+
return false;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
offline.queue = offline.queue || [];
|
|
390
|
+
offline.queue.push({
|
|
391
|
+
action: actionType,
|
|
392
|
+
count,
|
|
393
|
+
timestamp: new Date().toISOString(),
|
|
394
|
+
machineId: getMachineId(),
|
|
395
|
+
});
|
|
396
|
+
|
|
397
|
+
await writeOfflineQueue(offline);
|
|
398
|
+
return true;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
// ============================================================================
|
|
402
|
+
// CACHE MANAGEMENT
|
|
403
|
+
// ============================================================================
|
|
404
|
+
|
|
405
|
+
async checkCachedUsage(actionType, serverError) {
|
|
406
|
+
const cache = await readCache();
|
|
407
|
+
|
|
408
|
+
if (!cache?.signedToken || !cache?.usage) {
|
|
409
|
+
return {
|
|
410
|
+
allowed: false,
|
|
411
|
+
error: serverError || 'Unable to verify usage',
|
|
412
|
+
source: 'none',
|
|
413
|
+
};
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
// Check token expiry
|
|
417
|
+
const tokenExpiry = new Date(cache.signedToken.expiresAt);
|
|
418
|
+
if (tokenExpiry < new Date()) {
|
|
419
|
+
return {
|
|
420
|
+
allowed: false,
|
|
421
|
+
error: 'Cached usage expired. Please try again.',
|
|
422
|
+
source: 'cache_expired',
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
const actionMap = {
|
|
427
|
+
scan: 'scan',
|
|
428
|
+
reality: 'reality',
|
|
429
|
+
agent: 'agent',
|
|
430
|
+
gate: 'gate',
|
|
431
|
+
fix: 'fix',
|
|
432
|
+
};
|
|
433
|
+
const usageKey = actionMap[actionType];
|
|
434
|
+
const current = cache.usage[usageKey] || 0;
|
|
435
|
+
const limitKey = usageKey === 'scan' ? 'scans' : usageKey;
|
|
436
|
+
const limit = cache.limits?.[limitKey] || 0;
|
|
437
|
+
|
|
438
|
+
const allowed = limit === -1 || current < limit;
|
|
439
|
+
|
|
440
|
+
return {
|
|
441
|
+
allowed,
|
|
442
|
+
current,
|
|
443
|
+
limit,
|
|
444
|
+
remaining: limit === -1 ? -1 : Math.max(0, limit - current),
|
|
445
|
+
source: 'cache',
|
|
446
|
+
warning: 'Using cached data due to server error',
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
async updateCacheFromServer(serverResponse) {
|
|
451
|
+
const cache = await readCache() || {};
|
|
452
|
+
|
|
453
|
+
cache.usage = serverResponse.usage;
|
|
454
|
+
cache.limits = serverResponse.limits;
|
|
455
|
+
cache.tier = serverResponse.tier;
|
|
456
|
+
cache.period = serverResponse.period;
|
|
457
|
+
cache.lastUpdated = new Date().toISOString();
|
|
458
|
+
|
|
459
|
+
if (serverResponse.signedToken) {
|
|
460
|
+
cache.signedToken = serverResponse.signedToken;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
await writeCache(cache);
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
async updateCacheWithToken(signedToken, serverResponse) {
|
|
467
|
+
const cache = await readCache() || {};
|
|
468
|
+
|
|
469
|
+
cache.signedToken = signedToken;
|
|
470
|
+
cache.usage = serverResponse.usage || cache.usage;
|
|
471
|
+
cache.limits = serverResponse.limits || cache.limits;
|
|
472
|
+
cache.lastUpdated = new Date().toISOString();
|
|
473
|
+
|
|
474
|
+
await writeCache(cache);
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
// ============================================================================
|
|
478
|
+
// UI HELPERS
|
|
479
|
+
// ============================================================================
|
|
480
|
+
|
|
481
|
+
formatUpgradePrompt(actionType, check) {
|
|
482
|
+
const lines = [
|
|
483
|
+
'',
|
|
484
|
+
'\x1b[31m╭─────────────────────────────────────────────────────────────╮\x1b[0m',
|
|
485
|
+
'\x1b[31m│\x1b[0m \x1b[1m⚠️ MONTHLY LIMIT REACHED\x1b[0m \x1b[31m│\x1b[0m',
|
|
486
|
+
'\x1b[31m├─────────────────────────────────────────────────────────────┤\x1b[0m',
|
|
487
|
+
`\x1b[31m│\x1b[0m ${actionType}: \x1b[33m${check.current}/${check.limit}\x1b[0m used this month`.padEnd(72) + '\x1b[31m│\x1b[0m',
|
|
488
|
+
'\x1b[31m├─────────────────────────────────────────────────────────────┤\x1b[0m',
|
|
489
|
+
'\x1b[31m│\x1b[0m \x1b[36m→ vibecheck upgrade\x1b[0m \x1b[31m│\x1b[0m',
|
|
490
|
+
'\x1b[31m│\x1b[0m \x1b[36m→ https://vibecheckai.dev/pricing\x1b[0m \x1b[31m│\x1b[0m',
|
|
491
|
+
'\x1b[31m╰─────────────────────────────────────────────────────────────╯\x1b[0m',
|
|
492
|
+
'',
|
|
493
|
+
];
|
|
494
|
+
return lines.join('\n');
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
// ============================================================================
|
|
499
|
+
// SINGLETON EXPORT
|
|
500
|
+
// ============================================================================
|
|
501
|
+
|
|
502
|
+
const serverUsage = new ServerUsageEnforcement();
|
|
503
|
+
|
|
504
|
+
module.exports = {
|
|
505
|
+
serverUsage,
|
|
506
|
+
checkUsage: (actionType) => serverUsage.checkUsage(actionType),
|
|
507
|
+
recordUsage: (actionType, count) => serverUsage.recordUsage(actionType, count),
|
|
508
|
+
enforceLimit: (actionType) => serverUsage.enforceLimit(actionType),
|
|
509
|
+
getUsageSummary: () => serverUsage.getUsageSummary(),
|
|
510
|
+
syncOfflineUsage: () => serverUsage.syncOfflineUsage(),
|
|
511
|
+
requiresSync: () => serverUsage.requiresSync(),
|
|
512
|
+
OFFLINE_ALLOWANCE,
|
|
513
|
+
};
|