@bonesofspring/ai-rules 0.2.78 → 0.2.80

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 (340) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/README.md +4 -2
  3. package/bin/lib/engine-scripts.js +6 -0
  4. package/bin/lib/seed-ai-local-team.js +2 -0
  5. package/docs/TEAM-DB.md +118 -15
  6. package/docs/openapi/team-db.v1.json +2879 -1858
  7. package/package.json +5 -1
  8. package/presets/_shared/ai-local/scripts/check-task-repositories.mjs +264 -0
  9. package/presets/_shared/ai-local/scripts/rr-migrate-repositories.mjs +481 -0
  10. package/presets/_shared/ai-local/scripts/team-db-api.mjs +211 -12
  11. package/presets/_shared/ai-local/scripts/team-db-openapi.mjs +289 -3
  12. package/presets/_shared/ai-local/scripts/team-db-project.mjs +857 -1
  13. package/presets/_shared/ai-local/scripts/team-db-schema.mjs +68 -0
  14. package/presets/_shared/ai-local/scripts/team-db-tracker.mjs +29 -10
  15. package/presets/_shared/ai-local/scripts/team-db.mjs +46 -1
  16. package/presets/_shared/hooks/chain-team-phases.sh.tmpl +69 -1
  17. package/presets/claude/android-kotlin/agents/task-router.md +2 -0
  18. package/presets/claude/android-kotlin/commands/README.md +1 -0
  19. package/presets/claude/android-kotlin/commands/rr-migrate-repositories.md +59 -0
  20. package/presets/claude/android-kotlin/commands/task.md +4 -0
  21. package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +69 -1
  22. package/presets/claude/go/agents/task-router.md +2 -0
  23. package/presets/claude/go/commands/README.md +1 -0
  24. package/presets/claude/go/commands/rr-migrate-repositories.md +59 -0
  25. package/presets/claude/go/commands/task.md +4 -0
  26. package/presets/claude/go/hooks/chain-team-phases.sh +69 -1
  27. package/presets/claude/ios-swift/agents/task-router.md +2 -0
  28. package/presets/claude/ios-swift/commands/README.md +1 -0
  29. package/presets/claude/ios-swift/commands/rr-migrate-repositories.md +59 -0
  30. package/presets/claude/ios-swift/commands/task.md +4 -0
  31. package/presets/claude/ios-swift/hooks/chain-team-phases.sh +69 -1
  32. package/presets/claude/java/agents/task-router.md +2 -0
  33. package/presets/claude/java/commands/README.md +1 -0
  34. package/presets/claude/java/commands/rr-migrate-repositories.md +59 -0
  35. package/presets/claude/java/commands/task.md +4 -0
  36. package/presets/claude/java/hooks/chain-team-phases.sh +69 -1
  37. package/presets/claude/mcp-ts/agents/task-router.md +2 -0
  38. package/presets/claude/mcp-ts/commands/README.md +1 -0
  39. package/presets/claude/mcp-ts/commands/rr-migrate-repositories.md +59 -0
  40. package/presets/claude/mcp-ts/commands/task.md +4 -0
  41. package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +69 -1
  42. package/presets/claude/mol/agents/task-router.md +2 -0
  43. package/presets/claude/mol/commands/README.md +1 -0
  44. package/presets/claude/mol/commands/rr-migrate-repositories.md +59 -0
  45. package/presets/claude/mol/commands/task.md +4 -0
  46. package/presets/claude/mol/hooks/chain-team-phases.sh +69 -1
  47. package/presets/claude/next/agents/task-router.md +2 -0
  48. package/presets/claude/next/commands/README.md +1 -0
  49. package/presets/claude/next/commands/rr-migrate-repositories.md +59 -0
  50. package/presets/claude/next/commands/task.md +4 -0
  51. package/presets/claude/next/commands/ui-start.md +12 -4
  52. package/presets/claude/next/commands/ui-stop.md +5 -2
  53. package/presets/claude/next/hooks/chain-team-phases.sh +69 -1
  54. package/presets/claude/nuxt/agents/task-router.md +2 -0
  55. package/presets/claude/nuxt/commands/README.md +1 -0
  56. package/presets/claude/nuxt/commands/rr-migrate-repositories.md +59 -0
  57. package/presets/claude/nuxt/commands/task.md +4 -0
  58. package/presets/claude/nuxt/hooks/chain-team-phases.sh +69 -1
  59. package/presets/claude/php-hexagonal/agents/task-router.md +2 -0
  60. package/presets/claude/php-hexagonal/commands/README.md +1 -0
  61. package/presets/claude/php-hexagonal/commands/rr-migrate-repositories.md +59 -0
  62. package/presets/claude/php-hexagonal/commands/task.md +4 -0
  63. package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +69 -1
  64. package/presets/claude/php-laravel/agents/task-router.md +2 -0
  65. package/presets/claude/php-laravel/commands/README.md +1 -0
  66. package/presets/claude/php-laravel/commands/rr-migrate-repositories.md +59 -0
  67. package/presets/claude/php-laravel/commands/task.md +4 -0
  68. package/presets/claude/php-laravel/hooks/chain-team-phases.sh +69 -1
  69. package/presets/claude/svelte/agents/task-router.md +2 -0
  70. package/presets/claude/svelte/commands/README.md +1 -0
  71. package/presets/claude/svelte/commands/rr-migrate-repositories.md +59 -0
  72. package/presets/claude/svelte/commands/task.md +4 -0
  73. package/presets/claude/svelte/hooks/chain-team-phases.sh +69 -1
  74. package/presets/cursor/android-kotlin/agents/task-router.md +2 -0
  75. package/presets/cursor/android-kotlin/commands/README.md +1 -0
  76. package/presets/cursor/android-kotlin/commands/rr-migrate-repositories.md +59 -0
  77. package/presets/cursor/android-kotlin/commands/task.md +4 -0
  78. package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +69 -1
  79. package/presets/cursor/go/agents/task-router.md +2 -0
  80. package/presets/cursor/go/commands/README.md +1 -0
  81. package/presets/cursor/go/commands/rr-migrate-repositories.md +59 -0
  82. package/presets/cursor/go/commands/task.md +4 -0
  83. package/presets/cursor/go/hooks/chain-team-phases.sh +69 -1
  84. package/presets/cursor/ios-swift/agents/task-router.md +2 -0
  85. package/presets/cursor/ios-swift/commands/README.md +1 -0
  86. package/presets/cursor/ios-swift/commands/rr-migrate-repositories.md +59 -0
  87. package/presets/cursor/ios-swift/commands/task.md +4 -0
  88. package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +69 -1
  89. package/presets/cursor/java/agents/task-router.md +2 -0
  90. package/presets/cursor/java/commands/README.md +1 -0
  91. package/presets/cursor/java/commands/rr-migrate-repositories.md +59 -0
  92. package/presets/cursor/java/commands/task.md +4 -0
  93. package/presets/cursor/java/hooks/chain-team-phases.sh +69 -1
  94. package/presets/cursor/mcp-ts/agents/task-router.md +2 -0
  95. package/presets/cursor/mcp-ts/commands/README.md +1 -0
  96. package/presets/cursor/mcp-ts/commands/rr-migrate-repositories.md +59 -0
  97. package/presets/cursor/mcp-ts/commands/task.md +4 -0
  98. package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +69 -1
  99. package/presets/cursor/mol/agents/task-router.md +2 -0
  100. package/presets/cursor/mol/commands/README.md +1 -0
  101. package/presets/cursor/mol/commands/rr-migrate-repositories.md +59 -0
  102. package/presets/cursor/mol/commands/task.md +4 -0
  103. package/presets/cursor/mol/hooks/chain-team-phases.sh +69 -1
  104. package/presets/cursor/next/agents/task-router.md +2 -0
  105. package/presets/cursor/next/commands/README.md +1 -0
  106. package/presets/cursor/next/commands/rr-migrate-repositories.md +59 -0
  107. package/presets/cursor/next/commands/task.md +4 -0
  108. package/presets/cursor/next/commands/ui-start.md +12 -4
  109. package/presets/cursor/next/commands/ui-stop.md +5 -2
  110. package/presets/cursor/next/hooks/chain-team-phases.sh +69 -1
  111. package/presets/cursor/nuxt/agents/task-router.md +2 -0
  112. package/presets/cursor/nuxt/commands/README.md +1 -0
  113. package/presets/cursor/nuxt/commands/rr-migrate-repositories.md +59 -0
  114. package/presets/cursor/nuxt/commands/task.md +4 -0
  115. package/presets/cursor/nuxt/hooks/chain-team-phases.sh +69 -1
  116. package/presets/cursor/php-hexagonal/agents/task-router.md +2 -0
  117. package/presets/cursor/php-hexagonal/commands/README.md +1 -0
  118. package/presets/cursor/php-hexagonal/commands/rr-migrate-repositories.md +59 -0
  119. package/presets/cursor/php-hexagonal/commands/task.md +4 -0
  120. package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +69 -1
  121. package/presets/cursor/php-laravel/agents/task-router.md +2 -0
  122. package/presets/cursor/php-laravel/commands/README.md +1 -0
  123. package/presets/cursor/php-laravel/commands/rr-migrate-repositories.md +59 -0
  124. package/presets/cursor/php-laravel/commands/task.md +4 -0
  125. package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +69 -1
  126. package/presets/cursor/svelte/agents/task-router.md +2 -0
  127. package/presets/cursor/svelte/commands/README.md +1 -0
  128. package/presets/cursor/svelte/commands/rr-migrate-repositories.md +59 -0
  129. package/presets/cursor/svelte/commands/task.md +4 -0
  130. package/presets/cursor/svelte/hooks/chain-team-phases.sh +69 -1
  131. package/presets/mavis/android-kotlin/adapter-map.json +9 -1
  132. package/presets/mavis/android-kotlin/agents/task-router.md +2 -0
  133. package/presets/mavis/android-kotlin/commands/README.md +1 -0
  134. package/presets/mavis/android-kotlin/commands/rr-migrate-repositories.md +54 -0
  135. package/presets/mavis/android-kotlin/commands/task.md +4 -0
  136. package/presets/mavis/android-kotlin/hooks/chain-team-phases.sh +69 -1
  137. package/presets/mavis/go/adapter-map.json +9 -1
  138. package/presets/mavis/go/agents/task-router.md +2 -0
  139. package/presets/mavis/go/commands/README.md +1 -0
  140. package/presets/mavis/go/commands/rr-migrate-repositories.md +54 -0
  141. package/presets/mavis/go/commands/task.md +4 -0
  142. package/presets/mavis/go/hooks/chain-team-phases.sh +69 -1
  143. package/presets/mavis/ios-swift/adapter-map.json +9 -1
  144. package/presets/mavis/ios-swift/agents/task-router.md +2 -0
  145. package/presets/mavis/ios-swift/commands/README.md +1 -0
  146. package/presets/mavis/ios-swift/commands/rr-migrate-repositories.md +54 -0
  147. package/presets/mavis/ios-swift/commands/task.md +4 -0
  148. package/presets/mavis/ios-swift/hooks/chain-team-phases.sh +69 -1
  149. package/presets/mavis/java/adapter-map.json +9 -1
  150. package/presets/mavis/java/agents/task-router.md +2 -0
  151. package/presets/mavis/java/commands/README.md +1 -0
  152. package/presets/mavis/java/commands/rr-migrate-repositories.md +54 -0
  153. package/presets/mavis/java/commands/task.md +4 -0
  154. package/presets/mavis/java/hooks/chain-team-phases.sh +69 -1
  155. package/presets/mavis/mcp-ts/adapter-map.json +9 -1
  156. package/presets/mavis/mcp-ts/agents/task-router.md +2 -0
  157. package/presets/mavis/mcp-ts/commands/README.md +1 -0
  158. package/presets/mavis/mcp-ts/commands/rr-migrate-repositories.md +54 -0
  159. package/presets/mavis/mcp-ts/commands/task.md +4 -0
  160. package/presets/mavis/mcp-ts/hooks/chain-team-phases.sh +69 -1
  161. package/presets/mavis/mol/adapter-map.json +9 -1
  162. package/presets/mavis/mol/agents/task-router.md +2 -0
  163. package/presets/mavis/mol/commands/README.md +1 -0
  164. package/presets/mavis/mol/commands/rr-migrate-repositories.md +54 -0
  165. package/presets/mavis/mol/commands/task.md +4 -0
  166. package/presets/mavis/mol/hooks/chain-team-phases.sh +69 -1
  167. package/presets/mavis/next/adapter-map.json +9 -1
  168. package/presets/mavis/next/agents/task-router.md +2 -0
  169. package/presets/mavis/next/commands/README.md +1 -0
  170. package/presets/mavis/next/commands/rr-migrate-repositories.md +54 -0
  171. package/presets/mavis/next/commands/task.md +4 -0
  172. package/presets/mavis/next/commands/ui-start.md +12 -4
  173. package/presets/mavis/next/commands/ui-stop.md +5 -2
  174. package/presets/mavis/next/hooks/chain-team-phases.sh +69 -1
  175. package/presets/mavis/nuxt/adapter-map.json +9 -1
  176. package/presets/mavis/nuxt/agents/task-router.md +2 -0
  177. package/presets/mavis/nuxt/commands/README.md +1 -0
  178. package/presets/mavis/nuxt/commands/rr-migrate-repositories.md +54 -0
  179. package/presets/mavis/nuxt/commands/task.md +4 -0
  180. package/presets/mavis/nuxt/hooks/chain-team-phases.sh +69 -1
  181. package/presets/mavis/php-hexagonal/adapter-map.json +9 -1
  182. package/presets/mavis/php-hexagonal/agents/task-router.md +2 -0
  183. package/presets/mavis/php-hexagonal/commands/README.md +1 -0
  184. package/presets/mavis/php-hexagonal/commands/rr-migrate-repositories.md +54 -0
  185. package/presets/mavis/php-hexagonal/commands/task.md +4 -0
  186. package/presets/mavis/php-hexagonal/hooks/chain-team-phases.sh +69 -1
  187. package/presets/mavis/php-laravel/adapter-map.json +9 -1
  188. package/presets/mavis/php-laravel/agents/task-router.md +2 -0
  189. package/presets/mavis/php-laravel/commands/README.md +1 -0
  190. package/presets/mavis/php-laravel/commands/rr-migrate-repositories.md +54 -0
  191. package/presets/mavis/php-laravel/commands/task.md +4 -0
  192. package/presets/mavis/php-laravel/hooks/chain-team-phases.sh +69 -1
  193. package/presets/mavis/svelte/adapter-map.json +9 -1
  194. package/presets/mavis/svelte/agents/task-router.md +2 -0
  195. package/presets/mavis/svelte/commands/README.md +1 -0
  196. package/presets/mavis/svelte/commands/rr-migrate-repositories.md +54 -0
  197. package/presets/mavis/svelte/commands/task.md +4 -0
  198. package/presets/mavis/svelte/hooks/chain-team-phases.sh +69 -1
  199. package/presets/opencode/android-kotlin/adapter-map.json +9 -1
  200. package/presets/opencode/android-kotlin/agents/task-router.md +2 -0
  201. package/presets/opencode/android-kotlin/commands/README.md +1 -0
  202. package/presets/opencode/android-kotlin/commands/rr-migrate-repositories.md +62 -0
  203. package/presets/opencode/android-kotlin/commands/task.md +4 -0
  204. package/presets/opencode/android-kotlin/hooks/chain-team-phases.sh +69 -1
  205. package/presets/opencode/go/adapter-map.json +9 -1
  206. package/presets/opencode/go/agents/task-router.md +2 -0
  207. package/presets/opencode/go/commands/README.md +1 -0
  208. package/presets/opencode/go/commands/rr-migrate-repositories.md +62 -0
  209. package/presets/opencode/go/commands/task.md +4 -0
  210. package/presets/opencode/go/hooks/chain-team-phases.sh +69 -1
  211. package/presets/opencode/ios-swift/adapter-map.json +9 -1
  212. package/presets/opencode/ios-swift/agents/task-router.md +2 -0
  213. package/presets/opencode/ios-swift/commands/README.md +1 -0
  214. package/presets/opencode/ios-swift/commands/rr-migrate-repositories.md +62 -0
  215. package/presets/opencode/ios-swift/commands/task.md +4 -0
  216. package/presets/opencode/ios-swift/hooks/chain-team-phases.sh +69 -1
  217. package/presets/opencode/java/adapter-map.json +9 -1
  218. package/presets/opencode/java/agents/task-router.md +2 -0
  219. package/presets/opencode/java/commands/README.md +1 -0
  220. package/presets/opencode/java/commands/rr-migrate-repositories.md +62 -0
  221. package/presets/opencode/java/commands/task.md +4 -0
  222. package/presets/opencode/java/hooks/chain-team-phases.sh +69 -1
  223. package/presets/opencode/mcp-ts/adapter-map.json +9 -1
  224. package/presets/opencode/mcp-ts/agents/task-router.md +2 -0
  225. package/presets/opencode/mcp-ts/commands/README.md +1 -0
  226. package/presets/opencode/mcp-ts/commands/rr-migrate-repositories.md +62 -0
  227. package/presets/opencode/mcp-ts/commands/task.md +4 -0
  228. package/presets/opencode/mcp-ts/hooks/chain-team-phases.sh +69 -1
  229. package/presets/opencode/mol/adapter-map.json +9 -1
  230. package/presets/opencode/mol/agents/task-router.md +2 -0
  231. package/presets/opencode/mol/commands/README.md +1 -0
  232. package/presets/opencode/mol/commands/rr-migrate-repositories.md +62 -0
  233. package/presets/opencode/mol/commands/task.md +4 -0
  234. package/presets/opencode/mol/hooks/chain-team-phases.sh +69 -1
  235. package/presets/opencode/next/adapter-map.json +9 -1
  236. package/presets/opencode/next/agents/task-router.md +2 -0
  237. package/presets/opencode/next/commands/README.md +1 -0
  238. package/presets/opencode/next/commands/rr-migrate-repositories.md +62 -0
  239. package/presets/opencode/next/commands/task.md +4 -0
  240. package/presets/opencode/next/commands/ui-start.md +12 -4
  241. package/presets/opencode/next/commands/ui-stop.md +5 -2
  242. package/presets/opencode/next/hooks/chain-team-phases.sh +69 -1
  243. package/presets/opencode/nuxt/adapter-map.json +9 -1
  244. package/presets/opencode/nuxt/agents/task-router.md +2 -0
  245. package/presets/opencode/nuxt/commands/README.md +1 -0
  246. package/presets/opencode/nuxt/commands/rr-migrate-repositories.md +62 -0
  247. package/presets/opencode/nuxt/commands/task.md +4 -0
  248. package/presets/opencode/nuxt/hooks/chain-team-phases.sh +69 -1
  249. package/presets/opencode/php-hexagonal/adapter-map.json +9 -1
  250. package/presets/opencode/php-hexagonal/agents/task-router.md +2 -0
  251. package/presets/opencode/php-hexagonal/commands/README.md +1 -0
  252. package/presets/opencode/php-hexagonal/commands/rr-migrate-repositories.md +62 -0
  253. package/presets/opencode/php-hexagonal/commands/task.md +4 -0
  254. package/presets/opencode/php-hexagonal/hooks/chain-team-phases.sh +69 -1
  255. package/presets/opencode/php-laravel/adapter-map.json +9 -1
  256. package/presets/opencode/php-laravel/agents/task-router.md +2 -0
  257. package/presets/opencode/php-laravel/commands/README.md +1 -0
  258. package/presets/opencode/php-laravel/commands/rr-migrate-repositories.md +62 -0
  259. package/presets/opencode/php-laravel/commands/task.md +4 -0
  260. package/presets/opencode/php-laravel/hooks/chain-team-phases.sh +69 -1
  261. package/presets/opencode/plugins/task-status/README.md +15 -7
  262. package/presets/opencode/plugins/task-status/deepseek.ts +193 -0
  263. package/presets/opencode/plugins/task-status/details-data.ts +39 -2
  264. package/presets/opencode/plugins/task-status/prompt-text.ts +18 -8
  265. package/presets/opencode/plugins/task-status/task-view.ts +253 -63
  266. package/presets/opencode/plugins/task-status/tui.tsx +48 -11
  267. package/presets/opencode/svelte/adapter-map.json +9 -1
  268. package/presets/opencode/svelte/agents/task-router.md +2 -0
  269. package/presets/opencode/svelte/commands/README.md +1 -0
  270. package/presets/opencode/svelte/commands/rr-migrate-repositories.md +62 -0
  271. package/presets/opencode/svelte/commands/task.md +4 -0
  272. package/presets/opencode/svelte/hooks/chain-team-phases.sh +69 -1
  273. package/presets/zcode/android-kotlin/adapter-map.json +9 -1
  274. package/presets/zcode/android-kotlin/agents/task-router.md +2 -0
  275. package/presets/zcode/android-kotlin/commands/README.md +1 -0
  276. package/presets/zcode/android-kotlin/commands/rr-migrate-repositories.md +62 -0
  277. package/presets/zcode/android-kotlin/commands/task.md +4 -0
  278. package/presets/zcode/android-kotlin/hooks/chain-team-phases.sh +69 -1
  279. package/presets/zcode/go/adapter-map.json +9 -1
  280. package/presets/zcode/go/agents/task-router.md +2 -0
  281. package/presets/zcode/go/commands/README.md +1 -0
  282. package/presets/zcode/go/commands/rr-migrate-repositories.md +62 -0
  283. package/presets/zcode/go/commands/task.md +4 -0
  284. package/presets/zcode/go/hooks/chain-team-phases.sh +69 -1
  285. package/presets/zcode/ios-swift/adapter-map.json +9 -1
  286. package/presets/zcode/ios-swift/agents/task-router.md +2 -0
  287. package/presets/zcode/ios-swift/commands/README.md +1 -0
  288. package/presets/zcode/ios-swift/commands/rr-migrate-repositories.md +62 -0
  289. package/presets/zcode/ios-swift/commands/task.md +4 -0
  290. package/presets/zcode/ios-swift/hooks/chain-team-phases.sh +69 -1
  291. package/presets/zcode/java/adapter-map.json +9 -1
  292. package/presets/zcode/java/agents/task-router.md +2 -0
  293. package/presets/zcode/java/commands/README.md +1 -0
  294. package/presets/zcode/java/commands/rr-migrate-repositories.md +62 -0
  295. package/presets/zcode/java/commands/task.md +4 -0
  296. package/presets/zcode/java/hooks/chain-team-phases.sh +69 -1
  297. package/presets/zcode/mcp-ts/adapter-map.json +9 -1
  298. package/presets/zcode/mcp-ts/agents/task-router.md +2 -0
  299. package/presets/zcode/mcp-ts/commands/README.md +1 -0
  300. package/presets/zcode/mcp-ts/commands/rr-migrate-repositories.md +62 -0
  301. package/presets/zcode/mcp-ts/commands/task.md +4 -0
  302. package/presets/zcode/mcp-ts/hooks/chain-team-phases.sh +69 -1
  303. package/presets/zcode/mol/adapter-map.json +9 -1
  304. package/presets/zcode/mol/agents/task-router.md +2 -0
  305. package/presets/zcode/mol/commands/README.md +1 -0
  306. package/presets/zcode/mol/commands/rr-migrate-repositories.md +62 -0
  307. package/presets/zcode/mol/commands/task.md +4 -0
  308. package/presets/zcode/mol/hooks/chain-team-phases.sh +69 -1
  309. package/presets/zcode/next/adapter-map.json +9 -1
  310. package/presets/zcode/next/agents/task-router.md +2 -0
  311. package/presets/zcode/next/commands/README.md +1 -0
  312. package/presets/zcode/next/commands/rr-migrate-repositories.md +62 -0
  313. package/presets/zcode/next/commands/task.md +4 -0
  314. package/presets/zcode/next/commands/ui-start.md +12 -4
  315. package/presets/zcode/next/commands/ui-stop.md +5 -2
  316. package/presets/zcode/next/hooks/chain-team-phases.sh +69 -1
  317. package/presets/zcode/nuxt/adapter-map.json +9 -1
  318. package/presets/zcode/nuxt/agents/task-router.md +2 -0
  319. package/presets/zcode/nuxt/commands/README.md +1 -0
  320. package/presets/zcode/nuxt/commands/rr-migrate-repositories.md +62 -0
  321. package/presets/zcode/nuxt/commands/task.md +4 -0
  322. package/presets/zcode/nuxt/hooks/chain-team-phases.sh +69 -1
  323. package/presets/zcode/php-hexagonal/adapter-map.json +9 -1
  324. package/presets/zcode/php-hexagonal/agents/task-router.md +2 -0
  325. package/presets/zcode/php-hexagonal/commands/README.md +1 -0
  326. package/presets/zcode/php-hexagonal/commands/rr-migrate-repositories.md +62 -0
  327. package/presets/zcode/php-hexagonal/commands/task.md +4 -0
  328. package/presets/zcode/php-hexagonal/hooks/chain-team-phases.sh +69 -1
  329. package/presets/zcode/php-laravel/adapter-map.json +9 -1
  330. package/presets/zcode/php-laravel/agents/task-router.md +2 -0
  331. package/presets/zcode/php-laravel/commands/README.md +1 -0
  332. package/presets/zcode/php-laravel/commands/rr-migrate-repositories.md +62 -0
  333. package/presets/zcode/php-laravel/commands/task.md +4 -0
  334. package/presets/zcode/php-laravel/hooks/chain-team-phases.sh +69 -1
  335. package/presets/zcode/svelte/adapter-map.json +9 -1
  336. package/presets/zcode/svelte/agents/task-router.md +2 -0
  337. package/presets/zcode/svelte/commands/README.md +1 -0
  338. package/presets/zcode/svelte/commands/rr-migrate-repositories.md +62 -0
  339. package/presets/zcode/svelte/commands/task.md +4 -0
  340. package/presets/zcode/svelte/hooks/chain-team-phases.sh +69 -1
@@ -0,0 +1,481 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * `/rr-migrate-repositories`: turn the repositories already on disk into
4
+ * registry records, then project the file into the team database.
5
+ *
6
+ * The registry file stays local-only and is never committed. This script does
7
+ * not write it directly: it sends one `repositories apply` envelope for the
8
+ * missing records, one `repositories put` per changed record, and finishes with
9
+ * `repositories project`, so the lock-guarded verb remains the only writer
10
+ * (ADR 0006 / ADR 0007).
11
+ *
12
+ * Scan rules:
13
+ * - a directory with `.git` is a repository; the walk does not descend into it;
14
+ * - a `.git` file that points at `.git/modules/**` or `.git/worktrees/**` is a
15
+ * submodule or a linked worktree, not a repository of its own, and is skipped;
16
+ * - hidden directories, `node_modules`, and symlinked directories are skipped;
17
+ * - repositories with one remote are collapsed to the shallowest clone.
18
+ *
19
+ * Records are never deleted: a repository absent from the current scan may have
20
+ * been moved, or the scan may cover only part of the disk.
21
+ *
22
+ * Usage:
23
+ * node .ai.local/scripts/rr-migrate-repositories.mjs [options]
24
+ *
25
+ * Options:
26
+ * --scan <dir> directory to scan; repeatable (default: the parent of the repo root, or the repo root when that parent is $HOME)
27
+ * --depth <n> directory levels below a scan root (default 4)
28
+ * --team-root <dir> team store root (default: <repo-root>/.ai.local/team)
29
+ * --repo-root <dir> repository whose parent is scanned by default (default: git toplevel, else cwd)
30
+ * --dry-run print the plan and write nothing
31
+ * --no-update create missing records only; never update an existing one
32
+ * --json machine-readable summary
33
+ * --help
34
+ *
35
+ * Exit codes: 0 ok (including the kill-switch and no-sqlite fallbacks), 1 a
36
+ * child verb failed, 2 usage.
37
+ */
38
+ import { spawnSync } from 'node:child_process';
39
+ import fs from 'node:fs';
40
+ import os from 'node:os';
41
+ import path from 'node:path';
42
+ import { fileURLToPath } from 'node:url';
43
+
44
+ const SCRIPT_DIR = path.dirname(fileURLToPath(import.meta.url));
45
+ const TEAM_DB = path.join(SCRIPT_DIR, 'team-db.mjs');
46
+ const MAX_ID_LENGTH = 48;
47
+ const MAX_NAME_LENGTH = 120;
48
+ const DEFAULT_DEPTH = 4;
49
+ const SKIP_DIRS = new Set(['node_modules', 'Library', 'Applications']);
50
+ const DISABLED_LINE = 'disabled by AI_RULES_TEAM_DB_DISABLE';
51
+
52
+ export const USAGE = `Usage: node .ai.local/scripts/rr-migrate-repositories.mjs [options]
53
+
54
+ --scan <dir> directory to scan; repeatable (default: the parent of the repo root, or the repo root when that parent is $HOME)
55
+ --depth <n> directory levels below a scan root (default ${DEFAULT_DEPTH})
56
+ --team-root <dir> team store root (default: <repo-root>/.ai.local/team)
57
+ --repo-root <dir> repository whose parent is scanned by default
58
+ --dry-run print the plan and write nothing
59
+ --no-update create missing records only; never update an existing one
60
+ --json machine-readable summary
61
+ --help this text`;
62
+
63
+ const usageError = (message) => {
64
+ console.error(`rr-migrate-repositories: ${message}\n\n${USAGE}`);
65
+ process.exit(2);
66
+ };
67
+
68
+ const isRemoteLocator = (value) => /^(git\+|git@|ssh:\/\/|https?:\/\/)/.test(value);
69
+
70
+ /** Case-, protocol-, and `.git`-insensitive remote identity. */
71
+ export const normaliseLocator = (locator) =>
72
+ String(locator)
73
+ .trim()
74
+ .toLowerCase()
75
+ .replace(/^git\+/, '')
76
+ .replace(/^ssh:\/\/git@/, '')
77
+ .replace(/^git@([^:]+):/, '$1/')
78
+ .replace(/^(?:https?|ssh|git):\/\//, '')
79
+ .replace(/\.git\/?$/, '')
80
+ .replace(/\/+$/, '');
81
+
82
+ /** A stable registry key for a remote URL or an absolute path. */
83
+ export const locatorKey = (locator) => {
84
+ const value = String(locator).trim();
85
+ return isRemoteLocator(value) ? `remote:${normaliseLocator(value)}` : `local:${path.resolve(value)}`;
86
+ };
87
+
88
+ export const slugify = (value) => {
89
+ const slug = String(value)
90
+ .toLowerCase()
91
+ .replace(/[^a-z0-9]+/g, '-')
92
+ .replace(/^-+|-+$/g, '');
93
+ return slug.slice(0, MAX_ID_LENGTH).replace(/-+$/, '') || 'repository';
94
+ };
95
+
96
+ const depthOf = (value) => value.split(/[\\/]/).filter(Boolean).length;
97
+
98
+ const repoMarker = (directory) => {
99
+ const marker = path.join(directory, '.git');
100
+ let stat;
101
+ try {
102
+ stat = fs.lstatSync(marker);
103
+ } catch {
104
+ return null;
105
+ }
106
+ if (stat.isDirectory()) return { kind: 'directory' };
107
+ if (!stat.isFile()) return null;
108
+ const firstLine = fs.readFileSync(marker, 'utf8').split('\n')[0] ?? '';
109
+ const target = firstLine.replace(/^gitdir:\s*/, '').replace(/\\/g, '/');
110
+ return /\/(?:modules|worktrees)\//.test(target) ? { kind: 'linked' } : { kind: 'file' };
111
+ };
112
+
113
+ const gitValue = (directory, args) => {
114
+ const result = spawnSync('git', ['-C', directory, ...args], { encoding: 'utf8' });
115
+ return result.status === 0 ? result.stdout.trim() : '';
116
+ };
117
+
118
+ /** `isTruthy` in team-db-schema.mjs: only these spellings disable writes. */
119
+ const isDisabled = (value) => {
120
+ if (typeof value !== 'string') return false;
121
+ return ['1', 'true', 'yes'].includes(value.trim().toLowerCase());
122
+ };
123
+
124
+ /** Walk one scan root. A repository is reported and never descended into. */
125
+ export const collectFromRoot = (root, depth) => {
126
+ const found = [];
127
+ const skipped = [];
128
+
129
+ const visit = (directory, remaining) => {
130
+ let real;
131
+ try {
132
+ real = fs.realpathSync(directory);
133
+ } catch {
134
+ skipped.push({ path: directory, reason: 'unreadable' });
135
+ return;
136
+ }
137
+ const marker = repoMarker(directory);
138
+ if (marker !== null) {
139
+ if (marker.kind === 'linked') {
140
+ skipped.push({ path: directory, reason: 'submodule-or-worktree' });
141
+ return;
142
+ }
143
+ const remote = gitValue(directory, ['config', '--get', 'remote.origin.url']);
144
+ found.push({
145
+ path: directory,
146
+ real,
147
+ name: path.basename(directory),
148
+ remote,
149
+ locator: remote || real,
150
+ });
151
+ return;
152
+ }
153
+ if (remaining <= 0) return;
154
+ let entries;
155
+ try {
156
+ entries = fs.readdirSync(directory, { withFileTypes: true });
157
+ } catch {
158
+ skipped.push({ path: directory, reason: 'unreadable' });
159
+ return;
160
+ }
161
+ for (const entry of entries.sort((left, right) => left.name.localeCompare(right.name))) {
162
+ if (!entry.isDirectory()) continue;
163
+ if (entry.name.startsWith('.')) continue;
164
+ if (SKIP_DIRS.has(entry.name)) continue;
165
+ visit(path.join(directory, entry.name), remaining - 1);
166
+ }
167
+ };
168
+
169
+ visit(root, depth);
170
+ return { found, skipped };
171
+ };
172
+
173
+ /** Collapse clones of one remote (or one local path); keep the shallowest path. */
174
+ export const dedupeRepositories = (found) => {
175
+ const groups = new Map();
176
+ for (const entry of found) {
177
+ const key = locatorKey(entry.locator);
178
+ if (!groups.has(key)) groups.set(key, []);
179
+ groups.get(key).push(entry);
180
+ }
181
+ const repositories = [];
182
+ const duplicates = [];
183
+ for (const group of groups.values()) {
184
+ group.sort((left, right) => depthOf(left.path) - depthOf(right.path) || left.path.localeCompare(right.path));
185
+ const [representative, ...rest] = group;
186
+ repositories.push(representative);
187
+ for (const entry of rest) duplicates.push({ path: entry.path, duplicateOf: representative.path });
188
+ }
189
+ repositories.sort((left, right) => left.path.localeCompare(right.path));
190
+ return { repositories, duplicates };
191
+ };
192
+
193
+ /**
194
+ * Assign an id to every scanned repository. A record whose locator already
195
+ * exists keeps its id, so a re-run never renames or duplicates a record.
196
+ */
197
+ export const assignIds = (repositories, existingRecords) => {
198
+ const existingByKey = new Map();
199
+ const existingById = new Map();
200
+ for (const record of existingRecords) {
201
+ existingByKey.set(locatorKey(record.locator), record);
202
+ existingById.set(record.id, record);
203
+ }
204
+ const matched = new Set();
205
+ for (const entry of repositories) {
206
+ const known = existingByKey.get(locatorKey(entry.locator));
207
+ if (known !== undefined) matched.add(known.id);
208
+ }
209
+ const used = new Set(existingRecords.map((record) => record.id));
210
+ const reused = new Set();
211
+ const planned = [];
212
+
213
+ for (const entry of repositories) {
214
+ const key = locatorKey(entry.locator);
215
+ const known = existingByKey.get(key);
216
+ let id = known ? known.id : slugify(entry.name);
217
+ if (!known) {
218
+ // A record whose locator is gone keeps its id when this clone carries the
219
+ // same directory name, so a renamed remote updates instead of forking.
220
+ const orphan = existingById.get(id);
221
+ const canReuseOrphan = orphan !== undefined && !matched.has(id) && !reused.has(id);
222
+ if (canReuseOrphan) {
223
+ reused.add(id);
224
+ } else if (used.has(id)) {
225
+ const parent = slugify(path.basename(path.dirname(entry.path)));
226
+ let candidate = `${parent}-${id}`.slice(0, MAX_ID_LENGTH).replace(/-+$/, '');
227
+ if (used.has(candidate)) {
228
+ let counter = 2;
229
+ while (used.has(`${id}-${counter}`)) counter += 1;
230
+ candidate = `${id}-${counter}`.slice(0, MAX_ID_LENGTH).replace(/-+$/, '');
231
+ }
232
+ id = candidate;
233
+ used.add(id);
234
+ }
235
+ }
236
+ used.add(id);
237
+ planned.push({ ...entry, id });
238
+ }
239
+ return planned;
240
+ };
241
+
242
+ const trimName = (value) => {
243
+ const name = String(value).trim();
244
+ return (name.length > MAX_NAME_LENGTH ? name.slice(0, MAX_NAME_LENGTH) : name) || 'repository';
245
+ };
246
+
247
+ /** Split the planned scan into create / update / unchanged against the file. */
248
+ export const derivePlan = (planned, existingRecords, { update = true } = {}) => {
249
+ const existingById = new Map(existingRecords.map((record) => [record.id, record]));
250
+ const create = [];
251
+ const updateRows = [];
252
+ const unchanged = [];
253
+
254
+ for (const entry of planned) {
255
+ const name = trimName(entry.name);
256
+ const prior = existingById.get(entry.id) ?? null;
257
+ if (prior === null) {
258
+ create.push({
259
+ id: entry.id,
260
+ name,
261
+ locator: entry.locator,
262
+ description: null,
263
+ labels: null,
264
+ status: 'active',
265
+ });
266
+ continue;
267
+ }
268
+ const same =
269
+ prior.name === name && locatorKey(prior.locator) === locatorKey(entry.locator) && prior.status === 'active';
270
+ if (same) {
271
+ unchanged.push(entry.id);
272
+ continue;
273
+ }
274
+ if (!update) {
275
+ unchanged.push(entry.id);
276
+ continue;
277
+ }
278
+ updateRows.push({
279
+ id: entry.id,
280
+ name,
281
+ locator: entry.locator,
282
+ description: prior.description ?? null,
283
+ labels: prior.labels ?? null,
284
+ status: 'active',
285
+ revision: prior.revision,
286
+ });
287
+ }
288
+
289
+ const scannedIds = new Set(planned.map((entry) => entry.id));
290
+ const notOnDisk = existingRecords.filter((record) => !scannedIds.has(record.id)).map((record) => record.id);
291
+ return { create, update: updateRows, unchanged, notOnDisk };
292
+ };
293
+
294
+ const parseArgs = (argv) => {
295
+ const options = {
296
+ scans: [],
297
+ depth: DEFAULT_DEPTH,
298
+ teamRoot: null,
299
+ repoRoot: null,
300
+ dryRun: false,
301
+ update: true,
302
+ json: false,
303
+ };
304
+ const value = (token, index) => {
305
+ const next = argv[index + 1];
306
+ if (next === undefined || next.startsWith('-')) usageError(`${token} needs a value`);
307
+ return next;
308
+ };
309
+ for (let index = 0; index < argv.length; index += 1) {
310
+ const token = argv[index];
311
+ if (token === '--scan') {
312
+ options.scans.push(path.resolve(value(token, index)));
313
+ index += 1;
314
+ } else if (token === '--depth') {
315
+ const raw = value(token, index);
316
+ if (!/^\d+$/.test(raw)) usageError('--depth must be a non-negative integer');
317
+ options.depth = Number(raw);
318
+ index += 1;
319
+ } else if (token === '--team-root') {
320
+ options.teamRoot = path.resolve(value(token, index));
321
+ index += 1;
322
+ } else if (token === '--repo-root') {
323
+ options.repoRoot = path.resolve(value(token, index));
324
+ index += 1;
325
+ } else if (token === '--dry-run') {
326
+ options.dryRun = true;
327
+ } else if (token === '--no-update') {
328
+ options.update = false;
329
+ } else if (token === '--json') {
330
+ options.json = true;
331
+ } else if (token === '--help' || token === '-h') {
332
+ console.log(USAGE);
333
+ process.exit(0);
334
+ } else {
335
+ usageError(`unknown option ${token}`);
336
+ }
337
+ }
338
+ return options;
339
+ };
340
+
341
+ const gitToplevel = (directory) => {
342
+ const top = gitValue(directory, ['rev-parse', '--show-toplevel']);
343
+ return top === '' ? null : path.resolve(top);
344
+ };
345
+
346
+ /** Siblings of the repo; a repo directly in `$HOME` scans itself, not the whole home. */
347
+ const defaultScanRoot = (repoRoot) => {
348
+ const parent = path.dirname(repoRoot);
349
+ return parent === os.homedir() ? repoRoot : parent;
350
+ };
351
+
352
+ const parseJsonOutput = (text) => {
353
+ const lines = String(text)
354
+ .split('\n')
355
+ .map((line) => line.trim())
356
+ .filter(Boolean);
357
+ for (let index = lines.length - 1; index >= 0; index -= 1) {
358
+ if (!lines[index].startsWith('{')) continue;
359
+ try {
360
+ return JSON.parse(lines[index]);
361
+ } catch {
362
+ // keep looking for the machine-readable line
363
+ }
364
+ }
365
+ return null;
366
+ };
367
+
368
+ const runTeamDb = (args, input) => {
369
+ if (!fs.existsSync(TEAM_DB)) {
370
+ console.error(`rr-migrate-repositories: missing ${TEAM_DB}`);
371
+ process.exit(1);
372
+ }
373
+ const result = spawnSync(process.execPath, [TEAM_DB, ...args, '--json'], {
374
+ input,
375
+ encoding: 'utf8',
376
+ maxBuffer: 16 * 1024 * 1024,
377
+ });
378
+ if (result.error) {
379
+ console.error(`rr-migrate-repositories: ${result.error.message}`);
380
+ process.exit(1);
381
+ }
382
+ if (result.status !== 0) {
383
+ const message = (result.stderr || result.stdout || '').trim();
384
+ console.error(`rr-migrate-repositories: repositories ${args[1]} failed (exit ${result.status})`);
385
+ if (message !== '') console.error(message);
386
+ process.exit(1);
387
+ }
388
+ return { summary: parseJsonOutput(result.stdout) };
389
+ };
390
+
391
+ function main() {
392
+ const options = parseArgs(process.argv.slice(2));
393
+ if (!fs.existsSync(TEAM_DB)) {
394
+ console.error(`rr-migrate-repositories: ${TEAM_DB} not found; run this from an installed preset`);
395
+ process.exit(1);
396
+ }
397
+
398
+ const repoRoot = options.repoRoot ?? gitToplevel(process.cwd()) ?? process.cwd();
399
+ const teamRoot =
400
+ options.teamRoot ??
401
+ (process.env.AI_RULES_TEAM_ROOT ? path.resolve(process.env.AI_RULES_TEAM_ROOT) : path.join(repoRoot, '.ai.local', 'team'));
402
+ const roots = options.scans.length > 0 ? options.scans : [defaultScanRoot(repoRoot)];
403
+ for (const root of roots) {
404
+ if (!fs.existsSync(root) || !fs.statSync(root).isDirectory()) usageError(`scan root is not a directory: ${root}`);
405
+ if (path.parse(root).root === root) usageError(`refusing to scan a filesystem root: ${root}`);
406
+ }
407
+
408
+ const collected = [];
409
+ const skipped = [];
410
+ for (const root of roots) {
411
+ const result = collectFromRoot(root, options.depth);
412
+ collected.push(...result.found);
413
+ skipped.push(...result.skipped);
414
+ }
415
+ const { repositories, duplicates } = dedupeRepositories(collected);
416
+
417
+ const listed = runTeamDb(['repositories', 'list', '--root', teamRoot]).summary;
418
+ const existing = Array.isArray(listed?.repositories) ? listed.repositories : [];
419
+ const planned = assignIds(repositories, existing);
420
+ const plan = derivePlan(planned, existing, { update: options.update });
421
+
422
+ const disabled = isDisabled(process.env.AI_RULES_TEAM_DB_DISABLE);
423
+ const summary = {
424
+ ok: true,
425
+ dryRun: options.dryRun || disabled,
426
+ disabled,
427
+ roots,
428
+ teamRoot,
429
+ scanned: collected.length,
430
+ repositories: planned.length,
431
+ duplicates: duplicates.length,
432
+ skipped: skipped.length,
433
+ registry: {
434
+ existing: existing.length,
435
+ create: plan.create.length,
436
+ update: plan.update.length,
437
+ unchanged: plan.unchanged.length,
438
+ notOnDisk: plan.notOnDisk.length,
439
+ },
440
+ applied: { created: 0, updated: 0 },
441
+ projection: null,
442
+ };
443
+
444
+ if (!options.dryRun && !disabled) {
445
+ if (plan.create.length > 0) {
446
+ const applied = runTeamDb(
447
+ ['repositories', 'apply', '--file', '-', '--root', teamRoot],
448
+ JSON.stringify({ repositories: plan.create }),
449
+ );
450
+ summary.applied.created = applied.summary?.repositories ?? plan.create.length;
451
+ }
452
+ for (const record of plan.update) {
453
+ runTeamDb(['repositories', 'put', '--file', '-', '--root', teamRoot], JSON.stringify(record));
454
+ summary.applied.updated += 1;
455
+ }
456
+ const projected = runTeamDb(['repositories', 'project', '--root', teamRoot]);
457
+ summary.projection = projected.summary?.projection ?? null;
458
+ }
459
+
460
+ if (options.json) {
461
+ process.stdout.write(`${JSON.stringify(summary)}\n`);
462
+ } else {
463
+ console.log(`scan: roots=${roots.length} scanned=${summary.scanned} repositories=${summary.repositories} duplicates=${summary.duplicates} skipped=${summary.skipped}`);
464
+ console.log(
465
+ `registry: existing=${summary.registry.existing} create=${summary.registry.create} update=${summary.registry.update} unchanged=${summary.registry.unchanged} not-on-disk=${summary.registry.notOnDisk}`,
466
+ );
467
+ if (summary.dryRun) {
468
+ console.log(disabled ? DISABLED_LINE : 'dry-run: nothing written');
469
+ if (disabled) console.log('run with AI_RULES_TEAM_DB_DISABLE unset to write');
470
+ } else {
471
+ console.log(`apply: created=${summary.applied.created} updated=${summary.applied.updated}`);
472
+ if (summary.projection !== null) {
473
+ console.log(
474
+ `project: repositories=${summary.projection.repositories ?? 0} links=${summary.projection.links ?? 0} attributions=${summary.projection.attributions ?? 0}`,
475
+ );
476
+ }
477
+ }
478
+ }
479
+ }
480
+
481
+ if (process.argv[1] !== undefined && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) main();