@vibecheckai/cli 3.7.0 → 3.8.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 (99) hide show
  1. package/README.md +135 -63
  2. package/bin/_deprecations.js +447 -19
  3. package/bin/_router.js +1 -1
  4. package/bin/registry.js +347 -280
  5. package/bin/runners/context/generators/cursor-enhanced.js +2439 -0
  6. package/bin/runners/lib/agent-firewall/enforcement/gateway.js +1059 -0
  7. package/bin/runners/lib/agent-firewall/enforcement/index.js +98 -0
  8. package/bin/runners/lib/agent-firewall/enforcement/mode.js +318 -0
  9. package/bin/runners/lib/agent-firewall/enforcement/orchestrator.js +484 -0
  10. package/bin/runners/lib/agent-firewall/enforcement/proof-artifact.js +418 -0
  11. package/bin/runners/lib/agent-firewall/enforcement/schemas/change-event.schema.json +173 -0
  12. package/bin/runners/lib/agent-firewall/enforcement/schemas/intent.schema.json +181 -0
  13. package/bin/runners/lib/agent-firewall/enforcement/schemas/verdict.schema.json +222 -0
  14. package/bin/runners/lib/agent-firewall/enforcement/verdict-v2.js +333 -0
  15. package/bin/runners/lib/agent-firewall/index.js +200 -0
  16. package/bin/runners/lib/agent-firewall/integration/index.js +20 -0
  17. package/bin/runners/lib/agent-firewall/integration/ship-gate.js +437 -0
  18. package/bin/runners/lib/agent-firewall/intent/alignment-engine.js +622 -0
  19. package/bin/runners/lib/agent-firewall/intent/auto-detect.js +426 -0
  20. package/bin/runners/lib/agent-firewall/intent/index.js +102 -0
  21. package/bin/runners/lib/agent-firewall/intent/schema.js +352 -0
  22. package/bin/runners/lib/agent-firewall/intent/store.js +283 -0
  23. package/bin/runners/lib/agent-firewall/interception/fs-interceptor.js +502 -0
  24. package/bin/runners/lib/agent-firewall/interception/index.js +23 -0
  25. package/bin/runners/lib/agent-firewall/session/collector.js +451 -0
  26. package/bin/runners/lib/agent-firewall/session/index.js +26 -0
  27. package/bin/runners/lib/artifact-envelope.js +540 -0
  28. package/bin/runners/lib/auth-shared.js +977 -0
  29. package/bin/runners/lib/checkpoint.js +941 -0
  30. package/bin/runners/lib/cleanup/engine.js +571 -0
  31. package/bin/runners/lib/cleanup/index.js +53 -0
  32. package/bin/runners/lib/cleanup/output.js +375 -0
  33. package/bin/runners/lib/cleanup/rules.js +1060 -0
  34. package/bin/runners/lib/doctor/diagnosis-receipt.js +454 -0
  35. package/bin/runners/lib/doctor/failure-signatures.js +526 -0
  36. package/bin/runners/lib/doctor/fix-script.js +336 -0
  37. package/bin/runners/lib/doctor/modules/build-tools.js +453 -0
  38. package/bin/runners/lib/doctor/modules/index.js +62 -3
  39. package/bin/runners/lib/doctor/modules/os-quirks.js +706 -0
  40. package/bin/runners/lib/doctor/modules/repo-integrity.js +485 -0
  41. package/bin/runners/lib/doctor/safe-repair.js +384 -0
  42. package/bin/runners/lib/engines/attack-detector.js +1192 -0
  43. package/bin/runners/lib/entitlements-v2.js +2 -2
  44. package/bin/runners/lib/missions/briefing.js +427 -0
  45. package/bin/runners/lib/missions/checkpoint.js +753 -0
  46. package/bin/runners/lib/missions/hardening.js +851 -0
  47. package/bin/runners/lib/missions/plan.js +421 -32
  48. package/bin/runners/lib/missions/safety-gates.js +645 -0
  49. package/bin/runners/lib/missions/schema.js +478 -0
  50. package/bin/runners/lib/packs/bundle.js +675 -0
  51. package/bin/runners/lib/packs/evidence-pack.js +671 -0
  52. package/bin/runners/lib/packs/pack-factory.js +837 -0
  53. package/bin/runners/lib/packs/permissions-pack.js +686 -0
  54. package/bin/runners/lib/packs/proof-graph-pack.js +779 -0
  55. package/bin/runners/lib/safelist/index.js +96 -0
  56. package/bin/runners/lib/safelist/integration.js +334 -0
  57. package/bin/runners/lib/safelist/matcher.js +696 -0
  58. package/bin/runners/lib/safelist/schema.js +948 -0
  59. package/bin/runners/lib/safelist/store.js +438 -0
  60. package/bin/runners/lib/schemas/ship-manifest.schema.json +251 -0
  61. package/bin/runners/lib/ship-gate.js +832 -0
  62. package/bin/runners/lib/ship-manifest.js +1153 -0
  63. package/bin/runners/lib/ship-output.js +1 -1
  64. package/bin/runners/lib/unified-cli-output.js +710 -383
  65. package/bin/runners/lib/upsell.js +3 -3
  66. package/bin/runners/lib/why-tree.js +650 -0
  67. package/bin/runners/runAllowlist.js +33 -4
  68. package/bin/runners/runApprove.js +240 -1122
  69. package/bin/runners/runAudit.js +692 -0
  70. package/bin/runners/runAuth.js +325 -29
  71. package/bin/runners/runCheckpoint.js +442 -494
  72. package/bin/runners/runCleanup.js +343 -0
  73. package/bin/runners/runDoctor.js +269 -19
  74. package/bin/runners/runFix.js +411 -32
  75. package/bin/runners/runForge.js +411 -0
  76. package/bin/runners/runIntent.js +906 -0
  77. package/bin/runners/runKickoff.js +878 -0
  78. package/bin/runners/runLaunch.js +2000 -0
  79. package/bin/runners/runLink.js +785 -0
  80. package/bin/runners/runMcp.js +1741 -837
  81. package/bin/runners/runPacks.js +2089 -0
  82. package/bin/runners/runPolish.js +41 -0
  83. package/bin/runners/runSafelist.js +1190 -0
  84. package/bin/runners/runScan.js +21 -9
  85. package/bin/runners/runShield.js +1282 -0
  86. package/bin/runners/runShip.js +395 -16
  87. package/bin/vibecheck.js +34 -6
  88. package/mcp-server/README.md +117 -158
  89. package/mcp-server/handlers/tool-handler.ts +3 -3
  90. package/mcp-server/index.js +16 -0
  91. package/mcp-server/intent-firewall-interceptor.js +529 -0
  92. package/mcp-server/manifest.json +473 -0
  93. package/mcp-server/package.json +1 -1
  94. package/mcp-server/registry/tool-registry.js +315 -523
  95. package/mcp-server/registry/tools.json +442 -428
  96. package/mcp-server/tier-auth.js +68 -11
  97. package/mcp-server/tools-v3.js +70 -16
  98. package/package.json +1 -1
  99. package/bin/runners/runProof.zip +0 -0
@@ -0,0 +1,375 @@
1
+ /**
2
+ * vibecheck polish --cleanup Output UX
3
+ *
4
+ * ═══════════════════════════════════════════════════════════════════════════════
5
+ * CLEANUP OUTPUT - Diff Summary & Risk Notes
6
+ * ═══════════════════════════════════════════════════════════════════════════════
7
+ *
8
+ * Beautiful, informative output for cleanup operations.
9
+ */
10
+
11
+ "use strict";
12
+
13
+ const path = require("path");
14
+ const { CATEGORIES, RISK_LEVELS } = require("./rules");
15
+
16
+ // ═══════════════════════════════════════════════════════════════════════════════
17
+ // TERMINAL STYLING
18
+ // ═══════════════════════════════════════════════════════════════════════════════
19
+
20
+ const SUPPORTS_COLOR = process.stdout.isTTY && !process.env.NO_COLOR;
21
+
22
+ const c = SUPPORTS_COLOR ? {
23
+ reset: "\x1b[0m",
24
+ bold: "\x1b[1m",
25
+ dim: "\x1b[2m",
26
+ italic: "\x1b[3m",
27
+ underline: "\x1b[4m",
28
+ red: "\x1b[31m",
29
+ green: "\x1b[32m",
30
+ yellow: "\x1b[33m",
31
+ blue: "\x1b[34m",
32
+ magenta: "\x1b[35m",
33
+ cyan: "\x1b[36m",
34
+ white: "\x1b[37m",
35
+ bgRed: "\x1b[41m",
36
+ bgGreen: "\x1b[42m",
37
+ bgYellow: "\x1b[43m",
38
+ } : {
39
+ reset: "", bold: "", dim: "", italic: "", underline: "",
40
+ red: "", green: "", yellow: "", blue: "", magenta: "", cyan: "", white: "",
41
+ bgRed: "", bgGreen: "", bgYellow: "",
42
+ };
43
+
44
+ const icons = {
45
+ check: "✓",
46
+ cross: "✗",
47
+ warning: "⚠",
48
+ info: "ℹ",
49
+ arrow: "→",
50
+ bullet: "•",
51
+ sparkle: "✨",
52
+ broom: "🧹",
53
+ shield: "🛡️",
54
+ rocket: "🚀",
55
+ file: "📄",
56
+ folder: "📁",
57
+ trash: "🗑️",
58
+ clock: "⏱️",
59
+ };
60
+
61
+ // ═══════════════════════════════════════════════════════════════════════════════
62
+ // BANNER
63
+ // ═══════════════════════════════════════════════════════════════════════════════
64
+
65
+ function printBanner() {
66
+ console.log(`
67
+ ${c.bold}╔══════════════════════════════════════════════════════════════════════════════╗
68
+ ║ ║
69
+ ║ ${icons.broom} ${c.cyan}VIBECHECK POLISH - CLEANUP MODE${c.reset}${c.bold} ║
70
+ ║ ${c.dim}Production-grade cleanup without chaos${c.reset}${c.bold} ║
71
+ ║ ║
72
+ ╚══════════════════════════════════════════════════════════════════════════════╝${c.reset}
73
+ `);
74
+ }
75
+
76
+ // ═══════════════════════════════════════════════════════════════════════════════
77
+ // SUMMARY OUTPUT
78
+ // ═══════════════════════════════════════════════════════════════════════════════
79
+
80
+ function printAnalysisSummary(analysis, projectPath) {
81
+ console.log(`${c.bold}${icons.folder} PROJECT SCAN SUMMARY${c.reset}`);
82
+ console.log(`${"─".repeat(60)}`);
83
+ console.log(` Path: ${c.dim}${projectPath}${c.reset}`);
84
+ console.log(` Files scanned: ${analysis.totalFiles}`);
85
+ console.log(` Files with findings: ${analysis.filesWithFindings}`);
86
+ console.log(` Total findings: ${c.bold}${analysis.totalFindings}${c.reset}`);
87
+
88
+ if (analysis.truncated) {
89
+ console.log(` ${c.yellow}${icons.warning} Scan limited to first 1000 files${c.reset}`);
90
+ }
91
+ console.log();
92
+ }
93
+
94
+ // ═══════════════════════════════════════════════════════════════════════════════
95
+ // RISK ASSESSMENT OUTPUT
96
+ // ═══════════════════════════════════════════════════════════════════════════════
97
+
98
+ function printRiskAssessment(riskAssessment) {
99
+ console.log(`${c.bold}${icons.shield} RISK ASSESSMENT${c.reset}`);
100
+ console.log(`${"─".repeat(60)}`);
101
+
102
+ // Risk score bar
103
+ const score = riskAssessment.score;
104
+ const barWidth = 30;
105
+ const filledWidth = Math.round((score / 100) * barWidth);
106
+ const emptyWidth = barWidth - filledWidth;
107
+
108
+ let barColor = c.green;
109
+ if (score >= 50) barColor = c.red;
110
+ else if (score >= 25) barColor = c.yellow;
111
+
112
+ const bar = barColor + "█".repeat(filledWidth) + c.dim + "░".repeat(emptyWidth) + c.reset;
113
+
114
+ console.log(` Risk Score: ${bar} ${c.bold}${score}/100${c.reset}`);
115
+ console.log(` Risk Level: ${getRiskBadge(riskAssessment.level)}`);
116
+ console.log();
117
+
118
+ // Breakdown
119
+ console.log(` ${c.bold}Findings by Risk:${c.reset}`);
120
+ console.log(` ${c.green}${icons.check} Safe:${c.reset} ${riskAssessment.summary.safe} ${c.dim}(auto-fixable)${c.reset}`);
121
+ console.log(` ${c.yellow}${icons.warning} Moderate:${c.reset} ${riskAssessment.summary.moderate} ${c.dim}(review recommended)${c.reset}`);
122
+ console.log(` ${c.red}${icons.cross} Aggressive:${c.reset} ${riskAssessment.summary.aggressive} ${c.dim}(requires --aggressive)${c.reset}`);
123
+ console.log();
124
+ }
125
+
126
+ function getRiskBadge(level) {
127
+ switch (level) {
128
+ case "low":
129
+ return `${c.bgGreen}${c.white} LOW ${c.reset}`;
130
+ case "moderate":
131
+ return `${c.bgYellow}${c.white} MODERATE ${c.reset}`;
132
+ case "high":
133
+ return `${c.bgRed}${c.white} HIGH ${c.reset}`;
134
+ default:
135
+ return level;
136
+ }
137
+ }
138
+
139
+ // ═══════════════════════════════════════════════════════════════════════════════
140
+ // FINDINGS BY CATEGORY
141
+ // ═══════════════════════════════════════════════════════════════════════════════
142
+
143
+ function printFindingsByCategory(analysis, opts = {}) {
144
+ const { verbose = false, limit = 5 } = opts;
145
+
146
+ console.log(`${c.bold}${icons.sparkle} FINDINGS BY CATEGORY${c.reset}`);
147
+ console.log(`${"─".repeat(60)}`);
148
+
149
+ for (const [category, findings] of Object.entries(analysis.byCategory)) {
150
+ const catInfo = CATEGORIES[category] || { name: category, icon: "📌" };
151
+
152
+ console.log(`\n ${catInfo.icon} ${c.bold}${catInfo.name}${c.reset} ${c.dim}(${findings.length})${c.reset}`);
153
+
154
+ const toShow = verbose ? findings : findings.slice(0, limit);
155
+
156
+ for (const finding of toShow) {
157
+ const riskColor = finding.rule.riskLevel === "safe" ? c.green :
158
+ finding.rule.riskLevel === "moderate" ? c.yellow : c.red;
159
+
160
+ console.log(` ${riskColor}${icons.bullet}${c.reset} ${finding.rule.name}`);
161
+ console.log(` ${c.dim}${path.relative(process.cwd(), finding.file)}:${finding.line}${c.reset}`);
162
+
163
+ if (verbose) {
164
+ console.log(` ${c.dim}${finding.lineContent.substring(0, 60)}${finding.lineContent.length > 60 ? "..." : ""}${c.reset}`);
165
+ }
166
+ }
167
+
168
+ if (!verbose && findings.length > limit) {
169
+ console.log(` ${c.dim}... and ${findings.length - limit} more${c.reset}`);
170
+ }
171
+ }
172
+ console.log();
173
+ }
174
+
175
+ // ═══════════════════════════════════════════════════════════════════════════════
176
+ // DIFF PREVIEW
177
+ // ═══════════════════════════════════════════════════════════════════════════════
178
+
179
+ function printDiffPreview(diffsResult, opts = {}) {
180
+ const { verbose = false, limit = 10 } = opts;
181
+
182
+ if (diffsResult.filesChanged === 0) {
183
+ console.log(`${c.dim}No auto-fixable changes to apply.${c.reset}\n`);
184
+ return;
185
+ }
186
+
187
+ console.log(`${c.bold}${icons.file} DIFF PREVIEW${c.reset}`);
188
+ console.log(`${"─".repeat(60)}`);
189
+ console.log(` Files to modify: ${c.bold}${diffsResult.filesChanged}${c.reset}`);
190
+ console.log(` Total changes: ${c.bold}${diffsResult.totalChanges}${c.reset}`);
191
+ console.log();
192
+
193
+ const toShow = verbose ? diffsResult.diffs : diffsResult.diffs.slice(0, limit);
194
+
195
+ for (const diff of toShow) {
196
+ console.log(` ${c.bold}${diff.relativePath}${c.reset} ${c.dim}(${diff.changes.length} changes)${c.reset}`);
197
+
198
+ for (const change of diff.changes.slice(0, verbose ? 10 : 3)) {
199
+ console.log(` Line ${change.line}:`);
200
+ console.log(` ${c.red}- ${truncate(change.removed, 50)}${c.reset}`);
201
+ console.log(` ${c.green}+ ${truncate(change.added || "(removed)", 50)}${c.reset}`);
202
+ }
203
+
204
+ if (diff.changes.length > (verbose ? 10 : 3)) {
205
+ console.log(` ${c.dim}... and ${diff.changes.length - (verbose ? 10 : 3)} more changes${c.reset}`);
206
+ }
207
+ console.log();
208
+ }
209
+
210
+ if (!verbose && diffsResult.diffs.length > limit) {
211
+ console.log(` ${c.dim}... and ${diffsResult.diffs.length - limit} more files${c.reset}\n`);
212
+ }
213
+ }
214
+
215
+ function truncate(str, maxLen) {
216
+ if (!str) return "";
217
+ const trimmed = str.trim().replace(/\s+/g, " ");
218
+ return trimmed.length > maxLen ? trimmed.substring(0, maxLen) + "..." : trimmed;
219
+ }
220
+
221
+ // ═══════════════════════════════════════════════════════════════════════════════
222
+ // APPLY RESULTS
223
+ // ═══════════════════════════════════════════════════════════════════════════════
224
+
225
+ function printApplyResults(applyResult) {
226
+ console.log(`${c.bold}${icons.check} CHANGES APPLIED${c.reset}`);
227
+ console.log(`${"─".repeat(60)}`);
228
+ console.log(` Files modified: ${c.green}${applyResult.applied.length}${c.reset}`);
229
+
230
+ if (applyResult.failed.length > 0) {
231
+ console.log(` Files failed: ${c.red}${applyResult.failed.length}${c.reset}`);
232
+ for (const fail of applyResult.failed) {
233
+ console.log(` ${c.red}${icons.cross}${c.reset} ${fail.file}: ${fail.error}`);
234
+ }
235
+ }
236
+
237
+ console.log(`\n ${c.bold}Backup saved to:${c.reset}`);
238
+ console.log(` ${c.cyan}${applyResult.backupDir}${c.reset}`);
239
+ console.log();
240
+ }
241
+
242
+ // ═══════════════════════════════════════════════════════════════════════════════
243
+ // ROLLBACK INFO
244
+ // ═══════════════════════════════════════════════════════════════════════════════
245
+
246
+ function printRollbackInfo(backupDir) {
247
+ console.log(`${c.bold}${icons.clock} ROLLBACK AVAILABLE${c.reset}`);
248
+ console.log(`${"─".repeat(60)}`);
249
+ console.log(` To undo all changes, run:`);
250
+ console.log(` ${c.cyan}vibecheck polish --rollback ${backupDir}${c.reset}`);
251
+ console.log();
252
+ }
253
+
254
+ // ═══════════════════════════════════════════════════════════════════════════════
255
+ // AGGRESSIVE WARNING
256
+ // ═══════════════════════════════════════════════════════════════════════════════
257
+
258
+ function printAggressiveWarning(aggressiveFindings) {
259
+ if (aggressiveFindings.length === 0) return;
260
+
261
+ console.log(`${c.yellow}${c.bold}${icons.warning} AGGRESSIVE TRANSFORMATIONS SKIPPED${c.reset}`);
262
+ console.log(`${"─".repeat(60)}`);
263
+ console.log(` ${c.yellow}${aggressiveFindings.length} findings require --aggressive --yes-i-am-sure${c.reset}`);
264
+ console.log(` ${c.dim}These could change program behavior and need manual review.${c.reset}`);
265
+ console.log();
266
+
267
+ // Group by rule
268
+ const byRule = {};
269
+ for (const finding of aggressiveFindings) {
270
+ if (!byRule[finding.ruleId]) byRule[finding.ruleId] = [];
271
+ byRule[finding.ruleId].push(finding);
272
+ }
273
+
274
+ for (const [ruleId, findings] of Object.entries(byRule)) {
275
+ const rule = findings[0].rule;
276
+ console.log(` ${c.red}${icons.bullet}${c.reset} ${rule.name} (${findings.length})`);
277
+ console.log(` ${c.dim}${rule.description}${c.reset}`);
278
+ }
279
+ console.log();
280
+ }
281
+
282
+ // ═══════════════════════════════════════════════════════════════════════════════
283
+ // NEXT STEPS
284
+ // ═══════════════════════════════════════════════════════════════════════════════
285
+
286
+ function printNextSteps(analysis, diffsResult, opts = {}) {
287
+ const { applied = false, aggressive = false } = opts;
288
+
289
+ console.log(`${c.bold}${icons.rocket} NEXT STEPS${c.reset}`);
290
+ console.log(`${"─".repeat(60)}`);
291
+
292
+ if (!applied && diffsResult.filesChanged > 0) {
293
+ console.log(` 1. Review the diff preview above`);
294
+ console.log(` 2. Apply changes: ${c.cyan}vibecheck polish --cleanup --apply${c.reset}`);
295
+ } else if (applied) {
296
+ console.log(` ${c.green}${icons.check}${c.reset} Changes applied successfully!`);
297
+ console.log(` 1. Run your tests: ${c.cyan}npm test${c.reset}`);
298
+ console.log(` 2. Review changes: ${c.cyan}git diff${c.reset}`);
299
+ console.log(` 3. If issues: ${c.cyan}vibecheck polish --rollback${c.reset}`);
300
+ }
301
+
302
+ if (analysis.byRisk.aggressive.length > 0 && !aggressive) {
303
+ console.log(`\n ${c.dim}For aggressive fixes (could change behavior):${c.reset}`);
304
+ console.log(` ${c.cyan}vibecheck polish --cleanup --aggressive --yes-i-am-sure${c.reset}`);
305
+ }
306
+
307
+ if (analysis.byRisk.moderate.length > 0) {
308
+ console.log(`\n ${c.dim}Review moderate findings manually:${c.reset}`);
309
+ console.log(` ${c.cyan}vibecheck polish --cleanup --verbose${c.reset}`);
310
+ }
311
+
312
+ console.log();
313
+ }
314
+
315
+ // ═══════════════════════════════════════════════════════════════════════════════
316
+ // JSON OUTPUT
317
+ // ═══════════════════════════════════════════════════════════════════════════════
318
+
319
+ function formatJsonOutput(analysis, diffsResult, riskAssessment, opts = {}) {
320
+ return {
321
+ summary: {
322
+ filesScanned: analysis.totalFiles,
323
+ filesWithFindings: analysis.filesWithFindings,
324
+ totalFindings: analysis.totalFindings,
325
+ truncated: analysis.truncated,
326
+ },
327
+ risk: riskAssessment,
328
+ findings: {
329
+ byRisk: {
330
+ safe: analysis.byRisk.safe.length,
331
+ moderate: analysis.byRisk.moderate.length,
332
+ aggressive: analysis.byRisk.aggressive.length,
333
+ },
334
+ byCategory: Object.fromEntries(
335
+ Object.entries(analysis.byCategory).map(([k, v]) => [k, v.length])
336
+ ),
337
+ details: analysis.findings.map(f => ({
338
+ ruleId: f.ruleId,
339
+ file: f.file,
340
+ line: f.line,
341
+ match: f.match,
342
+ riskLevel: f.rule.riskLevel,
343
+ category: f.rule.category,
344
+ autoFixable: f.rule.autoFixable,
345
+ })),
346
+ },
347
+ diffs: {
348
+ filesChanged: diffsResult.filesChanged,
349
+ totalChanges: diffsResult.totalChanges,
350
+ files: diffsResult.diffs.map(d => ({
351
+ file: d.relativePath,
352
+ changes: d.changes.length,
353
+ })),
354
+ },
355
+ };
356
+ }
357
+
358
+ // ═══════════════════════════════════════════════════════════════════════════════
359
+ // EXPORTS
360
+ // ═══════════════════════════════════════════════════════════════════════════════
361
+
362
+ module.exports = {
363
+ printBanner,
364
+ printAnalysisSummary,
365
+ printRiskAssessment,
366
+ printFindingsByCategory,
367
+ printDiffPreview,
368
+ printApplyResults,
369
+ printRollbackInfo,
370
+ printAggressiveWarning,
371
+ printNextSteps,
372
+ formatJsonOutput,
373
+ c,
374
+ icons,
375
+ };