@bonesofspring/ai-rules 0.2.57 → 0.2.61

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 (603) hide show
  1. package/CHANGELOG.md +127 -0
  2. package/README.md +91 -20
  3. package/bin/cli.js +714 -33
  4. package/bin/lib/ai-local-drift.js +18 -0
  5. package/bin/lib/engine-scripts.js +25 -5
  6. package/bin/lib/engine-upgrade.js +279 -0
  7. package/bin/lib/mcp/catalog.js +158 -0
  8. package/bin/lib/mcp/clients.js +35 -2
  9. package/bin/lib/mcp/credentials.js +173 -1
  10. package/bin/lib/mcp/doctor.js +192 -24
  11. package/bin/lib/mcp/npx.js +17 -0
  12. package/bin/lib/mcp/registry.js +12 -4
  13. package/bin/lib/merged-config.js +38 -0
  14. package/bin/lib/seed-ai-local-team.js +37 -19
  15. package/docs/MCP-CATALOG.md +84 -0
  16. package/docs/MCP-SETUP.md +62 -6
  17. package/docs/OPENCODE.md +22 -2
  18. package/docs/PLATFORMS.md +38 -0
  19. package/docs/PRESET-CONTRIBUTION.md +12 -1
  20. package/docs/TEAM-DB.md +187 -20
  21. package/docs/openapi/team-db.v1.json +4443 -2083
  22. package/mcp/defectdojo-mcp.mjs +353 -0
  23. package/mcp/github-proxy.mjs +133 -0
  24. package/mcp/gitlab.mjs +5 -1
  25. package/mcp/lib/defectdojo.mjs +249 -0
  26. package/mcp/lib/github.mjs +187 -0
  27. package/mcp/lib/streamable-http.mjs +185 -0
  28. package/mcp/lib/yandex.mjs +55 -152
  29. package/package.json +11 -3
  30. package/presets/_shared/ai-local/scripts/check-write-scope.mjs +212 -0
  31. package/presets/_shared/ai-local/scripts/lock.mjs +139 -19
  32. package/presets/_shared/ai-local/scripts/rule-improver.mjs +343 -50
  33. package/presets/_shared/ai-local/scripts/run.mjs +122 -3
  34. package/presets/_shared/ai-local/scripts/signals.mjs +17 -1
  35. package/presets/_shared/ai-local/scripts/team-db-api.mjs +496 -67
  36. package/presets/_shared/ai-local/scripts/team-db-dashboard.mjs +816 -5
  37. package/presets/_shared/ai-local/scripts/team-db-openapi.mjs +761 -6
  38. package/presets/_shared/ai-local/scripts/team-db-project.mjs +10 -0
  39. package/presets/_shared/ai-local/scripts/team-db-scheduler.mjs +2360 -0
  40. package/presets/_shared/ai-local/scripts/team-db-schema.mjs +87 -0
  41. package/presets/_shared/ai-local/scripts/team-db.mjs +151 -9
  42. package/presets/_shared/ai-local/scripts/upstream-research.mjs +2961 -0
  43. package/presets/_shared/core/agent-team/agent-artifact-contracts.md +13 -0
  44. package/presets/_shared/core/agent-team/agent-team-orchestrator.md +12 -0
  45. package/presets/_shared/core/review/code-review-mr.md +10 -0
  46. package/presets/_shared/hooks/README.md +23 -3
  47. package/presets/_shared/hooks/chain-team-phases.sh.tmpl +200 -4
  48. package/presets/{claude/nuxt/hooks/guard-shell-command.sh → _shared/hooks/guard-shell-command.mjs.tmpl} +29 -35
  49. package/presets/_shared/hooks/run-hook.mjs +102 -0
  50. package/presets/claude/android-kotlin/commands/update.md +1 -0
  51. package/presets/claude/android-kotlin/hooks/README.md +4 -3
  52. package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +200 -4
  53. package/presets/claude/android-kotlin/hooks/examples/README.md +2 -2
  54. package/presets/claude/android-kotlin/hooks/guard-shell-command.mjs +96 -0
  55. package/presets/claude/android-kotlin/hooks/run-hook.mjs +102 -0
  56. package/presets/claude/android-kotlin/rules/tooling-and-review/agent-team-orchestrator.md +12 -0
  57. package/presets/claude/android-kotlin/rules/tooling-and-review/code-review.md +10 -0
  58. package/presets/claude/android-kotlin/settings.json +2 -2
  59. package/presets/claude/android-kotlin/team/README.md +5 -0
  60. package/presets/claude/go/commands/update.md +1 -0
  61. package/presets/claude/go/hooks/README.md +4 -3
  62. package/presets/claude/go/hooks/chain-team-phases.sh +200 -4
  63. package/presets/claude/go/hooks/examples/README.md +2 -2
  64. package/presets/claude/go/hooks/guard-shell-command.mjs +95 -0
  65. package/presets/claude/go/hooks/run-hook.mjs +102 -0
  66. package/presets/claude/go/rules/tooling-and-review/agent-team-orchestrator.md +12 -0
  67. package/presets/claude/go/rules/tooling-and-review/code-review.md +10 -0
  68. package/presets/claude/go/settings.json +2 -2
  69. package/presets/claude/go/team/README.md +5 -0
  70. package/presets/claude/ios-swift/commands/update.md +1 -0
  71. package/presets/claude/ios-swift/hooks/README.md +4 -3
  72. package/presets/claude/ios-swift/hooks/chain-team-phases.sh +200 -4
  73. package/presets/claude/ios-swift/hooks/examples/README.md +2 -2
  74. package/presets/claude/ios-swift/hooks/guard-shell-command.mjs +95 -0
  75. package/presets/claude/ios-swift/hooks/run-hook.mjs +102 -0
  76. package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-orchestrator.md +12 -0
  77. package/presets/claude/ios-swift/rules/tooling-and-review/code-review.md +10 -0
  78. package/presets/claude/ios-swift/settings.json +2 -2
  79. package/presets/claude/ios-swift/team/README.md +5 -0
  80. package/presets/claude/java/commands/update.md +1 -0
  81. package/presets/claude/java/hooks/README.md +4 -3
  82. package/presets/claude/java/hooks/chain-team-phases.sh +200 -4
  83. package/presets/claude/java/hooks/examples/README.md +2 -2
  84. package/presets/claude/java/hooks/{guard-shell-command.sh → guard-shell-command.mjs} +31 -38
  85. package/presets/claude/java/hooks/run-hook.mjs +102 -0
  86. package/presets/claude/java/rules/tooling-and-review/agent-team-orchestrator.md +12 -0
  87. package/presets/claude/java/rules/tooling-and-review/code-review.md +10 -0
  88. package/presets/claude/java/settings.json +2 -2
  89. package/presets/claude/java/team/README.md +5 -0
  90. package/presets/claude/mcp-ts/commands/update.md +1 -0
  91. package/presets/claude/mcp-ts/hooks/README.md +4 -3
  92. package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +200 -4
  93. package/presets/claude/mcp-ts/hooks/examples/README.md +1 -1
  94. package/presets/claude/mcp-ts/hooks/guard-shell-command.mjs +95 -0
  95. package/presets/claude/mcp-ts/hooks/run-hook.mjs +102 -0
  96. package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-orchestrator.md +12 -0
  97. package/presets/claude/mcp-ts/rules/tooling-and-review/code-review.md +10 -0
  98. package/presets/claude/mcp-ts/settings.json +2 -2
  99. package/presets/claude/mcp-ts/team/README.md +5 -0
  100. package/presets/claude/mol/commands/update.md +1 -0
  101. package/presets/claude/mol/hooks/README.md +20 -0
  102. package/presets/claude/mol/hooks/chain-team-phases.sh +200 -4
  103. package/presets/claude/{svelte/hooks/guard-shell-command.sh → mol/hooks/guard-shell-command.mjs} +29 -35
  104. package/presets/claude/mol/hooks/run-hook.mjs +102 -0
  105. package/presets/claude/mol/rules/tooling-and-review/agent-team-orchestrator.md +12 -0
  106. package/presets/claude/mol/rules/tooling-and-review/code-review-mr.md +10 -0
  107. package/presets/claude/mol/settings.json +2 -2
  108. package/presets/claude/mol/team/README.md +5 -0
  109. package/presets/claude/next/agents/build-verifier.md +4 -0
  110. package/presets/claude/next/agents/code-reviewer.md +10 -0
  111. package/presets/claude/next/agents/feature-developer.md +1 -0
  112. package/presets/claude/next/agents/task-analyst.md +4 -0
  113. package/presets/claude/next/agents/task-router.md +5 -3
  114. package/presets/claude/next/commands/README.md +1 -0
  115. package/presets/claude/next/commands/task-continue.md +4 -2
  116. package/presets/claude/next/commands/update.md +1 -0
  117. package/presets/claude/next/commands/upstream-research.md +23 -0
  118. package/presets/claude/next/hooks/README.md +4 -3
  119. package/presets/claude/next/hooks/chain-team-phases.sh +200 -4
  120. package/presets/claude/next/hooks/examples/README.md +2 -2
  121. package/presets/claude/next/hooks/guard-shell-command.mjs +94 -0
  122. package/presets/claude/next/hooks/run-hook.mjs +102 -0
  123. package/presets/claude/next/rules/tooling-and-review/agent-team-orchestrator.md +12 -0
  124. package/presets/claude/next/rules/tooling-and-review/code-review-mr.md +10 -0
  125. package/presets/claude/next/settings.json +2 -2
  126. package/presets/claude/next/team/README.md +23 -0
  127. package/presets/claude/next/team/upstream/config.json +31 -0
  128. package/presets/claude/next/team/upstream/digest-template.md +55 -0
  129. package/presets/claude/next/team/upstream/opencode.json +34 -0
  130. package/presets/claude/next/team/upstream/projects.json +4 -0
  131. package/presets/claude/next/team/upstream/prompt.md +77 -0
  132. package/presets/claude/next/team/upstream/signatures.json +9 -0
  133. package/presets/claude/nuxt/commands/update.md +1 -0
  134. package/presets/claude/nuxt/hooks/README.md +4 -3
  135. package/presets/claude/nuxt/hooks/chain-team-phases.sh +200 -4
  136. package/presets/claude/nuxt/hooks/examples/README.md +2 -2
  137. package/presets/claude/{ios-swift/hooks/guard-shell-command.sh → nuxt/hooks/guard-shell-command.mjs} +29 -37
  138. package/presets/claude/nuxt/hooks/run-hook.mjs +102 -0
  139. package/presets/claude/nuxt/rules/tooling-and-review/agent-team-orchestrator.md +12 -0
  140. package/presets/claude/nuxt/rules/tooling-and-review/code-review-mr.md +10 -0
  141. package/presets/claude/nuxt/settings.json +2 -2
  142. package/presets/claude/nuxt/team/README.md +5 -0
  143. package/presets/claude/php-hexagonal/commands/update.md +1 -0
  144. package/presets/claude/php-hexagonal/hooks/README.md +4 -3
  145. package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +200 -4
  146. package/presets/claude/php-hexagonal/hooks/examples/README.md +2 -2
  147. package/presets/claude/php-hexagonal/hooks/guard-shell-command.mjs +96 -0
  148. package/presets/claude/php-hexagonal/hooks/run-hook.mjs +102 -0
  149. package/presets/claude/php-hexagonal/rules/tooling-and-review/agent-team-orchestrator.md +12 -0
  150. package/presets/claude/php-hexagonal/rules/tooling-and-review/code-review.md +10 -0
  151. package/presets/claude/php-hexagonal/settings.json +2 -2
  152. package/presets/claude/php-hexagonal/team/README.md +5 -0
  153. package/presets/claude/php-laravel/commands/update.md +1 -0
  154. package/presets/claude/php-laravel/hooks/README.md +4 -3
  155. package/presets/claude/php-laravel/hooks/chain-team-phases.sh +200 -4
  156. package/presets/claude/php-laravel/hooks/examples/README.md +2 -2
  157. package/presets/claude/php-laravel/hooks/guard-shell-command.mjs +96 -0
  158. package/presets/claude/php-laravel/hooks/run-hook.mjs +102 -0
  159. package/presets/claude/php-laravel/rules/tooling-and-review/agent-team-orchestrator.md +12 -0
  160. package/presets/claude/php-laravel/rules/tooling-and-review/code-review.md +10 -0
  161. package/presets/claude/php-laravel/settings.json +2 -2
  162. package/presets/claude/php-laravel/team/README.md +5 -0
  163. package/presets/claude/svelte/commands/update.md +1 -0
  164. package/presets/claude/svelte/hooks/README.md +4 -3
  165. package/presets/claude/svelte/hooks/chain-team-phases.sh +200 -4
  166. package/presets/claude/svelte/hooks/examples/README.md +2 -2
  167. package/presets/claude/svelte/hooks/guard-shell-command.mjs +94 -0
  168. package/presets/claude/svelte/hooks/run-hook.mjs +102 -0
  169. package/presets/claude/svelte/rules/tooling-and-review/agent-team-orchestrator.md +12 -0
  170. package/presets/claude/svelte/rules/tooling-and-review/code-review-mr.md +10 -0
  171. package/presets/claude/svelte/settings.json +2 -2
  172. package/presets/claude/svelte/team/README.md +5 -0
  173. package/presets/cursor/android-kotlin/commands/update.md +1 -0
  174. package/presets/cursor/android-kotlin/hooks/README.md +2 -1
  175. package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +200 -4
  176. package/presets/cursor/android-kotlin/hooks/examples/README.md +1 -1
  177. package/presets/cursor/android-kotlin/hooks/guard-shell-command.mjs +96 -0
  178. package/presets/cursor/android-kotlin/hooks/run-hook.mjs +102 -0
  179. package/presets/cursor/android-kotlin/hooks.json +2 -2
  180. package/presets/cursor/android-kotlin/rules/code-review-mr.mdc +10 -0
  181. package/presets/cursor/android-kotlin/team/README.md +5 -0
  182. package/presets/cursor/go/commands/update.md +1 -0
  183. package/presets/cursor/go/hooks/README.md +2 -1
  184. package/presets/cursor/go/hooks/chain-team-phases.sh +200 -4
  185. package/presets/cursor/go/hooks/examples/README.md +1 -1
  186. package/presets/cursor/go/hooks/guard-shell-command.mjs +95 -0
  187. package/presets/cursor/go/hooks/run-hook.mjs +102 -0
  188. package/presets/cursor/go/hooks.json +2 -2
  189. package/presets/cursor/go/rules/code-review-mr.mdc +10 -0
  190. package/presets/cursor/go/team/README.md +5 -0
  191. package/presets/cursor/ios-swift/commands/update.md +1 -0
  192. package/presets/cursor/ios-swift/hooks/README.md +2 -1
  193. package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +200 -4
  194. package/presets/cursor/ios-swift/hooks/examples/README.md +1 -1
  195. package/presets/cursor/ios-swift/hooks/guard-shell-command.mjs +95 -0
  196. package/presets/cursor/ios-swift/hooks/run-hook.mjs +102 -0
  197. package/presets/cursor/ios-swift/hooks.json +2 -2
  198. package/presets/cursor/ios-swift/rules/code-review-mr.mdc +10 -0
  199. package/presets/cursor/ios-swift/team/README.md +5 -0
  200. package/presets/cursor/java/commands/update.md +1 -0
  201. package/presets/cursor/java/hooks/README.md +2 -1
  202. package/presets/cursor/java/hooks/chain-team-phases.sh +200 -4
  203. package/presets/cursor/java/hooks/examples/README.md +1 -1
  204. package/presets/cursor/java/hooks/guard-shell-command.mjs +96 -0
  205. package/presets/cursor/java/hooks/run-hook.mjs +102 -0
  206. package/presets/cursor/java/hooks.json +2 -2
  207. package/presets/cursor/java/rules/code-review-mr.mdc +10 -0
  208. package/presets/cursor/java/team/README.md +5 -0
  209. package/presets/cursor/mcp-ts/commands/update.md +1 -0
  210. package/presets/cursor/mcp-ts/hooks/README.md +2 -1
  211. package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +200 -4
  212. package/presets/cursor/mcp-ts/hooks/guard-shell-command.mjs +95 -0
  213. package/presets/cursor/mcp-ts/hooks/run-hook.mjs +102 -0
  214. package/presets/cursor/mcp-ts/hooks.json +2 -2
  215. package/presets/cursor/mcp-ts/rules/code-review-mr.mdc +10 -0
  216. package/presets/cursor/mcp-ts/team/README.md +5 -0
  217. package/presets/cursor/mol/MCP.md +4 -3
  218. package/presets/cursor/mol/commands/update.md +1 -0
  219. package/presets/cursor/mol/hooks/README.md +2 -1
  220. package/presets/cursor/mol/hooks/chain-team-phases.sh +200 -4
  221. package/presets/cursor/mol/hooks/examples/README.md +1 -1
  222. package/presets/{claude/next/hooks/guard-shell-command.sh → cursor/mol/hooks/guard-shell-command.mjs} +29 -35
  223. package/presets/cursor/mol/hooks/run-hook.mjs +102 -0
  224. package/presets/cursor/mol/hooks.json +2 -2
  225. package/presets/cursor/mol/rules/code-review-mr.mdc +10 -0
  226. package/presets/cursor/mol/team/README.md +5 -0
  227. package/presets/cursor/next/MCP.md +4 -3
  228. package/presets/cursor/next/agents/build-verifier.md +4 -0
  229. package/presets/cursor/next/agents/code-reviewer.md +10 -0
  230. package/presets/cursor/next/agents/feature-developer.md +1 -0
  231. package/presets/cursor/next/agents/task-analyst.md +4 -0
  232. package/presets/cursor/next/agents/task-router.md +5 -3
  233. package/presets/cursor/next/commands/README.md +1 -0
  234. package/presets/cursor/next/commands/task-continue.md +4 -2
  235. package/presets/cursor/next/commands/update.md +1 -0
  236. package/presets/cursor/next/commands/upstream-research.md +23 -0
  237. package/presets/cursor/next/hooks/README.md +2 -1
  238. package/presets/cursor/next/hooks/chain-team-phases.sh +200 -4
  239. package/presets/cursor/next/hooks/examples/README.md +1 -1
  240. package/presets/cursor/next/hooks/guard-shell-command.mjs +94 -0
  241. package/presets/cursor/next/hooks/run-hook.mjs +102 -0
  242. package/presets/cursor/next/hooks.json +2 -2
  243. package/presets/cursor/next/rules/code-review-mr.mdc +10 -0
  244. package/presets/cursor/next/team/README.md +23 -0
  245. package/presets/cursor/next/team/upstream/config.json +31 -0
  246. package/presets/cursor/next/team/upstream/digest-template.md +55 -0
  247. package/presets/cursor/next/team/upstream/opencode.json +34 -0
  248. package/presets/cursor/next/team/upstream/projects.json +4 -0
  249. package/presets/cursor/next/team/upstream/prompt.md +77 -0
  250. package/presets/cursor/next/team/upstream/signatures.json +9 -0
  251. package/presets/cursor/nuxt/commands/update.md +1 -0
  252. package/presets/cursor/nuxt/hooks/README.md +2 -1
  253. package/presets/cursor/nuxt/hooks/chain-team-phases.sh +200 -4
  254. package/presets/cursor/nuxt/hooks/examples/README.md +1 -1
  255. package/presets/cursor/nuxt/hooks/guard-shell-command.mjs +94 -0
  256. package/presets/cursor/nuxt/hooks/run-hook.mjs +102 -0
  257. package/presets/cursor/nuxt/hooks.json +2 -2
  258. package/presets/cursor/nuxt/rules/code-review-mr.mdc +10 -0
  259. package/presets/cursor/nuxt/team/README.md +5 -0
  260. package/presets/cursor/php-hexagonal/commands/update.md +1 -0
  261. package/presets/cursor/php-hexagonal/hooks/README.md +2 -1
  262. package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +200 -4
  263. package/presets/cursor/php-hexagonal/hooks/examples/README.md +1 -1
  264. package/presets/cursor/php-hexagonal/hooks/guard-shell-command.mjs +96 -0
  265. package/presets/cursor/php-hexagonal/hooks/run-hook.mjs +102 -0
  266. package/presets/cursor/php-hexagonal/hooks.json +2 -2
  267. package/presets/cursor/php-hexagonal/rules/code-review-mr.mdc +10 -0
  268. package/presets/cursor/php-hexagonal/team/README.md +5 -0
  269. package/presets/cursor/php-laravel/commands/update.md +1 -0
  270. package/presets/cursor/php-laravel/hooks/README.md +2 -1
  271. package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +200 -4
  272. package/presets/cursor/php-laravel/hooks/examples/README.md +1 -1
  273. package/presets/cursor/php-laravel/hooks/guard-shell-command.mjs +96 -0
  274. package/presets/cursor/php-laravel/hooks/run-hook.mjs +102 -0
  275. package/presets/cursor/php-laravel/hooks.json +2 -2
  276. package/presets/cursor/php-laravel/rules/code-review-mr.mdc +10 -0
  277. package/presets/cursor/php-laravel/team/README.md +5 -0
  278. package/presets/cursor/svelte/commands/update.md +1 -0
  279. package/presets/cursor/svelte/hooks/README.md +2 -1
  280. package/presets/cursor/svelte/hooks/chain-team-phases.sh +200 -4
  281. package/presets/cursor/svelte/hooks/examples/README.md +1 -1
  282. package/presets/cursor/svelte/hooks/guard-shell-command.mjs +94 -0
  283. package/presets/cursor/svelte/hooks/run-hook.mjs +102 -0
  284. package/presets/cursor/svelte/hooks.json +2 -2
  285. package/presets/cursor/svelte/rules/code-review-mr.mdc +10 -0
  286. package/presets/cursor/svelte/team/README.md +5 -0
  287. package/presets/mavis/android-kotlin/adapter-map.json +11 -3
  288. package/presets/mavis/android-kotlin/commands/update.md +1 -0
  289. package/presets/mavis/android-kotlin/hooks/README.md +2 -1
  290. package/presets/mavis/android-kotlin/hooks/chain-team-phases.sh +200 -4
  291. package/presets/mavis/android-kotlin/rules/agent-team-orchestrator.md +12 -0
  292. package/presets/mavis/android-kotlin/rules/code-review-mr.md +10 -0
  293. package/presets/mavis/android-kotlin/team/README.md +5 -0
  294. package/presets/mavis/go/adapter-map.json +11 -3
  295. package/presets/mavis/go/commands/update.md +1 -0
  296. package/presets/mavis/go/hooks/README.md +2 -1
  297. package/presets/mavis/go/hooks/chain-team-phases.sh +200 -4
  298. package/presets/mavis/go/rules/agent-team-orchestrator.md +12 -0
  299. package/presets/mavis/go/rules/code-review-mr.md +10 -0
  300. package/presets/mavis/go/team/README.md +5 -0
  301. package/presets/mavis/ios-swift/adapter-map.json +11 -3
  302. package/presets/mavis/ios-swift/commands/update.md +1 -0
  303. package/presets/mavis/ios-swift/hooks/README.md +2 -1
  304. package/presets/mavis/ios-swift/hooks/chain-team-phases.sh +200 -4
  305. package/presets/mavis/ios-swift/rules/agent-team-orchestrator.md +12 -0
  306. package/presets/mavis/ios-swift/rules/code-review-mr.md +10 -0
  307. package/presets/mavis/ios-swift/team/README.md +5 -0
  308. package/presets/mavis/java/adapter-map.json +11 -3
  309. package/presets/mavis/java/commands/update.md +1 -0
  310. package/presets/mavis/java/hooks/README.md +2 -1
  311. package/presets/mavis/java/hooks/chain-team-phases.sh +200 -4
  312. package/presets/mavis/java/rules/agent-team-orchestrator.md +12 -0
  313. package/presets/mavis/java/rules/code-review-mr.md +10 -0
  314. package/presets/mavis/java/team/README.md +5 -0
  315. package/presets/mavis/mcp-ts/adapter-map.json +11 -3
  316. package/presets/mavis/mcp-ts/commands/update.md +1 -0
  317. package/presets/mavis/mcp-ts/hooks/README.md +2 -1
  318. package/presets/mavis/mcp-ts/hooks/chain-team-phases.sh +200 -4
  319. package/presets/mavis/mcp-ts/rules/agent-team-orchestrator.md +12 -0
  320. package/presets/mavis/mcp-ts/rules/code-review-mr.md +10 -0
  321. package/presets/mavis/mcp-ts/team/README.md +5 -0
  322. package/presets/mavis/mol/MCP.md +4 -3
  323. package/presets/mavis/mol/adapter-map.json +11 -3
  324. package/presets/mavis/mol/commands/update.md +1 -0
  325. package/presets/mavis/mol/hooks/README.md +2 -1
  326. package/presets/mavis/mol/hooks/chain-team-phases.sh +200 -4
  327. package/presets/mavis/mol/rules/agent-team-orchestrator.md +12 -0
  328. package/presets/mavis/mol/rules/code-review-mr.md +10 -0
  329. package/presets/mavis/mol/team/README.md +5 -0
  330. package/presets/mavis/next/MCP.md +4 -3
  331. package/presets/mavis/next/adapter-map.json +67 -3
  332. package/presets/mavis/next/agents/build-verifier.md +4 -0
  333. package/presets/mavis/next/agents/code-reviewer.md +10 -0
  334. package/presets/mavis/next/agents/feature-developer.md +1 -0
  335. package/presets/mavis/next/agents/task-analyst.md +4 -0
  336. package/presets/mavis/next/agents/task-router.md +5 -3
  337. package/presets/mavis/next/commands/README.md +1 -0
  338. package/presets/mavis/next/commands/task-continue.md +4 -2
  339. package/presets/mavis/next/commands/update.md +1 -0
  340. package/presets/mavis/next/commands/upstream-research.md +18 -0
  341. package/presets/mavis/next/hooks/README.md +2 -1
  342. package/presets/mavis/next/hooks/chain-team-phases.sh +200 -4
  343. package/presets/mavis/next/rules/agent-team-orchestrator.md +12 -0
  344. package/presets/mavis/next/rules/code-review-mr.md +10 -0
  345. package/presets/mavis/next/team/README.md +23 -0
  346. package/presets/mavis/next/team/upstream/config.json +31 -0
  347. package/presets/mavis/next/team/upstream/digest-template.md +55 -0
  348. package/presets/mavis/next/team/upstream/opencode.json +34 -0
  349. package/presets/mavis/next/team/upstream/projects.json +4 -0
  350. package/presets/mavis/next/team/upstream/prompt.md +77 -0
  351. package/presets/mavis/next/team/upstream/signatures.json +9 -0
  352. package/presets/mavis/nuxt/adapter-map.json +11 -3
  353. package/presets/mavis/nuxt/commands/update.md +1 -0
  354. package/presets/mavis/nuxt/hooks/README.md +2 -1
  355. package/presets/mavis/nuxt/hooks/chain-team-phases.sh +200 -4
  356. package/presets/mavis/nuxt/rules/agent-team-orchestrator.md +12 -0
  357. package/presets/mavis/nuxt/rules/code-review-mr.md +10 -0
  358. package/presets/mavis/nuxt/team/README.md +5 -0
  359. package/presets/mavis/php-hexagonal/adapter-map.json +11 -3
  360. package/presets/mavis/php-hexagonal/commands/update.md +1 -0
  361. package/presets/mavis/php-hexagonal/hooks/README.md +2 -1
  362. package/presets/mavis/php-hexagonal/hooks/chain-team-phases.sh +200 -4
  363. package/presets/mavis/php-hexagonal/rules/agent-team-orchestrator.md +12 -0
  364. package/presets/mavis/php-hexagonal/rules/code-review-mr.md +10 -0
  365. package/presets/mavis/php-hexagonal/team/README.md +5 -0
  366. package/presets/mavis/php-laravel/adapter-map.json +11 -3
  367. package/presets/mavis/php-laravel/commands/update.md +1 -0
  368. package/presets/mavis/php-laravel/hooks/README.md +2 -1
  369. package/presets/mavis/php-laravel/hooks/chain-team-phases.sh +200 -4
  370. package/presets/mavis/php-laravel/rules/agent-team-orchestrator.md +12 -0
  371. package/presets/mavis/php-laravel/rules/code-review-mr.md +10 -0
  372. package/presets/mavis/php-laravel/team/README.md +5 -0
  373. package/presets/mavis/svelte/adapter-map.json +11 -3
  374. package/presets/mavis/svelte/commands/update.md +1 -0
  375. package/presets/mavis/svelte/hooks/README.md +2 -1
  376. package/presets/mavis/svelte/hooks/chain-team-phases.sh +200 -4
  377. package/presets/mavis/svelte/rules/agent-team-orchestrator.md +12 -0
  378. package/presets/mavis/svelte/rules/code-review-mr.md +10 -0
  379. package/presets/mavis/svelte/team/README.md +5 -0
  380. package/presets/opencode/android-kotlin/OPENCODE.md +1 -1
  381. package/presets/opencode/android-kotlin/README.md +1 -1
  382. package/presets/opencode/android-kotlin/adapter-map.json +11 -3
  383. package/presets/opencode/android-kotlin/commands/update.md +1 -0
  384. package/presets/opencode/android-kotlin/hooks/README.md +3 -2
  385. package/presets/opencode/android-kotlin/hooks/chain-team-phases.sh +200 -4
  386. package/presets/opencode/android-kotlin/rules/agent-team-orchestrator.md +12 -0
  387. package/presets/opencode/android-kotlin/rules/code-review-mr.md +10 -0
  388. package/presets/opencode/android-kotlin/team/README.md +5 -0
  389. package/presets/opencode/go/OPENCODE.md +1 -1
  390. package/presets/opencode/go/README.md +1 -1
  391. package/presets/opencode/go/adapter-map.json +11 -3
  392. package/presets/opencode/go/commands/update.md +1 -0
  393. package/presets/opencode/go/hooks/README.md +3 -2
  394. package/presets/opencode/go/hooks/chain-team-phases.sh +200 -4
  395. package/presets/opencode/go/rules/agent-team-orchestrator.md +12 -0
  396. package/presets/opencode/go/rules/code-review-mr.md +10 -0
  397. package/presets/opencode/go/team/README.md +5 -0
  398. package/presets/opencode/ios-swift/OPENCODE.md +1 -1
  399. package/presets/opencode/ios-swift/README.md +1 -1
  400. package/presets/opencode/ios-swift/adapter-map.json +11 -3
  401. package/presets/opencode/ios-swift/commands/update.md +1 -0
  402. package/presets/opencode/ios-swift/hooks/README.md +3 -2
  403. package/presets/opencode/ios-swift/hooks/chain-team-phases.sh +200 -4
  404. package/presets/opencode/ios-swift/rules/agent-team-orchestrator.md +12 -0
  405. package/presets/opencode/ios-swift/rules/code-review-mr.md +10 -0
  406. package/presets/opencode/ios-swift/team/README.md +5 -0
  407. package/presets/opencode/java/OPENCODE.md +1 -1
  408. package/presets/opencode/java/README.md +1 -1
  409. package/presets/opencode/java/adapter-map.json +11 -3
  410. package/presets/opencode/java/commands/update.md +1 -0
  411. package/presets/opencode/java/hooks/README.md +3 -2
  412. package/presets/opencode/java/hooks/chain-team-phases.sh +200 -4
  413. package/presets/opencode/java/rules/agent-team-orchestrator.md +12 -0
  414. package/presets/opencode/java/rules/code-review-mr.md +10 -0
  415. package/presets/opencode/java/team/README.md +5 -0
  416. package/presets/opencode/mcp-ts/OPENCODE.md +1 -1
  417. package/presets/opencode/mcp-ts/README.md +1 -1
  418. package/presets/opencode/mcp-ts/adapter-map.json +11 -3
  419. package/presets/opencode/mcp-ts/commands/update.md +1 -0
  420. package/presets/opencode/mcp-ts/hooks/README.md +3 -2
  421. package/presets/opencode/mcp-ts/hooks/chain-team-phases.sh +200 -4
  422. package/presets/opencode/mcp-ts/rules/agent-team-orchestrator.md +12 -0
  423. package/presets/opencode/mcp-ts/rules/code-review-mr.md +10 -0
  424. package/presets/opencode/mcp-ts/team/README.md +5 -0
  425. package/presets/opencode/mol/MCP.md +4 -3
  426. package/presets/opencode/mol/OPENCODE.md +1 -1
  427. package/presets/opencode/mol/README.md +1 -1
  428. package/presets/opencode/mol/adapter-map.json +11 -3
  429. package/presets/opencode/mol/commands/update.md +1 -0
  430. package/presets/opencode/mol/hooks/README.md +3 -2
  431. package/presets/opencode/mol/hooks/chain-team-phases.sh +200 -4
  432. package/presets/opencode/mol/rules/agent-team-orchestrator.md +12 -0
  433. package/presets/opencode/mol/rules/code-review-mr.md +10 -0
  434. package/presets/opencode/mol/team/README.md +5 -0
  435. package/presets/opencode/next/MCP.md +4 -3
  436. package/presets/opencode/next/OPENCODE.md +1 -1
  437. package/presets/opencode/next/README.md +1 -1
  438. package/presets/opencode/next/adapter-map.json +67 -3
  439. package/presets/opencode/next/agents/build-verifier.md +4 -0
  440. package/presets/opencode/next/agents/code-reviewer.md +10 -0
  441. package/presets/opencode/next/agents/feature-developer.md +1 -0
  442. package/presets/opencode/next/agents/task-analyst.md +4 -0
  443. package/presets/opencode/next/agents/task-router.md +5 -3
  444. package/presets/opencode/next/commands/README.md +1 -0
  445. package/presets/opencode/next/commands/task-continue.md +4 -2
  446. package/presets/opencode/next/commands/update.md +1 -0
  447. package/presets/opencode/next/commands/upstream-research.md +26 -0
  448. package/presets/opencode/next/hooks/README.md +3 -2
  449. package/presets/opencode/next/hooks/chain-team-phases.sh +200 -4
  450. package/presets/opencode/next/rules/agent-team-orchestrator.md +12 -0
  451. package/presets/opencode/next/rules/code-review-mr.md +10 -0
  452. package/presets/opencode/next/team/README.md +23 -0
  453. package/presets/opencode/next/team/upstream/config.json +31 -0
  454. package/presets/opencode/next/team/upstream/digest-template.md +55 -0
  455. package/presets/opencode/next/team/upstream/opencode.json +34 -0
  456. package/presets/opencode/next/team/upstream/projects.json +4 -0
  457. package/presets/opencode/next/team/upstream/prompt.md +77 -0
  458. package/presets/opencode/next/team/upstream/signatures.json +9 -0
  459. package/presets/opencode/nuxt/OPENCODE.md +1 -1
  460. package/presets/opencode/nuxt/README.md +1 -1
  461. package/presets/opencode/nuxt/adapter-map.json +11 -3
  462. package/presets/opencode/nuxt/commands/update.md +1 -0
  463. package/presets/opencode/nuxt/hooks/README.md +3 -2
  464. package/presets/opencode/nuxt/hooks/chain-team-phases.sh +200 -4
  465. package/presets/opencode/nuxt/rules/agent-team-orchestrator.md +12 -0
  466. package/presets/opencode/nuxt/rules/code-review-mr.md +10 -0
  467. package/presets/opencode/nuxt/team/README.md +5 -0
  468. package/presets/opencode/php-hexagonal/OPENCODE.md +1 -1
  469. package/presets/opencode/php-hexagonal/README.md +1 -1
  470. package/presets/opencode/php-hexagonal/adapter-map.json +11 -3
  471. package/presets/opencode/php-hexagonal/commands/update.md +1 -0
  472. package/presets/opencode/php-hexagonal/hooks/README.md +3 -2
  473. package/presets/opencode/php-hexagonal/hooks/chain-team-phases.sh +200 -4
  474. package/presets/opencode/php-hexagonal/rules/agent-team-orchestrator.md +12 -0
  475. package/presets/opencode/php-hexagonal/rules/code-review-mr.md +10 -0
  476. package/presets/opencode/php-hexagonal/team/README.md +5 -0
  477. package/presets/opencode/php-laravel/OPENCODE.md +1 -1
  478. package/presets/opencode/php-laravel/README.md +1 -1
  479. package/presets/opencode/php-laravel/adapter-map.json +11 -3
  480. package/presets/opencode/php-laravel/commands/update.md +1 -0
  481. package/presets/opencode/php-laravel/hooks/README.md +3 -2
  482. package/presets/opencode/php-laravel/hooks/chain-team-phases.sh +200 -4
  483. package/presets/opencode/php-laravel/rules/agent-team-orchestrator.md +12 -0
  484. package/presets/opencode/php-laravel/rules/code-review-mr.md +10 -0
  485. package/presets/opencode/php-laravel/team/README.md +5 -0
  486. package/presets/opencode/svelte/OPENCODE.md +1 -1
  487. package/presets/opencode/svelte/README.md +1 -1
  488. package/presets/opencode/svelte/adapter-map.json +11 -3
  489. package/presets/opencode/svelte/commands/update.md +1 -0
  490. package/presets/opencode/svelte/hooks/README.md +3 -2
  491. package/presets/opencode/svelte/hooks/chain-team-phases.sh +200 -4
  492. package/presets/opencode/svelte/rules/agent-team-orchestrator.md +12 -0
  493. package/presets/opencode/svelte/rules/code-review-mr.md +10 -0
  494. package/presets/opencode/svelte/team/README.md +5 -0
  495. package/presets/zcode/android-kotlin/adapter-map.json +11 -3
  496. package/presets/zcode/android-kotlin/commands/update.md +1 -0
  497. package/presets/zcode/android-kotlin/hooks/README.md +2 -1
  498. package/presets/zcode/android-kotlin/hooks/chain-team-phases.sh +200 -4
  499. package/presets/zcode/android-kotlin/rules/agent-team-orchestrator.md +12 -0
  500. package/presets/zcode/android-kotlin/rules/code-review-mr.md +10 -0
  501. package/presets/zcode/android-kotlin/team/README.md +5 -0
  502. package/presets/zcode/go/adapter-map.json +11 -3
  503. package/presets/zcode/go/commands/update.md +1 -0
  504. package/presets/zcode/go/hooks/README.md +2 -1
  505. package/presets/zcode/go/hooks/chain-team-phases.sh +200 -4
  506. package/presets/zcode/go/rules/agent-team-orchestrator.md +12 -0
  507. package/presets/zcode/go/rules/code-review-mr.md +10 -0
  508. package/presets/zcode/go/team/README.md +5 -0
  509. package/presets/zcode/ios-swift/adapter-map.json +11 -3
  510. package/presets/zcode/ios-swift/commands/update.md +1 -0
  511. package/presets/zcode/ios-swift/hooks/README.md +2 -1
  512. package/presets/zcode/ios-swift/hooks/chain-team-phases.sh +200 -4
  513. package/presets/zcode/ios-swift/rules/agent-team-orchestrator.md +12 -0
  514. package/presets/zcode/ios-swift/rules/code-review-mr.md +10 -0
  515. package/presets/zcode/ios-swift/team/README.md +5 -0
  516. package/presets/zcode/java/adapter-map.json +11 -3
  517. package/presets/zcode/java/commands/update.md +1 -0
  518. package/presets/zcode/java/hooks/README.md +2 -1
  519. package/presets/zcode/java/hooks/chain-team-phases.sh +200 -4
  520. package/presets/zcode/java/rules/agent-team-orchestrator.md +12 -0
  521. package/presets/zcode/java/rules/code-review-mr.md +10 -0
  522. package/presets/zcode/java/team/README.md +5 -0
  523. package/presets/zcode/mcp-ts/adapter-map.json +11 -3
  524. package/presets/zcode/mcp-ts/commands/update.md +1 -0
  525. package/presets/zcode/mcp-ts/hooks/README.md +2 -1
  526. package/presets/zcode/mcp-ts/hooks/chain-team-phases.sh +200 -4
  527. package/presets/zcode/mcp-ts/rules/agent-team-orchestrator.md +12 -0
  528. package/presets/zcode/mcp-ts/rules/code-review-mr.md +10 -0
  529. package/presets/zcode/mcp-ts/team/README.md +5 -0
  530. package/presets/zcode/mol/MCP.md +4 -3
  531. package/presets/zcode/mol/adapter-map.json +11 -3
  532. package/presets/zcode/mol/commands/update.md +1 -0
  533. package/presets/zcode/mol/hooks/README.md +2 -1
  534. package/presets/zcode/mol/hooks/chain-team-phases.sh +200 -4
  535. package/presets/zcode/mol/rules/agent-team-orchestrator.md +12 -0
  536. package/presets/zcode/mol/rules/code-review-mr.md +10 -0
  537. package/presets/zcode/mol/team/README.md +5 -0
  538. package/presets/zcode/next/MCP.md +4 -3
  539. package/presets/zcode/next/adapter-map.json +67 -3
  540. package/presets/zcode/next/agents/build-verifier.md +4 -0
  541. package/presets/zcode/next/agents/code-reviewer.md +10 -0
  542. package/presets/zcode/next/agents/feature-developer.md +1 -0
  543. package/presets/zcode/next/agents/task-analyst.md +4 -0
  544. package/presets/zcode/next/agents/task-router.md +5 -3
  545. package/presets/zcode/next/commands/README.md +1 -0
  546. package/presets/zcode/next/commands/task-continue.md +4 -2
  547. package/presets/zcode/next/commands/update.md +1 -0
  548. package/presets/zcode/next/commands/upstream-research.md +26 -0
  549. package/presets/zcode/next/hooks/README.md +2 -1
  550. package/presets/zcode/next/hooks/chain-team-phases.sh +200 -4
  551. package/presets/zcode/next/rules/agent-team-orchestrator.md +12 -0
  552. package/presets/zcode/next/rules/code-review-mr.md +10 -0
  553. package/presets/zcode/next/team/README.md +23 -0
  554. package/presets/zcode/next/team/upstream/config.json +31 -0
  555. package/presets/zcode/next/team/upstream/digest-template.md +55 -0
  556. package/presets/zcode/next/team/upstream/opencode.json +34 -0
  557. package/presets/zcode/next/team/upstream/projects.json +4 -0
  558. package/presets/zcode/next/team/upstream/prompt.md +77 -0
  559. package/presets/zcode/next/team/upstream/signatures.json +9 -0
  560. package/presets/zcode/nuxt/adapter-map.json +11 -3
  561. package/presets/zcode/nuxt/commands/update.md +1 -0
  562. package/presets/zcode/nuxt/hooks/README.md +2 -1
  563. package/presets/zcode/nuxt/hooks/chain-team-phases.sh +200 -4
  564. package/presets/zcode/nuxt/rules/agent-team-orchestrator.md +12 -0
  565. package/presets/zcode/nuxt/rules/code-review-mr.md +10 -0
  566. package/presets/zcode/nuxt/team/README.md +5 -0
  567. package/presets/zcode/php-hexagonal/adapter-map.json +11 -3
  568. package/presets/zcode/php-hexagonal/commands/update.md +1 -0
  569. package/presets/zcode/php-hexagonal/hooks/README.md +2 -1
  570. package/presets/zcode/php-hexagonal/hooks/chain-team-phases.sh +200 -4
  571. package/presets/zcode/php-hexagonal/rules/agent-team-orchestrator.md +12 -0
  572. package/presets/zcode/php-hexagonal/rules/code-review-mr.md +10 -0
  573. package/presets/zcode/php-hexagonal/team/README.md +5 -0
  574. package/presets/zcode/php-laravel/adapter-map.json +11 -3
  575. package/presets/zcode/php-laravel/commands/update.md +1 -0
  576. package/presets/zcode/php-laravel/hooks/README.md +2 -1
  577. package/presets/zcode/php-laravel/hooks/chain-team-phases.sh +200 -4
  578. package/presets/zcode/php-laravel/rules/agent-team-orchestrator.md +12 -0
  579. package/presets/zcode/php-laravel/rules/code-review-mr.md +10 -0
  580. package/presets/zcode/php-laravel/team/README.md +5 -0
  581. package/presets/zcode/svelte/adapter-map.json +11 -3
  582. package/presets/zcode/svelte/commands/update.md +1 -0
  583. package/presets/zcode/svelte/hooks/README.md +2 -1
  584. package/presets/zcode/svelte/hooks/chain-team-phases.sh +200 -4
  585. package/presets/zcode/svelte/rules/agent-team-orchestrator.md +12 -0
  586. package/presets/zcode/svelte/rules/code-review-mr.md +10 -0
  587. package/presets/zcode/svelte/team/README.md +5 -0
  588. package/presets/claude/android-kotlin/hooks/guard-shell-command.sh +0 -103
  589. package/presets/claude/go/hooks/guard-shell-command.sh +0 -102
  590. package/presets/claude/mcp-ts/hooks/guard-shell-command.sh +0 -102
  591. package/presets/claude/php-hexagonal/hooks/guard-shell-command.sh +0 -103
  592. package/presets/claude/php-laravel/hooks/guard-shell-command.sh +0 -103
  593. package/presets/cursor/android-kotlin/hooks/guard-shell-command.sh +0 -80
  594. package/presets/cursor/go/hooks/guard-shell-command.sh +0 -79
  595. package/presets/cursor/ios-swift/hooks/guard-shell-command.sh +0 -79
  596. package/presets/cursor/java/hooks/guard-shell-command.sh +0 -80
  597. package/presets/cursor/mcp-ts/hooks/guard-shell-command.sh +0 -79
  598. package/presets/cursor/mol/hooks/guard-shell-command.sh +0 -77
  599. package/presets/cursor/next/hooks/guard-shell-command.sh +0 -77
  600. package/presets/cursor/nuxt/hooks/guard-shell-command.sh +0 -77
  601. package/presets/cursor/php-hexagonal/hooks/guard-shell-command.sh +0 -80
  602. package/presets/cursor/php-laravel/hooks/guard-shell-command.sh +0 -80
  603. package/presets/cursor/svelte/hooks/guard-shell-command.sh +0 -77
package/bin/cli.js CHANGED
@@ -10,7 +10,7 @@ const { cmdInitMavis, cmdCleanMavis } = require('./mavis-install');
10
10
  const { cmdInitOpencode, cmdCleanOpencode } = require('./opencode-install');
11
11
  const { cmdInitZcode, cmdCleanZcode } = require('./zcode-install');
12
12
  const { seedAiLocalTeam } = require('./lib/seed-ai-local-team');
13
- const { flushAiLocalDriftSummary, flushAllAiLocalDriftSummaries } = require('./lib/ai-local-drift');
13
+ const { flushAiLocalDriftSummary, flushAllAiLocalDriftSummaries, ownEngineCheck } = require('./lib/ai-local-drift');
14
14
  const { assertSafeDest, escapesRoot, resolveManagedPath } = require('./lib/safe-path');
15
15
  const {
16
16
  createInstallTransaction,
@@ -32,12 +32,14 @@ const {
32
32
  stripMergedConfigs,
33
33
  } = require('./lib/merged-config');
34
34
  const { otherToolInstallPresent, TOOL_INSTALL_MARKERS } = require('./lib/tool-installs');
35
+ const { planEngineUpgrade, applyEngineUpgrade } = require('./lib/engine-upgrade');
35
36
  const {
36
37
  CLIENT_IDS,
37
38
  serverBySlug,
38
39
  serversFor,
39
40
  } = require('./lib/mcp/registry');
40
- const { selectClients, registerServers, removeServers } = require('./lib/mcp/clients');
41
+ const { CATALOG, catalogNames, resolveCatalogName } = require('./lib/mcp/catalog');
42
+ const { selectClients, registerServers, registerCatalogServers, removeServers } = require('./lib/mcp/clients');
41
43
  const credentials = require('./lib/mcp/credentials');
42
44
  const { runDoctor, AREAS } = require('./lib/mcp/doctor');
43
45
  const {
@@ -106,22 +108,30 @@ function printHelp() {
106
108
  Usage:
107
109
  ai-rules init <cursor|claude|mavis|opencode|zcode|multi> [--preset <name>]
108
110
  ai-rules init <cursor|claude|mavis|opencode|zcode|multi> <preset-name>
109
- ai-rules update [--merge-ai-local | --check] [--cwd <dir>]
111
+ ai-rules init mcp <name...|--all> [--tools <list>] [--cwd <dir>]
112
+ ai-rules update [--fix | --merge-ai-local | --check] [--no-backup] [--cwd <dir>]
113
+ ai-rules doctor [--json] [--fix] [--cwd <dir>]
110
114
  ai-rules clean <cursor|claude|mavis|opencode|zcode> [--cwd <dir>]
111
- ai-rules mcp setup <gitlab|yandex|all> [--tools <list>] [--yes] [--replace] [--url <url>] [--org-id <id>] [--json] [--cwd <dir>]
112
- ai-rules mcp add <gitlab|yandex|all> [--tools <list>] [--replace] [--json] [--cwd <dir>]
113
- ai-rules mcp remove <gitlab|yandex|all> [--tools <list>] [--purge] [--json] [--cwd <dir>]
114
- ai-rules mcp doctor [gitlab|yandex|all] [--json] [--cwd <dir>]
115
+ ai-rules mcp setup <gitlab|github|yandex|defectdojo|all> [--tools <list>] [--yes] [--replace] [--url <url>] [--org-id <id>] [--json] [--cwd <dir>]
116
+ ai-rules mcp add <gitlab|github|yandex|defectdojo|all> [--tools <list>] [--replace] [--json] [--cwd <dir>]
117
+ ai-rules mcp remove <gitlab|github|yandex|defectdojo|all> [--tools <list>] [--purge] [--json] [--cwd <dir>]
118
+ ai-rules mcp doctor [gitlab|github|yandex|defectdojo|all] [--json] [--cwd <dir>]
115
119
  ai-rules mcp refresh yandex [--print] [--json] [--yc-bin <path>] [--cwd <dir>]
116
- ai-rules mcp run <gitlab|yandex-tracker|yandex-wiki> [--print-env] (internal — used by the client config)
120
+ ai-rules mcp run <gitlab|github|yandex-tracker|yandex-wiki|defectdojo> [--print-env] (internal — used by the client config)
117
121
 
118
122
  Options:
119
123
  --preset <name> Preset name (default: ${DEFAULT_PRESET})
120
124
  --cwd <dir> Target project directory (default: current working directory)
125
+ --all init mcp: every server in the catalog
126
+ --tools <list> init mcp: comma-separated clients (default: detected)
121
127
  --merge-ai-local Fast-forward .ai.local/ files whose recorded base still matches
122
128
  --check Print each .ai.local/ drift rel and write nothing
123
129
  the preset template; a file you edited is kept and its diff is
124
130
  written to .ai.local/.rollback/template-drift/
131
+ --fix Write the seeded .ai.local/scripts/ modules whose bytes still
132
+ match the recorded shipped base (update and doctor)
133
+ --no-backup update --fix: skip the durable .ai.local/.rollback/engine-<stamp>/
134
+ backup (failure atomicity and safe-path refusal stay on)
125
135
 
126
136
  Notes:
127
137
  init merges into the target directory; same-named preset files are overwritten (no backups are kept).
@@ -151,15 +161,23 @@ Notes:
151
161
  OpenCode init copies into .opencode/ plus REPO_AGENTS.md → <cwd>/AGENTS.md; MCP merges into <cwd>/opencode.json (never ~/.config/opencode/**).
152
162
  All init targets also copy REPO_AGENTS.md → <cwd>/AGENTS.md (repo-root cross-tool agents file; overwrite; all next platforms ship the same file).
153
163
  init multi installs every platform that has released the preset (cursor, claude, plus mavis/opencode when listed in releasedStacks). Not a clean target.
154
- update reinstalls each tool that already has <tool>/.ai-rules-install.json, using the preset field that init wrote. Tools without a manifest stay uninstalled. The recorded preset is kept. update does not accept --preset or a tool name; --merge-ai-local is allowed on update and on init.
164
+ update reinstalls each tool that already has <tool>/.ai-rules-install.json, using the preset field that init wrote. Tools without a manifest stay uninstalled. The recorded preset is kept. update does not accept --preset or a tool name; --merge-ai-local is allowed on update and on init. update --fix upgrades a seeded .ai.local/scripts/ module only when its bytes still match the recorded shipped base in .ai.local/.template-base.json: a consumer-edited module is kept as modified, a module with no recorded base is never written, and every overwritten module is backed up to .ai.local/.rollback/engine-<stamp>/ (keep the 5 newest runs; --no-backup skips the durable copy). Restore with: cp -R .ai.local/.rollback/engine-<stamp>/.ai.local .
165
+ doctor reports for every installed platform missing/modified managed files, a manifest/package version mismatch, and the shared .ai.local/scripts/ engine set (stale-engine = safely upgradeable, missing-engine, modified = your edit); every finding carries fixable in --json. doctor --fix applies the same plan and writer as update --fix, then re-runs the check and prints the post-state; exit 0 = clean, 1 = findings, 2 = usage error. --json prints one object with an additive fix field when --fix ran.
155
166
  When <cwd>/docs/specs/ is absent, init also seeds INDEX.md stub + _templates/* from package assets (never overwrites an existing INDEX).
156
167
  clean removes only files the last init copied and that are unchanged since; consumer files are kept.
157
168
  Merged configs are never deleted wholesale: clean strips the entries init added (shipped MCP servers, preset
158
169
  settings.json permissions/hooks, opencode.json instructions/bash keys) and removes the file only when nothing
159
170
  else is left in a file init created. Shared <cwd>/AGENTS.md is removed only when no other tool install remains.
160
171
  Command forms: "init cursor --preset next", "init cursor next", "--preset next init cursor", "cursor init --preset next".
172
+ init mcp <name> registers a third-party server from the shipped catalog into every installed client
173
+ (or --tools only). Names: context7, playwright, chrome-devtools, next-devtools, semgrep, sentry,
174
+ figma-desktop (alias: figma), figma-cloud, storybook, defectdojo, gitlab, github, yandex-tracker,
175
+ yandex-wiki; --all selects every one. Runtime entries (defectdojo, gitlab, github, yandex-*) need the
176
+ mcp setup command for credentials. Entries merge like init: extra servers and consumer env/headers stay.
161
177
  mcp setup obtains and validates credentials, writes the client entries and runs the doctor. GitLab credentials live in
162
- .ai-rules/mcp/credentials.env (0600); Yandex settings live in .ai-rules/mcp/config.env (no token). Both sit in a
178
+ .ai-rules/mcp/credentials.env (0600); Yandex settings live in .ai-rules/mcp/config.env (no token); the GitHub token is read
179
+ from the shell or from .env.github in the project root and is never written by the package. The DefectDojo URL and token are
180
+ read from the shell or from .env.defectdojo and are never written by the package. The two settings files sit in a
163
181
  self-ignoring .ai-rules/ (the root .gitignore is never modified). Only clients already installed are registered; --tools
164
182
  narrows or names a client explicitly. mcp commands require Node 20+ (the GitLab child declares engines >=20).
165
183
 
@@ -195,14 +213,19 @@ Examples:
195
213
  npx @bonesofspring/ai-rules clean mavis
196
214
  npx @bonesofspring/ai-rules clean opencode
197
215
  npx @bonesofspring/ai-rules clean cursor
216
+ npx @bonesofspring/ai-rules init mcp context7
217
+ npx @bonesofspring/ai-rules init mcp figma-desktop chrome-devtools
218
+ npx @bonesofspring/ai-rules init mcp --all
198
219
  npx @bonesofspring/ai-rules mcp setup gitlab
220
+ npx @bonesofspring/ai-rules mcp setup github
199
221
  npx @bonesofspring/ai-rules mcp setup yandex
222
+ npx @bonesofspring/ai-rules mcp setup defectdojo
200
223
  npx @bonesofspring/ai-rules mcp doctor
201
224
  npx @bonesofspring/ai-rules mcp refresh yandex
202
225
  `);
203
226
  }
204
227
 
205
- function parseArgs(argv) {
228
+ function parseArgs(argv, options = {}) {
206
229
  const args = { _: [], cwd: undefined, preset: undefined, presetError: undefined };
207
230
  for (let i = 0; i < argv.length; i++) {
208
231
  const a = argv[i];
@@ -257,6 +280,19 @@ function parseArgs(argv) {
257
280
  args.checkAiLocal = true;
258
281
  continue;
259
282
  }
283
+ if (a === '--fix') {
284
+ args.fix = true;
285
+ continue;
286
+ }
287
+ if (a === '--no-backup') {
288
+ args.noBackup = true;
289
+ continue;
290
+ }
291
+ if (a === '--json') {
292
+ if (options.json) args.json = true;
293
+ else args.unknownOption = a;
294
+ continue;
295
+ }
260
296
  if (a.startsWith('-') && a !== '-') {
261
297
  args.unknownOption = a;
262
298
  continue;
@@ -586,21 +622,21 @@ function presetHasAnySource(base, cfg) {
586
622
  return false;
587
623
  }
588
624
 
589
- function resolveTargetCwd(cwdOption) {
625
+ function resolveTargetCwd(cwdOption, usageExitCode = 1) {
590
626
  // Reject empty string explicitly: `path.resolve('')` silently returns cwd,
591
627
  // turning `--cwd ""` into a footgun that mutates the wrong directory.
592
628
  if (cwdOption !== undefined && cwdOption === '') {
593
629
  console.error('--cwd requires a non-empty path (use --cwd <dir> or omit for current directory)');
594
- process.exit(1);
630
+ process.exit(usageExitCode);
595
631
  }
596
632
  const cwd = cwdOption ? path.resolve(cwdOption) : process.cwd();
597
633
  if (!fs.existsSync(cwd)) {
598
634
  console.error(`Target directory does not exist: ${cwd}`);
599
- process.exit(1);
635
+ process.exit(usageExitCode);
600
636
  }
601
637
  if (!fs.statSync(cwd).isDirectory()) {
602
638
  console.error(`Target path is not a directory: ${cwd}`);
603
- process.exit(1);
639
+ process.exit(usageExitCode);
604
640
  }
605
641
  return cwd;
606
642
  }
@@ -720,6 +756,21 @@ function updatePresetReady(tool, presetName) {
720
756
  * Validates the whole plan before the first init so a bad manifest does not partially update.
721
757
  */
722
758
  function cmdUpdate(cwdOption, opts) {
759
+ const fix = Boolean(opts && opts.fix);
760
+ const noBackup = Boolean(opts && opts.noBackup);
761
+ const check = Boolean(opts && opts.checkAiLocal);
762
+ if (fix && opts.checkAiLocal) {
763
+ console.error('update: --fix and --check cannot be combined.');
764
+ process.exit(2);
765
+ }
766
+ if (fix && opts.mergeAiLocal) {
767
+ console.error('update: --fix and --merge-ai-local cannot be combined.');
768
+ process.exit(2);
769
+ }
770
+ if (noBackup && !fix) {
771
+ console.error('update: --no-backup requires --fix.');
772
+ process.exit(2);
773
+ }
723
774
  const cwd = resolveTargetCwd(cwdOption);
724
775
  const errors = [];
725
776
  const found = [];
@@ -775,6 +826,15 @@ function cmdUpdate(cwdOption, opts) {
775
826
 
776
827
  const plan = found.map((item) => `${item.tool} (${item.preset})`).join(', ');
777
828
  console.log(`update: reinstalling ${plan}`);
829
+ const packageRoot = getPackageRoot();
830
+ // One plan per command: the engine classifier reads the record before any pass
831
+ // can adopt a rel, and `applyEngineUpgrade` writes after the last pass. `--check`
832
+ // previews the engine lines from this same plan — the drift pass must not
833
+ // classify them a second time with a source that may not match the record.
834
+ const enginePlan = fix || check ? planEngineUpgrade({ cwd, packageRoot }) : null;
835
+ if (check) {
836
+ ownEngineCheck(cwd, new Set(enginePlan.entries.map((entry) => entry.rel)));
837
+ }
778
838
  // One command, one tree, one summary: each tool's pass accumulates, this flushes.
779
839
  const passOpts = { ...opts, deferAiLocalSummary: true };
780
840
  for (const item of found) {
@@ -782,9 +842,305 @@ function cmdUpdate(cwdOption, opts) {
782
842
  cmdInit(item.tool, item.preset, cwdOption, passOpts);
783
843
  }
784
844
  flushAiLocalDriftSummary(cwd);
845
+ if (enginePlan && check) {
846
+ printEngineCheckResult(enginePlan);
847
+ }
848
+ if (enginePlan && fix) {
849
+ let result;
850
+ try {
851
+ result = runEngineFix({ cwd, packageRoot, plan: enginePlan, backup: !noBackup });
852
+ } catch (error) {
853
+ console.error(`update --fix: ${error instanceof Error ? error.message : String(error)}`);
854
+ process.exit(1);
855
+ }
856
+ printEngineFixResult(result);
857
+ const symlinkNote = result.skippedSymlinks.length > 0
858
+ ? `, ${result.skippedSymlinks.length} skipped symlink`
859
+ : '';
860
+ console.log(
861
+ `engine: ${result.fixed.length} fixed, ${result.keptModified.length} kept modified, ${result.current} current${symlinkNote}`,
862
+ );
863
+ }
785
864
  console.log(`\nDone. update reinstalled ${plan}`);
786
865
  }
787
866
 
867
+ /** Run the engine writer through a failure-atomic transaction; throws on failure. */
868
+ function runEngineFix({ cwd, packageRoot, plan, backup }) {
869
+ const stamp = runStamp();
870
+ if (plan.writable.length === 0) {
871
+ return applyEngineUpgrade({ cwd, packageRoot, plan, backup, stamp });
872
+ }
873
+ const tx = createInstallTransaction(
874
+ cwd,
875
+ path.join(cwd, '.ai.local', '.rollback', `.engine-tx-${stamp}`),
876
+ );
877
+ try {
878
+ const result = applyEngineUpgrade({ cwd, packageRoot, plan, backup, stamp, tx });
879
+ tx.commit();
880
+ return result;
881
+ } catch (error) {
882
+ try {
883
+ tx.rollback();
884
+ } catch {
885
+ // applyEngineUpgrade already restored the run; the original error is reported.
886
+ }
887
+ throw error;
888
+ }
889
+ }
890
+
891
+ function printEngineFixResult(result) {
892
+ for (const item of result.fixed) {
893
+ console.log(item.backup ? `fixed ${item.rel} (backup ${item.backup})` : `fixed ${item.rel}`);
894
+ }
895
+ for (const rel of result.keptModified) {
896
+ console.log(`kept modified ${rel}`);
897
+ }
898
+ for (const rel of result.unattributed) {
899
+ console.log(`unattributable ${rel} (no recorded base; delete it and re-run init)`);
900
+ }
901
+ for (const rel of result.skippedSymlinks) {
902
+ console.log(`skipped symlink ${rel} (never written through)`);
903
+ }
904
+ }
905
+
906
+ /** Preview the engine lines from the same plan `update --fix` writes with. */
907
+ function printEngineCheckResult(plan) {
908
+ for (const entry of plan.entries) {
909
+ if (!entry.checkOutcome || entry.checkOutcome === 'noop') continue;
910
+ console.log(`check ${entry.checkOutcome} ${entry.rel}`);
911
+ }
912
+ }
913
+
914
+ /**
915
+ * Host prerequisites the shipped surfaces rely on. `ok` here is advisory: the
916
+ * install-state `state.ok` stays about managed files and the engine set, so a
917
+ * clean install on a host without `perl` (or with an old Node) still exits 0.
918
+ */
919
+ const PREREQUISITE_PROBES = [
920
+ { name: 'git', args: ['--version'], next: 'install Git: https://git-scm.com/downloads' },
921
+ { name: 'bash', args: ['--version'], next: 'install bash (Git Bash on Windows; the chain hook needs it)' },
922
+ {
923
+ name: 'perl',
924
+ args: ['-e', 'exit 0'],
925
+ optional: true,
926
+ next: 'optional: the engine lock falls back to a directory lock without perl',
927
+ },
928
+ ];
929
+
930
+ function collectPrerequisiteState() {
931
+ const items = [];
932
+ const nodeMajor = Number.parseInt(process.versions.node.split('.')[0], 10);
933
+ items.push(
934
+ nodeMajor >= 20
935
+ ? { name: 'node', status: 'ok', detail: process.versions.node, next: null }
936
+ : {
937
+ name: 'node',
938
+ status: 'warn',
939
+ detail: `${process.versions.node} is below the supported floor (>=20)`,
940
+ next: 'install Node 20 LTS or newer',
941
+ },
942
+ );
943
+ for (const probe of PREREQUISITE_PROBES) {
944
+ const result = spawnSync(probe.name, probe.args, { stdio: 'ignore' });
945
+ if (!result.error && result.status === 0) {
946
+ items.push({ name: probe.name, status: 'ok', detail: 'found on PATH', next: null });
947
+ continue;
948
+ }
949
+ items.push({
950
+ name: probe.name,
951
+ status: 'warn',
952
+ detail: probe.optional ? 'not found on PATH (optional)' : 'not found on PATH',
953
+ next: probe.next,
954
+ });
955
+ }
956
+ return { ok: items.every((item) => item.status === 'ok'), items };
957
+ }
958
+
959
+ /**
960
+ * Install-state doctor.
961
+ *
962
+ * Per installed platform (`.ai-rules-install.json`): missing or modified managed
963
+ * files and a `packageVersion` mismatch. Once per project: the shared engine set
964
+ * (`.ai.local/scripts/`) classified by the same `planEngineUpgrade` predicate
965
+ * `update --fix` writes with, so `stale-engine` means safely upgradeable and a
966
+ * consumer edit is `modified`. Every finding carries `fixable`. The report alone
967
+ * is read-only; `doctor --fix` runs the writer, then re-runs this collector.
968
+ */
969
+ function collectDoctorState(cwd, packageRoot) {
970
+ const packageVersion = getPackageVersion(packageRoot);
971
+ const platforms = [];
972
+ for (const { tool, root } of UPDATE_TARGETS) {
973
+ const rel = `${root}/.ai-rules-install.json`;
974
+ const abs = resolveManagedPath(cwd, rel);
975
+ if (!abs || !fs.existsSync(abs)) continue;
976
+ const findings = [];
977
+ let manifest = null;
978
+ try {
979
+ const parsed = JSON.parse(fs.readFileSync(abs, 'utf8'));
980
+ manifest = isPlainObject(parsed) ? parsed : null;
981
+ } catch {
982
+ manifest = null;
983
+ }
984
+ if (!manifest) {
985
+ findings.push({ code: 'missing', path: rel, detail: 'install manifest is not readable JSON', fixable: false });
986
+ } else {
987
+ if (typeof manifest.packageVersion === 'string' && manifest.packageVersion !== packageVersion) {
988
+ findings.push({
989
+ code: 'version-mismatch',
990
+ path: rel,
991
+ detail: `manifest records ${manifest.packageVersion}, package is ${packageVersion}`,
992
+ fixable: false,
993
+ });
994
+ }
995
+ if (typeof manifest.schemaVersion === 'number' && manifest.schemaVersion < MANIFEST_SCHEMA_VERSION) {
996
+ findings.push({
997
+ code: 'legacy-manifest',
998
+ path: rel,
999
+ detail: 'schema v1 hashes consumer files too; re-run init to record a current manifest',
1000
+ fixable: false,
1001
+ });
1002
+ } else if (!isPlainObject(manifest.managedFiles) || Object.keys(manifest.managedFiles).length === 0) {
1003
+ findings.push({
1004
+ code: 'missing',
1005
+ path: rel,
1006
+ detail: 'schema v2 manifest has no managedFiles map; re-run init for this platform',
1007
+ fixable: false,
1008
+ });
1009
+ } else {
1010
+ for (const [managedRel, expectedHash] of Object.entries(manifest.managedFiles)) {
1011
+ const managedAbs = resolveManagedPath(cwd, managedRel);
1012
+ if (!managedAbs || !fs.existsSync(managedAbs) || !fs.lstatSync(managedAbs).isFile()) {
1013
+ findings.push({ code: 'missing', path: managedRel, detail: 'managed file is absent', fixable: false });
1014
+ continue;
1015
+ }
1016
+ if (typeof expectedHash === 'string' && sha256File(managedAbs) !== expectedHash) {
1017
+ findings.push({ code: 'modified', path: managedRel, detail: 'bytes differ from the install manifest', fixable: false });
1018
+ }
1019
+ }
1020
+ }
1021
+ }
1022
+ platforms.push({
1023
+ platform: tool,
1024
+ root,
1025
+ preset: manifest && typeof manifest.preset === 'string' ? manifest.preset : null,
1026
+ packageVersion: manifest && typeof manifest.packageVersion === 'string' ? manifest.packageVersion : null,
1027
+ ok: findings.length === 0,
1028
+ findings,
1029
+ });
1030
+ }
1031
+
1032
+ const engineFindings = [];
1033
+ const engineRel = '.ai.local/scripts';
1034
+ const engineDir = resolveManagedPath(cwd, engineRel);
1035
+ const engineInstalled = Boolean(engineDir && fs.existsSync(engineDir) && fs.statSync(engineDir).isDirectory());
1036
+ if (platforms.length === 0 && !engineInstalled) {
1037
+ // Nothing is installed; a missing engine is not a finding for a bare tree.
1038
+ } else if (!engineInstalled) {
1039
+ engineFindings.push({ code: 'missing-engine', path: engineRel, detail: 'engine directory is absent', fixable: false });
1040
+ } else {
1041
+ // Eligibility comes from the same classifier `update --fix` writes with: a
1042
+ // consumer edit is `modified`, never a `stale-engine` that a fix could overwrite.
1043
+ const enginePlan = planEngineUpgrade({ cwd, packageRoot });
1044
+ for (const entry of enginePlan.entries) {
1045
+ if (entry.state === 'current') {
1046
+ continue;
1047
+ }
1048
+ if (entry.state === 'missing') {
1049
+ engineFindings.push({
1050
+ code: 'missing-engine',
1051
+ path: entry.rel,
1052
+ detail: entry.detail,
1053
+ fixable: false,
1054
+ });
1055
+ continue;
1056
+ }
1057
+ engineFindings.push({
1058
+ code: entry.state === 'stale' ? 'stale-engine' : 'modified',
1059
+ path: entry.rel,
1060
+ detail: entry.detail,
1061
+ fixable: entry.state === 'stale',
1062
+ });
1063
+ }
1064
+ }
1065
+
1066
+ const engine = { root: engineRel, ok: engineFindings.length === 0, findings: engineFindings };
1067
+ return {
1068
+ schemaVersion: 1,
1069
+ packageVersion,
1070
+ ok: platforms.every((platform) => platform.ok) && engine.ok,
1071
+ platforms,
1072
+ engine,
1073
+ prerequisites: collectPrerequisiteState(),
1074
+ };
1075
+ }
1076
+
1077
+ function printDoctorReport(state, opts = {}) {
1078
+ console.log(`@bonesofspring/ai-rules doctor${opts.fix ? ' --fix (post-state)' : ' (read-only)'}`);
1079
+ console.log(`package: ${state.packageVersion}`);
1080
+ if (state.platforms.length === 0) {
1081
+ console.log('installed platforms: none (.ai-rules-install.json not found)');
1082
+ } else {
1083
+ console.log(`installed platforms: ${state.platforms.map((platform) => `${platform.platform} (${platform.preset ?? 'unknown'})`).join(', ')}`);
1084
+ }
1085
+ for (const platform of state.platforms) {
1086
+ console.log(`${platform.platform}: ${platform.ok ? 'OK' : `${platform.findings.length} finding(s)`}`);
1087
+ for (const finding of platform.findings) {
1088
+ console.log(` ${finding.code} ${finding.path} — ${finding.detail}`);
1089
+ }
1090
+ }
1091
+ console.log(`engine: ${state.engine.ok ? 'OK' : `${state.engine.findings.length} finding(s)`}`);
1092
+ for (const finding of state.engine.findings) {
1093
+ console.log(` ${finding.code} ${finding.path} — ${finding.detail}`);
1094
+ }
1095
+ const prerequisites = state.prerequisites ?? { ok: true, items: [] };
1096
+ const warnings = prerequisites.items.filter((item) => item.status !== 'ok').length;
1097
+ console.log(`prerequisites: ${prerequisites.ok ? 'OK' : `${warnings} warning(s)`}`);
1098
+ for (const item of prerequisites.items) {
1099
+ const suffix = item.status === 'ok' || !item.next ? '' : ` — ${item.next}`;
1100
+ console.log(` ${item.name}: ${item.detail}${suffix}`);
1101
+ }
1102
+ const total = state.platforms.reduce((sum, platform) => sum + platform.findings.length, 0)
1103
+ + state.engine.findings.length;
1104
+ console.log(`result: ${state.ok ? 'OK' : `FINDINGS (${total})`}`);
1105
+ }
1106
+
1107
+ function cmdDoctor(cwdOption, opts) {
1108
+ const cwd = resolveTargetCwd(cwdOption, 2);
1109
+ const packageRoot = getPackageRoot();
1110
+ let fix = null;
1111
+ let fixResult = null;
1112
+ if (opts && opts.fix) {
1113
+ const plan = planEngineUpgrade({ cwd, packageRoot });
1114
+ try {
1115
+ fixResult = runEngineFix({ cwd, packageRoot, plan, backup: true });
1116
+ } catch (error) {
1117
+ console.error(`doctor --fix: ${error instanceof Error ? error.message : String(error)}`);
1118
+ process.exit(1);
1119
+ }
1120
+ fix = {
1121
+ backup: fixResult.backup,
1122
+ fixed: fixResult.fixed.map((item) => item.rel),
1123
+ keptModified: fixResult.keptModified,
1124
+ unattributed: fixResult.unattributed,
1125
+ skippedSymlinks: fixResult.skippedSymlinks,
1126
+ current: fixResult.current,
1127
+ };
1128
+ }
1129
+ const state = collectDoctorState(cwd, packageRoot);
1130
+ if (opts && opts.json) {
1131
+ if (fix) {
1132
+ state.fix = fix;
1133
+ }
1134
+ console.log(JSON.stringify(state, null, 2));
1135
+ } else {
1136
+ if (fixResult) {
1137
+ printEngineFixResult(fixResult);
1138
+ }
1139
+ printDoctorReport(state, { fix: Boolean(fix) });
1140
+ }
1141
+ process.exit(state.ok ? 0 : 1);
1142
+ }
1143
+
788
1144
  function cmdInit(tool, preset, cwdOption, opts) {
789
1145
  const mergeAiLocal = Boolean(opts && opts.mergeAiLocal);
790
1146
  const checkAiLocal = Boolean(opts && opts.checkAiLocal);
@@ -1133,12 +1489,12 @@ function printMcpHelp() {
1133
1489
  console.log(`ai-rules mcp
1134
1490
 
1135
1491
  Usage:
1136
- ai-rules mcp setup <gitlab|yandex|all> [--tools <list>] [--yes] [--replace] [--url <url>] [--org-id <id>] [--json] [--cwd <dir>]
1137
- ai-rules mcp add <gitlab|yandex|all> [--tools <list>] [--replace] [--json] [--cwd <dir>]
1138
- ai-rules mcp remove <gitlab|yandex|all> [--tools <list>] [--purge] [--json] [--cwd <dir>]
1139
- ai-rules mcp doctor [gitlab|yandex|all] [--json] [--cwd <dir>]
1492
+ ai-rules mcp setup <gitlab|github|yandex|defectdojo|all> [--tools <list>] [--yes] [--replace] [--url <url>] [--org-id <id>] [--json] [--cwd <dir>]
1493
+ ai-rules mcp add <gitlab|github|yandex|defectdojo|all> [--tools <list>] [--replace] [--json] [--cwd <dir>]
1494
+ ai-rules mcp remove <gitlab|github|yandex|defectdojo|all> [--tools <list>] [--purge] [--json] [--cwd <dir>]
1495
+ ai-rules mcp doctor [gitlab|github|yandex|defectdojo|all] [--json] [--cwd <dir>]
1140
1496
  ai-rules mcp refresh yandex [--print] [--json] [--yc-bin <path>] [--cwd <dir>]
1141
- ai-rules mcp run <gitlab|yandex-tracker|yandex-wiki> [--print-env]
1497
+ ai-rules mcp run <gitlab|github|yandex-tracker|yandex-wiki|defectdojo> [--print-env]
1142
1498
 
1143
1499
  Options:
1144
1500
  --tools <list> Comma-separated clients (cursor, claude, mavis, opencode); default: detected
@@ -1151,7 +1507,7 @@ Options:
1151
1507
  --print refresh: print the fresh IAM token to stdout (opt-in)
1152
1508
  --json One JSON document on stdout; human text moves to stderr
1153
1509
  --cwd <dir> Target project directory (default: current working directory)
1154
- --print-env run (gitlab): print the masked child env mapping and exit
1510
+ --print-env run (gitlab, github): print the masked child env mapping and exit
1155
1511
 
1156
1512
  Commands:
1157
1513
  setup Credentials + registration + doctor for one provider (the normal entry point)
@@ -1162,9 +1518,244 @@ Commands:
1162
1518
  run Internal — the client config starts it; speaks MCP over stdio
1163
1519
 
1164
1520
  Node 20+ is required for every mcp command. Nothing here writes a token into a client config.
1521
+ The GitHub token is read from the shell or from .env.github in the project root; the pack never writes it.
1522
+ Third-party servers without credentials are installed with ai-rules init mcp <name...|--all>.
1523
+ `);
1524
+ }
1525
+
1526
+ function printInitMcpHelp() {
1527
+ const width = Math.max(...CATALOG.map((server) => server.slug.length));
1528
+ const lines = CATALOG.map((server) => {
1529
+ const notes = [];
1530
+ if (server.ids && server.ids.claude) {
1531
+ notes.push(`Claude id: ${server.ids.claude}`);
1532
+ }
1533
+ if (server.aliases && server.aliases.length > 0) {
1534
+ notes.push(`alias: ${server.aliases.join(', ')}`);
1535
+ }
1536
+ if (server.runtime === 'defectdojo') {
1537
+ notes.push(`setup: ${credentials.DEFECTDOJO_CREDENTIALS_REL}`);
1538
+ } else if (server.runtime === 'gitlab' || server.runtime === 'github') {
1539
+ notes.push(`setup: ai-rules mcp setup ${server.runtime}`);
1540
+ } else if (server.runtime && server.runtime.startsWith('yandex')) {
1541
+ notes.push('setup: ai-rules mcp setup yandex');
1542
+ }
1543
+ if (server.slug === 'next-devtools') {
1544
+ notes.push('needs: next dev, Next.js 16+');
1545
+ }
1546
+ if (server.slug === 'semgrep') {
1547
+ notes.push('needs: semgrep CLI');
1548
+ }
1549
+ if (server.slug === 'sentry') {
1550
+ notes.push('auth: OAuth');
1551
+ }
1552
+ const suffix = notes.length > 0 ? ` (${notes.join('; ')})` : '';
1553
+ return ` ${server.slug.padEnd(width)} ${server.title}${suffix}`;
1554
+ });
1555
+ console.log(`ai-rules init mcp
1556
+
1557
+ Usage:
1558
+ ai-rules init mcp <name...> [--tools <list>] [--cwd <dir>]
1559
+ ai-rules init mcp --all [--tools <list>] [--cwd <dir>]
1560
+
1561
+ Servers:
1562
+ ${lines.join('\n')}
1563
+
1564
+ Options:
1565
+ --all Every server above
1566
+ --tools <list> Comma-separated clients (cursor, claude, mavis, opencode, zcode); default: detected
1567
+ --cwd <dir> Target project directory (default: current working directory)
1568
+ -h, --help Print this help
1569
+
1570
+ Each client gets its native shape; entries merge like init, so other servers and consumer
1571
+ env/headers stay. Runtime entries (GitLab, GitHub, Yandex, DefectDojo) are registered without
1572
+ credentials: run the printed setup command once per provider before first use. Next.js DevTools
1573
+ needs a running next dev server on Next.js 16+; Semgrep needs the semgrep CLI; Sentry uses OAuth.
1165
1574
  `);
1166
1575
  }
1167
1576
 
1577
+ const INIT_MCP_VALUE_OPTIONS = new Set(['--tools', '--cwd']);
1578
+
1579
+ function parseInitMcpArgs(argv) {
1580
+ const options = { _: [] };
1581
+ for (let i = 0; i < argv.length; i++) {
1582
+ const token = argv[i];
1583
+ if (token === '--') {
1584
+ options._.push(...argv.slice(i + 1));
1585
+ break;
1586
+ }
1587
+ if (token === '--all') {
1588
+ options.all = true;
1589
+ continue;
1590
+ }
1591
+ if (token === '-h' || token === '--help') {
1592
+ options.help = true;
1593
+ continue;
1594
+ }
1595
+ if (INIT_MCP_VALUE_OPTIONS.has(token)) {
1596
+ const value = argv[i + 1];
1597
+ if (value === undefined || value === '' || value.startsWith('-')) {
1598
+ throw new Error(`Missing value for ${token}`);
1599
+ }
1600
+ options[camelOption(token)] = value;
1601
+ i++;
1602
+ continue;
1603
+ }
1604
+ const equals = token.indexOf('=');
1605
+ if (token.startsWith('--') && equals > 0) {
1606
+ const name = token.slice(0, equals);
1607
+ if (INIT_MCP_VALUE_OPTIONS.has(name)) {
1608
+ const value = token.slice(equals + 1);
1609
+ if (value === '') {
1610
+ throw new Error(`Missing value after ${name}=`);
1611
+ }
1612
+ options[camelOption(name)] = value;
1613
+ continue;
1614
+ }
1615
+ throw new Error(`Unknown option: ${name}`);
1616
+ }
1617
+ if (token.startsWith('-') && token !== '-') {
1618
+ throw new Error(`Unknown option: ${token}`);
1619
+ }
1620
+ options._.push(token);
1621
+ }
1622
+ return options;
1623
+ }
1624
+
1625
+ function cmdInitMcp(argv) {
1626
+ let options;
1627
+ try {
1628
+ options = parseInitMcpArgs(argv);
1629
+ } catch (error) {
1630
+ console.error(error instanceof Error ? error.message : String(error));
1631
+ process.exit(1);
1632
+ }
1633
+ if (options.help) {
1634
+ printInitMcpHelp();
1635
+ process.exit(0);
1636
+ }
1637
+
1638
+ const names = options._;
1639
+ if (options.all && names.length > 0) {
1640
+ console.error('init mcp: --all takes no server names.');
1641
+ process.exit(1);
1642
+ }
1643
+ if (!options.all && names.length === 0) {
1644
+ console.error('init mcp: name at least one server or pass --all.');
1645
+ printInitMcpHelp();
1646
+ process.exit(1);
1647
+ }
1648
+
1649
+ let servers;
1650
+ if (options.all) {
1651
+ servers = CATALOG.slice();
1652
+ } else {
1653
+ servers = [];
1654
+ for (const name of names) {
1655
+ const server = resolveCatalogName(name);
1656
+ if (!server) {
1657
+ console.error(`Unknown server: ${name}. Use ${catalogNames().join(', ')}, or --all.`);
1658
+ process.exit(1);
1659
+ }
1660
+ if (!servers.some((item) => item.slug === server.slug)) {
1661
+ servers.push(server);
1662
+ }
1663
+ }
1664
+ }
1665
+
1666
+ let tools;
1667
+ if (options.tools !== undefined) {
1668
+ try {
1669
+ tools = parseMcpTools(options.tools);
1670
+ } catch (error) {
1671
+ console.error(error instanceof Error ? error.message : String(error));
1672
+ process.exit(1);
1673
+ }
1674
+ }
1675
+
1676
+ const cwd = resolveTargetCwd(options.cwd);
1677
+ const selection = selectClients({ cwd, tools, markers: TOOL_INSTALL_MARKERS });
1678
+ const printer = createMcpPrinter(false);
1679
+ for (const warning of selection.warnings) {
1680
+ printer.warn('clients', warning);
1681
+ }
1682
+ if (selection.clients.length === 0) {
1683
+ printer.fail('clients', 'no MCP client detected');
1684
+ printer.next('ai-rules init <cursor|claude|mavis|opencode|zcode> --preset <stack>');
1685
+ process.exit(1);
1686
+ }
1687
+
1688
+ let registration;
1689
+ try {
1690
+ registration = registerCatalogServers({
1691
+ cwd,
1692
+ clients: selection.clients,
1693
+ servers,
1694
+ version: packageVersion(getPackageRoot()),
1695
+ });
1696
+ } catch (error) {
1697
+ console.error(`init mcp failed: ${error instanceof Error ? error.message : String(error)}`);
1698
+ process.exit(1);
1699
+ }
1700
+
1701
+ const clientIds = selection.clients.map((client) => client.id).join(', ');
1702
+ printer.ok('servers', servers.map((server) => server.slug).join(', '));
1703
+ printer.ok('clients', clientIds);
1704
+ if (registration.changed.length === 0) {
1705
+ printer.ok('registration', `${clientIds} already up to date`);
1706
+ } else {
1707
+ for (const rel of registration.changed) {
1708
+ printer.ok('registration', `wrote ${rel}`);
1709
+ }
1710
+ }
1711
+ reportCatalogCredentials(cwd, servers, printer);
1712
+ printer.next('restart the MCP server in your client');
1713
+ }
1714
+
1715
+ /**
1716
+ * Runtime entries (GitLab, Yandex, DefectDojo) are registered without
1717
+ * credentials so one `init mcp --all` is enough to wire every client. Name the
1718
+ * setup command for each provider that has no local configuration yet.
1719
+ */
1720
+ function reportCatalogCredentials(cwd, servers, printer) {
1721
+ const cached = (rel) => fs.existsSync(path.join(cwd, rel));
1722
+ const fromEnv = (key) => typeof process.env[key] === 'string' && process.env[key] !== '';
1723
+ const missing = [];
1724
+ if (
1725
+ servers.some((server) => server.runtime === 'gitlab')
1726
+ && !cached('.ai-rules/mcp/credentials.env')
1727
+ && !fromEnv('GITLAB_TOKEN')
1728
+ ) {
1729
+ missing.push('gitlab');
1730
+ }
1731
+ if (
1732
+ servers.some((server) => server.runtime === 'github')
1733
+ && !cached('.env.github')
1734
+ && !fromEnv('GITHUB_TOKEN')
1735
+ && !fromEnv('GITHUB_PERSONAL_ACCESS_TOKEN')
1736
+ ) {
1737
+ missing.push('github');
1738
+ }
1739
+ if (
1740
+ servers.some((server) => server.runtime === 'yandex-tracker' || server.runtime === 'yandex-wiki')
1741
+ && !cached('.ai-rules/mcp/config.env')
1742
+ && !fromEnv('YANDEX_ORG_ID')
1743
+ ) {
1744
+ missing.push('yandex');
1745
+ }
1746
+ if (
1747
+ servers.some((server) => server.runtime === 'defectdojo')
1748
+ && !cached('.env.defectdojo')
1749
+ && !fromEnv('DEFECTDOJO_TOKEN')
1750
+ ) {
1751
+ missing.push('defectdojo');
1752
+ }
1753
+ for (const provider of missing) {
1754
+ printer.warn('credentials', `${provider} is registered but not configured`);
1755
+ printer.next(`ai-rules mcp setup ${provider}`);
1756
+ }
1757
+ }
1758
+
1168
1759
  const MCP_COMMANDS = new Set(['setup', 'add', 'remove', 'doctor', 'refresh', 'run']);
1169
1760
  const MCP_VALUE_OPTIONS = new Set(['--tools', '--url', '--org-id', '--yc-bin', '--cwd']);
1170
1761
  const MCP_BOOL_OPTIONS = new Set(['--yes', '--json', '--replace', '--purge', '--print', '--print-env', '--help', '-h']);
@@ -1271,7 +1862,9 @@ function publicServers(servers) {
1271
1862
  async function loadPackModules(packageRoot) {
1272
1863
  const envfile = await import(pathToFileURL(path.join(packageRoot, 'mcp', 'lib', 'envfile.mjs')).href);
1273
1864
  const yandex = await import(pathToFileURL(path.join(packageRoot, 'mcp', 'lib', 'yandex.mjs')).href);
1274
- return { envfile, yandex };
1865
+ const github = await import(pathToFileURL(path.join(packageRoot, 'mcp', 'lib', 'github.mjs')).href);
1866
+ const defectdojo = await import(pathToFileURL(path.join(packageRoot, 'mcp', 'lib', 'defectdojo.mjs')).href);
1867
+ return { envfile, yandex, github, defectdojo };
1275
1868
  }
1276
1869
 
1277
1870
  function parseMcpTools(value) {
@@ -1319,7 +1912,9 @@ function registerProvider({ cwd, provider, options, version, printer, selection:
1319
1912
  }
1320
1913
 
1321
1914
  async function cmdMcpSetup({ cwd, provider, options, printer, packageRoot, modules, version }) {
1322
- const providers = provider === 'all' ? ['gitlab', 'yandex'] : [provider];
1915
+ const providers = provider === 'all'
1916
+ ? ['gitlab', 'yandex', 'github', 'defectdojo']
1917
+ : [provider];
1323
1918
  const results = [];
1324
1919
 
1325
1920
  for (const current of providers) {
@@ -1331,9 +1926,22 @@ async function cmdMcpSetup({ cwd, provider, options, printer, packageRoot, modul
1331
1926
  process.exit(1);
1332
1927
  }
1333
1928
 
1334
- const credentialResult = current === 'gitlab'
1335
- ? await credentials.setupGitlab({ cwd, options, envfile: modules.envfile })
1336
- : await credentials.setupYandex({ cwd, options, io: {}, yandex: modules.yandex, envfile: modules.envfile });
1929
+ let credentialResult;
1930
+ if (current === 'gitlab') {
1931
+ credentialResult = await credentials.setupGitlab({ cwd, options, envfile: modules.envfile });
1932
+ } else if (current === 'github') {
1933
+ credentialResult = await credentials.setupGithub({ cwd, options, github: modules.github });
1934
+ } else if (current === 'defectdojo') {
1935
+ credentialResult = await credentials.setupDefectdojo({ cwd, defectdojo: modules.defectdojo });
1936
+ } else {
1937
+ credentialResult = await credentials.setupYandex({
1938
+ cwd,
1939
+ options,
1940
+ io: {},
1941
+ yandex: modules.yandex,
1942
+ envfile: modules.envfile,
1943
+ });
1944
+ }
1337
1945
 
1338
1946
  for (const warning of credentialResult.warnings || []) {
1339
1947
  printer.warn('credentials', warning);
@@ -1361,6 +1969,8 @@ async function cmdMcpSetup({ cwd, provider, options, printer, packageRoot, modul
1361
1969
  version,
1362
1970
  envfile: modules.envfile,
1363
1971
  yandex: modules.yandex,
1972
+ github: modules.github,
1973
+ defectdojo: modules.defectdojo,
1364
1974
  options,
1365
1975
  });
1366
1976
  renderDoctor(doctor, printer);
@@ -1377,7 +1987,7 @@ async function cmdMcpSetup({ cwd, provider, options, printer, packageRoot, modul
1377
1987
  (server) => ['runtime', 'registration', 'credentials'].some((area) => server.checks[area].status === 'fail'),
1378
1988
  );
1379
1989
  const upstreamCredentialClass = doctor.servers.some(
1380
- (server) => server.checks.upstream.status === 'fail' && /401|organization/i.test(server.checks.upstream.detail),
1990
+ (server) => server.checks.upstream.status === 'fail' && /401|403|organization/i.test(server.checks.upstream.detail),
1381
1991
  );
1382
1992
  if (credentialClass || upstreamCredentialClass) {
1383
1993
  printer.result({ command: 'setup', ok: false, providers: results });
@@ -1441,6 +2051,8 @@ async function cmdMcpDoctor({ cwd, provider, options, printer, packageRoot, modu
1441
2051
  version,
1442
2052
  envfile: modules.envfile,
1443
2053
  yandex: modules.yandex,
2054
+ github: modules.github,
2055
+ defectdojo: modules.defectdojo,
1444
2056
  options,
1445
2057
  });
1446
2058
  renderDoctor(doctor, printer);
@@ -1489,7 +2101,7 @@ function cmdMcpRefresh({ cwd, options, packageRoot }) {
1489
2101
  async function cmdMcpRun({ slug, options, packageRoot }) {
1490
2102
  const server = serverBySlug(slug);
1491
2103
  if (!server) {
1492
- console.error(`Unknown server: ${slug ?? '(none)'}. Use gitlab, yandex-tracker, or yandex-wiki.`);
2104
+ console.error(`Unknown server: ${slug ?? '(none)'}. Use gitlab, github, yandex-tracker, yandex-wiki, or defectdojo.`);
1493
2105
  process.exit(1);
1494
2106
  }
1495
2107
  if (!options.printEnv && (process.stdin.isTTY || process.stdout.isTTY)) {
@@ -1497,8 +2109,8 @@ async function cmdMcpRun({ slug, options, packageRoot }) {
1497
2109
  console.error('next: ai-rules mcp doctor');
1498
2110
  process.exit(1);
1499
2111
  }
1500
- if (options.printEnv && server.provider !== 'gitlab') {
1501
- console.error('--print-env is supported for gitlab only.');
2112
+ if (options.printEnv && !['gitlab', 'github', 'defectdojo'].includes(server.provider)) {
2113
+ console.error('--print-env is supported for gitlab, github, and defectdojo only.');
1502
2114
  process.exit(1);
1503
2115
  }
1504
2116
  const entry = runtimeEntryPath(packageRoot, server.entry);
@@ -1528,6 +2140,30 @@ async function cmdMcpRun({ slug, options, packageRoot }) {
1528
2140
  }
1529
2141
  }
1530
2142
 
2143
+ if (server.provider === 'github') {
2144
+ const modules = await loadPackModules(packageRoot);
2145
+ try {
2146
+ modules.github.loadGitHubConfig({ root: resolveProjectRoot() });
2147
+ } catch (error) {
2148
+ const detail = error instanceof Error ? error.message : String(error);
2149
+ console.error(`fail runtime ${detail}`);
2150
+ console.error('next: add GITHUB_TOKEN to .env.github in the project root, then rerun ai-rules mcp setup github');
2151
+ process.exit(1);
2152
+ }
2153
+ }
2154
+
2155
+ if (server.provider === 'defectdojo') {
2156
+ const modules = await loadPackModules(packageRoot);
2157
+ try {
2158
+ modules.defectdojo.loadDefectDojoConfig({ root: resolveProjectRoot() });
2159
+ } catch (error) {
2160
+ const detail = error instanceof Error ? error.message : String(error);
2161
+ console.error(`fail runtime ${detail}`);
2162
+ console.error('next: add DEFECTDOJO_URL and DEFECTDOJO_TOKEN to .env.defectdojo in the project root, then rerun ai-rules mcp setup defectdojo');
2163
+ process.exit(1);
2164
+ }
2165
+ }
2166
+
1531
2167
  const args = [entry, ...server.argv];
1532
2168
  if (options.printEnv) {
1533
2169
  args.push('--print-env');
@@ -1624,13 +2260,13 @@ async function cmdMcp(argv) {
1624
2260
  provider = providerArg ?? 'all';
1625
2261
  } else {
1626
2262
  if (providerArg === undefined) {
1627
- console.error(`Missing provider. Use: mcp ${command} <gitlab|yandex|all>`);
2263
+ console.error(`Missing provider. Use: mcp ${command} <gitlab|github|yandex|defectdojo|all>`);
1628
2264
  process.exit(1);
1629
2265
  }
1630
2266
  provider = providerArg;
1631
2267
  }
1632
- if (!['gitlab', 'yandex', 'all'].includes(provider)) {
1633
- console.error(`Unknown provider: ${provider}. Use gitlab, yandex, or all.`);
2268
+ if (!['gitlab', 'github', 'yandex', 'defectdojo', 'all'].includes(provider)) {
2269
+ console.error(`Unknown provider: ${provider}. Use gitlab, github, yandex, defectdojo, or all.`);
1634
2270
  process.exit(1);
1635
2271
  }
1636
2272
 
@@ -1659,6 +2295,11 @@ function main() {
1659
2295
  process.exit(0);
1660
2296
  }
1661
2297
 
2298
+ if (argv[0] === 'init' && argv[1] === 'mcp') {
2299
+ cmdInitMcp(argv.slice(2));
2300
+ return;
2301
+ }
2302
+
1662
2303
  if (argv[0] === 'mcp') {
1663
2304
  cmdMcp(argv.slice(1)).catch((error) => {
1664
2305
  console.error(error instanceof Error ? error.message : String(error));
@@ -1667,6 +2308,32 @@ function main() {
1667
2308
  return;
1668
2309
  }
1669
2310
 
2311
+ if (argv[0] === 'doctor') {
2312
+ const parsed = parseArgs(argv.slice(1), { json: true });
2313
+ if (parsed.help) {
2314
+ printHelp();
2315
+ process.exit(0);
2316
+ }
2317
+ if (parsed.unknownOption) {
2318
+ console.error(`Unknown option: ${parsed.unknownOption}`);
2319
+ process.exit(2);
2320
+ }
2321
+ if (parsed.mergeAiLocal || parsed.checkAiLocal || parsed.noBackup) {
2322
+ console.error('doctor takes --json, --fix, and --cwd only.');
2323
+ process.exit(2);
2324
+ }
2325
+ if (parsed.preset || parsed.presetError || parsed.cwdError) {
2326
+ console.error('doctor takes --json, --fix, and --cwd only.');
2327
+ process.exit(2);
2328
+ }
2329
+ if (parsed._.length > 0) {
2330
+ console.error('doctor takes no positional argument.');
2331
+ process.exit(2);
2332
+ }
2333
+ cmdDoctor(parsed.cwd, parsed);
2334
+ return;
2335
+ }
2336
+
1670
2337
  const parsed = parseArgs(argv);
1671
2338
  if (parsed.help) {
1672
2339
  printHelp();
@@ -1689,6 +2356,16 @@ function main() {
1689
2356
  const { command, tool, preset } = normalizeInitClean(parsed);
1690
2357
 
1691
2358
  if (command === 'init') {
2359
+ if (parsed.fix) {
2360
+ console.error(
2361
+ 'init does not take --fix; run update --fix to upgrade a seeded .ai.local/scripts/ module.',
2362
+ );
2363
+ process.exit(1);
2364
+ }
2365
+ if (parsed.noBackup) {
2366
+ console.error('init does not take --no-backup; --no-backup applies to update --fix.');
2367
+ process.exit(1);
2368
+ }
1692
2369
  if (!tool || !INIT_TARGETS.has(tool)) {
1693
2370
  console.error(
1694
2371
  'Missing or invalid tool. Use: init cursor|claude|mavis|opencode|zcode|multi [--preset next]',
@@ -1721,6 +2398,10 @@ function main() {
1721
2398
  console.error('--merge-ai-local and --check apply to init and update.');
1722
2399
  process.exit(1);
1723
2400
  }
2401
+ if (parsed.fix || parsed.noBackup) {
2402
+ console.error('--fix and --no-backup apply to update and doctor.');
2403
+ process.exit(1);
2404
+ }
1724
2405
  if (tool === 'multi') {
1725
2406
  console.error('clean multi is not supported. Clean each tool: cursor, claude, mavis, opencode.');
1726
2407
  process.exit(1);