@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
package/CHANGELOG.md CHANGED
@@ -1,5 +1,82 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.61
4
+
5
+ ### Cross-platform support
6
+
7
+ - **Hook registration through Node.** Every Cursor and Claude stack registers the guard and the chain hook as `node <file>.mjs` commands, so hook startup no longer depends on a shell being executable. `failClosed: true` stays on the guard; the chain hook stays fail-open.
8
+ - **Guard as an `.mjs` file.** The bash guard is replaced by one Node source rendered per stack; the deny/allow contract is unchanged (malformed stdin → `allow`, destructive git → `ask`, package-manager mismatch → `ask`). An existing consumer tree keeps the old `.cursor/hooks/guard-shell-command.sh` / `.claude/hooks/guard-shell-command.sh` as an inert, unmanaged file, because `init` does not delete paths it no longer manages — delete it manually after upgrading. The `.claude/settings.json` merge drops the two legacy bash commands (`guard-shell-command.sh`, `chain-team-phases.sh`) from every event group before it adds the Node commands, so a re-init does not leave a dead hook beside the live one; no other consumer command is touched.
9
+ - **Chain-hook bash resolver.** A Node resolver locates `bash` (PATH, then the usual Git Bash locations on Windows), forwards stdin/stdout, and exits 0 with one actionable line when bash is absent, so a machine without bash no longer blocks the pipeline silently.
10
+ - **Node 20 floor.** `engines.node` is `>=20` in the package and the workspace, and both READMEs link the platform matrix. The `team-db` SQLite projection still needs Node 22.13+ and degrades to file-only below it.
11
+ - **`.gitattributes`.** A repository-root attribute file forces LF for shell scripts, JavaScript, JSON, Markdown, and workflow files, so a Windows checkout cannot produce CRLF shebangs or byte-digest drift; image and font assets stay binary.
12
+ - **Perl-less engine lock.** The self-learning lock keeps the `perl` `flock` fast path but falls back to an atomic directory lock with owner-pid stale recovery, so `manifest.mjs`, `signals.mjs`, and `rule-improver.mjs` work when `perl` is absent without opening a double-writer window.
13
+ - **Windows fixes.** The GitLab MCP runtime and `mcp doctor` launch `npx`/`npm` through the platform-aware invocation (a `.cmd` needs a shell on current Node); the scheduler forwards the Windows child environment and resolves `.cmd` executables; `team-db serve --open` survives a missing browser opener and prints one diagnostic line; signal paths are normalized from `\` to `/` before the traversal guard runs.
14
+
15
+ ### Scheduled jobs
16
+
17
+ - **`team-db.mjs schedule`.** One timer per team root: `scheduler/jobs.json` holds the definitions, the lease file `scheduler/scheduler.lock` refuses a second process with exit 4 and goes stale after 90 s, and every due occurrence is claimed inside `BEGIN IMMEDIATE` against `job_runs` — so two racing firings produce one child and one `skipped` row, and `concurrency: allow` still works (no unique active-run index exists).
18
+ - **Bounded children.** A claimed run spawns detached in its own process group, is bounded by the job's `timeoutMs` (`SIGTERM`, a 5 s grace, then `SIGKILL` to the group), and records `succeeded` / `failed` / `timeout` / `skipped` / `interrupted` in a run manifest that is written twice (claim and finalize). `stdout` and `stderr` land in separate files capped at 1 MiB, with the byte count, sha256, and truncation flag on the row.
19
+ - **Two payload kinds.** `command` spawns `payload.argv` with `shell: false` (a resolved Windows `.cmd`/`.bat` is the one exception: it needs a shell); `pipeline` renders `payload.promptTemplate` into `<runDir>/prompt.md` and substitutes `{promptFile}` in a consumer-configured `payload.runner`. The child environment is `PATH`, `HOME`, `TMPDIR`, `LANG`, `TZ` plus `envPassthrough` names (plus the Windows system names on `win32`); no `AI_RULES_TEAM_DB_*` value is forwarded and no new dependency is added — the cron parser and next-fire are hand-written on `node:*` with `Intl` zone math (both `Europe/Berlin` 2027 DST transitions are fixtures).
20
+ - **Definitions are files.** `jobs list|get|put|delete|enable|disable|reconcile|run` write `scheduler/jobs.json` first (sorted by `id`, atomic, an unchanged rewrite is byte-identical) and project `scheduled_jobs`; `--dry-run` writes nothing, a stale `revision` is `409 E_CONFLICT`, and an invalid definition is refused with the offending parameter and the file untouched.
21
+ - **Retention and recovery.** 1 MiB per stream per run, 200 runs per job, 30 days, 2 GiB per team root, never pruning an active run; `state.json` keeps the last fire instant, so a restart replays a gap once (`run-once`) or up to five occurrences (`catch-up`) and a clock jump backwards never re-fires. A `claimed`/`running` run whose process is gone is reconciled to `interrupted` with `E_ORPHANED` before the first fire; `sync --rebuild` and `sync --vacuum` refuse with `E_SCHEDULER_RUNNING` while a fresh lease exists. The kill switch drains: no new claim, the in-flight child finishes, exit 0.
22
+ - **No redaction.** Run output is persisted verbatim under `scheduler/runs/**`, which `.ai.local/.gitignore` ignores together with `state.json`; `jobs.json` stays tracked.
23
+ - **Schema v2.** Migration `0002-scheduler` adds `scheduled_jobs`, `job_runs`, `job_run_events`, and five indexes; migration 1's bytes and checksum literal are unchanged. A v1 database carries a fingerprint that no longer describes the schema, so the next open moves it aside as `team.db.mismatch-<stamp>` and rebuilds from the task files.
24
+ - **Contract.** Nine job routes take the API to 32 operations (`jobs` list/create, `jobs/{id}` read/update/delete, its runs and run log, and run-now), with per-route body bounds (64 KiB for a job write, 1 KiB for run-now), `E_CONFLICT` / `E_SCHEDULER_OFFLINE` in the documented code table plus `E_ORPHANED` as the run reason, `capabilities` gaining `jobs` and `schedule`, and `Health.scheduler` derived from the lease. The two existing `spawnSync` mutations became asynchronous bounded children, so no request path blocks the event loop.
25
+ - **Dashboard.** `team-db.mjs serve` gains a jobs list with filters and load-more, a job detail with recent runs, a run page with two incremental log streams polled at 2 000 ms by byte offset, a create/edit form with per-field errors, enable/disable, run-now, and delete — each destructive action behind its own confirmation, and every section with empty, error, and loading states.
26
+ - **Install surface.** `team-db-scheduler.mjs` joins `ENGINE_SCRIPTS` (fifteen modules) and the seeded `.ai.local/.gitignore`; an existing consumer receives it plus migration 2 through one `update --fix` (the missing module by the seed, the stale schema by the guard, backed up before it is overwritten). `update --check` names that eligible rel set and writes none of it; a module the consumer edited is kept byte-identical.
27
+ - **Gates.** New `test-team-db-scheduler.mjs`; `test-team-db-concurrency.mjs` adds a scheduler-versus-projector run on one database, a `SIGKILL`ed scheduler that leaves `integrity_check` ok and one `interrupted` row, 50 finalized runs inside the WAL bound, and a held exclusive lock that neither hangs nor leaves a lease; `test-team-db-fixtures.mjs` plants a defect for every new or edited gate (migration 2 checksum, claim overlap, capture cap, route parity at 32, `E_DISABLED` ordering, the dashboard per-route table, the app operations table). Both suites are wired into `check-preset-structure.sh` and `yarn test:team-db`.
28
+
29
+ ### Upstream research
30
+
31
+ - **Weekly and manual evolution review.** A new `upstream-research` pipeline job runs one engine module, `.ai.local/scripts/upstream-research.mjs`, over a growing registry of comparison repositories. A run probes `opencode` first (exit `10` / `11` before any cursor, digest, or project write), scans each due clone with `git fetch --depth 1`, labels exactly one window (`range`, `baseline`, `unprovable`, `no-change`), calls a read-only agent, validates a marked JSON answer, re-checks every citation inside the clone, dedupes by mechanism, and commits one ranked digest to `docs/upstream/digest-<runId>.md`.
32
+ - **Registry and caps are data.** `.ai.local/team/upstream/projects.json` is typed and bounded (`schemaVersion: 1`, named `E_REGISTRY_*` errors, ≤ 100 entries, `refs.branch` must be a git ref name and never a `git` option); `config.json` carries the frozen caps (5 projects, 20 minutes per project, 60 minutes total, 3 digest items) with the same loader; the per-project cursor is git-ignored, type-checked, and rebuilt from the newest `report.json`. `config.agent.model` is `null` by default, so the call uses the model the installed `opencode` resolves; a `provider/model` id adds `--model` to the call with no code change.
33
+ - **Read-only agent.** `team/upstream/opencode.json` ships `agent.upstream-researcher` with a global `"*": "deny"` — no built-in, MCP, or custom tool — plus `edit`, `bash`, `read`, `glob`, `grep`, `list`, `webfetch`, `websearch`, `task`, and `external_directory` denied on `*`; the invocation is `opencode run --agent upstream-researcher --format json --archived --auto`, never `--worktree`. Before phase 1 the runner resolves the installed agent with `opencode debug agents` and fails `E_AGENT_CONFIG_INVALID` (12) if the wildcard or any named action was widened, or if the deciding deny is narrower than resource `*`. The runner also compares `git status --porcelain` before and after each call (`E_WORKTREE_CHANGED`, `E_UPSTREAM_DIRTY`).
34
+ - **Durable dedupe.** The attribution list is git-ignored, so `.ai.local/team/upstream/signatures.json` is the durable index (`generatedFrom.{path,sha256,rows}`). An adopted mechanism drops; a rejected one returns only with an `invalidates` change inside the window; a near-miss is kept and annotated; missing prior art marks every idea `dedupe: unverified` and never new.
35
+ - **Failure isolation.** One failed project leaves the run successful; every project failing exits `13` with a digest; `budget.maxConsecutiveAgentFailures` stops starting projects and marks the tail `skipped: agent-unavailable`; one `budget.projectTimeoutMs` deadline bounds a project's scan and both agent attempts; `concurrency: skip` records `E_CONCURRENCY_SKIP`; the scheduler's closed reason codes stay untouched, so the job row reports `E_EXIT_<n>`.
36
+ - **Install surface.** `upstream-research.mjs` joins `ENGINE_SCRIPTS`; `.ai.local/.gitignore` gains `team/upstream/cursor.json`; `init`/`update` refresh `prompt.md`, `digest-template.md`, and `opencode.json` while seeding `projects.json`, `config.json`, and `signatures.json` only when absent; `/upstream-research` queues a run and adds one `schedule --once` tick when the timer is offline. Docs: `docs/TEAM-DB.md` § Upstream research job, `docs/OPENCODE.md` § Upstream research agent.
37
+ - **Gates.** New `scripts/test-upstream-research.mjs` covers the probe failures, registry and policy bounds, the four window labels, the fetch-failure cursor guarantee, the answer schema and one-retry path, the full read-only deny set plus the runtime `debug agents` assertion, the ref-option and digest-forgery FAIL-direction fixtures, the evidence drop, prior-art parsing and dedupe, the digest ranking/state machine/prune survival, and the isolation/budget/ordering rules; `scripts/test-team-db-scheduler.mjs` stays green with `team-db-scheduler.mjs` byte-identical. All 55 CLI goldens are recaptured by `fix:generated`.
38
+
39
+ ### Engine repair verbs
40
+
41
+ - **`update --fix`.** Upgrades a seeded `.ai.local/scripts/` module only when its current bytes still match the shipped digest recorded in `.ai.local/.template-base.json`. A consumer-edited module is reported `kept modified` and left byte-identical; a module with no recorded base is reported `unattributable` and never written; a symlinked module is reported `skipped symlink` and never written through. `--no-backup` skips the durable copy; failure atomicity and the `safe-path` refusal stay on.
42
+ - **Backup and restore.** The default run writes `.ai.local/.rollback/engine-<stamp>/<rel>` for every overwritten module before the first module write, keeps the five newest `engine-*` runs, and never touches `template-drift/` or `legacy-team-*`. Restore with `cp -R .ai.local/.rollback/engine-<stamp>/.ai.local .`.
43
+ - **`update --check` parity.** The `check fast-forward .ai.local/scripts/<name>` set is computed from the same plan as the `--fix` write set — including a module whose recorded base names a tool you have since cleaned — and is exactly that set; `--check` still writes nothing.
44
+ - **`doctor --fix` and `fixable`.** Every doctor finding now carries `fixable` (`stale-engine` → `true`; `missing-engine`, `modified`, `legacy-manifest`, and `version-mismatch` → `false`). `doctor --fix` runs the same plan and writer, re-runs its checks, prints the post-state, and exits `0` only when that state is clean; `doctor --json` keeps `schemaVersion: 1` and adds one `fix` field when `--fix` ran.
45
+ - **Finding split.** `stale-engine` now means "bytes still equal the recorded shipped base, so the module is safely upgradeable". A consumer-edited module is `modified` (`fixable: false`), removing the conflation that made the old `stale-engine` report unsafe to repair.
46
+ - **`init --fix`.** Rejected with exit `1` and a message pointing at `update --fix`; `init` keeps skip-if-exists and never overwrites a consumer module.
47
+ - **Gates.** `test-engine-upgrade.mjs` covers `current`, `modified`, `stale`, and `no-base`, the `--check`/`--fix` set equality, backup/restore/retention, a backup-failure abort, `init --fix`, the `fixable` table, and the help block; it is wired into `check-preset-structure.sh` after `cli-install-doctor`.
48
+
49
+ ### Project MCP catalog
50
+
51
+ - **`init mcp`.** `ai-rules init mcp <name…|--all> [--tools <list>]` writes the third-party servers this package uses into every detected client (`--tools` narrows the set and warns for a client that is not installed). One canonical catalog in `bin/lib/mcp/catalog.js` renders into each client's native shape: Cursor `.cursor/mcp.json` (`mcpServers`), Claude `.mcp.json` (remotes carry `type: "http"`), Mavis `.mavis/mcp.json`, OpenCode `opencode.json` (`local` argv / `remote` url), ZCode `.zcode/config.json` (nested `mcp.servers`). Names: `context7`, `playwright` (Claude's own id is `playwright-test`), `chrome-devtools`, `next-devtools`, `semgrep`, `sentry`, `figma-desktop` (alias `figma`), `figma-cloud`, `storybook`, plus the runtime rows `defectdojo`, `gitlab`, `github`, `yandex-tracker`, `yandex-wiki` that resolve to `npx -y @bonesofspring/ai-rules@<version> mcp run <slug>`.
52
+ - **Merge and idempotence.** A catalog id is written or refreshed and its scalar fields (`command`, `args`, `url`, `type`) win; a foreign server id, consumer `env` / `headers`, and other top-level keys stay. A second run is byte-identical and does not move the file mtime (it prints `already up to date`); a file that is not valid JSON, or whose `mcp` / `mcpServers` key is not an object, exits `1` untouched. Pins mirror `presets/<tool>/next/mcp.json`, and `test-cli-mcp-catalog.mjs` — wired into `check-preset-structure.sh` — fails when the two drift, when a catalog row is missing on any client shape, or when the doctor stops reporting a registered-but-unconfigured provider.
53
+ - **DefectDojo runtime provider.** `mcp/defectdojo-mcp.mjs` over `mcp/lib/defectdojo.mjs` is the new stdio wrapper; `mcp setup defectdojo` reads `DEFECTDOJO_URL` / `DEFECTDOJO_TOKEN` from the shell or `.env.defectdojo` in the project root, refuses to run while that file is not git-ignored, validates the pair with `GET /api/v2/findings/` before registering anything, and never writes the secret. `mcp doctor` with no provider now covers five providers (GitLab, GitHub, Yandex Tracker, Yandex Wiki, DefectDojo) and names one next step per failure; `mcp remove --purge` deletes only `.ai-rules/mcp/{credentials,config}.env` and never the consumer's `.env.defectdojo`. Docs: `docs/MCP-CATALOG.md`, `docs/MCP-SETUP.md` § 4.
54
+
55
+ ### Chain hook: per-session slug binding
56
+
57
+ - **Resolution order.** The chain hook now resolves the task slug from `TEAM_TASK_SLUG`, then from a per-session lease `.ai.local/team/.session-leases/<session>.json` (session id from `OPENCODE_SESSION_ID` or `AI_RULES_SESSION_ID`, `[A-Za-z0-9_-]{1,128}`), then from `active-task.json`. A lease is written atomically (temp + rename), expires after 7 days, and stale leases are pruned on every write; the lease is best-effort and never gates a hook.
58
+ - **Write and warning.** Only an explicit `TEAM_TASK_SLUG` writes the lease, so a fallback-derived slug never becomes another session's binding. Every fallback prints one stderr line naming the slug and the source; an explicit binding or a lease prints none. Two parallel OpenCode sessions no longer no-op each other's handoffs, and a missing env is visible instead of silent.
59
+ - **Surface and gates.** The shared template and all 55 hooks carry the resolver. The `next` command twins, every stack's orchestrator rule, the OpenCode-generated `README.md` / `OPENCODE.md`, and the published `docs/OPENCODE.md` show `TEAM_TASK_SLUG=<slug>` on the manual call. The seeded `.ai.local/.gitignore` gains `team/.session-leases/` (an existing install gets the line appended by `init`/`update`). `test-chain-team-phases-session-lease.mjs` covers the explicit write, a same-session lease beating a foreign pointer, a foreign session falling back with the warning and writing no lease, and an explicit rebind; it is wired into `check-preset-structure.sh`, and the pre-existing postflight suite now binds the slug from the pointer before it calls the hook, so its runs stay warning-free.
60
+
61
+ ### Leaner pipeline defaults
62
+
63
+ - **Profile caps.** `task-router` selects `full` only for app code that carries a named risk flag or an e2e AC; preset-only, docs, review, and test-only tasks are never `full`, and a `high` classification without a named flag stays `standard`. Generated trees, snapshots, CLI goldens, docs, and test fixtures do not raise the profile, so a large mechanical diff no longer buys the heavy pipeline. `light` keeps its explicit-AC meaning.
64
+ - **Artifact budgets.** `agent-artifact-contracts.md` ships a size table — `brief.md` ≤ 80 prose lines, `decomposition.md` ≤ 60 and only when the task has more than 3 work packages, `implementation.md` ≤ 80, `validation-report.md` ≤ 40, `review.md` ≤ 100, `.memlog.md` ≤ 40 — with evidence tables and finding rows exempt. The four producer prompts (`task-analyst`, `feature-developer`, `build-verifier`, `code-reviewer`) carry their own cap; the Cursor source, the Claude twins, the generated trees, and the goldens carry the same text.
65
+ - **Requirements registry removed (repo-local).** The 28-R-ID registry left this repository: `.ai.local/requirements/**`, `check-requirements-compliance.mjs`, `requirements-registry.mjs`, and `requirements-block.mjs` are gone, the two auto-created gate rules merged into `agent-pipeline-gates.md`, and `task-levels.md` is now L0–L2 with the artifact budgets above. The preset-development checklist is six lines in `.ai.local/conventions.md` § Patterns. These modules were never in `ENGINE_SCRIPTS`; consumers of `0.2.60` did not receive them and need no action.
66
+
67
+ ### Faster iteration gates
68
+
69
+ - **`yarn check:changed`.** The changed-domain classifier gets a script alias (`check-preset-delta.mjs --base HEAD`), so the cheap loop is one command that names the gates a diff can affect; `yarn check:fast` stays the structure gate without the hook matrix, and `yarn check:preset-structure` remains the release gate. `docs/PRESET-CONTRIBUTION.md` gains an "iteration versus release" section.
70
+ - **Generated-tree cache.** `check-generated-drift.mjs` caches each generated subtree in the OS temp directory under a digest of `presets/cursor/<stack>`, `presets/_shared`, `scripts/lib`, and `package.json` (the Claude tree adds its mapping table). A source or generator edit changes the key and forces a fresh generation; a hit compares the working tree against byte-identical generated output, so the cache can never hide drift, and it is pruned after 7 days. `test-generated-cache.mjs` covers a hit, a source-edit invalidation, and the temp-directory location, and runs as its own gate row.
71
+ - **Hook matrix.** The coverage suite's dynamic fixtures run on the `cursor/next` representative hook instead of all 55; the other 54 stay held by the static `check-chain-hook-coverage.sh`, `check-hook-body-parity.mjs`, and the pause/stale-attempt suites. The suite drops from 15–20 minutes to ~41 s while every generated body is still asserted.
72
+
73
+ ### Upgrade
74
+
75
+ - Run `npx @bonesofspring/ai-rules update` to refresh the 55 hooks, the commands, the shared rules, and the `next` agents. Pass `TEAM_TASK_SLUG=<slug>` on every manual hook call: the fallback still works, but it now warns and the lease only binds from an explicit slug. A registered host hook that cannot set the env still resolves `active-task.json` and prints that warning on each call — the intended loud signal, not an error. An existing `.ai.local/.gitignore` receives `team/.session-leases/` from the same run.
76
+ - `npx @bonesofspring/ai-rules init mcp --all` (or a named subset) wires the third-party servers into the installed clients; nothing is registered until you run it. Use `mcp setup defectdojo` for the new provider, and `mcp doctor` to see all five credential-bearing providers.
77
+ - `upstream-research.mjs` joins the sixteen-module engine seed; the next `init`/`update` installs it, and `update --fix` upgrades a seeded module whose bytes still match the recorded base (`update --check` names that set without writing).
78
+ - Profile caps and artifact budgets change routing and artifact size only: no file migration, no schema change, no consumer action.
79
+
3
80
  ## 0.2.60
4
81
 
5
82
  `0.2.58` (no tag, no npm version) and `0.2.59` (a tag, no npm version) were never published — their notes ship as `0.2.60`.
package/README.md CHANGED
@@ -1,14 +1,14 @@
1
1
  # @bonesofspring/ai-rules
2
2
 
3
- Presets for **Cursor**, **Claude Code**, **Mavis** (MiniMax `mcode`), **OpenCode**, and **ZCode**. Node 18+.
3
+ Presets for **Cursor**, **Claude Code**, **Mavis** (MiniMax `mcode`), **OpenCode**, and **ZCode**. Node 20+. Platform support, prerequisites, and the Windows setup (Git Bash): [`docs/PLATFORMS.md`](docs/PLATFORMS.md).
4
4
 
5
5
  ```bash
6
6
  npx @bonesofspring/ai-rules init multi --preset next
7
7
  npx @bonesofspring/ai-rules update # reinstall tools already recorded in this repo
8
8
  npx @bonesofspring/ai-rules update --merge-ai-local # fast-forward files whose recorded base still matches; edits and pre-record files stay put
9
- npx @bonesofspring/ai-rules doctor # read-only install health: managed files, engine set, version
9
+ npx @bonesofspring/ai-rules doctor # install health: managed files, engine set, version; --fix upgrades stale engine modules
10
10
  npx @bonesofspring/ai-rules clean cursor # never deletes .ai.local/
11
- npx @bonesofspring/ai-rules init mcp --all # third-party catalog: context7, playwright, chrome-devtools, figma-desktop, figma-cloud
11
+ npx @bonesofspring/ai-rules init mcp --all # catalog: context7, playwright, chrome/next-devtools, semgrep, sentry, figma, storybook, defectdojo, gitlab/github, yandex-*
12
12
  ```
13
13
 
14
14
  Run `init` from the **app root** (`--cwd` if needed). Default `--preset` is `next`. Forms: `init cursor --preset next`, `init cursor next`, `init cursor`. Global: `npm i -g @bonesofspring/ai-rules`.
@@ -25,12 +25,12 @@ Run `init` from the **app root** (`--cwd` if needed). Default `--preset` is `nex
25
25
  | Root agents | `REPO_AGENTS.md` → `AGENTS.md` (same file on all five; ZCode loads it natively) | | | | |
26
26
  | `/task` artifacts | **`.ai.local/team/`** (shared; templates refreshed; `tasks/<slug>/` never overwritten) | | | |
27
27
  | Template drift | **`.ai.local/.template-base.json`** (shared; one record per tree of files that hold a shipped template byte; `update` prints one drift line, `update --merge-ai-local` fast-forwards a file only when its recorded base still matches and reports the rest) | | | |
28
- | Self-learning engine | **`.ai.local/scripts/`** (shared; fourteen scripts — the engine, `manifest.mjs`, the six `team-db*.mjs` projection modules, and the read-only `check-write-scope.mjs` write audit; existing files never overwritten) | | | |
28
+ | Self-learning engine | **`.ai.local/scripts/`** (shared; sixteen scripts — the six self-learning engine modules, `manifest.mjs`, the seven `team-db*.mjs` projection and scheduler modules, the `upstream-research.mjs` review, and the read-only `check-write-scope.mjs` write audit; existing files never overwritten) | | | |
29
29
  | Specs seed | `docs/specs/` copied only if the directory is **absent** | | | |
30
30
 
31
31
  ### Project MCP catalog
32
32
 
33
- `init mcp` writes the third-party servers this package uses into every installed client; `--tools` narrows the list to the clients you name. Entries render in each client's native shape and merge like `init`: extra servers, the consumer's `env` / `headers`, and other top-level keys stay. Names: `context7`, `playwright` (Claude's id is `playwright-test`), `chrome-devtools`, `figma-desktop` (alias `figma`, the local `http://127.0.0.1:3845/mcp` server), and `figma-cloud` (the remote `https://mcp.figma.com/mcp` server); `--all` selects every one.
33
+ `init mcp` writes the third-party servers this package ships plus Storybook, DefectDojo, and the packaged GitLab / GitHub / Yandex runtime entries into every installed client; `--tools` narrows the list to the clients you name. Entries render in each client's native shape and merge like `init`: extra servers, the consumer's `env` / `headers`, and other top-level keys stay. Names: `context7`, `playwright` (Claude's id is `playwright-test`), `chrome-devtools`, `next-devtools`, `semgrep`, `sentry`, `figma-desktop` (alias `figma`, the local `http://127.0.0.1:3845/mcp` server), `figma-cloud` (the remote `https://mcp.figma.com/mcp` server), `storybook` (`http://localhost:6200/mcp`), `defectdojo`, `gitlab`, `github`, `yandex-tracker`, and `yandex-wiki`; `--all` selects every one. The last five are packaged runtime entries: they are registered without credentials and need `mcp setup <provider>` once (DefectDojo reads `.env.defectdojo`). Next.js DevTools needs a running `next dev` on Next.js 16+; Semgrep needs the `semgrep` CLI; Sentry uses OAuth.
34
34
 
35
35
  ```bash
36
36
  npx @bonesofspring/ai-rules init mcp context7
@@ -38,7 +38,7 @@ npx @bonesofspring/ai-rules init mcp figma-desktop figma-cloud
38
38
  npx @bonesofspring/ai-rules init mcp --all --tools cursor,claude
39
39
  ```
40
40
 
41
- Details: [`docs/MCP-CATALOG.md`](docs/MCP-CATALOG.md). The credential-bearing pack (GitLab, GitHub, Yandex) is a separate command group: the `mcp setup|add|remove|doctor|refresh|run` namespace.
41
+ Details: [`docs/MCP-CATALOG.md`](docs/MCP-CATALOG.md). The credential-bearing pack (GitLab, GitHub, Yandex, DefectDojo) is the `mcp setup|add|remove|doctor|refresh|run` namespace.
42
42
 
43
43
 
44
44
  The engine is the in-task self-learning loop: `.ai.local/signals.jsonl` → `.ai.local/rule-changes.jsonl` →
@@ -55,28 +55,32 @@ node .ai.local/scripts/run.mjs --dry-run # read-only preview: decision, target,
55
55
  `build-verifier` and `code-reviewer` also run the read-only write audit `node .ai.local/scripts/check-write-scope.mjs --slug <slug> --step <step-id>`: it labels every changed path `declared`, `derived`, or `out-of-scope` against the step's `writeScopes`. It is never a hook gate.
56
56
 
57
57
  `init` seeds the engine with **skip-if-exists** — a modified `run.mjs` stays yours and is reported as kept; there is no
58
- `--force`. Re-running `init` does not update a seeded module, so delete the file to pick up a newer engine. The seeded
59
- tree is byte-identical to `presets/_shared/ai-local/scripts/`, and `.ai.local/.gitignore` (created when absent, missing
60
- required lines appended to an existing file) ignores `*.lock`, `*.tmp`, `.rollback/`, `STOP`, `ESTOP`, `team.db`,
61
- `team.db-wal`, `team.db-shm`, and `team-db-errors.log`; the root `.gitignore` is never edited.
62
-
63
- The seeded engine copy is **skip-if-exists** too, so a consumer that already holds `.ai.local/scripts/rule-improver.mjs`
64
- keeps the old engine and does **not** get the per-store budget split — the human store `.ai.local/rules/**` (≤ 5 rules,
65
- ≤ 170 lines) and the machine store `.ai.local/conventions.md` (≤ 30 lines) now carry separate caps, the combined
66
- envelope stays 200. The shipped `conventions.md` template is 27 non-empty lines, so a fresh install has three lines of
67
- machine headroom before the loop stages instead. Delete the changed seeded modules and re-run `init` / `update`:
58
+ `--force`. The seeded tree is byte-identical to `presets/_shared/ai-local/scripts/`, and `.ai.local/.gitignore` (created
59
+ when absent, missing required lines appended to an existing file) ignores `*.lock`, `*.tmp`, `.rollback/`, `STOP`,
60
+ `ESTOP`, `team.db`, `team.db-wal`, `team.db-shm`, `team-db-errors.log`, `team/scheduler/runs/`, and
61
+ `team/scheduler/state.json`; the root `.gitignore` is never edited.
62
+
63
+ Upgrade a seeded module with `update --fix`: it writes a module only when its current bytes still match the shipped digest
64
+ recorded in `.ai.local/.template-base.json`. A module you edited is reported `kept modified` and stays byte-identical; a
65
+ module with no recorded base (installed before the record existed) is reported `unattributable` and never written — delete
66
+ that one file and re-run `init` to adopt it. Every overwritten module is backed up by default to
67
+ `.ai.local/.rollback/engine-<stamp>/` (the five newest runs are kept); `--no-backup` skips the durable copy while keeping
68
+ the failure rollback. Restore a run with:
68
69
 
69
70
  ```bash
70
- rm .ai.local/scripts/rule-improver.mjs
71
- rm .ai.local/scripts/run.mjs
72
- rm .ai.local/scripts/team-db-schema.mjs
73
- npx @bonesofspring/ai-rules update
71
+ cp -R .ai.local/.rollback/engine-<stamp>/.ai.local .
74
72
  ```
75
73
 
76
- `--dry-run` and `--rollback` live in the newer `run.mjs` / `rule-improver.mjs`, so the same two deletions take them.
74
+ `update --check` prints the same `check fast-forward .ai.local/scripts/<name>` lines and writes nothing, so it previews the
75
+ `--fix` write set; both come from one plan, including a module whose recorded base names a tool you have since cleaned. A
76
+ symlinked module is reported `skipped symlink` and never written through. `doctor --json` marks every engine finding
77
+ `fixable` (`stale-engine` → `true`; `modified`, `missing-engine`, `legacy-manifest`, and `version-mismatch` → `false`), and
78
+ `doctor --fix` runs the same plan and writer before printing the post-state. A consumer that already holds
79
+ `.ai.local/scripts/rule-improver.mjs` keeps the old engine
80
+ until it upgrades; `--dry-run` and `--rollback` live in the newer `run.mjs` / `rule-improver.mjs`.
77
81
 
78
82
  The 0.2.56 delete-task release also changes `team-db.mjs`, `team-db-project.mjs`, `team-db-api.mjs`, and
79
- `team-db-openapi.mjs`; delete those too if you are taking both changes.
83
+ `team-db-openapi.mjs`; `update --fix` takes those too when you never edited them.
80
84
 
81
85
  Promote a staged seed by hand; the engine never activates one on its own:
82
86
 
@@ -130,6 +134,8 @@ node .ai.local/scripts/team-db.mjs sync # full backfill + reconc
130
134
  node .ai.local/scripts/team-db.mjs sync --slug <slug> # the bounded hook-shaped projection
131
135
  node .ai.local/scripts/team-db.mjs check # schema, fingerprint, integrity
132
136
  node .ai.local/scripts/team-db.mjs serve # http://127.0.0.1:4178 + dashboard
137
+ node .ai.local/scripts/team-db.mjs schedule # the timer: claims, runs, captures, reconciles
138
+ node .ai.local/scripts/team-db.mjs jobs list # definitions + next fire, file-authoritative
133
139
  AI_RULES_TEAM_DB_DISABLE=1 node .ai.local/scripts/team-db.mjs sync # no-op: file-only mode
134
140
  ```
135
141
 
@@ -137,9 +143,36 @@ Requires Node 22.13.0+ for `node:sqlite`; older runtimes stay file-only with one
137
143
  `migrate-tasks` is the one-command path: it creates the database when it is absent and writes
138
144
  only the delta against an existing one, so a fresh workspace and a populated database converge
139
145
  in one invocation.
140
- `team-db.mjs serve` binds loopback only, is read-only apart from `POST /api/v1/sync`, and
141
- serves the OpenAPI 3.1 document at `/openapi.json`. Details, environment names, retention,
142
- and rollback: [`docs/TEAM-DB.md`](docs/TEAM-DB.md).
146
+ `team-db.mjs serve` binds loopback only, is read-only apart from the six documented mutations
147
+ (`POST /api/v1/sync`, the task delete, and four job writes), and serves the OpenAPI 3.1
148
+ document at `/openapi.json`. Details, environment names, retention, and rollback:
149
+ [`docs/TEAM-DB.md`](docs/TEAM-DB.md).
150
+
151
+ ### Scheduled jobs
152
+
153
+ `scheduler/jobs.json` defines cron or interval jobs — a `command` argv or a `pipeline` prompt
154
+ lowered to a consumer-configured runner — and `team-db.mjs schedule` runs one at a time per
155
+ team root: one `BEGIN IMMEDIATE` claim per occurrence, a detached child with a process-group
156
+ timeout kill, split `stdout`/`stderr` capped at 1 MiB, and a reconciled restart. The
157
+ definitions are committed, run output and `state.json` are ignored, and the captured output is
158
+ never redacted. The `queue` concurrency policy and the `run-once` / `catch-up` (five
159
+ occurrences) misfire policies cover overlap and downtime; the kill switch drains instead of
160
+ dropping a claim. The same nine job routes drive the shipped dashboard (its Jobs tab under
161
+ `team-db.mjs serve`) and any other client. Schema v2 adds the three projection tables; a
162
+ pre-v2 database is rebuilt from the files on the next `sync`.
163
+
164
+ ### Upstream research
165
+
166
+ The `next` preset ships a weekly `upstream-research` job and a read-only `opencode` agent for
167
+ it. The runner (`.ai.local/scripts/upstream-research.mjs`) probes `opencode`, loads
168
+ `upstream/projects.json` and `upstream/config.json`, fetches each due clone with
169
+ `git fetch --depth 1`, labels the window (`range`, `baseline`, `unprovable`, `no-change`),
170
+ validates the agent's marked JSON, re-checks every citation inside the clone, dedupes by
171
+ mechanism against the committed `upstream/signatures.json`, and writes one ranked digest to
172
+ `docs/upstream/digest-<runId>.md`. The cursor is git-ignored; the caps are data. `/upstream-research`
173
+ queues a run and adds one `schedule --once` tick when no timer is online. Details:
174
+ [`docs/TEAM-DB.md`](docs/TEAM-DB.md#upstream-research-job) and
175
+ [`docs/OPENCODE.md`](docs/OPENCODE.md#upstream-research-agent).
143
176
 
144
177
  Living exceptions: **`.ai.local/rules/`** and **`.ai.local/conventions.md`** (`init` does not overwrite them). The only exception is opt-in and hash-gated: `update --merge-ai-local` fast-forwards a file whose recorded base in `.ai.local/.template-base.json` still matches, keeps an edited file byte-identical, and diverts its unified diff to `.ai.local/.rollback/template-drift/` (never a `.md`, never a conflict marker). Plain `update` only prints one drift line and records the files that already hold the shipped template; your own bytes never become a base. Overlay does not load `.ai.local/team/**` as rules; see [`docs/LOCAL-OVERLAY.md`](docs/LOCAL-OVERLAY.md#template-drift).
145
178
 
@@ -157,7 +190,7 @@ Mavis never writes `~/.minimax/**`. OpenCode never writes `~/.config/opencode/**
157
190
 
158
191
  `update` reinstalls each tool whose `<tool>/.ai-rules-install.json` is already present, using the `preset` field `init` wrote (`platform` + `preset`). Slash command `/update` runs that CLI. A tool without a manifest stays uninstalled, and the recorded preset stays as stored. To switch preset, run `init <tool> --preset <name>`.
159
192
 
160
- `doctor` is the read-only install-state check. For every installed platform it reports `missing` or `modified` managed files, a manifest without a `managedFiles` map, `legacy-manifest` for schema v1, and a `version-mismatch` between the manifest's `packageVersion` and the package you are running. Once per project it compares `.ai.local/scripts/` with `presets/_shared/ai-local/scripts/` and reports `stale-engine` (naming the module) or `missing-engine`; the F-1 class — an old `run.mjs` next to a newer `rule-improver.mjs` — is exactly one `stale-engine` finding. `--json` prints one object. Exit `0` means clean, `1` means findings, `2` means a usage error (unknown option, bad positional, bad `--cwd`). There is no `--fix`: fix by re-running `init` / `update` after deleting the changed seeded module.
193
+ `doctor` is the install-state check. For every installed platform it reports `missing` or `modified` managed files, a manifest without a `managedFiles` map, `legacy-manifest` for schema v1, and a `version-mismatch` between the manifest's `packageVersion` and the package you are running. Once per project it classifies `.ai.local/scripts/` with the same predicate `update --fix` writes with: `stale-engine` is safely upgradeable (`fixable: true`), `modified` is your edit (`fixable: false`), and `missing-engine`, `legacy-manifest`, and `version-mismatch` are not fixable. `--json` prints one object with `fixable` on every finding and adds one `fix` field when `--fix` ran. Exit `0` means clean, `1` means findings, `2` means a usage error (unknown option, bad positional, bad `--cwd`). `doctor --fix` applies the same plan and writer as `update --fix`, re-runs the check, prints the post-state, and exits `0` only when that post-state is clean; a `modified` module is never overwritten, and a module with no recorded base needs the delete + `init` remedy.
161
194
 
162
195
  On session start (Cursor and Claude hooks; Mavis, OpenCode, and ZCode on the first reply) the preset compares that recorded `packageVersion` with the latest `@bonesofspring/ai-rules` release. When a newer release exists, the reply opens with a level-2 heading and a blockquote naming the installed version, the latest version, and `/update`. That block stays out of the task answer. `/update` then says the update finished successfully, or that it did not, without quoting the exit code.
163
196