@bonesofspring/ai-rules 0.2.60 → 0.2.63

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 (718) hide show
  1. package/CHANGELOG.md +102 -0
  2. package/README.md +62 -29
  3. package/bin/cli.js +368 -59
  4. package/bin/lib/ai-local-drift.js +18 -0
  5. package/bin/lib/engine-scripts.js +22 -5
  6. package/bin/lib/engine-upgrade.js +279 -0
  7. package/bin/lib/mcp/catalog.js +66 -5
  8. package/bin/lib/mcp/clients.js +4 -4
  9. package/bin/lib/mcp/credentials.js +88 -0
  10. package/bin/lib/mcp/doctor.js +100 -8
  11. package/bin/lib/mcp/npx.js +17 -0
  12. package/bin/lib/mcp/registry.js +2 -0
  13. package/bin/lib/merged-config.js +38 -0
  14. package/bin/lib/seed-ai-local-team.js +32 -14
  15. package/bin/mavis-install.js +3 -1
  16. package/bin/opencode-install.js +3 -1
  17. package/bin/zcode-install.js +3 -1
  18. package/docs/MAVIS.md +5 -2
  19. package/docs/MCP-CATALOG.md +30 -2
  20. package/docs/MCP-SETUP.md +30 -6
  21. package/docs/OPENCODE.md +27 -4
  22. package/docs/PLATFORMS.md +38 -0
  23. package/docs/PRESET-CONTRIBUTION.md +27 -14
  24. package/docs/TEAM-DB.md +194 -21
  25. package/docs/openapi/team-db.v1.json +4443 -2083
  26. package/mcp/defectdojo-mcp.mjs +353 -0
  27. package/mcp/gitlab.mjs +5 -1
  28. package/mcp/lib/defectdojo.mjs +249 -0
  29. package/mcp/lib/yandex.mjs +39 -15
  30. package/package.json +11 -5
  31. package/presets/_shared/ai-local/scripts/check-write-scope.mjs +176 -28
  32. package/presets/_shared/ai-local/scripts/lock.mjs +128 -69
  33. package/presets/_shared/ai-local/scripts/signals.mjs +17 -1
  34. package/presets/_shared/ai-local/scripts/team-db-api.mjs +496 -67
  35. package/presets/_shared/ai-local/scripts/team-db-dashboard.mjs +816 -5
  36. package/presets/_shared/ai-local/scripts/team-db-openapi.mjs +761 -6
  37. package/presets/_shared/ai-local/scripts/team-db-project.mjs +10 -0
  38. package/presets/_shared/ai-local/scripts/team-db-scheduler.mjs +2360 -0
  39. package/presets/_shared/ai-local/scripts/team-db-schema.mjs +87 -0
  40. package/presets/_shared/ai-local/scripts/team-db.mjs +151 -9
  41. package/presets/_shared/ai-local/scripts/upstream-research.mjs +2961 -0
  42. package/presets/_shared/core/agent-team/agent-artifact-contracts.md +17 -0
  43. package/presets/_shared/core/agent-team/agent-team-intake.md +1 -0
  44. package/presets/_shared/core/agent-team/agent-team-orchestrator.md +5 -2
  45. package/presets/_shared/core/meta/preset-pr-checklist.md +4 -4
  46. package/presets/_shared/core/meta/preset-twin-sync.md +1 -1
  47. package/presets/_shared/hooks/README.md +23 -3
  48. package/presets/_shared/hooks/chain-team-phases.sh.tmpl +57 -3
  49. package/presets/_shared/hooks/check-preset-update.mjs +4 -3
  50. package/presets/{claude/nuxt/hooks/guard-shell-command.sh → _shared/hooks/guard-shell-command.mjs.tmpl} +29 -35
  51. package/presets/_shared/hooks/run-hook.mjs +102 -0
  52. package/presets/claude/android-kotlin/hooks/README.md +4 -3
  53. package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +57 -3
  54. package/presets/claude/android-kotlin/hooks/check-preset-update.mjs +4 -3
  55. package/presets/claude/android-kotlin/hooks/examples/README.md +2 -2
  56. package/presets/claude/android-kotlin/hooks/guard-shell-command.mjs +96 -0
  57. package/presets/claude/android-kotlin/hooks/run-hook.mjs +102 -0
  58. package/presets/claude/android-kotlin/rules/tooling-and-review/agent-team-intake.md +1 -0
  59. package/presets/claude/android-kotlin/rules/tooling-and-review/agent-team-orchestrator.md +5 -2
  60. package/presets/claude/android-kotlin/rules/tooling-and-review/preset-pr-checklist.md +4 -4
  61. package/presets/claude/android-kotlin/rules/tooling-and-review/preset-twin-sync.md +1 -1
  62. package/presets/claude/android-kotlin/settings.json +2 -2
  63. package/presets/claude/android-kotlin/team/README.md +5 -0
  64. package/presets/claude/go/hooks/README.md +4 -3
  65. package/presets/claude/go/hooks/chain-team-phases.sh +57 -3
  66. package/presets/claude/go/hooks/check-preset-update.mjs +4 -3
  67. package/presets/claude/go/hooks/examples/README.md +2 -2
  68. package/presets/claude/go/hooks/guard-shell-command.mjs +95 -0
  69. package/presets/claude/go/hooks/run-hook.mjs +102 -0
  70. package/presets/claude/go/rules/tooling-and-review/agent-team-intake.md +1 -0
  71. package/presets/claude/go/rules/tooling-and-review/agent-team-orchestrator.md +5 -2
  72. package/presets/claude/go/rules/tooling-and-review/preset-pr-checklist.md +4 -4
  73. package/presets/claude/go/rules/tooling-and-review/preset-twin-sync.md +1 -1
  74. package/presets/claude/go/settings.json +2 -2
  75. package/presets/claude/go/team/README.md +5 -0
  76. package/presets/claude/ios-swift/hooks/README.md +4 -3
  77. package/presets/claude/ios-swift/hooks/chain-team-phases.sh +57 -3
  78. package/presets/claude/ios-swift/hooks/check-preset-update.mjs +4 -3
  79. package/presets/claude/ios-swift/hooks/examples/README.md +2 -2
  80. package/presets/claude/ios-swift/hooks/guard-shell-command.mjs +95 -0
  81. package/presets/claude/ios-swift/hooks/run-hook.mjs +102 -0
  82. package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-intake.md +1 -0
  83. package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-orchestrator.md +5 -2
  84. package/presets/claude/ios-swift/rules/tooling-and-review/preset-pr-checklist.md +4 -4
  85. package/presets/claude/ios-swift/rules/tooling-and-review/preset-twin-sync.md +1 -1
  86. package/presets/claude/ios-swift/settings.json +2 -2
  87. package/presets/claude/ios-swift/team/README.md +5 -0
  88. package/presets/claude/java/hooks/README.md +4 -3
  89. package/presets/claude/java/hooks/chain-team-phases.sh +57 -3
  90. package/presets/claude/java/hooks/check-preset-update.mjs +4 -3
  91. package/presets/claude/java/hooks/examples/README.md +2 -2
  92. package/presets/claude/java/hooks/{guard-shell-command.sh → guard-shell-command.mjs} +31 -38
  93. package/presets/claude/java/hooks/run-hook.mjs +102 -0
  94. package/presets/claude/java/rules/tooling-and-review/agent-team-intake.md +1 -0
  95. package/presets/claude/java/rules/tooling-and-review/agent-team-orchestrator.md +5 -2
  96. package/presets/claude/java/rules/tooling-and-review/preset-pr-checklist.md +4 -4
  97. package/presets/claude/java/rules/tooling-and-review/preset-twin-sync.md +1 -1
  98. package/presets/claude/java/settings.json +2 -2
  99. package/presets/claude/java/team/README.md +5 -0
  100. package/presets/claude/mcp-ts/hooks/README.md +4 -3
  101. package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +57 -3
  102. package/presets/claude/mcp-ts/hooks/check-preset-update.mjs +4 -3
  103. package/presets/claude/mcp-ts/hooks/examples/README.md +1 -1
  104. package/presets/claude/mcp-ts/hooks/guard-shell-command.mjs +95 -0
  105. package/presets/claude/mcp-ts/hooks/run-hook.mjs +102 -0
  106. package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-intake.md +1 -0
  107. package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-orchestrator.md +5 -2
  108. package/presets/claude/mcp-ts/rules/tooling-and-review/preset-pr-checklist.md +4 -4
  109. package/presets/claude/mcp-ts/rules/tooling-and-review/preset-twin-sync.md +1 -1
  110. package/presets/claude/mcp-ts/settings.json +2 -2
  111. package/presets/claude/mcp-ts/team/README.md +5 -0
  112. package/presets/claude/mol/hooks/README.md +20 -0
  113. package/presets/claude/mol/hooks/chain-team-phases.sh +57 -3
  114. package/presets/claude/mol/hooks/check-preset-update.mjs +4 -3
  115. package/presets/claude/{svelte/hooks/guard-shell-command.sh → mol/hooks/guard-shell-command.mjs} +29 -35
  116. package/presets/claude/mol/hooks/run-hook.mjs +102 -0
  117. package/presets/claude/mol/rules/tooling-and-review/agent-team-intake.md +1 -0
  118. package/presets/claude/mol/rules/tooling-and-review/agent-team-orchestrator.md +5 -2
  119. package/presets/claude/mol/rules/tooling-and-review/preset-pr-checklist.md +4 -4
  120. package/presets/claude/mol/rules/tooling-and-review/preset-twin-sync.md +1 -1
  121. package/presets/claude/mol/settings.json +2 -2
  122. package/presets/claude/mol/team/README.md +5 -0
  123. package/presets/claude/next/agents/build-verifier.md +18 -3
  124. package/presets/claude/next/agents/code-reviewer.md +2 -0
  125. package/presets/claude/next/agents/feature-developer.md +3 -1
  126. package/presets/claude/next/agents/task-analyst.md +6 -0
  127. package/presets/claude/next/agents/task-router.md +5 -3
  128. package/presets/claude/next/commands/README.md +1 -0
  129. package/presets/claude/next/commands/task-continue.md +1 -1
  130. package/presets/claude/next/commands/upstream-research.md +23 -0
  131. package/presets/claude/next/hooks/README.md +4 -3
  132. package/presets/claude/next/hooks/chain-team-phases.sh +57 -3
  133. package/presets/claude/next/hooks/check-preset-update.mjs +4 -3
  134. package/presets/claude/next/hooks/examples/README.md +2 -2
  135. package/presets/claude/next/hooks/guard-shell-command.mjs +94 -0
  136. package/presets/claude/next/hooks/run-hook.mjs +102 -0
  137. package/presets/claude/next/rules/tooling-and-review/agent-team-intake.md +1 -0
  138. package/presets/claude/next/rules/tooling-and-review/agent-team-orchestrator.md +5 -2
  139. package/presets/claude/next/rules/tooling-and-review/preset-pr-checklist.md +4 -4
  140. package/presets/claude/next/rules/tooling-and-review/preset-twin-sync.md +1 -1
  141. package/presets/claude/next/settings.json +2 -2
  142. package/presets/claude/next/team/README.md +23 -0
  143. package/presets/claude/next/team/upstream/config.json +31 -0
  144. package/presets/claude/next/team/upstream/digest-template.md +55 -0
  145. package/presets/claude/next/team/upstream/opencode.json +34 -0
  146. package/presets/claude/next/team/upstream/projects.json +4 -0
  147. package/presets/claude/next/team/upstream/prompt.md +77 -0
  148. package/presets/claude/next/team/upstream/signatures.json +9 -0
  149. package/presets/claude/nuxt/hooks/README.md +4 -3
  150. package/presets/claude/nuxt/hooks/chain-team-phases.sh +57 -3
  151. package/presets/claude/nuxt/hooks/check-preset-update.mjs +4 -3
  152. package/presets/claude/nuxt/hooks/examples/README.md +2 -2
  153. package/presets/claude/{ios-swift/hooks/guard-shell-command.sh → nuxt/hooks/guard-shell-command.mjs} +29 -37
  154. package/presets/claude/nuxt/hooks/run-hook.mjs +102 -0
  155. package/presets/claude/nuxt/rules/tooling-and-review/agent-team-intake.md +1 -0
  156. package/presets/claude/nuxt/rules/tooling-and-review/agent-team-orchestrator.md +5 -2
  157. package/presets/claude/nuxt/rules/tooling-and-review/preset-pr-checklist.md +4 -4
  158. package/presets/claude/nuxt/rules/tooling-and-review/preset-twin-sync.md +1 -1
  159. package/presets/claude/nuxt/settings.json +2 -2
  160. package/presets/claude/nuxt/team/README.md +5 -0
  161. package/presets/claude/php-hexagonal/hooks/README.md +4 -3
  162. package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +57 -3
  163. package/presets/claude/php-hexagonal/hooks/check-preset-update.mjs +4 -3
  164. package/presets/claude/php-hexagonal/hooks/examples/README.md +2 -2
  165. package/presets/claude/php-hexagonal/hooks/guard-shell-command.mjs +96 -0
  166. package/presets/claude/php-hexagonal/hooks/run-hook.mjs +102 -0
  167. package/presets/claude/php-hexagonal/rules/tooling-and-review/agent-team-intake.md +1 -0
  168. package/presets/claude/php-hexagonal/rules/tooling-and-review/agent-team-orchestrator.md +5 -2
  169. package/presets/claude/php-hexagonal/rules/tooling-and-review/preset-pr-checklist.md +4 -4
  170. package/presets/claude/php-hexagonal/rules/tooling-and-review/preset-twin-sync.md +1 -1
  171. package/presets/claude/php-hexagonal/settings.json +2 -2
  172. package/presets/claude/php-hexagonal/team/README.md +5 -0
  173. package/presets/claude/php-laravel/hooks/README.md +4 -3
  174. package/presets/claude/php-laravel/hooks/chain-team-phases.sh +57 -3
  175. package/presets/claude/php-laravel/hooks/check-preset-update.mjs +4 -3
  176. package/presets/claude/php-laravel/hooks/examples/README.md +2 -2
  177. package/presets/claude/php-laravel/hooks/guard-shell-command.mjs +96 -0
  178. package/presets/claude/php-laravel/hooks/run-hook.mjs +102 -0
  179. package/presets/claude/php-laravel/rules/tooling-and-review/agent-team-intake.md +1 -0
  180. package/presets/claude/php-laravel/rules/tooling-and-review/agent-team-orchestrator.md +5 -2
  181. package/presets/claude/php-laravel/rules/tooling-and-review/preset-pr-checklist.md +4 -4
  182. package/presets/claude/php-laravel/rules/tooling-and-review/preset-twin-sync.md +1 -1
  183. package/presets/claude/php-laravel/settings.json +2 -2
  184. package/presets/claude/php-laravel/team/README.md +5 -0
  185. package/presets/claude/svelte/hooks/README.md +4 -3
  186. package/presets/claude/svelte/hooks/chain-team-phases.sh +57 -3
  187. package/presets/claude/svelte/hooks/check-preset-update.mjs +4 -3
  188. package/presets/claude/svelte/hooks/examples/README.md +2 -2
  189. package/presets/claude/svelte/hooks/guard-shell-command.mjs +94 -0
  190. package/presets/claude/svelte/hooks/run-hook.mjs +102 -0
  191. package/presets/claude/svelte/rules/tooling-and-review/agent-team-intake.md +1 -0
  192. package/presets/claude/svelte/rules/tooling-and-review/agent-team-orchestrator.md +5 -2
  193. package/presets/claude/svelte/rules/tooling-and-review/preset-pr-checklist.md +4 -4
  194. package/presets/claude/svelte/rules/tooling-and-review/preset-twin-sync.md +1 -1
  195. package/presets/claude/svelte/settings.json +2 -2
  196. package/presets/claude/svelte/team/README.md +5 -0
  197. package/presets/cursor/android-kotlin/hooks/README.md +2 -1
  198. package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +57 -3
  199. package/presets/cursor/android-kotlin/hooks/check-preset-update.mjs +4 -3
  200. package/presets/cursor/android-kotlin/hooks/examples/README.md +1 -1
  201. package/presets/cursor/android-kotlin/hooks/guard-shell-command.mjs +96 -0
  202. package/presets/cursor/android-kotlin/hooks/run-hook.mjs +102 -0
  203. package/presets/cursor/android-kotlin/hooks.json +2 -2
  204. package/presets/cursor/android-kotlin/rules/agent-team-intake.mdc +1 -0
  205. package/presets/cursor/android-kotlin/rules/agent-team-orchestrator.mdc +2 -1
  206. package/presets/cursor/android-kotlin/rules/preset-pr-checklist.mdc +4 -4
  207. package/presets/cursor/android-kotlin/rules/preset-twin-sync.mdc +1 -1
  208. package/presets/cursor/android-kotlin/team/README.md +5 -0
  209. package/presets/cursor/go/hooks/README.md +2 -1
  210. package/presets/cursor/go/hooks/chain-team-phases.sh +57 -3
  211. package/presets/cursor/go/hooks/check-preset-update.mjs +4 -3
  212. package/presets/cursor/go/hooks/examples/README.md +1 -1
  213. package/presets/cursor/go/hooks/guard-shell-command.mjs +95 -0
  214. package/presets/cursor/go/hooks/run-hook.mjs +102 -0
  215. package/presets/cursor/go/hooks.json +2 -2
  216. package/presets/cursor/go/rules/agent-team-intake.mdc +1 -0
  217. package/presets/cursor/go/rules/agent-team-orchestrator.mdc +2 -1
  218. package/presets/cursor/go/rules/preset-pr-checklist.mdc +4 -4
  219. package/presets/cursor/go/rules/preset-twin-sync.mdc +1 -1
  220. package/presets/cursor/go/team/README.md +5 -0
  221. package/presets/cursor/ios-swift/hooks/README.md +2 -1
  222. package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +57 -3
  223. package/presets/cursor/ios-swift/hooks/check-preset-update.mjs +4 -3
  224. package/presets/cursor/ios-swift/hooks/examples/README.md +1 -1
  225. package/presets/cursor/ios-swift/hooks/guard-shell-command.mjs +95 -0
  226. package/presets/cursor/ios-swift/hooks/run-hook.mjs +102 -0
  227. package/presets/cursor/ios-swift/hooks.json +2 -2
  228. package/presets/cursor/ios-swift/rules/agent-team-intake.mdc +1 -0
  229. package/presets/cursor/ios-swift/rules/agent-team-orchestrator.mdc +2 -1
  230. package/presets/cursor/ios-swift/rules/preset-pr-checklist.mdc +4 -4
  231. package/presets/cursor/ios-swift/rules/preset-twin-sync.mdc +1 -1
  232. package/presets/cursor/ios-swift/team/README.md +5 -0
  233. package/presets/cursor/java/hooks/README.md +2 -1
  234. package/presets/cursor/java/hooks/chain-team-phases.sh +57 -3
  235. package/presets/cursor/java/hooks/check-preset-update.mjs +4 -3
  236. package/presets/cursor/java/hooks/examples/README.md +1 -1
  237. package/presets/cursor/java/hooks/guard-shell-command.mjs +96 -0
  238. package/presets/cursor/java/hooks/run-hook.mjs +102 -0
  239. package/presets/cursor/java/hooks.json +2 -2
  240. package/presets/cursor/java/rules/agent-team-intake.mdc +1 -0
  241. package/presets/cursor/java/rules/agent-team-orchestrator.mdc +2 -1
  242. package/presets/cursor/java/rules/preset-pr-checklist.mdc +4 -4
  243. package/presets/cursor/java/rules/preset-twin-sync.mdc +1 -1
  244. package/presets/cursor/java/team/README.md +5 -0
  245. package/presets/cursor/mcp-ts/hooks/README.md +2 -1
  246. package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +57 -3
  247. package/presets/cursor/mcp-ts/hooks/check-preset-update.mjs +4 -3
  248. package/presets/cursor/mcp-ts/hooks/guard-shell-command.mjs +95 -0
  249. package/presets/cursor/mcp-ts/hooks/run-hook.mjs +102 -0
  250. package/presets/cursor/mcp-ts/hooks.json +2 -2
  251. package/presets/cursor/mcp-ts/rules/agent-team-intake.mdc +1 -0
  252. package/presets/cursor/mcp-ts/rules/agent-team-orchestrator.mdc +2 -1
  253. package/presets/cursor/mcp-ts/rules/preset-pr-checklist.mdc +4 -4
  254. package/presets/cursor/mcp-ts/rules/preset-twin-sync.mdc +1 -1
  255. package/presets/cursor/mcp-ts/team/README.md +5 -0
  256. package/presets/cursor/mol/hooks/README.md +2 -1
  257. package/presets/cursor/mol/hooks/chain-team-phases.sh +57 -3
  258. package/presets/cursor/mol/hooks/check-preset-update.mjs +4 -3
  259. package/presets/cursor/mol/hooks/examples/README.md +1 -1
  260. package/presets/{claude/next/hooks/guard-shell-command.sh → cursor/mol/hooks/guard-shell-command.mjs} +29 -35
  261. package/presets/cursor/mol/hooks/run-hook.mjs +102 -0
  262. package/presets/cursor/mol/hooks.json +2 -2
  263. package/presets/cursor/mol/rules/agent-team-intake.mdc +1 -0
  264. package/presets/cursor/mol/rules/agent-team-orchestrator.mdc +2 -1
  265. package/presets/cursor/mol/rules/preset-pr-checklist.mdc +4 -4
  266. package/presets/cursor/mol/rules/preset-twin-sync.mdc +1 -1
  267. package/presets/cursor/mol/team/README.md +5 -0
  268. package/presets/cursor/next/agents/build-verifier.md +18 -3
  269. package/presets/cursor/next/agents/code-reviewer.md +2 -0
  270. package/presets/cursor/next/agents/feature-developer.md +3 -1
  271. package/presets/cursor/next/agents/task-analyst.md +6 -0
  272. package/presets/cursor/next/agents/task-router.md +5 -3
  273. package/presets/cursor/next/commands/README.md +1 -0
  274. package/presets/cursor/next/commands/task-continue.md +1 -1
  275. package/presets/cursor/next/commands/upstream-research.md +23 -0
  276. package/presets/cursor/next/hooks/README.md +2 -1
  277. package/presets/cursor/next/hooks/chain-team-phases.sh +57 -3
  278. package/presets/cursor/next/hooks/check-preset-update.mjs +4 -3
  279. package/presets/cursor/next/hooks/examples/README.md +1 -1
  280. package/presets/cursor/next/hooks/guard-shell-command.mjs +94 -0
  281. package/presets/cursor/next/hooks/run-hook.mjs +102 -0
  282. package/presets/cursor/next/hooks.json +2 -2
  283. package/presets/cursor/next/rules/agent-team-intake.mdc +1 -0
  284. package/presets/cursor/next/rules/agent-team-orchestrator.mdc +2 -1
  285. package/presets/cursor/next/rules/preset-pr-checklist.mdc +4 -4
  286. package/presets/cursor/next/rules/preset-twin-sync.mdc +1 -1
  287. package/presets/cursor/next/team/README.md +23 -0
  288. package/presets/cursor/next/team/upstream/config.json +31 -0
  289. package/presets/cursor/next/team/upstream/digest-template.md +55 -0
  290. package/presets/cursor/next/team/upstream/opencode.json +34 -0
  291. package/presets/cursor/next/team/upstream/projects.json +4 -0
  292. package/presets/cursor/next/team/upstream/prompt.md +77 -0
  293. package/presets/cursor/next/team/upstream/signatures.json +9 -0
  294. package/presets/cursor/nuxt/hooks/README.md +2 -1
  295. package/presets/cursor/nuxt/hooks/chain-team-phases.sh +57 -3
  296. package/presets/cursor/nuxt/hooks/check-preset-update.mjs +4 -3
  297. package/presets/cursor/nuxt/hooks/examples/README.md +1 -1
  298. package/presets/cursor/nuxt/hooks/guard-shell-command.mjs +94 -0
  299. package/presets/cursor/nuxt/hooks/run-hook.mjs +102 -0
  300. package/presets/cursor/nuxt/hooks.json +2 -2
  301. package/presets/cursor/nuxt/rules/agent-team-intake.mdc +1 -0
  302. package/presets/cursor/nuxt/rules/agent-team-orchestrator.mdc +2 -1
  303. package/presets/cursor/nuxt/rules/preset-pr-checklist.mdc +4 -4
  304. package/presets/cursor/nuxt/rules/preset-twin-sync.mdc +1 -1
  305. package/presets/cursor/nuxt/team/README.md +5 -0
  306. package/presets/cursor/php-hexagonal/hooks/README.md +2 -1
  307. package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +57 -3
  308. package/presets/cursor/php-hexagonal/hooks/check-preset-update.mjs +4 -3
  309. package/presets/cursor/php-hexagonal/hooks/examples/README.md +1 -1
  310. package/presets/cursor/php-hexagonal/hooks/guard-shell-command.mjs +96 -0
  311. package/presets/cursor/php-hexagonal/hooks/run-hook.mjs +102 -0
  312. package/presets/cursor/php-hexagonal/hooks.json +2 -2
  313. package/presets/cursor/php-hexagonal/rules/agent-team-intake.mdc +1 -0
  314. package/presets/cursor/php-hexagonal/rules/agent-team-orchestrator.mdc +2 -1
  315. package/presets/cursor/php-hexagonal/rules/preset-pr-checklist.mdc +4 -4
  316. package/presets/cursor/php-hexagonal/rules/preset-twin-sync.mdc +1 -1
  317. package/presets/cursor/php-hexagonal/team/README.md +5 -0
  318. package/presets/cursor/php-laravel/hooks/README.md +2 -1
  319. package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +57 -3
  320. package/presets/cursor/php-laravel/hooks/check-preset-update.mjs +4 -3
  321. package/presets/cursor/php-laravel/hooks/examples/README.md +1 -1
  322. package/presets/cursor/php-laravel/hooks/guard-shell-command.mjs +96 -0
  323. package/presets/cursor/php-laravel/hooks/run-hook.mjs +102 -0
  324. package/presets/cursor/php-laravel/hooks.json +2 -2
  325. package/presets/cursor/php-laravel/rules/agent-team-intake.mdc +1 -0
  326. package/presets/cursor/php-laravel/rules/agent-team-orchestrator.mdc +2 -1
  327. package/presets/cursor/php-laravel/rules/preset-pr-checklist.mdc +4 -4
  328. package/presets/cursor/php-laravel/rules/preset-twin-sync.mdc +1 -1
  329. package/presets/cursor/php-laravel/team/README.md +5 -0
  330. package/presets/cursor/svelte/hooks/README.md +2 -1
  331. package/presets/cursor/svelte/hooks/chain-team-phases.sh +57 -3
  332. package/presets/cursor/svelte/hooks/check-preset-update.mjs +4 -3
  333. package/presets/cursor/svelte/hooks/examples/README.md +1 -1
  334. package/presets/cursor/svelte/hooks/guard-shell-command.mjs +94 -0
  335. package/presets/cursor/svelte/hooks/run-hook.mjs +102 -0
  336. package/presets/cursor/svelte/hooks.json +2 -2
  337. package/presets/cursor/svelte/rules/agent-team-intake.mdc +1 -0
  338. package/presets/cursor/svelte/rules/agent-team-orchestrator.mdc +2 -1
  339. package/presets/cursor/svelte/rules/preset-pr-checklist.mdc +4 -4
  340. package/presets/cursor/svelte/rules/preset-twin-sync.mdc +1 -1
  341. package/presets/cursor/svelte/team/README.md +5 -0
  342. package/presets/mavis/android-kotlin/adapter-map.json +11 -3
  343. package/presets/mavis/android-kotlin/hooks/README.md +2 -1
  344. package/presets/mavis/android-kotlin/hooks/chain-team-phases.sh +57 -3
  345. package/presets/mavis/android-kotlin/hooks/check-preset-update.mjs +4 -3
  346. package/presets/mavis/android-kotlin/rules/agent-team-intake.md +1 -0
  347. package/presets/mavis/android-kotlin/rules/agent-team-orchestrator.md +5 -2
  348. package/presets/mavis/android-kotlin/rules/preset-pr-checklist.md +4 -4
  349. package/presets/mavis/android-kotlin/rules/preset-twin-sync.md +1 -1
  350. package/presets/mavis/android-kotlin/team/README.md +5 -0
  351. package/presets/mavis/go/adapter-map.json +11 -3
  352. package/presets/mavis/go/hooks/README.md +2 -1
  353. package/presets/mavis/go/hooks/chain-team-phases.sh +57 -3
  354. package/presets/mavis/go/hooks/check-preset-update.mjs +4 -3
  355. package/presets/mavis/go/rules/agent-team-intake.md +1 -0
  356. package/presets/mavis/go/rules/agent-team-orchestrator.md +5 -2
  357. package/presets/mavis/go/rules/preset-pr-checklist.md +4 -4
  358. package/presets/mavis/go/rules/preset-twin-sync.md +1 -1
  359. package/presets/mavis/go/team/README.md +5 -0
  360. package/presets/mavis/ios-swift/adapter-map.json +11 -3
  361. package/presets/mavis/ios-swift/hooks/README.md +2 -1
  362. package/presets/mavis/ios-swift/hooks/chain-team-phases.sh +57 -3
  363. package/presets/mavis/ios-swift/hooks/check-preset-update.mjs +4 -3
  364. package/presets/mavis/ios-swift/rules/agent-team-intake.md +1 -0
  365. package/presets/mavis/ios-swift/rules/agent-team-orchestrator.md +5 -2
  366. package/presets/mavis/ios-swift/rules/preset-pr-checklist.md +4 -4
  367. package/presets/mavis/ios-swift/rules/preset-twin-sync.md +1 -1
  368. package/presets/mavis/ios-swift/team/README.md +5 -0
  369. package/presets/mavis/java/adapter-map.json +11 -3
  370. package/presets/mavis/java/hooks/README.md +2 -1
  371. package/presets/mavis/java/hooks/chain-team-phases.sh +57 -3
  372. package/presets/mavis/java/hooks/check-preset-update.mjs +4 -3
  373. package/presets/mavis/java/rules/agent-team-intake.md +1 -0
  374. package/presets/mavis/java/rules/agent-team-orchestrator.md +5 -2
  375. package/presets/mavis/java/rules/preset-pr-checklist.md +4 -4
  376. package/presets/mavis/java/rules/preset-twin-sync.md +1 -1
  377. package/presets/mavis/java/team/README.md +5 -0
  378. package/presets/mavis/mcp-ts/adapter-map.json +11 -3
  379. package/presets/mavis/mcp-ts/hooks/README.md +2 -1
  380. package/presets/mavis/mcp-ts/hooks/chain-team-phases.sh +57 -3
  381. package/presets/mavis/mcp-ts/hooks/check-preset-update.mjs +4 -3
  382. package/presets/mavis/mcp-ts/rules/agent-team-intake.md +1 -0
  383. package/presets/mavis/mcp-ts/rules/agent-team-orchestrator.md +5 -2
  384. package/presets/mavis/mcp-ts/rules/preset-pr-checklist.md +4 -4
  385. package/presets/mavis/mcp-ts/rules/preset-twin-sync.md +1 -1
  386. package/presets/mavis/mcp-ts/team/README.md +5 -0
  387. package/presets/mavis/mol/adapter-map.json +11 -3
  388. package/presets/mavis/mol/hooks/README.md +2 -1
  389. package/presets/mavis/mol/hooks/chain-team-phases.sh +57 -3
  390. package/presets/mavis/mol/hooks/check-preset-update.mjs +4 -3
  391. package/presets/mavis/mol/rules/agent-team-intake.md +1 -0
  392. package/presets/mavis/mol/rules/agent-team-orchestrator.md +5 -2
  393. package/presets/mavis/mol/rules/preset-pr-checklist.md +4 -4
  394. package/presets/mavis/mol/rules/preset-twin-sync.md +1 -1
  395. package/presets/mavis/mol/team/README.md +5 -0
  396. package/presets/mavis/next/adapter-map.json +67 -3
  397. package/presets/mavis/next/agents/build-verifier.md +18 -3
  398. package/presets/mavis/next/agents/code-reviewer.md +2 -0
  399. package/presets/mavis/next/agents/feature-developer.md +3 -1
  400. package/presets/mavis/next/agents/task-analyst.md +6 -0
  401. package/presets/mavis/next/agents/task-router.md +5 -3
  402. package/presets/mavis/next/commands/README.md +1 -0
  403. package/presets/mavis/next/commands/task-continue.md +1 -1
  404. package/presets/mavis/next/commands/upstream-research.md +18 -0
  405. package/presets/mavis/next/hooks/README.md +2 -1
  406. package/presets/mavis/next/hooks/chain-team-phases.sh +57 -3
  407. package/presets/mavis/next/hooks/check-preset-update.mjs +4 -3
  408. package/presets/mavis/next/rules/agent-team-intake.md +1 -0
  409. package/presets/mavis/next/rules/agent-team-orchestrator.md +5 -2
  410. package/presets/mavis/next/rules/preset-pr-checklist.md +4 -4
  411. package/presets/mavis/next/rules/preset-twin-sync.md +1 -1
  412. package/presets/mavis/next/team/README.md +23 -0
  413. package/presets/mavis/next/team/upstream/config.json +31 -0
  414. package/presets/mavis/next/team/upstream/digest-template.md +55 -0
  415. package/presets/mavis/next/team/upstream/opencode.json +34 -0
  416. package/presets/mavis/next/team/upstream/projects.json +4 -0
  417. package/presets/mavis/next/team/upstream/prompt.md +77 -0
  418. package/presets/mavis/next/team/upstream/signatures.json +9 -0
  419. package/presets/mavis/nuxt/adapter-map.json +11 -3
  420. package/presets/mavis/nuxt/hooks/README.md +2 -1
  421. package/presets/mavis/nuxt/hooks/chain-team-phases.sh +57 -3
  422. package/presets/mavis/nuxt/hooks/check-preset-update.mjs +4 -3
  423. package/presets/mavis/nuxt/rules/agent-team-intake.md +1 -0
  424. package/presets/mavis/nuxt/rules/agent-team-orchestrator.md +5 -2
  425. package/presets/mavis/nuxt/rules/preset-pr-checklist.md +4 -4
  426. package/presets/mavis/nuxt/rules/preset-twin-sync.md +1 -1
  427. package/presets/mavis/nuxt/team/README.md +5 -0
  428. package/presets/mavis/php-hexagonal/adapter-map.json +11 -3
  429. package/presets/mavis/php-hexagonal/hooks/README.md +2 -1
  430. package/presets/mavis/php-hexagonal/hooks/chain-team-phases.sh +57 -3
  431. package/presets/mavis/php-hexagonal/hooks/check-preset-update.mjs +4 -3
  432. package/presets/mavis/php-hexagonal/rules/agent-team-intake.md +1 -0
  433. package/presets/mavis/php-hexagonal/rules/agent-team-orchestrator.md +5 -2
  434. package/presets/mavis/php-hexagonal/rules/preset-pr-checklist.md +4 -4
  435. package/presets/mavis/php-hexagonal/rules/preset-twin-sync.md +1 -1
  436. package/presets/mavis/php-hexagonal/team/README.md +5 -0
  437. package/presets/mavis/php-laravel/adapter-map.json +11 -3
  438. package/presets/mavis/php-laravel/hooks/README.md +2 -1
  439. package/presets/mavis/php-laravel/hooks/chain-team-phases.sh +57 -3
  440. package/presets/mavis/php-laravel/hooks/check-preset-update.mjs +4 -3
  441. package/presets/mavis/php-laravel/rules/agent-team-intake.md +1 -0
  442. package/presets/mavis/php-laravel/rules/agent-team-orchestrator.md +5 -2
  443. package/presets/mavis/php-laravel/rules/preset-pr-checklist.md +4 -4
  444. package/presets/mavis/php-laravel/rules/preset-twin-sync.md +1 -1
  445. package/presets/mavis/php-laravel/team/README.md +5 -0
  446. package/presets/mavis/svelte/adapter-map.json +11 -3
  447. package/presets/mavis/svelte/hooks/README.md +2 -1
  448. package/presets/mavis/svelte/hooks/chain-team-phases.sh +57 -3
  449. package/presets/mavis/svelte/hooks/check-preset-update.mjs +4 -3
  450. package/presets/mavis/svelte/rules/agent-team-intake.md +1 -0
  451. package/presets/mavis/svelte/rules/agent-team-orchestrator.md +5 -2
  452. package/presets/mavis/svelte/rules/preset-pr-checklist.md +4 -4
  453. package/presets/mavis/svelte/rules/preset-twin-sync.md +1 -1
  454. package/presets/mavis/svelte/team/README.md +5 -0
  455. package/presets/opencode/android-kotlin/OPENCODE.md +1 -1
  456. package/presets/opencode/android-kotlin/README.md +1 -1
  457. package/presets/opencode/android-kotlin/adapter-map.json +11 -3
  458. package/presets/opencode/android-kotlin/hooks/README.md +3 -2
  459. package/presets/opencode/android-kotlin/hooks/chain-team-phases.sh +57 -3
  460. package/presets/opencode/android-kotlin/hooks/check-preset-update.mjs +4 -3
  461. package/presets/opencode/android-kotlin/rules/agent-team-intake.md +1 -0
  462. package/presets/opencode/android-kotlin/rules/agent-team-orchestrator.md +5 -2
  463. package/presets/opencode/android-kotlin/rules/preset-pr-checklist.md +4 -4
  464. package/presets/opencode/android-kotlin/rules/preset-twin-sync.md +1 -1
  465. package/presets/opencode/android-kotlin/team/README.md +5 -0
  466. package/presets/opencode/go/OPENCODE.md +1 -1
  467. package/presets/opencode/go/README.md +1 -1
  468. package/presets/opencode/go/adapter-map.json +11 -3
  469. package/presets/opencode/go/hooks/README.md +3 -2
  470. package/presets/opencode/go/hooks/chain-team-phases.sh +57 -3
  471. package/presets/opencode/go/hooks/check-preset-update.mjs +4 -3
  472. package/presets/opencode/go/rules/agent-team-intake.md +1 -0
  473. package/presets/opencode/go/rules/agent-team-orchestrator.md +5 -2
  474. package/presets/opencode/go/rules/preset-pr-checklist.md +4 -4
  475. package/presets/opencode/go/rules/preset-twin-sync.md +1 -1
  476. package/presets/opencode/go/team/README.md +5 -0
  477. package/presets/opencode/ios-swift/OPENCODE.md +1 -1
  478. package/presets/opencode/ios-swift/README.md +1 -1
  479. package/presets/opencode/ios-swift/adapter-map.json +11 -3
  480. package/presets/opencode/ios-swift/hooks/README.md +3 -2
  481. package/presets/opencode/ios-swift/hooks/chain-team-phases.sh +57 -3
  482. package/presets/opencode/ios-swift/hooks/check-preset-update.mjs +4 -3
  483. package/presets/opencode/ios-swift/rules/agent-team-intake.md +1 -0
  484. package/presets/opencode/ios-swift/rules/agent-team-orchestrator.md +5 -2
  485. package/presets/opencode/ios-swift/rules/preset-pr-checklist.md +4 -4
  486. package/presets/opencode/ios-swift/rules/preset-twin-sync.md +1 -1
  487. package/presets/opencode/ios-swift/team/README.md +5 -0
  488. package/presets/opencode/java/OPENCODE.md +1 -1
  489. package/presets/opencode/java/README.md +1 -1
  490. package/presets/opencode/java/adapter-map.json +11 -3
  491. package/presets/opencode/java/hooks/README.md +3 -2
  492. package/presets/opencode/java/hooks/chain-team-phases.sh +57 -3
  493. package/presets/opencode/java/hooks/check-preset-update.mjs +4 -3
  494. package/presets/opencode/java/rules/agent-team-intake.md +1 -0
  495. package/presets/opencode/java/rules/agent-team-orchestrator.md +5 -2
  496. package/presets/opencode/java/rules/preset-pr-checklist.md +4 -4
  497. package/presets/opencode/java/rules/preset-twin-sync.md +1 -1
  498. package/presets/opencode/java/team/README.md +5 -0
  499. package/presets/opencode/mcp-ts/OPENCODE.md +1 -1
  500. package/presets/opencode/mcp-ts/README.md +1 -1
  501. package/presets/opencode/mcp-ts/adapter-map.json +11 -3
  502. package/presets/opencode/mcp-ts/hooks/README.md +3 -2
  503. package/presets/opencode/mcp-ts/hooks/chain-team-phases.sh +57 -3
  504. package/presets/opencode/mcp-ts/hooks/check-preset-update.mjs +4 -3
  505. package/presets/opencode/mcp-ts/rules/agent-team-intake.md +1 -0
  506. package/presets/opencode/mcp-ts/rules/agent-team-orchestrator.md +5 -2
  507. package/presets/opencode/mcp-ts/rules/preset-pr-checklist.md +4 -4
  508. package/presets/opencode/mcp-ts/rules/preset-twin-sync.md +1 -1
  509. package/presets/opencode/mcp-ts/team/README.md +5 -0
  510. package/presets/opencode/mol/OPENCODE.md +1 -1
  511. package/presets/opencode/mol/README.md +1 -1
  512. package/presets/opencode/mol/adapter-map.json +11 -3
  513. package/presets/opencode/mol/hooks/README.md +3 -2
  514. package/presets/opencode/mol/hooks/chain-team-phases.sh +57 -3
  515. package/presets/opencode/mol/hooks/check-preset-update.mjs +4 -3
  516. package/presets/opencode/mol/rules/agent-team-intake.md +1 -0
  517. package/presets/opencode/mol/rules/agent-team-orchestrator.md +5 -2
  518. package/presets/opencode/mol/rules/preset-pr-checklist.md +4 -4
  519. package/presets/opencode/mol/rules/preset-twin-sync.md +1 -1
  520. package/presets/opencode/mol/team/README.md +5 -0
  521. package/presets/opencode/next/OPENCODE.md +1 -1
  522. package/presets/opencode/next/README.md +1 -1
  523. package/presets/opencode/next/adapter-map.json +67 -3
  524. package/presets/opencode/next/agents/build-verifier.md +18 -3
  525. package/presets/opencode/next/agents/code-reviewer.md +2 -0
  526. package/presets/opencode/next/agents/feature-developer.md +3 -1
  527. package/presets/opencode/next/agents/task-analyst.md +6 -0
  528. package/presets/opencode/next/agents/task-router.md +5 -3
  529. package/presets/opencode/next/commands/README.md +1 -0
  530. package/presets/opencode/next/commands/task-continue.md +1 -1
  531. package/presets/opencode/next/commands/upstream-research.md +26 -0
  532. package/presets/opencode/next/hooks/README.md +3 -2
  533. package/presets/opencode/next/hooks/chain-team-phases.sh +57 -3
  534. package/presets/opencode/next/hooks/check-preset-update.mjs +4 -3
  535. package/presets/opencode/next/rules/agent-team-intake.md +1 -0
  536. package/presets/opencode/next/rules/agent-team-orchestrator.md +5 -2
  537. package/presets/opencode/next/rules/preset-pr-checklist.md +4 -4
  538. package/presets/opencode/next/rules/preset-twin-sync.md +1 -1
  539. package/presets/opencode/next/team/README.md +23 -0
  540. package/presets/opencode/next/team/upstream/config.json +31 -0
  541. package/presets/opencode/next/team/upstream/digest-template.md +55 -0
  542. package/presets/opencode/next/team/upstream/opencode.json +34 -0
  543. package/presets/opencode/next/team/upstream/projects.json +4 -0
  544. package/presets/opencode/next/team/upstream/prompt.md +77 -0
  545. package/presets/opencode/next/team/upstream/signatures.json +9 -0
  546. package/presets/opencode/nuxt/OPENCODE.md +1 -1
  547. package/presets/opencode/nuxt/README.md +1 -1
  548. package/presets/opencode/nuxt/adapter-map.json +11 -3
  549. package/presets/opencode/nuxt/hooks/README.md +3 -2
  550. package/presets/opencode/nuxt/hooks/chain-team-phases.sh +57 -3
  551. package/presets/opencode/nuxt/hooks/check-preset-update.mjs +4 -3
  552. package/presets/opencode/nuxt/rules/agent-team-intake.md +1 -0
  553. package/presets/opencode/nuxt/rules/agent-team-orchestrator.md +5 -2
  554. package/presets/opencode/nuxt/rules/preset-pr-checklist.md +4 -4
  555. package/presets/opencode/nuxt/rules/preset-twin-sync.md +1 -1
  556. package/presets/opencode/nuxt/team/README.md +5 -0
  557. package/presets/opencode/php-hexagonal/OPENCODE.md +1 -1
  558. package/presets/opencode/php-hexagonal/README.md +1 -1
  559. package/presets/opencode/php-hexagonal/adapter-map.json +11 -3
  560. package/presets/opencode/php-hexagonal/hooks/README.md +3 -2
  561. package/presets/opencode/php-hexagonal/hooks/chain-team-phases.sh +57 -3
  562. package/presets/opencode/php-hexagonal/hooks/check-preset-update.mjs +4 -3
  563. package/presets/opencode/php-hexagonal/rules/agent-team-intake.md +1 -0
  564. package/presets/opencode/php-hexagonal/rules/agent-team-orchestrator.md +5 -2
  565. package/presets/opencode/php-hexagonal/rules/preset-pr-checklist.md +4 -4
  566. package/presets/opencode/php-hexagonal/rules/preset-twin-sync.md +1 -1
  567. package/presets/opencode/php-hexagonal/team/README.md +5 -0
  568. package/presets/opencode/php-laravel/OPENCODE.md +1 -1
  569. package/presets/opencode/php-laravel/README.md +1 -1
  570. package/presets/opencode/php-laravel/adapter-map.json +11 -3
  571. package/presets/opencode/php-laravel/hooks/README.md +3 -2
  572. package/presets/opencode/php-laravel/hooks/chain-team-phases.sh +57 -3
  573. package/presets/opencode/php-laravel/hooks/check-preset-update.mjs +4 -3
  574. package/presets/opencode/php-laravel/rules/agent-team-intake.md +1 -0
  575. package/presets/opencode/php-laravel/rules/agent-team-orchestrator.md +5 -2
  576. package/presets/opencode/php-laravel/rules/preset-pr-checklist.md +4 -4
  577. package/presets/opencode/php-laravel/rules/preset-twin-sync.md +1 -1
  578. package/presets/opencode/php-laravel/team/README.md +5 -0
  579. package/presets/opencode/svelte/OPENCODE.md +1 -1
  580. package/presets/opencode/svelte/README.md +1 -1
  581. package/presets/opencode/svelte/adapter-map.json +11 -3
  582. package/presets/opencode/svelte/hooks/README.md +3 -2
  583. package/presets/opencode/svelte/hooks/chain-team-phases.sh +57 -3
  584. package/presets/opencode/svelte/hooks/check-preset-update.mjs +4 -3
  585. package/presets/opencode/svelte/rules/agent-team-intake.md +1 -0
  586. package/presets/opencode/svelte/rules/agent-team-orchestrator.md +5 -2
  587. package/presets/opencode/svelte/rules/preset-pr-checklist.md +4 -4
  588. package/presets/opencode/svelte/rules/preset-twin-sync.md +1 -1
  589. package/presets/opencode/svelte/team/README.md +5 -0
  590. package/presets/zcode/android-kotlin/adapter-map.json +11 -3
  591. package/presets/zcode/android-kotlin/hooks/README.md +2 -1
  592. package/presets/zcode/android-kotlin/hooks/chain-team-phases.sh +57 -3
  593. package/presets/zcode/android-kotlin/hooks/check-preset-update.mjs +4 -3
  594. package/presets/zcode/android-kotlin/rules/agent-team-intake.md +1 -0
  595. package/presets/zcode/android-kotlin/rules/agent-team-orchestrator.md +5 -2
  596. package/presets/zcode/android-kotlin/rules/preset-pr-checklist.md +4 -4
  597. package/presets/zcode/android-kotlin/rules/preset-twin-sync.md +1 -1
  598. package/presets/zcode/android-kotlin/team/README.md +5 -0
  599. package/presets/zcode/go/adapter-map.json +11 -3
  600. package/presets/zcode/go/hooks/README.md +2 -1
  601. package/presets/zcode/go/hooks/chain-team-phases.sh +57 -3
  602. package/presets/zcode/go/hooks/check-preset-update.mjs +4 -3
  603. package/presets/zcode/go/rules/agent-team-intake.md +1 -0
  604. package/presets/zcode/go/rules/agent-team-orchestrator.md +5 -2
  605. package/presets/zcode/go/rules/preset-pr-checklist.md +4 -4
  606. package/presets/zcode/go/rules/preset-twin-sync.md +1 -1
  607. package/presets/zcode/go/team/README.md +5 -0
  608. package/presets/zcode/ios-swift/adapter-map.json +11 -3
  609. package/presets/zcode/ios-swift/hooks/README.md +2 -1
  610. package/presets/zcode/ios-swift/hooks/chain-team-phases.sh +57 -3
  611. package/presets/zcode/ios-swift/hooks/check-preset-update.mjs +4 -3
  612. package/presets/zcode/ios-swift/rules/agent-team-intake.md +1 -0
  613. package/presets/zcode/ios-swift/rules/agent-team-orchestrator.md +5 -2
  614. package/presets/zcode/ios-swift/rules/preset-pr-checklist.md +4 -4
  615. package/presets/zcode/ios-swift/rules/preset-twin-sync.md +1 -1
  616. package/presets/zcode/ios-swift/team/README.md +5 -0
  617. package/presets/zcode/java/adapter-map.json +11 -3
  618. package/presets/zcode/java/hooks/README.md +2 -1
  619. package/presets/zcode/java/hooks/chain-team-phases.sh +57 -3
  620. package/presets/zcode/java/hooks/check-preset-update.mjs +4 -3
  621. package/presets/zcode/java/rules/agent-team-intake.md +1 -0
  622. package/presets/zcode/java/rules/agent-team-orchestrator.md +5 -2
  623. package/presets/zcode/java/rules/preset-pr-checklist.md +4 -4
  624. package/presets/zcode/java/rules/preset-twin-sync.md +1 -1
  625. package/presets/zcode/java/team/README.md +5 -0
  626. package/presets/zcode/mcp-ts/adapter-map.json +11 -3
  627. package/presets/zcode/mcp-ts/hooks/README.md +2 -1
  628. package/presets/zcode/mcp-ts/hooks/chain-team-phases.sh +57 -3
  629. package/presets/zcode/mcp-ts/hooks/check-preset-update.mjs +4 -3
  630. package/presets/zcode/mcp-ts/rules/agent-team-intake.md +1 -0
  631. package/presets/zcode/mcp-ts/rules/agent-team-orchestrator.md +5 -2
  632. package/presets/zcode/mcp-ts/rules/preset-pr-checklist.md +4 -4
  633. package/presets/zcode/mcp-ts/rules/preset-twin-sync.md +1 -1
  634. package/presets/zcode/mcp-ts/team/README.md +5 -0
  635. package/presets/zcode/mol/adapter-map.json +11 -3
  636. package/presets/zcode/mol/hooks/README.md +2 -1
  637. package/presets/zcode/mol/hooks/chain-team-phases.sh +57 -3
  638. package/presets/zcode/mol/hooks/check-preset-update.mjs +4 -3
  639. package/presets/zcode/mol/rules/agent-team-intake.md +1 -0
  640. package/presets/zcode/mol/rules/agent-team-orchestrator.md +5 -2
  641. package/presets/zcode/mol/rules/preset-pr-checklist.md +4 -4
  642. package/presets/zcode/mol/rules/preset-twin-sync.md +1 -1
  643. package/presets/zcode/mol/team/README.md +5 -0
  644. package/presets/zcode/next/adapter-map.json +67 -3
  645. package/presets/zcode/next/agents/build-verifier.md +18 -3
  646. package/presets/zcode/next/agents/code-reviewer.md +2 -0
  647. package/presets/zcode/next/agents/feature-developer.md +3 -1
  648. package/presets/zcode/next/agents/task-analyst.md +6 -0
  649. package/presets/zcode/next/agents/task-router.md +5 -3
  650. package/presets/zcode/next/commands/README.md +1 -0
  651. package/presets/zcode/next/commands/task-continue.md +1 -1
  652. package/presets/zcode/next/commands/upstream-research.md +26 -0
  653. package/presets/zcode/next/hooks/README.md +2 -1
  654. package/presets/zcode/next/hooks/chain-team-phases.sh +57 -3
  655. package/presets/zcode/next/hooks/check-preset-update.mjs +4 -3
  656. package/presets/zcode/next/rules/agent-team-intake.md +1 -0
  657. package/presets/zcode/next/rules/agent-team-orchestrator.md +5 -2
  658. package/presets/zcode/next/rules/preset-pr-checklist.md +4 -4
  659. package/presets/zcode/next/rules/preset-twin-sync.md +1 -1
  660. package/presets/zcode/next/team/README.md +23 -0
  661. package/presets/zcode/next/team/upstream/config.json +31 -0
  662. package/presets/zcode/next/team/upstream/digest-template.md +55 -0
  663. package/presets/zcode/next/team/upstream/opencode.json +34 -0
  664. package/presets/zcode/next/team/upstream/projects.json +4 -0
  665. package/presets/zcode/next/team/upstream/prompt.md +77 -0
  666. package/presets/zcode/next/team/upstream/signatures.json +9 -0
  667. package/presets/zcode/nuxt/adapter-map.json +11 -3
  668. package/presets/zcode/nuxt/hooks/README.md +2 -1
  669. package/presets/zcode/nuxt/hooks/chain-team-phases.sh +57 -3
  670. package/presets/zcode/nuxt/hooks/check-preset-update.mjs +4 -3
  671. package/presets/zcode/nuxt/rules/agent-team-intake.md +1 -0
  672. package/presets/zcode/nuxt/rules/agent-team-orchestrator.md +5 -2
  673. package/presets/zcode/nuxt/rules/preset-pr-checklist.md +4 -4
  674. package/presets/zcode/nuxt/rules/preset-twin-sync.md +1 -1
  675. package/presets/zcode/nuxt/team/README.md +5 -0
  676. package/presets/zcode/php-hexagonal/adapter-map.json +11 -3
  677. package/presets/zcode/php-hexagonal/hooks/README.md +2 -1
  678. package/presets/zcode/php-hexagonal/hooks/chain-team-phases.sh +57 -3
  679. package/presets/zcode/php-hexagonal/hooks/check-preset-update.mjs +4 -3
  680. package/presets/zcode/php-hexagonal/rules/agent-team-intake.md +1 -0
  681. package/presets/zcode/php-hexagonal/rules/agent-team-orchestrator.md +5 -2
  682. package/presets/zcode/php-hexagonal/rules/preset-pr-checklist.md +4 -4
  683. package/presets/zcode/php-hexagonal/rules/preset-twin-sync.md +1 -1
  684. package/presets/zcode/php-hexagonal/team/README.md +5 -0
  685. package/presets/zcode/php-laravel/adapter-map.json +11 -3
  686. package/presets/zcode/php-laravel/hooks/README.md +2 -1
  687. package/presets/zcode/php-laravel/hooks/chain-team-phases.sh +57 -3
  688. package/presets/zcode/php-laravel/hooks/check-preset-update.mjs +4 -3
  689. package/presets/zcode/php-laravel/rules/agent-team-intake.md +1 -0
  690. package/presets/zcode/php-laravel/rules/agent-team-orchestrator.md +5 -2
  691. package/presets/zcode/php-laravel/rules/preset-pr-checklist.md +4 -4
  692. package/presets/zcode/php-laravel/rules/preset-twin-sync.md +1 -1
  693. package/presets/zcode/php-laravel/team/README.md +5 -0
  694. package/presets/zcode/svelte/adapter-map.json +11 -3
  695. package/presets/zcode/svelte/hooks/README.md +2 -1
  696. package/presets/zcode/svelte/hooks/chain-team-phases.sh +57 -3
  697. package/presets/zcode/svelte/hooks/check-preset-update.mjs +4 -3
  698. package/presets/zcode/svelte/rules/agent-team-intake.md +1 -0
  699. package/presets/zcode/svelte/rules/agent-team-orchestrator.md +5 -2
  700. package/presets/zcode/svelte/rules/preset-pr-checklist.md +4 -4
  701. package/presets/zcode/svelte/rules/preset-twin-sync.md +1 -1
  702. package/presets/zcode/svelte/team/README.md +5 -0
  703. package/presets/claude/android-kotlin/hooks/guard-shell-command.sh +0 -103
  704. package/presets/claude/go/hooks/guard-shell-command.sh +0 -102
  705. package/presets/claude/mcp-ts/hooks/guard-shell-command.sh +0 -102
  706. package/presets/claude/php-hexagonal/hooks/guard-shell-command.sh +0 -103
  707. package/presets/claude/php-laravel/hooks/guard-shell-command.sh +0 -103
  708. package/presets/cursor/android-kotlin/hooks/guard-shell-command.sh +0 -80
  709. package/presets/cursor/go/hooks/guard-shell-command.sh +0 -79
  710. package/presets/cursor/ios-swift/hooks/guard-shell-command.sh +0 -79
  711. package/presets/cursor/java/hooks/guard-shell-command.sh +0 -80
  712. package/presets/cursor/mcp-ts/hooks/guard-shell-command.sh +0 -79
  713. package/presets/cursor/mol/hooks/guard-shell-command.sh +0 -77
  714. package/presets/cursor/next/hooks/guard-shell-command.sh +0 -77
  715. package/presets/cursor/nuxt/hooks/guard-shell-command.sh +0 -77
  716. package/presets/cursor/php-hexagonal/hooks/guard-shell-command.sh +0 -80
  717. package/presets/cursor/php-laravel/hooks/guard-shell-command.sh +0 -80
  718. 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,7 +32,7 @@ const {
32
32
  stripMergedConfigs,
33
33
  } = require('./lib/merged-config');
34
34
  const { otherToolInstallPresent, TOOL_INSTALL_MARKERS } = require('./lib/tool-installs');
35
- const { ENGINE_SCRIPTS, ENGINE_SOURCE_RELATIVE } = require('./lib/engine-scripts');
35
+ const { planEngineUpgrade, applyEngineUpgrade } = require('./lib/engine-upgrade');
36
36
  const {
37
37
  CLIENT_IDS,
38
38
  serverBySlug,
@@ -109,15 +109,15 @@ Usage:
109
109
  ai-rules init <cursor|claude|mavis|opencode|zcode|multi> [--preset <name>]
110
110
  ai-rules init <cursor|claude|mavis|opencode|zcode|multi> <preset-name>
111
111
  ai-rules init mcp <name...|--all> [--tools <list>] [--cwd <dir>]
112
- ai-rules update [--merge-ai-local | --check] [--cwd <dir>]
113
- ai-rules doctor [--json] [--cwd <dir>]
112
+ ai-rules update [--fix | --merge-ai-local | --check] [--no-backup] [--cwd <dir>]
113
+ ai-rules doctor [--json] [--fix] [--cwd <dir>]
114
114
  ai-rules clean <cursor|claude|mavis|opencode|zcode> [--cwd <dir>]
115
- ai-rules mcp setup <gitlab|github|yandex|all> [--tools <list>] [--yes] [--replace] [--url <url>] [--org-id <id>] [--json] [--cwd <dir>]
116
- ai-rules mcp add <gitlab|github|yandex|all> [--tools <list>] [--replace] [--json] [--cwd <dir>]
117
- ai-rules mcp remove <gitlab|github|yandex|all> [--tools <list>] [--purge] [--json] [--cwd <dir>]
118
- ai-rules mcp doctor [gitlab|github|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>]
119
119
  ai-rules mcp refresh yandex [--print] [--json] [--yc-bin <path>] [--cwd <dir>]
120
- ai-rules mcp run <gitlab|github|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)
121
121
 
122
122
  Options:
123
123
  --preset <name> Preset name (default: ${DEFAULT_PRESET})
@@ -128,6 +128,10 @@ Options:
128
128
  --check Print each .ai.local/ drift rel and write nothing
129
129
  the preset template; a file you edited is kept and its diff is
130
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)
131
135
 
132
136
  Notes:
133
137
  init merges into the target directory; same-named preset files are overwritten (no backups are kept).
@@ -157,8 +161,8 @@ Notes:
157
161
  OpenCode init copies into .opencode/ plus REPO_AGENTS.md → <cwd>/AGENTS.md; MCP merges into <cwd>/opencode.json (never ~/.config/opencode/**).
158
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).
159
163
  init multi installs every platform that has released the preset (cursor, claude, plus mavis/opencode when listed in releasedStacks). Not a clean target.
160
- 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.
161
- doctor is read-only: for every installed platform it reports missing/modified managed files, a manifest/package version mismatch, and the shared .ai.local/scripts/ engine set against presets/_shared/ai-local/scripts/ (stale-engine / missing-engine). It has no --fix and writes nothing; --json prints one object. Exit 0 = clean, 1 = findings, 2 = usage error.
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.
162
166
  When <cwd>/docs/specs/ is absent, init also seeds INDEX.md stub + _templates/* from package assets (never overwrites an existing INDEX).
163
167
  clean removes only files the last init copied and that are unchanged since; consumer files are kept.
164
168
  Merged configs are never deleted wholesale: clean strips the entries init added (shipped MCP servers, preset
@@ -166,11 +170,14 @@ Notes:
166
170
  else is left in a file init created. Shared <cwd>/AGENTS.md is removed only when no other tool install remains.
167
171
  Command forms: "init cursor --preset next", "init cursor next", "--preset next init cursor", "cursor init --preset next".
168
172
  init mcp <name> registers a third-party server from the shipped catalog into every installed client
169
- (or --tools only). Names: context7, playwright, chrome-devtools, figma-desktop (alias: figma), figma-cloud;
170
- --all selects every one. Entries merge like init: extra servers and consumer env/headers stay.
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.
171
177
  mcp setup obtains and validates credentials, writes the client entries and runs the doctor. GitLab credentials live in
172
178
  .ai-rules/mcp/credentials.env (0600); Yandex settings live in .ai-rules/mcp/config.env (no token); the GitHub token is read
173
- from the shell or from .env.github in the project root and is never written by the package. The two settings files sit in a
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
174
181
  self-ignoring .ai-rules/ (the root .gitignore is never modified). Only clients already installed are registered; --tools
175
182
  narrows or names a client explicitly. mcp commands require Node 20+ (the GitLab child declares engines >=20).
176
183
 
@@ -212,6 +219,7 @@ Examples:
212
219
  npx @bonesofspring/ai-rules mcp setup gitlab
213
220
  npx @bonesofspring/ai-rules mcp setup github
214
221
  npx @bonesofspring/ai-rules mcp setup yandex
222
+ npx @bonesofspring/ai-rules mcp setup defectdojo
215
223
  npx @bonesofspring/ai-rules mcp doctor
216
224
  npx @bonesofspring/ai-rules mcp refresh yandex
217
225
  `);
@@ -272,6 +280,14 @@ function parseArgs(argv, options = {}) {
272
280
  args.checkAiLocal = true;
273
281
  continue;
274
282
  }
283
+ if (a === '--fix') {
284
+ args.fix = true;
285
+ continue;
286
+ }
287
+ if (a === '--no-backup') {
288
+ args.noBackup = true;
289
+ continue;
290
+ }
275
291
  if (a === '--json') {
276
292
  if (options.json) args.json = true;
277
293
  else args.unknownOption = a;
@@ -740,6 +756,21 @@ function updatePresetReady(tool, presetName) {
740
756
  * Validates the whole plan before the first init so a bad manifest does not partially update.
741
757
  */
742
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
+ }
743
774
  const cwd = resolveTargetCwd(cwdOption);
744
775
  const errors = [];
745
776
  const found = [];
@@ -795,6 +826,15 @@ function cmdUpdate(cwdOption, opts) {
795
826
 
796
827
  const plan = found.map((item) => `${item.tool} (${item.preset})`).join(', ');
797
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
+ }
798
838
  // One command, one tree, one summary: each tool's pass accumulates, this flushes.
799
839
  const passOpts = { ...opts, deferAiLocalSummary: true };
800
840
  for (const item of found) {
@@ -802,17 +842,129 @@ function cmdUpdate(cwdOption, opts) {
802
842
  cmdInit(item.tool, item.preset, cwdOption, passOpts);
803
843
  }
804
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
+ }
805
864
  console.log(`\nDone. update reinstalled ${plan}`);
806
865
  }
807
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
+
808
914
  /**
809
- * Read-only install-state doctor.
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.
810
961
  *
811
962
  * Per installed platform (`.ai-rules-install.json`): missing or modified managed
812
963
  * files and a `packageVersion` mismatch. Once per project: the shared engine set
813
- * (`.ai.local/scripts/` vs the package's `presets/_shared/ai-local/scripts/`)
814
- * reported as `stale-engine` / `missing-engine`. Never writes and has no `--fix`
815
- * (a prior non-adoption): the report is the whole contract.
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.
816
968
  */
817
969
  function collectDoctorState(cwd, packageRoot) {
818
970
  const packageVersion = getPackageVersion(packageRoot);
@@ -830,13 +982,14 @@ function collectDoctorState(cwd, packageRoot) {
830
982
  manifest = null;
831
983
  }
832
984
  if (!manifest) {
833
- findings.push({ code: 'missing', path: rel, detail: 'install manifest is not readable JSON' });
985
+ findings.push({ code: 'missing', path: rel, detail: 'install manifest is not readable JSON', fixable: false });
834
986
  } else {
835
987
  if (typeof manifest.packageVersion === 'string' && manifest.packageVersion !== packageVersion) {
836
988
  findings.push({
837
989
  code: 'version-mismatch',
838
990
  path: rel,
839
991
  detail: `manifest records ${manifest.packageVersion}, package is ${packageVersion}`,
992
+ fixable: false,
840
993
  });
841
994
  }
842
995
  if (typeof manifest.schemaVersion === 'number' && manifest.schemaVersion < MANIFEST_SCHEMA_VERSION) {
@@ -844,22 +997,24 @@ function collectDoctorState(cwd, packageRoot) {
844
997
  code: 'legacy-manifest',
845
998
  path: rel,
846
999
  detail: 'schema v1 hashes consumer files too; re-run init to record a current manifest',
1000
+ fixable: false,
847
1001
  });
848
1002
  } else if (!isPlainObject(manifest.managedFiles) || Object.keys(manifest.managedFiles).length === 0) {
849
1003
  findings.push({
850
1004
  code: 'missing',
851
1005
  path: rel,
852
1006
  detail: 'schema v2 manifest has no managedFiles map; re-run init for this platform',
1007
+ fixable: false,
853
1008
  });
854
1009
  } else {
855
1010
  for (const [managedRel, expectedHash] of Object.entries(manifest.managedFiles)) {
856
1011
  const managedAbs = resolveManagedPath(cwd, managedRel);
857
1012
  if (!managedAbs || !fs.existsSync(managedAbs) || !fs.lstatSync(managedAbs).isFile()) {
858
- findings.push({ code: 'missing', path: managedRel, detail: 'managed file is absent' });
1013
+ findings.push({ code: 'missing', path: managedRel, detail: 'managed file is absent', fixable: false });
859
1014
  continue;
860
1015
  }
861
1016
  if (typeof expectedHash === 'string' && sha256File(managedAbs) !== expectedHash) {
862
- findings.push({ code: 'modified', path: managedRel, detail: 'bytes differ from the install manifest' });
1017
+ findings.push({ code: 'modified', path: managedRel, detail: 'bytes differ from the install manifest', fixable: false });
863
1018
  }
864
1019
  }
865
1020
  }
@@ -877,28 +1032,34 @@ function collectDoctorState(cwd, packageRoot) {
877
1032
  const engineFindings = [];
878
1033
  const engineRel = '.ai.local/scripts';
879
1034
  const engineDir = resolveManagedPath(cwd, engineRel);
880
- const sourceDir = path.join(packageRoot, 'presets', ...ENGINE_SOURCE_RELATIVE.split('/'));
881
1035
  const engineInstalled = Boolean(engineDir && fs.existsSync(engineDir) && fs.statSync(engineDir).isDirectory());
882
1036
  if (platforms.length === 0 && !engineInstalled) {
883
1037
  // Nothing is installed; a missing engine is not a finding for a bare tree.
884
1038
  } else if (!engineInstalled) {
885
- engineFindings.push({ code: 'missing-engine', path: engineRel, detail: 'engine directory is absent' });
1039
+ engineFindings.push({ code: 'missing-engine', path: engineRel, detail: 'engine directory is absent', fixable: false });
886
1040
  } else {
887
- for (const name of ENGINE_SCRIPTS) {
888
- const rel = `${engineRel}/${name}`;
889
- const installed = path.join(engineDir, name);
890
- const source = path.join(sourceDir, name);
891
- if (!fs.existsSync(installed)) {
892
- engineFindings.push({ code: 'missing-engine', path: rel, detail: `engine module ${name} is absent` });
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') {
893
1046
  continue;
894
1047
  }
895
- if (fs.existsSync(source) && sha256File(installed) !== sha256File(source)) {
1048
+ if (entry.state === 'missing') {
896
1049
  engineFindings.push({
897
- code: 'stale-engine',
898
- path: rel,
899
- detail: `${name} differs from presets/${ENGINE_SOURCE_RELATIVE}/${name}`,
1050
+ code: 'missing-engine',
1051
+ path: entry.rel,
1052
+ detail: entry.detail,
1053
+ fixable: false,
900
1054
  });
1055
+ continue;
901
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
+ });
902
1063
  }
903
1064
  }
904
1065
 
@@ -909,11 +1070,12 @@ function collectDoctorState(cwd, packageRoot) {
909
1070
  ok: platforms.every((platform) => platform.ok) && engine.ok,
910
1071
  platforms,
911
1072
  engine,
1073
+ prerequisites: collectPrerequisiteState(),
912
1074
  };
913
1075
  }
914
1076
 
915
- function printDoctorReport(state) {
916
- console.log('@bonesofspring/ai-rules doctor (read-only)');
1077
+ function printDoctorReport(state, opts = {}) {
1078
+ console.log(`@bonesofspring/ai-rules doctor${opts.fix ? ' --fix (post-state)' : ' (read-only)'}`);
917
1079
  console.log(`package: ${state.packageVersion}`);
918
1080
  if (state.platforms.length === 0) {
919
1081
  console.log('installed platforms: none (.ai-rules-install.json not found)');
@@ -930,6 +1092,13 @@ function printDoctorReport(state) {
930
1092
  for (const finding of state.engine.findings) {
931
1093
  console.log(` ${finding.code} ${finding.path} — ${finding.detail}`);
932
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
+ }
933
1102
  const total = state.platforms.reduce((sum, platform) => sum + platform.findings.length, 0)
934
1103
  + state.engine.findings.length;
935
1104
  console.log(`result: ${state.ok ? 'OK' : `FINDINGS (${total})`}`);
@@ -937,11 +1106,37 @@ function printDoctorReport(state) {
937
1106
 
938
1107
  function cmdDoctor(cwdOption, opts) {
939
1108
  const cwd = resolveTargetCwd(cwdOption, 2);
940
- const state = collectDoctorState(cwd, getPackageRoot());
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);
941
1130
  if (opts && opts.json) {
1131
+ if (fix) {
1132
+ state.fix = fix;
1133
+ }
942
1134
  console.log(JSON.stringify(state, null, 2));
943
1135
  } else {
944
- printDoctorReport(state);
1136
+ if (fixResult) {
1137
+ printEngineFixResult(fixResult);
1138
+ }
1139
+ printDoctorReport(state, { fix: Boolean(fix) });
945
1140
  }
946
1141
  process.exit(state.ok ? 0 : 1);
947
1142
  }
@@ -1294,12 +1489,12 @@ function printMcpHelp() {
1294
1489
  console.log(`ai-rules mcp
1295
1490
 
1296
1491
  Usage:
1297
- ai-rules mcp setup <gitlab|github|yandex|all> [--tools <list>] [--yes] [--replace] [--url <url>] [--org-id <id>] [--json] [--cwd <dir>]
1298
- ai-rules mcp add <gitlab|github|yandex|all> [--tools <list>] [--replace] [--json] [--cwd <dir>]
1299
- ai-rules mcp remove <gitlab|github|yandex|all> [--tools <list>] [--purge] [--json] [--cwd <dir>]
1300
- ai-rules mcp doctor [gitlab|github|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>]
1301
1496
  ai-rules mcp refresh yandex [--print] [--json] [--yc-bin <path>] [--cwd <dir>]
1302
- ai-rules mcp run <gitlab|github|yandex-tracker|yandex-wiki> [--print-env]
1497
+ ai-rules mcp run <gitlab|github|yandex-tracker|yandex-wiki|defectdojo> [--print-env]
1303
1498
 
1304
1499
  Options:
1305
1500
  --tools <list> Comma-separated clients (cursor, claude, mavis, opencode); default: detected
@@ -1338,6 +1533,22 @@ function printInitMcpHelp() {
1338
1533
  if (server.aliases && server.aliases.length > 0) {
1339
1534
  notes.push(`alias: ${server.aliases.join(', ')}`);
1340
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
+ }
1341
1552
  const suffix = notes.length > 0 ? ` (${notes.join('; ')})` : '';
1342
1553
  return ` ${server.slug.padEnd(width)} ${server.title}${suffix}`;
1343
1554
  });
@@ -1357,7 +1568,9 @@ Options:
1357
1568
  -h, --help Print this help
1358
1569
 
1359
1570
  Each client gets its native shape; entries merge like init, so other servers and consumer
1360
- env/headers stay.
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.
1361
1574
  `);
1362
1575
  }
1363
1576
 
@@ -1474,7 +1687,12 @@ function cmdInitMcp(argv) {
1474
1687
 
1475
1688
  let registration;
1476
1689
  try {
1477
- registration = registerCatalogServers({ cwd, clients: selection.clients, servers });
1690
+ registration = registerCatalogServers({
1691
+ cwd,
1692
+ clients: selection.clients,
1693
+ servers,
1694
+ version: packageVersion(getPackageRoot()),
1695
+ });
1478
1696
  } catch (error) {
1479
1697
  console.error(`init mcp failed: ${error instanceof Error ? error.message : String(error)}`);
1480
1698
  process.exit(1);
@@ -1490,9 +1708,54 @@ function cmdInitMcp(argv) {
1490
1708
  printer.ok('registration', `wrote ${rel}`);
1491
1709
  }
1492
1710
  }
1711
+ reportCatalogCredentials(cwd, servers, printer);
1493
1712
  printer.next('restart the MCP server in your client');
1494
1713
  }
1495
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
+
1496
1759
  const MCP_COMMANDS = new Set(['setup', 'add', 'remove', 'doctor', 'refresh', 'run']);
1497
1760
  const MCP_VALUE_OPTIONS = new Set(['--tools', '--url', '--org-id', '--yc-bin', '--cwd']);
1498
1761
  const MCP_BOOL_OPTIONS = new Set(['--yes', '--json', '--replace', '--purge', '--print', '--print-env', '--help', '-h']);
@@ -1600,7 +1863,8 @@ async function loadPackModules(packageRoot) {
1600
1863
  const envfile = await import(pathToFileURL(path.join(packageRoot, 'mcp', 'lib', 'envfile.mjs')).href);
1601
1864
  const yandex = await import(pathToFileURL(path.join(packageRoot, 'mcp', 'lib', 'yandex.mjs')).href);
1602
1865
  const github = await import(pathToFileURL(path.join(packageRoot, 'mcp', 'lib', 'github.mjs')).href);
1603
- return { envfile, yandex, github };
1866
+ const defectdojo = await import(pathToFileURL(path.join(packageRoot, 'mcp', 'lib', 'defectdojo.mjs')).href);
1867
+ return { envfile, yandex, github, defectdojo };
1604
1868
  }
1605
1869
 
1606
1870
  function parseMcpTools(value) {
@@ -1648,7 +1912,9 @@ function registerProvider({ cwd, provider, options, version, printer, selection:
1648
1912
  }
1649
1913
 
1650
1914
  async function cmdMcpSetup({ cwd, provider, options, printer, packageRoot, modules, version }) {
1651
- const providers = provider === 'all' ? ['gitlab', 'yandex', 'github'] : [provider];
1915
+ const providers = provider === 'all'
1916
+ ? ['gitlab', 'yandex', 'github', 'defectdojo']
1917
+ : [provider];
1652
1918
  const results = [];
1653
1919
 
1654
1920
  for (const current of providers) {
@@ -1660,11 +1926,22 @@ async function cmdMcpSetup({ cwd, provider, options, printer, packageRoot, modul
1660
1926
  process.exit(1);
1661
1927
  }
1662
1928
 
1663
- const credentialResult = current === 'gitlab'
1664
- ? await credentials.setupGitlab({ cwd, options, envfile: modules.envfile })
1665
- : current === 'github'
1666
- ? await credentials.setupGithub({ cwd, options, github: modules.github })
1667
- : 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
+ }
1668
1945
 
1669
1946
  for (const warning of credentialResult.warnings || []) {
1670
1947
  printer.warn('credentials', warning);
@@ -1693,6 +1970,7 @@ async function cmdMcpSetup({ cwd, provider, options, printer, packageRoot, modul
1693
1970
  envfile: modules.envfile,
1694
1971
  yandex: modules.yandex,
1695
1972
  github: modules.github,
1973
+ defectdojo: modules.defectdojo,
1696
1974
  options,
1697
1975
  });
1698
1976
  renderDoctor(doctor, printer);
@@ -1709,7 +1987,7 @@ async function cmdMcpSetup({ cwd, provider, options, printer, packageRoot, modul
1709
1987
  (server) => ['runtime', 'registration', 'credentials'].some((area) => server.checks[area].status === 'fail'),
1710
1988
  );
1711
1989
  const upstreamCredentialClass = doctor.servers.some(
1712
- (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),
1713
1991
  );
1714
1992
  if (credentialClass || upstreamCredentialClass) {
1715
1993
  printer.result({ command: 'setup', ok: false, providers: results });
@@ -1774,6 +2052,7 @@ async function cmdMcpDoctor({ cwd, provider, options, printer, packageRoot, modu
1774
2052
  envfile: modules.envfile,
1775
2053
  yandex: modules.yandex,
1776
2054
  github: modules.github,
2055
+ defectdojo: modules.defectdojo,
1777
2056
  options,
1778
2057
  });
1779
2058
  renderDoctor(doctor, printer);
@@ -1822,7 +2101,7 @@ function cmdMcpRefresh({ cwd, options, packageRoot }) {
1822
2101
  async function cmdMcpRun({ slug, options, packageRoot }) {
1823
2102
  const server = serverBySlug(slug);
1824
2103
  if (!server) {
1825
- console.error(`Unknown server: ${slug ?? '(none)'}. Use gitlab, github, yandex-tracker, or yandex-wiki.`);
2104
+ console.error(`Unknown server: ${slug ?? '(none)'}. Use gitlab, github, yandex-tracker, yandex-wiki, or defectdojo.`);
1826
2105
  process.exit(1);
1827
2106
  }
1828
2107
  if (!options.printEnv && (process.stdin.isTTY || process.stdout.isTTY)) {
@@ -1830,8 +2109,8 @@ async function cmdMcpRun({ slug, options, packageRoot }) {
1830
2109
  console.error('next: ai-rules mcp doctor');
1831
2110
  process.exit(1);
1832
2111
  }
1833
- if (options.printEnv && !['gitlab', 'github'].includes(server.provider)) {
1834
- console.error('--print-env is supported for gitlab and github only.');
2112
+ if (options.printEnv && !['gitlab', 'github', 'defectdojo'].includes(server.provider)) {
2113
+ console.error('--print-env is supported for gitlab, github, and defectdojo only.');
1835
2114
  process.exit(1);
1836
2115
  }
1837
2116
  const entry = runtimeEntryPath(packageRoot, server.entry);
@@ -1873,6 +2152,18 @@ async function cmdMcpRun({ slug, options, packageRoot }) {
1873
2152
  }
1874
2153
  }
1875
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
+
1876
2167
  const args = [entry, ...server.argv];
1877
2168
  if (options.printEnv) {
1878
2169
  args.push('--print-env');
@@ -1969,13 +2260,13 @@ async function cmdMcp(argv) {
1969
2260
  provider = providerArg ?? 'all';
1970
2261
  } else {
1971
2262
  if (providerArg === undefined) {
1972
- console.error(`Missing provider. Use: mcp ${command} <gitlab|github|yandex|all>`);
2263
+ console.error(`Missing provider. Use: mcp ${command} <gitlab|github|yandex|defectdojo|all>`);
1973
2264
  process.exit(1);
1974
2265
  }
1975
2266
  provider = providerArg;
1976
2267
  }
1977
- if (!['gitlab', 'github', 'yandex', 'all'].includes(provider)) {
1978
- console.error(`Unknown provider: ${provider}. Use gitlab, github, 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.`);
1979
2270
  process.exit(1);
1980
2271
  }
1981
2272
 
@@ -2027,8 +2318,12 @@ function main() {
2027
2318
  console.error(`Unknown option: ${parsed.unknownOption}`);
2028
2319
  process.exit(2);
2029
2320
  }
2321
+ if (parsed.mergeAiLocal || parsed.checkAiLocal || parsed.noBackup) {
2322
+ console.error('doctor takes --json, --fix, and --cwd only.');
2323
+ process.exit(2);
2324
+ }
2030
2325
  if (parsed.preset || parsed.presetError || parsed.cwdError) {
2031
- console.error('doctor takes --json and --cwd only.');
2326
+ console.error('doctor takes --json, --fix, and --cwd only.');
2032
2327
  process.exit(2);
2033
2328
  }
2034
2329
  if (parsed._.length > 0) {
@@ -2061,6 +2356,16 @@ function main() {
2061
2356
  const { command, tool, preset } = normalizeInitClean(parsed);
2062
2357
 
2063
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
+ }
2064
2369
  if (!tool || !INIT_TARGETS.has(tool)) {
2065
2370
  console.error(
2066
2371
  'Missing or invalid tool. Use: init cursor|claude|mavis|opencode|zcode|multi [--preset next]',
@@ -2093,6 +2398,10 @@ function main() {
2093
2398
  console.error('--merge-ai-local and --check apply to init and update.');
2094
2399
  process.exit(1);
2095
2400
  }
2401
+ if (parsed.fix || parsed.noBackup) {
2402
+ console.error('--fix and --no-backup apply to update and doctor.');
2403
+ process.exit(1);
2404
+ }
2096
2405
  if (tool === 'multi') {
2097
2406
  console.error('clean multi is not supported. Clean each tool: cursor, claude, mavis, opencode.');
2098
2407
  process.exit(1);