@vibecheckai/cli 3.7.0 → 3.9.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 (118) 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 +634 -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/interceptor/base.js +7 -3
  26. package/bin/runners/lib/agent-firewall/session/collector.js +451 -0
  27. package/bin/runners/lib/agent-firewall/session/index.js +26 -0
  28. package/bin/runners/lib/artifact-envelope.js +540 -0
  29. package/bin/runners/lib/auth-shared.js +977 -0
  30. package/bin/runners/lib/checkpoint.js +941 -0
  31. package/bin/runners/lib/cleanup/engine.js +571 -0
  32. package/bin/runners/lib/cleanup/index.js +53 -0
  33. package/bin/runners/lib/cleanup/output.js +375 -0
  34. package/bin/runners/lib/cleanup/rules.js +1060 -0
  35. package/bin/runners/lib/doctor/diagnosis-receipt.js +454 -0
  36. package/bin/runners/lib/doctor/failure-signatures.js +526 -0
  37. package/bin/runners/lib/doctor/fix-script.js +336 -0
  38. package/bin/runners/lib/doctor/modules/build-tools.js +453 -0
  39. package/bin/runners/lib/doctor/modules/index.js +62 -3
  40. package/bin/runners/lib/doctor/modules/os-quirks.js +706 -0
  41. package/bin/runners/lib/doctor/modules/repo-integrity.js +485 -0
  42. package/bin/runners/lib/doctor/safe-repair.js +384 -0
  43. package/bin/runners/lib/engine/ast-cache.js +210 -210
  44. package/bin/runners/lib/engine/auth-extractor.js +211 -211
  45. package/bin/runners/lib/engine/billing-extractor.js +112 -112
  46. package/bin/runners/lib/engine/enforcement-extractor.js +100 -100
  47. package/bin/runners/lib/engine/env-extractor.js +207 -207
  48. package/bin/runners/lib/engine/express-extractor.js +208 -208
  49. package/bin/runners/lib/engine/extractors.js +849 -849
  50. package/bin/runners/lib/engine/index.js +207 -207
  51. package/bin/runners/lib/engine/repo-index.js +514 -514
  52. package/bin/runners/lib/engine/types.js +124 -124
  53. package/bin/runners/lib/engines/attack-detector.js +1192 -0
  54. package/bin/runners/lib/entitlements-v2.js +2 -2
  55. package/bin/runners/lib/missions/briefing.js +427 -0
  56. package/bin/runners/lib/missions/checkpoint.js +753 -0
  57. package/bin/runners/lib/missions/hardening.js +851 -0
  58. package/bin/runners/lib/missions/plan.js +421 -32
  59. package/bin/runners/lib/missions/safety-gates.js +645 -0
  60. package/bin/runners/lib/missions/schema.js +478 -0
  61. package/bin/runners/lib/packs/bundle.js +675 -0
  62. package/bin/runners/lib/packs/evidence-pack.js +671 -0
  63. package/bin/runners/lib/packs/pack-factory.js +837 -0
  64. package/bin/runners/lib/packs/permissions-pack.js +686 -0
  65. package/bin/runners/lib/packs/proof-graph-pack.js +779 -0
  66. package/bin/runners/lib/safelist/index.js +96 -0
  67. package/bin/runners/lib/safelist/integration.js +334 -0
  68. package/bin/runners/lib/safelist/matcher.js +696 -0
  69. package/bin/runners/lib/safelist/schema.js +948 -0
  70. package/bin/runners/lib/safelist/store.js +438 -0
  71. package/bin/runners/lib/schemas/ship-manifest.schema.json +251 -0
  72. package/bin/runners/lib/ship-gate.js +832 -0
  73. package/bin/runners/lib/ship-manifest.js +1153 -0
  74. package/bin/runners/lib/ship-output.js +1 -1
  75. package/bin/runners/lib/unified-cli-output.js +710 -383
  76. package/bin/runners/lib/upsell.js +3 -3
  77. package/bin/runners/lib/why-tree.js +650 -0
  78. package/bin/runners/runAllowlist.js +33 -4
  79. package/bin/runners/runApprove.js +240 -1122
  80. package/bin/runners/runAudit.js +692 -0
  81. package/bin/runners/runAuth.js +325 -29
  82. package/bin/runners/runCheckpoint.js +442 -494
  83. package/bin/runners/runCleanup.js +343 -0
  84. package/bin/runners/runDoctor.js +269 -19
  85. package/bin/runners/runFix.js +411 -32
  86. package/bin/runners/runForge.js +411 -0
  87. package/bin/runners/runIntent.js +906 -0
  88. package/bin/runners/runKickoff.js +878 -0
  89. package/bin/runners/runLaunch.js +2000 -0
  90. package/bin/runners/runLink.js +785 -0
  91. package/bin/runners/runMcp.js +1741 -837
  92. package/bin/runners/runPacks.js +2089 -0
  93. package/bin/runners/runPolish.js +41 -0
  94. package/bin/runners/runReality.js +178 -1
  95. package/bin/runners/runSafelist.js +1190 -0
  96. package/bin/runners/runScan.js +21 -9
  97. package/bin/runners/runShield.js +1282 -0
  98. package/bin/runners/runShip.js +395 -16
  99. package/bin/vibecheck.js +34 -6
  100. package/mcp-server/README.md +117 -158
  101. package/mcp-server/handlers/index.ts +2 -2
  102. package/mcp-server/handlers/tool-handler.ts +50 -11
  103. package/mcp-server/index.js +16 -0
  104. package/mcp-server/intent-firewall-interceptor.js +529 -0
  105. package/mcp-server/lib/executor.ts +5 -5
  106. package/mcp-server/lib/index.ts +14 -4
  107. package/mcp-server/lib/sandbox.test.ts +4 -4
  108. package/mcp-server/lib/sandbox.ts +2 -2
  109. package/mcp-server/manifest.json +473 -0
  110. package/mcp-server/package.json +1 -1
  111. package/mcp-server/registry/tool-registry.js +315 -523
  112. package/mcp-server/registry/tools.json +442 -428
  113. package/mcp-server/registry.test.ts +18 -12
  114. package/mcp-server/tier-auth.js +68 -11
  115. package/mcp-server/tools-v3.js +70 -16
  116. package/mcp-server/tsconfig.json +1 -0
  117. package/package.json +2 -1
  118. package/bin/runners/runProof.zip +0 -0
@@ -1,4 +1,4 @@
1
- # vibecheck MCP Server
1
+ # vibecheck MCP Server v4.0
2
2
 
3
3
  Professional Model Context Protocol server for vibecheck AI.
4
4
 
@@ -7,12 +7,25 @@ Professional Model Context Protocol server for vibecheck AI.
7
7
  ## Installation
8
8
 
9
9
  ```bash
10
- npm install -g vibecheck-mcp-server
10
+ npm install -g @vibecheckai/cli
11
11
  ```
12
12
 
13
13
  ## Configuration
14
14
 
15
- See [MCP-INSTALLATION-GUIDE.md](../docs/MCP-INSTALLATION-GUIDE.md) for editor-specific setup.
15
+ Add to your AI IDE's MCP configuration:
16
+
17
+ ```json
18
+ {
19
+ "mcpServers": {
20
+ "vibecheck": {
21
+ "command": "npx",
22
+ "args": ["@vibecheckai/cli", "mcp"]
23
+ }
24
+ }
25
+ }
26
+ ```
27
+
28
+ See [MCP-QUICK-START.md](../docs/MCP-QUICK-START.md) for editor-specific setup.
16
29
 
17
30
  ## Development
18
31
 
@@ -22,231 +35,177 @@ npm install
22
35
  npm start
23
36
  ```
24
37
 
25
- ## Premium Command Palette Tools
26
-
27
- These tools provide a top-notch, zero-friction UX:
38
+ ---
28
39
 
29
- ### Ship Check Commands
30
- - `run_ship` - vibecheck: Ship Check (GO/NO-GO)
31
- - `run_reality` - vibecheck: Run Reality Mode
32
- - `run_mockproof` - vibecheck: Run MockProof Gate
33
- - `run_airlock` - vibecheck: Run Airlock (SupplyChain)
40
+ ## Core MCP Tools (v4.0)
34
41
 
35
- ### Report & Artifact Commands
36
- - `get_last_run` - vibecheck: Open Last Run Report
37
- - `open_artifact` - Open Report/Replay/Trace/SARIF/Badge
38
- - `rerun_last_check` - vibecheck: Re-run Last Check
39
- - `export_sarif` - Export findings as SARIF
42
+ These are the primary tools available via MCP:
40
43
 
41
- ### Setup & Policy Commands
42
- - `run_doctor` - vibecheck: Doctor (Fix my setup)
43
- - `edit_policies` - vibecheck: Policies (Quick Edit)
44
- - `get_status` - Get server status and workspace info
45
- - `policy_patch` - Apply atomic policy changes
46
-
47
- ### Fix Mode Commands
48
- - `enter_fix_mode` - Enter Fix Mode for blocker resolution
49
- - `fix_mode_status` - Get Fix Mode checklist status
50
- - `mark_fix_complete` - Mark blocker as fixed
51
- - `exit_fix_mode` - Exit and re-run ship check
44
+ | Tool | Description |
45
+ |------|-------------|
46
+ | `vibecheck_audit` | 🔍 Static analysis - routes, secrets, contracts |
47
+ | `vibecheck_ship` | 🚀 Verdict engine - SHIP / WARN / BLOCK |
48
+ | `vibecheck_prove` | 🔬 Full proof loop: audit → reality → ship |
49
+ | `vibecheck_fix` | 🛠️ Mission-based auto-fix with safety gates |
50
+ | `vibecheck_reality` | 🧪 Browser-based runtime verification |
51
+ | `vibecheck_forge` | 📝 Generate AI IDE rules (.cursorrules, .windsurf) |
52
+ | `vibecheck_shield` | 🛡️ Agent Firewall controls |
53
+ | `vibecheck_doctor` | 🏥 Environment health check |
54
+ | `vibecheck_checkpoint` | 📍 Snapshot & restore, baseline comparison |
55
+ | `vibecheck_polish` | ✨ Production polish - final cleanup |
52
56
 
53
- ### Evidence & Diagnostics
54
- - `explain_finding` - Get detailed finding explanation
57
+ ---
55
58
 
56
- ## AI vibecheck Tools (Prompt Firewall + Output Verification)
59
+ ## Shield (Agent Firewall) Tools
57
60
 
58
- These tools provide AI safety and verification capabilities:
61
+ Control the Agent Firewall via MCP:
59
62
 
60
63
  | Tool | Description |
61
64
  |------|-------------|
62
- | `vibecheck.verify` | 🛡️ Verify AI agent output before applying - checks secrets, dangerous commands, path traversal |
63
- | `vibecheck.quality` | 📊 Code quality analysis - complexity, maintainability, technical debt metrics |
64
- | `vibecheck.smells` | 👃 Code smell detection - anti-patterns, naming issues, structural problems |
65
- | `vibecheck.hallucination` | 🔍 Hallucination check - verify claims against actual source code |
66
- | `vibecheck.breaking` | ⚠️ Breaking change detection - API changes, removed methods, type changes |
67
- | `vibecheck.mdc` | 📝 MDC Generator - source-anchored documentation generation |
68
- | `vibecheck.coverage` | 🧪 Test coverage mapping - identify untested components |
65
+ | `vibecheck_shield_status` | Get firewall status |
66
+ | `vibecheck_shield_enforce` | Enable enforcement mode |
67
+ | `vibecheck_shield_observe` | Enable observe-only mode |
68
+ | `vibecheck_shield_lock` | Hard lockdown (all rules enforced) |
69
+ | `vibecheck_shield_unlock` | Release lock |
70
+ | `vibecheck_shield_verify` | Verify claims/prompts |
69
71
 
70
- ### Example Usage
72
+ ---
71
73
 
72
- ```json
73
- // Verify AI-generated code before applying
74
- {
75
- "tool": "vibecheck.verify",
76
- "arguments": {
77
- "input": "{\"format\":\"vibecheck-v1\",\"diff\":\"...\",\"commands\":[]}",
78
- "mode": "build"
79
- }
80
- }
74
+ ## Intent & Approval Tools
81
75
 
82
- // Check code quality
83
- {
84
- "tool": "vibecheck.quality",
85
- "arguments": {
86
- "projectPath": ".",
87
- "threshold": 70
88
- }
89
- }
90
-
91
- // Detect code smells
92
- {
93
- "tool": "vibecheck.smells",
94
- "arguments": {
95
- "projectPath": ".",
96
- "severity": "high"
97
- }
98
- }
99
- ```
100
-
101
- ## Agent Checkpoint Tools
102
-
103
- Pre-write validation that blocks AI agents until issues are fixed:
76
+ For declaring AI intent and approving changes:
104
77
 
105
78
  | Tool | Description |
106
79
  |------|-------------|
107
- | `vibecheck_checkpoint` | 🛡️ Validate code before writing - blocks on TODOs, mocks, console.log, etc. |
108
- | `vibecheck_set_strictness` | ⚙️ Set checkpoint strictness: chill, standard, strict, paranoid |
109
- | `vibecheck_checkpoint_status` | 📊 Get current checkpoint status and blocking violations |
80
+ | `vibecheck_intent_start` | 🎯 Declare intent before making changes |
81
+ | `vibecheck_intent_check` | Check if changes align with stated intent |
82
+ | `vibecheck_intent_complete` | Complete step and generate proof artifact |
83
+ | `vibecheck_approve` | 👍 Review and approve session changes |
84
+
85
+ ---
110
86
 
111
- ## Architect Tools
87
+ ## Checkpoint Tools
112
88
 
113
- AI agents consult the Architect before writing code:
89
+ Pre-write validation and time machine:
114
90
 
115
91
  | Tool | Description |
116
92
  |------|-------------|
117
- | `vibecheck_architect_review` | 🏛️ Review code against architecture patterns |
118
- | `vibecheck_architect_suggest` | 💡 Get architectural guidance before writing code |
119
- | `vibecheck_architect_patterns` | 📋 List all active architecture patterns |
120
- | `vibecheck_architect_set_strictness` | ⚙️ Set architect strictness level |
93
+ | `vibecheck_checkpoint` | 🛡️ Validate code before writing - blocks on issues |
94
+ | `vibecheck_checkpoint_status` | 📊 Get current checkpoint status |
95
+ | `vibecheck_checkpoint_restore` | Restore to a previous checkpoint |
96
+ | `vibecheck_checkpoint_compare` | 📈 Compare baseline vs current |
97
+
98
+ ---
121
99
 
122
- ## Codebase Architect Tools
100
+ ## Report & Artifact Tools
123
101
 
124
- Deep codebase knowledge for AI agents:
102
+ Generate outputs and evidence:
125
103
 
126
104
  | Tool | Description |
127
105
  |------|-------------|
128
- | `vibecheck_architect_context` | 🧠 Load full codebase context (tech stack, conventions, patterns) |
129
- | `vibecheck_architect_guide` | 🏛️ Get guidance for creating/modifying code |
130
- | `vibecheck_architect_validate` | Validate code against codebase patterns |
131
- | `vibecheck_architect_dependencies` | 🔗 Understand file relationships and impact |
106
+ | `vibecheck_packs_evidence` | 📦 Bundle videos, traces, screenshots |
107
+ | `vibecheck_packs_report` | 📄 Generate HTML/MD/SARIF reports |
108
+ | `vibecheck_packs_graph` | 📊 Proof graph visualization |
109
+ | `vibecheck_seal` | 🏆 Generate ship badge and attestation |
132
110
 
133
- ## vibecheck 2.0 Tools (Consolidated)
111
+ ---
134
112
 
135
- Six core tools for the complete workflow:
113
+ ## Example Usage
136
114
 
137
- | Tool | Description |
138
- |------|-------------|
139
- | `checkpoint` | 🛡️ Block AI agents until issues are fixed (pre/post write) |
140
- | `check` | 🔍 Verify code is real, wired, honest |
141
- | `ship` | 🚀 Go/No-Go decision (GO / WARN / NO-GO) |
142
- | `fix` | 🔧 Fix blocking issues safely |
143
- | `status` | 📊 Health + version info |
144
- | `set_strictness` | ⚙️ Set checkpoint strictness level |
115
+ ### Run Analysis
145
116
 
146
- ## Intent Drift Guard Tools
147
-
148
- Capture intent before writing code, monitor for drift:
117
+ ```json
118
+ {
119
+ "tool": "vibecheck_audit",
120
+ "arguments": {
121
+ "path": ".",
122
+ "profile": "full"
123
+ }
124
+ }
125
+ ```
149
126
 
150
- | Tool | Description |
151
- |------|-------------|
152
- | `vibecheck_intent_start` | 🎯 Start a new step with explicit intent |
153
- | `vibecheck_intent_check` | ✅ Check if code changes align with stated intent |
154
- | `vibecheck_intent_validate_prompt` | 🔒 Validate new prompts against locked intent |
155
- | `vibecheck_intent_status` | 📊 Get current Intent Drift Guard status |
156
- | `vibecheck_intent_complete` | ✅ Complete step and generate proof artifact |
157
- | `vibecheck_intent_lock` | 🔒 Lock intent to prevent scope expansion |
158
- | `vibecheck_intent_unlock` | 🔓 Unlock intent, allow scope changes |
127
+ ### Get Ship Verdict
159
128
 
160
- ## Fix Missions v1 + Reality v2 Tools
129
+ ```json
130
+ {
131
+ "tool": "vibecheck_ship",
132
+ "arguments": {
133
+ "path": "."
134
+ }
135
+ }
136
+ ```
161
137
 
162
- Production-ready AI fix loop and runtime verification:
138
+ ### Full Proof Loop
163
139
 
164
- | Tool | Description |
165
- |------|-------------|
166
- | `vibecheck.fix` | 🛠 Fix Missions v1 — AI-powered surgical fixes with verification loop |
167
- | `vibecheck.reality` | 🧪 Reality Mode v2 — Two-pass auth verification (anon + auth), Dead UI detection |
168
- | `vibecheck.prove` | 🔬 One Command Reality Proof — orchestrates ctx → reality → ship → fix loop |
169
- | `vibecheck.share` | 📦 Share Bundle — generate PR comment / review bundle from fix missions |
140
+ ```json
141
+ {
142
+ "tool": "vibecheck_prove",
143
+ "arguments": {
144
+ "url": "http://localhost:3000",
145
+ "maxFixRounds": 3
146
+ }
147
+ }
148
+ ```
170
149
 
171
- ### vibecheck.reality Options
150
+ ### Runtime Verification
172
151
 
173
152
  ```json
174
153
  {
175
- "tool": "vibecheck.reality",
154
+ "tool": "vibecheck_reality",
176
155
  "arguments": {
177
156
  "url": "http://localhost:3000",
178
- "verifyAuth": true,
179
- "auth": "user@example.com:password",
180
- "storageState": ".vibecheck/reality/storageState.json",
181
- "truthpack": ".vibecheck/truth/truthpack.json",
182
157
  "headed": false,
183
158
  "maxPages": 18,
184
- "maxDepth": 2,
185
- "danger": false
159
+ "maxDepth": 2
186
160
  }
187
161
  }
188
162
  ```
189
163
 
190
- ### vibecheck.fix Options
164
+ ### AI-Powered Fixes
191
165
 
192
166
  ```json
193
167
  {
194
- "tool": "vibecheck.fix",
168
+ "tool": "vibecheck_fix",
195
169
  "arguments": {
196
- "promptOnly": false,
197
170
  "apply": true,
198
- "autopilot": true,
199
- "share": true,
200
- "maxMissions": 8,
201
- "maxSteps": 10
171
+ "autopilot": false,
172
+ "maxMissions": 8
202
173
  }
203
174
  }
204
175
  ```
205
176
 
206
- ### vibecheck.prove Options
177
+ ### Generate IDE Rules
207
178
 
208
179
  ```json
209
180
  {
210
- "tool": "vibecheck.prove",
181
+ "tool": "vibecheck_forge",
211
182
  "arguments": {
212
- "url": "http://localhost:3000",
213
- "auth": "user@example.com:password",
214
- "maxFixRounds": 3,
215
- "skipReality": false,
216
- "skipFix": false
183
+ "format": "cursor",
184
+ "enhanced": true
217
185
  }
218
186
  }
219
187
  ```
220
188
 
221
- ## Core Analysis Tools
222
-
223
- - `validate_project` - Validate project structure and API endpoints
224
- - `check_design_system` - Validate design system consistency
225
- - `check_project_drift` - Check for architecture drift
226
- - `setup_design_system` - Set up and lock design system
227
- - `register_api_endpoint` - Register API endpoint
228
- - `get_project_health` - Get project health score
229
- - `get_vibechecks_rules` - Get vibechecks rules
230
- - `architect_analyze` - Intelligent project analysis
231
- - `build_knowledge_base` - Build codebase knowledge
232
- - `semantic_search` - Search code by meaning
233
- - `security_scan` - Full security scan
234
- - `ship_check` - Ship readiness check
235
- - `get_deploy_verdict` - Get deploy GO/NO-GO decision
189
+ ---
236
190
 
237
191
  ## Resources
238
192
 
239
- - `vibechecks://rules` - Vibechecks rules document
240
- - `vibechecks://templates` - Available templates
241
- - `vibechecks://design-tokens` - Design system tokens
193
+ - `vibecheck://rules` - Generated AI rules
194
+ - `vibecheck://truthpack` - Repo reality index
195
+ - `vibecheck://status` - Server status and health
196
+
197
+ ---
242
198
 
243
199
  ## Documentation
244
200
 
245
- See [MCP-PREMIUM-TOOLS.md](../docs/MCP-PREMIUM-TOOLS.md) for detailed tool documentation.
201
+ - [MCP Quick Start](../docs/MCP-QUICK-START.md)
202
+ - [Full CLI Documentation](../docs/CLI-REFERENCE.md)
203
+ - [Agent Firewall Spec](../docs/AGENT_FIREWALL_V2_SPEC.md)
204
+
205
+ ---
246
206
 
247
207
  ## Privacy & Trust
248
208
 
249
209
  - Runs locally
250
210
  - Artifacts saved to `.vibecheck/`
251
- - No upload unless you export/share
252
-
211
+ - No upload unless you explicitly export/share
@@ -10,6 +10,6 @@ export {
10
10
  getToolsByTier,
11
11
  getToolsByCategory,
12
12
  validateRegistry,
13
- } from "./tool-handler";
13
+ } from "./tool-handler.js";
14
14
 
15
- export { default as ToolHandler } from "./tool-handler";
15
+ export { default as ToolHandler } from "./tool-handler.js";
@@ -13,8 +13,9 @@
13
13
  * 7) Return response with error envelope
14
14
  */
15
15
 
16
- import * as fs from "fs";
17
- import * as path from "path";
16
+ import * as fs from "node:fs";
17
+ import * as path from "node:path";
18
+ import { fileURLToPath } from "node:url";
18
19
  import Ajv from "ajv";
19
20
  import type {
20
21
  RunRequest,
@@ -25,9 +26,46 @@ import type {
25
26
  ToolResult,
26
27
  ValidationError,
27
28
  Finding,
28
- } from "../lib/types";
29
- import { PathSandbox } from "../lib/sandbox";
30
- import { CliExecutor, parseCliOutput, sortFindings, buildCliArgs } from "../lib/executor";
29
+ } from "../lib/types.js";
30
+ import { resolveSandboxPath, configFromRunRequest, type SandboxConfig } from "../lib/sandbox.js";
31
+ import { CliExecutor, parseCliOutput, sortFindings, buildCliArgs } from "../lib/executor.js";
32
+
33
+ // ESM __dirname equivalent
34
+ const __filename = fileURLToPath(import.meta.url);
35
+ const __dirname = path.dirname(__filename);
36
+
37
+ /**
38
+ * Simple PathSandbox wrapper class using the sandbox functions
39
+ */
40
+ class PathSandbox {
41
+ private config: SandboxConfig;
42
+
43
+ constructor(options: { projectRoot: string }) {
44
+ this.config = {
45
+ workspaceRoot: options.projectRoot,
46
+ includeThirdParty: false,
47
+ includeGenerated: false,
48
+ };
49
+ }
50
+
51
+ assertAllowed(inputPath: string): string {
52
+ const result = resolveSandboxPath(inputPath, this.config);
53
+ if (!result.valid) {
54
+ const error = new Error(result.error || "Path not allowed") as Error & { violationType?: string };
55
+ error.violationType = result.errorCode;
56
+ throw error;
57
+ }
58
+ return result.resolvedPath!;
59
+ }
60
+
61
+ validate(inputPath: string): { allowed: boolean; error?: string } {
62
+ const result = resolveSandboxPath(inputPath, this.config);
63
+ return {
64
+ allowed: result.valid,
65
+ error: result.error,
66
+ };
67
+ }
68
+ }
31
69
 
32
70
  // ═══════════════════════════════════════════════════════════════════════════════
33
71
  // REGISTRY
@@ -78,7 +116,8 @@ function getToolDefinition(toolName: string): ToolDefinition | null {
78
116
  // VALIDATION
79
117
  // ═══════════════════════════════════════════════════════════════════════════════
80
118
 
81
- const ajv = new Ajv({ allErrors: true, strict: false });
119
+ const AjvClass = Ajv.default || Ajv;
120
+ const ajv = new AjvClass({ allErrors: true, strict: false });
82
121
 
83
122
  /**
84
123
  * Validate data against JSON schema
@@ -86,14 +125,14 @@ const ajv = new Ajv({ allErrors: true, strict: false });
86
125
  function validateSchema(
87
126
  data: unknown,
88
127
  schema: unknown,
89
- schemaName: string
128
+ _schemaName: string
90
129
  ): ValidationError[] {
91
130
  const validate = ajv.compile(schema as object);
92
131
  const valid = validate(data);
93
132
 
94
133
  if (valid) return [];
95
134
 
96
- return (validate.errors || []).map((err) => ({
135
+ return (validate.errors || []).map((err: { instancePath?: string; message?: string; params?: { allowedValues?: string[] }; data?: unknown }) => ({
97
136
  path: err.instancePath || "/",
98
137
  message: err.message || "Validation failed",
99
138
  expected: err.params?.allowedValues?.join(", "),
@@ -117,17 +156,17 @@ const ERROR_NEXT_STEPS: Record<ErrorCode, string[]> = {
117
156
  "List available tools with the registry",
118
157
  ],
119
158
  TIER_REQUIRED: [
120
- "This tool requires a Pro subscription ($69/mo)",
159
+ "This tool requires a Pro subscription ($49/mo)",
121
160
  "Upgrade at https://vibecheckai.dev/pricing",
122
161
  "Some tools have free alternatives",
123
162
  ],
124
163
  NOT_ENTITLED: [
125
- "This tool requires a Pro subscription ($69/mo)",
164
+ "This tool requires a Pro subscription ($49/mo)",
126
165
  "Upgrade at https://vibecheckai.dev/pricing",
127
166
  "Run: vibecheck upgrade",
128
167
  ],
129
168
  OPTION_NOT_ENTITLED: [
130
- "This option requires a Pro subscription ($69/mo)",
169
+ "This option requires a Pro subscription ($49/mo)",
131
170
  "The base tool is available on FREE tier",
132
171
  "Upgrade at https://vibecheckai.dev/pricing",
133
172
  ],
@@ -553,6 +553,14 @@ import {
553
553
  handleAgentFirewallIntercept,
554
554
  } from "./agent-firewall-interceptor.js";
555
555
 
556
+ // Import Intent-Aware Firewall v2 - BLOCKING enforcement with intent alignment
557
+ import {
558
+ INTENT_FIREWALL_TOOL,
559
+ handleIntentFirewallIntercept,
560
+ INTENT_STATUS_TOOL,
561
+ handleIntentStatus,
562
+ } from "./intent-firewall-interceptor.js";
563
+
556
564
  // Import Conductor tools - Multi-Agent Coordination (Phase 2)
557
565
  import {
558
566
  CONDUCTOR_TOOLS,
@@ -717,6 +725,14 @@ class VibecheckMCP {
717
725
  addHandler("vibecheck_agent_firewall_intercept", handleAgentFirewallIntercept);
718
726
  }
719
727
 
728
+ // Intent-Aware Firewall v2 - blocking enforcement with intent alignment
729
+ if (handleIntentFirewallIntercept && typeof handleIntentFirewallIntercept === 'function') {
730
+ addHandler("vibecheck_intent_firewall_intercept", handleIntentFirewallIntercept);
731
+ }
732
+ if (handleIntentStatus && typeof handleIntentStatus === 'function') {
733
+ addHandler("vibecheck_intent_status", handleIntentStatus);
734
+ }
735
+
720
736
  // Conductor - multi-agent coordination tools
721
737
  addHandler("vibecheck_conductor_register", (projectPath, args) => handleConductorToolCall("vibecheck_conductor_register", args, projectPath));
722
738
  addHandler("vibecheck_conductor_acquire_lock", (projectPath, args) => handleConductorToolCall("vibecheck_conductor_acquire_lock", args, projectPath));