@bonesofspring/ai-rules 0.2.60 → 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 (433) hide show
  1. package/CHANGELOG.md +77 -0
  2. package/README.md +59 -26
  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 +29 -14
  15. package/docs/MCP-CATALOG.md +30 -2
  16. package/docs/MCP-SETUP.md +30 -6
  17. package/docs/OPENCODE.md +22 -2
  18. package/docs/PLATFORMS.md +38 -0
  19. package/docs/PRESET-CONTRIBUTION.md +11 -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/gitlab.mjs +5 -1
  24. package/mcp/lib/defectdojo.mjs +249 -0
  25. package/mcp/lib/yandex.mjs +39 -15
  26. package/package.json +9 -3
  27. package/presets/_shared/ai-local/scripts/lock.mjs +139 -19
  28. package/presets/_shared/ai-local/scripts/signals.mjs +17 -1
  29. package/presets/_shared/ai-local/scripts/team-db-api.mjs +496 -67
  30. package/presets/_shared/ai-local/scripts/team-db-dashboard.mjs +816 -5
  31. package/presets/_shared/ai-local/scripts/team-db-openapi.mjs +761 -6
  32. package/presets/_shared/ai-local/scripts/team-db-project.mjs +10 -0
  33. package/presets/_shared/ai-local/scripts/team-db-scheduler.mjs +2360 -0
  34. package/presets/_shared/ai-local/scripts/team-db-schema.mjs +87 -0
  35. package/presets/_shared/ai-local/scripts/team-db.mjs +151 -9
  36. package/presets/_shared/ai-local/scripts/upstream-research.mjs +2961 -0
  37. package/presets/_shared/core/agent-team/agent-artifact-contracts.md +13 -0
  38. package/presets/_shared/hooks/README.md +23 -3
  39. package/presets/_shared/hooks/chain-team-phases.sh.tmpl +57 -3
  40. package/presets/{claude/nuxt/hooks/guard-shell-command.sh → _shared/hooks/guard-shell-command.mjs.tmpl} +29 -35
  41. package/presets/_shared/hooks/run-hook.mjs +102 -0
  42. package/presets/claude/android-kotlin/hooks/README.md +4 -3
  43. package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +57 -3
  44. package/presets/claude/android-kotlin/hooks/examples/README.md +2 -2
  45. package/presets/claude/android-kotlin/hooks/guard-shell-command.mjs +96 -0
  46. package/presets/claude/android-kotlin/hooks/run-hook.mjs +102 -0
  47. package/presets/claude/android-kotlin/settings.json +2 -2
  48. package/presets/claude/android-kotlin/team/README.md +5 -0
  49. package/presets/claude/go/hooks/README.md +4 -3
  50. package/presets/claude/go/hooks/chain-team-phases.sh +57 -3
  51. package/presets/claude/go/hooks/examples/README.md +2 -2
  52. package/presets/claude/go/hooks/guard-shell-command.mjs +95 -0
  53. package/presets/claude/go/hooks/run-hook.mjs +102 -0
  54. package/presets/claude/go/settings.json +2 -2
  55. package/presets/claude/go/team/README.md +5 -0
  56. package/presets/claude/ios-swift/hooks/README.md +4 -3
  57. package/presets/claude/ios-swift/hooks/chain-team-phases.sh +57 -3
  58. package/presets/claude/ios-swift/hooks/examples/README.md +2 -2
  59. package/presets/claude/ios-swift/hooks/guard-shell-command.mjs +95 -0
  60. package/presets/claude/ios-swift/hooks/run-hook.mjs +102 -0
  61. package/presets/claude/ios-swift/settings.json +2 -2
  62. package/presets/claude/ios-swift/team/README.md +5 -0
  63. package/presets/claude/java/hooks/README.md +4 -3
  64. package/presets/claude/java/hooks/chain-team-phases.sh +57 -3
  65. package/presets/claude/java/hooks/examples/README.md +2 -2
  66. package/presets/claude/java/hooks/{guard-shell-command.sh → guard-shell-command.mjs} +31 -38
  67. package/presets/claude/java/hooks/run-hook.mjs +102 -0
  68. package/presets/claude/java/settings.json +2 -2
  69. package/presets/claude/java/team/README.md +5 -0
  70. package/presets/claude/mcp-ts/hooks/README.md +4 -3
  71. package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +57 -3
  72. package/presets/claude/mcp-ts/hooks/examples/README.md +1 -1
  73. package/presets/claude/mcp-ts/hooks/guard-shell-command.mjs +95 -0
  74. package/presets/claude/mcp-ts/hooks/run-hook.mjs +102 -0
  75. package/presets/claude/mcp-ts/settings.json +2 -2
  76. package/presets/claude/mcp-ts/team/README.md +5 -0
  77. package/presets/claude/mol/hooks/README.md +20 -0
  78. package/presets/claude/mol/hooks/chain-team-phases.sh +57 -3
  79. package/presets/claude/{svelte/hooks/guard-shell-command.sh → mol/hooks/guard-shell-command.mjs} +29 -35
  80. package/presets/claude/mol/hooks/run-hook.mjs +102 -0
  81. package/presets/claude/mol/settings.json +2 -2
  82. package/presets/claude/mol/team/README.md +5 -0
  83. package/presets/claude/next/agents/build-verifier.md +2 -0
  84. package/presets/claude/next/agents/code-reviewer.md +2 -0
  85. package/presets/claude/next/agents/feature-developer.md +1 -0
  86. package/presets/claude/next/agents/task-analyst.md +4 -0
  87. package/presets/claude/next/agents/task-router.md +5 -3
  88. package/presets/claude/next/commands/README.md +1 -0
  89. package/presets/claude/next/commands/task-continue.md +1 -1
  90. package/presets/claude/next/commands/upstream-research.md +23 -0
  91. package/presets/claude/next/hooks/README.md +4 -3
  92. package/presets/claude/next/hooks/chain-team-phases.sh +57 -3
  93. package/presets/claude/next/hooks/examples/README.md +2 -2
  94. package/presets/claude/next/hooks/guard-shell-command.mjs +94 -0
  95. package/presets/claude/next/hooks/run-hook.mjs +102 -0
  96. package/presets/claude/next/settings.json +2 -2
  97. package/presets/claude/next/team/README.md +23 -0
  98. package/presets/claude/next/team/upstream/config.json +31 -0
  99. package/presets/claude/next/team/upstream/digest-template.md +55 -0
  100. package/presets/claude/next/team/upstream/opencode.json +34 -0
  101. package/presets/claude/next/team/upstream/projects.json +4 -0
  102. package/presets/claude/next/team/upstream/prompt.md +77 -0
  103. package/presets/claude/next/team/upstream/signatures.json +9 -0
  104. package/presets/claude/nuxt/hooks/README.md +4 -3
  105. package/presets/claude/nuxt/hooks/chain-team-phases.sh +57 -3
  106. package/presets/claude/nuxt/hooks/examples/README.md +2 -2
  107. package/presets/claude/{ios-swift/hooks/guard-shell-command.sh → nuxt/hooks/guard-shell-command.mjs} +29 -37
  108. package/presets/claude/nuxt/hooks/run-hook.mjs +102 -0
  109. package/presets/claude/nuxt/settings.json +2 -2
  110. package/presets/claude/nuxt/team/README.md +5 -0
  111. package/presets/claude/php-hexagonal/hooks/README.md +4 -3
  112. package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +57 -3
  113. package/presets/claude/php-hexagonal/hooks/examples/README.md +2 -2
  114. package/presets/claude/php-hexagonal/hooks/guard-shell-command.mjs +96 -0
  115. package/presets/claude/php-hexagonal/hooks/run-hook.mjs +102 -0
  116. package/presets/claude/php-hexagonal/settings.json +2 -2
  117. package/presets/claude/php-hexagonal/team/README.md +5 -0
  118. package/presets/claude/php-laravel/hooks/README.md +4 -3
  119. package/presets/claude/php-laravel/hooks/chain-team-phases.sh +57 -3
  120. package/presets/claude/php-laravel/hooks/examples/README.md +2 -2
  121. package/presets/claude/php-laravel/hooks/guard-shell-command.mjs +96 -0
  122. package/presets/claude/php-laravel/hooks/run-hook.mjs +102 -0
  123. package/presets/claude/php-laravel/settings.json +2 -2
  124. package/presets/claude/php-laravel/team/README.md +5 -0
  125. package/presets/claude/svelte/hooks/README.md +4 -3
  126. package/presets/claude/svelte/hooks/chain-team-phases.sh +57 -3
  127. package/presets/claude/svelte/hooks/examples/README.md +2 -2
  128. package/presets/claude/svelte/hooks/guard-shell-command.mjs +94 -0
  129. package/presets/claude/svelte/hooks/run-hook.mjs +102 -0
  130. package/presets/claude/svelte/settings.json +2 -2
  131. package/presets/claude/svelte/team/README.md +5 -0
  132. package/presets/cursor/android-kotlin/hooks/README.md +2 -1
  133. package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +57 -3
  134. package/presets/cursor/android-kotlin/hooks/examples/README.md +1 -1
  135. package/presets/cursor/android-kotlin/hooks/guard-shell-command.mjs +96 -0
  136. package/presets/cursor/android-kotlin/hooks/run-hook.mjs +102 -0
  137. package/presets/cursor/android-kotlin/hooks.json +2 -2
  138. package/presets/cursor/android-kotlin/team/README.md +5 -0
  139. package/presets/cursor/go/hooks/README.md +2 -1
  140. package/presets/cursor/go/hooks/chain-team-phases.sh +57 -3
  141. package/presets/cursor/go/hooks/examples/README.md +1 -1
  142. package/presets/cursor/go/hooks/guard-shell-command.mjs +95 -0
  143. package/presets/cursor/go/hooks/run-hook.mjs +102 -0
  144. package/presets/cursor/go/hooks.json +2 -2
  145. package/presets/cursor/go/team/README.md +5 -0
  146. package/presets/cursor/ios-swift/hooks/README.md +2 -1
  147. package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +57 -3
  148. package/presets/cursor/ios-swift/hooks/examples/README.md +1 -1
  149. package/presets/cursor/ios-swift/hooks/guard-shell-command.mjs +95 -0
  150. package/presets/cursor/ios-swift/hooks/run-hook.mjs +102 -0
  151. package/presets/cursor/ios-swift/hooks.json +2 -2
  152. package/presets/cursor/ios-swift/team/README.md +5 -0
  153. package/presets/cursor/java/hooks/README.md +2 -1
  154. package/presets/cursor/java/hooks/chain-team-phases.sh +57 -3
  155. package/presets/cursor/java/hooks/examples/README.md +1 -1
  156. package/presets/cursor/java/hooks/guard-shell-command.mjs +96 -0
  157. package/presets/cursor/java/hooks/run-hook.mjs +102 -0
  158. package/presets/cursor/java/hooks.json +2 -2
  159. package/presets/cursor/java/team/README.md +5 -0
  160. package/presets/cursor/mcp-ts/hooks/README.md +2 -1
  161. package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +57 -3
  162. package/presets/cursor/mcp-ts/hooks/guard-shell-command.mjs +95 -0
  163. package/presets/cursor/mcp-ts/hooks/run-hook.mjs +102 -0
  164. package/presets/cursor/mcp-ts/hooks.json +2 -2
  165. package/presets/cursor/mcp-ts/team/README.md +5 -0
  166. package/presets/cursor/mol/hooks/README.md +2 -1
  167. package/presets/cursor/mol/hooks/chain-team-phases.sh +57 -3
  168. package/presets/cursor/mol/hooks/examples/README.md +1 -1
  169. package/presets/{claude/next/hooks/guard-shell-command.sh → cursor/mol/hooks/guard-shell-command.mjs} +29 -35
  170. package/presets/cursor/mol/hooks/run-hook.mjs +102 -0
  171. package/presets/cursor/mol/hooks.json +2 -2
  172. package/presets/cursor/mol/team/README.md +5 -0
  173. package/presets/cursor/next/agents/build-verifier.md +2 -0
  174. package/presets/cursor/next/agents/code-reviewer.md +2 -0
  175. package/presets/cursor/next/agents/feature-developer.md +1 -0
  176. package/presets/cursor/next/agents/task-analyst.md +4 -0
  177. package/presets/cursor/next/agents/task-router.md +5 -3
  178. package/presets/cursor/next/commands/README.md +1 -0
  179. package/presets/cursor/next/commands/task-continue.md +1 -1
  180. package/presets/cursor/next/commands/upstream-research.md +23 -0
  181. package/presets/cursor/next/hooks/README.md +2 -1
  182. package/presets/cursor/next/hooks/chain-team-phases.sh +57 -3
  183. package/presets/cursor/next/hooks/examples/README.md +1 -1
  184. package/presets/cursor/next/hooks/guard-shell-command.mjs +94 -0
  185. package/presets/cursor/next/hooks/run-hook.mjs +102 -0
  186. package/presets/cursor/next/hooks.json +2 -2
  187. package/presets/cursor/next/team/README.md +23 -0
  188. package/presets/cursor/next/team/upstream/config.json +31 -0
  189. package/presets/cursor/next/team/upstream/digest-template.md +55 -0
  190. package/presets/cursor/next/team/upstream/opencode.json +34 -0
  191. package/presets/cursor/next/team/upstream/projects.json +4 -0
  192. package/presets/cursor/next/team/upstream/prompt.md +77 -0
  193. package/presets/cursor/next/team/upstream/signatures.json +9 -0
  194. package/presets/cursor/nuxt/hooks/README.md +2 -1
  195. package/presets/cursor/nuxt/hooks/chain-team-phases.sh +57 -3
  196. package/presets/cursor/nuxt/hooks/examples/README.md +1 -1
  197. package/presets/cursor/nuxt/hooks/guard-shell-command.mjs +94 -0
  198. package/presets/cursor/nuxt/hooks/run-hook.mjs +102 -0
  199. package/presets/cursor/nuxt/hooks.json +2 -2
  200. package/presets/cursor/nuxt/team/README.md +5 -0
  201. package/presets/cursor/php-hexagonal/hooks/README.md +2 -1
  202. package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +57 -3
  203. package/presets/cursor/php-hexagonal/hooks/examples/README.md +1 -1
  204. package/presets/cursor/php-hexagonal/hooks/guard-shell-command.mjs +96 -0
  205. package/presets/cursor/php-hexagonal/hooks/run-hook.mjs +102 -0
  206. package/presets/cursor/php-hexagonal/hooks.json +2 -2
  207. package/presets/cursor/php-hexagonal/team/README.md +5 -0
  208. package/presets/cursor/php-laravel/hooks/README.md +2 -1
  209. package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +57 -3
  210. package/presets/cursor/php-laravel/hooks/examples/README.md +1 -1
  211. package/presets/cursor/php-laravel/hooks/guard-shell-command.mjs +96 -0
  212. package/presets/cursor/php-laravel/hooks/run-hook.mjs +102 -0
  213. package/presets/cursor/php-laravel/hooks.json +2 -2
  214. package/presets/cursor/php-laravel/team/README.md +5 -0
  215. package/presets/cursor/svelte/hooks/README.md +2 -1
  216. package/presets/cursor/svelte/hooks/chain-team-phases.sh +57 -3
  217. package/presets/cursor/svelte/hooks/examples/README.md +1 -1
  218. package/presets/cursor/svelte/hooks/guard-shell-command.mjs +94 -0
  219. package/presets/cursor/svelte/hooks/run-hook.mjs +102 -0
  220. package/presets/cursor/svelte/hooks.json +2 -2
  221. package/presets/cursor/svelte/team/README.md +5 -0
  222. package/presets/mavis/android-kotlin/adapter-map.json +11 -3
  223. package/presets/mavis/android-kotlin/hooks/README.md +2 -1
  224. package/presets/mavis/android-kotlin/hooks/chain-team-phases.sh +57 -3
  225. package/presets/mavis/android-kotlin/team/README.md +5 -0
  226. package/presets/mavis/go/adapter-map.json +11 -3
  227. package/presets/mavis/go/hooks/README.md +2 -1
  228. package/presets/mavis/go/hooks/chain-team-phases.sh +57 -3
  229. package/presets/mavis/go/team/README.md +5 -0
  230. package/presets/mavis/ios-swift/adapter-map.json +11 -3
  231. package/presets/mavis/ios-swift/hooks/README.md +2 -1
  232. package/presets/mavis/ios-swift/hooks/chain-team-phases.sh +57 -3
  233. package/presets/mavis/ios-swift/team/README.md +5 -0
  234. package/presets/mavis/java/adapter-map.json +11 -3
  235. package/presets/mavis/java/hooks/README.md +2 -1
  236. package/presets/mavis/java/hooks/chain-team-phases.sh +57 -3
  237. package/presets/mavis/java/team/README.md +5 -0
  238. package/presets/mavis/mcp-ts/adapter-map.json +11 -3
  239. package/presets/mavis/mcp-ts/hooks/README.md +2 -1
  240. package/presets/mavis/mcp-ts/hooks/chain-team-phases.sh +57 -3
  241. package/presets/mavis/mcp-ts/team/README.md +5 -0
  242. package/presets/mavis/mol/adapter-map.json +11 -3
  243. package/presets/mavis/mol/hooks/README.md +2 -1
  244. package/presets/mavis/mol/hooks/chain-team-phases.sh +57 -3
  245. package/presets/mavis/mol/team/README.md +5 -0
  246. package/presets/mavis/next/adapter-map.json +67 -3
  247. package/presets/mavis/next/agents/build-verifier.md +2 -0
  248. package/presets/mavis/next/agents/code-reviewer.md +2 -0
  249. package/presets/mavis/next/agents/feature-developer.md +1 -0
  250. package/presets/mavis/next/agents/task-analyst.md +4 -0
  251. package/presets/mavis/next/agents/task-router.md +5 -3
  252. package/presets/mavis/next/commands/README.md +1 -0
  253. package/presets/mavis/next/commands/task-continue.md +1 -1
  254. package/presets/mavis/next/commands/upstream-research.md +18 -0
  255. package/presets/mavis/next/hooks/README.md +2 -1
  256. package/presets/mavis/next/hooks/chain-team-phases.sh +57 -3
  257. package/presets/mavis/next/team/README.md +23 -0
  258. package/presets/mavis/next/team/upstream/config.json +31 -0
  259. package/presets/mavis/next/team/upstream/digest-template.md +55 -0
  260. package/presets/mavis/next/team/upstream/opencode.json +34 -0
  261. package/presets/mavis/next/team/upstream/projects.json +4 -0
  262. package/presets/mavis/next/team/upstream/prompt.md +77 -0
  263. package/presets/mavis/next/team/upstream/signatures.json +9 -0
  264. package/presets/mavis/nuxt/adapter-map.json +11 -3
  265. package/presets/mavis/nuxt/hooks/README.md +2 -1
  266. package/presets/mavis/nuxt/hooks/chain-team-phases.sh +57 -3
  267. package/presets/mavis/nuxt/team/README.md +5 -0
  268. package/presets/mavis/php-hexagonal/adapter-map.json +11 -3
  269. package/presets/mavis/php-hexagonal/hooks/README.md +2 -1
  270. package/presets/mavis/php-hexagonal/hooks/chain-team-phases.sh +57 -3
  271. package/presets/mavis/php-hexagonal/team/README.md +5 -0
  272. package/presets/mavis/php-laravel/adapter-map.json +11 -3
  273. package/presets/mavis/php-laravel/hooks/README.md +2 -1
  274. package/presets/mavis/php-laravel/hooks/chain-team-phases.sh +57 -3
  275. package/presets/mavis/php-laravel/team/README.md +5 -0
  276. package/presets/mavis/svelte/adapter-map.json +11 -3
  277. package/presets/mavis/svelte/hooks/README.md +2 -1
  278. package/presets/mavis/svelte/hooks/chain-team-phases.sh +57 -3
  279. package/presets/mavis/svelte/team/README.md +5 -0
  280. package/presets/opencode/android-kotlin/OPENCODE.md +1 -1
  281. package/presets/opencode/android-kotlin/README.md +1 -1
  282. package/presets/opencode/android-kotlin/adapter-map.json +11 -3
  283. package/presets/opencode/android-kotlin/hooks/README.md +3 -2
  284. package/presets/opencode/android-kotlin/hooks/chain-team-phases.sh +57 -3
  285. package/presets/opencode/android-kotlin/team/README.md +5 -0
  286. package/presets/opencode/go/OPENCODE.md +1 -1
  287. package/presets/opencode/go/README.md +1 -1
  288. package/presets/opencode/go/adapter-map.json +11 -3
  289. package/presets/opencode/go/hooks/README.md +3 -2
  290. package/presets/opencode/go/hooks/chain-team-phases.sh +57 -3
  291. package/presets/opencode/go/team/README.md +5 -0
  292. package/presets/opencode/ios-swift/OPENCODE.md +1 -1
  293. package/presets/opencode/ios-swift/README.md +1 -1
  294. package/presets/opencode/ios-swift/adapter-map.json +11 -3
  295. package/presets/opencode/ios-swift/hooks/README.md +3 -2
  296. package/presets/opencode/ios-swift/hooks/chain-team-phases.sh +57 -3
  297. package/presets/opencode/ios-swift/team/README.md +5 -0
  298. package/presets/opencode/java/OPENCODE.md +1 -1
  299. package/presets/opencode/java/README.md +1 -1
  300. package/presets/opencode/java/adapter-map.json +11 -3
  301. package/presets/opencode/java/hooks/README.md +3 -2
  302. package/presets/opencode/java/hooks/chain-team-phases.sh +57 -3
  303. package/presets/opencode/java/team/README.md +5 -0
  304. package/presets/opencode/mcp-ts/OPENCODE.md +1 -1
  305. package/presets/opencode/mcp-ts/README.md +1 -1
  306. package/presets/opencode/mcp-ts/adapter-map.json +11 -3
  307. package/presets/opencode/mcp-ts/hooks/README.md +3 -2
  308. package/presets/opencode/mcp-ts/hooks/chain-team-phases.sh +57 -3
  309. package/presets/opencode/mcp-ts/team/README.md +5 -0
  310. package/presets/opencode/mol/OPENCODE.md +1 -1
  311. package/presets/opencode/mol/README.md +1 -1
  312. package/presets/opencode/mol/adapter-map.json +11 -3
  313. package/presets/opencode/mol/hooks/README.md +3 -2
  314. package/presets/opencode/mol/hooks/chain-team-phases.sh +57 -3
  315. package/presets/opencode/mol/team/README.md +5 -0
  316. package/presets/opencode/next/OPENCODE.md +1 -1
  317. package/presets/opencode/next/README.md +1 -1
  318. package/presets/opencode/next/adapter-map.json +67 -3
  319. package/presets/opencode/next/agents/build-verifier.md +2 -0
  320. package/presets/opencode/next/agents/code-reviewer.md +2 -0
  321. package/presets/opencode/next/agents/feature-developer.md +1 -0
  322. package/presets/opencode/next/agents/task-analyst.md +4 -0
  323. package/presets/opencode/next/agents/task-router.md +5 -3
  324. package/presets/opencode/next/commands/README.md +1 -0
  325. package/presets/opencode/next/commands/task-continue.md +1 -1
  326. package/presets/opencode/next/commands/upstream-research.md +26 -0
  327. package/presets/opencode/next/hooks/README.md +3 -2
  328. package/presets/opencode/next/hooks/chain-team-phases.sh +57 -3
  329. package/presets/opencode/next/team/README.md +23 -0
  330. package/presets/opencode/next/team/upstream/config.json +31 -0
  331. package/presets/opencode/next/team/upstream/digest-template.md +55 -0
  332. package/presets/opencode/next/team/upstream/opencode.json +34 -0
  333. package/presets/opencode/next/team/upstream/projects.json +4 -0
  334. package/presets/opencode/next/team/upstream/prompt.md +77 -0
  335. package/presets/opencode/next/team/upstream/signatures.json +9 -0
  336. package/presets/opencode/nuxt/OPENCODE.md +1 -1
  337. package/presets/opencode/nuxt/README.md +1 -1
  338. package/presets/opencode/nuxt/adapter-map.json +11 -3
  339. package/presets/opencode/nuxt/hooks/README.md +3 -2
  340. package/presets/opencode/nuxt/hooks/chain-team-phases.sh +57 -3
  341. package/presets/opencode/nuxt/team/README.md +5 -0
  342. package/presets/opencode/php-hexagonal/OPENCODE.md +1 -1
  343. package/presets/opencode/php-hexagonal/README.md +1 -1
  344. package/presets/opencode/php-hexagonal/adapter-map.json +11 -3
  345. package/presets/opencode/php-hexagonal/hooks/README.md +3 -2
  346. package/presets/opencode/php-hexagonal/hooks/chain-team-phases.sh +57 -3
  347. package/presets/opencode/php-hexagonal/team/README.md +5 -0
  348. package/presets/opencode/php-laravel/OPENCODE.md +1 -1
  349. package/presets/opencode/php-laravel/README.md +1 -1
  350. package/presets/opencode/php-laravel/adapter-map.json +11 -3
  351. package/presets/opencode/php-laravel/hooks/README.md +3 -2
  352. package/presets/opencode/php-laravel/hooks/chain-team-phases.sh +57 -3
  353. package/presets/opencode/php-laravel/team/README.md +5 -0
  354. package/presets/opencode/svelte/OPENCODE.md +1 -1
  355. package/presets/opencode/svelte/README.md +1 -1
  356. package/presets/opencode/svelte/adapter-map.json +11 -3
  357. package/presets/opencode/svelte/hooks/README.md +3 -2
  358. package/presets/opencode/svelte/hooks/chain-team-phases.sh +57 -3
  359. package/presets/opencode/svelte/team/README.md +5 -0
  360. package/presets/zcode/android-kotlin/adapter-map.json +11 -3
  361. package/presets/zcode/android-kotlin/hooks/README.md +2 -1
  362. package/presets/zcode/android-kotlin/hooks/chain-team-phases.sh +57 -3
  363. package/presets/zcode/android-kotlin/team/README.md +5 -0
  364. package/presets/zcode/go/adapter-map.json +11 -3
  365. package/presets/zcode/go/hooks/README.md +2 -1
  366. package/presets/zcode/go/hooks/chain-team-phases.sh +57 -3
  367. package/presets/zcode/go/team/README.md +5 -0
  368. package/presets/zcode/ios-swift/adapter-map.json +11 -3
  369. package/presets/zcode/ios-swift/hooks/README.md +2 -1
  370. package/presets/zcode/ios-swift/hooks/chain-team-phases.sh +57 -3
  371. package/presets/zcode/ios-swift/team/README.md +5 -0
  372. package/presets/zcode/java/adapter-map.json +11 -3
  373. package/presets/zcode/java/hooks/README.md +2 -1
  374. package/presets/zcode/java/hooks/chain-team-phases.sh +57 -3
  375. package/presets/zcode/java/team/README.md +5 -0
  376. package/presets/zcode/mcp-ts/adapter-map.json +11 -3
  377. package/presets/zcode/mcp-ts/hooks/README.md +2 -1
  378. package/presets/zcode/mcp-ts/hooks/chain-team-phases.sh +57 -3
  379. package/presets/zcode/mcp-ts/team/README.md +5 -0
  380. package/presets/zcode/mol/adapter-map.json +11 -3
  381. package/presets/zcode/mol/hooks/README.md +2 -1
  382. package/presets/zcode/mol/hooks/chain-team-phases.sh +57 -3
  383. package/presets/zcode/mol/team/README.md +5 -0
  384. package/presets/zcode/next/adapter-map.json +67 -3
  385. package/presets/zcode/next/agents/build-verifier.md +2 -0
  386. package/presets/zcode/next/agents/code-reviewer.md +2 -0
  387. package/presets/zcode/next/agents/feature-developer.md +1 -0
  388. package/presets/zcode/next/agents/task-analyst.md +4 -0
  389. package/presets/zcode/next/agents/task-router.md +5 -3
  390. package/presets/zcode/next/commands/README.md +1 -0
  391. package/presets/zcode/next/commands/task-continue.md +1 -1
  392. package/presets/zcode/next/commands/upstream-research.md +26 -0
  393. package/presets/zcode/next/hooks/README.md +2 -1
  394. package/presets/zcode/next/hooks/chain-team-phases.sh +57 -3
  395. package/presets/zcode/next/team/README.md +23 -0
  396. package/presets/zcode/next/team/upstream/config.json +31 -0
  397. package/presets/zcode/next/team/upstream/digest-template.md +55 -0
  398. package/presets/zcode/next/team/upstream/opencode.json +34 -0
  399. package/presets/zcode/next/team/upstream/projects.json +4 -0
  400. package/presets/zcode/next/team/upstream/prompt.md +77 -0
  401. package/presets/zcode/next/team/upstream/signatures.json +9 -0
  402. package/presets/zcode/nuxt/adapter-map.json +11 -3
  403. package/presets/zcode/nuxt/hooks/README.md +2 -1
  404. package/presets/zcode/nuxt/hooks/chain-team-phases.sh +57 -3
  405. package/presets/zcode/nuxt/team/README.md +5 -0
  406. package/presets/zcode/php-hexagonal/adapter-map.json +11 -3
  407. package/presets/zcode/php-hexagonal/hooks/README.md +2 -1
  408. package/presets/zcode/php-hexagonal/hooks/chain-team-phases.sh +57 -3
  409. package/presets/zcode/php-hexagonal/team/README.md +5 -0
  410. package/presets/zcode/php-laravel/adapter-map.json +11 -3
  411. package/presets/zcode/php-laravel/hooks/README.md +2 -1
  412. package/presets/zcode/php-laravel/hooks/chain-team-phases.sh +57 -3
  413. package/presets/zcode/php-laravel/team/README.md +5 -0
  414. package/presets/zcode/svelte/adapter-map.json +11 -3
  415. package/presets/zcode/svelte/hooks/README.md +2 -1
  416. package/presets/zcode/svelte/hooks/chain-team-phases.sh +57 -3
  417. package/presets/zcode/svelte/team/README.md +5 -0
  418. package/presets/claude/android-kotlin/hooks/guard-shell-command.sh +0 -103
  419. package/presets/claude/go/hooks/guard-shell-command.sh +0 -102
  420. package/presets/claude/mcp-ts/hooks/guard-shell-command.sh +0 -102
  421. package/presets/claude/php-hexagonal/hooks/guard-shell-command.sh +0 -103
  422. package/presets/claude/php-laravel/hooks/guard-shell-command.sh +0 -103
  423. package/presets/cursor/android-kotlin/hooks/guard-shell-command.sh +0 -80
  424. package/presets/cursor/go/hooks/guard-shell-command.sh +0 -79
  425. package/presets/cursor/ios-swift/hooks/guard-shell-command.sh +0 -79
  426. package/presets/cursor/java/hooks/guard-shell-command.sh +0 -80
  427. package/presets/cursor/mcp-ts/hooks/guard-shell-command.sh +0 -79
  428. package/presets/cursor/mol/hooks/guard-shell-command.sh +0 -77
  429. package/presets/cursor/next/hooks/guard-shell-command.sh +0 -77
  430. package/presets/cursor/nuxt/hooks/guard-shell-command.sh +0 -77
  431. package/presets/cursor/php-hexagonal/hooks/guard-shell-command.sh +0 -80
  432. package/presets/cursor/php-laravel/hooks/guard-shell-command.sh +0 -80
  433. package/presets/cursor/svelte/hooks/guard-shell-command.sh +0 -77
@@ -10,12 +10,14 @@ const { resolveManagedPath } = require('../safe-path');
10
10
  const { isPlainObject } = require('../fs-utils');
11
11
  const { TOOL_INSTALL_MARKERS } = require('../tool-installs');
12
12
  const { assertNodeFloor, resolveProjectRootDetailed } = require('./run');
13
+ const { npxInvocation, npmInvocation } = require('./npx');
13
14
  const { detectClientIds, readClientConfig, containerAt } = require('./clients');
14
15
  const {
15
16
  checkIgnored,
16
17
  CREDENTIALS_REL,
17
18
  CONFIG_REL,
18
19
  GITHUB_CREDENTIALS_REL,
20
+ DEFECTDOJO_CREDENTIALS_REL,
19
21
  githubProjectRoot,
20
22
  } = require('./credentials');
21
23
  const { ownsEntry, registeredPin, tokenFinding, clientById } = require('./registry');
@@ -28,17 +30,18 @@ function oneLine(text) {
28
30
 
29
31
  let npxCached = null;
30
32
 
33
+ function versionResolves(invocation) {
34
+ return spawnSync(invocation.command, ['--version'], {
35
+ stdio: 'ignore',
36
+ shell: invocation.shell,
37
+ }).status === 0;
38
+ }
39
+
31
40
  function npxResolves() {
32
41
  if (npxCached !== null) {
33
42
  return npxCached;
34
43
  }
35
- const npx = process.platform === 'win32' ? 'npx.cmd' : 'npx';
36
- if (spawnSync(npx, ['--version'], { stdio: 'ignore' }).status === 0) {
37
- npxCached = true;
38
- return npxCached;
39
- }
40
- const npm = process.platform === 'win32' ? 'npm.cmd' : 'npm';
41
- npxCached = spawnSync(npm, ['--version'], { stdio: 'ignore' }).status === 0;
44
+ npxCached = versionResolves(npxInvocation()) || versionResolves(npmInvocation());
42
45
  return npxCached;
43
46
  }
44
47
 
@@ -176,6 +179,77 @@ async function checkGithubUpstream(config, github) {
176
179
  return { status: 'fail', detail: probe.detail, next: `check network access to ${host}` };
177
180
  }
178
181
 
182
+ function checkDefectdojoCredentials(root, config) {
183
+ if (!config.token) {
184
+ return {
185
+ status: 'fail',
186
+ detail: `DEFECTDOJO_TOKEN is not set in ${DEFECTDOJO_CREDENTIALS_REL} or the environment`,
187
+ next: `add DEFECTDOJO_URL and DEFECTDOJO_TOKEN to ${DEFECTDOJO_CREDENTIALS_REL} in the project root, then rerun ai-rules mcp setup defectdojo`,
188
+ };
189
+ }
190
+ if (!config.baseUrl) {
191
+ return {
192
+ status: 'fail',
193
+ detail: `DEFECTDOJO_URL is not set in ${DEFECTDOJO_CREDENTIALS_REL} or the environment`,
194
+ next: `add DEFECTDOJO_URL to ${DEFECTDOJO_CREDENTIALS_REL} in the project root, then rerun ai-rules mcp setup defectdojo`,
195
+ };
196
+ }
197
+
198
+ const origin = config.tokenOrigin === DEFECTDOJO_CREDENTIALS_REL ? DEFECTDOJO_CREDENTIALS_REL : 'the environment';
199
+ const details = [`token from ${origin}`];
200
+
201
+ if (config.fileHasToken) {
202
+ const ignored = checkIgnored(root, DEFECTDOJO_CREDENTIALS_REL);
203
+ if (ignored.status === 'fail') {
204
+ return {
205
+ status: 'fail',
206
+ detail: `${DEFECTDOJO_CREDENTIALS_REL} is not ignored`,
207
+ next: `add ${DEFECTDOJO_CREDENTIALS_REL} to .gitignore, then rerun ai-rules mcp setup defectdojo`,
208
+ };
209
+ }
210
+ details.push(ignored.status === 'warn' ? 'ignore rule not provable (not a git repository)' : 'ignored');
211
+ if (process.platform !== 'win32') {
212
+ const mode = fs.statSync(config.credentialsPath).mode & 0o777;
213
+ if (mode !== 0o600) {
214
+ details.push(`mode 0${mode.toString(8)} (0600 is safer)`);
215
+ return { status: 'warn', detail: details.join(', ') };
216
+ }
217
+ }
218
+ } else if (config.hasCredentialsFile) {
219
+ details.push(`${DEFECTDOJO_CREDENTIALS_REL} holds no token`);
220
+ }
221
+
222
+ return { status: 'ok', detail: details.join(', ') };
223
+ }
224
+
225
+ async function checkDefectdojoUpstream(config, defectdojo) {
226
+ const probe = await defectdojo.probeDefectDojoUpstream({
227
+ baseUrl: config.baseUrl,
228
+ token: config.token,
229
+ });
230
+
231
+ if (probe.ok) {
232
+ return { status: 'ok', detail: probe.detail };
233
+ }
234
+
235
+ if (probe.status === 401 || probe.status === 403) {
236
+ return {
237
+ status: 'fail',
238
+ detail: probe.detail,
239
+ next: `replace DEFECTDOJO_TOKEN in ${DEFECTDOJO_CREDENTIALS_REL} with a valid token, then rerun ai-rules mcp setup defectdojo`,
240
+ };
241
+ }
242
+
243
+ let host = config.baseUrl;
244
+ try {
245
+ host = new URL(config.baseUrl).host;
246
+ } catch {
247
+ // keep the raw value
248
+ }
249
+
250
+ return { status: 'fail', detail: probe.detail, next: `check network access to ${host}` };
251
+ }
252
+
179
253
  async function checkRegistration(server, cwd, version) {
180
254
  const clients = detectClientIds(cwd, TOOL_INSTALL_MARKERS);
181
255
  if (clients.length === 0) {
@@ -376,7 +450,7 @@ function checkRuntime(server, cwd, packageRoot, version) {
376
450
  /**
377
451
  * @returns {Promise<{ servers: object[], exitCode: 0|1|2 }>}
378
452
  */
379
- async function runDoctor({ cwd, provider, packageRoot, version, envfile, yandex, github, options = {} }) {
453
+ async function runDoctor({ cwd, provider, packageRoot, version, envfile, yandex, github, defectdojo, options = {} }) {
380
454
  const { serversFor } = require('./registry');
381
455
  const servers = [];
382
456
  const failures = [];
@@ -393,6 +467,13 @@ async function runDoctor({ cwd, provider, packageRoot, version, envfile, yandex,
393
467
  return { check: checkGithubCredentials(root, config), config };
394
468
  })()
395
469
  : null;
470
+ const defectdojoState = providers.has('defectdojo')
471
+ ? (() => {
472
+ const root = githubProjectRoot(cwd);
473
+ const config = defectdojo.resolveDefectDojoConfig({ root });
474
+ return { check: checkDefectdojoCredentials(root, config), config };
475
+ })()
476
+ : null;
396
477
 
397
478
  for (const server of serversFor(provider)) {
398
479
  const checks = {};
@@ -441,6 +522,17 @@ async function runDoctor({ cwd, provider, packageRoot, version, envfile, yandex,
441
522
  } else {
442
523
  put('upstream', await checkGithubUpstream(githubState.config, github));
443
524
  }
525
+ } else if (server.provider === 'defectdojo') {
526
+ put('credentials', defectdojoState.check);
527
+ if (
528
+ defectdojoState.check.status === 'fail'
529
+ || !defectdojoState.config.token
530
+ || !defectdojoState.config.baseUrl
531
+ ) {
532
+ checks.upstream = { status: 'skipped', detail: 'credentials not ready' };
533
+ } else {
534
+ put('upstream', await checkDefectdojoUpstream(defectdojoState.config, defectdojo));
535
+ }
444
536
  } else {
445
537
  put('credentials', yandexState.check);
446
538
  if (yandexState.check.status === 'fail' || !yandexState.token) {
@@ -0,0 +1,17 @@
1
+ /**
2
+ * How to launch npm's CLI on this platform.
3
+ *
4
+ * On Windows `npx` and `npm` are `.cmd` shims, and current Node refuses to
5
+ * spawn a `.cmd`/`.bat` without a shell (post-CVE-2024-27980). The flag travels
6
+ * with the command so every spawn site uses the same resolution, while the
7
+ * registered MCP client entry keeps the bare `npx` name the goldens encode.
8
+ */
9
+ function invocation(name, platform) {
10
+ return { command: name, shell: platform === 'win32' };
11
+ }
12
+
13
+ const npxInvocation = (platform = process.platform) => invocation('npx', platform);
14
+
15
+ const npmInvocation = (platform = process.platform) => invocation('npm', platform);
16
+
17
+ module.exports = { npxInvocation, npmInvocation };
@@ -29,6 +29,7 @@ const SERVERS = [
29
29
  entry: 'mcp/yandex-mcp-proxy.mjs',
30
30
  argv: ['wiki'],
31
31
  },
32
+ { id: 'defectdojo', slug: 'defectdojo', provider: 'defectdojo', entry: 'mcp/defectdojo-mcp.mjs', argv: [] },
32
33
  ];
33
34
 
34
35
  const CLIENTS = [
@@ -116,6 +117,7 @@ function isLegacyEntry(entry, server) {
116
117
  const markers = {
117
118
  gitlab: 'gitlab-mcp.mjs',
118
119
  yandex: 'yandex-mcp-proxy.mjs',
120
+ defectdojo: 'defectdojo-mcp.mjs',
119
121
  };
120
122
  const marker = markers[server.provider];
121
123
  if (!marker) {
@@ -272,6 +272,42 @@ function mergeMcpConfig(presetObj, existingObj) {
272
272
  };
273
273
  }
274
274
 
275
+ /**
276
+ * Migration: earlier releases registered the guard and the chain hook as `.sh`
277
+ * files. Re-init only adds hook commands, so a consumer `.claude/settings.json`
278
+ * would keep the dead bash command next to the new Node one. These two commands
279
+ * are dropped from every event group before the preset hooks are merged; no
280
+ * other consumer command is touched.
281
+ */
282
+ const LEGACY_CLAUDE_HOOK_COMMANDS = new Set([
283
+ '${CLAUDE_PROJECT_DIR}/.claude/hooks/guard-shell-command.sh',
284
+ '${CLAUDE_PROJECT_DIR}/.claude/hooks/chain-team-phases.sh',
285
+ ]);
286
+
287
+ function dropLegacyClaudeHooks(hooks) {
288
+ if (!isPlainObject(hooks)) return;
289
+ for (const event of ownKeys(hooks)) {
290
+ const groups = hooks[event];
291
+ if (!Array.isArray(groups) || groups.length === 0) continue;
292
+ const keptGroups = [];
293
+ for (const group of groups) {
294
+ if (!isPlainObject(group) || !Array.isArray(group.hooks)) {
295
+ keptGroups.push(group);
296
+ continue;
297
+ }
298
+ const keptHooks = group.hooks.filter(
299
+ (hook) => !(isPlainObject(hook) && LEGACY_CLAUDE_HOOK_COMMANDS.has(hook.command)),
300
+ );
301
+ if (keptHooks.length === 0) continue;
302
+ keptGroups.push(
303
+ keptHooks.length === group.hooks.length ? group : { ...group, hooks: keptHooks },
304
+ );
305
+ }
306
+ if (keptGroups.length === 0) delete hooks[event];
307
+ else hooks[event] = keptGroups;
308
+ }
309
+ }
310
+
275
311
  /**
276
312
  * Union `permissions.*` arrays and add preset hooks by event (deduped by `command`).
277
313
  * Every other consumer key wins. Bare `Bash(git commit)` and `Bash(git push)` are
@@ -283,6 +319,8 @@ function mergeClaudeSettings(presetObj, existingObj) {
283
319
  const merged = structuredClone(isPlainObject(existingObj) ? existingObj : {});
284
320
  const added = { keys: [], permissions: {}, hooks: {} };
285
321
 
322
+ dropLegacyClaudeHooks(merged.hooks);
323
+
286
324
  for (const key of ownKeys(preset)) {
287
325
  if (key !== 'permissions' && key !== 'hooks' && !Object.hasOwn(merged, key)) {
288
326
  merged[key] = structuredClone(preset[key]);
@@ -10,7 +10,7 @@
10
10
  const fs = require('fs');
11
11
  const path = require('path');
12
12
  const { assertSafeDest } = require('./safe-path');
13
- const { ENGINE_SCRIPTS, ENGINE_SOURCE_RELATIVE } = require('./engine-scripts');
13
+ const { ENGINE_SCRIPTS, engineSourceDir } = require('./engine-scripts');
14
14
  const { runTemplateDrift } = require('./ai-local-drift');
15
15
 
16
16
  const LEGACY_TOOLS = ['cursor', 'claude', 'mavis', 'opencode', 'zcode'];
@@ -31,6 +31,12 @@ const AI_LOCAL_GITIGNORE = [
31
31
  'team.db-wal',
32
32
  'team.db-shm',
33
33
  'team-db-errors.log',
34
+ '# Per-session slug bindings for the chain hook; runtime state, never commit.',
35
+ 'team/.session-leases/',
36
+ '# Scheduler runtime state; jobs.json stays tracked (jobs as code).',
37
+ 'team/scheduler/runs/',
38
+ 'team/scheduler/state.json',
39
+ 'team/upstream/cursor.json',
34
40
  '',
35
41
  ].join('\n');
36
42
  const POINTER_README = `# Agent team artifacts moved
@@ -262,17 +268,6 @@ function ensureAiLocalIgnored(aiLocalRoot) {
262
268
  return true;
263
269
  }
264
270
 
265
- /**
266
- * Preset-root-relative directory holding the shipped engine scripts.
267
- * `presetTeamSrc` is `<presetBase>/team`, so three levels up is the preset root.
268
- */
269
- function engineSourceDir(presetTeamSrc) {
270
- if (!presetTeamSrc) {
271
- return null;
272
- }
273
- return path.resolve(presetTeamSrc, '..', '..', '..', ...ENGINE_SOURCE_RELATIVE.split('/'));
274
- }
275
-
276
271
  /**
277
272
  * Seed the shipped self-learning engine (`presets/_shared/ai-local/scripts/`)
278
273
  * into `<cwd>/.ai.local/scripts/`. Skip-if-exists: a consumer edit is never
@@ -284,7 +279,8 @@ function seedEngineScripts({ cwd, presetTeamSrc }) {
284
279
  if (!presetTeamSrc) {
285
280
  return result;
286
281
  }
287
- const sourceDir = engineSourceDir(presetTeamSrc);
282
+ // `presetTeamSrc` is `<presetBase>/team`; three levels up is the `presets/` root.
283
+ const sourceDir = engineSourceDir(path.resolve(presetTeamSrc, '..', '..', '..'));
288
284
  if (!fs.existsSync(sourceDir) || !fs.statSync(sourceDir).isDirectory()) {
289
285
  return result;
290
286
  }
@@ -339,6 +335,25 @@ function copyTemplates(presetTeamSrc, dest) {
339
335
  written.push(`.ai.local/team/fixtures/${rel}`);
340
336
  }
341
337
  }
338
+ // Preset-owned upstream templates refresh on every init/update: a consumer edit
339
+ // to the permission map or the prompt must not silently defeat the contract.
340
+ const upstreamSrc = path.join(presetTeamSrc, 'upstream');
341
+ for (const name of ['prompt.md', 'digest-template.md', 'opencode.json']) {
342
+ const source = path.join(upstreamSrc, name);
343
+ if (!fs.existsSync(source)) continue;
344
+ copyFile(source, path.join(dest, 'upstream', name));
345
+ written.push(`.ai.local/team/upstream/${name}`);
346
+ }
347
+ // Consumer-owned research data seeds only when absent: the registry is the
348
+ // source of truth and a re-init must never overwrite it.
349
+ for (const name of ['projects.json', 'config.json', 'signatures.json']) {
350
+ const source = path.join(upstreamSrc, name);
351
+ if (!fs.existsSync(source)) continue;
352
+ const target = path.join(dest, 'upstream', name);
353
+ if (fs.existsSync(target)) continue;
354
+ copyFile(source, target);
355
+ written.push(`.ai.local/team/upstream/${name}`);
356
+ }
342
357
  const gitkeepSrc = path.join(presetTeamSrc, 'tasks', '.gitkeep');
343
358
  if (fs.existsSync(gitkeepSrc) && !hasConsumerTaskSlugs(path.join(dest, 'tasks'))) {
344
359
  copyFile(gitkeepSrc, path.join(dest, 'tasks', '.gitkeep'));
@@ -671,7 +686,7 @@ function templateEntries(presetTeamSrc) {
671
686
  // preset keeps precedence because it is added after this line.
672
687
  addFile('.ai.local/rules/router-pages.md', path.join(libraryDir, 'router-pages.md'));
673
688
  addDir('.ai.local/rules/', path.join(presetBase, 'ai-local', 'rules'), (name) => name.endsWith('.md'));
674
- const engineDir = engineSourceDir(presetTeamSrc);
689
+ const engineDir = engineSourceDir(path.resolve(presetTeamSrc, '..', '..', '..'));
675
690
  if (engineDir) {
676
691
  for (const name of ENGINE_SCRIPTS) {
677
692
  addFile(`.ai.local/scripts/${name}`, path.join(engineDir, name));
@@ -1,6 +1,12 @@
1
1
  # Project MCP catalog: `init mcp`
2
2
 
3
- `init mcp` writes the third-party MCP servers this package ships in its own client configs. It is the no-credentials command: every entry is a pinned `npx` package or a URL. The credential-bearing pack (GitLab, GitHub, Yandex Tracker, Yandex Wiki) is the separate `mcp setup|add|remove|doctor|refresh|run` namespace — see [`MCP-SETUP.md`](MCP-SETUP.md).
3
+ `init mcp` writes the MCP servers this package and its `next` presets use: Context7, Playwright, Chrome DevTools, Next.js DevTools, Semgrep, Sentry, Figma Desktop/Cloud, Storybook, DefectDojo, GitLab, GitHub, Yandex Tracker, and Yandex Wiki.
4
+
5
+ Three kinds of entry:
6
+
7
+ - **static stdio** — a pinned `npx` package or a local binary (Context7, Playwright, Chrome DevTools, Next.js DevTools, Semgrep);
8
+ - **remote** — a URL the client connects to (Figma, Storybook, Sentry);
9
+ - **runtime** — `npx -y @bonesofspring/ai-rules@<version> mcp run <slug>` (DefectDojo, GitLab, GitHub, Yandex). These need credentials from the `mcp setup` namespace; see [Credentials](#credentials).
4
10
 
5
11
  ```bash
6
12
  npx @bonesofspring/ai-rules@latest init mcp context7
@@ -16,12 +22,21 @@ npx @bonesofspring/ai-rules@latest init mcp --all --tools cursor,claude
16
22
  | `context7` | `npx -y @upstash/context7-mcp@4.5.0` | |
17
23
  | `playwright` | `npx -y @playwright/mcp@0.0.84` | Claude Code stores it as `playwright-test` |
18
24
  | `chrome-devtools` | `npx -y chrome-devtools-mcp@1.12.0` | |
25
+ | `next-devtools` | `npx -y next-devtools-mcp@0.4.0` | Needs a running `next dev` on Next.js 16+; exposes errors, routes, logs, compilation issues |
26
+ | `semgrep` | `semgrep mcp` | Needs the Semgrep CLI (`brew install semgrep`); `SEMGREP_APP_TOKEN` is optional |
27
+ | `sentry` | `https://mcp.sentry.dev/mcp` | OAuth; scope to one org/project by editing the URL. A client without OAuth support can use the stdio form `sentry mcp` after `sentry auth login` |
19
28
  | `figma-desktop` | `http://127.0.0.1:3845/mcp` | Alias `figma`; needs the Figma desktop app and a Dev/Full seat |
20
29
  | `figma-cloud` | `https://mcp.figma.com/mcp` | Remote Figma server; the client handles OAuth |
30
+ | `storybook` | `http://localhost:6200/mcp` | Needs Storybook running; 6200 is the catalog default (edit the entry if yours is 6006) |
31
+ | `defectdojo` | runtime `defectdojo` | Needs `DEFECTDOJO_URL` / `DEFECTDOJO_TOKEN` in `.env.defectdojo` |
32
+ | `gitlab` | runtime `gitlab` | Needs `mcp setup gitlab` |
33
+ | `github` | runtime `github` | Needs `mcp setup github` |
34
+ | `yandex-tracker` | runtime `yandex-tracker` | Needs `mcp setup yandex` |
35
+ | `yandex-wiki` | runtime `yandex-wiki` | Needs `mcp setup yandex` |
21
36
 
22
37
  `--all` selects every row. `figma` and `figma-desktop` resolve to the same entry.
23
38
 
24
- Pins mirror the shipped `next` presets; bump the catalog and `presets/<tool>/next/mcp.json` together — `scripts/test-cli-mcp-catalog.mjs` fails when the two drift.
39
+ For the servers the `next` presets also ship (Context7, Playwright, Chrome DevTools, Figma Desktop), pins mirror `presets/<tool>/next/mcp.json`; bump both together — `scripts/test-cli-mcp-catalog.mjs` fails when the two drift.
25
40
 
26
41
  ## What it writes
27
42
 
@@ -35,6 +50,19 @@ Pins mirror the shipped `next` presets; bump the catalog and `presets/<tool>/nex
35
50
 
36
51
  Only clients detected in the project are written (`mcp.json` exists, or the install marker does). `--tools <list>` narrows the set and warns when a named client is not installed.
37
52
 
53
+ ## Credentials
54
+
55
+ `init mcp` registers the runtime entries without credentials, so one `--all` is enough to wire every client. It prints one `next:` line per provider that has no local configuration yet:
56
+
57
+ | Provider | Where the credential comes from | Setup |
58
+ |----------|---------------------------------|-------|
59
+ | GitLab | `.ai-rules/mcp/credentials.env` (0600) or `GITLAB_TOKEN` | `ai-rules mcp setup gitlab` |
60
+ | GitHub | `.env.github` (project root, ignored) or `GITHUB_TOKEN` / `GITHUB_PERSONAL_ACCESS_TOKEN` | `ai-rules mcp setup github` |
61
+ | Yandex | `.ai-rules/mcp/config.env` or `YANDEX_ORG_ID` | `ai-rules mcp setup yandex` |
62
+ | DefectDojo | `.env.defectdojo` (project root, ignored) or `DEFECTDOJO_TOKEN` | `ai-rules mcp setup defectdojo` |
63
+
64
+ The DefectDojo token is never written by the package. `.env.defectdojo` holds `DEFECTDOJO_URL` and `DEFECTDOJO_TOKEN`; the file must be gitignored. `mcp setup defectdojo` proves the pair with `GET /api/v2/findings/` before registering.
65
+
38
66
  ## Merge rules
39
67
 
40
68
  `init mcp` merges like `init`:
package/docs/MCP-SETUP.md CHANGED
@@ -1,16 +1,16 @@
1
- # MCP setup: GitLab, GitHub, Yandex Tracker, Yandex Wiki
1
+ # MCP setup: GitLab, GitHub, Yandex Tracker, Yandex Wiki, DefectDojo
2
2
 
3
- Three sequences. Nothing here stores a token in a client config.
3
+ Four sequences. Nothing here stores a token in a client config.
4
4
  `mcp setup` writes the exact installed version pin into the client config; the runtime is pinned even though setup runs `@latest`.
5
5
  It registers only the clients already installed in the repository.
6
- GitLab credentials live in `.ai-rules/mcp/credentials.env`; Yandex keeps only non-secret settings in `.ai-rules/mcp/config.env`; the GitHub token is read from the shell or from `.env.github` in the project root and is never written by the package.
6
+ GitLab credentials live in `.ai-rules/mcp/credentials.env`; Yandex keeps only non-secret settings in `.ai-rules/mcp/config.env`; the GitHub token is read from the shell or from `.env.github` in the project root and is never written by the package; the DefectDojo URL and token are read from the shell or from `.env.defectdojo` and are never written by the package.
7
7
  All sequences are idempotent: rerun a step instead of editing a client config by hand.
8
8
  Run the `mcp` commands below from the repository root.
9
9
  Behind a corporate proxy, set `HTTPS_PROXY` and `NO_PROXY` for `yc` before `yc init`.
10
- Prerequisites: Node 20+, an MCP client, network to your GitLab instance, to GitHub and to Yandex.
10
+ Prerequisites: Node 20+, an MCP client, network to your GitLab instance, to GitHub, to Yandex and to DefectDojo.
11
11
  If no MCP client is installed yet, run `npx @bonesofspring/ai-rules@latest init cursor --preset next` (or your client/stack) first; `mcp setup` registers only installed clients.
12
12
 
13
- Third-party servers that need no credentials — Context7, Playwright, Chrome DevTools, Figma Desktop, Figma Cloud — are installed with `init mcp`; see [`MCP-CATALOG.md`](MCP-CATALOG.md).
13
+ Third-party servers that need no credentials — Context7, Playwright, Chrome DevTools, Next.js DevTools, Semgrep, Sentry (OAuth), Figma Desktop, Figma Cloud, Storybook — are installed with `init mcp`; see [`MCP-CATALOG.md`](MCP-CATALOG.md).
14
14
 
15
15
  ## 1. GitLab
16
16
 
@@ -89,6 +89,30 @@ Optional overrides in `.env.github` (or the shell): `GITHUB_MCP_URL` for a GitHu
89
89
  `npx @bonesofspring/ai-rules@latest mcp refresh yandex`
90
90
  → expected: `Yandex IAM token refreshed` and exit 0; no token is stored.
91
91
 
92
+ ## 4. DefectDojo
93
+
94
+ 1. **Create an API token.** Open your DefectDojo profile and copy the **API v2 Key**.
95
+ → expected: the key is shown once; keep it for the next step.
96
+
97
+ 2. **Put the endpoint and the token in `.env.defectdojo` in the project root.**
98
+ `DEFECTDOJO_URL=https://defectdojo.example.com` and `DEFECTDOJO_TOKEN=<the key>`.
99
+ Add the file to `.gitignore`; the package never edits your root `.gitignore` and refuses to register the server while the file is not ignored.
100
+ An exported `DEFECTDOJO_URL` / `DEFECTDOJO_TOKEN` in the shell wins over the file.
101
+ For an internal CA, point `NODE_EXTRA_CA_CERTS` at the PEM bundle.
102
+ → expected: the file exists with both values and is ignored by git.
103
+
104
+ 3. **Register the server and run the doctor.**
105
+ `npx @bonesofspring/ai-rules@latest mcp setup defectdojo`
106
+ → expected: `ok credentials` with `GET /api/v2/findings/ → 200`, `ok registration` per client, then `ok` doctor lines.
107
+
108
+ 4. **Reconnect the client** with the client action from GitLab step 3 (`opencode reload` in OpenCode).
109
+ → expected: `defectdojo` is connected and lists the `dd_*` tools.
110
+
111
+ 5. **Rotate the token.** Create a new key and replace the value in `.env.defectdojo`.
112
+ Rerun the setup; nothing is registered until the new token validates.
113
+ `npx @bonesofspring/ai-rules@latest mcp setup defectdojo`
114
+ → expected: the new token is validated; the server reconnects with it.
115
+
92
116
  ## Diagnostics
93
117
 
94
- `mcp doctor` without a provider covers **every** managed-pack provider (GitLab, GitHub, Yandex Tracker, Yandex Wiki) and exits non-zero while any of them is not ready — a provider you registered but never configured fails the report with one actionable next step. Scope it with `mcp doctor <gitlab|github|yandex>` when you want one provider only.
118
+ `mcp doctor` without a provider covers **every** managed-pack provider (GitLab, GitHub, Yandex Tracker, Yandex Wiki, DefectDojo) and exits non-zero while any of them is not ready — a provider you registered but never configured fails the report with one actionable next step. Scope it with `mcp doctor <gitlab|github|yandex|defectdojo>` when you want one provider only.
package/docs/OPENCODE.md CHANGED
@@ -75,7 +75,7 @@ File-based orchestration under `.ai.local/team/` mirrors Cursor/Claude:
75
75
 
76
76
  ```bash
77
77
  printf '%s\n' '{"status":"completed","attemptId":"<from-status.json>"}' \
78
- | bash .opencode/hooks/chain-team-phases.sh
78
+ | TEAM_TASK_SLUG=<slug> bash .opencode/hooks/chain-team-phases.sh
79
79
  ```
80
80
 
81
81
  Human gates pause with `awaitingHumanGate: true`. Resume with `/task-continue`. There is **no** shipped `hooks.json` or OpenCode plugin in v1.
@@ -101,11 +101,31 @@ Labels from official OpenCode docs (live CLI probe not yet run). Full matrix: [`
101
101
  | `.opencode/agents` / `skills` / `commands` | **confirmed** (docs) | Native discovery |
102
102
  | `opencode.json` MCP | **confirmed** (docs) | Merge `mcp` |
103
103
  | Glob / alwaysApply rules | **no-equivalent** | Lazy Read catalog under `.opencode/rules/` |
104
- | `hooks.json` / subagentStop | **manual** | `bash .opencode/hooks/chain-team-phases.sh` after receipts; no plugin in v1 |
104
+ | `hooks.json` / subagentStop | **manual** | `TEAM_TASK_SLUG=<slug> bash .opencode/hooks/chain-team-phases.sh` after receipts; no plugin in v1 |
105
105
  | Native Team lifecycle | **partial** | File pipeline is SoT; hook is single lifecycle writer |
106
106
 
107
107
  Do not pin OpenCode CLI or TUI versions in the contract.
108
108
 
109
+ ## Upstream research agent
110
+
111
+ The `next` preset ships a read-only agent for the `upstream-research` job at
112
+ `.ai.local/team/upstream/opencode.json` (source:
113
+ `presets/cursor/next/team/upstream/opencode.json`). It is refreshed on every `init`/`update`,
114
+ so a consumer cannot widen it by editing the installed copy.
115
+
116
+ - `agent.upstream-researcher` has `mode: "subagent"`.
117
+ - `permission` starts with `"*": "deny"`, so the agent has no tool at all: MCP servers installed by the same project (`chrome-devtools`, `playwright`, `context7`, `figma`) and custom tools resolve as `<server>_<tool>` and are denied by the same wildcard. The named rows stay as a second line of defence: `edit`/`bash`/`read`/`glob`/`grep`/`list` are `{"*": "deny"}`; `webfetch`, `websearch`, `task`, and `external_directory` are `deny`. The shell deny stops a write around the edit deny; the wildcard and the read/fetch/subagent denies keep untrusted upstream content from reaching a secret or a network destination. The agent needs no tool: the prompt arrives as an attached `--file` message and the runner verifies evidence itself.
118
+ - Before phase 1 the runner resolves the installed agent with `opencode debug agents` and refuses to start a project unless the global `*` and every named action still resolve to `deny` on resource `*` under last-match-wins (`E_AGENT_CONFIG_INVALID`, exit 12). The probe also asserts a synthetic non-built-in name, so a config that enumerates only the ten built-ins fails. A discovered config that appends an allow after the preset deny is caught here, not by a file grep.
119
+ - The job invokes `opencode run --agent upstream-researcher --format json --archived --auto`
120
+ with the child `cwd` set to the team `upstream/` directory; that nested config is the only
121
+ selector, because this build has no `--dir`.
122
+ - `--worktree` is never passed: the research is read-only.
123
+ - `--auto` cannot widen an explicit `deny`; the runner also compares `git status --porcelain`
124
+ in the repository before and after each call (`E_WORKTREE_CHANGED`) and inside the reviewed
125
+ clone (`E_UPSTREAM_DIRTY`).
126
+
127
+ The agent is not a first-class preset agent: it has no `agents/**` mirror and no adapter-map
128
+ row; the job asserts its resolved rules with `opencode debug agents` before the first project.
109
129
  ## Local overlay
110
130
 
111
131
  `.ai.local/rules/*.md` at repo root (or monorepo parents) override preset rules. See [`LOCAL-OVERLAY.md`](./LOCAL-OVERLAY.md).
@@ -0,0 +1,38 @@
1
+ # Platform support
2
+
3
+ Scope: `@bonesofspring/ai-rules` — the `ai-rules` CLI, the presets it installs (rules, agents, commands, hook registrations), and the self-learning engine seeded into `.ai.local/scripts/`.
4
+
5
+ macOS and Linux are fully supported. Windows is supported with the prerequisites below. The GitHub Actions full gate runs on ubuntu; the `platform-smoke` workflow adds a macOS and a Windows leg for the CLI, the engine suites, and the line-ending and bash-syntax gate.
6
+
7
+ ## Requirements
8
+
9
+ | Tool | Status | Notes |
10
+ |------|--------|-------|
11
+ | Node.js | required, **>= 20** | The whole package declares `engines.node: ">=20"`. The `mcp` command already refuses older runtimes, and the install doctor reports the floor. |
12
+ | Node.js for the `team-db` SQLite projection | **>= 22.13** | `team-db.mjs` uses `node:sqlite`. Below 22.13 the projection degrades to file-only with one diagnostic line; the rest of the engine keeps working. |
13
+ | `git` | required | Install state, generated-file drift, and every gate read the work tree through `git`. |
14
+ | `bash` | required for the chain hook only | The Cursor/Claude guard and the hook resolver run through Node. `chain-team-phases.sh` itself is still a bash script. |
15
+ | `perl` | optional | The engine lock uses a `perl` `flock` fast path. Without `perl` it falls back to a directory lock with the same mutual exclusion. |
16
+
17
+ ### Windows `bash`
18
+
19
+ Install **Git Bash**. The installer puts `bash.exe` in `Git\bin`, which is **not** added to the default Windows `PATH` (`Git\cmd` is). A consumer shell that runs the chain hook may need `C:\Program Files\Git\bin` on `PATH`; the hook resolver also probes the standard Git install locations. Git Bash is the documented prerequisite for contributors running the repository gates.
20
+
21
+ ## Feature matrix
22
+
23
+ | Feature | macOS | Linux | Windows |
24
+ |---------|-------|-------|---------|
25
+ | `init`, `update`, `clean`, `doctor` | yes | yes | yes |
26
+ | Cursor / Claude guard hook (Node `.mjs` registered through `node`) | yes | yes | yes |
27
+ | `chain-team-phases.sh` | yes (bash) | yes (bash) | yes (Git Bash) |
28
+ | Self-learning engine — `run.mjs`, `signals.mjs`, `manifest.mjs`, `rule-improver.mjs` | yes | yes | yes |
29
+ | `team-db` projection | SQLite on Node 22.13+; file-only below | SQLite on Node 22.13+; file-only below | SQLite on Node 22.13+; file-only below |
30
+ | `team-db` scheduler | POSIX process groups: a timeout terminates the whole group | POSIX process groups: a timeout terminates the whole group | Single process only — no group kill; a child that spawns its own children may outlive a timeout. A `.cmd` job is launched through `cmd.exe` with minimal argument quoting; avoid embedded double quotes in `jobs.json` argv |
31
+
32
+ ## Contributors
33
+
34
+ The repository gates (`packages/ai-rules/scripts/*.sh`, `yarn check:preset-structure`) require `bash` and `python3`. On Windows, run them from Git Bash, which provides `bash`; `python3` is a separate install — Git for Windows does not bundle it. The Node suites (`node --test`, the `test:*` scripts) run on any supported Node version on all three systems.
35
+
36
+ ## Upgrading from a bash guard
37
+
38
+ Cursor and Claude stacks previously registered `.cursor/hooks/guard-shell-command.sh` and `.claude/hooks/guard-shell-command.sh`. The guard now ships as a Node `.mjs` file, so those old bash files are no longer registered. `init` does not delete a path it no longer manages, so an upgraded consumer tree keeps the orphaned `.sh` file. It is inert; delete it manually after upgrading.
@@ -412,6 +412,7 @@ Load these when editing files under `packages/ai-rules/presets/**`, `.cursor/**`
412
412
  | `scripts/check-preset-twin-map.sh` / `yarn check:preset-twin-map` | **FAIL** if Cursor `.mdc` missing from Claude mapping table, twin file missing, or orphan topic `.md` (excl. `**/README.md`). Stacks: `next`, `nuxt`, `svelte`, `mol`, `ios-swift`, `android-kotlin`, `go`, `java`, `mcp-ts`, `php-hexagonal`, `php-laravel`. **Rules only** — commands and skills are guarded by `check-preset-twin-drift.mjs`. |
413
413
  | `scripts/check-preset-twin-drift.mjs` / `yarn check:preset-twin-drift` | **FAIL** when a hand-maintained Claude twin (`presets/claude/<stack>/{commands,skills}/**/*.md`) drifts further from its Cursor source than `scripts/_lib/claude-twin-drift-baseline.json` records, when the recorded divergence between the twins changes while the line delta does not, when a command/skill has no twin on the other side, when a new pair has no baseline row, when a baseline row has no live pair, or when the baseline itself is missing its hash rows. Full parity is not required: mirror a change in both twins (delta and divergence unchanged) or record a deliberate divergence with `--update`. Raising an allowance needs `--update --widen`; dropping a row needs `--update --prune`. Fixture `test-preset-twin-drift.mjs`. |
414
414
  | `scripts/check-claude-agent-parity.mjs` / `yarn check:claude-agent-parity` | **FAIL** when a hand-maintained Claude `agents/*.md` twin drifts from its Cursor source beyond `scripts/_lib/claude-agent-parity-baseline.json`: a grown or shrunk normalized line delta, a one-sided rewrite at an unchanged delta, a changed divergence hash, a missing twin, an unrecorded pair, an orphan row, or a pair in the static `parity` allowlist that is not at delta 0. Normalization masks packaging only — YAML frontmatter, the `## Rules to load (subagent context)` block, `<!-- shared-core -->` markers, the two anti-hallucination load lines, the `.cursor/` / `.claude/` root, and `.mdc` → `.md` — and reuses the twin-drift diff helpers. `--update` re-records deltas and hashes; `--widen` / `--prune` gate a raised allowance or a dropped row; `parity` is never edited by `--update`. Fixture `test-claude-agent-parity.mjs` proves one-sided Claude FAIL, one-sided Cursor FAIL and mirrored PASS. Wired into `check-preset-structure.sh` next to `claude-agent-blocks`. |
415
+ | `scripts/check-generated-drift.mjs` / `yarn check:generated-drift` | Regenerates Mavis, OpenCode, ZCode and the mapped Claude trees into a temp root and byte-compares them with the committed artifacts, then asserts the `.ai.local/scripts/` engine mirror. Also compares the eleven **hand-maintained** Claude `team/README.md` twins with their Cursor sources by line multiset: `generateClaudeStack` writes `rules/**` and `hooks/**` only, so those READMEs are not generator output and a Cursor-source edit must be mirrored by hand; section order differs by design and is not compared. |
415
416
  | `scripts/check-consumer-links.mjs` / `yarn check:consumer-links` | **FAIL** when a generated Claude rule or agent carries a source-only `.cursor/` path or a `.mdc` reference whose stem resolves through `claude/<stack>/rules/README.md`; `README.md` and `preset-*.md` are exempt by class. `scripts/_lib/claude-consumer-link-allowlist.json` records the legitimate lines one hash at a time; a stale row fails, and a planted line in an allowlisted file still fails unless it matches the recorded hash. `--update` re-hashes recorded rows only and refuses to add one. Scans `next` by default; `--stack` opts another stack in. Fixture `test-consumer-links.mjs`. Wired into `check-preset-structure.sh` next to `generated-drift`. |
416
417
  | `scripts/check-preset-token-budget.sh` / `yarn check:preset-token-budget` | **FAIL** if Cursor `alwaysApply: true` or Claude no-`paths:` (excl. README) count is outside **3–10**, `preset-*` always-on, or intended body sum > **4000**. Stacks include `nuxt`, `svelte`. CI also compares the baseline to the base revision (`--base`); a widening needs `--update --widen`. |
417
418
  | `scripts/check-preset-leakage.sh` / `yarn check:preset-leakage` | **FAIL** on forbidden stems in `hooks/**/*.sh` (recursive), wrong-stack agent filenames, or **positive** (non-negation) agent body mentions; **FAIL** if chain scripts are byte-identical across stacks. Explicit **negation** of forbidden stems in agent bodies is **suppressed** (INFO summary count only — not a merge blocker). Non-negation mentions in `build-verifier` → **WARN only**. |
@@ -427,7 +428,8 @@ Load these when editing files under `packages/ai-rules/presets/**`, `.cursor/**`
427
428
  | `scripts/check-rule-eval.mjs` / `yarn check:rule-eval` | **Hard gate** inside `check-preset-structure.sh`: validates Incorrect/Correct pairs + `impact:` on **next-only** golden stems (`eval/next/manifest.json`). Backend / ios / php-hexagonal / php-laravel stems are out of scope until a stack adds `eval/<stack>/`. |
428
429
  | `scripts/check-release-consistency.mjs` / `yarn check:release-consistency` | **FAIL** when `packages/ai-rules/package.json` version and the newest `## <version>` heading in `CHANGELOG.md` disagree — a tag must not ship the previous release's notes. Wired into `check-preset-structure.sh`; fixture `test-release-consistency.mjs`. |
429
430
  | `scripts/check-team-db-contract.mjs` / `yarn check:team-db-contract` | **FAIL** when the checked-in OpenAPI 3.1 document (`docs/openapi/team-db.v1.json`) drifts from `team-db-openapi.mjs`, fails the vendored 3.1 meta-schema (sha256-pinned), loses an `operationId`, diverges from `ROUTE_TABLE` in either direction, carries an invalid example, or leaves a `$ref` unresolved. `--write` is the only writer; no network at gate time. Wired into `check-preset-structure.sh`. |
430
- | `scripts/test-team-db-*.mjs` | The team-db suite family: schema (13), project (17), dual-write (13), API (12), security (10), dashboard (9), concurrency (6), and FAIL-direction fixtures (14). The fixtures prove each gate fails on its planted defect; `test-team-db-concurrency.mjs` covers first-creation races, a mixed writer/reader load, `SIGKILL` recovery, a held lock, and the 5 s hook budget. Wired into `check-preset-structure.sh`; `yarn test:team-db` runs the family. |
431
+ | `presets/_shared/ai-local/scripts/team-db-scheduler.mjs` | The scheduled-jobs module, shipped to consumers as `.ai.local/scripts/team-db-scheduler.mjs` (`ENGINE_SCRIPTS`): the job validator, a dependency-free five-field cron parser and next-fire on `Intl` zone math (both DST transitions are fixtures), the deterministic atomic `scheduler/jobs.json` store, the run-manifest and capped-capture helpers (the recorded sha256 covers exactly the pre-marker bytes, so a capped stream is not reported `E_LOG_HASH`), the projection into `scheduled_jobs` / `job_runs` / `job_run_events`, retention (1 MiB per stream, 200 runs, 30 days, 2 GiB; a pruned run directory takes its row with it; an active run is never pruned), restart reconciliation to `interrupted`, and `runScheduler` — the lease, the `BEGIN IMMEDIATE` claim, a durable run-now queue the timer re-reads and merges at every tick, the detached child with a process-group kill, `catch-up` bounded to five occurrences per gap with the truncation recorded (`E_CATCH_UP_TRUNCATED`), and the kill-switch drain. Fixture `test-team-db-scheduler.mjs`; concurrency fixtures live in `test-team-db-concurrency.mjs`. |
432
+ | `scripts/test-team-db-*.mjs` | The team-db suite family: schema (17), project (18), migrate-tasks (5), dual-write (13), API (27), security (17), dashboard (10), concurrency (10), scheduler (34), and FAIL-direction fixtures (22). The fixtures prove each gate fails on its planted defect; `test-team-db-concurrency.mjs` covers first-creation races, a mixed writer/reader load, `SIGKILL` recovery, a held lock, the 5 s hook budget, and the scheduler's four seams (scheduler versus projector on one database, a `SIGKILL`ed scheduler reconciled to one `interrupted` row, 50 finalized runs inside the WAL bound, and a held exclusive lock that neither hangs nor leaves a lease). Wired into `check-preset-structure.sh`; `yarn test:team-db` runs the family. |
431
433
 
432
434
  Run from `packages/ai-rules/`:
433
435
 
@@ -437,6 +439,14 @@ yarn check:preset-structure
437
439
  bash scripts/check-preset-structure.sh
438
440
  ```
439
441
 
442
+ Iteration versus release:
443
+
444
+ - **`yarn check:changed`** — the changed-domain classifier (`check-preset-delta.mjs --base HEAD`, or `--paths a,b`). Run the gates it names; this is the cheap loop.
445
+ - **`yarn check:fast`** — the structure gate without the ~40-minute hook matrix (`AI_RULES_SKIP_HOOK_TESTS=1`). Use it before handoff.
446
+ - **`yarn check:preset-structure`** — the full release gate, hook suites included; run it alone before a release.
447
+
448
+ `check-generated-drift` caches generated trees in the OS temp directory, keyed by a digest of the Cursor/`_shared` sources and the generator libraries. A source or generator edit misses the cache and regenerates; the cache is disposable and never hides drift.
449
+
440
450
  CI: [`.github/workflows/preset-structure.yml`](../../../.github/workflows/preset-structure.yml) runs the orchestrator on PRs touching `packages/ai-rules/**`.
441
451
 
442
452
  ---