@bonesofspring/ai-rules 0.2.57 → 0.2.61

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (603) hide show
  1. package/CHANGELOG.md +127 -0
  2. package/README.md +91 -20
  3. package/bin/cli.js +714 -33
  4. package/bin/lib/ai-local-drift.js +18 -0
  5. package/bin/lib/engine-scripts.js +25 -5
  6. package/bin/lib/engine-upgrade.js +279 -0
  7. package/bin/lib/mcp/catalog.js +158 -0
  8. package/bin/lib/mcp/clients.js +35 -2
  9. package/bin/lib/mcp/credentials.js +173 -1
  10. package/bin/lib/mcp/doctor.js +192 -24
  11. package/bin/lib/mcp/npx.js +17 -0
  12. package/bin/lib/mcp/registry.js +12 -4
  13. package/bin/lib/merged-config.js +38 -0
  14. package/bin/lib/seed-ai-local-team.js +37 -19
  15. package/docs/MCP-CATALOG.md +84 -0
  16. package/docs/MCP-SETUP.md +62 -6
  17. package/docs/OPENCODE.md +22 -2
  18. package/docs/PLATFORMS.md +38 -0
  19. package/docs/PRESET-CONTRIBUTION.md +12 -1
  20. package/docs/TEAM-DB.md +187 -20
  21. package/docs/openapi/team-db.v1.json +4443 -2083
  22. package/mcp/defectdojo-mcp.mjs +353 -0
  23. package/mcp/github-proxy.mjs +133 -0
  24. package/mcp/gitlab.mjs +5 -1
  25. package/mcp/lib/defectdojo.mjs +249 -0
  26. package/mcp/lib/github.mjs +187 -0
  27. package/mcp/lib/streamable-http.mjs +185 -0
  28. package/mcp/lib/yandex.mjs +55 -152
  29. package/package.json +11 -3
  30. package/presets/_shared/ai-local/scripts/check-write-scope.mjs +212 -0
  31. package/presets/_shared/ai-local/scripts/lock.mjs +139 -19
  32. package/presets/_shared/ai-local/scripts/rule-improver.mjs +343 -50
  33. package/presets/_shared/ai-local/scripts/run.mjs +122 -3
  34. package/presets/_shared/ai-local/scripts/signals.mjs +17 -1
  35. package/presets/_shared/ai-local/scripts/team-db-api.mjs +496 -67
  36. package/presets/_shared/ai-local/scripts/team-db-dashboard.mjs +816 -5
  37. package/presets/_shared/ai-local/scripts/team-db-openapi.mjs +761 -6
  38. package/presets/_shared/ai-local/scripts/team-db-project.mjs +10 -0
  39. package/presets/_shared/ai-local/scripts/team-db-scheduler.mjs +2360 -0
  40. package/presets/_shared/ai-local/scripts/team-db-schema.mjs +87 -0
  41. package/presets/_shared/ai-local/scripts/team-db.mjs +151 -9
  42. package/presets/_shared/ai-local/scripts/upstream-research.mjs +2961 -0
  43. package/presets/_shared/core/agent-team/agent-artifact-contracts.md +13 -0
  44. package/presets/_shared/core/agent-team/agent-team-orchestrator.md +12 -0
  45. package/presets/_shared/core/review/code-review-mr.md +10 -0
  46. package/presets/_shared/hooks/README.md +23 -3
  47. package/presets/_shared/hooks/chain-team-phases.sh.tmpl +200 -4
  48. package/presets/{claude/nuxt/hooks/guard-shell-command.sh → _shared/hooks/guard-shell-command.mjs.tmpl} +29 -35
  49. package/presets/_shared/hooks/run-hook.mjs +102 -0
  50. package/presets/claude/android-kotlin/commands/update.md +1 -0
  51. package/presets/claude/android-kotlin/hooks/README.md +4 -3
  52. package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +200 -4
  53. package/presets/claude/android-kotlin/hooks/examples/README.md +2 -2
  54. package/presets/claude/android-kotlin/hooks/guard-shell-command.mjs +96 -0
  55. package/presets/claude/android-kotlin/hooks/run-hook.mjs +102 -0
  56. package/presets/claude/android-kotlin/rules/tooling-and-review/agent-team-orchestrator.md +12 -0
  57. package/presets/claude/android-kotlin/rules/tooling-and-review/code-review.md +10 -0
  58. package/presets/claude/android-kotlin/settings.json +2 -2
  59. package/presets/claude/android-kotlin/team/README.md +5 -0
  60. package/presets/claude/go/commands/update.md +1 -0
  61. package/presets/claude/go/hooks/README.md +4 -3
  62. package/presets/claude/go/hooks/chain-team-phases.sh +200 -4
  63. package/presets/claude/go/hooks/examples/README.md +2 -2
  64. package/presets/claude/go/hooks/guard-shell-command.mjs +95 -0
  65. package/presets/claude/go/hooks/run-hook.mjs +102 -0
  66. package/presets/claude/go/rules/tooling-and-review/agent-team-orchestrator.md +12 -0
  67. package/presets/claude/go/rules/tooling-and-review/code-review.md +10 -0
  68. package/presets/claude/go/settings.json +2 -2
  69. package/presets/claude/go/team/README.md +5 -0
  70. package/presets/claude/ios-swift/commands/update.md +1 -0
  71. package/presets/claude/ios-swift/hooks/README.md +4 -3
  72. package/presets/claude/ios-swift/hooks/chain-team-phases.sh +200 -4
  73. package/presets/claude/ios-swift/hooks/examples/README.md +2 -2
  74. package/presets/claude/ios-swift/hooks/guard-shell-command.mjs +95 -0
  75. package/presets/claude/ios-swift/hooks/run-hook.mjs +102 -0
  76. package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-orchestrator.md +12 -0
  77. package/presets/claude/ios-swift/rules/tooling-and-review/code-review.md +10 -0
  78. package/presets/claude/ios-swift/settings.json +2 -2
  79. package/presets/claude/ios-swift/team/README.md +5 -0
  80. package/presets/claude/java/commands/update.md +1 -0
  81. package/presets/claude/java/hooks/README.md +4 -3
  82. package/presets/claude/java/hooks/chain-team-phases.sh +200 -4
  83. package/presets/claude/java/hooks/examples/README.md +2 -2
  84. package/presets/claude/java/hooks/{guard-shell-command.sh → guard-shell-command.mjs} +31 -38
  85. package/presets/claude/java/hooks/run-hook.mjs +102 -0
  86. package/presets/claude/java/rules/tooling-and-review/agent-team-orchestrator.md +12 -0
  87. package/presets/claude/java/rules/tooling-and-review/code-review.md +10 -0
  88. package/presets/claude/java/settings.json +2 -2
  89. package/presets/claude/java/team/README.md +5 -0
  90. package/presets/claude/mcp-ts/commands/update.md +1 -0
  91. package/presets/claude/mcp-ts/hooks/README.md +4 -3
  92. package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +200 -4
  93. package/presets/claude/mcp-ts/hooks/examples/README.md +1 -1
  94. package/presets/claude/mcp-ts/hooks/guard-shell-command.mjs +95 -0
  95. package/presets/claude/mcp-ts/hooks/run-hook.mjs +102 -0
  96. package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-orchestrator.md +12 -0
  97. package/presets/claude/mcp-ts/rules/tooling-and-review/code-review.md +10 -0
  98. package/presets/claude/mcp-ts/settings.json +2 -2
  99. package/presets/claude/mcp-ts/team/README.md +5 -0
  100. package/presets/claude/mol/commands/update.md +1 -0
  101. package/presets/claude/mol/hooks/README.md +20 -0
  102. package/presets/claude/mol/hooks/chain-team-phases.sh +200 -4
  103. package/presets/claude/{svelte/hooks/guard-shell-command.sh → mol/hooks/guard-shell-command.mjs} +29 -35
  104. package/presets/claude/mol/hooks/run-hook.mjs +102 -0
  105. package/presets/claude/mol/rules/tooling-and-review/agent-team-orchestrator.md +12 -0
  106. package/presets/claude/mol/rules/tooling-and-review/code-review-mr.md +10 -0
  107. package/presets/claude/mol/settings.json +2 -2
  108. package/presets/claude/mol/team/README.md +5 -0
  109. package/presets/claude/next/agents/build-verifier.md +4 -0
  110. package/presets/claude/next/agents/code-reviewer.md +10 -0
  111. package/presets/claude/next/agents/feature-developer.md +1 -0
  112. package/presets/claude/next/agents/task-analyst.md +4 -0
  113. package/presets/claude/next/agents/task-router.md +5 -3
  114. package/presets/claude/next/commands/README.md +1 -0
  115. package/presets/claude/next/commands/task-continue.md +4 -2
  116. package/presets/claude/next/commands/update.md +1 -0
  117. package/presets/claude/next/commands/upstream-research.md +23 -0
  118. package/presets/claude/next/hooks/README.md +4 -3
  119. package/presets/claude/next/hooks/chain-team-phases.sh +200 -4
  120. package/presets/claude/next/hooks/examples/README.md +2 -2
  121. package/presets/claude/next/hooks/guard-shell-command.mjs +94 -0
  122. package/presets/claude/next/hooks/run-hook.mjs +102 -0
  123. package/presets/claude/next/rules/tooling-and-review/agent-team-orchestrator.md +12 -0
  124. package/presets/claude/next/rules/tooling-and-review/code-review-mr.md +10 -0
  125. package/presets/claude/next/settings.json +2 -2
  126. package/presets/claude/next/team/README.md +23 -0
  127. package/presets/claude/next/team/upstream/config.json +31 -0
  128. package/presets/claude/next/team/upstream/digest-template.md +55 -0
  129. package/presets/claude/next/team/upstream/opencode.json +34 -0
  130. package/presets/claude/next/team/upstream/projects.json +4 -0
  131. package/presets/claude/next/team/upstream/prompt.md +77 -0
  132. package/presets/claude/next/team/upstream/signatures.json +9 -0
  133. package/presets/claude/nuxt/commands/update.md +1 -0
  134. package/presets/claude/nuxt/hooks/README.md +4 -3
  135. package/presets/claude/nuxt/hooks/chain-team-phases.sh +200 -4
  136. package/presets/claude/nuxt/hooks/examples/README.md +2 -2
  137. package/presets/claude/{ios-swift/hooks/guard-shell-command.sh → nuxt/hooks/guard-shell-command.mjs} +29 -37
  138. package/presets/claude/nuxt/hooks/run-hook.mjs +102 -0
  139. package/presets/claude/nuxt/rules/tooling-and-review/agent-team-orchestrator.md +12 -0
  140. package/presets/claude/nuxt/rules/tooling-and-review/code-review-mr.md +10 -0
  141. package/presets/claude/nuxt/settings.json +2 -2
  142. package/presets/claude/nuxt/team/README.md +5 -0
  143. package/presets/claude/php-hexagonal/commands/update.md +1 -0
  144. package/presets/claude/php-hexagonal/hooks/README.md +4 -3
  145. package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +200 -4
  146. package/presets/claude/php-hexagonal/hooks/examples/README.md +2 -2
  147. package/presets/claude/php-hexagonal/hooks/guard-shell-command.mjs +96 -0
  148. package/presets/claude/php-hexagonal/hooks/run-hook.mjs +102 -0
  149. package/presets/claude/php-hexagonal/rules/tooling-and-review/agent-team-orchestrator.md +12 -0
  150. package/presets/claude/php-hexagonal/rules/tooling-and-review/code-review.md +10 -0
  151. package/presets/claude/php-hexagonal/settings.json +2 -2
  152. package/presets/claude/php-hexagonal/team/README.md +5 -0
  153. package/presets/claude/php-laravel/commands/update.md +1 -0
  154. package/presets/claude/php-laravel/hooks/README.md +4 -3
  155. package/presets/claude/php-laravel/hooks/chain-team-phases.sh +200 -4
  156. package/presets/claude/php-laravel/hooks/examples/README.md +2 -2
  157. package/presets/claude/php-laravel/hooks/guard-shell-command.mjs +96 -0
  158. package/presets/claude/php-laravel/hooks/run-hook.mjs +102 -0
  159. package/presets/claude/php-laravel/rules/tooling-and-review/agent-team-orchestrator.md +12 -0
  160. package/presets/claude/php-laravel/rules/tooling-and-review/code-review.md +10 -0
  161. package/presets/claude/php-laravel/settings.json +2 -2
  162. package/presets/claude/php-laravel/team/README.md +5 -0
  163. package/presets/claude/svelte/commands/update.md +1 -0
  164. package/presets/claude/svelte/hooks/README.md +4 -3
  165. package/presets/claude/svelte/hooks/chain-team-phases.sh +200 -4
  166. package/presets/claude/svelte/hooks/examples/README.md +2 -2
  167. package/presets/claude/svelte/hooks/guard-shell-command.mjs +94 -0
  168. package/presets/claude/svelte/hooks/run-hook.mjs +102 -0
  169. package/presets/claude/svelte/rules/tooling-and-review/agent-team-orchestrator.md +12 -0
  170. package/presets/claude/svelte/rules/tooling-and-review/code-review-mr.md +10 -0
  171. package/presets/claude/svelte/settings.json +2 -2
  172. package/presets/claude/svelte/team/README.md +5 -0
  173. package/presets/cursor/android-kotlin/commands/update.md +1 -0
  174. package/presets/cursor/android-kotlin/hooks/README.md +2 -1
  175. package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +200 -4
  176. package/presets/cursor/android-kotlin/hooks/examples/README.md +1 -1
  177. package/presets/cursor/android-kotlin/hooks/guard-shell-command.mjs +96 -0
  178. package/presets/cursor/android-kotlin/hooks/run-hook.mjs +102 -0
  179. package/presets/cursor/android-kotlin/hooks.json +2 -2
  180. package/presets/cursor/android-kotlin/rules/code-review-mr.mdc +10 -0
  181. package/presets/cursor/android-kotlin/team/README.md +5 -0
  182. package/presets/cursor/go/commands/update.md +1 -0
  183. package/presets/cursor/go/hooks/README.md +2 -1
  184. package/presets/cursor/go/hooks/chain-team-phases.sh +200 -4
  185. package/presets/cursor/go/hooks/examples/README.md +1 -1
  186. package/presets/cursor/go/hooks/guard-shell-command.mjs +95 -0
  187. package/presets/cursor/go/hooks/run-hook.mjs +102 -0
  188. package/presets/cursor/go/hooks.json +2 -2
  189. package/presets/cursor/go/rules/code-review-mr.mdc +10 -0
  190. package/presets/cursor/go/team/README.md +5 -0
  191. package/presets/cursor/ios-swift/commands/update.md +1 -0
  192. package/presets/cursor/ios-swift/hooks/README.md +2 -1
  193. package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +200 -4
  194. package/presets/cursor/ios-swift/hooks/examples/README.md +1 -1
  195. package/presets/cursor/ios-swift/hooks/guard-shell-command.mjs +95 -0
  196. package/presets/cursor/ios-swift/hooks/run-hook.mjs +102 -0
  197. package/presets/cursor/ios-swift/hooks.json +2 -2
  198. package/presets/cursor/ios-swift/rules/code-review-mr.mdc +10 -0
  199. package/presets/cursor/ios-swift/team/README.md +5 -0
  200. package/presets/cursor/java/commands/update.md +1 -0
  201. package/presets/cursor/java/hooks/README.md +2 -1
  202. package/presets/cursor/java/hooks/chain-team-phases.sh +200 -4
  203. package/presets/cursor/java/hooks/examples/README.md +1 -1
  204. package/presets/cursor/java/hooks/guard-shell-command.mjs +96 -0
  205. package/presets/cursor/java/hooks/run-hook.mjs +102 -0
  206. package/presets/cursor/java/hooks.json +2 -2
  207. package/presets/cursor/java/rules/code-review-mr.mdc +10 -0
  208. package/presets/cursor/java/team/README.md +5 -0
  209. package/presets/cursor/mcp-ts/commands/update.md +1 -0
  210. package/presets/cursor/mcp-ts/hooks/README.md +2 -1
  211. package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +200 -4
  212. package/presets/cursor/mcp-ts/hooks/guard-shell-command.mjs +95 -0
  213. package/presets/cursor/mcp-ts/hooks/run-hook.mjs +102 -0
  214. package/presets/cursor/mcp-ts/hooks.json +2 -2
  215. package/presets/cursor/mcp-ts/rules/code-review-mr.mdc +10 -0
  216. package/presets/cursor/mcp-ts/team/README.md +5 -0
  217. package/presets/cursor/mol/MCP.md +4 -3
  218. package/presets/cursor/mol/commands/update.md +1 -0
  219. package/presets/cursor/mol/hooks/README.md +2 -1
  220. package/presets/cursor/mol/hooks/chain-team-phases.sh +200 -4
  221. package/presets/cursor/mol/hooks/examples/README.md +1 -1
  222. package/presets/{claude/next/hooks/guard-shell-command.sh → cursor/mol/hooks/guard-shell-command.mjs} +29 -35
  223. package/presets/cursor/mol/hooks/run-hook.mjs +102 -0
  224. package/presets/cursor/mol/hooks.json +2 -2
  225. package/presets/cursor/mol/rules/code-review-mr.mdc +10 -0
  226. package/presets/cursor/mol/team/README.md +5 -0
  227. package/presets/cursor/next/MCP.md +4 -3
  228. package/presets/cursor/next/agents/build-verifier.md +4 -0
  229. package/presets/cursor/next/agents/code-reviewer.md +10 -0
  230. package/presets/cursor/next/agents/feature-developer.md +1 -0
  231. package/presets/cursor/next/agents/task-analyst.md +4 -0
  232. package/presets/cursor/next/agents/task-router.md +5 -3
  233. package/presets/cursor/next/commands/README.md +1 -0
  234. package/presets/cursor/next/commands/task-continue.md +4 -2
  235. package/presets/cursor/next/commands/update.md +1 -0
  236. package/presets/cursor/next/commands/upstream-research.md +23 -0
  237. package/presets/cursor/next/hooks/README.md +2 -1
  238. package/presets/cursor/next/hooks/chain-team-phases.sh +200 -4
  239. package/presets/cursor/next/hooks/examples/README.md +1 -1
  240. package/presets/cursor/next/hooks/guard-shell-command.mjs +94 -0
  241. package/presets/cursor/next/hooks/run-hook.mjs +102 -0
  242. package/presets/cursor/next/hooks.json +2 -2
  243. package/presets/cursor/next/rules/code-review-mr.mdc +10 -0
  244. package/presets/cursor/next/team/README.md +23 -0
  245. package/presets/cursor/next/team/upstream/config.json +31 -0
  246. package/presets/cursor/next/team/upstream/digest-template.md +55 -0
  247. package/presets/cursor/next/team/upstream/opencode.json +34 -0
  248. package/presets/cursor/next/team/upstream/projects.json +4 -0
  249. package/presets/cursor/next/team/upstream/prompt.md +77 -0
  250. package/presets/cursor/next/team/upstream/signatures.json +9 -0
  251. package/presets/cursor/nuxt/commands/update.md +1 -0
  252. package/presets/cursor/nuxt/hooks/README.md +2 -1
  253. package/presets/cursor/nuxt/hooks/chain-team-phases.sh +200 -4
  254. package/presets/cursor/nuxt/hooks/examples/README.md +1 -1
  255. package/presets/cursor/nuxt/hooks/guard-shell-command.mjs +94 -0
  256. package/presets/cursor/nuxt/hooks/run-hook.mjs +102 -0
  257. package/presets/cursor/nuxt/hooks.json +2 -2
  258. package/presets/cursor/nuxt/rules/code-review-mr.mdc +10 -0
  259. package/presets/cursor/nuxt/team/README.md +5 -0
  260. package/presets/cursor/php-hexagonal/commands/update.md +1 -0
  261. package/presets/cursor/php-hexagonal/hooks/README.md +2 -1
  262. package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +200 -4
  263. package/presets/cursor/php-hexagonal/hooks/examples/README.md +1 -1
  264. package/presets/cursor/php-hexagonal/hooks/guard-shell-command.mjs +96 -0
  265. package/presets/cursor/php-hexagonal/hooks/run-hook.mjs +102 -0
  266. package/presets/cursor/php-hexagonal/hooks.json +2 -2
  267. package/presets/cursor/php-hexagonal/rules/code-review-mr.mdc +10 -0
  268. package/presets/cursor/php-hexagonal/team/README.md +5 -0
  269. package/presets/cursor/php-laravel/commands/update.md +1 -0
  270. package/presets/cursor/php-laravel/hooks/README.md +2 -1
  271. package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +200 -4
  272. package/presets/cursor/php-laravel/hooks/examples/README.md +1 -1
  273. package/presets/cursor/php-laravel/hooks/guard-shell-command.mjs +96 -0
  274. package/presets/cursor/php-laravel/hooks/run-hook.mjs +102 -0
  275. package/presets/cursor/php-laravel/hooks.json +2 -2
  276. package/presets/cursor/php-laravel/rules/code-review-mr.mdc +10 -0
  277. package/presets/cursor/php-laravel/team/README.md +5 -0
  278. package/presets/cursor/svelte/commands/update.md +1 -0
  279. package/presets/cursor/svelte/hooks/README.md +2 -1
  280. package/presets/cursor/svelte/hooks/chain-team-phases.sh +200 -4
  281. package/presets/cursor/svelte/hooks/examples/README.md +1 -1
  282. package/presets/cursor/svelte/hooks/guard-shell-command.mjs +94 -0
  283. package/presets/cursor/svelte/hooks/run-hook.mjs +102 -0
  284. package/presets/cursor/svelte/hooks.json +2 -2
  285. package/presets/cursor/svelte/rules/code-review-mr.mdc +10 -0
  286. package/presets/cursor/svelte/team/README.md +5 -0
  287. package/presets/mavis/android-kotlin/adapter-map.json +11 -3
  288. package/presets/mavis/android-kotlin/commands/update.md +1 -0
  289. package/presets/mavis/android-kotlin/hooks/README.md +2 -1
  290. package/presets/mavis/android-kotlin/hooks/chain-team-phases.sh +200 -4
  291. package/presets/mavis/android-kotlin/rules/agent-team-orchestrator.md +12 -0
  292. package/presets/mavis/android-kotlin/rules/code-review-mr.md +10 -0
  293. package/presets/mavis/android-kotlin/team/README.md +5 -0
  294. package/presets/mavis/go/adapter-map.json +11 -3
  295. package/presets/mavis/go/commands/update.md +1 -0
  296. package/presets/mavis/go/hooks/README.md +2 -1
  297. package/presets/mavis/go/hooks/chain-team-phases.sh +200 -4
  298. package/presets/mavis/go/rules/agent-team-orchestrator.md +12 -0
  299. package/presets/mavis/go/rules/code-review-mr.md +10 -0
  300. package/presets/mavis/go/team/README.md +5 -0
  301. package/presets/mavis/ios-swift/adapter-map.json +11 -3
  302. package/presets/mavis/ios-swift/commands/update.md +1 -0
  303. package/presets/mavis/ios-swift/hooks/README.md +2 -1
  304. package/presets/mavis/ios-swift/hooks/chain-team-phases.sh +200 -4
  305. package/presets/mavis/ios-swift/rules/agent-team-orchestrator.md +12 -0
  306. package/presets/mavis/ios-swift/rules/code-review-mr.md +10 -0
  307. package/presets/mavis/ios-swift/team/README.md +5 -0
  308. package/presets/mavis/java/adapter-map.json +11 -3
  309. package/presets/mavis/java/commands/update.md +1 -0
  310. package/presets/mavis/java/hooks/README.md +2 -1
  311. package/presets/mavis/java/hooks/chain-team-phases.sh +200 -4
  312. package/presets/mavis/java/rules/agent-team-orchestrator.md +12 -0
  313. package/presets/mavis/java/rules/code-review-mr.md +10 -0
  314. package/presets/mavis/java/team/README.md +5 -0
  315. package/presets/mavis/mcp-ts/adapter-map.json +11 -3
  316. package/presets/mavis/mcp-ts/commands/update.md +1 -0
  317. package/presets/mavis/mcp-ts/hooks/README.md +2 -1
  318. package/presets/mavis/mcp-ts/hooks/chain-team-phases.sh +200 -4
  319. package/presets/mavis/mcp-ts/rules/agent-team-orchestrator.md +12 -0
  320. package/presets/mavis/mcp-ts/rules/code-review-mr.md +10 -0
  321. package/presets/mavis/mcp-ts/team/README.md +5 -0
  322. package/presets/mavis/mol/MCP.md +4 -3
  323. package/presets/mavis/mol/adapter-map.json +11 -3
  324. package/presets/mavis/mol/commands/update.md +1 -0
  325. package/presets/mavis/mol/hooks/README.md +2 -1
  326. package/presets/mavis/mol/hooks/chain-team-phases.sh +200 -4
  327. package/presets/mavis/mol/rules/agent-team-orchestrator.md +12 -0
  328. package/presets/mavis/mol/rules/code-review-mr.md +10 -0
  329. package/presets/mavis/mol/team/README.md +5 -0
  330. package/presets/mavis/next/MCP.md +4 -3
  331. package/presets/mavis/next/adapter-map.json +67 -3
  332. package/presets/mavis/next/agents/build-verifier.md +4 -0
  333. package/presets/mavis/next/agents/code-reviewer.md +10 -0
  334. package/presets/mavis/next/agents/feature-developer.md +1 -0
  335. package/presets/mavis/next/agents/task-analyst.md +4 -0
  336. package/presets/mavis/next/agents/task-router.md +5 -3
  337. package/presets/mavis/next/commands/README.md +1 -0
  338. package/presets/mavis/next/commands/task-continue.md +4 -2
  339. package/presets/mavis/next/commands/update.md +1 -0
  340. package/presets/mavis/next/commands/upstream-research.md +18 -0
  341. package/presets/mavis/next/hooks/README.md +2 -1
  342. package/presets/mavis/next/hooks/chain-team-phases.sh +200 -4
  343. package/presets/mavis/next/rules/agent-team-orchestrator.md +12 -0
  344. package/presets/mavis/next/rules/code-review-mr.md +10 -0
  345. package/presets/mavis/next/team/README.md +23 -0
  346. package/presets/mavis/next/team/upstream/config.json +31 -0
  347. package/presets/mavis/next/team/upstream/digest-template.md +55 -0
  348. package/presets/mavis/next/team/upstream/opencode.json +34 -0
  349. package/presets/mavis/next/team/upstream/projects.json +4 -0
  350. package/presets/mavis/next/team/upstream/prompt.md +77 -0
  351. package/presets/mavis/next/team/upstream/signatures.json +9 -0
  352. package/presets/mavis/nuxt/adapter-map.json +11 -3
  353. package/presets/mavis/nuxt/commands/update.md +1 -0
  354. package/presets/mavis/nuxt/hooks/README.md +2 -1
  355. package/presets/mavis/nuxt/hooks/chain-team-phases.sh +200 -4
  356. package/presets/mavis/nuxt/rules/agent-team-orchestrator.md +12 -0
  357. package/presets/mavis/nuxt/rules/code-review-mr.md +10 -0
  358. package/presets/mavis/nuxt/team/README.md +5 -0
  359. package/presets/mavis/php-hexagonal/adapter-map.json +11 -3
  360. package/presets/mavis/php-hexagonal/commands/update.md +1 -0
  361. package/presets/mavis/php-hexagonal/hooks/README.md +2 -1
  362. package/presets/mavis/php-hexagonal/hooks/chain-team-phases.sh +200 -4
  363. package/presets/mavis/php-hexagonal/rules/agent-team-orchestrator.md +12 -0
  364. package/presets/mavis/php-hexagonal/rules/code-review-mr.md +10 -0
  365. package/presets/mavis/php-hexagonal/team/README.md +5 -0
  366. package/presets/mavis/php-laravel/adapter-map.json +11 -3
  367. package/presets/mavis/php-laravel/commands/update.md +1 -0
  368. package/presets/mavis/php-laravel/hooks/README.md +2 -1
  369. package/presets/mavis/php-laravel/hooks/chain-team-phases.sh +200 -4
  370. package/presets/mavis/php-laravel/rules/agent-team-orchestrator.md +12 -0
  371. package/presets/mavis/php-laravel/rules/code-review-mr.md +10 -0
  372. package/presets/mavis/php-laravel/team/README.md +5 -0
  373. package/presets/mavis/svelte/adapter-map.json +11 -3
  374. package/presets/mavis/svelte/commands/update.md +1 -0
  375. package/presets/mavis/svelte/hooks/README.md +2 -1
  376. package/presets/mavis/svelte/hooks/chain-team-phases.sh +200 -4
  377. package/presets/mavis/svelte/rules/agent-team-orchestrator.md +12 -0
  378. package/presets/mavis/svelte/rules/code-review-mr.md +10 -0
  379. package/presets/mavis/svelte/team/README.md +5 -0
  380. package/presets/opencode/android-kotlin/OPENCODE.md +1 -1
  381. package/presets/opencode/android-kotlin/README.md +1 -1
  382. package/presets/opencode/android-kotlin/adapter-map.json +11 -3
  383. package/presets/opencode/android-kotlin/commands/update.md +1 -0
  384. package/presets/opencode/android-kotlin/hooks/README.md +3 -2
  385. package/presets/opencode/android-kotlin/hooks/chain-team-phases.sh +200 -4
  386. package/presets/opencode/android-kotlin/rules/agent-team-orchestrator.md +12 -0
  387. package/presets/opencode/android-kotlin/rules/code-review-mr.md +10 -0
  388. package/presets/opencode/android-kotlin/team/README.md +5 -0
  389. package/presets/opencode/go/OPENCODE.md +1 -1
  390. package/presets/opencode/go/README.md +1 -1
  391. package/presets/opencode/go/adapter-map.json +11 -3
  392. package/presets/opencode/go/commands/update.md +1 -0
  393. package/presets/opencode/go/hooks/README.md +3 -2
  394. package/presets/opencode/go/hooks/chain-team-phases.sh +200 -4
  395. package/presets/opencode/go/rules/agent-team-orchestrator.md +12 -0
  396. package/presets/opencode/go/rules/code-review-mr.md +10 -0
  397. package/presets/opencode/go/team/README.md +5 -0
  398. package/presets/opencode/ios-swift/OPENCODE.md +1 -1
  399. package/presets/opencode/ios-swift/README.md +1 -1
  400. package/presets/opencode/ios-swift/adapter-map.json +11 -3
  401. package/presets/opencode/ios-swift/commands/update.md +1 -0
  402. package/presets/opencode/ios-swift/hooks/README.md +3 -2
  403. package/presets/opencode/ios-swift/hooks/chain-team-phases.sh +200 -4
  404. package/presets/opencode/ios-swift/rules/agent-team-orchestrator.md +12 -0
  405. package/presets/opencode/ios-swift/rules/code-review-mr.md +10 -0
  406. package/presets/opencode/ios-swift/team/README.md +5 -0
  407. package/presets/opencode/java/OPENCODE.md +1 -1
  408. package/presets/opencode/java/README.md +1 -1
  409. package/presets/opencode/java/adapter-map.json +11 -3
  410. package/presets/opencode/java/commands/update.md +1 -0
  411. package/presets/opencode/java/hooks/README.md +3 -2
  412. package/presets/opencode/java/hooks/chain-team-phases.sh +200 -4
  413. package/presets/opencode/java/rules/agent-team-orchestrator.md +12 -0
  414. package/presets/opencode/java/rules/code-review-mr.md +10 -0
  415. package/presets/opencode/java/team/README.md +5 -0
  416. package/presets/opencode/mcp-ts/OPENCODE.md +1 -1
  417. package/presets/opencode/mcp-ts/README.md +1 -1
  418. package/presets/opencode/mcp-ts/adapter-map.json +11 -3
  419. package/presets/opencode/mcp-ts/commands/update.md +1 -0
  420. package/presets/opencode/mcp-ts/hooks/README.md +3 -2
  421. package/presets/opencode/mcp-ts/hooks/chain-team-phases.sh +200 -4
  422. package/presets/opencode/mcp-ts/rules/agent-team-orchestrator.md +12 -0
  423. package/presets/opencode/mcp-ts/rules/code-review-mr.md +10 -0
  424. package/presets/opencode/mcp-ts/team/README.md +5 -0
  425. package/presets/opencode/mol/MCP.md +4 -3
  426. package/presets/opencode/mol/OPENCODE.md +1 -1
  427. package/presets/opencode/mol/README.md +1 -1
  428. package/presets/opencode/mol/adapter-map.json +11 -3
  429. package/presets/opencode/mol/commands/update.md +1 -0
  430. package/presets/opencode/mol/hooks/README.md +3 -2
  431. package/presets/opencode/mol/hooks/chain-team-phases.sh +200 -4
  432. package/presets/opencode/mol/rules/agent-team-orchestrator.md +12 -0
  433. package/presets/opencode/mol/rules/code-review-mr.md +10 -0
  434. package/presets/opencode/mol/team/README.md +5 -0
  435. package/presets/opencode/next/MCP.md +4 -3
  436. package/presets/opencode/next/OPENCODE.md +1 -1
  437. package/presets/opencode/next/README.md +1 -1
  438. package/presets/opencode/next/adapter-map.json +67 -3
  439. package/presets/opencode/next/agents/build-verifier.md +4 -0
  440. package/presets/opencode/next/agents/code-reviewer.md +10 -0
  441. package/presets/opencode/next/agents/feature-developer.md +1 -0
  442. package/presets/opencode/next/agents/task-analyst.md +4 -0
  443. package/presets/opencode/next/agents/task-router.md +5 -3
  444. package/presets/opencode/next/commands/README.md +1 -0
  445. package/presets/opencode/next/commands/task-continue.md +4 -2
  446. package/presets/opencode/next/commands/update.md +1 -0
  447. package/presets/opencode/next/commands/upstream-research.md +26 -0
  448. package/presets/opencode/next/hooks/README.md +3 -2
  449. package/presets/opencode/next/hooks/chain-team-phases.sh +200 -4
  450. package/presets/opencode/next/rules/agent-team-orchestrator.md +12 -0
  451. package/presets/opencode/next/rules/code-review-mr.md +10 -0
  452. package/presets/opencode/next/team/README.md +23 -0
  453. package/presets/opencode/next/team/upstream/config.json +31 -0
  454. package/presets/opencode/next/team/upstream/digest-template.md +55 -0
  455. package/presets/opencode/next/team/upstream/opencode.json +34 -0
  456. package/presets/opencode/next/team/upstream/projects.json +4 -0
  457. package/presets/opencode/next/team/upstream/prompt.md +77 -0
  458. package/presets/opencode/next/team/upstream/signatures.json +9 -0
  459. package/presets/opencode/nuxt/OPENCODE.md +1 -1
  460. package/presets/opencode/nuxt/README.md +1 -1
  461. package/presets/opencode/nuxt/adapter-map.json +11 -3
  462. package/presets/opencode/nuxt/commands/update.md +1 -0
  463. package/presets/opencode/nuxt/hooks/README.md +3 -2
  464. package/presets/opencode/nuxt/hooks/chain-team-phases.sh +200 -4
  465. package/presets/opencode/nuxt/rules/agent-team-orchestrator.md +12 -0
  466. package/presets/opencode/nuxt/rules/code-review-mr.md +10 -0
  467. package/presets/opencode/nuxt/team/README.md +5 -0
  468. package/presets/opencode/php-hexagonal/OPENCODE.md +1 -1
  469. package/presets/opencode/php-hexagonal/README.md +1 -1
  470. package/presets/opencode/php-hexagonal/adapter-map.json +11 -3
  471. package/presets/opencode/php-hexagonal/commands/update.md +1 -0
  472. package/presets/opencode/php-hexagonal/hooks/README.md +3 -2
  473. package/presets/opencode/php-hexagonal/hooks/chain-team-phases.sh +200 -4
  474. package/presets/opencode/php-hexagonal/rules/agent-team-orchestrator.md +12 -0
  475. package/presets/opencode/php-hexagonal/rules/code-review-mr.md +10 -0
  476. package/presets/opencode/php-hexagonal/team/README.md +5 -0
  477. package/presets/opencode/php-laravel/OPENCODE.md +1 -1
  478. package/presets/opencode/php-laravel/README.md +1 -1
  479. package/presets/opencode/php-laravel/adapter-map.json +11 -3
  480. package/presets/opencode/php-laravel/commands/update.md +1 -0
  481. package/presets/opencode/php-laravel/hooks/README.md +3 -2
  482. package/presets/opencode/php-laravel/hooks/chain-team-phases.sh +200 -4
  483. package/presets/opencode/php-laravel/rules/agent-team-orchestrator.md +12 -0
  484. package/presets/opencode/php-laravel/rules/code-review-mr.md +10 -0
  485. package/presets/opencode/php-laravel/team/README.md +5 -0
  486. package/presets/opencode/svelte/OPENCODE.md +1 -1
  487. package/presets/opencode/svelte/README.md +1 -1
  488. package/presets/opencode/svelte/adapter-map.json +11 -3
  489. package/presets/opencode/svelte/commands/update.md +1 -0
  490. package/presets/opencode/svelte/hooks/README.md +3 -2
  491. package/presets/opencode/svelte/hooks/chain-team-phases.sh +200 -4
  492. package/presets/opencode/svelte/rules/agent-team-orchestrator.md +12 -0
  493. package/presets/opencode/svelte/rules/code-review-mr.md +10 -0
  494. package/presets/opencode/svelte/team/README.md +5 -0
  495. package/presets/zcode/android-kotlin/adapter-map.json +11 -3
  496. package/presets/zcode/android-kotlin/commands/update.md +1 -0
  497. package/presets/zcode/android-kotlin/hooks/README.md +2 -1
  498. package/presets/zcode/android-kotlin/hooks/chain-team-phases.sh +200 -4
  499. package/presets/zcode/android-kotlin/rules/agent-team-orchestrator.md +12 -0
  500. package/presets/zcode/android-kotlin/rules/code-review-mr.md +10 -0
  501. package/presets/zcode/android-kotlin/team/README.md +5 -0
  502. package/presets/zcode/go/adapter-map.json +11 -3
  503. package/presets/zcode/go/commands/update.md +1 -0
  504. package/presets/zcode/go/hooks/README.md +2 -1
  505. package/presets/zcode/go/hooks/chain-team-phases.sh +200 -4
  506. package/presets/zcode/go/rules/agent-team-orchestrator.md +12 -0
  507. package/presets/zcode/go/rules/code-review-mr.md +10 -0
  508. package/presets/zcode/go/team/README.md +5 -0
  509. package/presets/zcode/ios-swift/adapter-map.json +11 -3
  510. package/presets/zcode/ios-swift/commands/update.md +1 -0
  511. package/presets/zcode/ios-swift/hooks/README.md +2 -1
  512. package/presets/zcode/ios-swift/hooks/chain-team-phases.sh +200 -4
  513. package/presets/zcode/ios-swift/rules/agent-team-orchestrator.md +12 -0
  514. package/presets/zcode/ios-swift/rules/code-review-mr.md +10 -0
  515. package/presets/zcode/ios-swift/team/README.md +5 -0
  516. package/presets/zcode/java/adapter-map.json +11 -3
  517. package/presets/zcode/java/commands/update.md +1 -0
  518. package/presets/zcode/java/hooks/README.md +2 -1
  519. package/presets/zcode/java/hooks/chain-team-phases.sh +200 -4
  520. package/presets/zcode/java/rules/agent-team-orchestrator.md +12 -0
  521. package/presets/zcode/java/rules/code-review-mr.md +10 -0
  522. package/presets/zcode/java/team/README.md +5 -0
  523. package/presets/zcode/mcp-ts/adapter-map.json +11 -3
  524. package/presets/zcode/mcp-ts/commands/update.md +1 -0
  525. package/presets/zcode/mcp-ts/hooks/README.md +2 -1
  526. package/presets/zcode/mcp-ts/hooks/chain-team-phases.sh +200 -4
  527. package/presets/zcode/mcp-ts/rules/agent-team-orchestrator.md +12 -0
  528. package/presets/zcode/mcp-ts/rules/code-review-mr.md +10 -0
  529. package/presets/zcode/mcp-ts/team/README.md +5 -0
  530. package/presets/zcode/mol/MCP.md +4 -3
  531. package/presets/zcode/mol/adapter-map.json +11 -3
  532. package/presets/zcode/mol/commands/update.md +1 -0
  533. package/presets/zcode/mol/hooks/README.md +2 -1
  534. package/presets/zcode/mol/hooks/chain-team-phases.sh +200 -4
  535. package/presets/zcode/mol/rules/agent-team-orchestrator.md +12 -0
  536. package/presets/zcode/mol/rules/code-review-mr.md +10 -0
  537. package/presets/zcode/mol/team/README.md +5 -0
  538. package/presets/zcode/next/MCP.md +4 -3
  539. package/presets/zcode/next/adapter-map.json +67 -3
  540. package/presets/zcode/next/agents/build-verifier.md +4 -0
  541. package/presets/zcode/next/agents/code-reviewer.md +10 -0
  542. package/presets/zcode/next/agents/feature-developer.md +1 -0
  543. package/presets/zcode/next/agents/task-analyst.md +4 -0
  544. package/presets/zcode/next/agents/task-router.md +5 -3
  545. package/presets/zcode/next/commands/README.md +1 -0
  546. package/presets/zcode/next/commands/task-continue.md +4 -2
  547. package/presets/zcode/next/commands/update.md +1 -0
  548. package/presets/zcode/next/commands/upstream-research.md +26 -0
  549. package/presets/zcode/next/hooks/README.md +2 -1
  550. package/presets/zcode/next/hooks/chain-team-phases.sh +200 -4
  551. package/presets/zcode/next/rules/agent-team-orchestrator.md +12 -0
  552. package/presets/zcode/next/rules/code-review-mr.md +10 -0
  553. package/presets/zcode/next/team/README.md +23 -0
  554. package/presets/zcode/next/team/upstream/config.json +31 -0
  555. package/presets/zcode/next/team/upstream/digest-template.md +55 -0
  556. package/presets/zcode/next/team/upstream/opencode.json +34 -0
  557. package/presets/zcode/next/team/upstream/projects.json +4 -0
  558. package/presets/zcode/next/team/upstream/prompt.md +77 -0
  559. package/presets/zcode/next/team/upstream/signatures.json +9 -0
  560. package/presets/zcode/nuxt/adapter-map.json +11 -3
  561. package/presets/zcode/nuxt/commands/update.md +1 -0
  562. package/presets/zcode/nuxt/hooks/README.md +2 -1
  563. package/presets/zcode/nuxt/hooks/chain-team-phases.sh +200 -4
  564. package/presets/zcode/nuxt/rules/agent-team-orchestrator.md +12 -0
  565. package/presets/zcode/nuxt/rules/code-review-mr.md +10 -0
  566. package/presets/zcode/nuxt/team/README.md +5 -0
  567. package/presets/zcode/php-hexagonal/adapter-map.json +11 -3
  568. package/presets/zcode/php-hexagonal/commands/update.md +1 -0
  569. package/presets/zcode/php-hexagonal/hooks/README.md +2 -1
  570. package/presets/zcode/php-hexagonal/hooks/chain-team-phases.sh +200 -4
  571. package/presets/zcode/php-hexagonal/rules/agent-team-orchestrator.md +12 -0
  572. package/presets/zcode/php-hexagonal/rules/code-review-mr.md +10 -0
  573. package/presets/zcode/php-hexagonal/team/README.md +5 -0
  574. package/presets/zcode/php-laravel/adapter-map.json +11 -3
  575. package/presets/zcode/php-laravel/commands/update.md +1 -0
  576. package/presets/zcode/php-laravel/hooks/README.md +2 -1
  577. package/presets/zcode/php-laravel/hooks/chain-team-phases.sh +200 -4
  578. package/presets/zcode/php-laravel/rules/agent-team-orchestrator.md +12 -0
  579. package/presets/zcode/php-laravel/rules/code-review-mr.md +10 -0
  580. package/presets/zcode/php-laravel/team/README.md +5 -0
  581. package/presets/zcode/svelte/adapter-map.json +11 -3
  582. package/presets/zcode/svelte/commands/update.md +1 -0
  583. package/presets/zcode/svelte/hooks/README.md +2 -1
  584. package/presets/zcode/svelte/hooks/chain-team-phases.sh +200 -4
  585. package/presets/zcode/svelte/rules/agent-team-orchestrator.md +12 -0
  586. package/presets/zcode/svelte/rules/code-review-mr.md +10 -0
  587. package/presets/zcode/svelte/team/README.md +5 -0
  588. package/presets/claude/android-kotlin/hooks/guard-shell-command.sh +0 -103
  589. package/presets/claude/go/hooks/guard-shell-command.sh +0 -102
  590. package/presets/claude/mcp-ts/hooks/guard-shell-command.sh +0 -102
  591. package/presets/claude/php-hexagonal/hooks/guard-shell-command.sh +0 -103
  592. package/presets/claude/php-laravel/hooks/guard-shell-command.sh +0 -103
  593. package/presets/cursor/android-kotlin/hooks/guard-shell-command.sh +0 -80
  594. package/presets/cursor/go/hooks/guard-shell-command.sh +0 -79
  595. package/presets/cursor/ios-swift/hooks/guard-shell-command.sh +0 -79
  596. package/presets/cursor/java/hooks/guard-shell-command.sh +0 -80
  597. package/presets/cursor/mcp-ts/hooks/guard-shell-command.sh +0 -79
  598. package/presets/cursor/mol/hooks/guard-shell-command.sh +0 -77
  599. package/presets/cursor/next/hooks/guard-shell-command.sh +0 -77
  600. package/presets/cursor/nuxt/hooks/guard-shell-command.sh +0 -77
  601. package/presets/cursor/php-hexagonal/hooks/guard-shell-command.sh +0 -80
  602. package/presets/cursor/php-laravel/hooks/guard-shell-command.sh +0 -80
  603. package/presets/cursor/svelte/hooks/guard-shell-command.sh +0 -77
@@ -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'];
@@ -23,11 +23,20 @@ const AI_LOCAL_GITIGNORE = [
23
23
  '.rollback/',
24
24
  '.template-base.json',
25
25
  '*.intent',
26
+ '# Operator pause sentinels; local runtime state, never commit.',
27
+ 'STOP',
28
+ 'ESTOP',
26
29
  '# Rebuildable SQLite projection of .ai.local/team; never commit a database.',
27
30
  'team.db',
28
31
  'team.db-wal',
29
32
  'team.db-shm',
30
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',
31
40
  '',
32
41
  ].join('\n');
33
42
  const POINTER_README = `# Agent team artifacts moved
@@ -236,11 +245,11 @@ function ensureRollbackIgnored(rollbackRoot) {
236
245
 
237
246
  /**
238
247
  * Make `.ai.local/` cover the files the self-learning engine writes beside its
239
- * scripts (`*.lock`, `*.tmp`) and the migration backups (`.rollback/`). A
240
- * `.gitignore` inside `.ai.local/` is used instead of appending to the
241
- * consumer's root `.gitignore`: the CLI never edits that file, and this works
242
- * even in a repo that has no `.gitignore` at all. An existing file keeps its
243
- * own lines; missing required lines are appended.
248
+ * scripts (`*.lock`, `*.tmp`), the operator pause sentinels (`STOP`, `ESTOP`),
249
+ * and the migration backups (`.rollback/`). A `.gitignore` inside `.ai.local/`
250
+ * is used instead of appending to the consumer's root `.gitignore`: the CLI never
251
+ * edits that file, and this works even in a repo that has no `.gitignore` at
252
+ * all. An existing file keeps its own lines; missing required lines are appended.
244
253
  */
245
254
  function ensureAiLocalIgnored(aiLocalRoot) {
246
255
  const ignoreFile = path.join(aiLocalRoot, '.gitignore');
@@ -259,17 +268,6 @@ function ensureAiLocalIgnored(aiLocalRoot) {
259
268
  return true;
260
269
  }
261
270
 
262
- /**
263
- * Preset-root-relative directory holding the shipped engine scripts.
264
- * `presetTeamSrc` is `<presetBase>/team`, so three levels up is the preset root.
265
- */
266
- function engineSourceDir(presetTeamSrc) {
267
- if (!presetTeamSrc) {
268
- return null;
269
- }
270
- return path.resolve(presetTeamSrc, '..', '..', '..', ...ENGINE_SOURCE_RELATIVE.split('/'));
271
- }
272
-
273
271
  /**
274
272
  * Seed the shipped self-learning engine (`presets/_shared/ai-local/scripts/`)
275
273
  * into `<cwd>/.ai.local/scripts/`. Skip-if-exists: a consumer edit is never
@@ -281,7 +279,8 @@ function seedEngineScripts({ cwd, presetTeamSrc }) {
281
279
  if (!presetTeamSrc) {
282
280
  return result;
283
281
  }
284
- const sourceDir = engineSourceDir(presetTeamSrc);
282
+ // `presetTeamSrc` is `<presetBase>/team`; three levels up is the `presets/` root.
283
+ const sourceDir = engineSourceDir(path.resolve(presetTeamSrc, '..', '..', '..'));
285
284
  if (!fs.existsSync(sourceDir) || !fs.statSync(sourceDir).isDirectory()) {
286
285
  return result;
287
286
  }
@@ -336,6 +335,25 @@ function copyTemplates(presetTeamSrc, dest) {
336
335
  written.push(`.ai.local/team/fixtures/${rel}`);
337
336
  }
338
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
+ }
339
357
  const gitkeepSrc = path.join(presetTeamSrc, 'tasks', '.gitkeep');
340
358
  if (fs.existsSync(gitkeepSrc) && !hasConsumerTaskSlugs(path.join(dest, 'tasks'))) {
341
359
  copyFile(gitkeepSrc, path.join(dest, 'tasks', '.gitkeep'));
@@ -668,7 +686,7 @@ function templateEntries(presetTeamSrc) {
668
686
  // preset keeps precedence because it is added after this line.
669
687
  addFile('.ai.local/rules/router-pages.md', path.join(libraryDir, 'router-pages.md'));
670
688
  addDir('.ai.local/rules/', path.join(presetBase, 'ai-local', 'rules'), (name) => name.endsWith('.md'));
671
- const engineDir = engineSourceDir(presetTeamSrc);
689
+ const engineDir = engineSourceDir(path.resolve(presetTeamSrc, '..', '..', '..'));
672
690
  if (engineDir) {
673
691
  for (const name of ENGINE_SCRIPTS) {
674
692
  addFile(`.ai.local/scripts/${name}`, path.join(engineDir, name));
@@ -0,0 +1,84 @@
1
+ # Project MCP catalog: `init mcp`
2
+
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).
10
+
11
+ ```bash
12
+ npx @bonesofspring/ai-rules@latest init mcp context7
13
+ npx @bonesofspring/ai-rules@latest init mcp figma-desktop figma-cloud
14
+ npx @bonesofspring/ai-rules@latest init mcp --all
15
+ npx @bonesofspring/ai-rules@latest init mcp --all --tools cursor,claude
16
+ ```
17
+
18
+ ## Names
19
+
20
+ | Name | Entry | Notes |
21
+ |------|-------|-------|
22
+ | `context7` | `npx -y @upstash/context7-mcp@4.5.0` | |
23
+ | `playwright` | `npx -y @playwright/mcp@0.0.84` | Claude Code stores it as `playwright-test` |
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` |
28
+ | `figma-desktop` | `http://127.0.0.1:3845/mcp` | Alias `figma`; needs the Figma desktop app and a Dev/Full seat |
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` |
36
+
37
+ `--all` selects every row. `figma` and `figma-desktop` resolve to the same entry.
38
+
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.
40
+
41
+ ## What it writes
42
+
43
+ | Client | File | Shape |
44
+ |--------|------|-------|
45
+ | Cursor | `.cursor/mcp.json` | `mcpServers` |
46
+ | Claude Code | `.mcp.json` (project root) | `mcpServers`; remote entries carry `type: "http"` |
47
+ | Mavis | `.mavis/mcp.json` | `mcpServers` |
48
+ | OpenCode | `opencode.json` | `mcp`; `type: "local"` with an argv array, `type: "remote"` for a URL |
49
+ | ZCode | `.zcode/config.json` | nested `mcp.servers` |
50
+
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.
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
+
66
+ ## Merge rules
67
+
68
+ `init mcp` merges like `init`:
69
+
70
+ - a server id in the catalog is written or refreshed; its scalar fields (`command`, `args`, `url`, `type`) win;
71
+ - another server id in the same file is kept untouched;
72
+ - consumer `env` / `headers` on a catalog id survive unless the catalog entry defines the same nested key (the catalog defines none, so tokens stay);
73
+ - other top-level keys in the file stay;
74
+ - a second run is byte-identical and does not move the file mtime;
75
+ - a file that is not valid JSON, or whose `mcp` / `mcpServers` key is not an object, fails with exit 1 and is left untouched.
76
+
77
+ ## Reconnect
78
+
79
+ After the first install, restart the server in the client:
80
+
81
+ - OpenCode: `opencode reload`
82
+ - Cursor: Settings → MCP → restart the server
83
+ - Claude Code: `/mcp`, then approve the server
84
+ - Mavis / ZCode: reconnect the server
package/docs/MCP-SETUP.md CHANGED
@@ -1,15 +1,17 @@
1
- # MCP setup: GitLab, Yandex Tracker, Yandex Wiki
1
+ # MCP setup: GitLab, GitHub, Yandex Tracker, Yandex Wiki, DefectDojo
2
2
 
3
- Two 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`.
7
- Both sequences are idempotent: rerun a step instead of editing a client config by hand.
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
+ 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 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, Next.js DevTools, Semgrep, Sentry (OAuth), Figma Desktop, Figma Cloud, Storybook — are installed with `init mcp`; see [`MCP-CATALOG.md`](MCP-CATALOG.md).
14
+
13
15
  ## 1. GitLab
14
16
 
15
17
  1. **Create a personal access token.**
@@ -36,7 +38,33 @@ If no MCP client is installed yet, run `npx @bonesofspring/ai-rules@latest init
36
38
  `npx @bonesofspring/ai-rules@latest mcp setup gitlab`
37
39
  → expected: the new token is validated and saved; the server reconnects with it.
38
40
 
39
- ## 2. Yandex (Tracker + Wiki)
41
+ ## 2. GitHub
42
+
43
+ 1. **Create a personal access token.**
44
+ Add a fine-grained token with the repository permissions the agent needs, or a classic token with `repo` (add `read:org` for organization data).
45
+ [GitHub: personal access tokens](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens)
46
+ → expected: the token is shown once; keep it for the next step.
47
+
48
+ 2. **Put the token in `.env.github` in the project root.**
49
+ `GITHUB_TOKEN=<the token>` — `GITHUB_PERSONAL_ACCESS_TOKEN` is accepted as an alias, and an exported `GITHUB_TOKEN` in the shell wins over the file.
50
+ Keep the file out of git: add `.env.github` to `.gitignore` (the package never edits your `.gitignore`, and it refuses to register the server while the file is not ignored).
51
+ → expected: the file exists with the token and is ignored by git.
52
+
53
+ 3. **Register the server and run the doctor.**
54
+ `npx @bonesofspring/ai-rules@latest mcp setup github`
55
+ → expected: `ok credentials` with the token validated against the GitHub API, `ok registration` per client, then `ok` doctor lines.
56
+
57
+ 4. **Reconnect the client** with the client action from GitLab step 3 (`opencode reload` in OpenCode).
58
+ → expected: `github` is connected and lists tools.
59
+
60
+ 5. **Rotate the token.** Create a new token with the same scopes and replace the value in `.env.github`.
61
+ Rerun the setup; nothing is written until the new token validates.
62
+ `npx @bonesofspring/ai-rules@latest mcp setup github`
63
+ → expected: the new token is validated; the server reconnects with it.
64
+
65
+ Optional overrides in `.env.github` (or the shell): `GITHUB_MCP_URL` for a GitHub Enterprise or a local relay, `GITHUB_API_URL` for the REST API base.
66
+
67
+ ## 3. Yandex (Tracker + Wiki)
40
68
 
41
69
  1. **Install the Yandex Cloud CLI.**
42
70
  [Yandex Cloud CLI: installation](https://yandex.cloud/en/docs/cli/operations/install-cli)
@@ -60,3 +88,31 @@ If no MCP client is installed yet, run `npx @bonesofspring/ai-rules@latest init
60
88
  `yc` reissues the IAM token on demand; `.ai-rules/mcp/` holds no token.
61
89
  `npx @bonesofspring/ai-rules@latest mcp refresh yandex`
62
90
  → expected: `Yandex IAM token refreshed` and exit 0; no token is stored.
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
+
116
+ ## Diagnostics
117
+
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**. |
@@ -420,13 +421,15 @@ Load these when editing files under `packages/ai-rules/presets/**`, `.cursor/**`
420
421
  | `scripts/check-preset-language-policy.sh` / `yarn check:preset-structure` | **FAIL** if the native-language policy is absent: the core `_shared/core/agent-team/language-policy.md` tokens, the `language-policy` consumer + `<!-- shared-core -->` marker, the Cursor `globs:`/`alwaysApply: false` + Claude `paths:` shape, the `## Language` setting home (with a BCP-47 marker) in `ai-local/conventions.md`, the always-on anchors (`ai-local-overlay` + `<app-core>` + `REPO_AGENTS.md` must contain `native language` and `every user message`), or the `language:` persistence token in `commands/task.md`; **refuses vacuous PASS** when the iteration set is empty. Wired into `check-preset-structure.sh` next to `goal-contract` / `prompt-persistence`; fixture `test-preset-language-policy-fixtures.mjs`. |
421
422
  | `scripts/check-preset-self-review-contract.sh` / `yarn check:preset-structure` | **FAIL** if the producer-side self-review / context-hygiene contract is absent: the core `_shared/core/quality/self-review-and-context-hygiene.md` tokens (G0 non-vacuous guard), the `<!-- shared-core: quality/self-review-and-context-hygiene.md -->` marker on `task-analyst` / `feature-developer` / `build-verifier` (×10) and on `debugger` / `code-reviewer` where present (skip-if-absent → `mcp-ts`), the `Self-review` + `re-anchor` tokens on every orchestrator rule, `Self-review` in `team/README.md` + `commands/task.md`, and leakage-free core + docs; **refuses vacuous PASS** when the iteration set is empty. Also holds two prose contracts: the canonical self-learning-loop sentence must not be followed by unsanctioned prose (an allowlist of sanctioned clauses; the tail is bounded by the carrier's **section**, not by a blank line, so prose moved one paragraph down still fails — a tail in a later `## ` section is out of scope), and every retro carrier (command, skill, rule) must state `finding_category`. Wired into `check-preset-structure.sh` next to `goal-contract`; fixture `test-preset-self-review-contract-fixtures.mjs`. |
422
423
  | `scripts/check-anti-hallucination-coverage.mjs` | **FAIL** when the shared contract, a Cursor load-line embed, a writer stack floor, or a generated Rules-to-load stem is missing. Writer roles are `implementer`, `unit-test`, `e2e`, `qa`, and `reviewer` (`code-reviewer` loads `STACK_FLOOR_STEMS` plus the contract). `/task` and the orchestrator must not name a floor stem. Does not scan consumer `app/**` and does not call Context7. Fixture `test-anti-hallucination-coverage.mjs` deletes `anti-hallucination-contract` from `next.reviewer` in memory and expects FAIL mentioning `next` and `reviewer`. Wired into `check-preset-structure.sh` immediately after `check-claude-agent-blocks.mjs`. |
424
+ | `presets/_shared/ai-local/scripts/check-write-scope.mjs` | Read-only post-step audit: compares the actual changed paths with the current `pipeline.json` step's `writeScopes` and labels each path `declared`, `derived` (task folder, engine mirror, generated platform tree/golden/hook, dogfood tree, adapter map), or `out-of-scope`, with the source named. Shipped to consumers as `.ai.local/scripts/check-write-scope.mjs` (`ENGINE_SCRIPTS`). `--slug <slug> [--step <id>] [--base <ref>] [--root <project>] [--paths a,b] [--json]`. The baseline defaults to `HEAD` (uncommitted change-set, untracked included); pass `--base` for a committed change-set. Exit `1` for an out-of-scope path on an implementation step, `0` for a reviewer/verifier step (advisory), `2` on a usage/config error. Fixture `test-write-scope.mjs`; wired into the build-verifier and code-reviewer prompts, never a hook. |
423
425
  | `scripts/check-preset-structure.sh` / `yarn check:preset-structure` | Orchestrator: twin-map + token-budget + leakage + shared-core drift + anti-hallucination coverage + rule-eval (**all hard**; drift via `AI_RULES_DRIFT_FAIL=1`). |
424
426
  | `scripts/check-product-specs.sh` / `yarn check:product-specs` | Opt-in consumer tree check: frontmatter v1 keys + required body headings on `docs/specs/**` (bash; does **not** run JSON Schema). Ships in the npm package `files` (`scripts/`). **WARN** by default; **`--strict`** exits non-zero. |
425
427
  | `yarn check:product-specs:dogfood` | Same script against monorepo `dogfood/mcp-ts-sample`. Soft WARN inside `check:preset-structure` + CI step (`continue-on-error`); not a hard consumer CI gate. |
426
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>/`. |
427
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`. |
428
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`. |
429
- | `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. |
430
433
 
431
434
  Run from `packages/ai-rules/`:
432
435
 
@@ -436,6 +439,14 @@ yarn check:preset-structure
436
439
  bash scripts/check-preset-structure.sh
437
440
  ```
438
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
+
439
450
  CI: [`.github/workflows/preset-structure.yml`](../../../.github/workflows/preset-structure.yml) runs the orchestrator on PRs touching `packages/ai-rules/**`.
440
451
 
441
452
  ---