@vibecheckai/cli 3.9.1 → 4.0.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 (85) hide show
  1. package/README.md +1 -1
  2. package/bin/runners/context/generators/cursor-enhanced.js +99 -13
  3. package/mcp-server/.eslintrc.json +24 -0
  4. package/mcp-server/README.md +425 -135
  5. package/mcp-server/SPEC.md +583 -0
  6. package/mcp-server/configs/README.md +172 -0
  7. package/mcp-server/configs/claude-desktop-pro.json +31 -0
  8. package/mcp-server/configs/claude-desktop-with-workspace.json +25 -0
  9. package/mcp-server/configs/claude-desktop.json +19 -0
  10. package/mcp-server/configs/cursor-mcp.json +21 -0
  11. package/mcp-server/configs/windsurf-mcp.json +17 -0
  12. package/mcp-server/mcp-config.example.json +9 -0
  13. package/mcp-server/package.json +49 -34
  14. package/mcp-server/src/cli.ts +185 -0
  15. package/mcp-server/src/index.ts +85 -0
  16. package/mcp-server/src/server.ts +1933 -0
  17. package/mcp-server/src/services/cache-service.ts +466 -0
  18. package/mcp-server/src/services/cli-service.ts +345 -0
  19. package/mcp-server/src/services/context-manager.ts +717 -0
  20. package/mcp-server/src/services/firewall-service.ts +662 -0
  21. package/mcp-server/src/services/git-service.ts +671 -0
  22. package/mcp-server/src/services/index.ts +52 -0
  23. package/mcp-server/src/services/prompt-builder-service.ts +1031 -0
  24. package/mcp-server/src/services/session-service.ts +550 -0
  25. package/mcp-server/src/services/tier-service.ts +470 -0
  26. package/mcp-server/src/types.ts +351 -0
  27. package/mcp-server/tsconfig.json +16 -27
  28. package/package.json +6 -6
  29. package/mcp-server/.guardrail/audit/audit.log.jsonl +0 -2
  30. package/mcp-server/.specs/architecture.mdc +0 -90
  31. package/mcp-server/.specs/security.mdc +0 -30
  32. package/mcp-server/HARDENING_SUMMARY.md +0 -299
  33. package/mcp-server/agent-checkpoint.js +0 -364
  34. package/mcp-server/agent-firewall-interceptor.js +0 -500
  35. package/mcp-server/architect-tools.js +0 -707
  36. package/mcp-server/audit-mcp.js +0 -206
  37. package/mcp-server/authority-tools.js +0 -569
  38. package/mcp-server/codebase-architect-tools.js +0 -838
  39. package/mcp-server/conductor/conflict-resolver.js +0 -588
  40. package/mcp-server/conductor/execution-planner.js +0 -544
  41. package/mcp-server/conductor/index.js +0 -377
  42. package/mcp-server/conductor/lock-manager.js +0 -615
  43. package/mcp-server/conductor/request-queue.js +0 -550
  44. package/mcp-server/conductor/session-manager.js +0 -500
  45. package/mcp-server/conductor/tools.js +0 -510
  46. package/mcp-server/consolidated-tools.js +0 -1170
  47. package/mcp-server/deprecation-middleware.js +0 -282
  48. package/mcp-server/handlers/index.ts +0 -15
  49. package/mcp-server/handlers/tool-handler.ts +0 -593
  50. package/mcp-server/hygiene-tools.js +0 -428
  51. package/mcp-server/index-v1.js +0 -698
  52. package/mcp-server/index.js +0 -2940
  53. package/mcp-server/intelligence-tools.js +0 -664
  54. package/mcp-server/intent-drift-tools.js +0 -873
  55. package/mcp-server/intent-firewall-interceptor.js +0 -529
  56. package/mcp-server/lib/api-client.cjs +0 -13
  57. package/mcp-server/lib/cache-wrapper.cjs +0 -383
  58. package/mcp-server/lib/error-envelope.js +0 -138
  59. package/mcp-server/lib/executor.ts +0 -499
  60. package/mcp-server/lib/index.ts +0 -29
  61. package/mcp-server/lib/logger.cjs +0 -30
  62. package/mcp-server/lib/rate-limiter.js +0 -166
  63. package/mcp-server/lib/sandbox.test.ts +0 -519
  64. package/mcp-server/lib/sandbox.ts +0 -395
  65. package/mcp-server/lib/types.ts +0 -267
  66. package/mcp-server/logger.js +0 -173
  67. package/mcp-server/manifest.json +0 -473
  68. package/mcp-server/mdc-generator.js +0 -298
  69. package/mcp-server/premium-tools.js +0 -1275
  70. package/mcp-server/proof-tools.js +0 -571
  71. package/mcp-server/registry/tool-registry.js +0 -586
  72. package/mcp-server/registry/tools.json +0 -619
  73. package/mcp-server/registry.test.ts +0 -340
  74. package/mcp-server/test-mcp.js +0 -108
  75. package/mcp-server/test-tools.js +0 -36
  76. package/mcp-server/tests/tier-gating.test.js +0 -297
  77. package/mcp-server/tier-auth.js +0 -767
  78. package/mcp-server/tools/index.js +0 -72
  79. package/mcp-server/tools-reorganized.ts +0 -244
  80. package/mcp-server/tools-v3.js +0 -1004
  81. package/mcp-server/truth-context.js +0 -622
  82. package/mcp-server/truth-firewall-tools.js +0 -2183
  83. package/mcp-server/vibecheck-2.0-tools.js +0 -761
  84. package/mcp-server/vibecheck-mcp-server-3.2.0.tgz +0 -0
  85. package/mcp-server/vibecheck-tools.js +0 -1075
@@ -1,761 +0,0 @@
1
- /**
2
- * vibecheck 2.0 MCP Tools - Consolidated to 6 Tools
3
- *
4
- * Tools:
5
- * checkpoint() - Pre/post write enforcement, block AI until fixed
6
- * check() - Verify code is real, wired, honest
7
- * ship() - Go/No-Go decision (GO / WARN / NO-GO)
8
- * fix() - Fix blocking issues safely
9
- * status() - Health + version info
10
- * set_strictness() - Set checkpoint strictness level
11
- *
12
- * Server-side enforcement:
13
- * - Fix-Only Mode: Rejects patches outside allowedFiles when blocked
14
- * - Intent Lock: Prevents scope creep when enabled
15
- */
16
-
17
- import { execSync } from "child_process";
18
- import fs from "fs/promises";
19
- import path from "path";
20
- import { getFeatureAccessStatus } from "./tier-auth.js";
21
-
22
- // Strictness levels for checkpoint
23
- const STRICTNESS_LEVELS = ["chill", "standard", "strict", "paranoid"];
24
-
25
- // Current strictness (in-memory, should be persisted per-project)
26
- let currentStrictness = "standard";
27
-
28
- // Blocked state tracking (in-memory, should be persisted)
29
- const blockedState = new Map();
30
-
31
- // ============================================================================
32
- // TOOL DEFINITIONS - 6 TOOLS ONLY
33
- // ============================================================================
34
-
35
- const VIBECHECK_2_TOOLS = [
36
- // 1. CHECKPOINT - Block AI agents until issues are fixed
37
- {
38
- name: "checkpoint",
39
- description: `🛡️ Block AI agents until issues are fixed. Call BEFORE and AFTER every code write.
40
-
41
- Returns:
42
- - PASS: Continue writing code
43
- - BLOCKED: Stop and fix issues first. Response includes:
44
- - blockedFiles: Files with violations
45
- - violations: List of issues with ruleId, message, file, line
46
- - fixOnly: { allowedFiles, forbiddenActions } - Fix-Only Mode restrictions
47
-
48
- If BLOCKED, you MUST:
49
- 1. Enter Fix-Only Mode
50
- 2. Only modify files in allowedFiles
51
- 3. Do NOT add features, refactors, or new files
52
- 4. Call checkpoint again after fixes`,
53
- inputSchema: {
54
- type: "object",
55
- properties: {
56
- file_path: {
57
- type: "string",
58
- description: "Path to file being written",
59
- },
60
- content: {
61
- type: "string",
62
- description: "Content to validate (for pre-write check)",
63
- },
64
- action: {
65
- type: "string",
66
- enum: ["pre_write", "post_write", "status"],
67
- description: "Checkpoint action type",
68
- default: "pre_write",
69
- },
70
- projectPath: {
71
- type: "string",
72
- default: ".",
73
- },
74
- },
75
- required: ["file_path"],
76
- },
77
- },
78
-
79
- // 2. CHECK - Verify code is real, wired, honest
80
- {
81
- name: "check",
82
- description: `🔍 Verify code is real, wired, and honest.
83
-
84
- Consolidates: scan, validate, mockproof
85
- Returns: PASS | WARN | FAIL with findings list
86
-
87
- Use cases:
88
- - Quick code verification
89
- - Mock/placeholder detection (--mocks)
90
- - Security scanning (--only=security)
91
- - AI code validation (--validate)`,
92
- inputSchema: {
93
- type: "object",
94
- properties: {
95
- projectPath: {
96
- type: "string",
97
- default: ".",
98
- },
99
- mocks: {
100
- type: "boolean",
101
- description: "Focus on mock/placeholder detection",
102
- default: false,
103
- },
104
- validate: {
105
- type: "boolean",
106
- description: "Include AI code validation",
107
- default: false,
108
- },
109
- only: {
110
- type: "array",
111
- items: { type: "string" },
112
- description:
113
- "Run specific checks: secrets, auth, routes, mocks, hygiene, security",
114
- },
115
- json: {
116
- type: "boolean",
117
- description: "Return machine-readable JSON",
118
- default: true,
119
- },
120
- },
121
- },
122
- },
123
-
124
- // 3. SHIP - Go/No-Go decision
125
- {
126
- name: "ship",
127
- description: `🚀 Decide if this can ship. Returns GO | WARN | NO-GO.
128
-
129
- Consolidates: ship, gate, realityproof, ai-test, badge, evidence
130
- Flags:
131
- - --ci: CI/CD hard fail mode
132
- - --runtime: Runtime verification (Playwright)
133
- - --badge: Generate ship badge
134
- - --report: Generate full report
135
- - --evidence: Enterprise audit evidence pack`,
136
- inputSchema: {
137
- type: "object",
138
- properties: {
139
- projectPath: {
140
- type: "string",
141
- default: ".",
142
- },
143
- ci: {
144
- type: "boolean",
145
- description: "CI mode - hard fail on issues",
146
- default: false,
147
- },
148
- runtime: {
149
- type: "boolean",
150
- description: "Run runtime verification",
151
- default: false,
152
- },
153
- url: {
154
- type: "string",
155
- description: "URL for runtime testing (required if runtime=true)",
156
- },
157
- badge: {
158
- type: "boolean",
159
- description: "Generate ship badge",
160
- default: false,
161
- },
162
- report: {
163
- type: "boolean",
164
- description: "Generate detailed report",
165
- default: true,
166
- },
167
- evidence: {
168
- type: "boolean",
169
- description: "Generate audit evidence pack (Enterprise)",
170
- default: false,
171
- },
172
- },
173
- },
174
- },
175
-
176
- // 4. FIX - Fix blocking issues safely
177
- {
178
- name: "fix",
179
- description: `🔧 Fix blocking issues safely.
180
-
181
- Options:
182
- - --plan: Show fix plan without applying (default)
183
- - --apply: Apply the fixes
184
- - --pr: Open a pull request with fixes
185
-
186
- Respects Fix-Only Mode restrictions when checkpoint is BLOCKED.`,
187
- inputSchema: {
188
- type: "object",
189
- properties: {
190
- projectPath: {
191
- type: "string",
192
- default: ".",
193
- },
194
- plan: {
195
- type: "boolean",
196
- description: "Show fix plan without applying",
197
- default: true,
198
- },
199
- apply: {
200
- type: "boolean",
201
- description: "Apply fixes",
202
- default: false,
203
- },
204
- pr: {
205
- type: "boolean",
206
- description: "Open PR with fixes",
207
- default: false,
208
- },
209
- scope: {
210
- type: "string",
211
- enum: ["all", "secrets", "auth", "mocks", "routes"],
212
- default: "all",
213
- },
214
- },
215
- },
216
- },
217
-
218
- // 5. STATUS - Health + version info
219
- {
220
- name: "status",
221
- description: `📊 Get vibecheck status - health, version, config, checkpoint state.
222
-
223
- Returns:
224
- - healthy: boolean
225
- - version: string
226
- - checkpoint: { strictness, blockedFiles, fixOnlyMode }
227
- - lastRun: timestamp and results`,
228
- inputSchema: {
229
- type: "object",
230
- properties: {
231
- projectPath: {
232
- type: "string",
233
- default: ".",
234
- },
235
- },
236
- },
237
- },
238
-
239
- // 6. SET_STRICTNESS - Set checkpoint strictness level
240
- {
241
- name: "set_strictness",
242
- description: `⚙️ Set checkpoint strictness level.
243
-
244
- Levels:
245
- - chill: TODOs, FIXMEs, mock data, placeholders
246
- - standard: + console.log, debugger, localhost URLs
247
- - strict: + any types, @ts-ignore, eslint-disable
248
- - paranoid: + nested ternaries, inline styles, JSDoc requirements`,
249
- inputSchema: {
250
- type: "object",
251
- properties: {
252
- level: {
253
- type: "string",
254
- enum: ["chill", "standard", "strict", "paranoid"],
255
- description: "Strictness level",
256
- },
257
- projectPath: {
258
- type: "string",
259
- default: ".",
260
- },
261
- },
262
- required: ["level"],
263
- },
264
- },
265
- ];
266
-
267
- // ============================================================================
268
- // CHECKPOINT RULES BY STRICTNESS
269
- // ============================================================================
270
-
271
- const CHECKPOINT_RULES = {
272
- chill: [
273
- {
274
- id: "no-todo",
275
- pattern: /\/\/\s*TODO[:\s].*$/gim,
276
- message: "TODO comment found",
277
- block: true,
278
- },
279
- {
280
- id: "no-fixme",
281
- pattern: /\/\/\s*FIXME[:\s].*$/gim,
282
- message: "FIXME comment found",
283
- block: true,
284
- },
285
- {
286
- id: "no-mock-data",
287
- pattern: /['"]mock['"]/gi,
288
- message: "Mock data reference",
289
- block: true,
290
- },
291
- {
292
- id: "no-placeholder",
293
- pattern: /placeholder|lorem ipsum/gi,
294
- message: "Placeholder content",
295
- block: true,
296
- },
297
- ],
298
- standard: [
299
- {
300
- id: "no-console-log",
301
- pattern: /console\.log\s*\(/g,
302
- message: "console.log found",
303
- block: true,
304
- },
305
- {
306
- id: "no-debugger",
307
- pattern: /\bdebugger\b/g,
308
- message: "debugger statement",
309
- block: true,
310
- },
311
- {
312
- id: "no-localhost",
313
- pattern: /localhost:\d+/g,
314
- message: "localhost URL",
315
- block: true,
316
- },
317
- {
318
- id: "no-empty-catch",
319
- pattern: /catch\s*\([^)]*\)\s*\{\s*\}/g,
320
- message: "Empty catch block",
321
- block: true,
322
- },
323
- ],
324
- strict: [
325
- {
326
- id: "no-any",
327
- pattern: /:\s*any\b/g,
328
- message: "any type used",
329
- block: true,
330
- },
331
- {
332
- id: "no-ts-ignore",
333
- pattern: /@ts-ignore/g,
334
- message: "@ts-ignore directive",
335
- block: true,
336
- },
337
- {
338
- id: "no-ts-nocheck",
339
- pattern: /@ts-nocheck/g,
340
- message: "@ts-nocheck directive",
341
- block: true,
342
- },
343
- {
344
- id: "no-eslint-disable",
345
- pattern: /eslint-disable/g,
346
- message: "eslint-disable directive",
347
- block: true,
348
- },
349
- ],
350
- paranoid: [
351
- {
352
- id: "no-nested-ternary",
353
- pattern: /\?[^:]+\?/g,
354
- message: "Nested ternary",
355
- block: true,
356
- },
357
- {
358
- id: "no-inline-style",
359
- pattern: /style\s*=\s*\{/g,
360
- message: "Inline style object",
361
- block: true,
362
- },
363
- ],
364
- };
365
-
366
- // ============================================================================
367
- // TOOL HANDLERS
368
- // ============================================================================
369
-
370
- /**
371
- * Handle checkpoint tool - server-side enforcement
372
- */
373
- async function handleCheckpoint(args, dirname) {
374
- const { file_path, content, action = "pre_write", projectPath = "." } = args;
375
- const fullPath = path.resolve(projectPath, file_path);
376
-
377
- // Get current blocked state for this project
378
- const projectKey = path.resolve(projectPath);
379
- const blocked = blockedState.get(projectKey) || { files: [], violations: [] };
380
-
381
- if (action === "status") {
382
- return {
383
- content: [
384
- {
385
- type: "text",
386
- text: JSON.stringify(
387
- {
388
- status: blocked.files.length > 0 ? "BLOCKED" : "PASS",
389
- strictness: currentStrictness,
390
- blockedFiles: blocked.files,
391
- violations: blocked.violations,
392
- fixOnly:
393
- blocked.files.length > 0
394
- ? {
395
- allowedFiles: blocked.files,
396
- forbiddenActions: [
397
- "add_file",
398
- "add_feature",
399
- "refactor",
400
- "change_scope",
401
- ],
402
- }
403
- : null,
404
- },
405
- null,
406
- 2,
407
- ),
408
- },
409
- ],
410
- };
411
- }
412
-
413
- // Validate content against checkpoint rules
414
- const violations = [];
415
- const contentToCheck = content || "";
416
-
417
- // Get rules for current strictness and below
418
- const strictnessIndex = STRICTNESS_LEVELS.indexOf(currentStrictness);
419
- const applicableLevels = STRICTNESS_LEVELS.slice(0, strictnessIndex + 1);
420
-
421
- for (const level of applicableLevels) {
422
- const rules = CHECKPOINT_RULES[level] || [];
423
- for (const rule of rules) {
424
- const matches = contentToCheck.match(rule.pattern);
425
- if (matches) {
426
- for (const match of matches) {
427
- const lineNum = contentToCheck
428
- .substring(0, contentToCheck.indexOf(match))
429
- .split("\n").length;
430
- violations.push({
431
- ruleId: rule.id,
432
- message: rule.message,
433
- file: file_path,
434
- line: lineNum,
435
- match: match.substring(0, 50),
436
- });
437
- }
438
- }
439
- }
440
- }
441
-
442
- if (violations.length > 0) {
443
- // Update blocked state
444
- if (!blocked.files.includes(file_path)) {
445
- blocked.files.push(file_path);
446
- }
447
- blocked.violations = [...blocked.violations, ...violations];
448
- blockedState.set(projectKey, blocked);
449
-
450
- return {
451
- isError: true,
452
- content: [
453
- {
454
- type: "text",
455
- text: JSON.stringify(
456
- {
457
- status: "BLOCKED",
458
- message: `🛑 CHECKPOINT BLOCKED: ${violations.length} violation(s) found`,
459
- blockedFiles: blocked.files,
460
- violations: violations,
461
- fixOnly: {
462
- allowedFiles: blocked.files,
463
- forbiddenActions: [
464
- "add_file",
465
- "add_feature",
466
- "refactor",
467
- "change_scope",
468
- ],
469
- },
470
- instruction:
471
- "Enter Fix-Only Mode. Only modify files in allowedFiles. Do NOT add features or new files.",
472
- },
473
- null,
474
- 2,
475
- ),
476
- },
477
- ],
478
- };
479
- }
480
-
481
- // Clear blocked state for this file if it was blocked
482
- if (blocked.files.includes(file_path)) {
483
- blocked.files = blocked.files.filter((f) => f !== file_path);
484
- blocked.violations = blocked.violations.filter((v) => v.file !== file_path);
485
- blockedState.set(projectKey, blocked);
486
- }
487
-
488
- return {
489
- content: [
490
- {
491
- type: "text",
492
- text: JSON.stringify(
493
- {
494
- status: "PASS",
495
- message: "✅ Checkpoint passed",
496
- blockedFiles: blocked.files,
497
- },
498
- null,
499
- 2,
500
- ),
501
- },
502
- ],
503
- };
504
- }
505
-
506
- /**
507
- * Handle check tool - unified code verification
508
- */
509
- async function handleCheck(args, dirname) {
510
- const { projectPath = ".", mocks, validate, only, json = true } = args;
511
-
512
- let output = "# 🔍 vibecheck Check\n\n";
513
-
514
- try {
515
- let cmd = `node "${path.join(dirname, "..", "bin", "vibecheck.js")}" check`;
516
- if (mocks) cmd += " --mocks";
517
- if (validate) cmd += " --validate";
518
- if (only?.length) cmd += ` --only=${only.join(",")}`;
519
- if (json) cmd += " --json";
520
-
521
- const result = execSync(cmd, {
522
- cwd: path.resolve(projectPath),
523
- encoding: "utf8",
524
- maxBuffer: 10 * 1024 * 1024,
525
- });
526
-
527
- if (json) {
528
- return { content: [{ type: "text", text: result }] };
529
- }
530
-
531
- output += result;
532
- } catch (err) {
533
- output += `⚠️ Check error: ${err.message}\n`;
534
- }
535
-
536
- return { content: [{ type: "text", text: output }] };
537
- }
538
-
539
- /**
540
- * Handle ship tool - Go/No-Go decision (PRO tier required)
541
- */
542
- async function handleShip(args, dirname) {
543
- // Check tier access (PRO tier required)
544
- const access = await getFeatureAccessStatus("vibecheck.ship", args?.apiKey);
545
- if (!access.hasAccess) {
546
- return {
547
- content: [{
548
- type: "text",
549
- text: `🚫 UPGRADE REQUIRED\n\n${access.reason}\n\nCurrent tier: ${access.tier}\nUpgrade at: https://vibecheckai.dev/pricing`
550
- }],
551
- isError: true
552
- };
553
- }
554
-
555
- const { projectPath = ".", ci, runtime, url, badge, report, evidence } = args;
556
-
557
- let output = "# 🚀 vibecheck Ship\n\n";
558
-
559
- try {
560
- let cmd = `node "${path.join(dirname, "..", "bin", "vibecheck.js")}" ship`;
561
- if (ci) cmd += " --ci";
562
- if (runtime && url) cmd += ` --runtime --url="${url}"`;
563
- if (badge) cmd += " --badge";
564
- if (evidence) cmd += " --evidence";
565
- cmd += " --json";
566
-
567
- const result = execSync(cmd, {
568
- cwd: path.resolve(projectPath),
569
- encoding: "utf8",
570
- maxBuffer: 10 * 1024 * 1024,
571
- });
572
-
573
- return { content: [{ type: "text", text: result }] };
574
- } catch (err) {
575
- // Ship command exits non-zero for NO-GO
576
- output += `## 🚫 NO-GO\n\n`;
577
- output += `${err.message}\n`;
578
- output += `\nRun \`vibecheck fix --plan\` to see fixes.\n`;
579
- }
580
-
581
- return { content: [{ type: "text", text: output }] };
582
- }
583
-
584
- /**
585
- * Handle fix tool
586
- */
587
- async function handleFix(args, dirname) {
588
- const { projectPath = ".", plan = true, apply, pr, scope = "all" } = args;
589
-
590
- // Check Fix-Only Mode restrictions
591
- const projectKey = path.resolve(projectPath);
592
- const blocked = blockedState.get(projectKey);
593
-
594
- if (blocked?.files.length > 0) {
595
- return {
596
- content: [
597
- {
598
- type: "text",
599
- text: JSON.stringify(
600
- {
601
- fixOnlyMode: true,
602
- message:
603
- "⚠️ Fix-Only Mode active. Fixes restricted to blocked files.",
604
- allowedFiles: blocked.files,
605
- scope: scope,
606
- },
607
- null,
608
- 2,
609
- ),
610
- },
611
- ],
612
- };
613
- }
614
-
615
- let output = "# 🔧 vibecheck Fix\n\n";
616
-
617
- try {
618
- let cmd = `node "${path.join(dirname, "..", "bin", "vibecheck.js")}" fix`;
619
- if (plan && !apply) cmd += " --plan";
620
- if (apply) cmd += " --apply";
621
- if (pr) cmd += " --pr";
622
- cmd += ` --scope=${scope}`;
623
-
624
- const result = execSync(cmd, {
625
- cwd: path.resolve(projectPath),
626
- encoding: "utf8",
627
- maxBuffer: 10 * 1024 * 1024,
628
- });
629
-
630
- output += result;
631
- } catch (err) {
632
- output += `⚠️ Fix error: ${err.message}\n`;
633
- }
634
-
635
- return { content: [{ type: "text", text: output }] };
636
- }
637
-
638
- /**
639
- * Handle status tool
640
- */
641
- async function handleStatus(args, dirname) {
642
- const { projectPath = "." } = args;
643
- const projectKey = path.resolve(projectPath);
644
- const blocked = blockedState.get(projectKey) || { files: [], violations: [] };
645
-
646
- const status = {
647
- healthy: true,
648
- version: "2.0.0",
649
- checkpoint: {
650
- strictness: currentStrictness,
651
- blockedFiles: blocked.files,
652
- fixOnlyMode: blocked.files.length > 0,
653
- violations: blocked.violations.length,
654
- },
655
- lastRun: null,
656
- };
657
-
658
- // Try to read last run info
659
- try {
660
- const summaryPath = path.join(projectPath, ".vibecheck", "summary.json");
661
- const summary = JSON.parse(await fs.readFile(summaryPath, "utf-8"));
662
- status.lastRun = {
663
- timestamp: summary.timestamp,
664
- score: summary.score,
665
- canShip: summary.canShip,
666
- };
667
- } catch {
668
- // No last run
669
- }
670
-
671
- return {
672
- content: [
673
- {
674
- type: "text",
675
- text: JSON.stringify(status, null, 2),
676
- },
677
- ],
678
- };
679
- }
680
-
681
- /**
682
- * Handle set_strictness tool
683
- */
684
- function handleSetStrictness(args) {
685
- const { level, projectPath = "." } = args;
686
-
687
- if (!STRICTNESS_LEVELS.includes(level)) {
688
- return {
689
- isError: true,
690
- content: [
691
- {
692
- type: "text",
693
- text: `Invalid strictness level: ${level}. Valid: ${STRICTNESS_LEVELS.join(", ")}`,
694
- },
695
- ],
696
- };
697
- }
698
-
699
- const previousLevel = currentStrictness;
700
- currentStrictness = level;
701
-
702
- // Clear blocked state when changing strictness (they'll need to re-check)
703
- const projectKey = path.resolve(projectPath);
704
- blockedState.delete(projectKey);
705
-
706
- return {
707
- content: [
708
- {
709
- type: "text",
710
- text: JSON.stringify(
711
- {
712
- success: true,
713
- previousLevel,
714
- currentLevel: currentStrictness,
715
- message: `Strictness changed from ${previousLevel} to ${currentStrictness}. Blocked state cleared.`,
716
- },
717
- null,
718
- 2,
719
- ),
720
- },
721
- ],
722
- };
723
- }
724
-
725
- /**
726
- * Route tool calls to handlers
727
- */
728
- async function handleVibecheck2Tool(name, args, dirname) {
729
- switch (name) {
730
- case "checkpoint":
731
- return await handleCheckpoint(args, dirname);
732
- case "check":
733
- return await handleCheck(args, dirname);
734
- case "ship":
735
- return await handleShip(args, dirname);
736
- case "fix":
737
- return await handleFix(args, dirname);
738
- case "status":
739
- return await handleStatus(args, dirname);
740
- case "set_strictness":
741
- return handleSetStrictness(args);
742
- default:
743
- return {
744
- isError: true,
745
- content: [{ type: "text", text: `Unknown tool: ${name}` }],
746
- };
747
- }
748
- }
749
-
750
- export {
751
- VIBECHECK_2_TOOLS,
752
- handleVibecheck2Tool,
753
- handleCheckpoint,
754
- handleCheck,
755
- handleShip,
756
- handleFix,
757
- handleStatus,
758
- handleSetStrictness,
759
- CHECKPOINT_RULES,
760
- STRICTNESS_LEVELS,
761
- };