@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
@@ -123,20 +123,17 @@ function renderVerdict(verdictData, options = {}) {
123
123
  lines.push(chalk.gray(BOX.v) + chalk.gray(tBot) + chalk.gray(BOX.v));
124
124
  lines.push(chalk.gray(BOX.v) + ' '.repeat(WIDTH - 2) + chalk.gray(BOX.v));
125
125
 
126
- // UPSELL (REDACTED STYLE)
126
+ // AUTO-FIX PROMPT
127
127
  lines.push(chalk.gray(BOX.trT + BOX.h.repeat(WIDTH - 2) + BOX.tlT));
128
- const lockTitle = chalk.white.bold('🔒 DEEP SCAN ANALYSIS: ') + chalk.gray('UNAVAILABLE');
129
- lines.push(chalk.gray(BOX.v) + padCenter(lockTitle, WIDTH + 9) + chalk.gray(BOX.v));
128
+ const fixTitle = chalk.white.bold(' AUTO-FIX AVAILABLE');
129
+ lines.push(chalk.gray(BOX.v) + padCenter(fixTitle, WIDTH + 9) + chalk.gray(BOX.v));
130
130
  lines.push(chalk.gray(BOX.v) + padCenter(chalk.gray('─'.repeat(60)), WIDTH + 9) + chalk.gray(BOX.v));
131
131
 
132
- // Redacted lines
133
- ['Runtime API Schema Validation', 'Live Auth Boundary Verification', 'Env Config Resolution'].forEach(txt => {
134
- const line = chalk.dim(`░░ [REDACTED] 🔒 ${txt}`);
135
- lines.push(chalk.gray(BOX.v) + padCenter(line, WIDTH + 9) + chalk.gray(BOX.v));
136
- });
132
+ // Fix options
133
+ lines.push(chalk.gray(BOX.v) + padCenter(chalk.dim('Run ') + chalk.cyan('vibecheck scan --autofix') + chalk.dim(' to apply fixes'), WIDTH + 9) + chalk.gray(BOX.v));
134
+ lines.push(chalk.gray(BOX.v) + padCenter(chalk.dim('Run ') + chalk.cyan('vibecheck fix') + chalk.dim(' to generate AI fix missions'), WIDTH + 9) + chalk.gray(BOX.v));
137
135
 
138
136
  lines.push(chalk.gray(BOX.v) + ' '.repeat(WIDTH - 2) + chalk.gray(BOX.v));
139
- lines.push(chalk.gray(BOX.v) + padCenter('Run ' + chalk.cyan('vibecheck upgrade pro') + ' to unlock.', WIDTH + 9) + chalk.gray(BOX.v));
140
137
  }
141
138
 
142
139
  // BOTTOM FRAME
@@ -152,6 +149,13 @@ function renderVerdict(verdictData, options = {}) {
152
149
 
153
150
  function formatScanOutput(result, options = {}) {
154
151
  const { json = false } = options;
152
+
153
+ // Sort findings deterministically for stable output
154
+ if (result.findings && Array.isArray(result.findings)) {
155
+ const { sortFindings } = require('./finding-sorter');
156
+ result.findings = sortFindings(result.findings);
157
+ }
158
+
155
159
  if (json) return JSON.stringify(result, null, 2);
156
160
  return renderVerdict(result, options);
157
161
  }
@@ -5,11 +5,16 @@
5
5
  const fs = require("fs");
6
6
  const path = require("path");
7
7
 
8
- // Terminal UI - Import from shared module
9
- const { c } = require("./lib/terminal-ui");
10
-
11
- // Unified Output System
12
- const { output } = require("./lib/output/index.js");
8
+ const c = {
9
+ reset: "\x1b[0m",
10
+ bold: "\x1b[1m",
11
+ dim: "\x1b[2m",
12
+ green: "\x1b[32m",
13
+ yellow: "\x1b[33m",
14
+ red: "\x1b[31m",
15
+ cyan: "\x1b[36m",
16
+ magenta: "\x1b[35m",
17
+ };
13
18
 
14
19
  function parseArgs(args) {
15
20
  const opts = {
@@ -10,9 +10,6 @@ const fs = require("fs");
10
10
  const path = require("path");
11
11
  const { loadPolicy } = require("./lib/agent-firewall/policy/loader");
12
12
 
13
- // Unified Output System
14
- const { output } = require("./lib/output/index.js");
15
-
16
13
  /**
17
14
  * Run agent command
18
15
  * @param {object} options - Command options
@@ -0,0 +1,389 @@
1
+ /**
2
+ * vibecheck allowlist - Manage Finding Allowlist
3
+ *
4
+ * ═══════════════════════════════════════════════════════════════════════════════
5
+ * Manage allowlist entries to suppress known false positives.
6
+ * Entries persist in .vibecheck/allowlist.json
7
+ * ═══════════════════════════════════════════════════════════════════════════════
8
+ */
9
+
10
+ "use strict";
11
+
12
+ const fs = require("fs");
13
+ const path = require("path");
14
+
15
+ // Colors
16
+ const c = {
17
+ reset: '\x1b[0m',
18
+ bold: '\x1b[1m',
19
+ dim: '\x1b[2m',
20
+ green: '\x1b[32m',
21
+ yellow: '\x1b[33m',
22
+ cyan: '\x1b[36m',
23
+ red: '\x1b[31m',
24
+ };
25
+
26
+ const rgb = (r, g, b) => `\x1b[38;2;${r};${g};${b}m`;
27
+
28
+ const colors = {
29
+ accent: rgb(0, 212, 255),
30
+ success: rgb(16, 185, 129),
31
+ warning: rgb(245, 158, 11),
32
+ error: rgb(239, 68, 68),
33
+ };
34
+
35
+ const ICONS = {
36
+ allow: '✓',
37
+ block: '✗',
38
+ list: '📋',
39
+ add: '+',
40
+ remove: '-',
41
+ };
42
+
43
+ function printHelp() {
44
+ console.log(`
45
+ ${c.bold}vibecheck allowlist${c.reset} - Manage Finding Allowlist
46
+
47
+ ${c.bold}Usage:${c.reset} vibecheck allowlist <action> [options]
48
+
49
+ ${c.bold}Actions:${c.reset}
50
+ ${colors.accent}list${c.reset} Show all allowlist entries ${c.dim}(default)${c.reset}
51
+ ${colors.accent}add${c.reset} Add entry to allowlist
52
+ ${colors.accent}remove${c.reset} Remove entry from allowlist
53
+ ${colors.accent}check${c.reset} Check if finding is allowlisted
54
+ ${colors.accent}clear${c.reset} Remove all allowlist entries
55
+
56
+ ${c.bold}Options (add):${c.reset}
57
+ ${colors.accent}--id <finding-id>${c.reset} Finding ID to allowlist
58
+ ${colors.accent}--pattern <regex>${c.reset} Pattern to match (message, file, category)
59
+ ${colors.accent}--reason <text>${c.reset} Reason for allowlisting ${c.dim}(required)${c.reset}
60
+ ${colors.accent}--scope <scope>${c.reset} Scope: global, file, line ${c.dim}(default: global)${c.reset}
61
+ ${colors.accent}--expires <days>${c.reset} Auto-expire after N days
62
+ ${colors.accent}--file <path>${c.reset} File scope (for scope=file|line)
63
+ ${colors.accent}--lines <start-end>${c.reset} Line range (for scope=line)
64
+
65
+ ${c.bold}Options (remove/check):${c.reset}
66
+ ${colors.accent}--id <entry-id>${c.reset} Allowlist entry ID
67
+
68
+ ${c.bold}Global Options:${c.reset}
69
+ ${colors.accent}--json${c.reset} Output as JSON
70
+ ${colors.accent}--help, -h${c.reset} Show this help
71
+
72
+ ${c.bold}Examples:${c.reset}
73
+ ${c.dim}# List all allowlist entries${c.reset}
74
+ vibecheck allowlist list
75
+
76
+ ${c.dim}# Add specific finding to allowlist${c.reset}
77
+ vibecheck allowlist add --id MOCK_DATA_abc123 --reason "Test fixture data"
78
+
79
+ ${c.dim}# Add pattern-based allowlist${c.reset}
80
+ vibecheck allowlist add --pattern "lorem ipsum" --reason "Placeholder text"
81
+
82
+ ${c.dim}# Add file-scoped allowlist${c.reset}
83
+ vibecheck allowlist add --pattern "test data" --scope file --file "src/fixtures.ts" --reason "Test fixtures"
84
+
85
+ ${c.dim}# Add with expiration${c.reset}
86
+ vibecheck allowlist add --id FAKE_xyz --reason "Temporary demo" --expires 7
87
+
88
+ ${c.dim}# Remove entry${c.reset}
89
+ vibecheck allowlist remove --id AL_abc123
90
+
91
+ ${c.dim}# Check if finding is allowlisted${c.reset}
92
+ vibecheck allowlist check --id MOCK_DATA_abc123
93
+ `);
94
+ }
95
+
96
+ function loadAllowlist(root) {
97
+ const allowlistPath = path.join(root, ".vibecheck", "allowlist.json");
98
+
99
+ if (!fs.existsSync(allowlistPath)) {
100
+ return { version: 1, entries: [] };
101
+ }
102
+
103
+ try {
104
+ return JSON.parse(fs.readFileSync(allowlistPath, "utf-8"));
105
+ } catch {
106
+ return { version: 1, entries: [] };
107
+ }
108
+ }
109
+
110
+ function saveAllowlist(root, allowlist) {
111
+ const vibecheckDir = path.join(root, ".vibecheck");
112
+ const allowlistPath = path.join(vibecheckDir, "allowlist.json");
113
+
114
+ fs.mkdirSync(vibecheckDir, { recursive: true });
115
+ fs.writeFileSync(allowlistPath, JSON.stringify(allowlist, null, 2));
116
+ }
117
+
118
+ function generateEntryId() {
119
+ return `AL_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 6)}`;
120
+ }
121
+
122
+ function isAllowlisted(finding, allowlist, filePath = null) {
123
+ const now = Date.now();
124
+
125
+ for (const entry of allowlist.entries) {
126
+ // Check expiration
127
+ if (entry.expiresAt && new Date(entry.expiresAt).getTime() < now) {
128
+ continue;
129
+ }
130
+
131
+ // Check direct ID match
132
+ if (entry.findingId && finding.id === entry.findingId) {
133
+ return { allowed: true, reason: entry.reason, entry };
134
+ }
135
+
136
+ // Check pattern match
137
+ if (entry.pattern) {
138
+ const regex = new RegExp(entry.pattern, 'i');
139
+ const targets = [
140
+ finding.message,
141
+ finding.category,
142
+ finding.file,
143
+ finding.id,
144
+ ].filter(Boolean);
145
+
146
+ if (targets.some(t => regex.test(t))) {
147
+ // Check scope
148
+ if (entry.scope === 'file' && entry.file) {
149
+ if (filePath && path.normalize(filePath).includes(path.normalize(entry.file))) {
150
+ return { allowed: true, reason: entry.reason, entry };
151
+ }
152
+ } else if (entry.scope === 'line' && entry.file && entry.lines) {
153
+ if (filePath && finding.line) {
154
+ const normalized = path.normalize(filePath);
155
+ if (normalized.includes(path.normalize(entry.file))) {
156
+ const [start, end] = entry.lines;
157
+ if (finding.line >= start && finding.line <= end) {
158
+ return { allowed: true, reason: entry.reason, entry };
159
+ }
160
+ }
161
+ }
162
+ } else {
163
+ // Global scope
164
+ return { allowed: true, reason: entry.reason, entry };
165
+ }
166
+ }
167
+ }
168
+ }
169
+
170
+ return { allowed: false };
171
+ }
172
+
173
+ async function runAllowlist(args = [], context = {}) {
174
+ // Parse arguments
175
+ const getArg = (flags) => {
176
+ for (const f of flags) {
177
+ const idx = args.indexOf(f);
178
+ if (idx !== -1 && idx < args.length - 1) return args[idx + 1];
179
+ }
180
+ return undefined;
181
+ };
182
+
183
+ const hasFlag = (flags) => flags.some(f => args.includes(f));
184
+
185
+ if (hasFlag(["--help", "-h"])) {
186
+ printHelp();
187
+ return 0;
188
+ }
189
+
190
+ const root = context.repoRoot || process.cwd();
191
+ const json = hasFlag(["--json"]);
192
+ const quiet = hasFlag(["--quiet", "-q"]);
193
+
194
+ // Get action (first positional arg)
195
+ const action = args.find(a => !a.startsWith("-") && !getArg([a])) || "list";
196
+
197
+ try {
198
+ switch (action) {
199
+ case "list": {
200
+ const allowlist = loadAllowlist(root);
201
+
202
+ if (json) {
203
+ console.log(JSON.stringify(allowlist, null, 2));
204
+ return 0;
205
+ }
206
+
207
+ if (!quiet) {
208
+ console.log(`\n ${ICONS.list} ${c.bold}Allowlist Entries${c.reset}\n`);
209
+ }
210
+
211
+ // Remove expired entries
212
+ const now = Date.now();
213
+ const activeEntries = allowlist.entries.filter(e =>
214
+ !e.expiresAt || new Date(e.expiresAt).getTime() > now
215
+ );
216
+
217
+ if (activeEntries.length === 0) {
218
+ console.log(` ${c.dim}No entries in allowlist.${c.reset}\n`);
219
+ console.log(` ${c.dim}Add entries with: vibecheck allowlist add --id <id> --reason "..."${c.reset}\n`);
220
+ return 0;
221
+ }
222
+
223
+ for (const entry of activeEntries) {
224
+ const expireStr = entry.expiresAt
225
+ ? `${c.dim}expires ${new Date(entry.expiresAt).toLocaleDateString()}${c.reset}`
226
+ : '';
227
+ const scopeStr = entry.scope !== 'global'
228
+ ? `${c.cyan}[${entry.scope}]${c.reset} `
229
+ : '';
230
+
231
+ console.log(` ${colors.success}${ICONS.allow}${c.reset} ${c.bold}${entry.id}${c.reset} ${scopeStr}${expireStr}`);
232
+
233
+ if (entry.findingId) {
234
+ console.log(` ${c.dim}Finding:${c.reset} ${entry.findingId}`);
235
+ }
236
+ if (entry.pattern) {
237
+ console.log(` ${c.dim}Pattern:${c.reset} ${entry.pattern}`);
238
+ }
239
+ if (entry.file) {
240
+ console.log(` ${c.dim}File:${c.reset} ${entry.file}`);
241
+ }
242
+ console.log(` ${c.dim}Reason:${c.reset} ${entry.reason || 'No reason provided'}`);
243
+ console.log(` ${c.dim}Added:${c.reset} ${entry.addedAt} by ${entry.addedBy || 'user'}`);
244
+ console.log();
245
+ }
246
+
247
+ console.log(` ${c.dim}Total: ${activeEntries.length} entries${c.reset}\n`);
248
+ return 0;
249
+ }
250
+
251
+ case "add": {
252
+ const id = getArg(["--id"]);
253
+ const pattern = getArg(["--pattern"]);
254
+ const reason = getArg(["--reason"]);
255
+ const scope = getArg(["--scope"]) || "global";
256
+ const file = getArg(["--file"]);
257
+ const lines = getArg(["--lines"]);
258
+ const expires = getArg(["--expires"]);
259
+
260
+ if (!id && !pattern) {
261
+ console.error(`\n ${colors.error}${ICONS.block}${c.reset} Either --id or --pattern is required\n`);
262
+ return 1;
263
+ }
264
+
265
+ if (!reason) {
266
+ console.error(`\n ${colors.error}${ICONS.block}${c.reset} --reason is required\n`);
267
+ return 1;
268
+ }
269
+
270
+ const entry = {
271
+ id: generateEntryId(),
272
+ findingId: id || null,
273
+ pattern: pattern || null,
274
+ reason,
275
+ scope,
276
+ addedAt: new Date().toISOString(),
277
+ addedBy: 'cli'
278
+ };
279
+
280
+ if (file) entry.file = file;
281
+ if (lines) {
282
+ const [start, end] = lines.split('-').map(Number);
283
+ entry.lines = [start, end || start];
284
+ }
285
+ if (expires) {
286
+ const days = parseInt(expires, 10);
287
+ entry.expiresAt = new Date(Date.now() + days * 24 * 60 * 60 * 1000).toISOString();
288
+ }
289
+
290
+ const allowlist = loadAllowlist(root);
291
+ allowlist.entries.push(entry);
292
+ saveAllowlist(root, allowlist);
293
+
294
+ if (json) {
295
+ console.log(JSON.stringify({ added: entry }, null, 2));
296
+ return 0;
297
+ }
298
+
299
+ console.log(`\n ${colors.success}${ICONS.add}${c.reset} Added allowlist entry: ${c.bold}${entry.id}${c.reset}\n`);
300
+ return 0;
301
+ }
302
+
303
+ case "remove": {
304
+ const id = getArg(["--id"]);
305
+
306
+ if (!id) {
307
+ console.error(`\n ${colors.error}${ICONS.block}${c.reset} --id is required for remove\n`);
308
+ return 1;
309
+ }
310
+
311
+ const allowlist = loadAllowlist(root);
312
+ const before = allowlist.entries.length;
313
+ allowlist.entries = allowlist.entries.filter(e => e.id !== id && e.findingId !== id);
314
+ const removed = before - allowlist.entries.length;
315
+
316
+ if (removed > 0) {
317
+ saveAllowlist(root, allowlist);
318
+ }
319
+
320
+ if (json) {
321
+ console.log(JSON.stringify({ removed, remaining: allowlist.entries.length }, null, 2));
322
+ return 0;
323
+ }
324
+
325
+ if (removed > 0) {
326
+ console.log(`\n ${colors.success}${ICONS.remove}${c.reset} Removed ${removed} entry from allowlist\n`);
327
+ } else {
328
+ console.log(`\n ${colors.warning}${ICONS.block}${c.reset} Entry not found: ${id}\n`);
329
+ }
330
+ return 0;
331
+ }
332
+
333
+ case "check": {
334
+ const id = getArg(["--id"]);
335
+
336
+ if (!id) {
337
+ console.error(`\n ${colors.error}${ICONS.block}${c.reset} --id is required for check\n`);
338
+ return 1;
339
+ }
340
+
341
+ const allowlist = loadAllowlist(root);
342
+ const result = isAllowlisted({ id }, allowlist);
343
+
344
+ if (json) {
345
+ console.log(JSON.stringify(result, null, 2));
346
+ return result.allowed ? 0 : 1;
347
+ }
348
+
349
+ if (result.allowed) {
350
+ console.log(`\n ${colors.success}${ICONS.allow}${c.reset} ${c.bold}Allowlisted${c.reset}`);
351
+ console.log(` ${c.dim}Reason:${c.reset} ${result.reason}`);
352
+ console.log(` ${c.dim}Entry:${c.reset} ${result.entry?.id}\n`);
353
+ } else {
354
+ console.log(`\n ${colors.warning}${ICONS.block}${c.reset} ${c.bold}Not allowlisted${c.reset}\n`);
355
+ }
356
+ return result.allowed ? 0 : 1;
357
+ }
358
+
359
+ case "clear": {
360
+ const allowlist = loadAllowlist(root);
361
+ const count = allowlist.entries.length;
362
+ allowlist.entries = [];
363
+ saveAllowlist(root, allowlist);
364
+
365
+ if (json) {
366
+ console.log(JSON.stringify({ cleared: count }, null, 2));
367
+ return 0;
368
+ }
369
+
370
+ console.log(`\n ${colors.success}${ICONS.remove}${c.reset} Cleared ${count} entries from allowlist\n`);
371
+ return 0;
372
+ }
373
+
374
+ default:
375
+ console.error(`\n ${colors.error}${ICONS.block}${c.reset} Unknown action: ${action}\n`);
376
+ printHelp();
377
+ return 1;
378
+ }
379
+ } catch (error) {
380
+ if (json) {
381
+ console.log(JSON.stringify({ error: error.message }, null, 2));
382
+ } else {
383
+ console.error(`\n ${colors.error}${ICONS.block}${c.reset} ${error.message}\n`);
384
+ }
385
+ return 1;
386
+ }
387
+ }
388
+
389
+ module.exports = { runAllowlist, loadAllowlist, saveAllowlist, isAllowlisted };
@@ -36,9 +36,6 @@ const {
36
36
  Spinner,
37
37
  } = require("./lib/terminal-ui");
38
38
 
39
- // Unified Output System
40
- const { output } = require("./lib/output/index.js");
41
-
42
39
  const BANNER = `
43
40
  ${ansi.rgb(0, 200, 255)} ██╗ ██╗██╗██████╗ ███████╗ ██████╗██╗ ██╗███████╗ ██████╗██╗ ██╗${ansi.reset}
44
41
  ${ansi.rgb(30, 180, 255)} ██║ ██║██║██╔══██╗██╔════╝██╔════╝██║ ██║██╔════╝██╔════╝██║ ██╔╝${ansi.reset}
@@ -1198,36 +1195,6 @@ async function analyzeSecurityRemediation(projectPath, authority, opts, spinner)
1198
1195
  };
1199
1196
  }
1200
1197
 
1201
- /**
1202
- * List available authorities (standalone command for registry)
1203
- */
1204
- async function runAuthorityList(args = []) {
1205
- const opts = { list: true, ...parseArgs(args) };
1206
-
1207
- if (opts.json) {
1208
- console.log(JSON.stringify(AUTHORITIES, null, 2));
1209
- return 0;
1210
- }
1211
-
1212
- console.log(`\n ${ansi.bold}Available Authorities:${ansi.reset}\n`);
1213
-
1214
- for (const [id, auth] of Object.entries(AUTHORITIES)) {
1215
- const tierLabel = auth.tier === 'free' ? colors.success + '[FREE]' :
1216
- auth.tier === 'starter' ? colors.accent + '[STARTER]' :
1217
- auth.tier === 'pro' ? colors.warning + '[PRO]' :
1218
- colors.error + '[ENTERPRISE]';
1219
- console.log(` ${colors.accent}${id}${ansi.reset} ${tierLabel}${ansi.reset}`);
1220
- console.log(` ${ansi.dim}${auth.description}${ansi.reset}`);
1221
- if (auth.note) {
1222
- console.log(` ${colors.warning}Note: ${auth.note}${ansi.reset}`);
1223
- }
1224
- console.log();
1225
- }
1226
-
1227
- return 0;
1228
- }
1229
-
1230
1198
  module.exports = {
1231
1199
  runApprove: withErrorHandling(runApprove, "Approve failed"),
1232
- runAuthorityList,
1233
1200
  };