@bonesofspring/ai-rules 0.2.80 → 0.2.86

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 (700) hide show
  1. package/CHANGELOG.md +70 -0
  2. package/bin/lib/merged-config.js +49 -0
  3. package/bin/lib/seed-ai-local-team.js +2 -0
  4. package/bin/mavis-install.js +53 -3
  5. package/docs/MAVIS-COMPATIBILITY.md +136 -8
  6. package/docs/PRESET-CONTRIBUTION.md +25 -7
  7. package/docs/TEAM-DB.md +76 -3
  8. package/docs/openapi/team-db.v1.json +7069 -5895
  9. package/package.json +8 -2
  10. package/presets/_shared/ai-local/scripts/check-task-repositories.mjs +20 -2
  11. package/presets/_shared/ai-local/scripts/check-verification.mjs +13 -6
  12. package/presets/_shared/ai-local/scripts/rr-migrate-repositories.mjs +66 -16
  13. package/presets/_shared/ai-local/scripts/run-compact.mjs +38 -10
  14. package/presets/_shared/ai-local/scripts/team-db-api.mjs +253 -15
  15. package/presets/_shared/ai-local/scripts/team-db-openapi.mjs +310 -4
  16. package/presets/_shared/ai-local/scripts/team-db-project.mjs +733 -8
  17. package/presets/_shared/ai-local/scripts/team-db-schema.mjs +44 -0
  18. package/presets/_shared/ai-local/scripts/team-db.mjs +43 -3
  19. package/presets/_shared/core/agent-team/agent-team-orchestrator.md +1 -0
  20. package/presets/_shared/core/review/code-review-mr.md +19 -4
  21. package/presets/_shared/hooks/chain-team-phases.sh.tmpl +40 -0
  22. package/presets/_shared/hooks/compact-shell-output.mjs +16 -1
  23. package/presets/claude/android-kotlin/agents/code-reviewer.md +5 -1
  24. package/presets/claude/android-kotlin/commands/update.md +1 -0
  25. package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +40 -0
  26. package/presets/claude/android-kotlin/rules/tooling-and-review/agent-team-orchestrator.md +1 -0
  27. package/presets/claude/android-kotlin/rules/tooling-and-review/code-review.md +19 -4
  28. package/presets/claude/android-kotlin/skills/code-review/SKILL.md +2 -1
  29. package/presets/claude/go/agents/code-reviewer.md +5 -1
  30. package/presets/claude/go/commands/update.md +1 -0
  31. package/presets/claude/go/hooks/chain-team-phases.sh +40 -0
  32. package/presets/claude/go/rules/tooling-and-review/agent-team-orchestrator.md +1 -0
  33. package/presets/claude/go/rules/tooling-and-review/code-review.md +19 -4
  34. package/presets/claude/go/skills/code-review/SKILL.md +2 -1
  35. package/presets/claude/ios-swift/agents/code-reviewer.md +5 -1
  36. package/presets/claude/ios-swift/commands/update.md +1 -0
  37. package/presets/claude/ios-swift/hooks/chain-team-phases.sh +40 -0
  38. package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-orchestrator.md +1 -0
  39. package/presets/claude/ios-swift/rules/tooling-and-review/code-review.md +19 -4
  40. package/presets/claude/ios-swift/skills/code-review/SKILL.md +2 -1
  41. package/presets/claude/java/agents/code-reviewer.md +5 -1
  42. package/presets/claude/java/commands/update.md +1 -0
  43. package/presets/claude/java/hooks/chain-team-phases.sh +40 -0
  44. package/presets/claude/java/rules/tooling-and-review/agent-team-orchestrator.md +1 -0
  45. package/presets/claude/java/rules/tooling-and-review/code-review.md +19 -4
  46. package/presets/claude/java/skills/code-review/SKILL.md +2 -1
  47. package/presets/claude/mcp-ts/commands/update.md +1 -0
  48. package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +40 -0
  49. package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-orchestrator.md +1 -0
  50. package/presets/claude/mcp-ts/rules/tooling-and-review/code-review.md +19 -4
  51. package/presets/claude/mol/REPO_AGENTS.md +1 -1
  52. package/presets/claude/mol/agents/code-reviewer.md +5 -1
  53. package/presets/claude/mol/agents/task-router.md +1 -1
  54. package/presets/claude/mol/commands/update.md +1 -0
  55. package/presets/claude/mol/hooks/chain-team-phases.sh +40 -0
  56. package/presets/claude/mol/rules/tooling-and-review/agent-team-orchestrator.md +1 -0
  57. package/presets/claude/mol/rules/tooling-and-review/code-review-mr.md +19 -4
  58. package/presets/claude/mol/skills/code-review/SKILL.md +2 -1
  59. package/presets/claude/next/REPO_AGENTS.md +1 -1
  60. package/presets/claude/next/agents/build-verifier.md +2 -1
  61. package/presets/claude/next/agents/code-reviewer.md +5 -1
  62. package/presets/claude/next/agents/feature-developer.md +1 -1
  63. package/presets/claude/next/agents/task-router.md +1 -1
  64. package/presets/claude/next/commands/update.md +1 -0
  65. package/presets/claude/next/hooks/chain-team-phases.sh +40 -0
  66. package/presets/claude/next/rules/tooling-and-review/agent-team-orchestrator.md +1 -0
  67. package/presets/claude/next/rules/tooling-and-review/code-review-mr.md +19 -4
  68. package/presets/claude/next/skills/code-review/SKILL.md +2 -1
  69. package/presets/claude/nuxt/agents/code-reviewer.md +5 -1
  70. package/presets/claude/nuxt/agents/task-router.md +1 -1
  71. package/presets/claude/nuxt/commands/update.md +1 -0
  72. package/presets/claude/nuxt/hooks/chain-team-phases.sh +40 -0
  73. package/presets/claude/nuxt/rules/tooling-and-review/agent-team-orchestrator.md +1 -0
  74. package/presets/claude/nuxt/rules/tooling-and-review/code-review-mr.md +19 -4
  75. package/presets/claude/nuxt/skills/code-review/SKILL.md +2 -1
  76. package/presets/claude/php-hexagonal/agents/code-reviewer.md +5 -1
  77. package/presets/claude/php-hexagonal/commands/update.md +1 -0
  78. package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +40 -0
  79. package/presets/claude/php-hexagonal/rules/tooling-and-review/agent-team-orchestrator.md +1 -0
  80. package/presets/claude/php-hexagonal/rules/tooling-and-review/code-review.md +19 -4
  81. package/presets/claude/php-hexagonal/skills/code-review/SKILL.md +2 -1
  82. package/presets/claude/php-laravel/agents/code-reviewer.md +5 -1
  83. package/presets/claude/php-laravel/commands/update.md +1 -0
  84. package/presets/claude/php-laravel/hooks/chain-team-phases.sh +40 -0
  85. package/presets/claude/php-laravel/rules/tooling-and-review/agent-team-orchestrator.md +1 -0
  86. package/presets/claude/php-laravel/rules/tooling-and-review/code-review.md +19 -4
  87. package/presets/claude/php-laravel/skills/code-review/SKILL.md +2 -1
  88. package/presets/claude/svelte/agents/code-reviewer.md +5 -1
  89. package/presets/claude/svelte/agents/task-router.md +1 -1
  90. package/presets/claude/svelte/commands/update.md +1 -0
  91. package/presets/claude/svelte/hooks/chain-team-phases.sh +40 -0
  92. package/presets/claude/svelte/rules/tooling-and-review/agent-team-orchestrator.md +1 -0
  93. package/presets/claude/svelte/rules/tooling-and-review/code-review-mr.md +19 -4
  94. package/presets/claude/svelte/skills/code-review/SKILL.md +2 -1
  95. package/presets/cursor/android-kotlin/agents/code-reviewer.md +5 -1
  96. package/presets/cursor/android-kotlin/commands/update.md +1 -0
  97. package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +40 -0
  98. package/presets/cursor/android-kotlin/hooks/compact-shell-output.mjs +16 -1
  99. package/presets/cursor/android-kotlin/rules/code-review-mr.mdc +19 -4
  100. package/presets/cursor/android-kotlin/skills/code-review/SKILL.md +2 -1
  101. package/presets/cursor/go/agents/code-reviewer.md +5 -1
  102. package/presets/cursor/go/commands/update.md +1 -0
  103. package/presets/cursor/go/hooks/chain-team-phases.sh +40 -0
  104. package/presets/cursor/go/hooks/compact-shell-output.mjs +16 -1
  105. package/presets/cursor/go/rules/code-review-mr.mdc +19 -4
  106. package/presets/cursor/go/skills/code-review/SKILL.md +2 -1
  107. package/presets/cursor/ios-swift/agents/code-reviewer.md +5 -1
  108. package/presets/cursor/ios-swift/commands/update.md +1 -0
  109. package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +40 -0
  110. package/presets/cursor/ios-swift/hooks/compact-shell-output.mjs +16 -1
  111. package/presets/cursor/ios-swift/rules/code-review-mr.mdc +19 -4
  112. package/presets/cursor/ios-swift/skills/code-review/SKILL.md +2 -1
  113. package/presets/cursor/java/agents/code-reviewer.md +5 -1
  114. package/presets/cursor/java/commands/update.md +1 -0
  115. package/presets/cursor/java/hooks/chain-team-phases.sh +40 -0
  116. package/presets/cursor/java/hooks/compact-shell-output.mjs +16 -1
  117. package/presets/cursor/java/rules/code-review-mr.mdc +19 -4
  118. package/presets/cursor/java/skills/code-review/SKILL.md +2 -1
  119. package/presets/cursor/mcp-ts/commands/update.md +1 -0
  120. package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +40 -0
  121. package/presets/cursor/mcp-ts/hooks/compact-shell-output.mjs +16 -1
  122. package/presets/cursor/mcp-ts/rules/code-review-mr.mdc +19 -4
  123. package/presets/cursor/mol/REPO_AGENTS.md +1 -1
  124. package/presets/cursor/mol/agents/code-reviewer.md +5 -1
  125. package/presets/cursor/mol/agents/task-router.md +1 -1
  126. package/presets/cursor/mol/commands/update.md +1 -0
  127. package/presets/cursor/mol/hooks/chain-team-phases.sh +40 -0
  128. package/presets/cursor/mol/hooks/compact-shell-output.mjs +16 -1
  129. package/presets/cursor/mol/rules/code-review-mr.mdc +19 -4
  130. package/presets/cursor/mol/skills/code-review/SKILL.md +2 -1
  131. package/presets/cursor/next/REPO_AGENTS.md +1 -1
  132. package/presets/cursor/next/agents/build-verifier.md +2 -1
  133. package/presets/cursor/next/agents/code-reviewer.md +5 -1
  134. package/presets/cursor/next/agents/feature-developer.md +1 -1
  135. package/presets/cursor/next/agents/task-router.md +1 -1
  136. package/presets/cursor/next/commands/update.md +1 -0
  137. package/presets/cursor/next/hooks/README.md +2 -0
  138. package/presets/cursor/next/hooks/chain-team-phases.sh +40 -0
  139. package/presets/cursor/next/hooks/compact-shell-output.mjs +16 -1
  140. package/presets/cursor/next/rules/code-review-mr.mdc +19 -4
  141. package/presets/cursor/next/skills/code-review/SKILL.md +2 -1
  142. package/presets/cursor/nuxt/agents/code-reviewer.md +5 -1
  143. package/presets/cursor/nuxt/agents/task-router.md +1 -1
  144. package/presets/cursor/nuxt/commands/update.md +1 -0
  145. package/presets/cursor/nuxt/hooks/chain-team-phases.sh +40 -0
  146. package/presets/cursor/nuxt/hooks/compact-shell-output.mjs +16 -1
  147. package/presets/cursor/nuxt/rules/code-review-mr.mdc +19 -4
  148. package/presets/cursor/nuxt/skills/code-review/SKILL.md +2 -1
  149. package/presets/cursor/php-hexagonal/agents/code-reviewer.md +5 -1
  150. package/presets/cursor/php-hexagonal/commands/update.md +1 -0
  151. package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +40 -0
  152. package/presets/cursor/php-hexagonal/hooks/compact-shell-output.mjs +16 -1
  153. package/presets/cursor/php-hexagonal/rules/code-review-mr.mdc +19 -4
  154. package/presets/cursor/php-hexagonal/skills/code-review/SKILL.md +2 -1
  155. package/presets/cursor/php-laravel/agents/code-reviewer.md +5 -1
  156. package/presets/cursor/php-laravel/commands/update.md +1 -0
  157. package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +40 -0
  158. package/presets/cursor/php-laravel/hooks/compact-shell-output.mjs +16 -1
  159. package/presets/cursor/php-laravel/rules/code-review-mr.mdc +19 -4
  160. package/presets/cursor/php-laravel/skills/code-review/SKILL.md +2 -1
  161. package/presets/cursor/svelte/agents/code-reviewer.md +5 -1
  162. package/presets/cursor/svelte/agents/task-router.md +1 -1
  163. package/presets/cursor/svelte/commands/update.md +1 -0
  164. package/presets/cursor/svelte/hooks/chain-team-phases.sh +40 -0
  165. package/presets/cursor/svelte/hooks/compact-shell-output.mjs +16 -1
  166. package/presets/cursor/svelte/rules/code-review-mr.mdc +19 -4
  167. package/presets/cursor/svelte/skills/code-review/SKILL.md +2 -1
  168. package/presets/mavis/android-kotlin/MAVIS.md +9 -3
  169. package/presets/mavis/android-kotlin/README.md +3 -1
  170. package/presets/mavis/android-kotlin/adapter-map.json +104 -44
  171. package/presets/mavis/android-kotlin/agents/code-reviewer.md +5 -1
  172. package/presets/mavis/android-kotlin/commands/update.md +1 -0
  173. package/presets/mavis/android-kotlin/hooks/README.md +29 -7
  174. package/presets/mavis/android-kotlin/hooks/chain-team-phases.sh +40 -0
  175. package/presets/mavis/android-kotlin/hooks/mavis-chain-hook.mjs +143 -0
  176. package/presets/mavis/android-kotlin/hooks/run-hook.mjs +103 -0
  177. package/presets/mavis/android-kotlin/minimax-hooks/hooks.json +28 -0
  178. package/presets/mavis/android-kotlin/native-skills/README.md +15 -0
  179. package/presets/mavis/android-kotlin/native-skills/ci-investigation/SKILL.md +53 -0
  180. package/presets/mavis/android-kotlin/native-skills/code-review/SKILL.md +62 -0
  181. package/presets/mavis/android-kotlin/native-skills/debug-investigation/SKILL.md +72 -0
  182. package/presets/mavis/android-kotlin/native-skills/feature-delivery/SKILL.md +51 -0
  183. package/presets/mavis/android-kotlin/native-skills/instrumentation-ui-e2e/SKILL.md +23 -0
  184. package/presets/mavis/android-kotlin/native-skills/migrate-tasks/SKILL.md +43 -0
  185. package/presets/mavis/android-kotlin/native-skills/mockup-review/SKILL.md +34 -0
  186. package/presets/mavis/android-kotlin/native-skills/rr-migrate-repositories/SKILL.md +61 -0
  187. package/presets/mavis/android-kotlin/native-skills/rr-scheduler-start/SKILL.md +34 -0
  188. package/presets/mavis/android-kotlin/native-skills/spec-authoring/SKILL.md +31 -0
  189. package/presets/mavis/android-kotlin/native-skills/spec-discovery/SKILL.md +63 -0
  190. package/presets/mavis/android-kotlin/native-skills/spec-start/SKILL.md +31 -0
  191. package/presets/mavis/android-kotlin/native-skills/task/SKILL.md +79 -0
  192. package/presets/mavis/android-kotlin/native-skills/task-continue/SKILL.md +74 -0
  193. package/presets/mavis/android-kotlin/native-skills/technical-retro/SKILL.md +72 -0
  194. package/presets/mavis/android-kotlin/native-skills/unit-testing/SKILL.md +38 -0
  195. package/presets/mavis/android-kotlin/native-skills/update/SKILL.md +44 -0
  196. package/presets/mavis/android-kotlin/native-skills/ux-design/SKILL.md +41 -0
  197. package/presets/mavis/android-kotlin/native-skills/write-adr/SKILL.md +46 -0
  198. package/presets/mavis/android-kotlin/rules/agent-team-orchestrator.md +1 -0
  199. package/presets/mavis/android-kotlin/rules/code-review-mr.md +19 -4
  200. package/presets/mavis/android-kotlin/skills/code-review/SKILL.md +2 -1
  201. package/presets/mavis/go/MAVIS.md +9 -3
  202. package/presets/mavis/go/README.md +3 -1
  203. package/presets/mavis/go/adapter-map.json +94 -40
  204. package/presets/mavis/go/agents/code-reviewer.md +5 -1
  205. package/presets/mavis/go/commands/update.md +1 -0
  206. package/presets/mavis/go/hooks/README.md +29 -7
  207. package/presets/mavis/go/hooks/chain-team-phases.sh +40 -0
  208. package/presets/mavis/go/hooks/mavis-chain-hook.mjs +143 -0
  209. package/presets/mavis/go/hooks/run-hook.mjs +103 -0
  210. package/presets/mavis/go/minimax-hooks/hooks.json +28 -0
  211. package/presets/mavis/go/native-skills/README.md +15 -0
  212. package/presets/mavis/go/native-skills/ci-investigation/SKILL.md +24 -0
  213. package/presets/mavis/go/native-skills/code-review/SKILL.md +48 -0
  214. package/presets/mavis/go/native-skills/debug-investigation/SKILL.md +55 -0
  215. package/presets/mavis/go/native-skills/feature-delivery/SKILL.md +43 -0
  216. package/presets/mavis/go/native-skills/integration-testing/SKILL.md +21 -0
  217. package/presets/mavis/go/native-skills/migrate-tasks/SKILL.md +43 -0
  218. package/presets/mavis/go/native-skills/rr-migrate-repositories/SKILL.md +61 -0
  219. package/presets/mavis/go/native-skills/rr-scheduler-start/SKILL.md +34 -0
  220. package/presets/mavis/go/native-skills/spec-authoring/SKILL.md +31 -0
  221. package/presets/mavis/go/native-skills/spec-discovery/SKILL.md +63 -0
  222. package/presets/mavis/go/native-skills/spec-start/SKILL.md +31 -0
  223. package/presets/mavis/go/native-skills/task/SKILL.md +77 -0
  224. package/presets/mavis/go/native-skills/task-continue/SKILL.md +72 -0
  225. package/presets/mavis/go/native-skills/technical-retro/SKILL.md +72 -0
  226. package/presets/mavis/go/native-skills/unit-testing/SKILL.md +20 -0
  227. package/presets/mavis/go/native-skills/update/SKILL.md +44 -0
  228. package/presets/mavis/go/native-skills/write-adr/SKILL.md +46 -0
  229. package/presets/mavis/go/rules/agent-team-orchestrator.md +1 -0
  230. package/presets/mavis/go/rules/code-review-mr.md +19 -4
  231. package/presets/mavis/go/skills/code-review/SKILL.md +2 -1
  232. package/presets/mavis/ios-swift/MAVIS.md +9 -3
  233. package/presets/mavis/ios-swift/README.md +3 -1
  234. package/presets/mavis/ios-swift/adapter-map.json +104 -44
  235. package/presets/mavis/ios-swift/agents/code-reviewer.md +5 -1
  236. package/presets/mavis/ios-swift/commands/update.md +1 -0
  237. package/presets/mavis/ios-swift/hooks/README.md +29 -7
  238. package/presets/mavis/ios-swift/hooks/chain-team-phases.sh +40 -0
  239. package/presets/mavis/ios-swift/hooks/mavis-chain-hook.mjs +143 -0
  240. package/presets/mavis/ios-swift/hooks/run-hook.mjs +103 -0
  241. package/presets/mavis/ios-swift/minimax-hooks/hooks.json +28 -0
  242. package/presets/mavis/ios-swift/native-skills/README.md +15 -0
  243. package/presets/mavis/ios-swift/native-skills/ci-investigation/SKILL.md +53 -0
  244. package/presets/mavis/ios-swift/native-skills/code-review/SKILL.md +62 -0
  245. package/presets/mavis/ios-swift/native-skills/debug-investigation/SKILL.md +72 -0
  246. package/presets/mavis/ios-swift/native-skills/feature-delivery/SKILL.md +51 -0
  247. package/presets/mavis/ios-swift/native-skills/migrate-tasks/SKILL.md +43 -0
  248. package/presets/mavis/ios-swift/native-skills/mockup-review/SKILL.md +34 -0
  249. package/presets/mavis/ios-swift/native-skills/rr-migrate-repositories/SKILL.md +61 -0
  250. package/presets/mavis/ios-swift/native-skills/rr-scheduler-start/SKILL.md +34 -0
  251. package/presets/mavis/ios-swift/native-skills/spec-authoring/SKILL.md +31 -0
  252. package/presets/mavis/ios-swift/native-skills/spec-discovery/SKILL.md +63 -0
  253. package/presets/mavis/ios-swift/native-skills/spec-start/SKILL.md +31 -0
  254. package/presets/mavis/ios-swift/native-skills/task/SKILL.md +79 -0
  255. package/presets/mavis/ios-swift/native-skills/task-continue/SKILL.md +74 -0
  256. package/presets/mavis/ios-swift/native-skills/technical-retro/SKILL.md +72 -0
  257. package/presets/mavis/ios-swift/native-skills/unit-testing/SKILL.md +38 -0
  258. package/presets/mavis/ios-swift/native-skills/update/SKILL.md +44 -0
  259. package/presets/mavis/ios-swift/native-skills/ux-design/SKILL.md +41 -0
  260. package/presets/mavis/ios-swift/native-skills/write-adr/SKILL.md +46 -0
  261. package/presets/mavis/ios-swift/native-skills/xcuitest-e2e/SKILL.md +39 -0
  262. package/presets/mavis/ios-swift/rules/agent-team-orchestrator.md +1 -0
  263. package/presets/mavis/ios-swift/rules/code-review-mr.md +19 -4
  264. package/presets/mavis/ios-swift/skills/code-review/SKILL.md +2 -1
  265. package/presets/mavis/java/MAVIS.md +9 -3
  266. package/presets/mavis/java/README.md +3 -1
  267. package/presets/mavis/java/adapter-map.json +94 -40
  268. package/presets/mavis/java/agents/code-reviewer.md +5 -1
  269. package/presets/mavis/java/commands/update.md +1 -0
  270. package/presets/mavis/java/hooks/README.md +29 -7
  271. package/presets/mavis/java/hooks/chain-team-phases.sh +40 -0
  272. package/presets/mavis/java/hooks/mavis-chain-hook.mjs +143 -0
  273. package/presets/mavis/java/hooks/run-hook.mjs +103 -0
  274. package/presets/mavis/java/minimax-hooks/hooks.json +28 -0
  275. package/presets/mavis/java/native-skills/README.md +15 -0
  276. package/presets/mavis/java/native-skills/ci-investigation/SKILL.md +24 -0
  277. package/presets/mavis/java/native-skills/code-review/SKILL.md +48 -0
  278. package/presets/mavis/java/native-skills/debug-investigation/SKILL.md +55 -0
  279. package/presets/mavis/java/native-skills/feature-delivery/SKILL.md +43 -0
  280. package/presets/mavis/java/native-skills/integration-testing/SKILL.md +21 -0
  281. package/presets/mavis/java/native-skills/migrate-tasks/SKILL.md +43 -0
  282. package/presets/mavis/java/native-skills/rr-migrate-repositories/SKILL.md +61 -0
  283. package/presets/mavis/java/native-skills/rr-scheduler-start/SKILL.md +34 -0
  284. package/presets/mavis/java/native-skills/spec-authoring/SKILL.md +31 -0
  285. package/presets/mavis/java/native-skills/spec-discovery/SKILL.md +63 -0
  286. package/presets/mavis/java/native-skills/spec-start/SKILL.md +31 -0
  287. package/presets/mavis/java/native-skills/task/SKILL.md +77 -0
  288. package/presets/mavis/java/native-skills/task-continue/SKILL.md +72 -0
  289. package/presets/mavis/java/native-skills/technical-retro/SKILL.md +72 -0
  290. package/presets/mavis/java/native-skills/unit-testing/SKILL.md +20 -0
  291. package/presets/mavis/java/native-skills/update/SKILL.md +44 -0
  292. package/presets/mavis/java/native-skills/write-adr/SKILL.md +46 -0
  293. package/presets/mavis/java/rules/agent-team-orchestrator.md +1 -0
  294. package/presets/mavis/java/rules/code-review-mr.md +19 -4
  295. package/presets/mavis/java/skills/code-review/SKILL.md +2 -1
  296. package/presets/mavis/mcp-ts/MAVIS.md +9 -3
  297. package/presets/mavis/mcp-ts/README.md +3 -1
  298. package/presets/mavis/mcp-ts/adapter-map.json +77 -32
  299. package/presets/mavis/mcp-ts/commands/update.md +1 -0
  300. package/presets/mavis/mcp-ts/hooks/README.md +29 -7
  301. package/presets/mavis/mcp-ts/hooks/chain-team-phases.sh +40 -0
  302. package/presets/mavis/mcp-ts/hooks/mavis-chain-hook.mjs +143 -0
  303. package/presets/mavis/mcp-ts/hooks/run-hook.mjs +103 -0
  304. package/presets/mavis/mcp-ts/minimax-hooks/hooks.json +28 -0
  305. package/presets/mavis/mcp-ts/native-skills/README.md +15 -0
  306. package/presets/mavis/mcp-ts/native-skills/code-review/SKILL.md +31 -0
  307. package/presets/mavis/mcp-ts/native-skills/debug-investigation/SKILL.md +51 -0
  308. package/presets/mavis/mcp-ts/native-skills/feature-delivery/SKILL.md +42 -0
  309. package/presets/mavis/mcp-ts/native-skills/migrate-tasks/SKILL.md +43 -0
  310. package/presets/mavis/mcp-ts/native-skills/rr-migrate-repositories/SKILL.md +61 -0
  311. package/presets/mavis/mcp-ts/native-skills/rr-scheduler-start/SKILL.md +34 -0
  312. package/presets/mavis/mcp-ts/native-skills/spec-authoring/SKILL.md +31 -0
  313. package/presets/mavis/mcp-ts/native-skills/spec-discovery/SKILL.md +63 -0
  314. package/presets/mavis/mcp-ts/native-skills/spec-start/SKILL.md +31 -0
  315. package/presets/mavis/mcp-ts/native-skills/task/SKILL.md +77 -0
  316. package/presets/mavis/mcp-ts/native-skills/task-continue/SKILL.md +72 -0
  317. package/presets/mavis/mcp-ts/native-skills/technical-retro/SKILL.md +95 -0
  318. package/presets/mavis/mcp-ts/native-skills/unit-testing/SKILL.md +22 -0
  319. package/presets/mavis/mcp-ts/native-skills/update/SKILL.md +44 -0
  320. package/presets/mavis/mcp-ts/rules/agent-team-orchestrator.md +1 -0
  321. package/presets/mavis/mcp-ts/rules/code-review-mr.md +19 -4
  322. package/presets/mavis/mol/MAVIS.md +9 -3
  323. package/presets/mavis/mol/README.md +3 -1
  324. package/presets/mavis/mol/REPO_AGENTS.md +1 -1
  325. package/presets/mavis/mol/adapter-map.json +94 -40
  326. package/presets/mavis/mol/agents/code-reviewer.md +5 -1
  327. package/presets/mavis/mol/agents/task-router.md +1 -1
  328. package/presets/mavis/mol/commands/update.md +1 -0
  329. package/presets/mavis/mol/hooks/README.md +29 -7
  330. package/presets/mavis/mol/hooks/chain-team-phases.sh +40 -0
  331. package/presets/mavis/mol/hooks/mavis-chain-hook.mjs +143 -0
  332. package/presets/mavis/mol/hooks/run-hook.mjs +103 -0
  333. package/presets/mavis/mol/minimax-hooks/hooks.json +28 -0
  334. package/presets/mavis/mol/native-skills/README.md +15 -0
  335. package/presets/mavis/mol/native-skills/ci-investigation/SKILL.md +49 -0
  336. package/presets/mavis/mol/native-skills/code-review/SKILL.md +61 -0
  337. package/presets/mavis/mol/native-skills/debug-investigation/SKILL.md +63 -0
  338. package/presets/mavis/mol/native-skills/feature-delivery/SKILL.md +44 -0
  339. package/presets/mavis/mol/native-skills/migrate-tasks/SKILL.md +43 -0
  340. package/presets/mavis/mol/native-skills/rr-migrate-repositories/SKILL.md +61 -0
  341. package/presets/mavis/mol/native-skills/rr-scheduler-start/SKILL.md +34 -0
  342. package/presets/mavis/mol/native-skills/spec-authoring/SKILL.md +31 -0
  343. package/presets/mavis/mol/native-skills/spec-discovery/SKILL.md +63 -0
  344. package/presets/mavis/mol/native-skills/spec-start/SKILL.md +31 -0
  345. package/presets/mavis/mol/native-skills/task/SKILL.md +82 -0
  346. package/presets/mavis/mol/native-skills/task-continue/SKILL.md +74 -0
  347. package/presets/mavis/mol/native-skills/task-evil/SKILL.md +89 -0
  348. package/presets/mavis/mol/native-skills/technical-retro/SKILL.md +72 -0
  349. package/presets/mavis/mol/native-skills/unit-testing/SKILL.md +38 -0
  350. package/presets/mavis/mol/native-skills/update/SKILL.md +44 -0
  351. package/presets/mavis/mol/native-skills/write-adr/SKILL.md +46 -0
  352. package/presets/mavis/mol/rules/agent-team-orchestrator.md +1 -0
  353. package/presets/mavis/mol/rules/code-review-mr.md +19 -4
  354. package/presets/mavis/mol/skills/code-review/SKILL.md +2 -1
  355. package/presets/mavis/next/MAVIS.md +9 -3
  356. package/presets/mavis/next/README.md +3 -1
  357. package/presets/mavis/next/REPO_AGENTS.md +1 -1
  358. package/presets/mavis/next/adapter-map.json +128 -53
  359. package/presets/mavis/next/agents/build-verifier.md +2 -1
  360. package/presets/mavis/next/agents/code-reviewer.md +5 -1
  361. package/presets/mavis/next/agents/feature-developer.md +1 -1
  362. package/presets/mavis/next/agents/task-router.md +1 -1
  363. package/presets/mavis/next/commands/update.md +1 -0
  364. package/presets/mavis/next/hooks/README.md +29 -7
  365. package/presets/mavis/next/hooks/chain-team-phases.sh +40 -0
  366. package/presets/mavis/next/hooks/mavis-chain-hook.mjs +143 -0
  367. package/presets/mavis/next/hooks/run-hook.mjs +103 -0
  368. package/presets/mavis/next/minimax-hooks/hooks.json +28 -0
  369. package/presets/mavis/next/native-skills/README.md +15 -0
  370. package/presets/mavis/next/native-skills/ci-investigation/SKILL.md +50 -0
  371. package/presets/mavis/next/native-skills/code-review/SKILL.md +62 -0
  372. package/presets/mavis/next/native-skills/debug-investigation/SKILL.md +64 -0
  373. package/presets/mavis/next/native-skills/feature-delivery/SKILL.md +45 -0
  374. package/presets/mavis/next/native-skills/figma-fidelity/SKILL.md +131 -0
  375. package/presets/mavis/next/native-skills/migrate-tasks/SKILL.md +43 -0
  376. package/presets/mavis/next/native-skills/mockup-review/SKILL.md +44 -0
  377. package/presets/mavis/next/native-skills/playwright-e2e/SKILL.md +39 -0
  378. package/presets/mavis/next/native-skills/react-performance/SKILL.md +49 -0
  379. package/presets/mavis/next/native-skills/rr-migrate-repositories/SKILL.md +61 -0
  380. package/presets/mavis/next/native-skills/rr-scheduler-start/SKILL.md +34 -0
  381. package/presets/mavis/next/native-skills/spec-authoring/SKILL.md +31 -0
  382. package/presets/mavis/next/native-skills/spec-discovery/SKILL.md +63 -0
  383. package/presets/mavis/next/native-skills/spec-start/SKILL.md +31 -0
  384. package/presets/mavis/next/native-skills/task/SKILL.md +88 -0
  385. package/presets/mavis/next/native-skills/task-continue/SKILL.md +87 -0
  386. package/presets/mavis/next/native-skills/task-evil/SKILL.md +89 -0
  387. package/presets/mavis/next/native-skills/technical-retro/SKILL.md +72 -0
  388. package/presets/mavis/next/native-skills/ui-start/SKILL.md +64 -0
  389. package/presets/mavis/next/native-skills/ui-stop/SKILL.md +48 -0
  390. package/presets/mavis/next/native-skills/unit-testing/SKILL.md +40 -0
  391. package/presets/mavis/next/native-skills/update/SKILL.md +44 -0
  392. package/presets/mavis/next/native-skills/ux-design/SKILL.md +41 -0
  393. package/presets/mavis/next/native-skills/write-adr/SKILL.md +46 -0
  394. package/presets/mavis/next/rules/agent-team-orchestrator.md +1 -0
  395. package/presets/mavis/next/rules/code-review-mr.md +19 -4
  396. package/presets/mavis/next/skills/code-review/SKILL.md +2 -1
  397. package/presets/mavis/nuxt/MAVIS.md +9 -3
  398. package/presets/mavis/nuxt/README.md +3 -1
  399. package/presets/mavis/nuxt/adapter-map.json +109 -46
  400. package/presets/mavis/nuxt/agents/code-reviewer.md +5 -1
  401. package/presets/mavis/nuxt/agents/task-router.md +1 -1
  402. package/presets/mavis/nuxt/commands/update.md +1 -0
  403. package/presets/mavis/nuxt/hooks/README.md +29 -7
  404. package/presets/mavis/nuxt/hooks/chain-team-phases.sh +40 -0
  405. package/presets/mavis/nuxt/hooks/mavis-chain-hook.mjs +143 -0
  406. package/presets/mavis/nuxt/hooks/run-hook.mjs +103 -0
  407. package/presets/mavis/nuxt/minimax-hooks/hooks.json +28 -0
  408. package/presets/mavis/nuxt/native-skills/README.md +15 -0
  409. package/presets/mavis/nuxt/native-skills/ci-investigation/SKILL.md +50 -0
  410. package/presets/mavis/nuxt/native-skills/code-review/SKILL.md +61 -0
  411. package/presets/mavis/nuxt/native-skills/debug-investigation/SKILL.md +64 -0
  412. package/presets/mavis/nuxt/native-skills/feature-delivery/SKILL.md +52 -0
  413. package/presets/mavis/nuxt/native-skills/migrate-tasks/SKILL.md +43 -0
  414. package/presets/mavis/nuxt/native-skills/mockup-review/SKILL.md +34 -0
  415. package/presets/mavis/nuxt/native-skills/playwright-e2e/SKILL.md +43 -0
  416. package/presets/mavis/nuxt/native-skills/rr-migrate-repositories/SKILL.md +61 -0
  417. package/presets/mavis/nuxt/native-skills/rr-scheduler-start/SKILL.md +34 -0
  418. package/presets/mavis/nuxt/native-skills/spec-authoring/SKILL.md +31 -0
  419. package/presets/mavis/nuxt/native-skills/spec-discovery/SKILL.md +63 -0
  420. package/presets/mavis/nuxt/native-skills/spec-start/SKILL.md +31 -0
  421. package/presets/mavis/nuxt/native-skills/task/SKILL.md +79 -0
  422. package/presets/mavis/nuxt/native-skills/task-continue/SKILL.md +74 -0
  423. package/presets/mavis/nuxt/native-skills/technical-retro/SKILL.md +72 -0
  424. package/presets/mavis/nuxt/native-skills/unit-testing/SKILL.md +38 -0
  425. package/presets/mavis/nuxt/native-skills/update/SKILL.md +44 -0
  426. package/presets/mavis/nuxt/native-skills/ux-design/SKILL.md +41 -0
  427. package/presets/mavis/nuxt/native-skills/vue-performance/SKILL.md +58 -0
  428. package/presets/mavis/nuxt/native-skills/write-adr/SKILL.md +46 -0
  429. package/presets/mavis/nuxt/rules/agent-team-orchestrator.md +1 -0
  430. package/presets/mavis/nuxt/rules/code-review-mr.md +19 -4
  431. package/presets/mavis/nuxt/skills/code-review/SKILL.md +2 -1
  432. package/presets/mavis/php-hexagonal/MAVIS.md +9 -3
  433. package/presets/mavis/php-hexagonal/README.md +3 -1
  434. package/presets/mavis/php-hexagonal/adapter-map.json +94 -40
  435. package/presets/mavis/php-hexagonal/agents/code-reviewer.md +5 -1
  436. package/presets/mavis/php-hexagonal/commands/update.md +1 -0
  437. package/presets/mavis/php-hexagonal/hooks/README.md +29 -7
  438. package/presets/mavis/php-hexagonal/hooks/chain-team-phases.sh +40 -0
  439. package/presets/mavis/php-hexagonal/hooks/mavis-chain-hook.mjs +143 -0
  440. package/presets/mavis/php-hexagonal/hooks/run-hook.mjs +103 -0
  441. package/presets/mavis/php-hexagonal/minimax-hooks/hooks.json +28 -0
  442. package/presets/mavis/php-hexagonal/native-skills/README.md +15 -0
  443. package/presets/mavis/php-hexagonal/native-skills/ci-investigation/SKILL.md +24 -0
  444. package/presets/mavis/php-hexagonal/native-skills/code-review/SKILL.md +48 -0
  445. package/presets/mavis/php-hexagonal/native-skills/debug-investigation/SKILL.md +55 -0
  446. package/presets/mavis/php-hexagonal/native-skills/feature-delivery/SKILL.md +43 -0
  447. package/presets/mavis/php-hexagonal/native-skills/integration-testing/SKILL.md +21 -0
  448. package/presets/mavis/php-hexagonal/native-skills/migrate-tasks/SKILL.md +43 -0
  449. package/presets/mavis/php-hexagonal/native-skills/rr-migrate-repositories/SKILL.md +61 -0
  450. package/presets/mavis/php-hexagonal/native-skills/rr-scheduler-start/SKILL.md +34 -0
  451. package/presets/mavis/php-hexagonal/native-skills/spec-authoring/SKILL.md +31 -0
  452. package/presets/mavis/php-hexagonal/native-skills/spec-discovery/SKILL.md +63 -0
  453. package/presets/mavis/php-hexagonal/native-skills/spec-start/SKILL.md +31 -0
  454. package/presets/mavis/php-hexagonal/native-skills/task/SKILL.md +77 -0
  455. package/presets/mavis/php-hexagonal/native-skills/task-continue/SKILL.md +72 -0
  456. package/presets/mavis/php-hexagonal/native-skills/technical-retro/SKILL.md +72 -0
  457. package/presets/mavis/php-hexagonal/native-skills/unit-testing/SKILL.md +20 -0
  458. package/presets/mavis/php-hexagonal/native-skills/update/SKILL.md +44 -0
  459. package/presets/mavis/php-hexagonal/native-skills/write-adr/SKILL.md +46 -0
  460. package/presets/mavis/php-hexagonal/rules/agent-team-orchestrator.md +1 -0
  461. package/presets/mavis/php-hexagonal/rules/code-review-mr.md +19 -4
  462. package/presets/mavis/php-hexagonal/skills/code-review/SKILL.md +2 -1
  463. package/presets/mavis/php-laravel/MAVIS.md +9 -3
  464. package/presets/mavis/php-laravel/README.md +3 -1
  465. package/presets/mavis/php-laravel/adapter-map.json +94 -40
  466. package/presets/mavis/php-laravel/agents/code-reviewer.md +5 -1
  467. package/presets/mavis/php-laravel/commands/update.md +1 -0
  468. package/presets/mavis/php-laravel/hooks/README.md +29 -7
  469. package/presets/mavis/php-laravel/hooks/chain-team-phases.sh +40 -0
  470. package/presets/mavis/php-laravel/hooks/mavis-chain-hook.mjs +143 -0
  471. package/presets/mavis/php-laravel/hooks/run-hook.mjs +103 -0
  472. package/presets/mavis/php-laravel/minimax-hooks/hooks.json +28 -0
  473. package/presets/mavis/php-laravel/native-skills/README.md +15 -0
  474. package/presets/mavis/php-laravel/native-skills/ci-investigation/SKILL.md +24 -0
  475. package/presets/mavis/php-laravel/native-skills/code-review/SKILL.md +48 -0
  476. package/presets/mavis/php-laravel/native-skills/debug-investigation/SKILL.md +55 -0
  477. package/presets/mavis/php-laravel/native-skills/feature-delivery/SKILL.md +43 -0
  478. package/presets/mavis/php-laravel/native-skills/integration-testing/SKILL.md +21 -0
  479. package/presets/mavis/php-laravel/native-skills/migrate-tasks/SKILL.md +43 -0
  480. package/presets/mavis/php-laravel/native-skills/rr-migrate-repositories/SKILL.md +61 -0
  481. package/presets/mavis/php-laravel/native-skills/rr-scheduler-start/SKILL.md +34 -0
  482. package/presets/mavis/php-laravel/native-skills/spec-authoring/SKILL.md +31 -0
  483. package/presets/mavis/php-laravel/native-skills/spec-discovery/SKILL.md +63 -0
  484. package/presets/mavis/php-laravel/native-skills/spec-start/SKILL.md +31 -0
  485. package/presets/mavis/php-laravel/native-skills/task/SKILL.md +77 -0
  486. package/presets/mavis/php-laravel/native-skills/task-continue/SKILL.md +72 -0
  487. package/presets/mavis/php-laravel/native-skills/technical-retro/SKILL.md +72 -0
  488. package/presets/mavis/php-laravel/native-skills/unit-testing/SKILL.md +20 -0
  489. package/presets/mavis/php-laravel/native-skills/update/SKILL.md +44 -0
  490. package/presets/mavis/php-laravel/native-skills/write-adr/SKILL.md +46 -0
  491. package/presets/mavis/php-laravel/rules/agent-team-orchestrator.md +1 -0
  492. package/presets/mavis/php-laravel/rules/code-review-mr.md +19 -4
  493. package/presets/mavis/php-laravel/skills/code-review/SKILL.md +2 -1
  494. package/presets/mavis/platform-contract.json +18 -5
  495. package/presets/mavis/svelte/MAVIS.md +9 -3
  496. package/presets/mavis/svelte/README.md +3 -1
  497. package/presets/mavis/svelte/adapter-map.json +109 -46
  498. package/presets/mavis/svelte/agents/code-reviewer.md +5 -1
  499. package/presets/mavis/svelte/agents/task-router.md +1 -1
  500. package/presets/mavis/svelte/commands/update.md +1 -0
  501. package/presets/mavis/svelte/hooks/README.md +29 -7
  502. package/presets/mavis/svelte/hooks/chain-team-phases.sh +40 -0
  503. package/presets/mavis/svelte/hooks/mavis-chain-hook.mjs +143 -0
  504. package/presets/mavis/svelte/hooks/run-hook.mjs +103 -0
  505. package/presets/mavis/svelte/minimax-hooks/hooks.json +28 -0
  506. package/presets/mavis/svelte/native-skills/README.md +15 -0
  507. package/presets/mavis/svelte/native-skills/ci-investigation/SKILL.md +50 -0
  508. package/presets/mavis/svelte/native-skills/code-review/SKILL.md +61 -0
  509. package/presets/mavis/svelte/native-skills/debug-investigation/SKILL.md +64 -0
  510. package/presets/mavis/svelte/native-skills/feature-delivery/SKILL.md +52 -0
  511. package/presets/mavis/svelte/native-skills/migrate-tasks/SKILL.md +43 -0
  512. package/presets/mavis/svelte/native-skills/mockup-review/SKILL.md +34 -0
  513. package/presets/mavis/svelte/native-skills/playwright-e2e/SKILL.md +43 -0
  514. package/presets/mavis/svelte/native-skills/rr-migrate-repositories/SKILL.md +61 -0
  515. package/presets/mavis/svelte/native-skills/rr-scheduler-start/SKILL.md +34 -0
  516. package/presets/mavis/svelte/native-skills/spec-authoring/SKILL.md +31 -0
  517. package/presets/mavis/svelte/native-skills/spec-discovery/SKILL.md +63 -0
  518. package/presets/mavis/svelte/native-skills/spec-start/SKILL.md +31 -0
  519. package/presets/mavis/svelte/native-skills/svelte-performance/SKILL.md +57 -0
  520. package/presets/mavis/svelte/native-skills/task/SKILL.md +79 -0
  521. package/presets/mavis/svelte/native-skills/task-continue/SKILL.md +74 -0
  522. package/presets/mavis/svelte/native-skills/technical-retro/SKILL.md +72 -0
  523. package/presets/mavis/svelte/native-skills/unit-testing/SKILL.md +38 -0
  524. package/presets/mavis/svelte/native-skills/update/SKILL.md +44 -0
  525. package/presets/mavis/svelte/native-skills/ux-design/SKILL.md +41 -0
  526. package/presets/mavis/svelte/native-skills/write-adr/SKILL.md +46 -0
  527. package/presets/mavis/svelte/rules/agent-team-orchestrator.md +1 -0
  528. package/presets/mavis/svelte/rules/code-review-mr.md +19 -4
  529. package/presets/mavis/svelte/skills/code-review/SKILL.md +2 -1
  530. package/presets/opencode/android-kotlin/adapter-map.json +1 -1
  531. package/presets/opencode/android-kotlin/agents/code-reviewer.md +5 -1
  532. package/presets/opencode/android-kotlin/commands/update.md +1 -0
  533. package/presets/opencode/android-kotlin/hooks/chain-team-phases.sh +40 -0
  534. package/presets/opencode/android-kotlin/rules/agent-team-orchestrator.md +1 -0
  535. package/presets/opencode/android-kotlin/rules/code-review-mr.md +19 -4
  536. package/presets/opencode/android-kotlin/skills/code-review/SKILL.md +2 -1
  537. package/presets/opencode/go/adapter-map.json +1 -1
  538. package/presets/opencode/go/agents/code-reviewer.md +5 -1
  539. package/presets/opencode/go/commands/update.md +1 -0
  540. package/presets/opencode/go/hooks/chain-team-phases.sh +40 -0
  541. package/presets/opencode/go/rules/agent-team-orchestrator.md +1 -0
  542. package/presets/opencode/go/rules/code-review-mr.md +19 -4
  543. package/presets/opencode/go/skills/code-review/SKILL.md +2 -1
  544. package/presets/opencode/ios-swift/adapter-map.json +1 -1
  545. package/presets/opencode/ios-swift/agents/code-reviewer.md +5 -1
  546. package/presets/opencode/ios-swift/commands/update.md +1 -0
  547. package/presets/opencode/ios-swift/hooks/chain-team-phases.sh +40 -0
  548. package/presets/opencode/ios-swift/rules/agent-team-orchestrator.md +1 -0
  549. package/presets/opencode/ios-swift/rules/code-review-mr.md +19 -4
  550. package/presets/opencode/ios-swift/skills/code-review/SKILL.md +2 -1
  551. package/presets/opencode/java/adapter-map.json +1 -1
  552. package/presets/opencode/java/agents/code-reviewer.md +5 -1
  553. package/presets/opencode/java/commands/update.md +1 -0
  554. package/presets/opencode/java/hooks/chain-team-phases.sh +40 -0
  555. package/presets/opencode/java/rules/agent-team-orchestrator.md +1 -0
  556. package/presets/opencode/java/rules/code-review-mr.md +19 -4
  557. package/presets/opencode/java/skills/code-review/SKILL.md +2 -1
  558. package/presets/opencode/mcp-ts/adapter-map.json +1 -1
  559. package/presets/opencode/mcp-ts/commands/update.md +1 -0
  560. package/presets/opencode/mcp-ts/hooks/chain-team-phases.sh +40 -0
  561. package/presets/opencode/mcp-ts/rules/agent-team-orchestrator.md +1 -0
  562. package/presets/opencode/mcp-ts/rules/code-review-mr.md +19 -4
  563. package/presets/opencode/mol/REPO_AGENTS.md +1 -1
  564. package/presets/opencode/mol/adapter-map.json +1 -1
  565. package/presets/opencode/mol/agents/code-reviewer.md +5 -1
  566. package/presets/opencode/mol/agents/task-router.md +1 -1
  567. package/presets/opencode/mol/commands/update.md +1 -0
  568. package/presets/opencode/mol/hooks/chain-team-phases.sh +40 -0
  569. package/presets/opencode/mol/rules/agent-team-orchestrator.md +1 -0
  570. package/presets/opencode/mol/rules/code-review-mr.md +19 -4
  571. package/presets/opencode/mol/skills/code-review/SKILL.md +2 -1
  572. package/presets/opencode/next/REPO_AGENTS.md +1 -1
  573. package/presets/opencode/next/adapter-map.json +1 -1
  574. package/presets/opencode/next/agents/build-verifier.md +2 -1
  575. package/presets/opencode/next/agents/code-reviewer.md +5 -1
  576. package/presets/opencode/next/agents/feature-developer.md +1 -1
  577. package/presets/opencode/next/agents/task-router.md +1 -1
  578. package/presets/opencode/next/commands/update.md +1 -0
  579. package/presets/opencode/next/hooks/chain-team-phases.sh +40 -0
  580. package/presets/opencode/next/rules/agent-team-orchestrator.md +1 -0
  581. package/presets/opencode/next/rules/code-review-mr.md +19 -4
  582. package/presets/opencode/next/skills/code-review/SKILL.md +2 -1
  583. package/presets/opencode/nuxt/adapter-map.json +1 -1
  584. package/presets/opencode/nuxt/agents/code-reviewer.md +5 -1
  585. package/presets/opencode/nuxt/agents/task-router.md +1 -1
  586. package/presets/opencode/nuxt/commands/update.md +1 -0
  587. package/presets/opencode/nuxt/hooks/chain-team-phases.sh +40 -0
  588. package/presets/opencode/nuxt/rules/agent-team-orchestrator.md +1 -0
  589. package/presets/opencode/nuxt/rules/code-review-mr.md +19 -4
  590. package/presets/opencode/nuxt/skills/code-review/SKILL.md +2 -1
  591. package/presets/opencode/php-hexagonal/adapter-map.json +1 -1
  592. package/presets/opencode/php-hexagonal/agents/code-reviewer.md +5 -1
  593. package/presets/opencode/php-hexagonal/commands/update.md +1 -0
  594. package/presets/opencode/php-hexagonal/hooks/chain-team-phases.sh +40 -0
  595. package/presets/opencode/php-hexagonal/rules/agent-team-orchestrator.md +1 -0
  596. package/presets/opencode/php-hexagonal/rules/code-review-mr.md +19 -4
  597. package/presets/opencode/php-hexagonal/skills/code-review/SKILL.md +2 -1
  598. package/presets/opencode/php-laravel/adapter-map.json +1 -1
  599. package/presets/opencode/php-laravel/agents/code-reviewer.md +5 -1
  600. package/presets/opencode/php-laravel/commands/update.md +1 -0
  601. package/presets/opencode/php-laravel/hooks/chain-team-phases.sh +40 -0
  602. package/presets/opencode/php-laravel/rules/agent-team-orchestrator.md +1 -0
  603. package/presets/opencode/php-laravel/rules/code-review-mr.md +19 -4
  604. package/presets/opencode/php-laravel/skills/code-review/SKILL.md +2 -1
  605. package/presets/opencode/plugins/task-status/README.md +4 -3
  606. package/presets/opencode/plugins/task-status/deepseek.ts +68 -34
  607. package/presets/opencode/plugins/task-status/task-view.ts +4 -1
  608. package/presets/opencode/plugins/task-status/tui.tsx +16 -18
  609. package/presets/opencode/plugins/task-status/types.ts +5 -1
  610. package/presets/opencode/svelte/adapter-map.json +1 -1
  611. package/presets/opencode/svelte/agents/code-reviewer.md +5 -1
  612. package/presets/opencode/svelte/agents/task-router.md +1 -1
  613. package/presets/opencode/svelte/commands/update.md +1 -0
  614. package/presets/opencode/svelte/hooks/chain-team-phases.sh +40 -0
  615. package/presets/opencode/svelte/rules/agent-team-orchestrator.md +1 -0
  616. package/presets/opencode/svelte/rules/code-review-mr.md +19 -4
  617. package/presets/opencode/svelte/skills/code-review/SKILL.md +2 -1
  618. package/presets/zcode/android-kotlin/adapter-map.json +1 -1
  619. package/presets/zcode/android-kotlin/agents/code-reviewer.md +5 -1
  620. package/presets/zcode/android-kotlin/commands/update.md +1 -0
  621. package/presets/zcode/android-kotlin/hooks/chain-team-phases.sh +40 -0
  622. package/presets/zcode/android-kotlin/rules/agent-team-orchestrator.md +1 -0
  623. package/presets/zcode/android-kotlin/rules/code-review-mr.md +19 -4
  624. package/presets/zcode/android-kotlin/skills/code-review/SKILL.md +2 -1
  625. package/presets/zcode/go/adapter-map.json +1 -1
  626. package/presets/zcode/go/agents/code-reviewer.md +5 -1
  627. package/presets/zcode/go/commands/update.md +1 -0
  628. package/presets/zcode/go/hooks/chain-team-phases.sh +40 -0
  629. package/presets/zcode/go/rules/agent-team-orchestrator.md +1 -0
  630. package/presets/zcode/go/rules/code-review-mr.md +19 -4
  631. package/presets/zcode/go/skills/code-review/SKILL.md +2 -1
  632. package/presets/zcode/ios-swift/adapter-map.json +1 -1
  633. package/presets/zcode/ios-swift/agents/code-reviewer.md +5 -1
  634. package/presets/zcode/ios-swift/commands/update.md +1 -0
  635. package/presets/zcode/ios-swift/hooks/chain-team-phases.sh +40 -0
  636. package/presets/zcode/ios-swift/rules/agent-team-orchestrator.md +1 -0
  637. package/presets/zcode/ios-swift/rules/code-review-mr.md +19 -4
  638. package/presets/zcode/ios-swift/skills/code-review/SKILL.md +2 -1
  639. package/presets/zcode/java/adapter-map.json +1 -1
  640. package/presets/zcode/java/agents/code-reviewer.md +5 -1
  641. package/presets/zcode/java/commands/update.md +1 -0
  642. package/presets/zcode/java/hooks/chain-team-phases.sh +40 -0
  643. package/presets/zcode/java/rules/agent-team-orchestrator.md +1 -0
  644. package/presets/zcode/java/rules/code-review-mr.md +19 -4
  645. package/presets/zcode/java/skills/code-review/SKILL.md +2 -1
  646. package/presets/zcode/mcp-ts/adapter-map.json +1 -1
  647. package/presets/zcode/mcp-ts/commands/update.md +1 -0
  648. package/presets/zcode/mcp-ts/hooks/chain-team-phases.sh +40 -0
  649. package/presets/zcode/mcp-ts/rules/agent-team-orchestrator.md +1 -0
  650. package/presets/zcode/mcp-ts/rules/code-review-mr.md +19 -4
  651. package/presets/zcode/mol/REPO_AGENTS.md +1 -1
  652. package/presets/zcode/mol/adapter-map.json +1 -1
  653. package/presets/zcode/mol/agents/code-reviewer.md +5 -1
  654. package/presets/zcode/mol/agents/task-router.md +1 -1
  655. package/presets/zcode/mol/commands/update.md +1 -0
  656. package/presets/zcode/mol/hooks/chain-team-phases.sh +40 -0
  657. package/presets/zcode/mol/rules/agent-team-orchestrator.md +1 -0
  658. package/presets/zcode/mol/rules/code-review-mr.md +19 -4
  659. package/presets/zcode/mol/skills/code-review/SKILL.md +2 -1
  660. package/presets/zcode/next/REPO_AGENTS.md +1 -1
  661. package/presets/zcode/next/adapter-map.json +1 -1
  662. package/presets/zcode/next/agents/build-verifier.md +2 -1
  663. package/presets/zcode/next/agents/code-reviewer.md +5 -1
  664. package/presets/zcode/next/agents/feature-developer.md +1 -1
  665. package/presets/zcode/next/agents/task-router.md +1 -1
  666. package/presets/zcode/next/commands/update.md +1 -0
  667. package/presets/zcode/next/hooks/chain-team-phases.sh +40 -0
  668. package/presets/zcode/next/rules/agent-team-orchestrator.md +1 -0
  669. package/presets/zcode/next/rules/code-review-mr.md +19 -4
  670. package/presets/zcode/next/skills/code-review/SKILL.md +2 -1
  671. package/presets/zcode/nuxt/adapter-map.json +1 -1
  672. package/presets/zcode/nuxt/agents/code-reviewer.md +5 -1
  673. package/presets/zcode/nuxt/agents/task-router.md +1 -1
  674. package/presets/zcode/nuxt/commands/update.md +1 -0
  675. package/presets/zcode/nuxt/hooks/chain-team-phases.sh +40 -0
  676. package/presets/zcode/nuxt/rules/agent-team-orchestrator.md +1 -0
  677. package/presets/zcode/nuxt/rules/code-review-mr.md +19 -4
  678. package/presets/zcode/nuxt/skills/code-review/SKILL.md +2 -1
  679. package/presets/zcode/php-hexagonal/adapter-map.json +1 -1
  680. package/presets/zcode/php-hexagonal/agents/code-reviewer.md +5 -1
  681. package/presets/zcode/php-hexagonal/commands/update.md +1 -0
  682. package/presets/zcode/php-hexagonal/hooks/chain-team-phases.sh +40 -0
  683. package/presets/zcode/php-hexagonal/rules/agent-team-orchestrator.md +1 -0
  684. package/presets/zcode/php-hexagonal/rules/code-review-mr.md +19 -4
  685. package/presets/zcode/php-hexagonal/skills/code-review/SKILL.md +2 -1
  686. package/presets/zcode/php-laravel/adapter-map.json +1 -1
  687. package/presets/zcode/php-laravel/agents/code-reviewer.md +5 -1
  688. package/presets/zcode/php-laravel/commands/update.md +1 -0
  689. package/presets/zcode/php-laravel/hooks/chain-team-phases.sh +40 -0
  690. package/presets/zcode/php-laravel/rules/agent-team-orchestrator.md +1 -0
  691. package/presets/zcode/php-laravel/rules/code-review-mr.md +19 -4
  692. package/presets/zcode/php-laravel/skills/code-review/SKILL.md +2 -1
  693. package/presets/zcode/svelte/adapter-map.json +1 -1
  694. package/presets/zcode/svelte/agents/code-reviewer.md +5 -1
  695. package/presets/zcode/svelte/agents/task-router.md +1 -1
  696. package/presets/zcode/svelte/commands/update.md +1 -0
  697. package/presets/zcode/svelte/hooks/chain-team-phases.sh +40 -0
  698. package/presets/zcode/svelte/rules/agent-team-orchestrator.md +1 -0
  699. package/presets/zcode/svelte/rules/code-review-mr.md +19 -4
  700. package/presets/zcode/svelte/skills/code-review/SKILL.md +2 -1
@@ -4012,14 +4012,54 @@ export function runRepositoriesCommand(subcommand, args, options = {}) {
4012
4012
  if (json) return { exitCode: 0, output: renderJson({ ok: true, dryRun: true, id, linksRemoved }) };
4013
4013
  return { exitCode: 0, output: `delete (dry run): ${id} linksRemoved=${linksRemoved}\n` };
4014
4014
  }
4015
- writeRepositoriesFile(teamRoot, {
4016
- ...file,
4017
- repositories: file.repositories.filter((entry) => entry.id !== id),
4018
- links: file.links.filter((link) => link.repositoryId !== id),
4019
- });
4020
- const projection = containProjection(() => projectRepositoriesInChild(teamRoot, { repositoryIds: [id], taskSlugs: [] }));
4021
- if (json) return { exitCode: 0, output: renderJson({ ok: true, id, linksRemoved, projection }) };
4022
- return { exitCode: 0, output: `delete: ${id} linksRemoved=${linksRemoved}\n` };
4015
+ // The project-registry cleanup (the resurrection guard): re-registering
4016
+ // a deleted repository id must never silently resurrect stale project
4017
+ // memberships, so the links naming this repository leave the projects
4018
+ // file in the same child. The nested projects lock is taken before
4019
+ // either file is written, still inside the repositories lock — the
4020
+ // frozen order `.repositories.lock` -> `.project-registry.lock` — so a
4021
+ // refusal here aborts the whole delete with both files untouched and
4022
+ // parseable.
4023
+ const projectPaths = projectsPaths(teamRoot);
4024
+ fs.mkdirSync(projectPaths.root, { recursive: true });
4025
+ let projectsToken = null;
4026
+ try {
4027
+ projectsToken = acquireLock(projectPaths.lock, { timeoutMs: 5000 });
4028
+ } catch (error) {
4029
+ teamDbFail(
4030
+ 'E_PROJECTS_BUSY',
4031
+ `could not take the projects lock at ${projectPaths.lock}: ${error.message}`,
4032
+ 4,
4033
+ );
4034
+ }
4035
+ try {
4036
+ const projectsDocument = readProjectsFile(teamRoot);
4037
+ const removedLinks = projectsDocument.links.filter((link) => link.repositoryId === id);
4038
+ const membersRemoved = removedLinks.length;
4039
+ const affectedProjectIds = [...new Set(removedLinks.map((link) => link.projectId))];
4040
+ writeProjectsFile(teamRoot, {
4041
+ ...projectsDocument,
4042
+ links: projectsDocument.links.filter((link) => link.repositoryId !== id),
4043
+ });
4044
+ writeRepositoriesFile(teamRoot, {
4045
+ ...file,
4046
+ repositories: file.repositories.filter((entry) => entry.id !== id),
4047
+ links: file.links.filter((link) => link.repositoryId !== id),
4048
+ });
4049
+ const projection = containProjection(() => projectRepositoriesInChild(teamRoot, { repositoryIds: [id], taskSlugs: [] }));
4050
+ const projectProjection = containProjectsProjection(() =>
4051
+ projectProjectsInChild(teamRoot, { projectIds: affectedProjectIds, repositoryIds: [id] }),
4052
+ );
4053
+ if (json) {
4054
+ return {
4055
+ exitCode: 0,
4056
+ output: renderJson({ ok: true, id, linksRemoved, membersRemoved, projection, projectProjection }),
4057
+ };
4058
+ }
4059
+ return { exitCode: 0, output: `delete: ${id} linksRemoved=${linksRemoved} membersRemoved=${membersRemoved}\n` };
4060
+ } finally {
4061
+ releaseLock(projectPaths.lock, projectsToken);
4062
+ }
4023
4063
  });
4024
4064
  }
4025
4065
 
@@ -4042,6 +4082,680 @@ const containProjection = (run) => {
4042
4082
  }
4043
4083
  };
4044
4084
 
4085
+ /* --------------------------- project-registry.json ------------------------- */
4086
+
4087
+ export const PROJECTS_FILE = 'project-registry.json';
4088
+ export const PROJECTS_LOCK = '.project-registry.lock';
4089
+ export const PROJECTS_FILE_VERSION = 1;
4090
+ /** The closed write-time `status` vocabulary. The reader accepts anything. */
4091
+ export const PROJECT_STATUSES = ['active', 'archived'];
4092
+ export const DECLARED_PROJECT_KEYS = [
4093
+ 'id',
4094
+ 'name',
4095
+ 'description',
4096
+ 'status',
4097
+ 'revision',
4098
+ 'createdAt',
4099
+ 'updatedAt',
4100
+ ];
4101
+ export const DECLARED_PROJECT_LINK_KEYS = ['projectId', 'repositoryId', 'addedAt'];
4102
+
4103
+ const MAX_PROJECT_DESCRIPTION_LENGTH = 2000;
4104
+
4105
+ /** Every path the project registry owns under one team root. */
4106
+ export function projectsPaths(teamRoot) {
4107
+ const root = resolveTeamRoot(teamRoot);
4108
+ return {
4109
+ root,
4110
+ file: path.join(root, PROJECTS_FILE),
4111
+ lock: path.join(root, PROJECTS_LOCK),
4112
+ };
4113
+ }
4114
+
4115
+ const failProjectField = (parameter, detail) => {
4116
+ const error = new TeamDbError('E_VALIDATION', `parameter "${parameter}": ${detail}`, 3);
4117
+ error.parameter = parameter;
4118
+ throw error;
4119
+ };
4120
+
4121
+ const projectsFileFailure = (detail) => teamDbFail('E_PROJECTS_PARSE', detail, 1);
4122
+
4123
+ const assertProjectKeys = (record, allowed, prefix) => {
4124
+ for (const key of Object.keys(record)) {
4125
+ if (!allowed.includes(key)) projectsFileFailure(`${prefix}${key}: unknown key`);
4126
+ }
4127
+ };
4128
+
4129
+ const projectText = (value, parameter, { min = 0, max } = {}) => {
4130
+ if (typeof value !== 'string' || value.length < min || (max !== undefined && value.length > max)) {
4131
+ projectsFileFailure(`"${parameter}" must be a string of ${min}-${max ?? 'unbounded'} characters`);
4132
+ }
4133
+ return value;
4134
+ };
4135
+
4136
+ const projectIso = (value, parameter) => {
4137
+ if (typeof value !== 'string' || Number.isNaN(Date.parse(value))) {
4138
+ projectsFileFailure(`"${parameter}" must be an ISO 8601 timestamp`);
4139
+ }
4140
+ return value;
4141
+ };
4142
+
4143
+ /**
4144
+ * Validate one stored project record and normalize it into the declared key
4145
+ * order. The reader is strict about shapes and permissive about `status`, the
4146
+ * same split as the repository record: the write verbs refuse an
4147
+ * out-of-vocabulary status with `E_VALIDATION`, the projection serves whatever
4148
+ * a hand-edited file says.
4149
+ */
4150
+ const readProjectRecord = (entry, path_) => {
4151
+ if (!isRecord(entry)) projectsFileFailure(`${path_}: a project must be an object`);
4152
+ assertProjectKeys(entry, DECLARED_PROJECT_KEYS, `${path_}: `);
4153
+ const id = entry.id;
4154
+ if (
4155
+ typeof id !== 'string' ||
4156
+ !SLUG_RE.test(id) ||
4157
+ id.length < 1 ||
4158
+ id.length > MAX_REPOSITORY_ID_LENGTH
4159
+ ) {
4160
+ projectsFileFailure(`${path_}: "id" must match ${SLUG_RE.source} and be 1-48 characters`);
4161
+ }
4162
+ const description = entry.description ?? null;
4163
+ if (description !== null) {
4164
+ projectText(description, 'description', { max: MAX_PROJECT_DESCRIPTION_LENGTH });
4165
+ }
4166
+ if (!Number.isInteger(entry.revision) || entry.revision < 1) {
4167
+ projectsFileFailure(`${path_}: "revision" must be an integer of at least 1`);
4168
+ }
4169
+ return {
4170
+ id,
4171
+ name: projectText(entry.name, 'name', { min: 1, max: MAX_REPOSITORY_NAME_LENGTH }),
4172
+ description,
4173
+ status: projectText(entry.status, 'status', { min: 1 }),
4174
+ revision: entry.revision,
4175
+ createdAt: projectIso(entry.createdAt, 'createdAt'),
4176
+ updatedAt: projectIso(entry.updatedAt, 'updatedAt'),
4177
+ };
4178
+ };
4179
+
4180
+ const readProjectLinkRecord = (entry, path_) => {
4181
+ if (!isRecord(entry)) projectsFileFailure(`${path_}: a link must be an object`);
4182
+ assertProjectKeys(entry, DECLARED_PROJECT_LINK_KEYS, `${path_}: `);
4183
+ return {
4184
+ projectId: projectText(entry.projectId, 'projectId', { min: 1 }),
4185
+ repositoryId: projectText(entry.repositoryId, 'repositoryId', { min: 1 }),
4186
+ addedAt: projectIso(entry.addedAt, 'addedAt'),
4187
+ };
4188
+ };
4189
+
4190
+ /**
4191
+ * Read `project-registry.json`. An absent file is an empty valid store; there
4192
+ * is no seed and no backfill from `repositories.json` in either direction.
4193
+ *
4194
+ * A malformed file is a named failure: the caller never writes over it, and
4195
+ * the projection records the error without tombstoning a row. A link naming
4196
+ * an unknown endpoint is the same refusal (I-1): the file is the definition
4197
+ * of record, so a dangling membership is a hand-edit bug, not a tolerable
4198
+ * state.
4199
+ */
4200
+ export function readProjectsFile(teamRoot) {
4201
+ const paths = projectsPaths(teamRoot);
4202
+ let text;
4203
+ try {
4204
+ text = fs.readFileSync(paths.file, 'utf8');
4205
+ } catch (error) {
4206
+ if (error.code === 'ENOENT') {
4207
+ return { version: PROJECTS_FILE_VERSION, projects: [], links: [], present: false };
4208
+ }
4209
+ projectsFileFailure(`${paths.file}: ${error.message}`);
4210
+ }
4211
+ let parsed;
4212
+ try {
4213
+ parsed = JSON.parse(text);
4214
+ } catch (error) {
4215
+ projectsFileFailure(`${paths.file}: not valid JSON (${error.message})`);
4216
+ }
4217
+ if (!isRecord(parsed)) projectsFileFailure(`${paths.file}: top level must be an object`);
4218
+ for (const key of Object.keys(parsed)) {
4219
+ if (!['version', 'projects', 'links'].includes(key)) {
4220
+ projectsFileFailure(`${paths.file}: unknown top-level key "${key}"`);
4221
+ }
4222
+ }
4223
+ if (parsed.version !== PROJECTS_FILE_VERSION) {
4224
+ projectsFileFailure(
4225
+ `${paths.file}: version must be ${PROJECTS_FILE_VERSION}, got ${JSON.stringify(parsed.version)}`,
4226
+ );
4227
+ }
4228
+ if (!Array.isArray(parsed.projects)) projectsFileFailure(`${paths.file}: "projects" must be an array`);
4229
+ if (!Array.isArray(parsed.links)) projectsFileFailure(`${paths.file}: "links" must be an array`);
4230
+
4231
+ const seen = new Set();
4232
+ const projects = parsed.projects.map((entry) => {
4233
+ const record = readProjectRecord(entry, paths.file);
4234
+ if (seen.has(record.id)) projectsFileFailure(`${paths.file}: duplicate project id "${record.id}"`);
4235
+ seen.add(record.id);
4236
+ return record;
4237
+ });
4238
+ const repositoryIds = new Set(readRepositoriesFile(teamRoot).repositories.map((record) => record.id));
4239
+ const linkKeys = new Set();
4240
+ const links = parsed.links.map((entry) => {
4241
+ const link = readProjectLinkRecord(entry, paths.file);
4242
+ if (!seen.has(link.projectId)) {
4243
+ projectsFileFailure(`${paths.file}: link names the unknown project "${link.projectId}"`);
4244
+ }
4245
+ if (!repositoryIds.has(link.repositoryId)) {
4246
+ projectsFileFailure(`${paths.file}: link names the unknown repository "${link.repositoryId}"`);
4247
+ }
4248
+ const key = `${link.projectId}\u0000${link.repositoryId}`;
4249
+ if (linkKeys.has(key)) {
4250
+ projectsFileFailure(
4251
+ `${paths.file}: duplicate link "${link.projectId}" -> "${link.repositoryId}"`,
4252
+ );
4253
+ }
4254
+ linkKeys.add(key);
4255
+ return link;
4256
+ });
4257
+ return { version: PROJECTS_FILE_VERSION, projects, links, present: true };
4258
+ }
4259
+
4260
+ /**
4261
+ * Deterministic serialization: declared key order, projects sorted by id, links
4262
+ * by `(projectId, repositoryId)`, two-space indent, one trailing newline. An
4263
+ * unchanged rewrite is byte-identical.
4264
+ */
4265
+ export function serializeProjectsFile(document) {
4266
+ const projects = [...document.projects]
4267
+ .sort((left, right) => byText(left.id, right.id))
4268
+ .map((record) => {
4269
+ const output = {};
4270
+ for (const key of DECLARED_PROJECT_KEYS) output[key] = record[key];
4271
+ return output;
4272
+ });
4273
+ const links = [...document.links]
4274
+ .sort((left, right) => byText(left.projectId, right.projectId) || byText(left.repositoryId, right.repositoryId))
4275
+ .map((record) => {
4276
+ const output = {};
4277
+ for (const key of DECLARED_PROJECT_LINK_KEYS) output[key] = record[key];
4278
+ return output;
4279
+ });
4280
+ return `${JSON.stringify({ version: PROJECTS_FILE_VERSION, projects, links }, null, 2)}\n`;
4281
+ }
4282
+
4283
+ /** Write the registry atomically; an identical rewrite performs no write. */
4284
+ export function writeProjectsFile(teamRoot, document) {
4285
+ const paths = projectsPaths(teamRoot);
4286
+ const content = serializeProjectsFile(document);
4287
+ try {
4288
+ if (fs.readFileSync(paths.file, 'utf8') === content) return false;
4289
+ } catch {
4290
+ /* absent or unreadable: write it */
4291
+ }
4292
+ writeAtomicRepositoriesFile(paths.file, content);
4293
+ return true;
4294
+ }
4295
+
4296
+ const projectContentHash = (record) => sha256(canonicalJson(record));
4297
+ const projectLinkContentHash = (link) =>
4298
+ sha256(canonicalJson({ projectId: link.projectId, repositoryId: link.repositoryId }));
4299
+
4300
+ const UPSERT_PROJECT_SQL = `
4301
+ INSERT INTO projects(
4302
+ id, name, description, status, revision, created_at, updated_at,
4303
+ content_hash, parse_error, projected_at, first_seen_at, last_seen_at, absent_at
4304
+ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, NULL, ?, ?, ?, NULL)
4305
+ ON CONFLICT(id) DO UPDATE SET
4306
+ name = excluded.name,
4307
+ description = excluded.description,
4308
+ status = excluded.status,
4309
+ revision = excluded.revision,
4310
+ created_at = excluded.created_at,
4311
+ updated_at = excluded.updated_at,
4312
+ content_hash = excluded.content_hash,
4313
+ parse_error = NULL,
4314
+ projected_at = excluded.projected_at,
4315
+ last_seen_at = excluded.last_seen_at,
4316
+ absent_at = NULL
4317
+ `;
4318
+
4319
+ const INSERT_PROJECT_LINK_SQL = `
4320
+ INSERT INTO project_repositories(
4321
+ project_id, repository_id, added_at, content_hash, projected_at
4322
+ ) VALUES (?, ?, ?, ?, ?)
4323
+ `;
4324
+
4325
+ const projectProjectRecord = (db, record, now) => {
4326
+ const hash = projectContentHash(record);
4327
+ const existing = db.prepare('SELECT content_hash, first_seen_at FROM projects WHERE id = ?1').get(record.id);
4328
+ if (existing && existing.content_hash === hash) {
4329
+ // An unchanged record only moves its inventory columns.
4330
+ db.prepare('UPDATE projects SET projected_at = ?2, last_seen_at = ?2, absent_at = NULL WHERE id = ?1').run(
4331
+ record.id,
4332
+ now,
4333
+ );
4334
+ return;
4335
+ }
4336
+ db.prepare(UPSERT_PROJECT_SQL).run(
4337
+ record.id,
4338
+ record.name,
4339
+ record.description,
4340
+ record.status,
4341
+ record.revision,
4342
+ record.createdAt,
4343
+ record.updatedAt,
4344
+ hash,
4345
+ now,
4346
+ existing ? existing.first_seen_at : now,
4347
+ now,
4348
+ );
4349
+ };
4350
+
4351
+ /**
4352
+ * Project the project registry into `team.db`.
4353
+ *
4354
+ * `scope` narrows a write child to the rows its payload touched: the named
4355
+ * project ids and the named repository ids. Without a scope the whole file is
4356
+ * projected, absent records are tombstoned and pruned, and the membership
4357
+ * table is replaced. A malformed file records the failure and touches no row.
4358
+ */
4359
+ export function projectProjects(db, options = {}) {
4360
+ const teamRoot = resolveTeamRoot(options.teamRoot);
4361
+ const now = options.now ?? new Date().toISOString();
4362
+ const scope = options.scope ?? null;
4363
+ const result = { projects: 0, links: 0, absent: 0, pruned: 0, failed: 0, errors: [] };
4364
+ let file;
4365
+ try {
4366
+ file = readProjectsFile(teamRoot);
4367
+ } catch (error) {
4368
+ result.failed += 1;
4369
+ result.errors.push({ path: projectsPaths(teamRoot).file, reason: error.message });
4370
+ return result;
4371
+ }
4372
+
4373
+ const inProjectScope = (id) => scope === null || scope.projectIds.includes(id);
4374
+ const knownProjects = new Set(file.projects.map((record) => record.id));
4375
+ // The membership table may only name repositories that exist themselves; a
4376
+ // repository id the other registry does not know is skipped, never inserted.
4377
+ const knownRepositories = new Set(
4378
+ readRepositoriesFile(teamRoot).repositories.map((record) => record.id),
4379
+ );
4380
+
4381
+ db.exec('BEGIN IMMEDIATE');
4382
+ try {
4383
+ for (const record of file.projects) {
4384
+ if (!inProjectScope(record.id)) continue;
4385
+ projectProjectRecord(db, record, now);
4386
+ result.projects += 1;
4387
+ }
4388
+
4389
+ if (scope === null) {
4390
+ result.absent += db
4391
+ .prepare('UPDATE projects SET absent_at = ? WHERE absent_at IS NULL')
4392
+ .run(now).changes;
4393
+ const stale = db.prepare('SELECT id FROM projects WHERE absent_at IS NOT NULL').all();
4394
+ for (const row of stale) {
4395
+ if (knownProjects.has(row.id)) {
4396
+ db.prepare('UPDATE projects SET absent_at = NULL WHERE id = ?').run(row.id);
4397
+ }
4398
+ }
4399
+ db.prepare('DELETE FROM project_repositories').run();
4400
+ } else {
4401
+ for (const projectId of scope.projectIds) {
4402
+ db.prepare('DELETE FROM project_repositories WHERE project_id = ?').run(projectId);
4403
+ }
4404
+ for (const repositoryId of scope.repositoryIds ?? []) {
4405
+ db.prepare('DELETE FROM project_repositories WHERE repository_id = ?').run(repositoryId);
4406
+ }
4407
+ }
4408
+
4409
+ for (const link of file.links) {
4410
+ if (scope !== null && !inProjectScope(link.projectId)) continue;
4411
+ if (!knownProjects.has(link.projectId)) continue;
4412
+ if (!knownRepositories.has(link.repositoryId)) continue;
4413
+ db.prepare(INSERT_PROJECT_LINK_SQL).run(
4414
+ link.projectId,
4415
+ link.repositoryId,
4416
+ link.addedAt,
4417
+ projectLinkContentHash(link),
4418
+ now,
4419
+ );
4420
+ result.links += 1;
4421
+ }
4422
+
4423
+ if (scope === null) {
4424
+ result.pruned += db.prepare('DELETE FROM projects WHERE absent_at IS NOT NULL').run().changes;
4425
+ } else {
4426
+ for (const id of scope.projectIds) {
4427
+ if (knownProjects.has(id)) continue;
4428
+ result.pruned += db.prepare('DELETE FROM projects WHERE id = ?').run(id).changes;
4429
+ }
4430
+ }
4431
+ db.exec('COMMIT');
4432
+ } catch (error) {
4433
+ try {
4434
+ db.exec('ROLLBACK');
4435
+ } catch {
4436
+ /* the primary failure is the finding */
4437
+ }
4438
+ throw error;
4439
+ }
4440
+ return result;
4441
+ }
4442
+
4443
+ const projectProjectsInChild = (teamRoot, scope, env = process.env) => {
4444
+ if (!isSqliteAvailable(env)) return null;
4445
+ const handle = openTeamDb({ teamRoot });
4446
+ try {
4447
+ return projectProjects(handle.db, { teamRoot: handle.teamRoot, scope });
4448
+ } finally {
4449
+ handle.db.close();
4450
+ }
4451
+ };
4452
+
4453
+ /**
4454
+ * A projection failure never fails a file write: one error-log line, and the
4455
+ * caller still reports `ok: true` with `failed >= 1`.
4456
+ */
4457
+ const containProjectsProjection = (run) => {
4458
+ try {
4459
+ const result = run();
4460
+ if (result === null) return { skipped: true, failed: 0 };
4461
+ return result;
4462
+ } catch (error) {
4463
+ logProjectionFailure('E_PROJECTS_PROJECTION', error.message);
4464
+ return { failed: 1, errors: [{ path: PROJECTS_FILE, reason: error.message }] };
4465
+ }
4466
+ };
4467
+
4468
+ /**
4469
+ * The `ProjectSummary` the membership verbs answer: the projected record plus
4470
+ * its member refs, read from the projection inside the same child that wrote
4471
+ * the file, so the route returns it verbatim without a refetch.
4472
+ */
4473
+ const readProjectedProjectSummary = (teamRoot, id) => {
4474
+ if (!isSqliteAvailable()) return null;
4475
+ const handle = openTeamDb({ teamRoot });
4476
+ try {
4477
+ const record = handle.db.prepare('SELECT * FROM projects WHERE id = ?1 AND absent_at IS NULL').get(id);
4478
+ if (!record) return null;
4479
+ const repositories = handle.db
4480
+ .prepare(
4481
+ `SELECT r.id, r.name, r.status
4482
+ FROM project_repositories pr JOIN repositories r ON r.id = pr.repository_id
4483
+ WHERE pr.project_id = ?1 AND r.absent_at IS NULL
4484
+ ORDER BY r.name COLLATE NOCASE, r.id`,
4485
+ )
4486
+ .all(id);
4487
+ return {
4488
+ id: record.id,
4489
+ name: record.name,
4490
+ description: record.description ?? null,
4491
+ status: record.status,
4492
+ revision: record.revision,
4493
+ createdAt: record.created_at,
4494
+ updatedAt: record.updated_at,
4495
+ repositories,
4496
+ };
4497
+ } finally {
4498
+ handle.db.close();
4499
+ }
4500
+ };
4501
+
4502
+ /**
4503
+ * Validate one `ProjectWrite` body and normalize it into the record shape.
4504
+ *
4505
+ * Membership is not a property of the record (I-3): an unknown key — including
4506
+ * a membership key — is refused here, and membership moves only through the
4507
+ * dedicated link verbs. `status` is the only closed vocabulary the write path
4508
+ * enforces; `createdAt` and `updatedAt` belong to the writer, not the client.
4509
+ */
4510
+ export function validateProjectWrite(input) {
4511
+ if (!isRecord(input)) failProjectField('project', 'must be an object');
4512
+ // The route table answers 422 `E_VALIDATION` for a field outside the
4513
+ // documented set, so the write validator names the key itself instead of
4514
+ // the reader's parse refusal (which the transport maps to 500).
4515
+ for (const key of Object.keys(input)) {
4516
+ if (![...DECLARED_PROJECT_KEYS, 'revision'].includes(key)) {
4517
+ failProjectField(key, 'unknown key');
4518
+ }
4519
+ }
4520
+ const id = input.id;
4521
+ if (
4522
+ typeof id !== 'string' ||
4523
+ !SLUG_RE.test(id) ||
4524
+ id.length < 1 ||
4525
+ id.length > MAX_REPOSITORY_ID_LENGTH
4526
+ ) {
4527
+ failProjectField('id', `must match ${SLUG_RE.source} and be 1-48 characters`);
4528
+ }
4529
+ const name = input.name;
4530
+ if (typeof name !== 'string' || name.trim().length < 1 || name.length > MAX_REPOSITORY_NAME_LENGTH) {
4531
+ failProjectField('name', `must be 1-${MAX_REPOSITORY_NAME_LENGTH} characters`);
4532
+ }
4533
+ const description = input.description ?? null;
4534
+ if (
4535
+ description !== null &&
4536
+ (typeof description !== 'string' || description.length > MAX_PROJECT_DESCRIPTION_LENGTH)
4537
+ ) {
4538
+ failProjectField('description', `must be null or at most ${MAX_PROJECT_DESCRIPTION_LENGTH} characters`);
4539
+ }
4540
+ if (typeof input.status !== 'string' || !PROJECT_STATUSES.includes(input.status)) {
4541
+ failProjectField('status', `must be one of ${PROJECT_STATUSES.join(', ')}`);
4542
+ }
4543
+ if (input.revision !== undefined && (!Number.isInteger(input.revision) || input.revision < 1)) {
4544
+ failProjectField('revision', 'must be an integer of at least 1');
4545
+ }
4546
+ return {
4547
+ id,
4548
+ name: name.trim(),
4549
+ description: description === null ? null : description,
4550
+ status: input.status,
4551
+ revision: input.revision,
4552
+ };
4553
+ }
4554
+
4555
+ const withProjectsLock = (teamRoot, run) => {
4556
+ const paths = projectsPaths(teamRoot);
4557
+ fs.mkdirSync(paths.root, { recursive: true });
4558
+ let token = null;
4559
+ try {
4560
+ token = acquireLock(paths.lock, { timeoutMs: 5000 });
4561
+ } catch (error) {
4562
+ teamDbFail('E_PROJECTS_BUSY', `could not take the projects lock at ${paths.lock}: ${error.message}`, 4);
4563
+ }
4564
+ try {
4565
+ return run(paths);
4566
+ } finally {
4567
+ releaseLock(paths.lock, token);
4568
+ }
4569
+ };
4570
+
4571
+ /**
4572
+ * `projects put|delete|link|unlink|list|project` over the file of record.
4573
+ *
4574
+ * One lock spans the whole read-modify-write-projection: the definition lands
4575
+ * first, the projection follows and its failure never fails the write.
4576
+ */
4577
+ export function runProjectsCommand(subcommand, args, options = {}) {
4578
+ const teamRoot = resolveTeamRoot(options.root);
4579
+ const json = Boolean(options.json);
4580
+ const quiet = Boolean(options.quiet);
4581
+ const now = new Date().toISOString();
4582
+
4583
+ if (isKillSwitchSet(process.env) && subcommand !== 'list') {
4584
+ teamDbFail('E_DISABLED', 'disabled by AI_RULES_TEAM_DB_DISABLE', 1);
4585
+ }
4586
+
4587
+ const readStdinOrFile = (label) => {
4588
+ const source = options.file;
4589
+ if (typeof source !== 'string' || source === '') teamDbFail('E_USAGE', `projects ${label} needs --file <path|->`, 3);
4590
+ const text = source === '-' ? fs.readFileSync(0, 'utf8') : fs.readFileSync(source, 'utf8');
4591
+ try {
4592
+ return JSON.parse(text);
4593
+ } catch (error) {
4594
+ failProjectField('payload', `the body is not JSON (${error.message})`);
4595
+ }
4596
+ return null;
4597
+ };
4598
+
4599
+ if (subcommand === 'list') {
4600
+ const file = readProjectsFile(teamRoot);
4601
+ if (json) return { exitCode: 0, output: renderJson({ ...file }) };
4602
+ if (quiet) return { exitCode: 0, output: '' };
4603
+ const lines = ['ID NAME STATUS MEMBERS'];
4604
+ for (const record of file.projects) {
4605
+ const members = file.links.filter((link) => link.projectId === record.id).length;
4606
+ lines.push(`${record.id} ${record.name} ${record.status} ${members}`);
4607
+ }
4608
+ return { exitCode: 0, output: `${lines.join('\n')}\n` };
4609
+ }
4610
+
4611
+ if (subcommand === 'project') {
4612
+ return withProjectsLock(teamRoot, () => {
4613
+ const result = projectProjectsInChild(teamRoot, null);
4614
+ if (json) return { exitCode: 0, output: renderJson({ ok: true, projection: result }) };
4615
+ return { exitCode: 0, output: `project: projects=${result?.projects ?? 0} links=${result?.links ?? 0}\n` };
4616
+ });
4617
+ }
4618
+
4619
+ if (subcommand === 'put') {
4620
+ const payload = readStdinOrFile('put');
4621
+ return withProjectsLock(teamRoot, () => {
4622
+ const file = readProjectsFile(teamRoot);
4623
+ const written = validateProjectWrite(payload);
4624
+ const existing = file.projects.find((record) => record.id === written.id) ?? null;
4625
+ if (existing) {
4626
+ if (payload.revision === undefined) {
4627
+ teamDbFail(
4628
+ 'E_CONFLICT',
4629
+ `project "${existing.id}" is at revision ${existing.revision}; an update must carry "revision"`,
4630
+ 1,
4631
+ );
4632
+ }
4633
+ if (payload.revision !== existing.revision) {
4634
+ teamDbFail(
4635
+ 'E_CONFLICT',
4636
+ `project "${existing.id}" is at revision ${existing.revision}, the body sent ${payload.revision}`,
4637
+ 1,
4638
+ );
4639
+ }
4640
+ } else if (payload.revision !== undefined && payload.revision !== 1) {
4641
+ teamDbFail('E_CONFLICT', `project "${written.id}" does not exist; revision must be 1`, 1);
4642
+ }
4643
+ const record = {
4644
+ id: written.id,
4645
+ name: written.name,
4646
+ description: written.description,
4647
+ status: written.status,
4648
+ revision: existing ? existing.revision + 1 : 1,
4649
+ createdAt: existing ? existing.createdAt : now,
4650
+ updatedAt: now,
4651
+ };
4652
+ if (options.dryRun) {
4653
+ if (json) return { exitCode: 0, output: renderJson({ ok: true, dryRun: true, project: record }) };
4654
+ return { exitCode: 0, output: `${JSON.stringify(record, null, 2)}\n` };
4655
+ }
4656
+ const projects = existing
4657
+ ? file.projects.map((entry) => (entry.id === record.id ? record : entry))
4658
+ : [...file.projects, record];
4659
+ writeProjectsFile(teamRoot, { ...file, projects });
4660
+ const projection = containProjectsProjection(() => projectProjectsInChild(teamRoot, { projectIds: [record.id], repositoryIds: [] }));
4661
+ if (json) return { exitCode: 0, output: renderJson({ ok: true, project: record, projection }) };
4662
+ return { exitCode: 0, output: `put: ${record.id} revision ${record.revision}\n` };
4663
+ });
4664
+ }
4665
+
4666
+ if (subcommand === 'delete') {
4667
+ const id = args[0] ?? options.id ?? null;
4668
+ if (!id) teamDbFail('E_USAGE', 'projects delete needs a project id', 3);
4669
+ return withProjectsLock(teamRoot, () => {
4670
+ const file = readProjectsFile(teamRoot);
4671
+ const record = file.projects.find((entry) => entry.id === id);
4672
+ if (!record) teamDbFail('E_NOT_FOUND', `no project "${id}"`, 1);
4673
+ if (options.revision !== undefined && options.revision !== record.revision) {
4674
+ teamDbFail(
4675
+ 'E_CONFLICT',
4676
+ `project "${id}" is at revision ${record.revision}, the request sent ${options.revision}`,
4677
+ 1,
4678
+ );
4679
+ }
4680
+ const membersRemoved = file.links.filter((link) => link.projectId === id).length;
4681
+ if (membersRemoved > 0 && !options.force) {
4682
+ const error = new TeamDbError(
4683
+ 'E_PROJECT_IN_USE',
4684
+ `this project has ${membersRemoved} member repositor${membersRemoved === 1 ? 'y' : 'ies'}; delete it anyway?`,
4685
+ 1,
4686
+ );
4687
+ error.memberRepositories = membersRemoved;
4688
+ throw error;
4689
+ }
4690
+ if (options.dryRun) {
4691
+ if (json) return { exitCode: 0, output: renderJson({ ok: true, dryRun: true, id, membersRemoved }) };
4692
+ return { exitCode: 0, output: `delete (dry run): ${id} membersRemoved=${membersRemoved}\n` };
4693
+ }
4694
+ writeProjectsFile(teamRoot, {
4695
+ ...file,
4696
+ projects: file.projects.filter((entry) => entry.id !== id),
4697
+ links: file.links.filter((link) => link.projectId !== id),
4698
+ });
4699
+ const projection = containProjectsProjection(() =>
4700
+ projectProjectsInChild(teamRoot, { projectIds: [id], repositoryIds: [] }),
4701
+ );
4702
+ if (json) return { exitCode: 0, output: renderJson({ ok: true, id, membersRemoved, projection }) };
4703
+ return { exitCode: 0, output: `delete: ${id} membersRemoved=${membersRemoved}\n` };
4704
+ });
4705
+ }
4706
+
4707
+ if (subcommand === 'link' || subcommand === 'unlink') {
4708
+ const projectId = args[0] ?? null;
4709
+ const repositoryId = args[1] ?? null;
4710
+ if (!projectId || !repositoryId) {
4711
+ teamDbFail('E_USAGE', `projects ${subcommand} needs <projectId> <repositoryId>`, 3);
4712
+ }
4713
+ return withProjectsLock(teamRoot, () => {
4714
+ const file = readProjectsFile(teamRoot);
4715
+ if (!file.projects.some((record) => record.id === projectId)) {
4716
+ teamDbFail('E_NOT_FOUND', `no project "${projectId}"`, 1);
4717
+ }
4718
+ const repositories = readRepositoriesFile(teamRoot);
4719
+ if (!repositories.repositories.some((record) => record.id === repositoryId)) {
4720
+ teamDbFail('E_VALIDATION', `parameter "repositoryId": names the unknown repository "${repositoryId}"`, 3);
4721
+ }
4722
+ const existing = file.links.find(
4723
+ (link) => link.projectId === projectId && link.repositoryId === repositoryId,
4724
+ );
4725
+ if (subcommand === 'link') {
4726
+ // Idempotent: a second write of the same pair keeps `addedAt` and the
4727
+ // document unchanged, so no file write and no projection happen.
4728
+ if (existing) {
4729
+ const summary = readProjectedProjectSummary(teamRoot, projectId);
4730
+ if (json) return { exitCode: 0, output: renderJson({ ok: true, project: summary, projection: { skipped: true, failed: 0 } }) };
4731
+ return { exitCode: 0, output: `link: ${repositoryId} -> ${projectId} (already a member)\n` };
4732
+ }
4733
+ writeProjectsFile(teamRoot, {
4734
+ ...file,
4735
+ links: [...file.links, { projectId, repositoryId, addedAt: now }],
4736
+ });
4737
+ } else {
4738
+ if (!existing) teamDbFail('E_NOT_FOUND', `"${repositoryId}" is not a member of "${projectId}"`, 1);
4739
+ writeProjectsFile(teamRoot, {
4740
+ ...file,
4741
+ links: file.links.filter(
4742
+ (link) => !(link.projectId === projectId && link.repositoryId === repositoryId),
4743
+ ),
4744
+ });
4745
+ }
4746
+ const projection = containProjectsProjection(() =>
4747
+ projectProjectsInChild(teamRoot, { projectIds: [projectId], repositoryIds: [] }),
4748
+ );
4749
+ const project = readProjectedProjectSummary(teamRoot, projectId);
4750
+ if (json) return { exitCode: 0, output: renderJson({ ok: true, project, projection }) };
4751
+ return { exitCode: 0, output: `${subcommand}: ${repositoryId} ${subcommand === 'link' ? '->' : 'x'} ${projectId}\n` };
4752
+ });
4753
+ }
4754
+
4755
+ teamDbFail('E_USAGE', `unknown projects subcommand "${subcommand}"`, 3);
4756
+ return null;
4757
+ }
4758
+
4045
4759
  /**
4046
4760
  * Project a tree (or one slug) into the database.
4047
4761
  *
@@ -4194,6 +4908,17 @@ export function syncProjection(options = {}) {
4194
4908
  result.errors.push({ path: REPOSITORIES_FILE, reason: error.message });
4195
4909
  }
4196
4910
  }
4911
+ if (!slug) {
4912
+ try {
4913
+ const projectProjection = projectProjects(db, { teamRoot: handle.teamRoot });
4914
+ result.failed += projectProjection.failed;
4915
+ for (const error of projectProjection.errors) result.errors.push(error);
4916
+ } catch (error) {
4917
+ // Same containment as the repository registry above.
4918
+ result.failed += 1;
4919
+ result.errors.push({ path: PROJECTS_FILE, reason: error.message });
4920
+ }
4921
+ }
4197
4922
  if (!slug) {
4198
4923
  const schedulerProjection = projectScheduler(db, { teamRoot: handle.teamRoot });
4199
4924
  result.failed += schedulerProjection.failed;