@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,426 @@
1
+ /**
2
+ * Auto-Detect Intent from Context
3
+ *
4
+ * ═══════════════════════════════════════════════════════════════════════════════
5
+ * SEAMLESS INTENT - AUTO-DETECTION
6
+ * ═══════════════════════════════════════════════════════════════════════════════
7
+ *
8
+ * Automatically detect intent from:
9
+ * - Git branch name
10
+ * - Staged files
11
+ * - Recent commit messages
12
+ * - File patterns being modified
13
+ *
14
+ * @module auto-detect
15
+ * @version 1.0.0
16
+ */
17
+
18
+ "use strict";
19
+
20
+ const path = require("path");
21
+ const { execSync } = require("child_process");
22
+
23
+ // ═══════════════════════════════════════════════════════════════════════════════
24
+ // INTENT INFERENCE FROM KEYWORDS
25
+ // ═══════════════════════════════════════════════════════════════════════════════
26
+
27
+ /**
28
+ * Intent type patterns - maps keywords to constraints
29
+ */
30
+ const INTENT_PATTERNS = {
31
+ fix: {
32
+ type: "bugfix",
33
+ constraints: [
34
+ "No new features",
35
+ "Changes limited to specified file(s)",
36
+ ],
37
+ },
38
+ bug: {
39
+ type: "bugfix",
40
+ constraints: [
41
+ "No new features",
42
+ "Changes limited to specified file(s)",
43
+ ],
44
+ },
45
+ hotfix: {
46
+ type: "bugfix",
47
+ constraints: [
48
+ "No new features",
49
+ "Changes limited to specified file(s)",
50
+ "Minimal changes only",
51
+ ],
52
+ },
53
+ refactor: {
54
+ type: "refactor",
55
+ constraints: [
56
+ "No behavior changes",
57
+ "No new dependencies",
58
+ ],
59
+ },
60
+ feature: {
61
+ type: "feature",
62
+ constraints: [
63
+ "Tests required",
64
+ ],
65
+ },
66
+ add: {
67
+ type: "feature",
68
+ constraints: [
69
+ "Tests required",
70
+ ],
71
+ },
72
+ update: {
73
+ type: "update",
74
+ constraints: [],
75
+ },
76
+ style: {
77
+ type: "style",
78
+ constraints: [
79
+ "No behavior changes",
80
+ "UI/CSS only",
81
+ ],
82
+ },
83
+ docs: {
84
+ type: "docs",
85
+ constraints: [
86
+ "Documentation only",
87
+ "No code changes",
88
+ ],
89
+ },
90
+ test: {
91
+ type: "test",
92
+ constraints: [
93
+ "Test files only",
94
+ ],
95
+ },
96
+ security: {
97
+ type: "security",
98
+ constraints: [
99
+ "No permission relaxation",
100
+ "Review required",
101
+ ],
102
+ },
103
+ perf: {
104
+ type: "performance",
105
+ constraints: [
106
+ "No behavior changes",
107
+ ],
108
+ },
109
+ chore: {
110
+ type: "chore",
111
+ constraints: [],
112
+ },
113
+ };
114
+
115
+ /**
116
+ * Domain detection patterns
117
+ */
118
+ const DOMAIN_PATTERNS = {
119
+ auth: ["auth", "login", "logout", "session", "jwt", "oauth", "password", "mfa"],
120
+ payments: ["payment", "stripe", "billing", "subscription", "checkout", "invoice"],
121
+ routes: ["route", "api", "endpoint", "router", "handler"],
122
+ database: ["database", "db", "prisma", "migration", "schema", "model"],
123
+ ui: ["component", "page", "ui", "style", "css", "button", "form", "modal"],
124
+ config: ["config", "env", "settings", "setup"],
125
+ };
126
+
127
+ // ═══════════════════════════════════════════════════════════════════════════════
128
+ // GIT CONTEXT HELPERS
129
+ // ═══════════════════════════════════════════════════════════════════════════════
130
+
131
+ /**
132
+ * Get current git branch name
133
+ * @param {string} projectRoot - Project root path
134
+ * @returns {string|null} Branch name or null
135
+ */
136
+ function getGitBranch(projectRoot) {
137
+ try {
138
+ const branch = execSync("git rev-parse --abbrev-ref HEAD", {
139
+ cwd: projectRoot,
140
+ encoding: "utf-8",
141
+ stdio: ["pipe", "pipe", "pipe"],
142
+ }).trim();
143
+ return branch === "HEAD" ? null : branch;
144
+ } catch {
145
+ return null;
146
+ }
147
+ }
148
+
149
+ /**
150
+ * Get staged files
151
+ * @param {string} projectRoot - Project root path
152
+ * @returns {string[]} Array of staged file paths
153
+ */
154
+ function getStagedFiles(projectRoot) {
155
+ try {
156
+ const output = execSync("git diff --cached --name-only", {
157
+ cwd: projectRoot,
158
+ encoding: "utf-8",
159
+ stdio: ["pipe", "pipe", "pipe"],
160
+ }).trim();
161
+ return output ? output.split("\n").filter(Boolean) : [];
162
+ } catch {
163
+ return [];
164
+ }
165
+ }
166
+
167
+ /**
168
+ * Get recently modified files (unstaged)
169
+ * @param {string} projectRoot - Project root path
170
+ * @returns {string[]} Array of modified file paths
171
+ */
172
+ function getModifiedFiles(projectRoot) {
173
+ try {
174
+ const output = execSync("git diff --name-only", {
175
+ cwd: projectRoot,
176
+ encoding: "utf-8",
177
+ stdio: ["pipe", "pipe", "pipe"],
178
+ }).trim();
179
+ return output ? output.split("\n").filter(Boolean) : [];
180
+ } catch {
181
+ return [];
182
+ }
183
+ }
184
+
185
+ /**
186
+ * Get last commit message
187
+ * @param {string} projectRoot - Project root path
188
+ * @returns {string|null} Last commit message or null
189
+ */
190
+ function getLastCommitMessage(projectRoot) {
191
+ try {
192
+ return execSync("git log -1 --pretty=%B", {
193
+ cwd: projectRoot,
194
+ encoding: "utf-8",
195
+ stdio: ["pipe", "pipe", "pipe"],
196
+ }).trim();
197
+ } catch {
198
+ return null;
199
+ }
200
+ }
201
+
202
+ // ═══════════════════════════════════════════════════════════════════════════════
203
+ // INTENT INFERENCE
204
+ // ═══════════════════════════════════════════════════════════════════════════════
205
+
206
+ /**
207
+ * Parse branch name into intent components
208
+ * @param {string} branch - Branch name (e.g., "fix/login-bug", "feature/user-profile")
209
+ * @returns {object} Parsed intent
210
+ */
211
+ function parseBranchName(branch) {
212
+ if (!branch) return null;
213
+
214
+ // Common patterns: fix/xxx, feature/xxx, hotfix/xxx, etc.
215
+ const patterns = [
216
+ /^(fix|bug|hotfix|feature|feat|refactor|style|docs|test|chore|perf|security)[\/\-_](.+)$/i,
217
+ /^([a-z]+)[\/\-_](.+)$/i,
218
+ ];
219
+
220
+ for (const pattern of patterns) {
221
+ const match = branch.match(pattern);
222
+ if (match) {
223
+ const type = match[1].toLowerCase();
224
+ const description = match[2]
225
+ .replace(/[-_]/g, " ")
226
+ .replace(/([a-z])([A-Z])/g, "$1 $2")
227
+ .toLowerCase();
228
+
229
+ return {
230
+ type,
231
+ description,
232
+ summary: `${capitalizeFirst(type)}: ${description}`,
233
+ };
234
+ }
235
+ }
236
+
237
+ return null;
238
+ }
239
+
240
+ /**
241
+ * Infer intent type from summary text
242
+ * @param {string} summary - Intent summary
243
+ * @returns {object} Intent type info
244
+ */
245
+ function inferTypeFromSummary(summary) {
246
+ const lower = summary.toLowerCase();
247
+
248
+ for (const [keyword, info] of Object.entries(INTENT_PATTERNS)) {
249
+ if (lower.startsWith(keyword) || lower.includes(` ${keyword} `)) {
250
+ return info;
251
+ }
252
+ }
253
+
254
+ // Default to general
255
+ return { type: "general", constraints: [] };
256
+ }
257
+
258
+ /**
259
+ * Detect domains from file paths
260
+ * @param {string[]} files - File paths
261
+ * @returns {string[]} Detected domains
262
+ */
263
+ function detectDomainsFromFiles(files) {
264
+ const domains = new Set();
265
+
266
+ for (const file of files) {
267
+ const lower = file.toLowerCase();
268
+
269
+ for (const [domain, patterns] of Object.entries(DOMAIN_PATTERNS)) {
270
+ if (patterns.some(p => lower.includes(p))) {
271
+ domains.add(domain);
272
+ }
273
+ }
274
+ }
275
+
276
+ return Array.from(domains);
277
+ }
278
+
279
+ /**
280
+ * Infer scope directories from files
281
+ * @param {string[]} files - File paths
282
+ * @returns {string[]} Common directories
283
+ */
284
+ function inferScopeFromFiles(files) {
285
+ if (files.length === 0) return [];
286
+
287
+ // Get unique directories
288
+ const dirs = new Set();
289
+ for (const file of files) {
290
+ const dir = path.dirname(file);
291
+ if (dir && dir !== ".") {
292
+ // Get top-level directory
293
+ const parts = dir.split(/[\/\\]/);
294
+ if (parts[0]) dirs.add(parts[0] + "/");
295
+ // Also add full path if different
296
+ if (parts.length > 1) dirs.add(dir + "/");
297
+ }
298
+ }
299
+
300
+ return Array.from(dirs).slice(0, 5); // Limit to 5
301
+ }
302
+
303
+ /**
304
+ * Auto-detect intent from project context
305
+ * @param {string} projectRoot - Project root path
306
+ * @param {string} [userSummary] - Optional user-provided summary
307
+ * @returns {object} Inferred intent data
308
+ */
309
+ function autoDetectIntent(projectRoot, userSummary = null) {
310
+ const context = {
311
+ branch: getGitBranch(projectRoot),
312
+ stagedFiles: getStagedFiles(projectRoot),
313
+ modifiedFiles: getModifiedFiles(projectRoot),
314
+ lastCommit: getLastCommitMessage(projectRoot),
315
+ };
316
+
317
+ const files = [...context.stagedFiles, ...context.modifiedFiles];
318
+ const uniqueFiles = [...new Set(files)];
319
+
320
+ // Determine summary
321
+ let summary = userSummary;
322
+ let typeInfo = null;
323
+
324
+ if (summary) {
325
+ // User provided summary - infer type from it
326
+ typeInfo = inferTypeFromSummary(summary);
327
+ } else if (context.branch) {
328
+ // Try to parse from branch name
329
+ const branchInfo = parseBranchName(context.branch);
330
+ if (branchInfo) {
331
+ summary = branchInfo.summary;
332
+ typeInfo = INTENT_PATTERNS[branchInfo.type] || { type: branchInfo.type, constraints: [] };
333
+ }
334
+ }
335
+
336
+ // Fallback summary
337
+ if (!summary) {
338
+ if (uniqueFiles.length > 0) {
339
+ const domains = detectDomainsFromFiles(uniqueFiles);
340
+ if (domains.length > 0) {
341
+ summary = `Modify ${domains.join(", ")} files`;
342
+ } else {
343
+ summary = `Modify ${uniqueFiles.length} file(s)`;
344
+ }
345
+ } else {
346
+ summary = "Code changes";
347
+ }
348
+ typeInfo = { type: "general", constraints: [] };
349
+ }
350
+
351
+ // Build constraints
352
+ const constraints = typeInfo?.constraints || [];
353
+
354
+ // Build allowed changes from files
355
+ const allowed_changes = uniqueFiles.map(file => ({
356
+ type: "file_modify",
357
+ target: file,
358
+ }));
359
+
360
+ // Build scope
361
+ const scopeDirs = inferScopeFromFiles(uniqueFiles);
362
+ const scopeDomains = detectDomainsFromFiles(uniqueFiles);
363
+
364
+ let scope = null;
365
+ if (scopeDirs.length > 0 || scopeDomains.length > 0) {
366
+ scope = {};
367
+ if (scopeDirs.length > 0) scope.directories = scopeDirs;
368
+ if (scopeDomains.length > 0) scope.domains = scopeDomains;
369
+ }
370
+
371
+ return {
372
+ summary,
373
+ constraints,
374
+ allowed_changes: allowed_changes.length > 0 ? allowed_changes : undefined,
375
+ scope,
376
+ _context: {
377
+ branch: context.branch,
378
+ stagedFiles: context.stagedFiles.length,
379
+ modifiedFiles: context.modifiedFiles.length,
380
+ inferredType: typeInfo?.type,
381
+ },
382
+ };
383
+ }
384
+
385
+ /**
386
+ * Format a human-readable intent summary from branch name
387
+ * @param {string} branch - Branch name
388
+ * @returns {string} Formatted summary
389
+ */
390
+ function formatBranchAsSummary(branch) {
391
+ const parsed = parseBranchName(branch);
392
+ if (parsed) return parsed.summary;
393
+
394
+ // Fallback: just clean up the branch name
395
+ return branch
396
+ .replace(/[-_]/g, " ")
397
+ .replace(/([a-z])([A-Z])/g, "$1 $2")
398
+ .replace(/\b\w/g, l => l.toUpperCase());
399
+ }
400
+
401
+ // ═══════════════════════════════════════════════════════════════════════════════
402
+ // UTILITIES
403
+ // ═══════════════════════════════════════════════════════════════════════════════
404
+
405
+ function capitalizeFirst(str) {
406
+ return str.charAt(0).toUpperCase() + str.slice(1);
407
+ }
408
+
409
+ // ═══════════════════════════════════════════════════════════════════════════════
410
+ // EXPORTS
411
+ // ═══════════════════════════════════════════════════════════════════════════════
412
+
413
+ module.exports = {
414
+ autoDetectIntent,
415
+ getGitBranch,
416
+ getStagedFiles,
417
+ getModifiedFiles,
418
+ getLastCommitMessage,
419
+ parseBranchName,
420
+ inferTypeFromSummary,
421
+ detectDomainsFromFiles,
422
+ inferScopeFromFiles,
423
+ formatBranchAsSummary,
424
+ INTENT_PATTERNS,
425
+ DOMAIN_PATTERNS,
426
+ };
@@ -0,0 +1,102 @@
1
+ /**
2
+ * Intent Module - Entry Point
3
+ *
4
+ * ═══════════════════════════════════════════════════════════════════════════════
5
+ * AGENT FIREWALL™ - INTENT DECLARATION SYSTEM
6
+ * ═══════════════════════════════════════════════════════════════════════════════
7
+ *
8
+ * @module intent
9
+ * @version 2.0.0
10
+ */
11
+
12
+ "use strict";
13
+
14
+ const {
15
+ INTENT_SCHEMA,
16
+ createIntent,
17
+ computeIntentHash,
18
+ verifyIntentIntegrity,
19
+ updateIntent,
20
+ isIntentExpired,
21
+ createBlockingIntent,
22
+ CONSTRAINT_TYPES,
23
+ CONSTRAINT_TEMPLATES,
24
+ } = require("./schema");
25
+
26
+ const {
27
+ IntentStore,
28
+ SessionIntentTracker,
29
+ globalSessionTracker,
30
+ } = require("./store");
31
+
32
+ const {
33
+ checkAlignment,
34
+ checkAlignmentBatch,
35
+ isFileChangeAllowed,
36
+ isRouteAllowed,
37
+ isEnvVarAllowed,
38
+ isWithinScope,
39
+ isDomainAllowed,
40
+ checkConstraintViolations,
41
+ detectCodeQualityViolations,
42
+ VIOLATION_CODES,
43
+ } = require("./alignment-engine");
44
+
45
+ const {
46
+ autoDetectIntent,
47
+ getGitBranch,
48
+ getStagedFiles,
49
+ getModifiedFiles,
50
+ getLastCommitMessage,
51
+ parseBranchName,
52
+ inferTypeFromSummary,
53
+ detectDomainsFromFiles,
54
+ inferScopeFromFiles,
55
+ formatBranchAsSummary,
56
+ INTENT_PATTERNS,
57
+ DOMAIN_PATTERNS,
58
+ } = require("./auto-detect");
59
+
60
+ module.exports = {
61
+ // Schema
62
+ INTENT_SCHEMA,
63
+ createIntent,
64
+ computeIntentHash,
65
+ verifyIntentIntegrity,
66
+ updateIntent,
67
+ isIntentExpired,
68
+ createBlockingIntent,
69
+ CONSTRAINT_TYPES,
70
+ CONSTRAINT_TEMPLATES,
71
+
72
+ // Storage
73
+ IntentStore,
74
+ SessionIntentTracker,
75
+ globalSessionTracker,
76
+
77
+ // Alignment Engine
78
+ checkAlignment,
79
+ checkAlignmentBatch,
80
+ isFileChangeAllowed,
81
+ isRouteAllowed,
82
+ isEnvVarAllowed,
83
+ isWithinScope,
84
+ isDomainAllowed,
85
+ checkConstraintViolations,
86
+ detectCodeQualityViolations,
87
+ VIOLATION_CODES,
88
+
89
+ // Auto-detect
90
+ autoDetectIntent,
91
+ getGitBranch,
92
+ getStagedFiles,
93
+ getModifiedFiles,
94
+ getLastCommitMessage,
95
+ parseBranchName,
96
+ inferTypeFromSummary,
97
+ detectDomainsFromFiles,
98
+ inferScopeFromFiles,
99
+ formatBranchAsSummary,
100
+ INTENT_PATTERNS,
101
+ DOMAIN_PATTERNS,
102
+ };