@vibecheckai/cli 3.5.0 → 3.5.2

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 (224) hide show
  1. package/bin/registry.js +214 -237
  2. package/bin/runners/cli-utils.js +33 -2
  3. package/bin/runners/context/analyzer.js +52 -1
  4. package/bin/runners/context/generators/cursor.js +2 -49
  5. package/bin/runners/context/git-context.js +3 -1
  6. package/bin/runners/context/team-conventions.js +33 -7
  7. package/bin/runners/lib/analysis-core.js +25 -5
  8. package/bin/runners/lib/analyzers.js +431 -481
  9. package/bin/runners/lib/default-config.js +127 -0
  10. package/bin/runners/lib/doctor/modules/security.js +3 -1
  11. package/bin/runners/lib/engine/ast-cache.js +210 -0
  12. package/bin/runners/lib/engine/auth-extractor.js +211 -0
  13. package/bin/runners/lib/engine/billing-extractor.js +112 -0
  14. package/bin/runners/lib/engine/enforcement-extractor.js +100 -0
  15. package/bin/runners/lib/engine/env-extractor.js +207 -0
  16. package/bin/runners/lib/engine/express-extractor.js +208 -0
  17. package/bin/runners/lib/engine/extractors.js +849 -0
  18. package/bin/runners/lib/engine/index.js +207 -0
  19. package/bin/runners/lib/engine/repo-index.js +514 -0
  20. package/bin/runners/lib/engine/types.js +124 -0
  21. package/bin/runners/lib/engines/accessibility-engine.js +18 -218
  22. package/bin/runners/lib/engines/api-consistency-engine.js +30 -335
  23. package/bin/runners/lib/engines/cross-file-analysis-engine.js +27 -292
  24. package/bin/runners/lib/engines/empty-catch-engine.js +17 -127
  25. package/bin/runners/lib/engines/mock-data-engine.js +10 -53
  26. package/bin/runners/lib/engines/performance-issues-engine.js +36 -176
  27. package/bin/runners/lib/engines/security-vulnerabilities-engine.js +54 -382
  28. package/bin/runners/lib/engines/type-aware-engine.js +39 -263
  29. package/bin/runners/lib/engines/vibecheck-engines/index.js +13 -122
  30. package/bin/runners/lib/engines/vibecheck-engines/lib/ast-cache.js +164 -0
  31. package/bin/runners/lib/engines/vibecheck-engines/lib/code-quality-engine.js +291 -0
  32. package/bin/runners/lib/engines/vibecheck-engines/lib/console-logs-engine.js +83 -0
  33. package/bin/runners/lib/engines/vibecheck-engines/lib/dead-code-engine.js +198 -0
  34. package/bin/runners/lib/engines/vibecheck-engines/lib/deprecated-api-engine.js +275 -0
  35. package/bin/runners/lib/engines/vibecheck-engines/lib/empty-catch-engine.js +167 -0
  36. package/bin/runners/lib/engines/vibecheck-engines/lib/file-filter.js +217 -0
  37. package/bin/runners/lib/engines/vibecheck-engines/lib/hardcoded-secrets-engine.js +73 -373
  38. package/bin/runners/lib/engines/vibecheck-engines/lib/mock-data-engine.js +140 -0
  39. package/bin/runners/lib/engines/vibecheck-engines/lib/parallel-processor.js +164 -0
  40. package/bin/runners/lib/engines/vibecheck-engines/lib/performance-issues-engine.js +234 -0
  41. package/bin/runners/lib/engines/vibecheck-engines/lib/type-aware-engine.js +217 -0
  42. package/bin/runners/lib/engines/vibecheck-engines/lib/unsafe-regex-engine.js +78 -0
  43. package/bin/runners/lib/entitlements-v2.js +73 -97
  44. package/bin/runners/lib/error-handler.js +44 -3
  45. package/bin/runners/lib/error-messages.js +289 -0
  46. package/bin/runners/lib/evidence-pack.js +7 -1
  47. package/bin/runners/lib/finding-id.js +69 -0
  48. package/bin/runners/lib/finding-sorter.js +89 -0
  49. package/bin/runners/lib/html-proof-report.js +700 -350
  50. package/bin/runners/lib/missions/plan.js +6 -46
  51. package/bin/runners/lib/missions/templates.js +0 -232
  52. package/bin/runners/lib/next-action.js +560 -0
  53. package/bin/runners/lib/prerequisites.js +149 -0
  54. package/bin/runners/lib/route-detection.js +137 -68
  55. package/bin/runners/lib/scan-output.js +91 -76
  56. package/bin/runners/lib/scan-runner.js +135 -0
  57. package/bin/runners/lib/schemas/ajv-validator.js +464 -0
  58. package/bin/runners/lib/schemas/error-envelope.schema.json +105 -0
  59. package/bin/runners/lib/schemas/finding-v3.schema.json +151 -0
  60. package/bin/runners/lib/schemas/report-artifact.schema.json +120 -0
  61. package/bin/runners/lib/schemas/run-request.schema.json +108 -0
  62. package/bin/runners/lib/schemas/validator.js +27 -0
  63. package/bin/runners/lib/schemas/verdict.schema.json +140 -0
  64. package/bin/runners/lib/ship-output-enterprise.js +23 -23
  65. package/bin/runners/lib/ship-output.js +75 -31
  66. package/bin/runners/lib/terminal-ui.js +6 -113
  67. package/bin/runners/lib/truth.js +351 -10
  68. package/bin/runners/lib/unified-cli-output.js +430 -603
  69. package/bin/runners/lib/unified-output.js +13 -9
  70. package/bin/runners/runAIAgent.js +10 -5
  71. package/bin/runners/runAgent.js +0 -3
  72. package/bin/runners/runAllowlist.js +389 -0
  73. package/bin/runners/runApprove.js +0 -33
  74. package/bin/runners/runAuth.js +73 -45
  75. package/bin/runners/runCheckpoint.js +51 -11
  76. package/bin/runners/runClassify.js +85 -21
  77. package/bin/runners/runContext.js +0 -3
  78. package/bin/runners/runDoctor.js +41 -28
  79. package/bin/runners/runEvidencePack.js +362 -0
  80. package/bin/runners/runFirewall.js +0 -3
  81. package/bin/runners/runFirewallHook.js +0 -3
  82. package/bin/runners/runFix.js +66 -76
  83. package/bin/runners/runGuard.js +18 -411
  84. package/bin/runners/runInit.js +113 -30
  85. package/bin/runners/runLabs.js +424 -0
  86. package/bin/runners/runMcp.js +19 -25
  87. package/bin/runners/runPolish.js +64 -240
  88. package/bin/runners/runPromptFirewall.js +12 -5
  89. package/bin/runners/runProve.js +57 -22
  90. package/bin/runners/runQuickstart.js +531 -0
  91. package/bin/runners/runReality.js +59 -68
  92. package/bin/runners/runReport.js +38 -33
  93. package/bin/runners/runRuntime.js +8 -5
  94. package/bin/runners/runScan.js +1413 -190
  95. package/bin/runners/runShip.js +113 -719
  96. package/bin/runners/runTruth.js +0 -3
  97. package/bin/runners/runValidate.js +13 -9
  98. package/bin/runners/runWatch.js +23 -14
  99. package/bin/scan.js +6 -1
  100. package/bin/vibecheck.js +204 -185
  101. package/mcp-server/deprecation-middleware.js +282 -0
  102. package/mcp-server/handlers/index.ts +15 -0
  103. package/mcp-server/handlers/tool-handler.ts +554 -0
  104. package/mcp-server/index-v1.js +698 -0
  105. package/mcp-server/index.js +210 -238
  106. package/mcp-server/lib/cache-wrapper.cjs +383 -0
  107. package/mcp-server/lib/error-envelope.js +138 -0
  108. package/mcp-server/lib/executor.ts +499 -0
  109. package/mcp-server/lib/index.ts +19 -0
  110. package/mcp-server/lib/rate-limiter.js +166 -0
  111. package/mcp-server/lib/sandbox.test.ts +519 -0
  112. package/mcp-server/lib/sandbox.ts +395 -0
  113. package/mcp-server/lib/types.ts +267 -0
  114. package/mcp-server/package.json +12 -3
  115. package/mcp-server/registry/tool-registry.js +794 -0
  116. package/mcp-server/registry/tools.json +605 -0
  117. package/mcp-server/registry.test.ts +334 -0
  118. package/mcp-server/tests/tier-gating.test.js +297 -0
  119. package/mcp-server/tier-auth.js +378 -45
  120. package/mcp-server/tools-v3.js +353 -442
  121. package/mcp-server/tsconfig.json +37 -0
  122. package/mcp-server/vibecheck-2.0-tools.js +14 -1
  123. package/package.json +1 -1
  124. package/bin/runners/lib/agent-firewall/learning/learning-engine.js +0 -849
  125. package/bin/runners/lib/audit-logger.js +0 -532
  126. package/bin/runners/lib/authority/authorities/architecture.js +0 -364
  127. package/bin/runners/lib/authority/authorities/compliance.js +0 -341
  128. package/bin/runners/lib/authority/authorities/human.js +0 -343
  129. package/bin/runners/lib/authority/authorities/quality.js +0 -420
  130. package/bin/runners/lib/authority/authorities/security.js +0 -228
  131. package/bin/runners/lib/authority/index.js +0 -293
  132. package/bin/runners/lib/bundle/bundle-intelligence.js +0 -846
  133. package/bin/runners/lib/cli-charts.js +0 -368
  134. package/bin/runners/lib/cli-config-display.js +0 -405
  135. package/bin/runners/lib/cli-demo.js +0 -275
  136. package/bin/runners/lib/cli-errors.js +0 -438
  137. package/bin/runners/lib/cli-help-formatter.js +0 -439
  138. package/bin/runners/lib/cli-interactive-menu.js +0 -509
  139. package/bin/runners/lib/cli-prompts.js +0 -441
  140. package/bin/runners/lib/cli-scan-cards.js +0 -362
  141. package/bin/runners/lib/compliance-reporter.js +0 -710
  142. package/bin/runners/lib/conductor/index.js +0 -671
  143. package/bin/runners/lib/easy/README.md +0 -123
  144. package/bin/runners/lib/easy/index.js +0 -140
  145. package/bin/runners/lib/easy/interactive-wizard.js +0 -788
  146. package/bin/runners/lib/easy/one-click-firewall.js +0 -564
  147. package/bin/runners/lib/easy/zero-config-reality.js +0 -714
  148. package/bin/runners/lib/engines/async-patterns-engine.js +0 -444
  149. package/bin/runners/lib/engines/bundle-size-engine.js +0 -433
  150. package/bin/runners/lib/engines/confidence-scoring.js +0 -276
  151. package/bin/runners/lib/engines/context-detection.js +0 -264
  152. package/bin/runners/lib/engines/database-patterns-engine.js +0 -429
  153. package/bin/runners/lib/engines/duplicate-code-engine.js +0 -354
  154. package/bin/runners/lib/engines/env-variables-engine.js +0 -458
  155. package/bin/runners/lib/engines/error-handling-engine.js +0 -437
  156. package/bin/runners/lib/engines/false-positive-prevention.js +0 -630
  157. package/bin/runners/lib/engines/framework-adapters/index.js +0 -607
  158. package/bin/runners/lib/engines/framework-detection.js +0 -508
  159. package/bin/runners/lib/engines/import-order-engine.js +0 -429
  160. package/bin/runners/lib/engines/naming-conventions-engine.js +0 -544
  161. package/bin/runners/lib/engines/noise-reduction-engine.js +0 -452
  162. package/bin/runners/lib/engines/orchestrator.js +0 -334
  163. package/bin/runners/lib/engines/react-patterns-engine.js +0 -457
  164. package/bin/runners/lib/engines/vibecheck-engines/lib/ai-hallucination-engine.js +0 -806
  165. package/bin/runners/lib/engines/vibecheck-engines/lib/smart-fix-engine.js +0 -577
  166. package/bin/runners/lib/engines/vibecheck-engines/lib/vibe-score-engine.js +0 -543
  167. package/bin/runners/lib/engines/vibecheck-engines.js +0 -514
  168. package/bin/runners/lib/enhanced-features/index.js +0 -305
  169. package/bin/runners/lib/enhanced-output.js +0 -631
  170. package/bin/runners/lib/enterprise.js +0 -300
  171. package/bin/runners/lib/firewall/command-validator.js +0 -351
  172. package/bin/runners/lib/firewall/config.js +0 -341
  173. package/bin/runners/lib/firewall/content-validator.js +0 -519
  174. package/bin/runners/lib/firewall/index.js +0 -101
  175. package/bin/runners/lib/firewall/path-validator.js +0 -256
  176. package/bin/runners/lib/intelligence/cross-repo-intelligence.js +0 -817
  177. package/bin/runners/lib/mcp-utils.js +0 -425
  178. package/bin/runners/lib/output/index.js +0 -1022
  179. package/bin/runners/lib/policy-engine.js +0 -652
  180. package/bin/runners/lib/polish/autofix/accessibility-fixes.js +0 -333
  181. package/bin/runners/lib/polish/autofix/async-handlers.js +0 -273
  182. package/bin/runners/lib/polish/autofix/dead-code.js +0 -280
  183. package/bin/runners/lib/polish/autofix/imports-optimizer.js +0 -344
  184. package/bin/runners/lib/polish/autofix/index.js +0 -200
  185. package/bin/runners/lib/polish/autofix/remove-consoles.js +0 -209
  186. package/bin/runners/lib/polish/autofix/strengthen-types.js +0 -245
  187. package/bin/runners/lib/polish/backend-checks.js +0 -148
  188. package/bin/runners/lib/polish/documentation-checks.js +0 -111
  189. package/bin/runners/lib/polish/frontend-checks.js +0 -168
  190. package/bin/runners/lib/polish/index.js +0 -71
  191. package/bin/runners/lib/polish/infrastructure-checks.js +0 -131
  192. package/bin/runners/lib/polish/library-detection.js +0 -175
  193. package/bin/runners/lib/polish/performance-checks.js +0 -100
  194. package/bin/runners/lib/polish/security-checks.js +0 -148
  195. package/bin/runners/lib/polish/utils.js +0 -203
  196. package/bin/runners/lib/prompt-builder.js +0 -540
  197. package/bin/runners/lib/proof-certificate.js +0 -634
  198. package/bin/runners/lib/reality/accessibility-audit.js +0 -946
  199. package/bin/runners/lib/reality/api-contract-validator.js +0 -1012
  200. package/bin/runners/lib/reality/chaos-engineering.js +0 -1084
  201. package/bin/runners/lib/reality/performance-tracker.js +0 -1077
  202. package/bin/runners/lib/reality/scenario-generator.js +0 -1404
  203. package/bin/runners/lib/reality/visual-regression.js +0 -852
  204. package/bin/runners/lib/reality-profiler.js +0 -717
  205. package/bin/runners/lib/replay/flight-recorder-viewer.js +0 -1160
  206. package/bin/runners/lib/review/ai-code-review.js +0 -832
  207. package/bin/runners/lib/rules/custom-rule-engine.js +0 -985
  208. package/bin/runners/lib/sbom-generator.js +0 -641
  209. package/bin/runners/lib/scan-output-enhanced.js +0 -512
  210. package/bin/runners/lib/security/owasp-scanner.js +0 -939
  211. package/bin/runners/lib/validators/contract-validator.js +0 -283
  212. package/bin/runners/lib/validators/dead-export-detector.js +0 -279
  213. package/bin/runners/lib/validators/dep-audit.js +0 -245
  214. package/bin/runners/lib/validators/env-validator.js +0 -319
  215. package/bin/runners/lib/validators/index.js +0 -120
  216. package/bin/runners/lib/validators/license-checker.js +0 -252
  217. package/bin/runners/lib/validators/route-validator.js +0 -290
  218. package/bin/runners/runAuthority.js +0 -528
  219. package/bin/runners/runConductor.js +0 -772
  220. package/bin/runners/runContainer.js +0 -366
  221. package/bin/runners/runEasy.js +0 -410
  222. package/bin/runners/runIaC.js +0 -372
  223. package/bin/runners/runVibe.js +0 -791
  224. package/mcp-server/tools.js +0 -495
@@ -1,405 +0,0 @@
1
- /**
2
- * CLI Config Display - Beautiful configuration display for Vibecheck CLI
3
- *
4
- * Provides:
5
- * - Config file visualization
6
- * - Environment variable display
7
- * - Project info cards
8
- * - Dependency trees
9
- * - Settings panels
10
- */
11
-
12
- "use strict";
13
-
14
- const {
15
- ansi,
16
- sym,
17
- box,
18
- padRight,
19
- padLeft,
20
- center,
21
- truncate,
22
- visibleLength,
23
- getTierBadge,
24
- formatBytes,
25
- } = require("./unified-cli-output");
26
-
27
- // ═══════════════════════════════════════════════════════════════════════════════
28
- // PROJECT INFO CARD
29
- // ═══════════════════════════════════════════════════════════════════════════════
30
-
31
- /**
32
- * Display a project info card
33
- * @param {Object} info - Project information
34
- */
35
- function projectCard(info) {
36
- const {
37
- name,
38
- version,
39
- description,
40
- path,
41
- framework,
42
- language,
43
- packageManager,
44
- nodeVersion,
45
- } = info;
46
-
47
- const width = 60;
48
- const lines = [];
49
-
50
- lines.push(` ${ansi.gray}${box.rTopLeft}${box.horizontal.repeat(width - 2)}${box.rTopRight}${ansi.reset}`);
51
-
52
- // Name and version
53
- const titleLine = `${ansi.bold}${name}${ansi.reset}${version ? ` ${ansi.dim}v${version}${ansi.reset}` : ''}`;
54
- lines.push(` ${ansi.gray}${box.vertical}${ansi.reset} ${sym.folder} ${titleLine}${' '.repeat(width - visibleLength(titleLine) - 6)}${ansi.gray}${box.vertical}${ansi.reset}`);
55
-
56
- // Description
57
- if (description) {
58
- const desc = truncate(description, width - 6);
59
- lines.push(` ${ansi.gray}${box.vertical}${ansi.reset} ${ansi.dim}${desc}${ansi.reset}${' '.repeat(width - desc.length - 6)}${ansi.gray}${box.vertical}${ansi.reset}`);
60
- }
61
-
62
- lines.push(` ${ansi.gray}${box.vertical}${box.horizontal.repeat(width - 2)}${box.vertical}${ansi.reset}`);
63
-
64
- // Info rows
65
- const rows = [];
66
- if (framework) rows.push({ label: 'Framework', value: framework });
67
- if (language) rows.push({ label: 'Language', value: language });
68
- if (packageManager) rows.push({ label: 'Package Manager', value: packageManager });
69
- if (nodeVersion) rows.push({ label: 'Node.js', value: nodeVersion });
70
- if (path) rows.push({ label: 'Path', value: truncate(path, 35) });
71
-
72
- for (const row of rows) {
73
- const label = padRight(row.label, 18);
74
- const value = truncate(String(row.value), 35);
75
- lines.push(` ${ansi.gray}${box.vertical}${ansi.reset} ${ansi.gray}${label}${ansi.reset}${value}${' '.repeat(width - 20 - value.length)}${ansi.gray}${box.vertical}${ansi.reset}`);
76
- }
77
-
78
- lines.push(` ${ansi.gray}${box.rBottomLeft}${box.horizontal.repeat(width - 2)}${box.rBottomRight}${ansi.reset}`);
79
-
80
- return lines.join('\n');
81
- }
82
-
83
- // ═══════════════════════════════════════════════════════════════════════════════
84
- // CONFIG FILE DISPLAY
85
- // ═══════════════════════════════════════════════════════════════════════════════
86
-
87
- /**
88
- * Display config file contents
89
- * @param {Object} config - Configuration object
90
- * @param {Object} options
91
- */
92
- function configDisplay(config, options = {}) {
93
- const { title = 'Configuration', showDefaults = false, maxDepth = 3 } = options;
94
- const lines = [];
95
-
96
- lines.push(`\n ${ansi.bold}${title}${ansi.reset}`);
97
- lines.push(` ${ansi.gray}${box.horizontal.repeat(50)}${ansi.reset}`);
98
-
99
- function renderValue(value, depth = 0) {
100
- const indent = ' '.repeat(depth + 1);
101
-
102
- if (value === null) return `${ansi.dim}null${ansi.reset}`;
103
- if (value === undefined) return `${ansi.dim}undefined${ansi.reset}`;
104
- if (typeof value === 'boolean') return value ? `${ansi.green}true${ansi.reset}` : `${ansi.red}false${ansi.reset}`;
105
- if (typeof value === 'number') return `${ansi.cyan}${value}${ansi.reset}`;
106
- if (typeof value === 'string') {
107
- if (value.startsWith('http')) return `${ansi.blue}${value}${ansi.reset}`;
108
- if (value.includes('/') || value.includes('\\')) return `${ansi.yellow}${value}${ansi.reset}`;
109
- return `${ansi.green}"${value}"${ansi.reset}`;
110
- }
111
- if (Array.isArray(value)) {
112
- if (value.length === 0) return `${ansi.dim}[]${ansi.reset}`;
113
- if (depth >= maxDepth) return `${ansi.dim}[${value.length} items]${ansi.reset}`;
114
- return `[${value.map(v => renderValue(v, depth)).join(', ')}]`;
115
- }
116
- if (typeof value === 'object') {
117
- if (Object.keys(value).length === 0) return `${ansi.dim}{}${ansi.reset}`;
118
- if (depth >= maxDepth) return `${ansi.dim}{...}${ansi.reset}`;
119
- return null; // Will be expanded
120
- }
121
- return String(value);
122
- }
123
-
124
- function renderObject(obj, depth = 0) {
125
- const indent = ' '.repeat(depth + 1);
126
-
127
- for (const [key, value] of Object.entries(obj)) {
128
- const rendered = renderValue(value, depth);
129
-
130
- if (rendered !== null) {
131
- lines.push(`${indent}${ansi.gray}${key}:${ansi.reset} ${rendered}`);
132
- } else {
133
- lines.push(`${indent}${ansi.gray}${key}:${ansi.reset}`);
134
- renderObject(value, depth + 1);
135
- }
136
- }
137
- }
138
-
139
- renderObject(config);
140
- lines.push('');
141
-
142
- return lines.join('\n');
143
- }
144
-
145
- // ═══════════════════════════════════════════════════════════════════════════════
146
- // ENVIRONMENT VARIABLES DISPLAY
147
- // ═══════════════════════════════════════════════════════════════════════════════
148
-
149
- /**
150
- * Display environment variables
151
- * @param {Object} env - Environment variables
152
- * @param {Object} options
153
- */
154
- function envDisplay(env, options = {}) {
155
- const { title = 'Environment Variables', maskSecrets = true } = options;
156
- const lines = [];
157
-
158
- const secretPatterns = ['key', 'secret', 'token', 'password', 'api_key', 'auth'];
159
-
160
- lines.push(`\n ${ansi.bold}${title}${ansi.reset}`);
161
- lines.push(` ${ansi.gray}${box.horizontal.repeat(60)}${ansi.reset}`);
162
-
163
- for (const [key, value] of Object.entries(env)) {
164
- const isSecret = maskSecrets && secretPatterns.some(p => key.toLowerCase().includes(p));
165
- const displayValue = isSecret
166
- ? `${ansi.dim}${'*'.repeat(Math.min(value.length, 20))}${ansi.reset}`
167
- : value.length > 40
168
- ? `${truncate(value, 40)}${ansi.dim}...${ansi.reset}`
169
- : value;
170
-
171
- const icon = isSecret ? sym.lock : ' ';
172
- lines.push(` ${icon} ${ansi.cyan}${padRight(key, 30)}${ansi.reset} ${displayValue}`);
173
- }
174
-
175
- lines.push('');
176
- return lines.join('\n');
177
- }
178
-
179
- // ═══════════════════════════════════════════════════════════════════════════════
180
- // DEPENDENCY TREE
181
- // ═══════════════════════════════════════════════════════════════════════════════
182
-
183
- /**
184
- * Display dependency tree
185
- * @param {Object} deps - Dependencies object
186
- * @param {Object} options
187
- */
188
- function dependencyTree(deps, options = {}) {
189
- const {
190
- title = 'Dependencies',
191
- showVersion = true,
192
- maxDisplay = 20,
193
- categorize = false,
194
- } = options;
195
-
196
- const lines = [];
197
-
198
- lines.push(`\n ${ansi.bold}${title}${ansi.reset}`);
199
- lines.push(` ${ansi.gray}${box.horizontal.repeat(50)}${ansi.reset}`);
200
-
201
- const entries = Object.entries(deps);
202
- const displayEntries = entries.slice(0, maxDisplay);
203
-
204
- if (categorize) {
205
- // Categorize by type
206
- const categories = {
207
- 'vibecheck': [],
208
- 'framework': [],
209
- 'other': [],
210
- };
211
-
212
- for (const [name, version] of displayEntries) {
213
- if (name.includes('vibecheck') || name.includes('vibecheckai')) {
214
- categories.vibecheck.push([name, version]);
215
- } else if (['react', 'vue', 'angular', 'next', 'nuxt', 'express', 'fastify'].some(f => name.includes(f))) {
216
- categories.framework.push([name, version]);
217
- } else {
218
- categories.other.push([name, version]);
219
- }
220
- }
221
-
222
- for (const [category, items] of Object.entries(categories)) {
223
- if (items.length === 0) continue;
224
- lines.push(`\n ${ansi.dim}${category}${ansi.reset}`);
225
- for (const [name, version] of items) {
226
- const versionStr = showVersion ? ` ${ansi.dim}${version}${ansi.reset}` : '';
227
- lines.push(` ${sym.bullet} ${ansi.cyan}${name}${ansi.reset}${versionStr}`);
228
- }
229
- }
230
- } else {
231
- for (const [name, version] of displayEntries) {
232
- const versionStr = showVersion ? ` ${ansi.dim}${version}${ansi.reset}` : '';
233
- lines.push(` ${sym.bullet} ${ansi.cyan}${name}${ansi.reset}${versionStr}`);
234
- }
235
- }
236
-
237
- if (entries.length > maxDisplay) {
238
- lines.push(` ${ansi.dim}... and ${entries.length - maxDisplay} more${ansi.reset}`);
239
- }
240
-
241
- lines.push('');
242
- return lines.join('\n');
243
- }
244
-
245
- // ═══════════════════════════════════════════════════════════════════════════════
246
- // SETTINGS PANEL
247
- // ═══════════════════════════════════════════════════════════════════════════════
248
-
249
- /**
250
- * Display settings panel
251
- * @param {Array<{label: string, value: any, enabled?: boolean}>} settings
252
- */
253
- function settingsPanel(settings, options = {}) {
254
- const { title = 'Settings' } = options;
255
- const lines = [];
256
- const width = 55;
257
-
258
- lines.push(`\n ${ansi.gray}${box.topLeft}${box.horizontal.repeat(width - 2)}${box.topRight}${ansi.reset}`);
259
- lines.push(` ${ansi.gray}${box.vertical}${ansi.reset} ${ansi.bold}${title}${ansi.reset}${' '.repeat(width - title.length - 4)}${ansi.gray}${box.vertical}${ansi.reset}`);
260
- lines.push(` ${ansi.gray}${box.vertical}${box.horizontal.repeat(width - 2)}${box.vertical}${ansi.reset}`);
261
-
262
- for (const setting of settings) {
263
- const enabled = setting.enabled !== undefined ? setting.enabled : true;
264
- const statusIcon = enabled
265
- ? `${ansi.green}${sym.check}${ansi.reset}`
266
- : `${ansi.red}${sym.cross}${ansi.reset}`;
267
-
268
- let valueStr;
269
- if (typeof setting.value === 'boolean') {
270
- valueStr = setting.value ? `${ansi.green}On${ansi.reset}` : `${ansi.dim}Off${ansi.reset}`;
271
- } else {
272
- valueStr = `${ansi.cyan}${setting.value}${ansi.reset}`;
273
- }
274
-
275
- const label = padRight(setting.label, 25);
276
- lines.push(` ${ansi.gray}${box.vertical}${ansi.reset} ${statusIcon} ${label} ${valueStr}${' '.repeat(width - 35 - visibleLength(valueStr))}${ansi.gray}${box.vertical}${ansi.reset}`);
277
- }
278
-
279
- lines.push(` ${ansi.gray}${box.bottomLeft}${box.horizontal.repeat(width - 2)}${box.bottomRight}${ansi.reset}`);
280
- lines.push('');
281
-
282
- return lines.join('\n');
283
- }
284
-
285
- // ═══════════════════════════════════════════════════════════════════════════════
286
- // FILE STATS DISPLAY
287
- // ═══════════════════════════════════════════════════════════════════════════════
288
-
289
- /**
290
- * Display file statistics
291
- * @param {Object} stats - File statistics
292
- */
293
- function fileStats(stats) {
294
- const {
295
- totalFiles,
296
- totalLines,
297
- totalSize,
298
- byExtension,
299
- largest,
300
- } = stats;
301
-
302
- const lines = [];
303
-
304
- lines.push(`\n ${ansi.bold}File Statistics${ansi.reset}`);
305
- lines.push(` ${ansi.gray}${box.horizontal.repeat(50)}${ansi.reset}`);
306
-
307
- lines.push(` ${sym.file} Total Files: ${ansi.bold}${totalFiles}${ansi.reset}`);
308
- if (totalLines) lines.push(` ${sym.file} Total Lines: ${ansi.bold}${totalLines.toLocaleString()}${ansi.reset}`);
309
- if (totalSize) lines.push(` ${sym.package} Total Size: ${ansi.bold}${formatBytes(totalSize)}${ansi.reset}`);
310
-
311
- if (byExtension && Object.keys(byExtension).length > 0) {
312
- lines.push('');
313
- lines.push(` ${ansi.dim}By Extension:${ansi.reset}`);
314
-
315
- const sorted = Object.entries(byExtension)
316
- .sort((a, b) => b[1] - a[1])
317
- .slice(0, 10);
318
-
319
- const maxCount = sorted[0]?.[1] || 1;
320
-
321
- for (const [ext, count] of sorted) {
322
- const barWidth = Math.round((count / maxCount) * 20);
323
- const bar = `${ansi.cyan}${'█'.repeat(barWidth)}${ansi.gray}${'░'.repeat(20 - barWidth)}${ansi.reset}`;
324
- lines.push(` ${padRight(ext, 10)} ${bar} ${ansi.bold}${count}${ansi.reset}`);
325
- }
326
- }
327
-
328
- if (largest && largest.length > 0) {
329
- lines.push('');
330
- lines.push(` ${ansi.dim}Largest Files:${ansi.reset}`);
331
- for (const file of largest.slice(0, 5)) {
332
- lines.push(` ${sym.file} ${truncate(file.path, 35)} ${ansi.dim}(${formatBytes(file.size)})${ansi.reset}`);
333
- }
334
- }
335
-
336
- lines.push('');
337
- return lines.join('\n');
338
- }
339
-
340
- // ═══════════════════════════════════════════════════════════════════════════════
341
- // TIER COMPARISON
342
- // ═══════════════════════════════════════════════════════════════════════════════
343
-
344
- /**
345
- * Display tier comparison
346
- * @param {string} currentTier - Current tier
347
- */
348
- function tierComparison(currentTier = 'free') {
349
- const tiers = [
350
- { name: 'free', features: ['Basic scanning', 'CLI access', '10 scans/day'] },
351
- { name: 'starter', features: ['Auto-fix suggestions', 'AI explanations', 'Unlimited scans', 'Badge generation'] },
352
- { name: 'pro', features: ['Reality proof', 'CI/CD integration', 'Team features', 'Priority support'] },
353
- { name: 'enterprise', features: ['SSO/SAML', 'Custom rules', 'SLA', 'Dedicated support'] },
354
- ];
355
-
356
- const lines = [];
357
- const colWidth = 18;
358
-
359
- lines.push(`\n ${ansi.bold}Plan Comparison${ansi.reset}`);
360
- lines.push(` ${ansi.gray}${box.horizontal.repeat(75)}${ansi.reset}`);
361
-
362
- // Header
363
- let header = ` ${padRight('', 25)}`;
364
- for (const tier of tiers) {
365
- const badge = tier.name === currentTier ? `${ansi.green}★ ${ansi.reset}` : ' ';
366
- header += badge + center(tier.name.toUpperCase(), colWidth - 2);
367
- }
368
- lines.push(header);
369
- lines.push(` ${ansi.gray}${box.horizontal.repeat(75)}${ansi.reset}`);
370
-
371
- // Features (simplified view)
372
- const allFeatures = [...new Set(tiers.flatMap(t => t.features))];
373
-
374
- for (const tier of tiers) {
375
- const icon = tier.name === currentTier ? `${ansi.green}▶${ansi.reset}` : ' ';
376
- const tierBadge = getTierBadge(tier.name);
377
- lines.push(` ${icon} ${tierBadge}`);
378
- for (const feature of tier.features) {
379
- lines.push(` ${ansi.gray}${sym.bullet}${ansi.reset} ${feature}`);
380
- }
381
- lines.push('');
382
- }
383
-
384
- lines.push(` ${ansi.dim}Current plan: ${getTierBadge(currentTier)}${ansi.reset}`);
385
- if (currentTier === 'free') {
386
- lines.push(` ${ansi.dim}Upgrade at: ${ansi.cyan}https://vibecheckai.dev/pricing${ansi.reset}`);
387
- }
388
- lines.push('');
389
-
390
- return lines.join('\n');
391
- }
392
-
393
- // ═══════════════════════════════════════════════════════════════════════════════
394
- // EXPORTS
395
- // ═══════════════════════════════════════════════════════════════════════════════
396
-
397
- module.exports = {
398
- projectCard,
399
- configDisplay,
400
- envDisplay,
401
- dependencyTree,
402
- settingsPanel,
403
- fileStats,
404
- tierComparison,
405
- };
@@ -1,275 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * CLI Demo - Demonstrates all Vibecheck CLI output styles
4
- *
5
- * Run with: node bin/runners/lib/cli-demo.js
6
- */
7
-
8
- "use strict";
9
-
10
- const {
11
- ansi,
12
- sym,
13
- box,
14
- Spinner,
15
- progressBar,
16
- renderTable,
17
- renderMinimalHeader,
18
- renderSectionHeader,
19
- renderVerdict,
20
- renderFindings,
21
- renderSuccess,
22
- renderError,
23
- renderWarning,
24
- renderInfo,
25
- renderBullet,
26
- renderKeyValue,
27
- renderDoctorResults,
28
- renderFooter,
29
- formatDuration,
30
- getTierBadge,
31
- } = require("./unified-cli-output");
32
-
33
- const {
34
- horizontalBarChart,
35
- sparkline,
36
- trendIndicator,
37
- severityBreakdown,
38
- comparisonTable,
39
- statsSummary,
40
- healthGauge,
41
- activityHeatmap,
42
- } = require("./cli-charts");
43
-
44
- const { renderMainHelp } = require("./cli-help-formatter");
45
-
46
- // ═══════════════════════════════════════════════════════════════════════════════
47
- // DEMO SECTIONS
48
- // ═══════════════════════════════════════════════════════════════════════════════
49
-
50
- function demoHeader() {
51
- console.log(`
52
- ${ansi.bold}${ansi.cyan}╔════════════════════════════════════════════════════════════════════════╗${ansi.reset}
53
- ${ansi.bold}${ansi.cyan}║${ansi.reset} ${ansi.bold}${ansi.cyan}║${ansi.reset}
54
- ${ansi.bold}${ansi.cyan}║${ansi.reset} ${ansi.bold}VIBECHECK CLI OUTPUT DEMO${ansi.reset} ${ansi.bold}${ansi.cyan}║${ansi.reset}
55
- ${ansi.bold}${ansi.cyan}║${ansi.reset} ${ansi.dim}Showcasing all available output styles${ansi.reset} ${ansi.bold}${ansi.cyan}║${ansi.reset}
56
- ${ansi.bold}${ansi.cyan}║${ansi.reset} ${ansi.bold}${ansi.cyan}║${ansi.reset}
57
- ${ansi.bold}${ansi.cyan}╚════════════════════════════════════════════════════════════════════════╝${ansi.reset}
58
- `);
59
- }
60
-
61
- function demoMinimalHeaders() {
62
- renderSectionHeader('Minimal Headers', sym.sparkles);
63
-
64
- console.log(' Different commands with tier badges:\n');
65
- renderMinimalHeader('scan', 'free');
66
- renderMinimalHeader('ship', 'pro');
67
- renderMinimalHeader('fix', 'pro');
68
- }
69
-
70
- function demoStatusMessages() {
71
- renderSectionHeader('Status Messages', sym.info);
72
-
73
- renderSuccess('Operation completed successfully');
74
- renderError('Something went wrong');
75
- renderWarning('This might cause issues');
76
- renderInfo('Here is some information');
77
- renderBullet('A simple bullet point');
78
- console.log();
79
- }
80
-
81
- function demoSpinner() {
82
- renderSectionHeader('Spinner', sym.clock);
83
-
84
- console.log(' Spinner states (simulated):\n');
85
- console.log(` ${ansi.cyan}⠋${ansi.reset} Analyzing files... ${ansi.dim}0.0s${ansi.reset}`);
86
- console.log(` ${ansi.green}${sym.check}${ansi.reset} Analyzing files ${ansi.dim}2.3s${ansi.reset}`);
87
- console.log(` ${ansi.red}${sym.cross}${ansi.reset} Failed to connect ${ansi.dim}5.0s${ansi.reset}`);
88
- console.log(` ${ansi.yellow}${sym.warning}${ansi.reset} Completed with warnings ${ansi.dim}1.5s${ansi.reset}`);
89
- console.log();
90
- }
91
-
92
- function demoProgressBar() {
93
- renderSectionHeader('Progress Bars', sym.chart);
94
-
95
- console.log(' Different progress levels:\n');
96
- console.log(` ${ansi.gray}0% ${ansi.reset} ${progressBar(0, 40)}`);
97
- console.log(` ${ansi.gray}25% ${ansi.reset} ${progressBar(25, 40)}`);
98
- console.log(` ${ansi.gray}50% ${ansi.reset} ${progressBar(50, 40)}`);
99
- console.log(` ${ansi.gray}75% ${ansi.reset} ${progressBar(75, 40)}`);
100
- console.log(` ${ansi.gray}100%${ansi.reset} ${progressBar(100, 40)}`);
101
- console.log();
102
- }
103
-
104
- function demoVerdicts() {
105
- renderSectionHeader('Verdict Cards', sym.rocket);
106
-
107
- renderVerdict('SHIP', 95);
108
- renderVerdict('WARN', 72);
109
- renderVerdict('BLOCK', 35);
110
- }
111
-
112
- function demoTables() {
113
- renderSectionHeader('Tables', sym.file);
114
-
115
- console.log(renderTable({
116
- title: 'Scan Results by File',
117
- columns: [
118
- { header: 'File', key: 'file', width: 25 },
119
- { header: 'Issues', key: 'issues', width: 8, align: 'right' },
120
- { header: 'Status', key: 'status', width: 12 },
121
- ],
122
- data: [
123
- { file: 'src/api/users.ts', issues: 3, status: `${ansi.red}Critical${ansi.reset}` },
124
- { file: 'src/lib/auth.ts', issues: 1, status: `${ansi.yellow}Warning${ansi.reset}` },
125
- { file: 'src/utils/db.ts', issues: 0, status: `${ansi.green}Clean${ansi.reset}` },
126
- { file: 'src/pages/index.tsx', issues: 2, status: `${ansi.yellow}Warning${ansi.reset}` },
127
- ],
128
- }));
129
- console.log();
130
- }
131
-
132
- function demoFindings() {
133
- renderSectionHeader('Findings Display', sym.warning);
134
-
135
- renderFindings([
136
- { severity: 'critical', category: 'Mock Data', message: 'Found fake API responses in api/users.ts' },
137
- { severity: 'high', category: 'Secrets', message: 'API key exposed in config/auth.js' },
138
- { severity: 'medium', category: 'Routes', message: '/api/legacy/users returns 404' },
139
- { severity: 'low', category: 'Performance', message: 'Large bundle size detected (2.3MB)' },
140
- ]);
141
- console.log();
142
- }
143
-
144
- function demoKeyValue() {
145
- renderSectionHeader('Key-Value Display', sym.key);
146
-
147
- renderKeyValue([
148
- { label: 'User', value: `${ansi.bold}John Doe${ansi.reset} ${ansi.dim}(usr_abc123)${ansi.reset}` },
149
- { label: 'Plan', value: getTierBadge('pro') },
150
- { label: 'Source', value: 'Environment Variable' },
151
- { label: 'Limits', value: 'unlimited runs/month' },
152
- { label: 'Expires', value: `${ansi.yellow}in 7 days${ansi.reset}` },
153
- ]);
154
- console.log();
155
- }
156
-
157
- function demoDoctor() {
158
- renderSectionHeader('Doctor Results', sym.doctor);
159
-
160
- renderDoctorResults([
161
- { name: 'Node.js', status: 'pass', message: 'v20.10.0' },
162
- { name: 'npm', status: 'pass', message: 'v10.2.3' },
163
- { name: 'TypeScript', status: 'warn', message: 'Not found', fix: 'npm install -D typescript' },
164
- { name: 'Config', status: 'pass', message: '.vibecheckrc found' },
165
- { name: 'Dependencies', status: 'pass', message: '142 packages' },
166
- { name: 'Git', status: 'pass', message: 'Clean working tree' },
167
- ]);
168
- console.log();
169
- }
170
-
171
- function demoCharts() {
172
- renderSectionHeader('Charts & Visualizations', sym.chart);
173
-
174
- // Bar chart
175
- console.log(horizontalBarChart([
176
- { label: 'Critical', value: 3, color: ansi.red },
177
- { label: 'High', value: 7, color: ansi.yellow },
178
- { label: 'Medium', value: 12, color: ansi.yellow },
179
- { label: 'Low', value: 8, color: ansi.blue },
180
- ], { title: 'Issues by Severity', width: 30, showPercent: true }));
181
- console.log();
182
-
183
- // Sparkline
184
- console.log(` ${ansi.gray}Weekly scan scores:${ansi.reset} ${sparkline([65, 72, 68, 75, 80, 78, 85])} ${ansi.dim}(last 7 days)${ansi.reset}`);
185
- console.log();
186
-
187
- // Trend indicators
188
- console.log(` ${ansi.gray}Score trend:${ansi.reset} ${trendIndicator(85, 72)} ${ansi.dim}(improved)${ansi.reset}`);
189
- console.log(` ${ansi.gray}Issues trend:${ansi.reset} ${trendIndicator(5, 12, { reverse: true })} ${ansi.dim}(fewer issues)${ansi.reset}`);
190
- console.log();
191
-
192
- // Health gauge
193
- console.log(healthGauge(85));
194
- console.log();
195
-
196
- // Stats summary
197
- console.log(statsSummary([
198
- { label: 'Files', value: '142', icon: sym.file },
199
- { label: 'Issues', value: '7', icon: sym.warning },
200
- { label: 'Time', value: '2.3s', icon: sym.clock },
201
- ]));
202
- console.log();
203
-
204
- // Activity heatmap
205
- console.log(activityHeatmap([3, 7, 5, 8, 4, 1, 2]));
206
- console.log();
207
- }
208
-
209
- function demoComparison() {
210
- renderSectionHeader('Comparison Tables', sym.chart);
211
-
212
- console.log(comparisonTable([
213
- { label: 'Health Score', before: 72, after: 85 },
214
- { label: 'Critical Issues', before: 5, after: 2, reverse: true },
215
- { label: 'Warnings', before: 12, after: 8, reverse: true },
216
- { label: 'Files Scanned', before: 120, after: 142 },
217
- ], { title: 'Before vs After Fix', beforeLabel: 'Before', afterLabel: 'After' }));
218
- console.log();
219
- }
220
-
221
- function demoTierBadges() {
222
- renderSectionHeader('Tier Badges', sym.star);
223
-
224
- console.log(` ${getTierBadge('free')} Free tier features`);
225
- console.log(` ${getTierBadge('pro')} Pro tier features`);
226
- console.log();
227
- }
228
-
229
- function demoFooter() {
230
- renderSectionHeader('Footer with Next Steps', sym.pointer);
231
-
232
- renderFooter({
233
- nextSteps: [
234
- { cmd: 'vibecheck fix --plan', desc: 'see suggested fixes' },
235
- { cmd: 'vibecheck ship --badge', desc: 'generate status badge' },
236
- { cmd: 'vibecheck guard', desc: 'run AI guardrails' },
237
- ],
238
- showUpsell: true,
239
- tier: 'free',
240
- });
241
- }
242
-
243
- // ═══════════════════════════════════════════════════════════════════════════════
244
- // RUN DEMO
245
- // ═══════════════════════════════════════════════════════════════════════════════
246
-
247
- function runDemo() {
248
- demoHeader();
249
- demoMinimalHeaders();
250
- demoStatusMessages();
251
- demoSpinner();
252
- demoProgressBar();
253
- demoVerdicts();
254
- demoTables();
255
- demoFindings();
256
- demoKeyValue();
257
- demoDoctor();
258
- demoCharts();
259
- demoComparison();
260
- demoTierBadges();
261
- demoFooter();
262
-
263
- console.log(`
264
- ${ansi.gray}${box.horizontal.repeat(72)}${ansi.reset}
265
- ${ansi.dim}End of CLI Output Demo${ansi.reset}
266
- ${ansi.dim}These styles are used across all Vibecheck CLI commands for consistency.${ansi.reset}
267
- `);
268
- }
269
-
270
- // Run if called directly
271
- if (require.main === module) {
272
- runDemo();
273
- }
274
-
275
- module.exports = { runDemo };