@bonesofspring/ai-rules 0.2.60 → 0.2.63

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 (718) hide show
  1. package/CHANGELOG.md +102 -0
  2. package/README.md +62 -29
  3. package/bin/cli.js +368 -59
  4. package/bin/lib/ai-local-drift.js +18 -0
  5. package/bin/lib/engine-scripts.js +22 -5
  6. package/bin/lib/engine-upgrade.js +279 -0
  7. package/bin/lib/mcp/catalog.js +66 -5
  8. package/bin/lib/mcp/clients.js +4 -4
  9. package/bin/lib/mcp/credentials.js +88 -0
  10. package/bin/lib/mcp/doctor.js +100 -8
  11. package/bin/lib/mcp/npx.js +17 -0
  12. package/bin/lib/mcp/registry.js +2 -0
  13. package/bin/lib/merged-config.js +38 -0
  14. package/bin/lib/seed-ai-local-team.js +32 -14
  15. package/bin/mavis-install.js +3 -1
  16. package/bin/opencode-install.js +3 -1
  17. package/bin/zcode-install.js +3 -1
  18. package/docs/MAVIS.md +5 -2
  19. package/docs/MCP-CATALOG.md +30 -2
  20. package/docs/MCP-SETUP.md +30 -6
  21. package/docs/OPENCODE.md +27 -4
  22. package/docs/PLATFORMS.md +38 -0
  23. package/docs/PRESET-CONTRIBUTION.md +27 -14
  24. package/docs/TEAM-DB.md +194 -21
  25. package/docs/openapi/team-db.v1.json +4443 -2083
  26. package/mcp/defectdojo-mcp.mjs +353 -0
  27. package/mcp/gitlab.mjs +5 -1
  28. package/mcp/lib/defectdojo.mjs +249 -0
  29. package/mcp/lib/yandex.mjs +39 -15
  30. package/package.json +11 -5
  31. package/presets/_shared/ai-local/scripts/check-write-scope.mjs +176 -28
  32. package/presets/_shared/ai-local/scripts/lock.mjs +128 -69
  33. package/presets/_shared/ai-local/scripts/signals.mjs +17 -1
  34. package/presets/_shared/ai-local/scripts/team-db-api.mjs +496 -67
  35. package/presets/_shared/ai-local/scripts/team-db-dashboard.mjs +816 -5
  36. package/presets/_shared/ai-local/scripts/team-db-openapi.mjs +761 -6
  37. package/presets/_shared/ai-local/scripts/team-db-project.mjs +10 -0
  38. package/presets/_shared/ai-local/scripts/team-db-scheduler.mjs +2360 -0
  39. package/presets/_shared/ai-local/scripts/team-db-schema.mjs +87 -0
  40. package/presets/_shared/ai-local/scripts/team-db.mjs +151 -9
  41. package/presets/_shared/ai-local/scripts/upstream-research.mjs +2961 -0
  42. package/presets/_shared/core/agent-team/agent-artifact-contracts.md +17 -0
  43. package/presets/_shared/core/agent-team/agent-team-intake.md +1 -0
  44. package/presets/_shared/core/agent-team/agent-team-orchestrator.md +5 -2
  45. package/presets/_shared/core/meta/preset-pr-checklist.md +4 -4
  46. package/presets/_shared/core/meta/preset-twin-sync.md +1 -1
  47. package/presets/_shared/hooks/README.md +23 -3
  48. package/presets/_shared/hooks/chain-team-phases.sh.tmpl +57 -3
  49. package/presets/_shared/hooks/check-preset-update.mjs +4 -3
  50. package/presets/{claude/nuxt/hooks/guard-shell-command.sh → _shared/hooks/guard-shell-command.mjs.tmpl} +29 -35
  51. package/presets/_shared/hooks/run-hook.mjs +102 -0
  52. package/presets/claude/android-kotlin/hooks/README.md +4 -3
  53. package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +57 -3
  54. package/presets/claude/android-kotlin/hooks/check-preset-update.mjs +4 -3
  55. package/presets/claude/android-kotlin/hooks/examples/README.md +2 -2
  56. package/presets/claude/android-kotlin/hooks/guard-shell-command.mjs +96 -0
  57. package/presets/claude/android-kotlin/hooks/run-hook.mjs +102 -0
  58. package/presets/claude/android-kotlin/rules/tooling-and-review/agent-team-intake.md +1 -0
  59. package/presets/claude/android-kotlin/rules/tooling-and-review/agent-team-orchestrator.md +5 -2
  60. package/presets/claude/android-kotlin/rules/tooling-and-review/preset-pr-checklist.md +4 -4
  61. package/presets/claude/android-kotlin/rules/tooling-and-review/preset-twin-sync.md +1 -1
  62. package/presets/claude/android-kotlin/settings.json +2 -2
  63. package/presets/claude/android-kotlin/team/README.md +5 -0
  64. package/presets/claude/go/hooks/README.md +4 -3
  65. package/presets/claude/go/hooks/chain-team-phases.sh +57 -3
  66. package/presets/claude/go/hooks/check-preset-update.mjs +4 -3
  67. package/presets/claude/go/hooks/examples/README.md +2 -2
  68. package/presets/claude/go/hooks/guard-shell-command.mjs +95 -0
  69. package/presets/claude/go/hooks/run-hook.mjs +102 -0
  70. package/presets/claude/go/rules/tooling-and-review/agent-team-intake.md +1 -0
  71. package/presets/claude/go/rules/tooling-and-review/agent-team-orchestrator.md +5 -2
  72. package/presets/claude/go/rules/tooling-and-review/preset-pr-checklist.md +4 -4
  73. package/presets/claude/go/rules/tooling-and-review/preset-twin-sync.md +1 -1
  74. package/presets/claude/go/settings.json +2 -2
  75. package/presets/claude/go/team/README.md +5 -0
  76. package/presets/claude/ios-swift/hooks/README.md +4 -3
  77. package/presets/claude/ios-swift/hooks/chain-team-phases.sh +57 -3
  78. package/presets/claude/ios-swift/hooks/check-preset-update.mjs +4 -3
  79. package/presets/claude/ios-swift/hooks/examples/README.md +2 -2
  80. package/presets/claude/ios-swift/hooks/guard-shell-command.mjs +95 -0
  81. package/presets/claude/ios-swift/hooks/run-hook.mjs +102 -0
  82. package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-intake.md +1 -0
  83. package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-orchestrator.md +5 -2
  84. package/presets/claude/ios-swift/rules/tooling-and-review/preset-pr-checklist.md +4 -4
  85. package/presets/claude/ios-swift/rules/tooling-and-review/preset-twin-sync.md +1 -1
  86. package/presets/claude/ios-swift/settings.json +2 -2
  87. package/presets/claude/ios-swift/team/README.md +5 -0
  88. package/presets/claude/java/hooks/README.md +4 -3
  89. package/presets/claude/java/hooks/chain-team-phases.sh +57 -3
  90. package/presets/claude/java/hooks/check-preset-update.mjs +4 -3
  91. package/presets/claude/java/hooks/examples/README.md +2 -2
  92. package/presets/claude/java/hooks/{guard-shell-command.sh → guard-shell-command.mjs} +31 -38
  93. package/presets/claude/java/hooks/run-hook.mjs +102 -0
  94. package/presets/claude/java/rules/tooling-and-review/agent-team-intake.md +1 -0
  95. package/presets/claude/java/rules/tooling-and-review/agent-team-orchestrator.md +5 -2
  96. package/presets/claude/java/rules/tooling-and-review/preset-pr-checklist.md +4 -4
  97. package/presets/claude/java/rules/tooling-and-review/preset-twin-sync.md +1 -1
  98. package/presets/claude/java/settings.json +2 -2
  99. package/presets/claude/java/team/README.md +5 -0
  100. package/presets/claude/mcp-ts/hooks/README.md +4 -3
  101. package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +57 -3
  102. package/presets/claude/mcp-ts/hooks/check-preset-update.mjs +4 -3
  103. package/presets/claude/mcp-ts/hooks/examples/README.md +1 -1
  104. package/presets/claude/mcp-ts/hooks/guard-shell-command.mjs +95 -0
  105. package/presets/claude/mcp-ts/hooks/run-hook.mjs +102 -0
  106. package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-intake.md +1 -0
  107. package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-orchestrator.md +5 -2
  108. package/presets/claude/mcp-ts/rules/tooling-and-review/preset-pr-checklist.md +4 -4
  109. package/presets/claude/mcp-ts/rules/tooling-and-review/preset-twin-sync.md +1 -1
  110. package/presets/claude/mcp-ts/settings.json +2 -2
  111. package/presets/claude/mcp-ts/team/README.md +5 -0
  112. package/presets/claude/mol/hooks/README.md +20 -0
  113. package/presets/claude/mol/hooks/chain-team-phases.sh +57 -3
  114. package/presets/claude/mol/hooks/check-preset-update.mjs +4 -3
  115. package/presets/claude/{svelte/hooks/guard-shell-command.sh → mol/hooks/guard-shell-command.mjs} +29 -35
  116. package/presets/claude/mol/hooks/run-hook.mjs +102 -0
  117. package/presets/claude/mol/rules/tooling-and-review/agent-team-intake.md +1 -0
  118. package/presets/claude/mol/rules/tooling-and-review/agent-team-orchestrator.md +5 -2
  119. package/presets/claude/mol/rules/tooling-and-review/preset-pr-checklist.md +4 -4
  120. package/presets/claude/mol/rules/tooling-and-review/preset-twin-sync.md +1 -1
  121. package/presets/claude/mol/settings.json +2 -2
  122. package/presets/claude/mol/team/README.md +5 -0
  123. package/presets/claude/next/agents/build-verifier.md +18 -3
  124. package/presets/claude/next/agents/code-reviewer.md +2 -0
  125. package/presets/claude/next/agents/feature-developer.md +3 -1
  126. package/presets/claude/next/agents/task-analyst.md +6 -0
  127. package/presets/claude/next/agents/task-router.md +5 -3
  128. package/presets/claude/next/commands/README.md +1 -0
  129. package/presets/claude/next/commands/task-continue.md +1 -1
  130. package/presets/claude/next/commands/upstream-research.md +23 -0
  131. package/presets/claude/next/hooks/README.md +4 -3
  132. package/presets/claude/next/hooks/chain-team-phases.sh +57 -3
  133. package/presets/claude/next/hooks/check-preset-update.mjs +4 -3
  134. package/presets/claude/next/hooks/examples/README.md +2 -2
  135. package/presets/claude/next/hooks/guard-shell-command.mjs +94 -0
  136. package/presets/claude/next/hooks/run-hook.mjs +102 -0
  137. package/presets/claude/next/rules/tooling-and-review/agent-team-intake.md +1 -0
  138. package/presets/claude/next/rules/tooling-and-review/agent-team-orchestrator.md +5 -2
  139. package/presets/claude/next/rules/tooling-and-review/preset-pr-checklist.md +4 -4
  140. package/presets/claude/next/rules/tooling-and-review/preset-twin-sync.md +1 -1
  141. package/presets/claude/next/settings.json +2 -2
  142. package/presets/claude/next/team/README.md +23 -0
  143. package/presets/claude/next/team/upstream/config.json +31 -0
  144. package/presets/claude/next/team/upstream/digest-template.md +55 -0
  145. package/presets/claude/next/team/upstream/opencode.json +34 -0
  146. package/presets/claude/next/team/upstream/projects.json +4 -0
  147. package/presets/claude/next/team/upstream/prompt.md +77 -0
  148. package/presets/claude/next/team/upstream/signatures.json +9 -0
  149. package/presets/claude/nuxt/hooks/README.md +4 -3
  150. package/presets/claude/nuxt/hooks/chain-team-phases.sh +57 -3
  151. package/presets/claude/nuxt/hooks/check-preset-update.mjs +4 -3
  152. package/presets/claude/nuxt/hooks/examples/README.md +2 -2
  153. package/presets/claude/{ios-swift/hooks/guard-shell-command.sh → nuxt/hooks/guard-shell-command.mjs} +29 -37
  154. package/presets/claude/nuxt/hooks/run-hook.mjs +102 -0
  155. package/presets/claude/nuxt/rules/tooling-and-review/agent-team-intake.md +1 -0
  156. package/presets/claude/nuxt/rules/tooling-and-review/agent-team-orchestrator.md +5 -2
  157. package/presets/claude/nuxt/rules/tooling-and-review/preset-pr-checklist.md +4 -4
  158. package/presets/claude/nuxt/rules/tooling-and-review/preset-twin-sync.md +1 -1
  159. package/presets/claude/nuxt/settings.json +2 -2
  160. package/presets/claude/nuxt/team/README.md +5 -0
  161. package/presets/claude/php-hexagonal/hooks/README.md +4 -3
  162. package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +57 -3
  163. package/presets/claude/php-hexagonal/hooks/check-preset-update.mjs +4 -3
  164. package/presets/claude/php-hexagonal/hooks/examples/README.md +2 -2
  165. package/presets/claude/php-hexagonal/hooks/guard-shell-command.mjs +96 -0
  166. package/presets/claude/php-hexagonal/hooks/run-hook.mjs +102 -0
  167. package/presets/claude/php-hexagonal/rules/tooling-and-review/agent-team-intake.md +1 -0
  168. package/presets/claude/php-hexagonal/rules/tooling-and-review/agent-team-orchestrator.md +5 -2
  169. package/presets/claude/php-hexagonal/rules/tooling-and-review/preset-pr-checklist.md +4 -4
  170. package/presets/claude/php-hexagonal/rules/tooling-and-review/preset-twin-sync.md +1 -1
  171. package/presets/claude/php-hexagonal/settings.json +2 -2
  172. package/presets/claude/php-hexagonal/team/README.md +5 -0
  173. package/presets/claude/php-laravel/hooks/README.md +4 -3
  174. package/presets/claude/php-laravel/hooks/chain-team-phases.sh +57 -3
  175. package/presets/claude/php-laravel/hooks/check-preset-update.mjs +4 -3
  176. package/presets/claude/php-laravel/hooks/examples/README.md +2 -2
  177. package/presets/claude/php-laravel/hooks/guard-shell-command.mjs +96 -0
  178. package/presets/claude/php-laravel/hooks/run-hook.mjs +102 -0
  179. package/presets/claude/php-laravel/rules/tooling-and-review/agent-team-intake.md +1 -0
  180. package/presets/claude/php-laravel/rules/tooling-and-review/agent-team-orchestrator.md +5 -2
  181. package/presets/claude/php-laravel/rules/tooling-and-review/preset-pr-checklist.md +4 -4
  182. package/presets/claude/php-laravel/rules/tooling-and-review/preset-twin-sync.md +1 -1
  183. package/presets/claude/php-laravel/settings.json +2 -2
  184. package/presets/claude/php-laravel/team/README.md +5 -0
  185. package/presets/claude/svelte/hooks/README.md +4 -3
  186. package/presets/claude/svelte/hooks/chain-team-phases.sh +57 -3
  187. package/presets/claude/svelte/hooks/check-preset-update.mjs +4 -3
  188. package/presets/claude/svelte/hooks/examples/README.md +2 -2
  189. package/presets/claude/svelte/hooks/guard-shell-command.mjs +94 -0
  190. package/presets/claude/svelte/hooks/run-hook.mjs +102 -0
  191. package/presets/claude/svelte/rules/tooling-and-review/agent-team-intake.md +1 -0
  192. package/presets/claude/svelte/rules/tooling-and-review/agent-team-orchestrator.md +5 -2
  193. package/presets/claude/svelte/rules/tooling-and-review/preset-pr-checklist.md +4 -4
  194. package/presets/claude/svelte/rules/tooling-and-review/preset-twin-sync.md +1 -1
  195. package/presets/claude/svelte/settings.json +2 -2
  196. package/presets/claude/svelte/team/README.md +5 -0
  197. package/presets/cursor/android-kotlin/hooks/README.md +2 -1
  198. package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +57 -3
  199. package/presets/cursor/android-kotlin/hooks/check-preset-update.mjs +4 -3
  200. package/presets/cursor/android-kotlin/hooks/examples/README.md +1 -1
  201. package/presets/cursor/android-kotlin/hooks/guard-shell-command.mjs +96 -0
  202. package/presets/cursor/android-kotlin/hooks/run-hook.mjs +102 -0
  203. package/presets/cursor/android-kotlin/hooks.json +2 -2
  204. package/presets/cursor/android-kotlin/rules/agent-team-intake.mdc +1 -0
  205. package/presets/cursor/android-kotlin/rules/agent-team-orchestrator.mdc +2 -1
  206. package/presets/cursor/android-kotlin/rules/preset-pr-checklist.mdc +4 -4
  207. package/presets/cursor/android-kotlin/rules/preset-twin-sync.mdc +1 -1
  208. package/presets/cursor/android-kotlin/team/README.md +5 -0
  209. package/presets/cursor/go/hooks/README.md +2 -1
  210. package/presets/cursor/go/hooks/chain-team-phases.sh +57 -3
  211. package/presets/cursor/go/hooks/check-preset-update.mjs +4 -3
  212. package/presets/cursor/go/hooks/examples/README.md +1 -1
  213. package/presets/cursor/go/hooks/guard-shell-command.mjs +95 -0
  214. package/presets/cursor/go/hooks/run-hook.mjs +102 -0
  215. package/presets/cursor/go/hooks.json +2 -2
  216. package/presets/cursor/go/rules/agent-team-intake.mdc +1 -0
  217. package/presets/cursor/go/rules/agent-team-orchestrator.mdc +2 -1
  218. package/presets/cursor/go/rules/preset-pr-checklist.mdc +4 -4
  219. package/presets/cursor/go/rules/preset-twin-sync.mdc +1 -1
  220. package/presets/cursor/go/team/README.md +5 -0
  221. package/presets/cursor/ios-swift/hooks/README.md +2 -1
  222. package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +57 -3
  223. package/presets/cursor/ios-swift/hooks/check-preset-update.mjs +4 -3
  224. package/presets/cursor/ios-swift/hooks/examples/README.md +1 -1
  225. package/presets/cursor/ios-swift/hooks/guard-shell-command.mjs +95 -0
  226. package/presets/cursor/ios-swift/hooks/run-hook.mjs +102 -0
  227. package/presets/cursor/ios-swift/hooks.json +2 -2
  228. package/presets/cursor/ios-swift/rules/agent-team-intake.mdc +1 -0
  229. package/presets/cursor/ios-swift/rules/agent-team-orchestrator.mdc +2 -1
  230. package/presets/cursor/ios-swift/rules/preset-pr-checklist.mdc +4 -4
  231. package/presets/cursor/ios-swift/rules/preset-twin-sync.mdc +1 -1
  232. package/presets/cursor/ios-swift/team/README.md +5 -0
  233. package/presets/cursor/java/hooks/README.md +2 -1
  234. package/presets/cursor/java/hooks/chain-team-phases.sh +57 -3
  235. package/presets/cursor/java/hooks/check-preset-update.mjs +4 -3
  236. package/presets/cursor/java/hooks/examples/README.md +1 -1
  237. package/presets/cursor/java/hooks/guard-shell-command.mjs +96 -0
  238. package/presets/cursor/java/hooks/run-hook.mjs +102 -0
  239. package/presets/cursor/java/hooks.json +2 -2
  240. package/presets/cursor/java/rules/agent-team-intake.mdc +1 -0
  241. package/presets/cursor/java/rules/agent-team-orchestrator.mdc +2 -1
  242. package/presets/cursor/java/rules/preset-pr-checklist.mdc +4 -4
  243. package/presets/cursor/java/rules/preset-twin-sync.mdc +1 -1
  244. package/presets/cursor/java/team/README.md +5 -0
  245. package/presets/cursor/mcp-ts/hooks/README.md +2 -1
  246. package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +57 -3
  247. package/presets/cursor/mcp-ts/hooks/check-preset-update.mjs +4 -3
  248. package/presets/cursor/mcp-ts/hooks/guard-shell-command.mjs +95 -0
  249. package/presets/cursor/mcp-ts/hooks/run-hook.mjs +102 -0
  250. package/presets/cursor/mcp-ts/hooks.json +2 -2
  251. package/presets/cursor/mcp-ts/rules/agent-team-intake.mdc +1 -0
  252. package/presets/cursor/mcp-ts/rules/agent-team-orchestrator.mdc +2 -1
  253. package/presets/cursor/mcp-ts/rules/preset-pr-checklist.mdc +4 -4
  254. package/presets/cursor/mcp-ts/rules/preset-twin-sync.mdc +1 -1
  255. package/presets/cursor/mcp-ts/team/README.md +5 -0
  256. package/presets/cursor/mol/hooks/README.md +2 -1
  257. package/presets/cursor/mol/hooks/chain-team-phases.sh +57 -3
  258. package/presets/cursor/mol/hooks/check-preset-update.mjs +4 -3
  259. package/presets/cursor/mol/hooks/examples/README.md +1 -1
  260. package/presets/{claude/next/hooks/guard-shell-command.sh → cursor/mol/hooks/guard-shell-command.mjs} +29 -35
  261. package/presets/cursor/mol/hooks/run-hook.mjs +102 -0
  262. package/presets/cursor/mol/hooks.json +2 -2
  263. package/presets/cursor/mol/rules/agent-team-intake.mdc +1 -0
  264. package/presets/cursor/mol/rules/agent-team-orchestrator.mdc +2 -1
  265. package/presets/cursor/mol/rules/preset-pr-checklist.mdc +4 -4
  266. package/presets/cursor/mol/rules/preset-twin-sync.mdc +1 -1
  267. package/presets/cursor/mol/team/README.md +5 -0
  268. package/presets/cursor/next/agents/build-verifier.md +18 -3
  269. package/presets/cursor/next/agents/code-reviewer.md +2 -0
  270. package/presets/cursor/next/agents/feature-developer.md +3 -1
  271. package/presets/cursor/next/agents/task-analyst.md +6 -0
  272. package/presets/cursor/next/agents/task-router.md +5 -3
  273. package/presets/cursor/next/commands/README.md +1 -0
  274. package/presets/cursor/next/commands/task-continue.md +1 -1
  275. package/presets/cursor/next/commands/upstream-research.md +23 -0
  276. package/presets/cursor/next/hooks/README.md +2 -1
  277. package/presets/cursor/next/hooks/chain-team-phases.sh +57 -3
  278. package/presets/cursor/next/hooks/check-preset-update.mjs +4 -3
  279. package/presets/cursor/next/hooks/examples/README.md +1 -1
  280. package/presets/cursor/next/hooks/guard-shell-command.mjs +94 -0
  281. package/presets/cursor/next/hooks/run-hook.mjs +102 -0
  282. package/presets/cursor/next/hooks.json +2 -2
  283. package/presets/cursor/next/rules/agent-team-intake.mdc +1 -0
  284. package/presets/cursor/next/rules/agent-team-orchestrator.mdc +2 -1
  285. package/presets/cursor/next/rules/preset-pr-checklist.mdc +4 -4
  286. package/presets/cursor/next/rules/preset-twin-sync.mdc +1 -1
  287. package/presets/cursor/next/team/README.md +23 -0
  288. package/presets/cursor/next/team/upstream/config.json +31 -0
  289. package/presets/cursor/next/team/upstream/digest-template.md +55 -0
  290. package/presets/cursor/next/team/upstream/opencode.json +34 -0
  291. package/presets/cursor/next/team/upstream/projects.json +4 -0
  292. package/presets/cursor/next/team/upstream/prompt.md +77 -0
  293. package/presets/cursor/next/team/upstream/signatures.json +9 -0
  294. package/presets/cursor/nuxt/hooks/README.md +2 -1
  295. package/presets/cursor/nuxt/hooks/chain-team-phases.sh +57 -3
  296. package/presets/cursor/nuxt/hooks/check-preset-update.mjs +4 -3
  297. package/presets/cursor/nuxt/hooks/examples/README.md +1 -1
  298. package/presets/cursor/nuxt/hooks/guard-shell-command.mjs +94 -0
  299. package/presets/cursor/nuxt/hooks/run-hook.mjs +102 -0
  300. package/presets/cursor/nuxt/hooks.json +2 -2
  301. package/presets/cursor/nuxt/rules/agent-team-intake.mdc +1 -0
  302. package/presets/cursor/nuxt/rules/agent-team-orchestrator.mdc +2 -1
  303. package/presets/cursor/nuxt/rules/preset-pr-checklist.mdc +4 -4
  304. package/presets/cursor/nuxt/rules/preset-twin-sync.mdc +1 -1
  305. package/presets/cursor/nuxt/team/README.md +5 -0
  306. package/presets/cursor/php-hexagonal/hooks/README.md +2 -1
  307. package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +57 -3
  308. package/presets/cursor/php-hexagonal/hooks/check-preset-update.mjs +4 -3
  309. package/presets/cursor/php-hexagonal/hooks/examples/README.md +1 -1
  310. package/presets/cursor/php-hexagonal/hooks/guard-shell-command.mjs +96 -0
  311. package/presets/cursor/php-hexagonal/hooks/run-hook.mjs +102 -0
  312. package/presets/cursor/php-hexagonal/hooks.json +2 -2
  313. package/presets/cursor/php-hexagonal/rules/agent-team-intake.mdc +1 -0
  314. package/presets/cursor/php-hexagonal/rules/agent-team-orchestrator.mdc +2 -1
  315. package/presets/cursor/php-hexagonal/rules/preset-pr-checklist.mdc +4 -4
  316. package/presets/cursor/php-hexagonal/rules/preset-twin-sync.mdc +1 -1
  317. package/presets/cursor/php-hexagonal/team/README.md +5 -0
  318. package/presets/cursor/php-laravel/hooks/README.md +2 -1
  319. package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +57 -3
  320. package/presets/cursor/php-laravel/hooks/check-preset-update.mjs +4 -3
  321. package/presets/cursor/php-laravel/hooks/examples/README.md +1 -1
  322. package/presets/cursor/php-laravel/hooks/guard-shell-command.mjs +96 -0
  323. package/presets/cursor/php-laravel/hooks/run-hook.mjs +102 -0
  324. package/presets/cursor/php-laravel/hooks.json +2 -2
  325. package/presets/cursor/php-laravel/rules/agent-team-intake.mdc +1 -0
  326. package/presets/cursor/php-laravel/rules/agent-team-orchestrator.mdc +2 -1
  327. package/presets/cursor/php-laravel/rules/preset-pr-checklist.mdc +4 -4
  328. package/presets/cursor/php-laravel/rules/preset-twin-sync.mdc +1 -1
  329. package/presets/cursor/php-laravel/team/README.md +5 -0
  330. package/presets/cursor/svelte/hooks/README.md +2 -1
  331. package/presets/cursor/svelte/hooks/chain-team-phases.sh +57 -3
  332. package/presets/cursor/svelte/hooks/check-preset-update.mjs +4 -3
  333. package/presets/cursor/svelte/hooks/examples/README.md +1 -1
  334. package/presets/cursor/svelte/hooks/guard-shell-command.mjs +94 -0
  335. package/presets/cursor/svelte/hooks/run-hook.mjs +102 -0
  336. package/presets/cursor/svelte/hooks.json +2 -2
  337. package/presets/cursor/svelte/rules/agent-team-intake.mdc +1 -0
  338. package/presets/cursor/svelte/rules/agent-team-orchestrator.mdc +2 -1
  339. package/presets/cursor/svelte/rules/preset-pr-checklist.mdc +4 -4
  340. package/presets/cursor/svelte/rules/preset-twin-sync.mdc +1 -1
  341. package/presets/cursor/svelte/team/README.md +5 -0
  342. package/presets/mavis/android-kotlin/adapter-map.json +11 -3
  343. package/presets/mavis/android-kotlin/hooks/README.md +2 -1
  344. package/presets/mavis/android-kotlin/hooks/chain-team-phases.sh +57 -3
  345. package/presets/mavis/android-kotlin/hooks/check-preset-update.mjs +4 -3
  346. package/presets/mavis/android-kotlin/rules/agent-team-intake.md +1 -0
  347. package/presets/mavis/android-kotlin/rules/agent-team-orchestrator.md +5 -2
  348. package/presets/mavis/android-kotlin/rules/preset-pr-checklist.md +4 -4
  349. package/presets/mavis/android-kotlin/rules/preset-twin-sync.md +1 -1
  350. package/presets/mavis/android-kotlin/team/README.md +5 -0
  351. package/presets/mavis/go/adapter-map.json +11 -3
  352. package/presets/mavis/go/hooks/README.md +2 -1
  353. package/presets/mavis/go/hooks/chain-team-phases.sh +57 -3
  354. package/presets/mavis/go/hooks/check-preset-update.mjs +4 -3
  355. package/presets/mavis/go/rules/agent-team-intake.md +1 -0
  356. package/presets/mavis/go/rules/agent-team-orchestrator.md +5 -2
  357. package/presets/mavis/go/rules/preset-pr-checklist.md +4 -4
  358. package/presets/mavis/go/rules/preset-twin-sync.md +1 -1
  359. package/presets/mavis/go/team/README.md +5 -0
  360. package/presets/mavis/ios-swift/adapter-map.json +11 -3
  361. package/presets/mavis/ios-swift/hooks/README.md +2 -1
  362. package/presets/mavis/ios-swift/hooks/chain-team-phases.sh +57 -3
  363. package/presets/mavis/ios-swift/hooks/check-preset-update.mjs +4 -3
  364. package/presets/mavis/ios-swift/rules/agent-team-intake.md +1 -0
  365. package/presets/mavis/ios-swift/rules/agent-team-orchestrator.md +5 -2
  366. package/presets/mavis/ios-swift/rules/preset-pr-checklist.md +4 -4
  367. package/presets/mavis/ios-swift/rules/preset-twin-sync.md +1 -1
  368. package/presets/mavis/ios-swift/team/README.md +5 -0
  369. package/presets/mavis/java/adapter-map.json +11 -3
  370. package/presets/mavis/java/hooks/README.md +2 -1
  371. package/presets/mavis/java/hooks/chain-team-phases.sh +57 -3
  372. package/presets/mavis/java/hooks/check-preset-update.mjs +4 -3
  373. package/presets/mavis/java/rules/agent-team-intake.md +1 -0
  374. package/presets/mavis/java/rules/agent-team-orchestrator.md +5 -2
  375. package/presets/mavis/java/rules/preset-pr-checklist.md +4 -4
  376. package/presets/mavis/java/rules/preset-twin-sync.md +1 -1
  377. package/presets/mavis/java/team/README.md +5 -0
  378. package/presets/mavis/mcp-ts/adapter-map.json +11 -3
  379. package/presets/mavis/mcp-ts/hooks/README.md +2 -1
  380. package/presets/mavis/mcp-ts/hooks/chain-team-phases.sh +57 -3
  381. package/presets/mavis/mcp-ts/hooks/check-preset-update.mjs +4 -3
  382. package/presets/mavis/mcp-ts/rules/agent-team-intake.md +1 -0
  383. package/presets/mavis/mcp-ts/rules/agent-team-orchestrator.md +5 -2
  384. package/presets/mavis/mcp-ts/rules/preset-pr-checklist.md +4 -4
  385. package/presets/mavis/mcp-ts/rules/preset-twin-sync.md +1 -1
  386. package/presets/mavis/mcp-ts/team/README.md +5 -0
  387. package/presets/mavis/mol/adapter-map.json +11 -3
  388. package/presets/mavis/mol/hooks/README.md +2 -1
  389. package/presets/mavis/mol/hooks/chain-team-phases.sh +57 -3
  390. package/presets/mavis/mol/hooks/check-preset-update.mjs +4 -3
  391. package/presets/mavis/mol/rules/agent-team-intake.md +1 -0
  392. package/presets/mavis/mol/rules/agent-team-orchestrator.md +5 -2
  393. package/presets/mavis/mol/rules/preset-pr-checklist.md +4 -4
  394. package/presets/mavis/mol/rules/preset-twin-sync.md +1 -1
  395. package/presets/mavis/mol/team/README.md +5 -0
  396. package/presets/mavis/next/adapter-map.json +67 -3
  397. package/presets/mavis/next/agents/build-verifier.md +18 -3
  398. package/presets/mavis/next/agents/code-reviewer.md +2 -0
  399. package/presets/mavis/next/agents/feature-developer.md +3 -1
  400. package/presets/mavis/next/agents/task-analyst.md +6 -0
  401. package/presets/mavis/next/agents/task-router.md +5 -3
  402. package/presets/mavis/next/commands/README.md +1 -0
  403. package/presets/mavis/next/commands/task-continue.md +1 -1
  404. package/presets/mavis/next/commands/upstream-research.md +18 -0
  405. package/presets/mavis/next/hooks/README.md +2 -1
  406. package/presets/mavis/next/hooks/chain-team-phases.sh +57 -3
  407. package/presets/mavis/next/hooks/check-preset-update.mjs +4 -3
  408. package/presets/mavis/next/rules/agent-team-intake.md +1 -0
  409. package/presets/mavis/next/rules/agent-team-orchestrator.md +5 -2
  410. package/presets/mavis/next/rules/preset-pr-checklist.md +4 -4
  411. package/presets/mavis/next/rules/preset-twin-sync.md +1 -1
  412. package/presets/mavis/next/team/README.md +23 -0
  413. package/presets/mavis/next/team/upstream/config.json +31 -0
  414. package/presets/mavis/next/team/upstream/digest-template.md +55 -0
  415. package/presets/mavis/next/team/upstream/opencode.json +34 -0
  416. package/presets/mavis/next/team/upstream/projects.json +4 -0
  417. package/presets/mavis/next/team/upstream/prompt.md +77 -0
  418. package/presets/mavis/next/team/upstream/signatures.json +9 -0
  419. package/presets/mavis/nuxt/adapter-map.json +11 -3
  420. package/presets/mavis/nuxt/hooks/README.md +2 -1
  421. package/presets/mavis/nuxt/hooks/chain-team-phases.sh +57 -3
  422. package/presets/mavis/nuxt/hooks/check-preset-update.mjs +4 -3
  423. package/presets/mavis/nuxt/rules/agent-team-intake.md +1 -0
  424. package/presets/mavis/nuxt/rules/agent-team-orchestrator.md +5 -2
  425. package/presets/mavis/nuxt/rules/preset-pr-checklist.md +4 -4
  426. package/presets/mavis/nuxt/rules/preset-twin-sync.md +1 -1
  427. package/presets/mavis/nuxt/team/README.md +5 -0
  428. package/presets/mavis/php-hexagonal/adapter-map.json +11 -3
  429. package/presets/mavis/php-hexagonal/hooks/README.md +2 -1
  430. package/presets/mavis/php-hexagonal/hooks/chain-team-phases.sh +57 -3
  431. package/presets/mavis/php-hexagonal/hooks/check-preset-update.mjs +4 -3
  432. package/presets/mavis/php-hexagonal/rules/agent-team-intake.md +1 -0
  433. package/presets/mavis/php-hexagonal/rules/agent-team-orchestrator.md +5 -2
  434. package/presets/mavis/php-hexagonal/rules/preset-pr-checklist.md +4 -4
  435. package/presets/mavis/php-hexagonal/rules/preset-twin-sync.md +1 -1
  436. package/presets/mavis/php-hexagonal/team/README.md +5 -0
  437. package/presets/mavis/php-laravel/adapter-map.json +11 -3
  438. package/presets/mavis/php-laravel/hooks/README.md +2 -1
  439. package/presets/mavis/php-laravel/hooks/chain-team-phases.sh +57 -3
  440. package/presets/mavis/php-laravel/hooks/check-preset-update.mjs +4 -3
  441. package/presets/mavis/php-laravel/rules/agent-team-intake.md +1 -0
  442. package/presets/mavis/php-laravel/rules/agent-team-orchestrator.md +5 -2
  443. package/presets/mavis/php-laravel/rules/preset-pr-checklist.md +4 -4
  444. package/presets/mavis/php-laravel/rules/preset-twin-sync.md +1 -1
  445. package/presets/mavis/php-laravel/team/README.md +5 -0
  446. package/presets/mavis/svelte/adapter-map.json +11 -3
  447. package/presets/mavis/svelte/hooks/README.md +2 -1
  448. package/presets/mavis/svelte/hooks/chain-team-phases.sh +57 -3
  449. package/presets/mavis/svelte/hooks/check-preset-update.mjs +4 -3
  450. package/presets/mavis/svelte/rules/agent-team-intake.md +1 -0
  451. package/presets/mavis/svelte/rules/agent-team-orchestrator.md +5 -2
  452. package/presets/mavis/svelte/rules/preset-pr-checklist.md +4 -4
  453. package/presets/mavis/svelte/rules/preset-twin-sync.md +1 -1
  454. package/presets/mavis/svelte/team/README.md +5 -0
  455. package/presets/opencode/android-kotlin/OPENCODE.md +1 -1
  456. package/presets/opencode/android-kotlin/README.md +1 -1
  457. package/presets/opencode/android-kotlin/adapter-map.json +11 -3
  458. package/presets/opencode/android-kotlin/hooks/README.md +3 -2
  459. package/presets/opencode/android-kotlin/hooks/chain-team-phases.sh +57 -3
  460. package/presets/opencode/android-kotlin/hooks/check-preset-update.mjs +4 -3
  461. package/presets/opencode/android-kotlin/rules/agent-team-intake.md +1 -0
  462. package/presets/opencode/android-kotlin/rules/agent-team-orchestrator.md +5 -2
  463. package/presets/opencode/android-kotlin/rules/preset-pr-checklist.md +4 -4
  464. package/presets/opencode/android-kotlin/rules/preset-twin-sync.md +1 -1
  465. package/presets/opencode/android-kotlin/team/README.md +5 -0
  466. package/presets/opencode/go/OPENCODE.md +1 -1
  467. package/presets/opencode/go/README.md +1 -1
  468. package/presets/opencode/go/adapter-map.json +11 -3
  469. package/presets/opencode/go/hooks/README.md +3 -2
  470. package/presets/opencode/go/hooks/chain-team-phases.sh +57 -3
  471. package/presets/opencode/go/hooks/check-preset-update.mjs +4 -3
  472. package/presets/opencode/go/rules/agent-team-intake.md +1 -0
  473. package/presets/opencode/go/rules/agent-team-orchestrator.md +5 -2
  474. package/presets/opencode/go/rules/preset-pr-checklist.md +4 -4
  475. package/presets/opencode/go/rules/preset-twin-sync.md +1 -1
  476. package/presets/opencode/go/team/README.md +5 -0
  477. package/presets/opencode/ios-swift/OPENCODE.md +1 -1
  478. package/presets/opencode/ios-swift/README.md +1 -1
  479. package/presets/opencode/ios-swift/adapter-map.json +11 -3
  480. package/presets/opencode/ios-swift/hooks/README.md +3 -2
  481. package/presets/opencode/ios-swift/hooks/chain-team-phases.sh +57 -3
  482. package/presets/opencode/ios-swift/hooks/check-preset-update.mjs +4 -3
  483. package/presets/opencode/ios-swift/rules/agent-team-intake.md +1 -0
  484. package/presets/opencode/ios-swift/rules/agent-team-orchestrator.md +5 -2
  485. package/presets/opencode/ios-swift/rules/preset-pr-checklist.md +4 -4
  486. package/presets/opencode/ios-swift/rules/preset-twin-sync.md +1 -1
  487. package/presets/opencode/ios-swift/team/README.md +5 -0
  488. package/presets/opencode/java/OPENCODE.md +1 -1
  489. package/presets/opencode/java/README.md +1 -1
  490. package/presets/opencode/java/adapter-map.json +11 -3
  491. package/presets/opencode/java/hooks/README.md +3 -2
  492. package/presets/opencode/java/hooks/chain-team-phases.sh +57 -3
  493. package/presets/opencode/java/hooks/check-preset-update.mjs +4 -3
  494. package/presets/opencode/java/rules/agent-team-intake.md +1 -0
  495. package/presets/opencode/java/rules/agent-team-orchestrator.md +5 -2
  496. package/presets/opencode/java/rules/preset-pr-checklist.md +4 -4
  497. package/presets/opencode/java/rules/preset-twin-sync.md +1 -1
  498. package/presets/opencode/java/team/README.md +5 -0
  499. package/presets/opencode/mcp-ts/OPENCODE.md +1 -1
  500. package/presets/opencode/mcp-ts/README.md +1 -1
  501. package/presets/opencode/mcp-ts/adapter-map.json +11 -3
  502. package/presets/opencode/mcp-ts/hooks/README.md +3 -2
  503. package/presets/opencode/mcp-ts/hooks/chain-team-phases.sh +57 -3
  504. package/presets/opencode/mcp-ts/hooks/check-preset-update.mjs +4 -3
  505. package/presets/opencode/mcp-ts/rules/agent-team-intake.md +1 -0
  506. package/presets/opencode/mcp-ts/rules/agent-team-orchestrator.md +5 -2
  507. package/presets/opencode/mcp-ts/rules/preset-pr-checklist.md +4 -4
  508. package/presets/opencode/mcp-ts/rules/preset-twin-sync.md +1 -1
  509. package/presets/opencode/mcp-ts/team/README.md +5 -0
  510. package/presets/opencode/mol/OPENCODE.md +1 -1
  511. package/presets/opencode/mol/README.md +1 -1
  512. package/presets/opencode/mol/adapter-map.json +11 -3
  513. package/presets/opencode/mol/hooks/README.md +3 -2
  514. package/presets/opencode/mol/hooks/chain-team-phases.sh +57 -3
  515. package/presets/opencode/mol/hooks/check-preset-update.mjs +4 -3
  516. package/presets/opencode/mol/rules/agent-team-intake.md +1 -0
  517. package/presets/opencode/mol/rules/agent-team-orchestrator.md +5 -2
  518. package/presets/opencode/mol/rules/preset-pr-checklist.md +4 -4
  519. package/presets/opencode/mol/rules/preset-twin-sync.md +1 -1
  520. package/presets/opencode/mol/team/README.md +5 -0
  521. package/presets/opencode/next/OPENCODE.md +1 -1
  522. package/presets/opencode/next/README.md +1 -1
  523. package/presets/opencode/next/adapter-map.json +67 -3
  524. package/presets/opencode/next/agents/build-verifier.md +18 -3
  525. package/presets/opencode/next/agents/code-reviewer.md +2 -0
  526. package/presets/opencode/next/agents/feature-developer.md +3 -1
  527. package/presets/opencode/next/agents/task-analyst.md +6 -0
  528. package/presets/opencode/next/agents/task-router.md +5 -3
  529. package/presets/opencode/next/commands/README.md +1 -0
  530. package/presets/opencode/next/commands/task-continue.md +1 -1
  531. package/presets/opencode/next/commands/upstream-research.md +26 -0
  532. package/presets/opencode/next/hooks/README.md +3 -2
  533. package/presets/opencode/next/hooks/chain-team-phases.sh +57 -3
  534. package/presets/opencode/next/hooks/check-preset-update.mjs +4 -3
  535. package/presets/opencode/next/rules/agent-team-intake.md +1 -0
  536. package/presets/opencode/next/rules/agent-team-orchestrator.md +5 -2
  537. package/presets/opencode/next/rules/preset-pr-checklist.md +4 -4
  538. package/presets/opencode/next/rules/preset-twin-sync.md +1 -1
  539. package/presets/opencode/next/team/README.md +23 -0
  540. package/presets/opencode/next/team/upstream/config.json +31 -0
  541. package/presets/opencode/next/team/upstream/digest-template.md +55 -0
  542. package/presets/opencode/next/team/upstream/opencode.json +34 -0
  543. package/presets/opencode/next/team/upstream/projects.json +4 -0
  544. package/presets/opencode/next/team/upstream/prompt.md +77 -0
  545. package/presets/opencode/next/team/upstream/signatures.json +9 -0
  546. package/presets/opencode/nuxt/OPENCODE.md +1 -1
  547. package/presets/opencode/nuxt/README.md +1 -1
  548. package/presets/opencode/nuxt/adapter-map.json +11 -3
  549. package/presets/opencode/nuxt/hooks/README.md +3 -2
  550. package/presets/opencode/nuxt/hooks/chain-team-phases.sh +57 -3
  551. package/presets/opencode/nuxt/hooks/check-preset-update.mjs +4 -3
  552. package/presets/opencode/nuxt/rules/agent-team-intake.md +1 -0
  553. package/presets/opencode/nuxt/rules/agent-team-orchestrator.md +5 -2
  554. package/presets/opencode/nuxt/rules/preset-pr-checklist.md +4 -4
  555. package/presets/opencode/nuxt/rules/preset-twin-sync.md +1 -1
  556. package/presets/opencode/nuxt/team/README.md +5 -0
  557. package/presets/opencode/php-hexagonal/OPENCODE.md +1 -1
  558. package/presets/opencode/php-hexagonal/README.md +1 -1
  559. package/presets/opencode/php-hexagonal/adapter-map.json +11 -3
  560. package/presets/opencode/php-hexagonal/hooks/README.md +3 -2
  561. package/presets/opencode/php-hexagonal/hooks/chain-team-phases.sh +57 -3
  562. package/presets/opencode/php-hexagonal/hooks/check-preset-update.mjs +4 -3
  563. package/presets/opencode/php-hexagonal/rules/agent-team-intake.md +1 -0
  564. package/presets/opencode/php-hexagonal/rules/agent-team-orchestrator.md +5 -2
  565. package/presets/opencode/php-hexagonal/rules/preset-pr-checklist.md +4 -4
  566. package/presets/opencode/php-hexagonal/rules/preset-twin-sync.md +1 -1
  567. package/presets/opencode/php-hexagonal/team/README.md +5 -0
  568. package/presets/opencode/php-laravel/OPENCODE.md +1 -1
  569. package/presets/opencode/php-laravel/README.md +1 -1
  570. package/presets/opencode/php-laravel/adapter-map.json +11 -3
  571. package/presets/opencode/php-laravel/hooks/README.md +3 -2
  572. package/presets/opencode/php-laravel/hooks/chain-team-phases.sh +57 -3
  573. package/presets/opencode/php-laravel/hooks/check-preset-update.mjs +4 -3
  574. package/presets/opencode/php-laravel/rules/agent-team-intake.md +1 -0
  575. package/presets/opencode/php-laravel/rules/agent-team-orchestrator.md +5 -2
  576. package/presets/opencode/php-laravel/rules/preset-pr-checklist.md +4 -4
  577. package/presets/opencode/php-laravel/rules/preset-twin-sync.md +1 -1
  578. package/presets/opencode/php-laravel/team/README.md +5 -0
  579. package/presets/opencode/svelte/OPENCODE.md +1 -1
  580. package/presets/opencode/svelte/README.md +1 -1
  581. package/presets/opencode/svelte/adapter-map.json +11 -3
  582. package/presets/opencode/svelte/hooks/README.md +3 -2
  583. package/presets/opencode/svelte/hooks/chain-team-phases.sh +57 -3
  584. package/presets/opencode/svelte/hooks/check-preset-update.mjs +4 -3
  585. package/presets/opencode/svelte/rules/agent-team-intake.md +1 -0
  586. package/presets/opencode/svelte/rules/agent-team-orchestrator.md +5 -2
  587. package/presets/opencode/svelte/rules/preset-pr-checklist.md +4 -4
  588. package/presets/opencode/svelte/rules/preset-twin-sync.md +1 -1
  589. package/presets/opencode/svelte/team/README.md +5 -0
  590. package/presets/zcode/android-kotlin/adapter-map.json +11 -3
  591. package/presets/zcode/android-kotlin/hooks/README.md +2 -1
  592. package/presets/zcode/android-kotlin/hooks/chain-team-phases.sh +57 -3
  593. package/presets/zcode/android-kotlin/hooks/check-preset-update.mjs +4 -3
  594. package/presets/zcode/android-kotlin/rules/agent-team-intake.md +1 -0
  595. package/presets/zcode/android-kotlin/rules/agent-team-orchestrator.md +5 -2
  596. package/presets/zcode/android-kotlin/rules/preset-pr-checklist.md +4 -4
  597. package/presets/zcode/android-kotlin/rules/preset-twin-sync.md +1 -1
  598. package/presets/zcode/android-kotlin/team/README.md +5 -0
  599. package/presets/zcode/go/adapter-map.json +11 -3
  600. package/presets/zcode/go/hooks/README.md +2 -1
  601. package/presets/zcode/go/hooks/chain-team-phases.sh +57 -3
  602. package/presets/zcode/go/hooks/check-preset-update.mjs +4 -3
  603. package/presets/zcode/go/rules/agent-team-intake.md +1 -0
  604. package/presets/zcode/go/rules/agent-team-orchestrator.md +5 -2
  605. package/presets/zcode/go/rules/preset-pr-checklist.md +4 -4
  606. package/presets/zcode/go/rules/preset-twin-sync.md +1 -1
  607. package/presets/zcode/go/team/README.md +5 -0
  608. package/presets/zcode/ios-swift/adapter-map.json +11 -3
  609. package/presets/zcode/ios-swift/hooks/README.md +2 -1
  610. package/presets/zcode/ios-swift/hooks/chain-team-phases.sh +57 -3
  611. package/presets/zcode/ios-swift/hooks/check-preset-update.mjs +4 -3
  612. package/presets/zcode/ios-swift/rules/agent-team-intake.md +1 -0
  613. package/presets/zcode/ios-swift/rules/agent-team-orchestrator.md +5 -2
  614. package/presets/zcode/ios-swift/rules/preset-pr-checklist.md +4 -4
  615. package/presets/zcode/ios-swift/rules/preset-twin-sync.md +1 -1
  616. package/presets/zcode/ios-swift/team/README.md +5 -0
  617. package/presets/zcode/java/adapter-map.json +11 -3
  618. package/presets/zcode/java/hooks/README.md +2 -1
  619. package/presets/zcode/java/hooks/chain-team-phases.sh +57 -3
  620. package/presets/zcode/java/hooks/check-preset-update.mjs +4 -3
  621. package/presets/zcode/java/rules/agent-team-intake.md +1 -0
  622. package/presets/zcode/java/rules/agent-team-orchestrator.md +5 -2
  623. package/presets/zcode/java/rules/preset-pr-checklist.md +4 -4
  624. package/presets/zcode/java/rules/preset-twin-sync.md +1 -1
  625. package/presets/zcode/java/team/README.md +5 -0
  626. package/presets/zcode/mcp-ts/adapter-map.json +11 -3
  627. package/presets/zcode/mcp-ts/hooks/README.md +2 -1
  628. package/presets/zcode/mcp-ts/hooks/chain-team-phases.sh +57 -3
  629. package/presets/zcode/mcp-ts/hooks/check-preset-update.mjs +4 -3
  630. package/presets/zcode/mcp-ts/rules/agent-team-intake.md +1 -0
  631. package/presets/zcode/mcp-ts/rules/agent-team-orchestrator.md +5 -2
  632. package/presets/zcode/mcp-ts/rules/preset-pr-checklist.md +4 -4
  633. package/presets/zcode/mcp-ts/rules/preset-twin-sync.md +1 -1
  634. package/presets/zcode/mcp-ts/team/README.md +5 -0
  635. package/presets/zcode/mol/adapter-map.json +11 -3
  636. package/presets/zcode/mol/hooks/README.md +2 -1
  637. package/presets/zcode/mol/hooks/chain-team-phases.sh +57 -3
  638. package/presets/zcode/mol/hooks/check-preset-update.mjs +4 -3
  639. package/presets/zcode/mol/rules/agent-team-intake.md +1 -0
  640. package/presets/zcode/mol/rules/agent-team-orchestrator.md +5 -2
  641. package/presets/zcode/mol/rules/preset-pr-checklist.md +4 -4
  642. package/presets/zcode/mol/rules/preset-twin-sync.md +1 -1
  643. package/presets/zcode/mol/team/README.md +5 -0
  644. package/presets/zcode/next/adapter-map.json +67 -3
  645. package/presets/zcode/next/agents/build-verifier.md +18 -3
  646. package/presets/zcode/next/agents/code-reviewer.md +2 -0
  647. package/presets/zcode/next/agents/feature-developer.md +3 -1
  648. package/presets/zcode/next/agents/task-analyst.md +6 -0
  649. package/presets/zcode/next/agents/task-router.md +5 -3
  650. package/presets/zcode/next/commands/README.md +1 -0
  651. package/presets/zcode/next/commands/task-continue.md +1 -1
  652. package/presets/zcode/next/commands/upstream-research.md +26 -0
  653. package/presets/zcode/next/hooks/README.md +2 -1
  654. package/presets/zcode/next/hooks/chain-team-phases.sh +57 -3
  655. package/presets/zcode/next/hooks/check-preset-update.mjs +4 -3
  656. package/presets/zcode/next/rules/agent-team-intake.md +1 -0
  657. package/presets/zcode/next/rules/agent-team-orchestrator.md +5 -2
  658. package/presets/zcode/next/rules/preset-pr-checklist.md +4 -4
  659. package/presets/zcode/next/rules/preset-twin-sync.md +1 -1
  660. package/presets/zcode/next/team/README.md +23 -0
  661. package/presets/zcode/next/team/upstream/config.json +31 -0
  662. package/presets/zcode/next/team/upstream/digest-template.md +55 -0
  663. package/presets/zcode/next/team/upstream/opencode.json +34 -0
  664. package/presets/zcode/next/team/upstream/projects.json +4 -0
  665. package/presets/zcode/next/team/upstream/prompt.md +77 -0
  666. package/presets/zcode/next/team/upstream/signatures.json +9 -0
  667. package/presets/zcode/nuxt/adapter-map.json +11 -3
  668. package/presets/zcode/nuxt/hooks/README.md +2 -1
  669. package/presets/zcode/nuxt/hooks/chain-team-phases.sh +57 -3
  670. package/presets/zcode/nuxt/hooks/check-preset-update.mjs +4 -3
  671. package/presets/zcode/nuxt/rules/agent-team-intake.md +1 -0
  672. package/presets/zcode/nuxt/rules/agent-team-orchestrator.md +5 -2
  673. package/presets/zcode/nuxt/rules/preset-pr-checklist.md +4 -4
  674. package/presets/zcode/nuxt/rules/preset-twin-sync.md +1 -1
  675. package/presets/zcode/nuxt/team/README.md +5 -0
  676. package/presets/zcode/php-hexagonal/adapter-map.json +11 -3
  677. package/presets/zcode/php-hexagonal/hooks/README.md +2 -1
  678. package/presets/zcode/php-hexagonal/hooks/chain-team-phases.sh +57 -3
  679. package/presets/zcode/php-hexagonal/hooks/check-preset-update.mjs +4 -3
  680. package/presets/zcode/php-hexagonal/rules/agent-team-intake.md +1 -0
  681. package/presets/zcode/php-hexagonal/rules/agent-team-orchestrator.md +5 -2
  682. package/presets/zcode/php-hexagonal/rules/preset-pr-checklist.md +4 -4
  683. package/presets/zcode/php-hexagonal/rules/preset-twin-sync.md +1 -1
  684. package/presets/zcode/php-hexagonal/team/README.md +5 -0
  685. package/presets/zcode/php-laravel/adapter-map.json +11 -3
  686. package/presets/zcode/php-laravel/hooks/README.md +2 -1
  687. package/presets/zcode/php-laravel/hooks/chain-team-phases.sh +57 -3
  688. package/presets/zcode/php-laravel/hooks/check-preset-update.mjs +4 -3
  689. package/presets/zcode/php-laravel/rules/agent-team-intake.md +1 -0
  690. package/presets/zcode/php-laravel/rules/agent-team-orchestrator.md +5 -2
  691. package/presets/zcode/php-laravel/rules/preset-pr-checklist.md +4 -4
  692. package/presets/zcode/php-laravel/rules/preset-twin-sync.md +1 -1
  693. package/presets/zcode/php-laravel/team/README.md +5 -0
  694. package/presets/zcode/svelte/adapter-map.json +11 -3
  695. package/presets/zcode/svelte/hooks/README.md +2 -1
  696. package/presets/zcode/svelte/hooks/chain-team-phases.sh +57 -3
  697. package/presets/zcode/svelte/hooks/check-preset-update.mjs +4 -3
  698. package/presets/zcode/svelte/rules/agent-team-intake.md +1 -0
  699. package/presets/zcode/svelte/rules/agent-team-orchestrator.md +5 -2
  700. package/presets/zcode/svelte/rules/preset-pr-checklist.md +4 -4
  701. package/presets/zcode/svelte/rules/preset-twin-sync.md +1 -1
  702. package/presets/zcode/svelte/team/README.md +5 -0
  703. package/presets/claude/android-kotlin/hooks/guard-shell-command.sh +0 -103
  704. package/presets/claude/go/hooks/guard-shell-command.sh +0 -102
  705. package/presets/claude/mcp-ts/hooks/guard-shell-command.sh +0 -102
  706. package/presets/claude/php-hexagonal/hooks/guard-shell-command.sh +0 -103
  707. package/presets/claude/php-laravel/hooks/guard-shell-command.sh +0 -103
  708. package/presets/cursor/android-kotlin/hooks/guard-shell-command.sh +0 -80
  709. package/presets/cursor/go/hooks/guard-shell-command.sh +0 -79
  710. package/presets/cursor/ios-swift/hooks/guard-shell-command.sh +0 -79
  711. package/presets/cursor/java/hooks/guard-shell-command.sh +0 -80
  712. package/presets/cursor/mcp-ts/hooks/guard-shell-command.sh +0 -79
  713. package/presets/cursor/mol/hooks/guard-shell-command.sh +0 -77
  714. package/presets/cursor/next/hooks/guard-shell-command.sh +0 -77
  715. package/presets/cursor/nuxt/hooks/guard-shell-command.sh +0 -77
  716. package/presets/cursor/php-hexagonal/hooks/guard-shell-command.sh +0 -80
  717. package/presets/cursor/php-laravel/hooks/guard-shell-command.sh +0 -80
  718. package/presets/cursor/svelte/hooks/guard-shell-command.sh +0 -77
@@ -1,6 +1,7 @@
1
1
  /**
2
- * The OpenAPI 3.1 document for the team-db API: reads plus two bounded
3
- * mutations (the idempotent rescan and the confirmed task delete).
2
+ * The OpenAPI 3.1 document for the team-db API: reads plus six bounded
3
+ * mutations (the idempotent rescan, the confirmed task delete, and the four
4
+ * job writes: create, update, delete, run-now).
4
5
  *
5
6
  * This module is the single source of the checked-in
6
7
  * `packages/ai-rules/docs/openapi/team-db.v1.json`: `check-team-db-contract.mjs
@@ -13,6 +14,9 @@
13
14
  * allowed inside v1; removing or renaming anything is a v2 document.
14
15
  */
15
16
 
17
+ // The run-reason vocabulary is the scheduler's own list: one source, no drift.
18
+ import { REASON_CODES } from './team-db-scheduler.mjs';
19
+
16
20
  export const API_MAJOR = 1;
17
21
  export const API_VERSION = '1.0.0';
18
22
  export const OPENAPI_VERSION = '3.1.0';
@@ -21,6 +25,8 @@ export const OPENAPI_SERVER_URL = 'http://127.0.0.1:4178';
21
25
 
22
26
  /** Mirrors `SLUG_RE` in `team-db-project.mjs`; a path parameter, never a file path. */
23
27
  export const SLUG_PATTERN = '^[a-z0-9]+(?:-[a-z0-9]+)*$';
28
+ export const JOB_ID_PATTERN = '^[a-z0-9]+(?:-[a-z0-9]+)*$';
29
+ export const RUN_ID_PATTERN = '^[0-9]{8}T[0-9]{6}Z-[0-9a-f]{8}$';
24
30
  export const AGENT_PATTERN = '^[a-z0-9][a-z0-9-]{0,63}$';
25
31
  export const INTENT_PATTERN = '^[a-z][a-z0-9-]{0,31}$';
26
32
 
@@ -71,6 +77,8 @@ export const ERROR_CODES = [
71
77
  'E_SCHEMA_OUTDATED',
72
78
  'E_SCHEMA_NEWER',
73
79
  'E_BUSY',
80
+ 'E_CONFLICT',
81
+ 'E_SCHEDULER_OFFLINE',
74
82
  'E_INTERNAL',
75
83
  ];
76
84
 
@@ -626,9 +634,22 @@ const schemas = {
626
634
  projectedAt: nullable('string'),
627
635
  capabilities: {
628
636
  type: 'array',
629
- items: { type: 'string', enum: ['sync', 'delete'] },
637
+ items: { type: 'string', enum: ['sync', 'delete', 'jobs', 'schedule'] },
630
638
  },
639
+ scheduler: object(
640
+ {
641
+ state: { type: 'string', enum: ['running', 'stale', 'stopped'] },
642
+ pid: nullable('integer'),
643
+ startedAt: nullable('string'),
644
+ heartbeatAt: nullable('string'),
645
+ nextTickAt: nullable('string'),
646
+ jobsDue: { type: 'integer', minimum: 0 },
647
+ },
648
+ ['state', 'pid', 'startedAt', 'heartbeatAt', 'nextTickAt', 'jobsDue'],
649
+ ),
631
650
  },
651
+ // `scheduler` is additive: every current server emits it, but a v1
652
+ // consumer must not require it.
632
653
  ['status', 'db', 'tasks', 'projectedAt', 'capabilities'],
633
654
  ),
634
655
  Migration: object(
@@ -690,6 +711,276 @@ const schemas = {
690
711
  'documentsIncluded',
691
712
  ],
692
713
  ),
714
+ // Reads: the server omits the key that belongs to the other `kind`, so only
715
+ // `kind` and the always-present fields are required. The optional keys stay
716
+ // declared so an older payload that carries a null sibling still validates.
717
+ JobSchedule: object(
718
+ {
719
+ kind: { type: 'string', enum: ['cron', 'interval'] },
720
+ expression: nullable('string'),
721
+ everySeconds: nullable('integer'),
722
+ timezone: { type: 'string' },
723
+ },
724
+ ['kind', 'timezone'],
725
+ ),
726
+ JobPayload: object(
727
+ {
728
+ kind: { type: 'string', enum: ['command', 'pipeline'] },
729
+ argv: { type: ['array', 'null'], items: { type: 'string' } },
730
+ promptTemplate: nullable('string'),
731
+ runner: { type: ['array', 'null'], items: { type: 'string' } },
732
+ },
733
+ ['kind'],
734
+ ),
735
+ // Writes: each `kind` admits only its own keys. The write validator refuses
736
+ // a null sibling, so a write must never carry one.
737
+ JobWriteSchedule: {
738
+ anyOf: [
739
+ object(
740
+ {
741
+ kind: { const: 'cron' },
742
+ expression: { type: 'string' },
743
+ timezone: { type: 'string' },
744
+ },
745
+ ['kind', 'expression', 'timezone'],
746
+ ),
747
+ object(
748
+ {
749
+ kind: { const: 'interval' },
750
+ everySeconds: { type: 'integer', minimum: 60, maximum: 2592000 },
751
+ timezone: { type: 'string' },
752
+ },
753
+ ['kind', 'everySeconds', 'timezone'],
754
+ ),
755
+ ],
756
+ },
757
+ JobWritePayload: {
758
+ anyOf: [
759
+ object(
760
+ {
761
+ kind: { const: 'command' },
762
+ argv: { type: 'array', items: { type: 'string' }, minItems: 1, maxItems: 32 },
763
+ },
764
+ ['kind', 'argv'],
765
+ ),
766
+ object(
767
+ {
768
+ kind: { const: 'pipeline' },
769
+ promptTemplate: { type: 'string' },
770
+ runner: { type: 'array', items: { type: 'string' }, minItems: 1, maxItems: 32 },
771
+ },
772
+ ['kind', 'promptTemplate', 'runner'],
773
+ ),
774
+ ],
775
+ },
776
+ Job: object(
777
+ {
778
+ id: { type: 'string', pattern: JOB_ID_PATTERN },
779
+ title: { type: 'string' },
780
+ enabled: { type: 'boolean' },
781
+ schedule: ref('JobSchedule'),
782
+ payload: ref('JobPayload'),
783
+ cwd: { type: 'string' },
784
+ envPassthrough: { type: 'array', items: { type: 'string' } },
785
+ timeoutMs: { type: 'integer', minimum: 1000, maximum: 43200000 },
786
+ concurrency: { type: 'string', enum: ['skip', 'queue', 'allow'] },
787
+ misfire: { type: 'string', enum: ['skip', 'run-once', 'catch-up'] },
788
+ createdAt: { type: 'string' },
789
+ updatedAt: { type: 'string' },
790
+ revision: { type: 'integer', minimum: 1 },
791
+ },
792
+ [
793
+ 'id',
794
+ 'title',
795
+ 'enabled',
796
+ 'schedule',
797
+ 'payload',
798
+ 'cwd',
799
+ 'envPassthrough',
800
+ 'timeoutMs',
801
+ 'concurrency',
802
+ 'misfire',
803
+ 'createdAt',
804
+ 'updatedAt',
805
+ 'revision',
806
+ ],
807
+ ),
808
+ JobWrite: object(
809
+ {
810
+ id: { type: 'string', pattern: JOB_ID_PATTERN },
811
+ title: { type: 'string' },
812
+ enabled: { type: 'boolean' },
813
+ schedule: ref('JobWriteSchedule'),
814
+ payload: ref('JobWritePayload'),
815
+ cwd: { type: 'string' },
816
+ envPassthrough: { type: 'array', items: { type: 'string' } },
817
+ timeoutMs: { type: 'integer', minimum: 1000, maximum: 43200000 },
818
+ concurrency: { type: 'string', enum: ['skip', 'queue', 'allow'] },
819
+ misfire: { type: 'string', enum: ['skip', 'run-once', 'catch-up'] },
820
+ // Optional on create (defaults to 1); required on update, where a
821
+ // missing or stale value is 409 `E_CONFLICT`.
822
+ revision: { type: 'integer', minimum: 1 },
823
+ // Accepted because a `JobDetail.job` response can be sent back as the
824
+ // `PUT` body; the writing child keeps `createdAt` immutable.
825
+ createdAt: { type: 'string' },
826
+ updatedAt: { type: 'string' },
827
+ },
828
+ ['id', 'schedule', 'payload'],
829
+ ),
830
+ JobLastRun: object(
831
+ {
832
+ runId: { type: 'string' },
833
+ state: { type: 'string', enum: ['claimed', 'running', 'succeeded', 'failed', 'timeout', 'skipped', 'interrupted'] },
834
+ finishedAt: nullable('string'),
835
+ durationMs: nullable('integer'),
836
+ },
837
+ ['runId', 'state', 'finishedAt', 'durationMs'],
838
+ ),
839
+ JobDetail: object(
840
+ {
841
+ job: ref('Job'),
842
+ nextFireAt: nullable('string'),
843
+ lastRun: { anyOf: [ref('JobLastRun'), { type: 'null' }] },
844
+ },
845
+ ['job', 'nextFireAt', 'lastRun'],
846
+ ),
847
+ JobList: object(
848
+ {
849
+ items: { type: 'array', items: ref('JobDetail') },
850
+ total: { type: 'integer', minimum: 0 },
851
+ limit: { type: 'integer', minimum: 1, maximum: 200 },
852
+ offset: { type: 'integer', minimum: 0 },
853
+ nextOffset: nullable('integer'),
854
+ },
855
+ ['items', 'total', 'limit', 'offset', 'nextOffset'],
856
+ ),
857
+ JobRun: object(
858
+ {
859
+ runId: { type: 'string', pattern: RUN_ID_PATTERN },
860
+ jobId: { type: 'string', pattern: JOB_ID_PATTERN },
861
+ trigger: { type: 'string', enum: ['schedule', 'manual', 'catch-up'] },
862
+ state: { type: 'string', enum: ['claimed', 'running', 'succeeded', 'failed', 'timeout', 'skipped', 'interrupted'] },
863
+ // `E_ORPHANED` is a reason, never an HTTP code. The fixed set is the
864
+ // scheduler's `REASON_CODES`; a lost child writes the parameterised
865
+ // `E_EXIT_<code>` / `E_SIGNAL_<signal>` families, and `null` is a
866
+ // successful run.
867
+ reasonCode: {
868
+ anyOf: [
869
+ { type: 'string', enum: [...REASON_CODES] },
870
+ { type: 'string', pattern: '^E_EXIT_(?:-?[0-9]+|UNKNOWN)$' },
871
+ { type: 'string', pattern: '^E_SIGNAL_[A-Z0-9]+$' },
872
+ { type: 'null' },
873
+ ],
874
+ },
875
+ exitCode: nullable('integer'),
876
+ signal: nullable('string'),
877
+ pid: nullable('integer'),
878
+ startedAt: { type: 'string' },
879
+ finishedAt: nullable('string'),
880
+ durationMs: nullable('integer'),
881
+ stdoutBytes: { type: 'integer', minimum: 0 },
882
+ stderrBytes: { type: 'integer', minimum: 0 },
883
+ stdoutTruncated: { type: 'boolean' },
884
+ stderrTruncated: { type: 'boolean' },
885
+ parseError: nullable('string'),
886
+ },
887
+ [
888
+ 'runId',
889
+ 'jobId',
890
+ 'trigger',
891
+ 'state',
892
+ 'reasonCode',
893
+ 'exitCode',
894
+ 'signal',
895
+ 'pid',
896
+ 'startedAt',
897
+ 'finishedAt',
898
+ 'durationMs',
899
+ 'stdoutBytes',
900
+ 'stderrBytes',
901
+ 'stdoutTruncated',
902
+ 'stderrTruncated',
903
+ 'parseError',
904
+ ],
905
+ ),
906
+ JobRunEvent: object(
907
+ {
908
+ seq: { type: 'integer', minimum: 1 },
909
+ at: { type: 'string' },
910
+ state: { type: 'string' },
911
+ code: nullable('string'),
912
+ message: nullable('string'),
913
+ },
914
+ ['seq', 'at', 'state', 'code', 'message'],
915
+ ),
916
+ JobRunList: object(
917
+ {
918
+ items: { type: 'array', items: ref('JobRun') },
919
+ total: { type: 'integer', minimum: 0 },
920
+ limit: { type: 'integer', minimum: 1, maximum: 200 },
921
+ offset: { type: 'integer', minimum: 0 },
922
+ nextOffset: nullable('integer'),
923
+ },
924
+ ['items', 'total', 'limit', 'offset', 'nextOffset'],
925
+ ),
926
+ JobRunDetail: object(
927
+ {
928
+ run: ref('JobRun'),
929
+ events: { type: 'array', items: ref('JobRunEvent') },
930
+ child: object(
931
+ {
932
+ pid: nullable('integer'),
933
+ exitCode: nullable('integer'),
934
+ signal: nullable('string'),
935
+ timedOut: { type: 'boolean' },
936
+ },
937
+ ['pid', 'exitCode', 'signal', 'timedOut'],
938
+ ),
939
+ logs: object(
940
+ {
941
+ stdout: ref('JobLogSummary'),
942
+ stderr: ref('JobLogSummary'),
943
+ },
944
+ ['stdout', 'stderr'],
945
+ ),
946
+ },
947
+ ['run', 'events', 'child', 'logs'],
948
+ ),
949
+ JobLogSummary: object(
950
+ {
951
+ bytes: { type: 'integer', minimum: 0 },
952
+ sha256: nullable('string'),
953
+ truncated: { type: 'boolean' },
954
+ },
955
+ ['bytes', 'sha256', 'truncated'],
956
+ ),
957
+ JobLogChunk: object(
958
+ {
959
+ stream: { type: 'string', enum: ['stdout', 'stderr'] },
960
+ offset: { type: 'integer', minimum: 0 },
961
+ limit: { type: 'integer', minimum: 1, maximum: 262144 },
962
+ totalBytes: { type: 'integer', minimum: 0 },
963
+ truncated: { type: 'boolean' },
964
+ text: { type: 'string' },
965
+ },
966
+ ['stream', 'offset', 'limit', 'totalBytes', 'truncated', 'text'],
967
+ ),
968
+ JobDeleteResult: object(
969
+ {
970
+ ok: { type: 'boolean' },
971
+ id: { type: 'string', pattern: JOB_ID_PATTERN },
972
+ runsRemoved: { type: 'integer', minimum: 0 },
973
+ },
974
+ ['ok', 'id', 'runsRemoved'],
975
+ ),
976
+ JobRunRequest: object(
977
+ {
978
+ requested: { type: 'boolean' },
979
+ requestedAt: { type: 'string' },
980
+ schedulerOnline: { type: 'boolean' },
981
+ },
982
+ ['requested', 'requestedAt', 'schedulerOnline'],
983
+ ),
693
984
  };
694
985
 
695
986
 
@@ -938,9 +1229,217 @@ const EXAMPLES = {
938
1229
  db: { file: 'team.db', present: true, schemaVersion: 1, fingerprintOk: true, search: 'fts5' },
939
1230
  tasks: { total: 90, absent: 0 },
940
1231
  projectedAt: '2026-11-06T08:00:04.000Z',
941
- capabilities: ['sync', 'delete'],
1232
+ capabilities: ['sync', 'delete', 'jobs', 'schedule'],
1233
+ scheduler: {
1234
+ state: 'running',
1235
+ pid: 41231,
1236
+ startedAt: '2026-11-06T07:00:00.000Z',
1237
+ heartbeatAt: '2026-11-06T08:00:04.000Z',
1238
+ nextTickAt: '2026-11-06T08:00:05.000Z',
1239
+ jobsDue: 1,
1240
+ },
1241
+ },
1242
+ ],
1243
+ JobSchedule: [{ kind: 'cron', expression: '0 3 * * *', timezone: 'Europe/Berlin' }],
1244
+ JobPayload: [{ kind: 'command', argv: ['node', '.ai.local/scripts/run.mjs', '--nightly'] }],
1245
+ JobWriteSchedule: [
1246
+ { kind: 'cron', expression: '0 3 * * *', timezone: 'Europe/Berlin' },
1247
+ { kind: 'interval', everySeconds: 900, timezone: 'Europe/Berlin' },
1248
+ ],
1249
+ JobWritePayload: [
1250
+ { kind: 'command', argv: ['node', '.ai.local/scripts/run.mjs', '--nightly'] },
1251
+ { kind: 'pipeline', promptTemplate: 'scheduler/prompts/retro.md', runner: ['node', 'runner.mjs', '{promptFile}'] },
1252
+ ],
1253
+ Job: [
1254
+ {
1255
+ id: 'nightly-retro',
1256
+ title: 'Nightly technical retro',
1257
+ enabled: true,
1258
+ schedule: { kind: 'cron', expression: '0 3 * * *', timezone: 'Europe/Berlin' },
1259
+ payload: { kind: 'command', argv: ['node', '.ai.local/scripts/run.mjs', '--nightly'] },
1260
+ cwd: '.',
1261
+ envPassthrough: ['CI'],
1262
+ timeoutMs: 900000,
1263
+ concurrency: 'skip',
1264
+ misfire: 'run-once',
1265
+ createdAt: '2026-11-10T09:00:00.000Z',
1266
+ updatedAt: '2026-11-10T09:00:00.000Z',
1267
+ revision: 1,
1268
+ },
1269
+ ],
1270
+ JobWrite: [
1271
+ {
1272
+ id: 'nightly-retro',
1273
+ title: 'Nightly technical retro',
1274
+ enabled: true,
1275
+ schedule: { kind: 'cron', expression: '0 3 * * *', timezone: 'Europe/Berlin' },
1276
+ payload: { kind: 'command', argv: ['node', '.ai.local/scripts/run.mjs', '--nightly'] },
1277
+ cwd: '.',
1278
+ envPassthrough: ['CI'],
1279
+ timeoutMs: 900000,
1280
+ concurrency: 'skip',
1281
+ misfire: 'run-once',
1282
+ revision: 1,
1283
+ },
1284
+ ],
1285
+ JobLastRun: [
1286
+ {
1287
+ runId: '20261110T101500Z-1a2b3c4d',
1288
+ state: 'succeeded',
1289
+ finishedAt: '2026-11-10T10:15:03.214Z',
1290
+ durationMs: 3214,
1291
+ },
1292
+ ],
1293
+ JobDetail: [
1294
+ {
1295
+ job: {
1296
+ id: 'nightly-retro',
1297
+ title: 'Nightly technical retro',
1298
+ enabled: true,
1299
+ schedule: { kind: 'cron', expression: '0 3 * * *', timezone: 'Europe/Berlin' },
1300
+ payload: { kind: 'command', argv: ['node', '.ai.local/scripts/run.mjs', '--nightly'] },
1301
+ cwd: '.',
1302
+ envPassthrough: ['CI'],
1303
+ timeoutMs: 900000,
1304
+ concurrency: 'skip',
1305
+ misfire: 'run-once',
1306
+ createdAt: '2026-11-10T09:00:00.000Z',
1307
+ updatedAt: '2026-11-10T09:00:00.000Z',
1308
+ revision: 1,
1309
+ },
1310
+ nextFireAt: '2026-11-11T02:00:00.000Z',
1311
+ lastRun: {
1312
+ runId: '20261110T101500Z-1a2b3c4d',
1313
+ state: 'succeeded',
1314
+ finishedAt: '2026-11-10T10:15:03.214Z',
1315
+ durationMs: 3214,
1316
+ },
1317
+ },
1318
+ ],
1319
+ JobList: [
1320
+ {
1321
+ items: [
1322
+ {
1323
+ job: {
1324
+ id: 'nightly-retro',
1325
+ title: 'Nightly technical retro',
1326
+ enabled: true,
1327
+ schedule: { kind: 'cron', expression: '0 3 * * *', timezone: 'Europe/Berlin' },
1328
+ payload: { kind: 'command', argv: ['node', '.ai.local/scripts/run.mjs', '--nightly'] },
1329
+ cwd: '.',
1330
+ envPassthrough: ['CI'],
1331
+ timeoutMs: 900000,
1332
+ concurrency: 'skip',
1333
+ misfire: 'run-once',
1334
+ createdAt: '2026-11-10T09:00:00.000Z',
1335
+ updatedAt: '2026-11-10T09:00:00.000Z',
1336
+ revision: 1,
1337
+ },
1338
+ nextFireAt: '2026-11-11T02:00:00.000Z',
1339
+ lastRun: {
1340
+ runId: '20261110T101500Z-1a2b3c4d',
1341
+ state: 'succeeded',
1342
+ finishedAt: '2026-11-10T10:15:03.214Z',
1343
+ durationMs: 3214,
1344
+ },
1345
+ },
1346
+ ],
1347
+ total: 1,
1348
+ limit: 50,
1349
+ offset: 0,
1350
+ nextOffset: null,
942
1351
  },
943
1352
  ],
1353
+ JobRun: [
1354
+ {
1355
+ runId: '20261110T101500Z-1a2b3c4d',
1356
+ jobId: 'nightly-retro',
1357
+ trigger: 'schedule',
1358
+ state: 'succeeded',
1359
+ reasonCode: null,
1360
+ exitCode: 0,
1361
+ signal: null,
1362
+ pid: 41299,
1363
+ startedAt: '2026-11-10T10:15:00.000Z',
1364
+ finishedAt: '2026-11-10T10:15:03.214Z',
1365
+ durationMs: 3214,
1366
+ stdoutBytes: 812,
1367
+ stderrBytes: 0,
1368
+ stdoutTruncated: false,
1369
+ stderrTruncated: false,
1370
+ parseError: null,
1371
+ },
1372
+ ],
1373
+ JobRunEvent: [{ seq: 1, at: '2026-11-10T10:15:00.000Z', state: 'claimed', code: null, message: 'claim' }],
1374
+ JobRunList: [
1375
+ {
1376
+ items: [
1377
+ {
1378
+ runId: '20261110T101500Z-1a2b3c4d',
1379
+ jobId: 'nightly-retro',
1380
+ trigger: 'schedule',
1381
+ state: 'succeeded',
1382
+ reasonCode: null,
1383
+ exitCode: 0,
1384
+ signal: null,
1385
+ pid: 41299,
1386
+ startedAt: '2026-11-10T10:15:00.000Z',
1387
+ finishedAt: '2026-11-10T10:15:03.214Z',
1388
+ durationMs: 3214,
1389
+ stdoutBytes: 812,
1390
+ stderrBytes: 0,
1391
+ stdoutTruncated: false,
1392
+ stderrTruncated: false,
1393
+ parseError: null,
1394
+ },
1395
+ ],
1396
+ total: 1,
1397
+ limit: 50,
1398
+ offset: 0,
1399
+ nextOffset: null,
1400
+ },
1401
+ ],
1402
+ JobRunDetail: [
1403
+ {
1404
+ run: {
1405
+ runId: '20261110T101500Z-1a2b3c4d',
1406
+ jobId: 'nightly-retro',
1407
+ trigger: 'schedule',
1408
+ state: 'succeeded',
1409
+ reasonCode: null,
1410
+ exitCode: 0,
1411
+ signal: null,
1412
+ pid: 41299,
1413
+ startedAt: '2026-11-10T10:15:00.000Z',
1414
+ finishedAt: '2026-11-10T10:15:03.214Z',
1415
+ durationMs: 3214,
1416
+ stdoutBytes: 812,
1417
+ stderrBytes: 0,
1418
+ stdoutTruncated: false,
1419
+ stderrTruncated: false,
1420
+ parseError: null,
1421
+ },
1422
+ events: [{ seq: 1, at: '2026-11-10T10:15:00.000Z', state: 'claimed', code: null, message: 'claim' }],
1423
+ child: { pid: 41299, exitCode: 0, signal: null, timedOut: false },
1424
+ logs: {
1425
+ stdout: { bytes: 812, sha256: '5f2a8d2298ea52f104580a1d7bb95d396497f12994fdf8f5f246abbe74aecda9', truncated: false },
1426
+ stderr: { bytes: 0, sha256: 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', truncated: false },
1427
+ },
1428
+ },
1429
+ ],
1430
+ JobLogSummary: [{ bytes: 812, sha256: '5f2a8d2298ea52f104580a1d7bb95d396497f12994fdf8f5f246abbe74aecda9', truncated: false }],
1431
+ JobLogChunk: [
1432
+ {
1433
+ stream: 'stdout',
1434
+ offset: 0,
1435
+ limit: 65536,
1436
+ totalBytes: 812,
1437
+ truncated: false,
1438
+ text: 'retro: 3 tasks inspected\n',
1439
+ },
1440
+ ],
1441
+ JobDeleteResult: [{ ok: true, id: 'nightly-retro', runsRemoved: 12 }],
1442
+ JobRunRequest: [{ requested: true, requestedAt: '2026-11-10T12:00:00.000Z', schedulerOnline: true }],
944
1443
  Meta: [
945
1444
  {
946
1445
  apiVersion: API_VERSION,
@@ -1005,15 +1504,103 @@ for (const [name, examples] of Object.entries(EXAMPLES)) {
1005
1504
 
1006
1505
  const taskIdParameters = [slugParameter];
1007
1506
 
1507
+ const jobIdParameter = {
1508
+ name: 'id',
1509
+ in: 'path',
1510
+ required: true,
1511
+ description: 'Job id: the key of one entry in `scheduler/jobs.json`.',
1512
+ schema: { type: 'string', pattern: JOB_ID_PATTERN },
1513
+ };
1514
+
1515
+ const runIdParameter = {
1516
+ name: 'runId',
1517
+ in: 'path',
1518
+ required: true,
1519
+ description: 'Run id: `YYYYMMDDTHHMMSSZ-<8 hex>`, lexicographically sortable.',
1520
+ schema: { type: 'string', pattern: RUN_ID_PATTERN },
1521
+ };
1522
+
1523
+ const JOB_LIST_PARAMETERS = [
1524
+ ...paginationParameters,
1525
+ {
1526
+ name: 'enabled',
1527
+ in: 'query',
1528
+ description: 'Restrict to enabled or disabled jobs.',
1529
+ required: false,
1530
+ schema: { type: 'boolean' },
1531
+ },
1532
+ {
1533
+ name: 'sort',
1534
+ in: 'query',
1535
+ description:
1536
+ 'Sort key. `nextFireAt` is computed in the API from the definition and `now`, so it is exact; the SQL stays an ordered read by id. There is deliberately no `q` parameter (F-1): the dashboard filters the page it has loaded.',
1537
+ required: false,
1538
+ schema: { type: 'string', enum: ['id', '-id', 'updatedAt', '-updatedAt', 'nextFireAt', '-nextFireAt'], default: 'id' },
1539
+ },
1540
+ ];
1541
+
1542
+ const jobRunStateParameter = {
1543
+ name: 'state',
1544
+ in: 'query',
1545
+ description: csvParameterDescription('run states (any subset)', [
1546
+ 'claimed',
1547
+ 'running',
1548
+ 'succeeded',
1549
+ 'failed',
1550
+ 'timeout',
1551
+ 'skipped',
1552
+ 'interrupted',
1553
+ ]),
1554
+ required: false,
1555
+ schema: { type: 'string' },
1556
+ };
1557
+
1558
+ const jobLogStreamParameter = {
1559
+ name: 'stream',
1560
+ in: 'query',
1561
+ description: 'Which captured stream to read. Streams are never interleaved.',
1562
+ required: false,
1563
+ schema: { type: 'string', enum: ['stdout', 'stderr'], default: 'stdout' },
1564
+ };
1565
+
1566
+ const jobLogOffsetParameter = {
1567
+ name: 'offset',
1568
+ in: 'query',
1569
+ description: 'Byte offset already rendered by the client.',
1570
+ required: false,
1571
+ schema: { type: 'integer', minimum: 0, maximum: 1048576, default: 0 },
1572
+ };
1573
+
1574
+ const jobLogLimitParameter = {
1575
+ name: 'limit',
1576
+ in: 'query',
1577
+ description: 'Maximum bytes to return, 1..262144.',
1578
+ required: false,
1579
+ schema: { type: 'integer', minimum: 1, maximum: 262144, default: 65536 },
1580
+ };
1581
+
1582
+ const jobWriteBody = {
1583
+ required: true,
1584
+ description: 'One job definition as `application/json`, at most 64 KiB.',
1585
+ content: { 'application/json': { schema: ref('JobWrite') } },
1586
+ };
1587
+
1588
+ const emptyBody = {
1589
+ required: false,
1590
+ description: 'Absent or an empty JSON object; any other body is rejected.',
1591
+ content: { 'application/json': { schema: object({}, []) } },
1592
+ };
1593
+
1008
1594
  const operation = (definition) => ({
1009
1595
  ...definition,
1010
1596
  security: [],
1011
1597
  });
1012
1598
 
1013
- const listOperation = (tags, summary, operationId, responseRef, parameters, extraResponses = {}) =>
1599
+ const listOperation = (tags, summary, operationId, responseRef, parameters, extraResponses = {}, description) =>
1014
1600
  operation({
1015
1601
  tags,
1016
1602
  summary,
1603
+ ...(description ? { description } : {}),
1017
1604
  operationId,
1018
1605
  parameters,
1019
1606
  responses: {
@@ -1023,6 +1610,23 @@ const listOperation = (tags, summary, operationId, responseRef, parameters, extr
1023
1610
  },
1024
1611
  });
1025
1612
 
1613
+ const jobScopedOperation = (operationId, responseRef, parameters = [jobIdParameter]) =>
1614
+ operation({
1615
+ tags: ['jobs'],
1616
+ summary: 'One job definition with its next fire and its last run',
1617
+ operationId,
1618
+ parameters,
1619
+ responses: {
1620
+ 200: jsonResponse(responseRef, 'The job-scoped payload'),
1621
+ 400: commonErrorResponses[400],
1622
+ 403: commonErrorResponses[403],
1623
+ 404: commonErrorResponses[404],
1624
+ 405: commonErrorResponses[405],
1625
+ 422: errorResponse('The job id is outside its documented shape'),
1626
+ 503: commonErrorResponses[503],
1627
+ },
1628
+ });
1629
+
1026
1630
  const taskScopedOperation = (tags, summary, operationId, responseRef, parameters = taskIdParameters) =>
1027
1631
  operation({
1028
1632
  tags,
@@ -1120,7 +1724,7 @@ export const OPENAPI_DOCUMENT = {
1120
1724
  info: {
1121
1725
  title: 'Agent team SQLite projection API',
1122
1726
  summary:
1123
- 'Projection of `.ai.local/team`. Task files are authoritative; the database is a rebuildable copy. Two mutations exist — the idempotent rescan and the confirmed task delete — and both run as bounded child processes.',
1727
+ 'Projection of `.ai.local/team`. Task files, job definitions and run manifests are authoritative; the database is a rebuildable copy. Six mutations exist — the idempotent rescan, the confirmed task delete, and the four job writes — and every one runs as a bounded child process.',
1124
1728
  description:
1125
1729
  'Loopback-only operator API. No authentication by design, no CORS, no outbound request. Errors use one `{error:{code,message,details?}}` envelope. Every non-GET/HEAD request to a read-only path returns 405 `E_METHOD_NOT_ALLOWED` with `Allow: GET, HEAD`; `GET` and `HEAD` on `/api/v1/sync` return 405 with `Allow: POST`; any other method on `/api/v1/tasks/{slug}` returns 405 with `Allow: GET, HEAD, DELETE`.',
1126
1730
  version: API_VERSION,
@@ -1142,6 +1746,7 @@ export const OPENAPI_DOCUMENT = {
1142
1746
  { name: 'documents', description: 'Raw documents by exact path' },
1143
1747
  { name: 'stats', description: 'Aggregate counts and durations' },
1144
1748
  { name: 'sync', description: 'Projection runs and the one idempotent rescan' },
1749
+ { name: 'jobs', description: 'Scheduled jobs, their runs and their logs' },
1145
1750
  ],
1146
1751
  paths: {
1147
1752
  '/': {
@@ -1296,6 +1901,156 @@ export const OPENAPI_DOCUMENT = {
1296
1901
  [slugParameter, { name: 'includeAbsent', in: 'query', required: false, schema: { type: 'boolean', default: false } }],
1297
1902
  ),
1298
1903
  },
1904
+ '/api/v1/jobs': {
1905
+ get: listOperation(
1906
+ ['jobs'],
1907
+ 'List job definitions with the next fire and the last run',
1908
+ 'listJobs',
1909
+ 'JobList',
1910
+ JOB_LIST_PARAMETERS,
1911
+ {},
1912
+ 'Reads at most `MAX_JOBS = 100` definitions: `total`, `nextOffset` and `sort=nextFireAt` are exact only below that cap, so `total` is never an unbounded count.',
1913
+ ),
1914
+ post: operation({
1915
+ tags: ['jobs'],
1916
+ summary: 'Create one job definition',
1917
+ description:
1918
+ 'The body is the file-authoritative definition (`scheduler/jobs.json`); the server never writes it directly. `createdAt` and `updatedAt` are set by the writing child. `revision` is optional and defaults to 1; a non-integer or null `revision` is 422 `E_VALIDATION`, and an integer other than 1 is 409 `E_CONFLICT` because the job does not exist yet. An invalid field is 422 `E_VALIDATION` with `details.parameter` naming it, and the file is left byte-identical; a non-JSON media type is the same 422. Executed as a bounded child (10 s, `SIGKILL`); `AI_RULES_TEAM_DB_DISABLE=1` answers 503 `E_DISABLED` before the child.',
1919
+ operationId: 'createJob',
1920
+ parameters: [],
1921
+ requestBody: jobWriteBody,
1922
+ responses: {
1923
+ 200: jsonResponse('JobDetail', 'The stored definition at its new revision'),
1924
+ 400: errorResponse('Malformed request'),
1925
+ 403: errorResponse('A non-loopback Host or Origin was rejected before routing'),
1926
+ 405: methodNotAllowedResponse,
1927
+ 409: errorResponse('The body names an existing job, or carries a revision other than 1; use `PUT /api/v1/jobs/{id}`'),
1928
+ 413: errorResponse('The body exceeds the 64 KiB JSON bound'),
1929
+ 422: errorResponse('A field is outside its documented bound or the media type is not JSON; `details.parameter` names it'),
1930
+ 503: errorResponse('The projection is disabled, the database is missing, unusable, busy, or the child exceeded its time bound'),
1931
+ },
1932
+ }),
1933
+ },
1934
+ '/api/v1/jobs/{id}': {
1935
+ get: jobScopedOperation('getJob', 'JobDetail', [jobIdParameter]),
1936
+ put: operation({
1937
+ tags: ['jobs'],
1938
+ summary: 'Update one job definition (enable and disable included)',
1939
+ description:
1940
+ 'Optimistic concurrency: `revision` is required and must equal the stored revision; a missing or stale `revision` is 409 `E_CONFLICT` and the file is untouched. The body `id` must equal the path id. Enable and disable are this same call with `enabled` flipped, so the mutating surface stays four paths. Executed as a bounded child (10 s, `SIGKILL`) behind the `E_DISABLED` guard.',
1941
+ operationId: 'updateJob',
1942
+ parameters: [jobIdParameter],
1943
+ requestBody: jobWriteBody,
1944
+ responses: {
1945
+ 200: jsonResponse('JobDetail', 'The stored definition at its incremented revision'),
1946
+ 400: errorResponse('Malformed request: an invalid job id'),
1947
+ 403: errorResponse('A non-loopback Host or Origin was rejected before routing'),
1948
+ 404: errorResponse('The job does not exist'),
1949
+ 405: methodNotAllowedResponse,
1950
+ 409: errorResponse('A missing or stale `revision`, or a body id that differs from the path id'),
1951
+ 413: errorResponse('The body exceeds the 64 KiB JSON bound'),
1952
+ 422: errorResponse('A field is outside its documented bound or the media type is not JSON; `details.parameter` names it'),
1953
+ 503: errorResponse('The projection is disabled, the database is missing, unusable, busy, or the child exceeded its time bound'),
1954
+ },
1955
+ }),
1956
+ delete: operation({
1957
+ tags: ['jobs'],
1958
+ summary: 'Delete one job, its run directories and its rows',
1959
+ description:
1960
+ 'Confirmed, destructive and irreversible. The definition leaves `scheduler/jobs.json` before the run directories and the rows, so a crash between the legs converges toward deleted and never resurrects a job. Executed as a bounded child (30 s, `SIGKILL`); the request body is ignored.',
1961
+ operationId: 'deleteJob',
1962
+ parameters: [jobIdParameter],
1963
+ responses: {
1964
+ 200: jsonResponse('JobDeleteResult', 'The deleted id and the number of removed run directories'),
1965
+ 400: errorResponse('Malformed request: an invalid job id'),
1966
+ 403: errorResponse('A non-loopback Host or Origin was rejected before routing'),
1967
+ 404: errorResponse('The job does not exist'),
1968
+ 405: methodNotAllowedResponse,
1969
+ 413: errorResponse('The body exceeds the declared bound'),
1970
+ 422: errorResponse('A parameter is outside its documented bound'),
1971
+ 503: errorResponse('The projection is disabled, the database is missing, unusable, busy, or the child exceeded its time bound'),
1972
+ },
1973
+ }),
1974
+ },
1975
+ '/api/v1/jobs/{id}/runs': {
1976
+ get: operation({
1977
+ tags: ['jobs'],
1978
+ summary: 'Run history of one job, newest first',
1979
+ description:
1980
+ '`total` is the full count for the job, so a delete confirmation can name the run count without a second call (F-2).',
1981
+ operationId: 'listJobRuns',
1982
+ parameters: [jobIdParameter, ...paginationParameters, jobRunStateParameter],
1983
+ responses: {
1984
+ 200: jsonResponse('JobRunList', 'The filtered page of runs'),
1985
+ 400: errorResponse('Malformed request: an invalid job id'),
1986
+ 403: errorResponse('A non-loopback Host or Origin was rejected before routing'),
1987
+ 404: errorResponse('The job does not exist'),
1988
+ 405: methodNotAllowedResponse,
1989
+ 422: errorResponse('A query parameter is outside its documented bounds'),
1990
+ 503: errorResponse('The database is missing, unusable or busy'),
1991
+ },
1992
+ }),
1993
+ },
1994
+ '/api/v1/jobs/{id}/runs/{runId}': {
1995
+ get: operation({
1996
+ tags: ['jobs'],
1997
+ summary: 'One run with its events, exit status and log summaries',
1998
+ operationId: 'getJobRun',
1999
+ parameters: [jobIdParameter, runIdParameter],
2000
+ responses: {
2001
+ 200: jsonResponse('JobRunDetail', 'The run manifest as projected'),
2002
+ 400: errorResponse('Malformed request: an invalid job or run id'),
2003
+ 403: errorResponse('A non-loopback Host or Origin was rejected before routing'),
2004
+ 404: errorResponse('The job or the run does not exist'),
2005
+ 405: methodNotAllowedResponse,
2006
+ 422: errorResponse('The job or run id is outside its documented shape'),
2007
+ 503: errorResponse('The database is missing, unusable or busy'),
2008
+ },
2009
+ }),
2010
+ },
2011
+ '/api/v1/jobs/{id}/runs/{runId}/log': {
2012
+ get: operation({
2013
+ tags: ['jobs'],
2014
+ summary: 'One bounded chunk of a run log',
2015
+ description:
2016
+ 'Byte-offset polling, not SSE: `offset` counts bytes already rendered and `limit` is clamped to 262144. The server reads at most `limit + 3` bytes and never loads the file. A path that resolves outside `scheduler/runs`, or a log file recorded in the manifest but missing on disk, answers 500 `E_INTERNAL`; an offset past `totalBytes` answers 416 `E_RANGE`.',
2017
+ operationId: 'getJobRunLog',
2018
+ parameters: [jobIdParameter, runIdParameter, jobLogStreamParameter, jobLogOffsetParameter, jobLogLimitParameter],
2019
+ responses: {
2020
+ 200: jsonResponse('JobLogChunk', 'The requested chunk of one stream'),
2021
+ 400: errorResponse('Malformed request: an invalid job or run id'),
2022
+ 403: errorResponse('A non-loopback Host or Origin was rejected before routing'),
2023
+ 404: errorResponse('The job or the run does not exist; a missing log file answers 500 `E_INTERNAL`'),
2024
+ 405: methodNotAllowedResponse,
2025
+ 416: errorResponse('The offset is past the end of the log'),
2026
+ 422: errorResponse('A query parameter is outside its documented bounds'),
2027
+ 500: errorResponse('A log file recorded in the manifest is missing on disk'),
2028
+ 503: errorResponse('The database is missing, unusable or busy'),
2029
+ },
2030
+ }),
2031
+ },
2032
+ '/api/v1/jobs/{id}/run': {
2033
+ post: operation({
2034
+ tags: ['jobs'],
2035
+ summary: 'Ask the running scheduler to claim one job now',
2036
+ description:
2037
+ 'Answered with 409 `E_SCHEDULER_OFFLINE` **before any enqueue** when no fresh lease exists, with `details.hint` naming `team-db.mjs schedule`; the request is written to `scheduler/state.json` and claimed on the scheduler\'s next tick. Executed as a bounded child (10 s, `SIGKILL`) behind the `E_DISABLED` guard.',
2038
+ operationId: 'runJobNow',
2039
+ parameters: [jobIdParameter],
2040
+ requestBody: emptyBody,
2041
+ responses: {
2042
+ 200: jsonResponse('JobRunRequest', 'The request was accepted by a live scheduler'),
2043
+ 400: errorResponse('Malformed request: an invalid job id'),
2044
+ 403: errorResponse('A non-loopback Host or Origin was rejected before routing'),
2045
+ 404: errorResponse('The job does not exist'),
2046
+ 405: methodNotAllowedResponse,
2047
+ 409: errorResponse('No fresh scheduler lease; `details.hint` names the command to start'),
2048
+ 413: errorResponse('The body exceeds the declared bound'),
2049
+ 422: errorResponse('A parameter is outside its documented bound'),
2050
+ 503: errorResponse('The projection is disabled, the database is missing, unusable, busy, or the child exceeded its time bound'),
2051
+ },
2052
+ }),
2053
+ },
1299
2054
  '/api/v1/stats': {
1300
2055
  get: listOperation(['stats'], 'Aggregate counts and durations', 'getStats', 'Stats', [
1301
2056
  { name: 'includeAbsent', in: 'query', required: false, schema: { type: 'boolean', default: false } },