@vibecheckai/cli 3.3.0 → 3.5.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.
Files changed (170) hide show
  1. package/bin/registry.js +389 -269
  2. package/bin/runners/cli-utils.js +2 -33
  3. package/bin/runners/context/generators/cursor.js +49 -2
  4. package/bin/runners/lib/agent-firewall/learning/learning-engine.js +849 -0
  5. package/bin/runners/lib/analyzers.js +599 -142
  6. package/bin/runners/lib/audit-logger.js +532 -0
  7. package/bin/runners/lib/authority/authorities/architecture.js +364 -0
  8. package/bin/runners/lib/authority/authorities/compliance.js +341 -0
  9. package/bin/runners/lib/authority/authorities/human.js +343 -0
  10. package/bin/runners/lib/authority/authorities/quality.js +420 -0
  11. package/bin/runners/lib/authority/authorities/security.js +228 -0
  12. package/bin/runners/lib/authority/index.js +293 -0
  13. package/bin/runners/lib/authority-badge.js +425 -425
  14. package/bin/runners/lib/bundle/bundle-intelligence.js +846 -0
  15. package/bin/runners/lib/cli-charts.js +368 -0
  16. package/bin/runners/lib/cli-config-display.js +405 -0
  17. package/bin/runners/lib/cli-demo.js +275 -0
  18. package/bin/runners/lib/cli-errors.js +438 -0
  19. package/bin/runners/lib/cli-help-formatter.js +439 -0
  20. package/bin/runners/lib/cli-interactive-menu.js +509 -0
  21. package/bin/runners/lib/cli-prompts.js +441 -0
  22. package/bin/runners/lib/cli-scan-cards.js +362 -0
  23. package/bin/runners/lib/compliance-reporter.js +710 -0
  24. package/bin/runners/lib/conductor/index.js +671 -0
  25. package/bin/runners/lib/easy/README.md +123 -0
  26. package/bin/runners/lib/easy/index.js +140 -0
  27. package/bin/runners/lib/easy/interactive-wizard.js +788 -0
  28. package/bin/runners/lib/easy/one-click-firewall.js +564 -0
  29. package/bin/runners/lib/easy/zero-config-reality.js +714 -0
  30. package/bin/runners/lib/engines/accessibility-engine.js +218 -18
  31. package/bin/runners/lib/engines/api-consistency-engine.js +335 -30
  32. package/bin/runners/lib/engines/async-patterns-engine.js +444 -0
  33. package/bin/runners/lib/engines/bundle-size-engine.js +433 -0
  34. package/bin/runners/lib/engines/confidence-scoring.js +276 -0
  35. package/bin/runners/lib/engines/context-detection.js +264 -0
  36. package/bin/runners/lib/engines/cross-file-analysis-engine.js +292 -27
  37. package/bin/runners/lib/engines/database-patterns-engine.js +429 -0
  38. package/bin/runners/lib/engines/duplicate-code-engine.js +354 -0
  39. package/bin/runners/lib/engines/empty-catch-engine.js +127 -17
  40. package/bin/runners/lib/engines/env-variables-engine.js +458 -0
  41. package/bin/runners/lib/engines/error-handling-engine.js +437 -0
  42. package/bin/runners/lib/engines/false-positive-prevention.js +630 -0
  43. package/bin/runners/lib/engines/framework-adapters/index.js +607 -0
  44. package/bin/runners/lib/engines/framework-detection.js +508 -0
  45. package/bin/runners/lib/engines/import-order-engine.js +429 -0
  46. package/bin/runners/lib/engines/mock-data-engine.js +53 -10
  47. package/bin/runners/lib/engines/naming-conventions-engine.js +544 -0
  48. package/bin/runners/lib/engines/noise-reduction-engine.js +452 -0
  49. package/bin/runners/lib/engines/orchestrator.js +334 -0
  50. package/bin/runners/lib/engines/performance-issues-engine.js +176 -36
  51. package/bin/runners/lib/engines/react-patterns-engine.js +457 -0
  52. package/bin/runners/lib/engines/security-vulnerabilities-engine.js +382 -54
  53. package/bin/runners/lib/engines/type-aware-engine.js +263 -39
  54. package/bin/runners/lib/engines/vibecheck-engines/index.js +122 -13
  55. package/bin/runners/lib/engines/vibecheck-engines/lib/ai-hallucination-engine.js +806 -0
  56. package/bin/runners/lib/engines/vibecheck-engines/lib/hardcoded-secrets-engine.js +373 -73
  57. package/bin/runners/lib/engines/vibecheck-engines/lib/smart-fix-engine.js +577 -0
  58. package/bin/runners/lib/engines/vibecheck-engines/lib/vibe-score-engine.js +543 -0
  59. package/bin/runners/lib/engines/vibecheck-engines.js +514 -0
  60. package/bin/runners/lib/enhanced-features/index.js +305 -0
  61. package/bin/runners/lib/enhanced-output.js +631 -0
  62. package/bin/runners/lib/enterprise.js +300 -0
  63. package/bin/runners/lib/entitlements-v2.js +161 -478
  64. package/bin/runners/lib/firewall/command-validator.js +351 -0
  65. package/bin/runners/lib/firewall/config.js +341 -0
  66. package/bin/runners/lib/firewall/content-validator.js +519 -0
  67. package/bin/runners/lib/firewall/index.js +101 -0
  68. package/bin/runners/lib/firewall/path-validator.js +256 -0
  69. package/bin/runners/lib/html-proof-report.js +350 -700
  70. package/bin/runners/lib/intelligence/cross-repo-intelligence.js +817 -0
  71. package/bin/runners/lib/mcp-utils.js +425 -0
  72. package/bin/runners/lib/missions/plan.js +46 -6
  73. package/bin/runners/lib/missions/templates.js +232 -0
  74. package/bin/runners/lib/output/index.js +1022 -0
  75. package/bin/runners/lib/policy-engine.js +652 -0
  76. package/bin/runners/lib/polish/autofix/accessibility-fixes.js +333 -0
  77. package/bin/runners/lib/polish/autofix/async-handlers.js +273 -0
  78. package/bin/runners/lib/polish/autofix/dead-code.js +280 -0
  79. package/bin/runners/lib/polish/autofix/imports-optimizer.js +344 -0
  80. package/bin/runners/lib/polish/autofix/index.js +200 -0
  81. package/bin/runners/lib/polish/autofix/remove-consoles.js +209 -0
  82. package/bin/runners/lib/polish/autofix/strengthen-types.js +245 -0
  83. package/bin/runners/lib/polish/backend-checks.js +148 -0
  84. package/bin/runners/lib/polish/documentation-checks.js +111 -0
  85. package/bin/runners/lib/polish/frontend-checks.js +168 -0
  86. package/bin/runners/lib/polish/index.js +71 -0
  87. package/bin/runners/lib/polish/infrastructure-checks.js +131 -0
  88. package/bin/runners/lib/polish/library-detection.js +175 -0
  89. package/bin/runners/lib/polish/performance-checks.js +100 -0
  90. package/bin/runners/lib/polish/security-checks.js +148 -0
  91. package/bin/runners/lib/polish/utils.js +203 -0
  92. package/bin/runners/lib/prompt-builder.js +540 -0
  93. package/bin/runners/lib/proof-certificate.js +634 -0
  94. package/bin/runners/lib/reality/accessibility-audit.js +946 -0
  95. package/bin/runners/lib/reality/api-contract-validator.js +1012 -0
  96. package/bin/runners/lib/reality/chaos-engineering.js +1084 -0
  97. package/bin/runners/lib/reality/performance-tracker.js +1077 -0
  98. package/bin/runners/lib/reality/scenario-generator.js +1404 -0
  99. package/bin/runners/lib/reality/visual-regression.js +852 -0
  100. package/bin/runners/lib/reality-profiler.js +717 -0
  101. package/bin/runners/lib/replay/flight-recorder-viewer.js +1160 -0
  102. package/bin/runners/lib/review/ai-code-review.js +832 -0
  103. package/bin/runners/lib/rules/custom-rule-engine.js +985 -0
  104. package/bin/runners/lib/sbom-generator.js +641 -0
  105. package/bin/runners/lib/scan-output-enhanced.js +512 -0
  106. package/bin/runners/lib/scan-output.js +65 -19
  107. package/bin/runners/lib/security/owasp-scanner.js +939 -0
  108. package/bin/runners/lib/ship-output.js +18 -25
  109. package/bin/runners/lib/terminal-ui.js +113 -1
  110. package/bin/runners/lib/unified-cli-output.js +603 -430
  111. package/bin/runners/lib/upsell.js +90 -338
  112. package/bin/runners/lib/validators/contract-validator.js +283 -0
  113. package/bin/runners/lib/validators/dead-export-detector.js +279 -0
  114. package/bin/runners/lib/validators/dep-audit.js +245 -0
  115. package/bin/runners/lib/validators/env-validator.js +319 -0
  116. package/bin/runners/lib/validators/index.js +120 -0
  117. package/bin/runners/lib/validators/license-checker.js +252 -0
  118. package/bin/runners/lib/validators/route-validator.js +290 -0
  119. package/bin/runners/runAIAgent.js +5 -10
  120. package/bin/runners/runAgent.js +3 -0
  121. package/bin/runners/runApprove.js +1233 -1200
  122. package/bin/runners/runAuth.js +22 -1
  123. package/bin/runners/runAuthority.js +528 -0
  124. package/bin/runners/runCheckpoint.js +4 -24
  125. package/bin/runners/runClassify.js +862 -859
  126. package/bin/runners/runConductor.js +772 -0
  127. package/bin/runners/runContainer.js +366 -0
  128. package/bin/runners/runContext.js +3 -0
  129. package/bin/runners/runDoctor.js +28 -41
  130. package/bin/runners/runEasy.js +410 -0
  131. package/bin/runners/runFirewall.js +3 -0
  132. package/bin/runners/runFirewallHook.js +3 -0
  133. package/bin/runners/runFix.js +76 -66
  134. package/bin/runners/runGuard.js +411 -18
  135. package/bin/runners/runIaC.js +372 -0
  136. package/bin/runners/runInit.js +10 -60
  137. package/bin/runners/runMcp.js +11 -12
  138. package/bin/runners/runPolish.js +240 -64
  139. package/bin/runners/runPromptFirewall.js +5 -12
  140. package/bin/runners/runProve.js +20 -55
  141. package/bin/runners/runReality.js +68 -59
  142. package/bin/runners/runReport.js +31 -5
  143. package/bin/runners/runRuntime.js +5 -8
  144. package/bin/runners/runScan.js +194 -1273
  145. package/bin/runners/runShip.js +695 -47
  146. package/bin/runners/runTruth.js +3 -0
  147. package/bin/runners/runValidate.js +7 -11
  148. package/bin/runners/runVibe.js +791 -0
  149. package/bin/runners/runWatch.js +14 -23
  150. package/bin/vibecheck.js +179 -65
  151. package/mcp-server/index.js +202 -636
  152. package/mcp-server/lib/api-client.cjs +7 -299
  153. package/mcp-server/package.json +1 -1
  154. package/mcp-server/tier-auth.js +175 -574
  155. package/mcp-server/tools-v3.js +800 -505
  156. package/mcp-server/tools.js +495 -0
  157. package/package.json +1 -1
  158. package/bin/runners/lib/engines/vibecheck-engines/lib/ast-cache.js +0 -164
  159. package/bin/runners/lib/engines/vibecheck-engines/lib/code-quality-engine.js +0 -291
  160. package/bin/runners/lib/engines/vibecheck-engines/lib/console-logs-engine.js +0 -83
  161. package/bin/runners/lib/engines/vibecheck-engines/lib/dead-code-engine.js +0 -198
  162. package/bin/runners/lib/engines/vibecheck-engines/lib/deprecated-api-engine.js +0 -275
  163. package/bin/runners/lib/engines/vibecheck-engines/lib/empty-catch-engine.js +0 -167
  164. package/bin/runners/lib/engines/vibecheck-engines/lib/file-filter.js +0 -217
  165. package/bin/runners/lib/engines/vibecheck-engines/lib/mock-data-engine.js +0 -140
  166. package/bin/runners/lib/engines/vibecheck-engines/lib/parallel-processor.js +0 -164
  167. package/bin/runners/lib/engines/vibecheck-engines/lib/performance-issues-engine.js +0 -234
  168. package/bin/runners/lib/engines/vibecheck-engines/lib/type-aware-engine.js +0 -217
  169. package/bin/runners/lib/engines/vibecheck-engines/lib/unsafe-regex-engine.js +0 -78
  170. package/mcp-server/index-v1.js +0 -698
package/bin/registry.js CHANGED
@@ -1,44 +1,51 @@
1
1
  /**
2
- * Vibecheck CLI Command Registry (LOCKED)
2
+ * Vibecheck CLI Command Registry
3
3
  *
4
4
  * Single source of truth for the public CLI surface.
5
5
  * If it isn't here, it does not exist.
6
6
  *
7
- * ═══════════════════════════════════════════════════════════════════════════════
8
- * WORLD-CLASS CLI - Enhanced Registry with Rich Metadata
9
- * ═══════════════════════════════════════════════════════════════════════════════
7
+ * Simple 2-tier model:
8
+ * - FREE ($0): Inspect & Observe
9
+ * - PRO ($69/mo): Fix, Prove & Enforce
10
+ *
11
+ * SCAN = Quick lint (5 core engines, fast, FREE)
12
+ * SHIP = Comprehensive verdict (all engines + proof cert, PRO)
10
13
  */
11
14
 
12
15
  "use strict";
13
16
 
14
17
  // ─────────────────────────────────────────────────────────────
15
- // CORE 19 COMMANDS (locked surface area)
18
+ // CLI COMMANDS (22 total - 2-tier: FREE / PRO)
16
19
  // ─────────────────────────────────────────────────────────────
17
20
  const ALLOWED_COMMANDS = new Set([
18
- // FREE (9) - Core functionality to try the product
19
- "init", // one-time setup
20
- "doctor", // health check
21
- "watch", // continuous mode
22
- "scan", // includes --allowlist subcommand
23
- "ship", // verdict engine
24
- "classify", // Authority: inventory (duplication/legacy maps)
25
- "login", // authenticate
26
- "logout", // remove credentials
27
- "whoami", // show current user
28
-
29
- // STARTER (7) - Productivity & automation
30
- "fix", // AI-powered fixes
31
- "report", // generate reports
32
- "context", // generate IDE rules
33
- "guard", // AI guardrails (prompt firewall, hallucination checking)
34
- "mcp", // MCP server
35
- "checkpoint", // baseline comparison & hallucination scoring
36
- "approve", // Authority: get verdicts for authorities
37
-
38
- // PRO (3) - Advanced proof & AI testing
39
- "prove", // includes --bundle for evidence packs
40
- "reality", // includes --agent for AI testing
41
- "polish", // production polish
21
+ // FREE (12) - Inspect & Observe
22
+ "scan", // quick lint - 5 core engines
23
+ "context", // generate truthpack + IDE rules
24
+ "watch", // real-time file watching
25
+ "doctor", // environment diagnostics
26
+ "report", // generate HTML/SARIF reports
27
+ "authority", // authority system main command
28
+ "authority.list", // list available authorities
29
+ "guard", // agent firewall (observe mode FREE, enforce mode PRO)
30
+ "login", // authenticate
31
+ "logout", // clear auth
32
+ "whoami", // show current user
33
+ "init", // one-time setup (legacy, redirects to context)
34
+
35
+ // PRO (12) - Fix, Prove & Enforce
36
+ "ship", // comprehensive - all engines, verdict, proof cert
37
+ "fix", // AI-powered fixes with LLM
38
+ "polish", // production hardening
39
+ "reality", // playwright browser verification
40
+ "prove", // full proof loop with evidence pack
41
+ "gate", // CI/CD enforcement
42
+ "ai-test", // AI agent for autonomous app testing
43
+ "authority.approve", // get authority verdict
44
+ "conductor.status", // multi-agent coordination status
45
+ "conductor.register", // register AI agent
46
+ "conductor.lock", // acquire file lock
47
+ "conductor.unlock", // release file lock
48
+ "conductor.propose", // submit change proposal
42
49
  ]);
43
50
 
44
51
  function assertAllowedOnly(obj) {
@@ -49,34 +56,60 @@ function assertAllowedOnly(obj) {
49
56
  }
50
57
 
51
58
  // ─────────────────────────────────────────────────────────────
52
- // COMMANDS (ALLOWED ONLY) - Enhanced with World-Class Metadata
59
+ // COMMANDS - 2-Tier: FREE and PRO ($69/mo)
53
60
  // ─────────────────────────────────────────────────────────────
54
61
  const COMMANDS = {
55
62
  // ══════════════════════════════════════════════════════════════
56
- // FREE TIER (8 commands) - Core functionality to try the product
63
+ // FREE TIER - Inspect & Observe
57
64
  // ══════════════════════════════════════════════════════════════
58
65
 
59
- // ── SETUP ───────────────────────────────────────────────────
60
- init: {
61
- description: "One-time setup (config + contracts + scripts)",
62
- longDescription: "Initialize vibecheck in your project. Creates configuration files, sets up IDE rules, and optionally connects to the vibecheck dashboard for team collaboration.",
66
+ scan: {
67
+ description: "Quick lint - 5 core engines, fast feedback",
68
+ longDescription: "Fast static analysis using 5 core engines: secrets, mock data, console logs, type issues, and security vulnerabilities. Use for rapid feedback during development.",
69
+ tier: "free",
70
+ category: "analysis",
71
+ aliases: ["s", "check", "lint"],
72
+ runner: () => require("./runners/runScan").runScan,
73
+ examples: [
74
+ { command: "vibecheck scan", description: "Quick scan with 5 core engines" },
75
+ { command: "vibecheck scan --json", description: "JSON output for CI" },
76
+ { command: "vibecheck scan --allowlist list", description: "View suppressed findings" },
77
+ ],
78
+ related: ["ship", "fix", "report"],
79
+ },
80
+
81
+ context: {
82
+ description: "Generate truthpack + IDE rules (.cursorrules, MDC, Copilot)",
83
+ longDescription: "Generate project-aware AI coding rules and truthpack for your IDE. Creates .cursorrules, MDC files, and other IDE configurations.",
63
84
  tier: "free",
64
85
  category: "setup",
65
- aliases: ["setup", "configure"],
66
- runner: () => require("./runners/runInit").runInit,
86
+ aliases: ["rules", "ai-rules", "mdc", "ctx", "init"],
87
+ runner: () => require("./runners/runContext").runContext,
67
88
  examples: [
68
- { command: "vibecheck init", description: "Interactive setup wizard" },
69
- { command: "vibecheck init --local", description: "Quick local-only setup (no API)" },
70
- { command: "vibecheck init --connect", description: "Setup with GitHub integration", tier: "starter" },
71
- { command: "vibecheck init --quick", description: "Non-interactive with sensible defaults" },
89
+ { command: "vibecheck context", description: "Generate all IDE rules + truthpack" },
90
+ { command: "vibecheck context --format cursor", description: ".cursorrules only" },
91
+ { command: "vibecheck context --format mdc", description: "MDC files only" },
72
92
  ],
73
- related: ["doctor", "scan"],
74
- docsUrl: "https://docs.vibecheckai.dev/getting-started",
93
+ related: ["scan", "guard"],
94
+ },
95
+
96
+ watch: {
97
+ description: "Real-time file watching - re-runs scan on changes",
98
+ longDescription: "File watcher that automatically re-runs quick scan when your code changes.",
99
+ tier: "free",
100
+ category: "setup",
101
+ aliases: ["w", "dev"],
102
+ runner: () => require("./runners/runWatch").runWatch,
103
+ examples: [
104
+ { command: "vibecheck watch", description: "Start watching" },
105
+ { command: "vibecheck watch --path ./src", description: "Watch specific directory" },
106
+ ],
107
+ related: ["scan"],
75
108
  },
76
109
 
77
110
  doctor: {
78
- description: "Environment + dependency + config health check",
79
- longDescription: "Comprehensive diagnostics for your development environment. Checks Node.js, package managers, project configuration, and vibecheck setup. Can auto-fix common issues.",
111
+ description: "Environment diagnostics - config and dependency health check",
112
+ longDescription: "Comprehensive diagnostics for your development environment, configuration, and dependencies.",
80
113
  tier: "free",
81
114
  category: "setup",
82
115
  aliases: ["health", "diag"],
@@ -84,359 +117,446 @@ const COMMANDS = {
84
117
  examples: [
85
118
  { command: "vibecheck doctor", description: "Run all health checks" },
86
119
  { command: "vibecheck doctor --fix", description: "Auto-fix detected issues" },
87
- { command: "vibecheck doctor --json", description: "Output diagnostics as JSON" },
120
+ { command: "vibecheck doctor --json", description: "Output as JSON" },
88
121
  ],
89
- related: ["init", "scan"],
90
- docsUrl: "https://docs.vibecheckai.dev/cli/doctor",
122
+ related: ["context", "scan"],
91
123
  },
92
124
 
93
- watch: {
94
- description: "Continuous mode - re-runs on changes",
95
- longDescription: "File watcher that automatically re-runs scans when your code changes. Ideal for development workflows where you want instant feedback.",
125
+ report: {
126
+ description: "Generate HTML/SARIF reports from scan results",
127
+ longDescription: "Create shareable reports from scan results in HTML, Markdown, or SARIF format.",
96
128
  tier: "free",
97
- category: "setup",
98
- aliases: ["w", "dev"],
99
- runner: () => require("./runners/runWatch").runWatch,
129
+ category: "output",
130
+ aliases: ["html", "artifact"],
131
+ runner: () => require("./runners/runReport").runReport,
100
132
  examples: [
101
- { command: "vibecheck watch", description: "Start watching current directory" },
102
- { command: "vibecheck watch --path ./src", description: "Watch specific directory" },
103
- { command: "vibecheck watch --debounce 1000", description: "Custom debounce (1 second)" },
133
+ { command: "vibecheck report", description: "Generate HTML report" },
134
+ { command: "vibecheck report --format md", description: "Markdown report" },
135
+ { command: "vibecheck report --format sarif", description: "SARIF for GitHub" },
104
136
  ],
105
137
  related: ["scan", "ship"],
106
- docsUrl: "https://docs.vibecheckai.dev/cli/watch",
107
138
  },
108
139
 
109
- // ── CORE LOOP ───────────────────────────────────────────────
110
- scan: {
111
- description: "Route integrity & code analysis; use --allowlist for false positive management",
112
- longDescription: "The core analysis engine. Scans your codebase for route integrity issues, security vulnerabilities, code quality problems, and more. Supports multiple scan layers: AST (fast), Truth (build manifests), and Reality (runtime browser testing).",
140
+ "authority": {
141
+ description: "Authority System - automated and human approvals",
142
+ longDescription: "Request approval from built-in authorities (security, architecture, compliance, quality) or human reviewers. Use 'authority list' to see available authorities and 'authority approve' to request approval.",
113
143
  tier: "free",
114
- category: "proof",
115
- aliases: ["s", "check"],
116
- runner: () => require("./runners/runScan").runScan,
144
+ category: "authority",
145
+ aliases: ["auth"],
146
+ runner: () => require("./runners/runAuthority").runAuthority,
117
147
  examples: [
118
- { command: "vibecheck scan", description: "Quick AST scan (Layer 1)" },
119
- { command: "vibecheck scan --truth", description: "Include build manifest verification" },
120
- { command: "vibecheck scan --reality --url http://localhost:3000", description: "Full runtime proof", tier: "pro" },
121
- { command: "vibecheck scan --autofix", description: "Generate AI fix missions", tier: "starter" },
122
- { command: "vibecheck scan --allowlist list", description: "View suppressed findings" },
123
- { command: "vibecheck scan --allowlist add --id R_DEAD_xyz --reason 'Known toggle'", description: "Suppress false positive" },
148
+ { command: "vibecheck authority list", description: "List all authorities" },
149
+ { command: "vibecheck authority approve --authority security", description: "Security review" },
150
+ { command: "vibecheck authority approve -a quality -a security", description: "Multi-authority" },
124
151
  ],
125
- related: ["ship", "fix", "prove"],
126
- docsUrl: "https://docs.vibecheckai.dev/cli/scan",
152
+ related: ["authority.list", "authority.approve", "ship"],
127
153
  },
128
154
 
129
- ship: {
130
- description: "Verdict engine - SHIP / WARN / BLOCK",
131
- longDescription: "The final word on whether your code is ready to ship. Combines all scan results, generates proof graphs, and renders a clear SHIP/WARN/BLOCK verdict. Use before every deployment.",
155
+ "authority.list": {
156
+ description: "List available authorities",
157
+ longDescription: "List all available authorities for code analysis and approval workflows.",
132
158
  tier: "free",
133
- category: "proof",
134
- aliases: ["verdict", "go"],
135
- runner: () => require("./runners/runShip").runShip,
159
+ category: "authority",
160
+ aliases: ["authorities", "auth-list"],
161
+ runner: () => require("./runners/runAuthority").runAuthority,
136
162
  examples: [
137
- { command: "vibecheck ship", description: "Get shipping verdict" },
138
- { command: "vibecheck ship --strict", description: "Fail on any warnings" },
139
- { command: "vibecheck ship --badge", description: "Generate status badge" },
140
- { command: "vibecheck ship --fix", description: "Attempt auto-fixes then re-check" },
163
+ { command: "vibecheck authority list", description: "List all authorities" },
141
164
  ],
142
- related: ["scan", "prove", "fix"],
143
- docsUrl: "https://docs.vibecheckai.dev/cli/ship",
165
+ related: ["authority", "authority.approve"],
144
166
  },
145
167
 
146
- // ── ACCOUNT (skipAuth) ────────────────────────────────────
147
168
  login: {
148
169
  description: "Authenticate with API key",
149
- longDescription: "Connect your CLI to the vibecheck API. Required for dashboard sync, team features, and paid tier commands.",
170
+ longDescription: "Connect your CLI to the vibecheck API with your API key.",
150
171
  tier: "free",
151
- category: "account",
172
+ category: "auth",
152
173
  aliases: ["auth", "signin"],
153
174
  runner: () => require("./runners/runAuth").runLogin,
154
175
  skipAuth: true,
155
176
  examples: [
156
- { command: "vibecheck login", description: "Interactive login (opens browser)" },
157
- { command: "vibecheck login --key YOUR_API_KEY", description: "Login with API key directly" },
158
- { command: "VIBECHECK_API_KEY=xxx vibecheck scan", description: "Use env var (CI/CD)" },
177
+ { command: "vibecheck login", description: "Interactive login" },
178
+ { command: "vibecheck login --key YOUR_API_KEY", description: "Login with key" },
159
179
  ],
160
180
  related: ["logout", "whoami"],
161
- docsUrl: "https://docs.vibecheckai.dev/authentication",
162
181
  },
163
182
 
164
183
  logout: {
165
- description: "Remove stored credentials",
166
- longDescription: "Clear your stored API key and log out of the vibecheck CLI.",
184
+ description: "Clear stored credentials",
185
+ longDescription: "Remove stored authentication credentials from your system.",
167
186
  tier: "free",
168
- category: "account",
187
+ category: "auth",
169
188
  aliases: ["signout"],
170
189
  runner: () => require("./runners/runAuth").runLogout,
171
190
  skipAuth: true,
172
191
  examples: [
173
- { command: "vibecheck logout", description: "Clear stored credentials" },
192
+ { command: "vibecheck logout", description: "Clear credentials" },
174
193
  ],
175
194
  related: ["login", "whoami"],
176
- docsUrl: "https://docs.vibecheckai.dev/authentication",
177
195
  },
178
196
 
179
197
  whoami: {
180
198
  description: "Show current user and plan",
181
- longDescription: "Display your current authentication status, subscription tier, and usage limits.",
199
+ longDescription: "Display information about the currently authenticated user and their subscription plan.",
182
200
  tier: "free",
183
- category: "account",
201
+ category: "auth",
184
202
  aliases: ["me", "user"],
185
203
  runner: () => require("./runners/runAuth").runWhoami,
186
204
  skipAuth: true,
187
205
  examples: [
188
- { command: "vibecheck whoami", description: "Show current user info" },
189
- { command: "vibecheck whoami --json", description: "Output as JSON" },
206
+ { command: "vibecheck whoami", description: "Show user info" },
190
207
  ],
191
208
  related: ["login", "logout"],
192
- docsUrl: "https://docs.vibecheckai.dev/authentication",
193
209
  },
194
210
 
195
- // ── AUTHORITY SYSTEM (FREE) ──────────────────────────────────
196
- classify: {
197
- description: "Inventory authority - duplication & legacy code maps",
198
- longDescription: "Produces a read-only inventory of your codebase including duplication maps, legacy code detection, and risk classifications. Part of the Authority System - read-only analysis available on FREE tier.",
211
+ init: {
212
+ description: "One-time setup (alias for context)",
213
+ longDescription: "Initialize vibecheck in your project. Alias for 'vibecheck context'.",
199
214
  tier: "free",
200
- category: "authority",
201
- aliases: ["inventory", "audit"],
202
- runner: () => require("./runners/runClassify").runClassify,
215
+ category: "setup",
216
+ aliases: ["setup", "configure"],
217
+ runner: () => require("./runners/runContext").runContext,
203
218
  examples: [
204
- { command: "vibecheck classify", description: "Quick inventory analysis" },
205
- { command: "vibecheck classify --json", description: "JSON output for processing" },
206
- { command: "vibecheck classify --include-semantic", description: "Include semantic duplicates" },
207
- { command: "vibecheck classify --output inventory.md --format markdown", description: "Save as markdown" },
219
+ { command: "vibecheck init", description: "Initialize project" },
208
220
  ],
209
- related: ["approve", "scan"],
210
- docsUrl: "https://docs.vibecheckai.dev/cli/classify",
221
+ related: ["context", "doctor"],
211
222
  },
212
223
 
213
224
  // ══════════════════════════════════════════════════════════════
214
- // STARTER TIER (7 commands) - Productivity & automation
225
+ // PRO TIER ($69/mo) - Fix, Prove & Enforce
215
226
  // ══════════════════════════════════════════════════════════════
216
227
 
228
+ ship: {
229
+ description: "Comprehensive verdict - ALL engines + route validation + proof cert",
230
+ longDescription: "The final word on whether your code is ready to ship. Runs ALL 15+ analysis engines, validates routes and contracts, generates proof certificate. SHIP/WARN/BLOCK verdict.",
231
+ tier: "pro",
232
+ category: "analysis",
233
+ aliases: ["verdict", "go", "full"],
234
+ runner: () => require("./runners/runShip").runShip,
235
+ examples: [
236
+ { command: "vibecheck ship", description: "Get shipping verdict" },
237
+ { command: "vibecheck ship --strict", description: "Fail on warnings" },
238
+ { command: "vibecheck ship --badge", description: "Generate status badge" },
239
+ ],
240
+ related: ["scan", "prove", "fix"],
241
+ },
242
+
217
243
  fix: {
218
- description: "AI-powered auto-fix for findings",
219
- longDescription: "Generate surgical AI prompts (missions) to fix detected issues. Each mission includes context, constraints, and verification steps. Use --apply to let AI make changes directly.",
220
- tier: "starter",
221
- category: "proof",
222
- aliases: ["f", "repair"],
244
+ description: "AI-powered auto-fix with LLM",
245
+ longDescription: "Generate AI-powered fixes for detected issues. Uses LLM to analyze and fix problems automatically.",
246
+ tier: "pro",
247
+ category: "repair",
248
+ aliases: ["f", "repair", "autofix"],
223
249
  runner: () => require("./runners/runFix").runFix,
224
250
  examples: [
225
- { command: "vibecheck fix", description: "Generate fix missions (prompts only)" },
226
- { command: "vibecheck fix --apply", description: "Apply AI-generated fixes" },
227
- { command: "vibecheck fix --loop", description: "Continuous fix loop until clean" },
228
- { command: "vibecheck fix --max-missions 5", description: "Limit to 5 missions" },
251
+ { command: "vibecheck fix", description: "Generate fix missions" },
252
+ { command: "vibecheck fix --apply", description: "Apply AI fixes" },
253
+ { command: "vibecheck fix --loop", description: "Fix loop until clean" },
229
254
  ],
230
- related: ["scan", "checkpoint", "ship"],
231
- docsUrl: "https://docs.vibecheckai.dev/cli/fix",
255
+ related: ["scan", "ship", "polish"],
232
256
  },
233
257
 
234
- report: {
235
- description: "Generate HTML/MD/SARIF reports",
236
- longDescription: "Create beautiful, shareable reports from your scan results. Supports multiple formats for different audiences: HTML for stakeholders, Markdown for docs, SARIF for GitHub code scanning.",
237
- tier: "starter",
238
- category: "output",
239
- aliases: ["html", "artifact"],
240
- runner: () => require("./runners/runReport").runReport,
258
+ polish: {
259
+ description: "Production hardening - console removal, dead code, type strengthening",
260
+ longDescription: "Automated code transformations for production readiness. Removes console statements, unused imports, strengthens types, and more - all without requiring an LLM.",
261
+ tier: "pro",
262
+ category: "repair",
263
+ aliases: ["prod", "final", "harden"],
264
+ runner: () => require("./runners/runPolish").runPolish,
241
265
  examples: [
242
- { command: "vibecheck report", description: "Generate HTML report" },
243
- { command: "vibecheck report --format md", description: "Markdown report" },
244
- { command: "vibecheck report --format sarif", description: "SARIF for GitHub" },
245
- { command: "vibecheck report --type executive", description: "Executive summary" },
246
- { command: "vibecheck report --output ./reports", description: "Custom output directory" },
266
+ { command: "vibecheck polish", description: "Dry-run - preview changes" },
267
+ { command: "vibecheck polish --apply", description: "Apply all auto-fixes" },
268
+ { command: "vibecheck polish --passes remove-consoles,dead-code", description: "Run specific passes" },
269
+ { command: "vibecheck polish --safe-only --apply", description: "Apply only safe fixes" },
270
+ { command: "vibecheck polish --list-passes", description: "List available passes" },
247
271
  ],
248
- related: ["scan", "prove"],
249
- docsUrl: "https://docs.vibecheckai.dev/cli/report",
272
+ related: ["ship", "fix", "scan"],
250
273
  },
251
274
 
252
- context: {
253
- description: "Generate IDE rules (.cursorrules, MDC, Windsurf, Copilot)",
254
- longDescription: "Generate project-aware AI coding rules for your IDE. These rules help AI assistants understand your codebase conventions, preventing common mistakes and enforcing patterns.",
255
- tier: "starter",
256
- category: "truth",
257
- aliases: ["rules", "ai-rules", "mdc"],
258
- runner: () => require("./runners/runContext").runContext,
275
+ reality: {
276
+ description: "Playwright browser verification - test runtime behavior",
277
+ longDescription: "Verify your app's runtime behavior with Playwright-powered browser testing. Tests actual API responses, UI behavior, and auth flows.",
278
+ tier: "pro",
279
+ category: "verification",
280
+ aliases: ["browser", "e2e", "playwright"],
281
+ runner: () => require("./runners/runReality").runReality,
259
282
  examples: [
260
- { command: "vibecheck context", description: "Generate all IDE rule formats" },
261
- { command: "vibecheck context --format cursor", description: ".cursorrules only" },
262
- { command: "vibecheck context --format mdc", description: "MDC format (Cursor)" },
263
- { command: "vibecheck context --format copilot", description: "GitHub Copilot instructions" },
283
+ { command: "vibecheck reality --url http://localhost:3000", description: "Test localhost" },
284
+ { command: "vibecheck reality --auth email:pass", description: "With authentication" },
285
+ { command: "vibecheck reality --record", description: "Record video evidence" },
264
286
  ],
265
- related: ["scan", "guard"],
266
- docsUrl: "https://docs.vibecheckai.dev/cli/context",
287
+ related: ["prove", "ship", "ai-test"],
267
288
  },
268
289
 
269
- guard: {
270
- description: "AI guardrails - prompt firewall & hallucination checking",
271
- longDescription: "Validate AI-generated code and prompts. Detects prompt injection attempts, verifies claims against your codebase (hallucination checking), and ensures AI outputs meet your standards.",
272
- tier: "starter",
273
- category: "truth",
274
- aliases: ["ai-guard", "firewall", "validate"],
275
- runner: () => require("./runners/runGuard").runGuard,
290
+ "ai-test": {
291
+ description: "AI agent for autonomous app testing",
292
+ longDescription: "AI-powered autonomous testing that explores your app like a real user. Supports common scenarios like login, checkout, and signup flows.",
293
+ tier: "pro",
294
+ category: "verification",
295
+ aliases: ["agent", "autonomous"],
296
+ runner: () => require("./runners/runAIAgent").runAIAgent,
276
297
  examples: [
277
- { command: "vibecheck guard", description: "Run all guardrail checks" },
278
- { command: "vibecheck guard --claims", description: "Verify AI claims against codebase" },
279
- { command: "vibecheck guard --prompts", description: "Check for prompt injection" },
280
- { command: "vibecheck guard --hallucinations", description: "Detect hallucinated code" },
298
+ { command: "vibecheck ai-test --url http://localhost:3000", description: "Explore app autonomously" },
299
+ { command: "vibecheck ai-test --url http://localhost:3000 --scenario login", description: "Test login flow" },
300
+ { command: "vibecheck ai-test --url http://localhost:3000 --headed", description: "Watch the AI test" },
281
301
  ],
282
- related: ["context", "checkpoint", "fix"],
283
- docsUrl: "https://docs.vibecheckai.dev/cli/guard",
302
+ related: ["reality", "prove"],
284
303
  },
285
304
 
286
- mcp: {
287
- description: "Start MCP server for AI IDEs",
288
- longDescription: "Launch a Model Context Protocol (MCP) server that integrates vibecheck directly into AI IDEs like Cursor. Enables real-time code analysis, fix suggestions, and proof verification within your editor.",
289
- tier: "starter",
305
+ prove: {
306
+ description: "Full proof loop with evidence pack",
307
+ longDescription: "Complete verification cycle: scan + reality check + evidence generation. Creates cryptographically signed proof pack.",
308
+ tier: "pro",
309
+ category: "verification",
310
+ aliases: ["p", "verify", "evidence"],
311
+ runner: () => require("./runners/runProve").runProve,
312
+ examples: [
313
+ { command: "vibecheck prove", description: "Run full proof loop" },
314
+ { command: "vibecheck prove --url http://localhost:3000", description: "With runtime testing" },
315
+ { command: "vibecheck prove --bundle", description: "Generate evidence pack" },
316
+ ],
317
+ related: ["ship", "reality"],
318
+ },
319
+
320
+ gate: {
321
+ description: "CI/CD enforcement - blocks deploys on issues",
322
+ longDescription: "Enforce quality gates in your CI/CD pipeline. Returns exit code 1 on failures to block deployments.",
323
+ tier: "pro",
290
324
  category: "automation",
291
- aliases: [],
292
- runner: () => require("./runners/runMcp").runMcp,
325
+ aliases: ["ci", "enforce", "block"],
326
+ runner: () => require("./runners/runGuard").runGate,
293
327
  examples: [
294
- { command: "vibecheck mcp", description: "Start MCP server" },
295
- { command: "vibecheck mcp --port 3099", description: "Custom port" },
328
+ { command: "vibecheck gate", description: "Run CI gate check" },
329
+ { command: "vibecheck gate --strict", description: "Strict mode (fail on warnings)" },
330
+ { command: "vibecheck gate --threshold 80", description: "Custom score threshold" },
296
331
  ],
297
- related: ["context", "guard"],
298
- docsUrl: "https://docs.vibecheckai.dev/integrations/mcp",
332
+ related: ["ship", "scan"],
299
333
  },
300
334
 
301
- checkpoint: {
302
- description: "Compare baseline vs current, hallucination scoring",
303
- longDescription: "Track changes between scan runs. Detects new issues, resolved issues, and regressions. Includes hallucination scoring to measure drift from your codebase's ground truth.",
304
- tier: "starter",
305
- category: "analysis",
306
- aliases: ["cp", "compare", "diff"],
307
- runner: () => require("./runners/runCheckpoint").runCheckpoint,
335
+ guard: {
336
+ description: "Agent firewall - monitors/blocks AI agent actions",
337
+ longDescription: "AI agent firewall that validates file writes, command execution, and content. Observe mode (FREE) logs violations. Enforce mode (PRO) blocks violations. Protects against forbidden paths, dangerous commands, and hallucination patterns.",
338
+ tier: "free",
339
+ category: "firewall",
340
+ skipAuth: true, // Allow observe mode without authentication
341
+ aliases: ["firewall", "ai-guard"],
342
+ runner: () => require("./runners/runGuard").runGuard,
308
343
  examples: [
309
- { command: "vibecheck checkpoint", description: "Compare against last baseline" },
310
- { command: "vibecheck checkpoint --set", description: "Save current as new baseline" },
311
- { command: "vibecheck checkpoint --score", description: "Calculate hallucination score" },
344
+ { command: "vibecheck guard --init", description: "Initialize firewall config" },
345
+ { command: "vibecheck guard --mode observe --action write --path .env", description: "Check path (observe)" },
346
+ { command: "vibecheck guard --mode enforce --action write --path .env", description: "Block write (PRO)" },
347
+ { command: "vibecheck guard --action execute --command \"rm -rf /\"", description: "Validate command" },
348
+ { command: "vibecheck guard --claims", description: "Verify AI claims (legacy)" },
312
349
  ],
313
- related: ["scan", "fix", "guard"],
314
- docsUrl: "https://docs.vibecheckai.dev/cli/checkpoint",
350
+ related: ["context", "fix", "scan"],
315
351
  },
316
352
 
317
- // ── AUTHORITY SYSTEM (STARTER) ───────────────────────────────
318
- approve: {
319
- description: "Authority verdicts - PROCEED/STOP/DEFER with proofs",
320
- longDescription: "Execute authorities to get structured verdicts with proofs. Part of the Authority System - transforms prompts into enforceable policy engines. Requires STARTER for advisory verdicts, PRO for enforcement.",
321
- tier: "starter",
353
+ "authority.approve": {
354
+ description: "Get authority verdict - APPROVED/REJECTED/PENDING with proofs",
355
+ longDescription: "Request approval from an authority for a specific action. Returns structured verdict with evidence and findings.",
356
+ tier: "pro",
322
357
  category: "authority",
323
- aliases: ["auth-verdict", "authority"],
324
- runner: () => require("./runners/runApprove").runApprove,
358
+ aliases: ["auth-verdict"],
359
+ runner: () => {
360
+ const { runAuthority } = require("./runners/runAuthority");
361
+ return (args, context) => runAuthority(['approve', ...args], context);
362
+ },
325
363
  examples: [
326
- { command: "vibecheck approve safe-consolidation", description: "Run safe-consolidation authority" },
327
- { command: "vibecheck approve --list", description: "List available authorities" },
328
- { command: "vibecheck approve safe-consolidation --json", description: "JSON output for CI" },
329
- { command: "vibecheck approve safe-consolidation --badge", description: "Generate badge for PROCEED", tier: "pro" },
364
+ { command: "vibecheck authority approve --authority security", description: "Security review" },
365
+ { command: "vibecheck authority approve -a security -a quality", description: "Multi-authority" },
366
+ { command: "vibecheck authority approve -a security --json", description: "JSON output" },
330
367
  ],
331
- related: ["classify", "scan", "ship"],
332
- docsUrl: "https://docs.vibecheckai.dev/cli/approve",
368
+ related: ["authority", "authority.list", "ship"],
333
369
  },
334
370
 
335
- // ══════════════════════════════════════════════════════════════
336
- // PRO TIER (3 commands) - Advanced proof & AI testing
337
- // ══════════════════════════════════════════════════════════════
371
+ "conductor.status": {
372
+ description: "Multi-agent coordination status",
373
+ longDescription: "View status of registered AI agents, active locks, and pending proposals.",
374
+ tier: "pro",
375
+ category: "coordination",
376
+ aliases: ["cstatus"],
377
+ runner: () => require("./runners/runConductor").runConductorStatus,
378
+ examples: [
379
+ { command: "vibecheck conductor.status", description: "View coordination status" },
380
+ { command: "vibecheck conductor.status --json", description: "JSON output" },
381
+ ],
382
+ related: ["conductor.register", "conductor.lock"],
383
+ },
338
384
 
339
- reality: {
340
- description: "Runtime proof (browser crawl); use --agent for AI testing",
341
- longDescription: "Browser-based runtime verification. Crawls your app with Playwright, records video/traces/HAR, verifies routes actually work, and captures network evidence. Use --agent for AI-driven autonomous testing.",
385
+ "conductor.register": {
386
+ description: "Register AI agent for coordination",
387
+ longDescription: "Register an AI agent with the conductor for multi-agent coordination.",
342
388
  tier: "pro",
343
- category: "proof",
344
- caps: "--agent for AI autonomous testing",
345
- aliases: ["r", "test", "e2e"],
346
- runner: () => async (args, ctx) => {
347
- const { runRuntime } = require("./runners/runRuntime");
348
- // Check if --agent flag is present to route to agent subcommand
349
- if (args.includes("--agent") || args.includes("-a")) {
350
- const filteredArgs = args.filter(a => a !== "--agent" && a !== "-a");
351
- return await runRuntime(["agent", ...filteredArgs], ctx);
352
- }
353
- return await runRuntime(["crawl", ...args], ctx);
354
- },
389
+ category: "coordination",
390
+ aliases: ["cregister"],
391
+ runner: () => require("./runners/runConductor").runConductorRegister,
355
392
  examples: [
356
- { command: "vibecheck reality --url http://localhost:3000", description: "Crawl and verify routes" },
357
- { command: "vibecheck reality --url http://localhost:3000 --headed", description: "Watch browser in action" },
358
- { command: "vibecheck reality --agent --url http://localhost:3000", description: "AI autonomous testing" },
359
- { command: "vibecheck reality --auth ./auth.json", description: "Test with authentication" },
393
+ { command: "vibecheck conductor.register --name cursor", description: "Register agent" },
360
394
  ],
361
- related: ["prove", "scan", "ship"],
362
- docsUrl: "https://docs.vibecheckai.dev/cli/reality",
395
+ related: ["conductor.status", "conductor.lock"],
363
396
  },
364
397
 
365
- prove: {
366
- description: "One command reality proof - video + network evidence that your app works",
367
- longDescription: "The ultimate verification command. Runs the full 5-step pipeline: context → reality → ship → fix → verify. Generates a complete evidence pack with video recordings, network traces, and proof artifacts. Perfect for audits and stakeholder demos.",
398
+ "conductor.lock": {
399
+ description: "Acquire file lock for exclusive editing",
400
+ longDescription: "Acquire a lock on files for exclusive editing by an AI agent.",
368
401
  tier: "pro",
369
- category: "proof",
370
- aliases: ["p", "full", "all"],
371
- caps: "video, trace, HAR recording; use --bundle for evidence pack",
372
- runner: () => require("./runners/runProve").runProve,
402
+ category: "coordination",
403
+ aliases: ["clock"],
404
+ runner: () => require("./runners/runConductor").runConductorLock,
373
405
  examples: [
374
- { command: "vibecheck prove --url http://localhost:3000", description: "Full proof pipeline" },
375
- { command: "vibecheck prove --url http://localhost:3000 --bundle", description: "Generate shareable evidence pack" },
376
- { command: "vibecheck prove --url http://localhost:3000 --stability-runs 3", description: "Run 3x for stability" },
377
- { command: "vibecheck prove --skip-fix", description: "Skip auto-fix step" },
406
+ { command: "vibecheck conductor.lock src/file.ts", description: "Lock file" },
407
+ { command: "vibecheck conductor.lock --agent cursor src/", description: "Lock directory" },
378
408
  ],
379
- related: ["reality", "scan", "report"],
380
- docsUrl: "https://docs.vibecheckai.dev/cli/prove",
409
+ related: ["conductor.unlock", "conductor.status"],
381
410
  },
382
411
 
383
- polish: {
384
- description: "Production polish analyzer - finds missing essentials",
385
- longDescription: "Deep analysis for production readiness. Checks for missing essentials like error handling, loading states, empty states, accessibility, SEO, performance patterns, and more. Generates a prioritized punch list.",
412
+ "conductor.unlock": {
413
+ description: "Release file lock",
414
+ longDescription: "Release a previously acquired lock on files.",
386
415
  tier: "pro",
387
- category: "quality",
388
- aliases: ["quality", "finalize", "ready"],
389
- runner: () => require("./runners/runPolish").runPolish,
416
+ category: "coordination",
417
+ aliases: ["cunlock"],
418
+ runner: () => require("./runners/runConductor").runConductorUnlock,
390
419
  examples: [
391
- { command: "vibecheck polish", description: "Full production readiness check" },
392
- { command: "vibecheck polish --category accessibility", description: "Focus on a11y" },
393
- { command: "vibecheck polish --category performance", description: "Focus on perf" },
394
- { command: "vibecheck polish --severity high", description: "Only high-priority items" },
420
+ { command: "vibecheck conductor.unlock src/file.ts", description: "Unlock file" },
421
+ { command: "vibecheck conductor.unlock --all", description: "Release all locks" },
395
422
  ],
396
- related: ["scan", "ship", "prove"],
397
- docsUrl: "https://docs.vibecheckai.dev/cli/polish",
423
+ related: ["conductor.lock", "conductor.status"],
424
+ },
425
+
426
+ "conductor.propose": {
427
+ description: "Submit change proposal for review",
428
+ longDescription: "Submit a proposed change for review by the conductor before applying.",
429
+ tier: "pro",
430
+ category: "coordination",
431
+ aliases: ["cpropose"],
432
+ runner: () => require("./runners/runConductor").runConductorPropose,
433
+ examples: [
434
+ { command: "vibecheck conductor.propose --diff changes.patch", description: "Submit proposal" },
435
+ ],
436
+ related: ["conductor.status", "authority.approve"],
398
437
  },
399
438
  };
400
439
 
440
+ // Validate that only allowed commands are defined
401
441
  assertAllowedOnly(COMMANDS);
402
442
 
403
443
  // ─────────────────────────────────────────────────────────────
404
- // DERIVED MAPS
444
+ // TIER HELPERS
445
+ // ─────────────────────────────────────────────────────────────
446
+ function isPro(tier) {
447
+ return tier === "pro";
448
+ }
449
+
450
+ function requiresPro(commandName) {
451
+ const cmd = COMMANDS[commandName];
452
+ return cmd && cmd.tier === "pro";
453
+ }
454
+
455
+ function getFreeCommands() {
456
+ return Object.entries(COMMANDS)
457
+ .filter(([, cmd]) => cmd.tier === "free")
458
+ .map(([name]) => name);
459
+ }
460
+
461
+ function getProCommands() {
462
+ return Object.entries(COMMANDS)
463
+ .filter(([, cmd]) => cmd.tier === "pro")
464
+ .map(([name]) => name);
465
+ }
466
+
467
+ // ─────────────────────────────────────────────────────────────
468
+ // BUILD DERIVED DATA STRUCTURES
405
469
  // ─────────────────────────────────────────────────────────────
470
+
471
+ // Build alias map: { alias -> command }
406
472
  const ALIAS_MAP = {};
407
- for (const [cmd, def] of Object.entries(COMMANDS)) {
408
- for (const alias of def.aliases || []) ALIAS_MAP[alias] = cmd;
473
+ for (const [cmdName, cmd] of Object.entries(COMMANDS)) {
474
+ if (cmd.aliases) {
475
+ for (const alias of cmd.aliases) {
476
+ ALIAS_MAP[alias] = cmdName;
477
+ }
478
+ }
409
479
  }
410
480
 
411
- const ALL_COMMANDS = [
481
+ // All command names including aliases
482
+ const ALL_COMMANDS = new Set([
412
483
  ...Object.keys(COMMANDS),
413
- ...Object.values(COMMANDS).flatMap((c) => c.aliases || []),
414
- ];
484
+ ...Object.keys(ALIAS_MAP),
485
+ ]);
415
486
 
416
487
  // ─────────────────────────────────────────────────────────────
417
- // RUNNER LOADER
488
+ // GETTERS
418
489
  // ─────────────────────────────────────────────────────────────
419
- function getRunner(cmd, styles = {}) {
420
- const def = COMMANDS[cmd];
421
- if (!def) return null;
422
-
423
- const red = styles.red || "";
424
- const reset = styles.reset || "";
425
- const errorSym = styles.errorSymbol || "✗";
426
490
 
491
+ function getRunner(cmd, opts = {}) {
492
+ // Resolve alias to canonical command
493
+ const canonicalCmd = ALIAS_MAP[cmd] || cmd;
494
+ const def = COMMANDS[canonicalCmd];
495
+
496
+ if (!def) {
497
+ return null;
498
+ }
499
+
500
+ if (!def.runner) {
501
+ return null;
502
+ }
503
+
427
504
  try {
428
505
  return def.runner();
429
506
  } catch (e) {
430
- return async () => {
431
- console.error(`${red}${errorSym}${reset} Failed to load ${cmd}: ${e.message}`);
432
- return 1;
433
- };
507
+ if (opts.red && opts.reset) {
508
+ console.error(`${opts.red}${opts.errorSymbol || '×'} Failed to load runner for ${cmd}: ${e.message}${opts.reset}`);
509
+ }
510
+ return null;
511
+ }
512
+ }
513
+
514
+ function getCommand(name) {
515
+ // Check direct name
516
+ if (COMMANDS[name]) return COMMANDS[name];
517
+
518
+ // Check alias map
519
+ const canonical = ALIAS_MAP[name];
520
+ if (canonical && COMMANDS[canonical]) {
521
+ return { ...COMMANDS[canonical], _resolvedFrom: name, _canonicalName: canonical };
434
522
  }
523
+
524
+ return null;
435
525
  }
436
526
 
527
+ function resolveCommand(name) {
528
+ return ALIAS_MAP[name] || name;
529
+ }
530
+
531
+ // ─────────────────────────────────────────────────────────────
532
+ // EXPORTS
533
+ // ─────────────────────────────────────────────────────────────
437
534
  module.exports = {
535
+ // Core data
438
536
  COMMANDS,
537
+ ALLOWED_COMMANDS,
439
538
  ALIAS_MAP,
440
539
  ALL_COMMANDS,
540
+
541
+ // Tier helpers
542
+ isPro,
543
+ requiresPro,
544
+ getFreeCommands,
545
+ getProCommands,
546
+
547
+ // Getters
441
548
  getRunner,
549
+ getCommand,
550
+ resolveCommand,
551
+ listCommands: () => Object.keys(COMMANDS),
552
+
553
+ getCommandsByTier: (tier) =>
554
+ Object.entries(COMMANDS)
555
+ .filter(([, cmd]) => cmd.tier === tier)
556
+ .map(([name, cmd]) => ({ name, ...cmd })),
557
+
558
+ getCommandsByCategory: (category) =>
559
+ Object.entries(COMMANDS)
560
+ .filter(([, cmd]) => cmd.category === category)
561
+ .map(([name, cmd]) => ({ name, ...cmd })),
442
562
  };