@cybedefend/vibedefend 1.8.3 → 1.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 (320) hide show
  1. package/README.md +135 -16
  2. package/dist/clients/antigravity.js +30 -6
  3. package/dist/clients/antigravity.js.map +1 -1
  4. package/dist/clients/claude-code.js +209 -17
  5. package/dist/clients/claude-code.js.map +1 -1
  6. package/dist/clients/codex.js +171 -11
  7. package/dist/clients/codex.js.map +1 -1
  8. package/dist/clients/cursor.js +149 -9
  9. package/dist/clients/cursor.js.map +1 -1
  10. package/dist/clients/dependency-check-wiring.js +24 -0
  11. package/dist/clients/dependency-check-wiring.js.map +1 -0
  12. package/dist/clients/opencode-plugin.js +905 -0
  13. package/dist/clients/opencode-plugin.js.map +1 -0
  14. package/dist/clients/opencode.js +653 -0
  15. package/dist/clients/opencode.js.map +1 -0
  16. package/dist/clients/registry.js +2 -0
  17. package/dist/clients/registry.js.map +1 -1
  18. package/dist/clients/vscode.js +106 -12
  19. package/dist/clients/vscode.js.map +1 -1
  20. package/dist/clients/windsurf.js +9 -1
  21. package/dist/clients/windsurf.js.map +1 -1
  22. package/dist/commands/mcp/index.js +11 -0
  23. package/dist/commands/mcp/index.js.map +1 -1
  24. package/dist/config.js +3 -0
  25. package/dist/config.js.map +1 -1
  26. package/dist/diagnostics.js +22 -3
  27. package/dist/diagnostics.js.map +1 -1
  28. package/dist/doctor.js +26 -1
  29. package/dist/doctor.js.map +1 -1
  30. package/dist/guards-evaluator/command-analysis.js +347 -86
  31. package/dist/guards-evaluator/command-analysis.js.map +1 -1
  32. package/dist/guards-evaluator/command-view.js +116 -16
  33. package/dist/guards-evaluator/command-view.js.map +1 -1
  34. package/dist/guards-evaluator/evaluate.js +185 -41
  35. package/dist/guards-evaluator/evaluate.js.map +1 -1
  36. package/dist/guards-evaluator/file-reads.js +202 -0
  37. package/dist/guards-evaluator/file-reads.js.map +1 -0
  38. package/dist/guards-evaluator/index.js +1 -1
  39. package/dist/guards-evaluator/index.js.map +1 -1
  40. package/dist/guards-evaluator/inline-danger.js +299 -0
  41. package/dist/guards-evaluator/inline-danger.js.map +1 -0
  42. package/dist/guards-evaluator/normalize.js +1186 -55
  43. package/dist/guards-evaluator/normalize.js.map +1 -1
  44. package/dist/guards-evaluator/regex.js +91 -4
  45. package/dist/guards-evaluator/regex.js.map +1 -1
  46. package/dist/guards-evaluator/shell-files.js +587 -0
  47. package/dist/guards-evaluator/shell-files.js.map +1 -0
  48. package/dist/guards-evaluator/triage.js +32 -2
  49. package/dist/guards-evaluator/triage.js.map +1 -1
  50. package/dist/hook-runner.js +25598 -5432
  51. package/dist/hooks/install.js +8 -3
  52. package/dist/hooks/install.js.map +1 -1
  53. package/dist/hooks/runtime/antigravity-session.js +109 -50
  54. package/dist/hooks/runtime/antigravity-session.js.map +1 -1
  55. package/dist/hooks/runtime/apply-patch.js +92 -0
  56. package/dist/hooks/runtime/apply-patch.js.map +1 -0
  57. package/dist/hooks/runtime/caller-gate.js +27 -0
  58. package/dist/hooks/runtime/caller-gate.js.map +1 -0
  59. package/dist/hooks/runtime/code-mode.js +259 -0
  60. package/dist/hooks/runtime/code-mode.js.map +1 -0
  61. package/dist/hooks/runtime/dependency-check/api.js +179 -0
  62. package/dist/hooks/runtime/dependency-check/api.js.map +1 -0
  63. package/dist/hooks/runtime/dependency-check/capabilities.js +99 -0
  64. package/dist/hooks/runtime/dependency-check/capabilities.js.map +1 -0
  65. package/dist/hooks/runtime/dependency-check/checked-packages.js +48 -0
  66. package/dist/hooks/runtime/dependency-check/checked-packages.js.map +1 -0
  67. package/dist/hooks/runtime/dependency-check/commands/cwd.js +154 -0
  68. package/dist/hooks/runtime/dependency-check/commands/cwd.js.map +1 -0
  69. package/dist/hooks/runtime/dependency-check/commands/env.js +99 -0
  70. package/dist/hooks/runtime/dependency-check/commands/env.js.map +1 -0
  71. package/dist/hooks/runtime/dependency-check/commands/flags.js +164 -0
  72. package/dist/hooks/runtime/dependency-check/commands/flags.js.map +1 -0
  73. package/dist/hooks/runtime/dependency-check/commands/managers.js +418 -0
  74. package/dist/hooks/runtime/dependency-check/commands/managers.js.map +1 -0
  75. package/dist/hooks/runtime/dependency-check/commands/peel.js +111 -0
  76. package/dist/hooks/runtime/dependency-check/commands/peel.js.map +1 -0
  77. package/dist/hooks/runtime/dependency-check/commands/shell.js +217 -0
  78. package/dist/hooks/runtime/dependency-check/commands/shell.js.map +1 -0
  79. package/dist/hooks/runtime/dependency-check/commands/types.js +4 -0
  80. package/dist/hooks/runtime/dependency-check/commands/types.js.map +1 -0
  81. package/dist/hooks/runtime/dependency-check/commands.js +34 -0
  82. package/dist/hooks/runtime/dependency-check/commands.js.map +1 -0
  83. package/dist/hooks/runtime/dependency-check/deadlines.js +69 -0
  84. package/dist/hooks/runtime/dependency-check/deadlines.js.map +1 -0
  85. package/dist/hooks/runtime/dependency-check/dispatch.js +344 -0
  86. package/dist/hooks/runtime/dependency-check/dispatch.js.map +1 -0
  87. package/dist/hooks/runtime/dependency-check/entering.js +63 -0
  88. package/dist/hooks/runtime/dependency-check/entering.js.map +1 -0
  89. package/dist/hooks/runtime/dependency-check/exec-cache.js +36 -0
  90. package/dist/hooks/runtime/dependency-check/exec-cache.js.map +1 -0
  91. package/dist/hooks/runtime/dependency-check/git-blob.js +116 -0
  92. package/dist/hooks/runtime/dependency-check/git-blob.js.map +1 -0
  93. package/dist/hooks/runtime/dependency-check/hook.js +418 -0
  94. package/dist/hooks/runtime/dependency-check/hook.js.map +1 -0
  95. package/dist/hooks/runtime/dependency-check/local-store.js +74 -0
  96. package/dist/hooks/runtime/dependency-check/local-store.js.map +1 -0
  97. package/dist/hooks/runtime/dependency-check/lockfile-walk.js +89 -0
  98. package/dist/hooks/runtime/dependency-check/lockfile-walk.js.map +1 -0
  99. package/dist/hooks/runtime/dependency-check/lockfiles/bun.js +153 -0
  100. package/dist/hooks/runtime/dependency-check/lockfiles/bun.js.map +1 -0
  101. package/dist/hooks/runtime/dependency-check/lockfiles/by-name.js +46 -0
  102. package/dist/hooks/runtime/dependency-check/lockfiles/by-name.js.map +1 -0
  103. package/dist/hooks/runtime/dependency-check/lockfiles/cargo.js +91 -0
  104. package/dist/hooks/runtime/dependency-check/lockfiles/cargo.js.map +1 -0
  105. package/dist/hooks/runtime/dependency-check/lockfiles/composer.js +98 -0
  106. package/dist/hooks/runtime/dependency-check/lockfiles/composer.js.map +1 -0
  107. package/dist/hooks/runtime/dependency-check/lockfiles/gemfile.js +88 -0
  108. package/dist/hooks/runtime/dependency-check/lockfiles/gemfile.js.map +1 -0
  109. package/dist/hooks/runtime/dependency-check/lockfiles/go-mod.js +154 -0
  110. package/dist/hooks/runtime/dependency-check/lockfiles/go-mod.js.map +1 -0
  111. package/dist/hooks/runtime/dependency-check/lockfiles/gradle-lockfile.js +27 -0
  112. package/dist/hooks/runtime/dependency-check/lockfiles/gradle-lockfile.js.map +1 -0
  113. package/dist/hooks/runtime/dependency-check/lockfiles/graph.js +131 -0
  114. package/dist/hooks/runtime/dependency-check/lockfiles/graph.js.map +1 -0
  115. package/dist/hooks/runtime/dependency-check/lockfiles/npm.js +107 -0
  116. package/dist/hooks/runtime/dependency-check/lockfiles/npm.js.map +1 -0
  117. package/dist/hooks/runtime/dependency-check/lockfiles/nuget-packages-lock.js +60 -0
  118. package/dist/hooks/runtime/dependency-check/lockfiles/nuget-packages-lock.js.map +1 -0
  119. package/dist/hooks/runtime/dependency-check/lockfiles/pins.js +105 -0
  120. package/dist/hooks/runtime/dependency-check/lockfiles/pins.js.map +1 -0
  121. package/dist/hooks/runtime/dependency-check/lockfiles/pip-report.js +34 -0
  122. package/dist/hooks/runtime/dependency-check/lockfiles/pip-report.js.map +1 -0
  123. package/dist/hooks/runtime/dependency-check/lockfiles/pnpm.js +109 -0
  124. package/dist/hooks/runtime/dependency-check/lockfiles/pnpm.js.map +1 -0
  125. package/dist/hooks/runtime/dependency-check/lockfiles/poetry.js +105 -0
  126. package/dist/hooks/runtime/dependency-check/lockfiles/poetry.js.map +1 -0
  127. package/dist/hooks/runtime/dependency-check/lockfiles/uv.js +181 -0
  128. package/dist/hooks/runtime/dependency-check/lockfiles/uv.js.map +1 -0
  129. package/dist/hooks/runtime/dependency-check/lockfiles/yaml.js +319 -0
  130. package/dist/hooks/runtime/dependency-check/lockfiles/yaml.js.map +1 -0
  131. package/dist/hooks/runtime/dependency-check/lockfiles/yarn-berry.js +71 -0
  132. package/dist/hooks/runtime/dependency-check/lockfiles/yarn-berry.js.map +1 -0
  133. package/dist/hooks/runtime/dependency-check/lockfiles/yarn1.js +144 -0
  134. package/dist/hooks/runtime/dependency-check/lockfiles/yarn1.js.map +1 -0
  135. package/dist/hooks/runtime/dependency-check/manifests/apply.js +110 -0
  136. package/dist/hooks/runtime/dependency-check/manifests/apply.js.map +1 -0
  137. package/dist/hooks/runtime/dependency-check/manifests/diff.js +127 -0
  138. package/dist/hooks/runtime/dependency-check/manifests/diff.js.map +1 -0
  139. package/dist/hooks/runtime/dependency-check/manifests/edit.js +259 -0
  140. package/dist/hooks/runtime/dependency-check/manifests/edit.js.map +1 -0
  141. package/dist/hooks/runtime/dependency-check/manifests/json.js +109 -0
  142. package/dist/hooks/runtime/dependency-check/manifests/json.js.map +1 -0
  143. package/dist/hooks/runtime/dependency-check/manifests/kind.js +40 -0
  144. package/dist/hooks/runtime/dependency-check/manifests/kind.js.map +1 -0
  145. package/dist/hooks/runtime/dependency-check/manifests/patch.js +179 -0
  146. package/dist/hooks/runtime/dependency-check/manifests/patch.js.map +1 -0
  147. package/dist/hooks/runtime/dependency-check/manifests/text.js +665 -0
  148. package/dist/hooks/runtime/dependency-check/manifests/text.js.map +1 -0
  149. package/dist/hooks/runtime/dependency-check/manifests/toml.js +350 -0
  150. package/dist/hooks/runtime/dependency-check/manifests/toml.js.map +1 -0
  151. package/dist/hooks/runtime/dependency-check/manifests.js +14 -0
  152. package/dist/hooks/runtime/dependency-check/manifests.js.map +1 -0
  153. package/dist/hooks/runtime/dependency-check/messages.js +270 -0
  154. package/dist/hooks/runtime/dependency-check/messages.js.map +1 -0
  155. package/dist/hooks/runtime/dependency-check/net-baseline.js +157 -0
  156. package/dist/hooks/runtime/dependency-check/net-baseline.js.map +1 -0
  157. package/dist/hooks/runtime/dependency-check/net-state.js +70 -0
  158. package/dist/hooks/runtime/dependency-check/net-state.js.map +1 -0
  159. package/dist/hooks/runtime/dependency-check/pending-forces.js +54 -0
  160. package/dist/hooks/runtime/dependency-check/pending-forces.js.map +1 -0
  161. package/dist/hooks/runtime/dependency-check/post-tool-use.js +108 -0
  162. package/dist/hooks/runtime/dependency-check/post-tool-use.js.map +1 -0
  163. package/dist/hooks/runtime/dependency-check/ranges.js +369 -0
  164. package/dist/hooks/runtime/dependency-check/ranges.js.map +1 -0
  165. package/dist/hooks/runtime/dependency-check/requirement-files.js +144 -0
  166. package/dist/hooks/runtime/dependency-check/requirement-files.js.map +1 -0
  167. package/dist/hooks/runtime/dependency-check/resolvers/bun.js +38 -0
  168. package/dist/hooks/runtime/dependency-check/resolvers/bun.js.map +1 -0
  169. package/dist/hooks/runtime/dependency-check/resolvers/bundler.js +218 -0
  170. package/dist/hooks/runtime/dependency-check/resolvers/bundler.js.map +1 -0
  171. package/dist/hooks/runtime/dependency-check/resolvers/cargo.js +303 -0
  172. package/dist/hooks/runtime/dependency-check/resolvers/cargo.js.map +1 -0
  173. package/dist/hooks/runtime/dependency-check/resolvers/composer.js +250 -0
  174. package/dist/hooks/runtime/dependency-check/resolvers/composer.js.map +1 -0
  175. package/dist/hooks/runtime/dependency-check/resolvers/config-files.js +27 -0
  176. package/dist/hooks/runtime/dependency-check/resolvers/config-files.js.map +1 -0
  177. package/dist/hooks/runtime/dependency-check/resolvers/direct-only-registry.js +409 -0
  178. package/dist/hooks/runtime/dependency-check/resolvers/direct-only-registry.js.map +1 -0
  179. package/dist/hooks/runtime/dependency-check/resolvers/direct-only.js +290 -0
  180. package/dist/hooks/runtime/dependency-check/resolvers/direct-only.js.map +1 -0
  181. package/dist/hooks/runtime/dependency-check/resolvers/gem.js +89 -0
  182. package/dist/hooks/runtime/dependency-check/resolvers/gem.js.map +1 -0
  183. package/dist/hooks/runtime/dependency-check/resolvers/go.js +313 -0
  184. package/dist/hooks/runtime/dependency-check/resolvers/go.js.map +1 -0
  185. package/dist/hooks/runtime/dependency-check/resolvers/npm.js +81 -0
  186. package/dist/hooks/runtime/dependency-check/resolvers/npm.js.map +1 -0
  187. package/dist/hooks/runtime/dependency-check/resolvers/pip.js +229 -0
  188. package/dist/hooks/runtime/dependency-check/resolvers/pip.js.map +1 -0
  189. package/dist/hooks/runtime/dependency-check/resolvers/pipx.js +8 -0
  190. package/dist/hooks/runtime/dependency-check/resolvers/pipx.js.map +1 -0
  191. package/dist/hooks/runtime/dependency-check/resolvers/pnpm.js +68 -0
  192. package/dist/hooks/runtime/dependency-check/resolvers/pnpm.js.map +1 -0
  193. package/dist/hooks/runtime/dependency-check/resolvers/poetry.js +70 -0
  194. package/dist/hooks/runtime/dependency-check/resolvers/poetry.js.map +1 -0
  195. package/dist/hooks/runtime/dependency-check/resolvers/project.js +208 -0
  196. package/dist/hooks/runtime/dependency-check/resolvers/project.js.map +1 -0
  197. package/dist/hooks/runtime/dependency-check/resolvers/python-index.js +270 -0
  198. package/dist/hooks/runtime/dependency-check/resolvers/python-index.js.map +1 -0
  199. package/dist/hooks/runtime/dependency-check/resolvers/python.js +229 -0
  200. package/dist/hooks/runtime/dependency-check/resolvers/python.js.map +1 -0
  201. package/dist/hooks/runtime/dependency-check/resolvers/registry.js +221 -0
  202. package/dist/hooks/runtime/dependency-check/resolvers/registry.js.map +1 -0
  203. package/dist/hooks/runtime/dependency-check/resolvers/shared.js +440 -0
  204. package/dist/hooks/runtime/dependency-check/resolvers/shared.js.map +1 -0
  205. package/dist/hooks/runtime/dependency-check/resolvers/tree.js +131 -0
  206. package/dist/hooks/runtime/dependency-check/resolvers/tree.js.map +1 -0
  207. package/dist/hooks/runtime/dependency-check/resolvers/uv.js +433 -0
  208. package/dist/hooks/runtime/dependency-check/resolvers/uv.js.map +1 -0
  209. package/dist/hooks/runtime/dependency-check/resolvers/xml-lite.js +132 -0
  210. package/dist/hooks/runtime/dependency-check/resolvers/xml-lite.js.map +1 -0
  211. package/dist/hooks/runtime/dependency-check/resolvers/yarn-berry.js +106 -0
  212. package/dist/hooks/runtime/dependency-check/resolvers/yarn-berry.js.map +1 -0
  213. package/dist/hooks/runtime/dependency-check/sandbox.js +328 -0
  214. package/dist/hooks/runtime/dependency-check/sandbox.js.map +1 -0
  215. package/dist/hooks/runtime/dependency-check/specs.js +171 -0
  216. package/dist/hooks/runtime/dependency-check/specs.js.map +1 -0
  217. package/dist/hooks/runtime/dependency-check/static-view.js +90 -0
  218. package/dist/hooks/runtime/dependency-check/static-view.js.map +1 -0
  219. package/dist/hooks/runtime/dependency-check/stop-net.js +278 -0
  220. package/dist/hooks/runtime/dependency-check/stop-net.js.map +1 -0
  221. package/dist/hooks/runtime/dependency-check/stop-wiring.js +94 -0
  222. package/dist/hooks/runtime/dependency-check/stop-wiring.js.map +1 -0
  223. package/dist/hooks/runtime/dependency-check/tool-call.js +130 -0
  224. package/dist/hooks/runtime/dependency-check/tool-call.js.map +1 -0
  225. package/dist/hooks/runtime/dependency-check/types.js +96 -0
  226. package/dist/hooks/runtime/dependency-check/types.js.map +1 -0
  227. package/dist/hooks/runtime/emit.js +240 -52
  228. package/dist/hooks/runtime/emit.js.map +1 -1
  229. package/dist/hooks/runtime/exit-deadlock-guard.js +24 -8
  230. package/dist/hooks/runtime/exit-deadlock-guard.js.map +1 -1
  231. package/dist/hooks/runtime/fetch-rules.js +78 -29
  232. package/dist/hooks/runtime/fetch-rules.js.map +1 -1
  233. package/dist/hooks/runtime/grep-include.js +228 -0
  234. package/dist/hooks/runtime/grep-include.js.map +1 -0
  235. package/dist/hooks/runtime/pre-compact.js +1 -1
  236. package/dist/hooks/runtime/pre-compact.js.map +1 -1
  237. package/dist/hooks/runtime/pre-invocation.js +3 -3
  238. package/dist/hooks/runtime/pre-invocation.js.map +1 -1
  239. package/dist/hooks/runtime/repo-registry.js +72 -0
  240. package/dist/hooks/runtime/repo-registry.js.map +1 -0
  241. package/dist/hooks/runtime/repo-scope.js +75 -0
  242. package/dist/hooks/runtime/repo-scope.js.map +1 -0
  243. package/dist/hooks/runtime/resolve.js +11 -2
  244. package/dist/hooks/runtime/resolve.js.map +1 -1
  245. package/dist/hooks/runtime/runner-args.js +17 -2
  246. package/dist/hooks/runtime/runner-args.js.map +1 -1
  247. package/dist/hooks/runtime/script-resolve.js +21 -5
  248. package/dist/hooks/runtime/script-resolve.js.map +1 -1
  249. package/dist/hooks/runtime/session-activation.js +71 -18
  250. package/dist/hooks/runtime/session-activation.js.map +1 -1
  251. package/dist/hooks/runtime/session-review.js +136 -66
  252. package/dist/hooks/runtime/session-review.js.map +1 -1
  253. package/dist/hooks/runtime/session-start.js +68 -13
  254. package/dist/hooks/runtime/session-start.js.map +1 -1
  255. package/dist/hooks/runtime/session-writes.js +11 -5
  256. package/dist/hooks/runtime/session-writes.js.map +1 -1
  257. package/dist/hooks/runtime/shell-writes.js +7 -88
  258. package/dist/hooks/runtime/shell-writes.js.map +1 -1
  259. package/dist/hooks/runtime/sniff.js +227 -2
  260. package/dist/hooks/runtime/sniff.js.map +1 -1
  261. package/dist/hooks/runtime/target-resolve.js +32 -17
  262. package/dist/hooks/runtime/target-resolve.js.map +1 -1
  263. package/dist/hooks/runtime/unmapped-tools.js +77 -1
  264. package/dist/hooks/runtime/unmapped-tools.js.map +1 -1
  265. package/dist/hooks/runtime/user-prompt-submit.js +1 -1
  266. package/dist/hooks/runtime/user-prompt-submit.js.map +1 -1
  267. package/dist/hooks/runtime/work-dir.js +3 -0
  268. package/dist/hooks/runtime/work-dir.js.map +1 -1
  269. package/dist/hooks/shim.js +27 -20
  270. package/dist/hooks/shim.js.map +1 -1
  271. package/dist/index.js +40 -3
  272. package/dist/index.js.map +1 -1
  273. package/dist/install-scope.js +12 -0
  274. package/dist/install-scope.js.map +1 -0
  275. package/dist/install.js +188 -78
  276. package/dist/install.js.map +1 -1
  277. package/dist/link.js +55 -5
  278. package/dist/link.js.map +1 -1
  279. package/dist/mcp/config/hook.js +25 -0
  280. package/dist/mcp/config/hook.js.map +1 -1
  281. package/dist/org.js +3 -1
  282. package/dist/org.js.map +1 -1
  283. package/dist/prompts.js +96 -12
  284. package/dist/prompts.js.map +1 -1
  285. package/dist/refresh-hooks.js +67 -15
  286. package/dist/refresh-hooks.js.map +1 -1
  287. package/dist/repo/exclude-block.js +112 -0
  288. package/dist/repo/exclude-block.js.map +1 -0
  289. package/dist/repo/footer.js +93 -0
  290. package/dist/repo/footer.js.map +1 -0
  291. package/dist/repo/git-repo.js +77 -0
  292. package/dist/repo/git-repo.js.map +1 -0
  293. package/dist/repo/guarded-write.js +45 -0
  294. package/dist/repo/guarded-write.js.map +1 -0
  295. package/dist/repo/install-repo.js +508 -0
  296. package/dist/repo/install-repo.js.map +1 -0
  297. package/dist/repo/machine-wiring.js +122 -0
  298. package/dist/repo/machine-wiring.js.map +1 -0
  299. package/dist/repo/mcp-json.js +57 -0
  300. package/dist/repo/mcp-json.js.map +1 -0
  301. package/dist/repo/registry.js +53 -0
  302. package/dist/repo/registry.js.map +1 -0
  303. package/dist/repo/repo-mode-guard.js +83 -0
  304. package/dist/repo/repo-mode-guard.js.map +1 -0
  305. package/dist/repo/repo-setups.js +123 -0
  306. package/dist/repo/repo-setups.js.map +1 -0
  307. package/dist/repo/repo-status.js +283 -0
  308. package/dist/repo/repo-status.js.map +1 -0
  309. package/dist/repo/uninstall-repo.js +56 -0
  310. package/dist/repo/uninstall-repo.js.map +1 -0
  311. package/dist/repo/unsupported.js +14 -0
  312. package/dist/repo/unsupported.js.map +1 -0
  313. package/dist/shim.js +9 -7
  314. package/dist/status.js +53 -11
  315. package/dist/status.js.map +1 -1
  316. package/dist/uninstall.js +51 -3
  317. package/dist/uninstall.js.map +1 -1
  318. package/dist/update.js +6 -1
  319. package/dist/update.js.map +1 -1
  320. package/package.json +5 -2
package/README.md CHANGED
@@ -21,6 +21,10 @@ have it because Claude Code / Cursor / Codex ship with a bundled Node.
21
21
 
22
22
  The installer is fully interactive, and signs you in **first**:
23
23
 
24
+ 0. **Where to set it up**, asked only when you run the installer from a git
25
+ repository: every repository on this machine, or this repository only (see
26
+ [One repository only](#one-repository-only)). Outside a git repository, the
27
+ whole machine is set up without a question.
24
28
  1. **Pick a region** (EU / US).
25
29
  2. **Sign in** — your browser opens for a one-time CybeDefend sign-in
26
30
  (skipped if you're already signed in from a previous run).
@@ -41,6 +45,39 @@ The installer is fully interactive, and signs you in **first**:
41
45
  servers left without one, if you say yes (or later:
42
46
  `vibedefend connect --all`).
43
47
 
48
+ **OpenCode** (V1 and V2) is wired with one plugin file and a `cybedefend` entry
49
+ in its config, pointing straight at the region's MCP server. OpenCode's other
50
+ MCP servers are not put behind the proxy, so your organization's MCP inventory
51
+ and blocks do not reach them. Restart OpenCode V1 once the install has finished:
52
+ it loads its plugins when it starts. When the `opencode` command on your PATH
53
+ is V1 and it is not signed in to CybeDefend yet, the installer runs `opencode
54
+ mcp auth cybedefend` for you (your browser opens). If OpenCode later reports
55
+ that the server needs authentication, run that command yourself; in the desktop
56
+ app, open the list of MCP servers and authenticate `cybedefend` there. The
57
+ install's "Next steps" list that sign-in when it is still to do.
58
+
59
+ On OpenCode V2, run `opencode service restart` after every install or update of
60
+ VibeDefend. V2's background service keeps running when you quit OpenCode or `opencode
61
+ run` ends, and it does not load a plugin written while it runs: after a first install
62
+ no guard is active until you restart it, and after an update it goes on running the
63
+ previous plugin. The restart also closes the terminals that service keeps open.
64
+ "Next steps" list the command. A background update of VibeDefend rewrites the plugin
65
+ without printing anything, so V2 keeps the previous plugin until the next restart.
66
+
67
+ Then sign in. The installer runs neither command on V2 and cannot read V2's
68
+ sign-in, so it says so and "Next steps" always list the step, even if you are signed
69
+ in already: run `opencode mcp auth cybedefend`. After moving from V1, sign in again:
70
+ V1's sign-in is not carried over.
71
+
72
+ Both versions can share a machine, since they read the same config directory:
73
+ the one plugin file and the one `cybedefend` entry serve both. Each keeps its
74
+ own sign-in, and `opencode` on your PATH is only one of them. The installer
75
+ signs in the one it can (V1) and names V2's commands for the other: `opencode2
76
+ service restart` and `opencode2 mcp auth cybedefend` when `opencode2` is on your
77
+ PATH (npm and the install script add it, Homebrew does not). They share a data
78
+ directory too, where the order matters: V1 refuses one that V2 created first
79
+ (`Database is not empty and has no session table`), while V1 then V2 works.
80
+
44
81
  Run through `npx` (or `pnpm dlx` / `yarn dlx`), the installer first installs
45
82
  the CLI globally (`npm install -g @cybedefend/vibedefend`), so the
46
83
  `vibedefend` command is available afterwards and the hooks auto-update. If that
@@ -59,16 +96,16 @@ npm install -g @cybedefend/vibedefend && vibedefend install
59
96
 
60
97
  VibeDefend auto-detects and wires whichever of these you have installed.
61
98
 
62
- | Capability | Claude Code | Cursor | OpenAI Codex | Windsurf | VS Code Copilot | Google Antigravity |
63
- |---|:---:|:---:|:---:|:---:|:---:|:---:|
64
- | **MCP server install** | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
65
- | **Business + Security Rules** *(injected pre-write)* | ✅ edit + shell⁴ | ✅ | ✅ edit + shell⁴ | ⚠️ writes only | ✅ | ⚠️ edit + shell⁴, after the edit⁵ |
66
- | **Action Guards** *(hard block on deny)* | ✅ all tools | ✅ all tools | ✅ all tools | ⚠️ writes, reads, shell + MCP fallback¹ | ❌ not yet wired | ✅ all tools⁶ |
67
- | **Session Start** *(loads doctrine + proposals inbox)* | ✅ | ✅ | ✅ | ⚠️ proxied² | ✅ | ✅ |
68
- | **Session Review** *(end-of-session gap analysis + pre-commit diff scan)* | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
69
- | **PreCompact** *(long-session gap analysis)* | ✅ | ✅ | ❌ no event | ❌ no event | ✅ | ❌ no event |
70
- | **Doctrine backstop** *(per-prompt reminder)* | ✅ | ❌ | ✱ via MCP³ | ❌ | ❌ | ❌ |
71
- | **Min version** | latest | ≥ 1.7 | latest | latest | ≥ 1.110 | ≥ 2.0 (app / IDE) |
99
+ | Capability | Claude Code | Cursor | OpenAI Codex | Windsurf | VS Code Copilot | Google Antigravity | OpenCode |
100
+ |---|:---:|:---:|:---:|:---:|:---:|:---:|:---:|
101
+ | **MCP server install** | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
102
+ | **Business + Security Rules** *(injected pre-write)* | ✅ edit + shell⁴ | ✅ | ✅ edit + shell⁴ | ⚠️ writes only | ✅ | ⚠️ edit + shell⁴, after the edit⁵ | ⚠️ edit + shell⁴, after the edit⁷ |
103
+ | **Action Guards** *(hard block on deny)* | ✅ all tools | ✅ all tools | ✅ all tools | ⚠️ writes, reads, shell + MCP fallback¹ | ❌ not yet wired | ✅ all tools⁶ | ✅ all tools⁸ |
104
+ | **Session Start** *(loads doctrine + proposals inbox)* | ✅ | ✅ | ✅ | ⚠️ proxied² | ✅ | ✅ | ✅ |
105
+ | **Session Review** *(end-of-session gap analysis + pre-commit diff scan)* | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ (⚠️ `opencode run`⁹) |
106
+ | **PreCompact** *(long-session gap analysis)* | ✅ | ✅ | ❌ no event | ❌ no event | ✅ | ❌ no event | ❌ no usable event |
107
+ | **Doctrine backstop** *(per-prompt reminder)* | ✅ | ❌ | ✱ via MCP³ | ❌ | ❌ | ❌ | ✱ via MCP³ |
108
+ | **Min version** | latest | ≥ 1.7 | latest | latest | ≥ 1.110 | ≥ 2.0 (app / IDE) | 1.18.29+ and 2.x¹⁰ |
72
109
 
73
110
  **Legend** — ✅ supported · ⚠️ supported with caveats · ❌ not exposed by the agent · ✱ alternate mechanism
74
111
 
@@ -76,14 +113,22 @@ VibeDefend auto-detects and wires whichever of these you have installed.
76
113
 
77
114
  ² Windsurf has no native SessionStart event. We wire `pre_user_prompt`, which fires on every turn. The hook is idempotent and cheap (one GET to the proposals endpoint, returns "0 pending" once the inbox is empty), so the per-turn cost is negligible.
78
115
 
79
- ³ Codex follows the doctrine via the MCP server's `Server.instructions` field on each session, removing the need for a per-prompt reminder hook.
116
+ ³ Codex and OpenCode follow the doctrine via the MCP server's `Server.instructions` field on each session, removing the need for a per-prompt reminder hook.
80
117
 
81
- ⁴ On Claude Code, Codex and Antigravity (its `run_command` tool) the rules hook also fires on shell commands that write files (`>` / `>>` redirections, heredocs, `tee`, `sed -i`, `perl -pi`, `cp` / `mv`, `dd of=`, `bash -c '…'`), so an agent that edits through the shell gets the same rules as one using the edit tool. Read-only commands fetch nothing. Inline interpreters (`python -c`, `node -e`) and `git apply` / `patch` are not inspected. Cursor, Windsurf and VS Code Copilot: edit tools only.
118
+ ⁴ On Claude Code, Codex, Antigravity (its `run_command` tool) and OpenCode (its `bash` tool, `shell` on V2) the rules hook also fires on shell commands that write files (`>` / `>>` redirections, heredocs, `tee`, `sed -i`, `perl -pi`, `cp` / `mv`, `dd of=`, `bash -c '…'`), so an agent that edits through the shell gets the same rules as one using the edit tool. Read-only commands fetch nothing. Inline interpreters (`python -c`, `node -e`) and `git apply` / `patch` are not inspected. Cursor, Windsurf and VS Code Copilot: edit tools only.
82
119
 
83
120
  ⁵ Antigravity has no channel to inject context into the model from its PreToolUse hook, so rules fetched before a write are held and delivered at the agent's next model call (its PreInvocation event) instead — one step later than on every other client, but before the agent acts on what it just read.
84
121
 
85
122
  ⁶ `agy --dangerously-skip-permissions` runs no hook at all, on any event. On Windows, a home path with a space in it is not supported — Antigravity has no way to quote the hook command it runs, so the installer detects this and refuses to wire a dead command rather than silently blocking every tool call. Antigravity's MCP servers are **not** wrapped by the VibeDefend MCP proxy (like Codex today): the CybeDefend server is registered directly against the region's URL.
86
123
 
124
+ ⁷ OpenCode's plugin cannot add context before a tool runs, so the rules fetched for an edit reach the agent with the edit's result: it reads them right after the write, before its next step, not before it. A call whose tool failed gets none (the agent retries the edit, which fetches again).
125
+
126
+ ⁸ OpenCode has no confirmation prompt for a tool call: a guard either blocks the call, and the model reads why as the tool's error (the call is not run), or lets it through. Guards run on every tool call, MCP tools and sub-agents included. A guard that cannot answer within 30 seconds (or cannot run at all) lets the call through, and the agent reads with the call's result: `CybeDefend Action Guards could not verify this tool call (no answer in time); it was allowed.` On V1, `opencode --pure` (or `OPENCODE_PURE=1`) loads no external plugin, so in that mode no guard runs and no rule lands. V2 has no such mode.
127
+
128
+ ⁹ `opencode run` ends as soon as its answer is complete, before the end-of-session review can run. On V1 the review therefore only happens in a session that stays open after the answer. On V2 it still runs in the background service once `opencode run` has exited, and `opencode run` prints none of it.
129
+
130
+ ¹⁰ No version gate: VibeDefend wires the OpenCode it finds (the `opencode` or `opencode2` command, or the desktop app). 1.18.29 is the first V1 that OpenCode documents for the plugin form serving both versions. V1 was tested with 1.19. V2 was checked with 2.2.1, through a test plugin and this plugin's own test suite, and has not yet been through a full live run. After `vibedefend install` and `vibedefend update`, restart V1, which loads its plugins when it starts, and run `opencode service restart` on V2, whose running service does not load a plugin written while it runs: after a first install, no guard is active until then. V2 does not take over V1's sign-in: after moving from V1, run `opencode mcp auth cybedefend` again.
131
+
87
132
  **Codex setup gotcha:** Codex 0.131+ requires you to approve each hook via the `/hooks` panel inside Codex *before* they fire. After running `vibedefend install`, open Codex, run `/hooks`, and trust the `cybedefend` entries — until you do that the panel will show `Installed N / Active 0`.
88
133
 
89
134
  **Antigravity sign-in:** Antigravity does not open the CybeDefend sign-in on its own, and `agy` has no login command the installer could run for you (as it runs `codex mcp login` for Codex). Until you sign in once, the `cybedefend` server answers *Unauthorized*. In the Antigravity app, open **Customizations → Installed → MCP Servers** and click **Authenticate** next to `cybedefend`. In the `agy` CLI, run `/mcp`, pick `cybedefend`, then **Authenticate**. The app, the IDE and the CLI each keep their own sign-in. The installer prints these steps under *Next steps*.
@@ -116,13 +161,18 @@ It works the same way: `CYBEDEFEND_AUTO_PROPOSE=1` (or `0`) takes precedence
116
161
  over `"autoProposeMode"` in `~/.cybedefend/runtime-config.json`. Non-blocking
117
162
  mode supersedes it.
118
163
 
119
- Unchecked agents stay untouched. Re-run `vibedefend install` later to
120
- toggle any on or off.
164
+ Unchecked agents stay untouched. Re-run `vibedefend install` later to add an
165
+ agent: it wires the agents you tick and leaves the others as they are, so
166
+ unticking an agent there does not remove it. To remove VibeDefend, run
167
+ `vibedefend uninstall` (see [Uninstalling](#uninstalling)), which removes it
168
+ from every agent, then `vibedefend install` again for the agents you keep.
121
169
 
122
170
  ## Commands
123
171
 
124
172
  ```
125
173
  vibedefend install Set up MCP + hooks (interactive, signs you in first)
174
+ vibedefend install --repo Set up this repository only
175
+ vibedefend install --machine Set up the whole machine, without the scope question
126
176
  vibedefend update Refresh hooks to the latest version
127
177
  vibedefend update --self Upgrade the CLI itself
128
178
  vibedefend status Read-only install report
@@ -132,9 +182,27 @@ vibedefend logout Clear stored credentials (a fresh sign-in next run
132
182
  vibedefend link Link a repo to a CybeDefend project
133
183
  vibedefend scan-diff <paths> Pre-commit diff scan of the given files
134
184
  vibedefend uninstall Remove every VibeDefend-installed file
185
+ vibedefend uninstall --repo Remove VibeDefend from this repository only
135
186
  vibedefend --help Full help
136
187
  ```
137
188
 
189
+ ## One repository only
190
+
191
+ To use VibeDefend in one repository and nowhere else, run the installer in
192
+ that repository and choose **This repository only**, or skip the question:
193
+
194
+ ```bash
195
+ vibedefend install --repo # this repository (an optional path is accepted)
196
+ vibedefend install --machine # the whole machine, without the question
197
+ vibedefend uninstall --repo # remove it from this repository only
198
+ ```
199
+
200
+ In any other folder your agents run no VibeDefend hook and list no CybeDefend
201
+ MCP server. Its files are kept out of git through `.git/info/exclude`. A
202
+ worktree needs `vibedefend install --repo` too for most agents. In this mode
203
+ the MCP proxy is off, and Claude Desktop, Antigravity and Windsurf are not
204
+ supported: use the machine-wide install for them.
205
+
138
206
  ## Linking a repo to its project
139
207
 
140
208
  For **projects imported from GitHub or GitLab, there is nothing to do**:
@@ -184,8 +252,11 @@ every folder your agent opens. When a session starts in a folder with no
184
252
  CybeDefend is off for this session and why. All other hooks then stay off for
185
253
  the rest of that session. Running `vibedefend link` in the folder turns
186
254
  them back on, even mid-session. Claude Code and Codex show that line
187
- themselves; Cursor's agent relays it in its first reply; Windsurf does not
188
- display hook output, but its hooks stay off all the same.
255
+ themselves; the agents of Cursor, Antigravity and OpenCode relay it in their
256
+ first reply; Windsurf does not display hook output, but its hooks stay off all
257
+ the same. The folder is the one your agent works in (Antigravity: its
258
+ workspace; OpenCode: the directory of its session, wherever OpenCode itself
259
+ runs).
189
260
 
190
261
  `.cybedefend/config.json` also accepts an optional `apiBase`. Because the file
191
262
  is committed — and therefore comes from whoever published the repository you
@@ -247,6 +318,47 @@ This is the command the end-of-session review asks the agent to run. It
247
318
  replaces the agent-side `zip` and HTTP upload of earlier versions, which
248
319
  tripped the `shell.net.curl_outbound` Action Guard.
249
320
 
321
+ ## Package check (dependency check)
322
+
323
+ Before an agent adds a package, VibeDefend checks it. The hook runs when the
324
+ agent installs or runs a package (`npm install`, `pnpm add`, `pip install`,
325
+ `npx`, `cargo add` and the other managers it knows) and when it edits a
326
+ manifest (`package.json`, `requirements.txt`, `Cargo.toml`, …). The packages
327
+ that would enter the project are resolved on your machine, checked by
328
+ CybeDefend, and the call is allowed, asked about or refused. If the check
329
+ cannot run, the call goes ahead. On clients that show hook notes on an allowed
330
+ call (Claude Code, Codex and VS Code; not yet Cursor, Windsurf or
331
+ Antigravity), the agent is told it was not checked.
332
+
333
+ On VS Code, only manifest edits are checked before they run. A command is
334
+ checked afterwards, at the end of the agent's turn, through the lockfile it
335
+ changed. That end-of-turn check runs on every client, for the packages that
336
+ entered a lockfile during the session without being checked first. It cannot
337
+ undo the install: the agent tells you which packages failed and proposes
338
+ a fix before the commit, and changes nothing without your agreement.
339
+
340
+ OpenCode is the exception: nothing is checked before it runs, and the
341
+ end-of-turn check runs only when the session review is on, since the plugin
342
+ starts it with the review.
343
+
344
+ After the agent edits `requirements.txt`, `pip install -r requirements.txt`
345
+ checks the lines added since the last commit, with what they pull in.
346
+
347
+ **What is sent**, for each package: its ecosystem, its name, its version,
348
+ whether it is a direct dependency, the direct package that pulled it in, and
349
+ whether it came from the public registry. Nothing else: no manifest, no
350
+ lockfile, no path, no command line, no environment, no registry URL, no git URL
351
+ and no code.
352
+
353
+ A package that comes from a private registry is sent like the others, with its
354
+ name and version, and marked as not public; the registry itself is never
355
+ named. A git or URL dependency is not sent: the agent is told it was not
356
+ verified.
357
+
358
+ The installer asks whether to turn the check on (it is on by default). To
359
+ change it later, run `vibedefend install` again, or set `"enablePackageCheck"`
360
+ under `hooks` in `~/.cybedefend/runtime-config.json`.
361
+
250
362
  ## Where VibeDefend is active
251
363
 
252
364
  The hooks are wired **globally** (one `~/.claude/settings.json`, one
@@ -335,6 +447,13 @@ flag stays set, since other hooks may rely on it. Antigravity's `hooks.json` and
335
447
  `mcp_config.json` are user-global (shared by the app, the IDE extension and
336
448
  `agy`, never per-project), so uninstall drops our `cybedefend-*` groups and MCP
337
449
  server from there once, for every project — there is no per-repo cleanup to do.
450
+ For OpenCode, uninstall deletes the plugin file (`plugins/cybedefend-vibedefend.js`
451
+ in OpenCode's config directory, `~/.config/opencode` unless `XDG_CONFIG_HOME` is
452
+ set) and the `cybedefend` entry of its `opencode.json` / `opencode.jsonc`; a file
453
+ at that path that VibeDefend did not write is left alone. The sign-in OpenCode
454
+ holds for the server is OpenCode's own and stays: run `opencode mcp logout
455
+ cybedefend` to forget it. On V2, run it before you uninstall: once the entry is
456
+ gone, V2 answers `MCP server not found`.
338
457
 
339
458
  ## Sibling: `cybedefend-cli`
340
459
 
@@ -18,12 +18,15 @@
18
18
  * flip in the Antigravity UI; `writeSettings` preserves it across a
19
19
  * reinstall (see `writeSettings` below).
20
20
  *
21
- * We write 5 groups, one per moment, all prefixed `cybedefend-`:
21
+ * We write 6 groups, one per moment, all prefixed `cybedefend-`:
22
22
  * - cybedefend-session-start SessionStart → session-start
23
23
  * - cybedefend-rules PreToolUse → fetch-rules (matcher "*", self-filtered)
24
24
  * - cybedefend-rules-delivery PreInvocation → pre-invocation (injects stashed rules)
25
25
  * - cybedefend-guards PreToolUse → guard-check (matcher "*", every tool)
26
- * - cybedefend-session-review Stop → session-review (only when enabled)
26
+ * - cybedefend-dependency-check PreToolUse → dependency-check (matcher "*", timeout 45;
27
+ * not written when `enablePackageCheck` is off)
28
+ * - cybedefend-session-review Stop → session-review (when the review or
29
+ * the package check is on: the net runs there)
27
30
  *
28
31
  * A top-level key is OURS when its name starts with `cybedefend-` AND its
29
32
  * JSON references our managed hook dir (`textReferencesHookRunner`). That
@@ -66,6 +69,7 @@ import { HOOK_RUNNER_PATH, toPosixPath, quoteCommandPath, textReferencesHookRunn
66
69
  import { PRE_TOOL_USE_SUBCOMMANDS } from '../hooks/runtime/emit.js';
67
70
  import { mcpStatus, readJsonServerEntry } from './mcp-url.js';
68
71
  import { deleteKeys, editJsonFile } from './unwire.js';
72
+ import { DEPENDENCY_CHECK_TIMEOUT_S, dependencyCheckWiring } from './dependency-check-wiring.js';
69
73
  import { configDirExists, probeBinaryVersion } from './detect.js';
70
74
  const ANTIGRAVITY_HOOKS = home('.gemini', 'config', 'hooks.json');
71
75
  const ANTIGRAVITY_MCP = home('.gemini', 'config', 'mcp_config.json');
@@ -103,8 +107,10 @@ export function antigravityWindowsBlock(platform, runnerPath) {
103
107
  return `Antigravity on Windows cannot run a hook whose path contains a space: ${runnerPath}`;
104
108
  }
105
109
  /**
106
- * The 5 (or 4, with session review off) `cybedefend-*` hook groups, keyed by
107
- * group name — ready to be merged as whole top-level keys into `hooks.json`.
110
+ * The `cybedefend-*` hook groups (six; no dependency-check group with the
111
+ * package check off, no session-review group with both the review and the
112
+ * package check off), keyed by group name — ready to be merged as whole
113
+ * top-level keys into `hooks.json`.
108
114
  */
109
115
  export function buildAntigravityHookGroups(opts) {
110
116
  const cmd = (sub) => antigravityHookCommand(sub, { platform: opts.platform, runnerPath: opts.runnerPath });
@@ -137,7 +143,22 @@ export function buildAntigravityHookGroups(opts) {
137
143
  ],
138
144
  },
139
145
  };
140
- if (opts.enableSessionReview) {
146
+ if (opts.enableDependencyCheck !== false) {
147
+ groups['cybedefend-dependency-check'] = {
148
+ PreToolUse: [
149
+ {
150
+ // Every tool, as the guards: the hook keeps only shell commands and
151
+ // manifest edits itself and answers `allow` at once on any other.
152
+ matcher: '*',
153
+ hooks: [
154
+ { type: 'command', command: cmd('dependency-check'), timeout: DEPENDENCY_CHECK_TIMEOUT_S },
155
+ ],
156
+ },
157
+ ],
158
+ };
159
+ }
160
+ // Stop runs the review and the package check's net (BACK-262): wired when either is on.
161
+ if (opts.enableSessionReview || opts.enableDependencyCheck !== false) {
141
162
  groups['cybedefend-session-review'] = {
142
163
  Stop: [{ type: 'command', command: cmd('session-review'), timeout: 30 }],
143
164
  };
@@ -229,7 +250,10 @@ function writeSettings(opts) {
229
250
  const file = readJson(ANTIGRAVITY_HOOKS, {});
230
251
  const disabled = disabledOurGroups(file);
231
252
  dropOurGroups(file);
232
- const groups = buildAntigravityHookGroups({ enableSessionReview: opts.enableSessionReview });
253
+ const groups = buildAntigravityHookGroups({
254
+ enableSessionReview: opts.enableSessionReview,
255
+ enableDependencyCheck: dependencyCheckWiring('antigravity', opts).check,
256
+ });
233
257
  for (const key of disabled) {
234
258
  const group = groups[key];
235
259
  if (group && typeof group === 'object') {
@@ -1 +1 @@
1
- {"version":3,"file":"antigravity.js","sourceRoot":"","sources":["../../src/clients/antigravity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AACH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEnD,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,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IAAI,YAAY,GAAG,KAAK,CAAC;IACzB,IAAI,UAAmB,CAAC;IACxB,IAAI,CAAC;QACH,YAAY,GAAG,YAAY,CAA0B,iBAAiB,EAAE,aAAa,CAAC,CAAC;IACzF,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,UAAU,GAAG,GAAG,CAAC;IACnB,CAAC;IAED,IAAI,UAAU,GAAa,EAAE,CAAC;IAC9B,IAAI,QAAiB,CAAC;IACtB,IAAI,CAAC;QACH,YAAY,CAAqB,eAAe,EAAE,CAAC,IAAI,EAAE,EAAE;YACzD,UAAU,GAAG,UAAU,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;YACxD,OAAO,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC;QAC/B,CAAC,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,QAAQ,GAAG,GAAG,CAAC;IACjB,CAAC;IAED,IAAI,UAAU;QAAE,MAAM,UAAU,CAAC;IACjC,IAAI,QAAQ;QAAE,MAAM,QAAQ,CAAC;IAE7B,OAAO,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,UAAU,EAAE,CAAC;AAC5E,CAAC;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAkB;IAC/C,EAAE,EAAE,aAAa;IACjB,KAAK,EAAE,oBAAoB;IAC3B,MAAM;IACN,QAAQ;IACR,aAAa;IACb,WAAW;IACX,aAAa;IACb,OAAO;IACP,SAAS;CACV,CAAC"}
@@ -8,15 +8,26 @@
8
8
  * universal bundled runner installed at `~/.cybedefend/hook-runner.js`.
9
9
  * No bash, no jq — runs the same way on Linux / macOS / Windows.
10
10
  */
11
- import { existsSync, readFileSync } from 'node:fs';
11
+ import { existsSync, readFileSync, rmSync } from 'node:fs';
12
12
  import { join } from 'node:path';
13
13
  import { readJson, writeJson } from '../json-file.js';
14
14
  import { home, log, run, which } from '../utils.js';
15
15
  import { hookCommand, textReferencesHookRunner, isVibedefendOwnedHookCommand, } from '../hooks/install.js';
16
+ import { isTracked } from '../repo/git-repo.js';
17
+ import { editRepoJson } from '../repo/guarded-write.js';
18
+ import { unwireSharedMcpJson, wireSharedMcpJson } from '../repo/mcp-json.js';
16
19
  import { probeBinaryVersion } from './detect.js';
17
20
  import { mcpStatus } from './mcp-url.js';
18
21
  import { dropFromEventArrays, editJsonFile } from './unwire.js';
19
- const CLAUDE_SETTINGS = home('.claude', 'settings.json');
22
+ import { DEPENDENCY_CHECK_TIMEOUT_S, POST_TOOL_USE_MATCHER, POST_TOOL_USE_TIMEOUT_S, dependencyCheckWiring, } from './dependency-check-wiring.js';
23
+ /** Claude Code's profile directory; honours CLAUDE_CONFIG_DIR, read per call. */
24
+ export function claudeProfileDir() {
25
+ return process.env.CLAUDE_CONFIG_DIR || home('.claude');
26
+ }
27
+ /** Machine-wide settings file; honours CLAUDE_CONFIG_DIR, read per call. */
28
+ export function claudeSettingsPath() {
29
+ return join(claudeProfileDir(), 'settings.json');
30
+ }
20
31
  function detect() {
21
32
  if (which('claude') === null) {
22
33
  return {
@@ -53,8 +64,9 @@ function supports(event) {
53
64
  function dropOurs(entries) {
54
65
  return entries.filter((e) => !(e.hooks ?? []).some((h) => isVibedefendOwnedHookCommand(h.command)));
55
66
  }
56
- function writeSettings(opts) {
57
- const settings = readJson(CLAUDE_SETTINGS, {});
67
+ /** Put every hook entry vibedefend owns into `settings`, replacing earlier ones of ours. */
68
+ export function applyClaudeHooks(settings, opts) {
69
+ const cmd = (sub) => hookCommand(sub, undefined, opts.client);
58
70
  settings.hooks ??= {};
59
71
  settings.hooks.PreToolUse ??= [];
60
72
  settings.hooks.Stop ??= [];
@@ -66,41 +78,83 @@ function writeSettings(opts) {
66
78
  settings.hooks.Stop = dropOurs(settings.hooks.Stop);
67
79
  settings.hooks.PreCompact = dropOurs(settings.hooks.PreCompact);
68
80
  settings.hooks.UserPromptSubmit = dropOurs(settings.hooks.UserPromptSubmit);
81
+ // Post-call hooks exist only where a capability names one: never create
82
+ // the arrays otherwise, but clean ours out of ones a previous install made.
83
+ if (settings.hooks.PostToolUse)
84
+ settings.hooks.PostToolUse = dropOurs(settings.hooks.PostToolUse);
85
+ if (settings.hooks.PostToolUseFailure) {
86
+ settings.hooks.PostToolUseFailure = dropOurs(settings.hooks.PostToolUseFailure);
87
+ }
69
88
  // Rules injection: the edit tools AND Bash — a shell command that writes
70
89
  // files (`cat > f <<EOF`, `sed -i`, `tee`…) fetches the rules for its
71
90
  // targets too; the runner self-filters read-only commands (BACK-173).
72
91
  settings.hooks.PreToolUse.push({
73
92
  matcher: 'Edit|Write|MultiEdit|Bash',
74
- hooks: [{ type: 'command', command: hookCommand('fetch-rules') }],
93
+ hooks: [{ type: 'command', command: cmd('fetch-rules') }],
75
94
  });
76
95
  // Action Guards: hard-block hook. Runs on every tool call (no matcher so
77
96
  // it fires for Read/Write/Edit/Bash/WebFetch etc.). Exit code 2 → Claude
78
97
  // Code blocks the tool call and surfaces the message to the model.
79
98
  settings.hooks.PreToolUse.push({
80
- hooks: [{ type: 'command', command: hookCommand('guard-check') }],
99
+ hooks: [{ type: 'command', command: cmd('guard-check') }],
81
100
  });
82
101
  settings.hooks.SessionStart.push({
83
- hooks: [{ type: 'command', command: hookCommand('session-start') }],
102
+ hooks: [{ type: 'command', command: cmd('session-start') }],
84
103
  });
104
+ // Dependency check (BACK-262): before a command that adds a package or an
105
+ // edit of a manifest. Its own entry, since it may take longer than a guard.
106
+ const dependencyCheck = dependencyCheckWiring('claude-code', opts);
107
+ if (dependencyCheck.check) {
108
+ settings.hooks.PreToolUse.push({
109
+ matcher: 'Bash|Edit|Write|MultiEdit',
110
+ hooks: [
111
+ {
112
+ type: 'command',
113
+ command: cmd('dependency-check'),
114
+ timeout: DEPENDENCY_CHECK_TIMEOUT_S,
115
+ },
116
+ ],
117
+ });
118
+ }
119
+ // A call that ran, accepted or failed, reports the force asked for it.
120
+ if (dependencyCheck.postHook === 'PostToolUse') {
121
+ const post = () => ({
122
+ matcher: POST_TOOL_USE_MATCHER,
123
+ hooks: [
124
+ { type: 'command', command: cmd('post-tool-use'), timeout: POST_TOOL_USE_TIMEOUT_S },
125
+ ],
126
+ });
127
+ (settings.hooks.PostToolUse ??= []).push(post());
128
+ (settings.hooks.PostToolUseFailure ??= []).push(post());
129
+ }
85
130
  // UserPromptSubmit fires before the agent processes each user prompt.
86
131
  // We use it to backstop the CybeDefend doctrine when a skill (notably
87
132
  // superpowers:brainstorming) auto-activates and would otherwise
88
133
  // hijack the flow before step 0 / step 1 fire. See
89
134
  // src/hooks/runtime/user-prompt-submit.ts for the full rationale.
90
135
  settings.hooks.UserPromptSubmit.push({
91
- hooks: [{ type: 'command', command: hookCommand('user-prompt-submit') }],
136
+ hooks: [{ type: 'command', command: cmd('user-prompt-submit') }],
92
137
  });
93
- if (opts.enableSessionReview) {
138
+ // The Stop hook runs the review and the package check's net (BACK-262):
139
+ // wired when either is on. PreCompact is the review's alone.
140
+ if (opts.enableSessionReview || dependencyCheck.check) {
94
141
  settings.hooks.Stop.push({
95
142
  matcher: 'Stop',
96
- hooks: [{ type: 'command', command: hookCommand('session-review') }],
143
+ hooks: [{ type: 'command', command: cmd('session-review') }],
97
144
  });
145
+ }
146
+ if (opts.enableSessionReview) {
98
147
  settings.hooks.PreCompact.push({
99
- hooks: [{ type: 'command', command: hookCommand('pre-compact') }],
148
+ hooks: [{ type: 'command', command: cmd('pre-compact') }],
100
149
  });
101
150
  }
102
- writeJson(CLAUDE_SETTINGS, settings);
103
- log.ok(`Claude Code hooks wired into ${CLAUDE_SETTINGS}`);
151
+ }
152
+ function writeSettings(opts) {
153
+ const path = claudeSettingsPath();
154
+ const settings = readJson(path, {});
155
+ applyClaudeHooks(settings, opts);
156
+ writeJson(path, settings);
157
+ log.ok(`Claude Code hooks wired into ${path}`);
104
158
  }
105
159
  /**
106
160
  * Claude Code's user-scope config file, where `claude mcp add --scope user`
@@ -203,8 +257,8 @@ function registerMcp(opts) {
203
257
  function inspect(region) {
204
258
  let hooksWired = false;
205
259
  try {
206
- if (existsSync(CLAUDE_SETTINGS)) {
207
- hooksWired = textReferencesHookRunner(readFileSync(CLAUDE_SETTINGS, 'utf8'));
260
+ if (existsSync(claudeSettingsPath())) {
261
+ hooksWired = textReferencesHookRunner(readFileSync(claudeSettingsPath(), 'utf8'));
208
262
  }
209
263
  }
210
264
  catch {
@@ -222,7 +276,7 @@ function inspect(region) {
222
276
  * `claude` CLI) and is not an error.
223
277
  */
224
278
  function uninstall(opts) {
225
- const hooksRemoved = editJsonFile(CLAUDE_SETTINGS, (settings) => {
279
+ const hooksRemoved = editJsonFile(claudeSettingsPath(), (settings) => {
226
280
  if (!settings.hooks || typeof settings.hooks !== 'object')
227
281
  return false;
228
282
  const hooks = settings.hooks;
@@ -238,8 +292,145 @@ function uninstall(opts) {
238
292
  // Safe: `mcpNames` are validated against a strict charset upstream.
239
293
  run(cmd, args, { silent: true, shell: process.platform === 'win32' }));
240
294
  const mcpRemoved = opts.mcpNames.filter((name) => runCommand('claude', ['mcp', 'remove', name, '--scope', 'user']) === 0);
241
- return { hookFiles: hooksRemoved ? [CLAUDE_SETTINGS] : [], mcpRemoved };
295
+ return { hookFiles: hooksRemoved ? [claudeSettingsPath()] : [], mcpRemoved };
296
+ }
297
+ const LOCAL_SETTINGS = '.claude/settings.local.json';
298
+ function hooksRoot(tree) {
299
+ return tree.mainCheckoutRoot ?? tree.root;
300
+ }
301
+ function wireRepoHooks(ctx) {
302
+ const root = hooksRoot(ctx.tree);
303
+ const r = editRepoJson(root, LOCAL_SETTINGS, ctx.isTracked, (settings) => {
304
+ applyClaudeHooks(settings, {
305
+ enableSessionReview: ctx.hooks.enableSessionReview,
306
+ hooks: ctx.hooks,
307
+ client: 'claude-code',
308
+ });
309
+ });
310
+ if (!r.ok) {
311
+ return { client: 'claude-code', piece: 'hooks', state: 'off', files: [], reason: r.reason };
312
+ }
313
+ return { client: 'claude-code', piece: 'hooks', state: 'on', files: [r.file] };
314
+ }
315
+ function wireRepoMcp(ctx) {
316
+ const { mcpName, mcpUrl } = ctx.region;
317
+ if (!ctx.isTracked(ctx.tree.root, '.mcp.json')) {
318
+ const shared = wireSharedMcpJson(ctx, 'claude-code');
319
+ if (shared.state === 'on') {
320
+ return { ...shared, nextStep: `approve the "${mcpName}" server at the first session if asked` };
321
+ }
322
+ return shared;
323
+ }
324
+ // The team's .mcp.json is tracked: register for this profile only. As in
325
+ // registerMcp, `claude mcp add` refuses a name that exists: an entry on
326
+ // this URL is kept as it is, one on another URL is removed first.
327
+ const existing = readLocalScopeMcp(ctx.tree.root, mcpName);
328
+ if (existing?.type === 'http' && existing.url === mcpUrl)
329
+ return localScopeOn();
330
+ if (existing)
331
+ ctx.run('claude', ['mcp', 'remove', mcpName, '--scope', 'local'], ctx.tree.root);
332
+ const code = ctx.run('claude', ['mcp', 'add', mcpName, '--scope', 'local', '--transport', 'http', mcpUrl], ctx.tree.root);
333
+ if (code !== 0) {
334
+ return {
335
+ client: 'claude-code',
336
+ piece: 'mcp',
337
+ state: 'off',
338
+ files: [],
339
+ reason: `.mcp.json is tracked by git and \`claude mcp add --scope local\` returned exit ${code}`,
340
+ };
341
+ }
342
+ return localScopeOn();
343
+ }
344
+ function localScopeOn() {
345
+ return {
346
+ client: 'claude-code',
347
+ piece: 'mcp',
348
+ state: 'on',
349
+ files: [],
350
+ nextStep: `registered for this Claude Code profile only (${claudeProfileDir()}): .mcp.json is tracked by git`,
351
+ };
352
+ }
353
+ /**
354
+ * The local-scope registration of `name` for the folder `root`
355
+ * (`projects[<root>].mcpServers` of the running profile's config), or `null`
356
+ * when absent or unreadable.
357
+ */
358
+ function readLocalScopeMcp(root, name) {
359
+ try {
360
+ const config = JSON.parse(readFileSync(claudeUserConfigPath(), 'utf8'));
361
+ const entry = config.projects?.[root]?.mcpServers?.[name];
362
+ return entry !== null && typeof entry === 'object' ? entry : null;
363
+ }
364
+ catch {
365
+ return null;
366
+ }
367
+ }
368
+ function unwireRepo(tree, mcpNames, runCmd, tracked = (root, rel) => isTracked({ root }, rel)) {
369
+ const files = [];
370
+ const root = hooksRoot(tree);
371
+ const abs = join(root, LOCAL_SETTINGS);
372
+ if (existsSync(abs) && !tracked(root, LOCAL_SETTINGS)) {
373
+ try {
374
+ const settings = JSON.parse(readFileSync(abs, 'utf8'));
375
+ if (settings && typeof settings === 'object' && settings.hooks && typeof settings.hooks === 'object') {
376
+ const hooks = settings.hooks;
377
+ if (dropFromEventArrays(hooks, dropOurs)) {
378
+ if (Object.keys(hooks).length === 0)
379
+ delete settings.hooks;
380
+ if (Object.keys(settings).length === 0)
381
+ rmSync(abs, { force: true });
382
+ else
383
+ writeJson(abs, settings);
384
+ files.push({ root, rel: LOCAL_SETTINGS });
385
+ }
386
+ }
387
+ }
388
+ catch {
389
+ /* unreadable: left alone */
390
+ }
391
+ }
392
+ files.push(...unwireSharedMcpJson(tree.root, mcpNames, tracked));
393
+ // `mcpNames` come from the caller (validated upstream), never from a repo file.
394
+ for (const name of mcpNames) {
395
+ runCmd('claude', ['mcp', 'remove', name, '--scope', 'local'], tree.root);
396
+ }
397
+ return files;
242
398
  }
399
+ function inspectRepo(tree, region) {
400
+ let hooksWired = false;
401
+ try {
402
+ hooksWired = textReferencesHookRunner(readFileSync(join(hooksRoot(tree), LOCAL_SETTINGS), 'utf8'));
403
+ }
404
+ catch {
405
+ /* missing or unreadable */
406
+ }
407
+ let mcpRegistered = false;
408
+ try {
409
+ const mcp = JSON.parse(readFileSync(join(tree.root, '.mcp.json'), 'utf8'));
410
+ mcpRegistered = mcp.mcpServers?.[region.mcpName]?.url === region.mcpUrl;
411
+ }
412
+ catch {
413
+ /* missing or unreadable */
414
+ }
415
+ if (!mcpRegistered) {
416
+ // The tracked-file fallback registers at local scope: ~/.claude.json,
417
+ // projects[<tree root>].mcpServers.
418
+ try {
419
+ const config = JSON.parse(readFileSync(claudeUserConfigPath(), 'utf8'));
420
+ mcpRegistered = config.projects?.[tree.root]?.mcpServers?.[region.mcpName]?.url === region.mcpUrl;
421
+ }
422
+ catch {
423
+ /* missing or unreadable */
424
+ }
425
+ }
426
+ return { hooksWired, mcpRegistered };
427
+ }
428
+ const repo = {
429
+ wireHooks: wireRepoHooks,
430
+ wireMcp: wireRepoMcp,
431
+ unwire: unwireRepo,
432
+ inspect: inspectRepo,
433
+ };
243
434
  export const claudeCodeAdapter = {
244
435
  id: 'claude-code',
245
436
  label: 'Claude Code',
@@ -249,6 +440,7 @@ export const claudeCodeAdapter = {
249
440
  registerMcp,
250
441
  inspect,
251
442
  uninstall,
443
+ repo,
252
444
  };
253
445
  /**
254
446
  * Cross-platform sanity gate (used by the installer banner).