@rt-tools/agent-kit 0.37.0 → 0.38.0

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 (436) hide show
  1. package/README.md +5 -5
  2. package/assets/checks/action-of.mjs +154 -0
  3. package/assets/checks/board-pull-state.github.mjs +82 -13
  4. package/assets/checks/board-runs.github.mjs +40 -5
  5. package/assets/checks/board.github.mjs +1 -1
  6. package/assets/checks/check-board.github.mjs +58 -19
  7. package/assets/checks/check-specs.mjs +2 -2
  8. package/assets/checks/check-state-next.mjs +22 -10
  9. package/assets/checks/check-turn-map.mjs +26 -6
  10. package/assets/checks/check-work-steps.mjs +4 -173
  11. package/assets/checks/decide.mjs +285 -0
  12. package/assets/checks/decision-table.json +21365 -0
  13. package/assets/checks/decision-table.mjs +495 -0
  14. package/assets/checks/epic-table.github.mjs +4 -3
  15. package/assets/checks/epic-window.mjs +98 -0
  16. package/assets/checks/flow-condition.mjs +64 -0
  17. package/assets/checks/flow-data.mjs +136 -0
  18. package/assets/checks/flow-forecast.mjs +330 -0
  19. package/assets/checks/flow-guard-run.mjs +90 -0
  20. package/assets/checks/flow-guard.mjs +294 -0
  21. package/assets/checks/flow-model.mjs +271 -0
  22. package/assets/checks/flow-override.mjs +130 -0
  23. package/assets/checks/flow-plan.mjs +206 -0
  24. package/assets/checks/flow-scaffold.mjs +224 -0
  25. package/assets/checks/flow-step.mjs +365 -0
  26. package/assets/checks/flow-sync.mjs +296 -0
  27. package/assets/checks/flow-syntax.mjs +292 -0
  28. package/assets/checks/flow-verdict.mjs +112 -0
  29. package/assets/checks/lib-common.mjs +10 -2
  30. package/assets/checks/lib-domains.mjs +1 -1
  31. package/assets/checks/lib-manifests.mjs +34 -2
  32. package/assets/checks/merge-read.mjs +239 -0
  33. package/assets/checks/owner-nudges.mjs +389 -0
  34. package/assets/checks/push-inputs.mjs +444 -0
  35. package/assets/checks/push-trace.mjs +108 -0
  36. package/assets/checks/record-count.mjs +410 -0
  37. package/assets/checks/record-recount.mjs +187 -0
  38. package/assets/checks/record-turn.mjs +155 -0
  39. package/assets/checks/rt-kit-checks.config.mjs +17 -2
  40. package/assets/checks/spec-anchors.mjs +4 -4
  41. package/assets/checks/spec-contract.mjs +5 -5
  42. package/assets/checks/task-flow-script.mjs +292 -0
  43. package/assets/checks/tree-assignment.mjs +26 -7
  44. package/assets/checks/work-result.mjs +281 -0
  45. package/assets/checks/work-steps-lib.mjs +205 -0
  46. package/assets/commands/next-session.md +3 -1
  47. package/assets/commands/night.md +28 -18
  48. package/assets/defaults/gate-map.sh +39 -12
  49. package/assets/defaults/merges.sh +48 -0
  50. package/assets/defaults/project.sh +43 -13
  51. package/assets/defaults/push.sh +23 -0
  52. package/assets/defaults/turn-map.md +24 -21
  53. package/assets/docs/GLOSSARY.md +6 -2
  54. package/assets/hooks/ask-judge.md +65 -0
  55. package/assets/hooks/browser-guard-device-id.sh +11 -9
  56. package/assets/hooks/browser-guard-no-asking.sh +12 -6
  57. package/assets/hooks/browser-guard-no-listing.sh +13 -7
  58. package/assets/hooks/browser-guard-no-other-drivers.sh +25 -17
  59. package/assets/hooks/browser-guard-require-select.sh +15 -15
  60. package/assets/hooks/commit-msg.sh +13 -3
  61. package/assets/hooks/conscience-guard.sh +9 -25
  62. package/assets/hooks/decide.sh +141 -0
  63. package/assets/hooks/deny-tail.sh +16 -11
  64. package/assets/hooks/dev-server-guard.sh +27 -20
  65. package/assets/hooks/dispatch.sh +47 -4
  66. package/assets/hooks/docs-guard.sh +31 -200
  67. package/assets/hooks/end-conversation-guard.sh +12 -21
  68. package/assets/hooks/epic-stop-guard.sh +54 -105
  69. package/assets/hooks/exam-guard.sh +32 -65
  70. package/assets/hooks/facts-docs.sh +221 -0
  71. package/assets/hooks/facts-flow.sh +173 -0
  72. package/assets/hooks/facts.sh +308 -0
  73. package/assets/hooks/flow-step-guard.sh +93 -0
  74. package/assets/hooks/git-guard-delivery-body.sh +4 -4
  75. package/assets/hooks/git-guard-delivery-conflict.sh +16 -10
  76. package/assets/hooks/git-guard-delivery-draft.sh +3 -3
  77. package/assets/hooks/git-guard-delivery-epic.sh +18 -9
  78. package/assets/hooks/git-guard-delivery-folder.sh +32 -7
  79. package/assets/hooks/git-guard-delivery-merge.sh +2 -2
  80. package/assets/hooks/git-guard-delivery-merged.sh +12 -1
  81. package/assets/hooks/git-guard-delivery-pipeline.sh +1 -1
  82. package/assets/hooks/git-guard-delivery-rerun.sh +32 -0
  83. package/assets/hooks/git-guard-delivery-signature.sh +82 -45
  84. package/assets/hooks/git-guard-delivery-task.sh +47 -0
  85. package/assets/hooks/git-guard-delivery.sh +112 -101
  86. package/assets/hooks/git-guard-discard.sh +8 -18
  87. package/assets/hooks/git-guard-main.sh +13 -19
  88. package/assets/hooks/git-guard-no-verify.sh +56 -16
  89. package/assets/hooks/git-guard-push-ahead.sh +46 -5
  90. package/assets/hooks/git-guard-push-marks.sh +227 -31
  91. package/assets/hooks/git-guard-push-tests.sh +51 -53
  92. package/assets/hooks/git-guard-tree-assignment.sh +7 -4
  93. package/assets/hooks/guard-note.sh +8 -6
  94. package/assets/hooks/handoff-entry-guard.sh +20 -39
  95. package/assets/hooks/handoff-write.sh +3 -1
  96. package/assets/hooks/hook-input.sh +0 -41
  97. package/assets/hooks/metric-marks.sh +19 -7
  98. package/assets/hooks/observe.sh +1 -1
  99. package/assets/hooks/override-write-guard.sh +27 -9
  100. package/assets/hooks/pre-push.sh +20 -10
  101. package/assets/hooks/prose-style-guard.sh +6 -19
  102. package/assets/hooks/pull-merges.sh +76 -0
  103. package/assets/hooks/push-set.sh +39 -7
  104. package/assets/hooks/qa-dataid-guard.sh +7 -17
  105. package/assets/hooks/record-turn.sh +52 -0
  106. package/assets/hooks/rerun-guard.sh +11 -16
  107. package/assets/hooks/reuse-first-guard.sh +7 -21
  108. package/assets/hooks/role-calls.sh +25 -3
  109. package/assets/hooks/rule-source-guard.sh +54 -21
  110. package/assets/hooks/skill-gate-rearm.sh +18 -5
  111. package/assets/hooks/skill-gate.sh +156 -20
  112. package/assets/hooks/skill-loaded.sh +18 -3
  113. package/assets/hooks/sql-guard-target.sh +2 -2
  114. package/assets/hooks/sql-guard-write.sh +12 -12
  115. package/assets/hooks/sql-guard.sh +58 -16
  116. package/assets/hooks/task-context-load.sh +3 -1
  117. package/assets/hooks/task-flow-context.sh +20 -22
  118. package/assets/hooks/task-flow-draft-guard.sh +25 -74
  119. package/assets/hooks/task-flow-guard.sh +28 -129
  120. package/assets/hooks/tree-assignment-guard.sh +25 -14
  121. package/assets/hooks/turn-entry-load.sh +3 -1
  122. package/assets/hooks/turn-exit-guard.sh +92 -452
  123. package/assets/hooks/turn-exit-role.sh +47 -0
  124. package/assets/hooks/turn-judge.md +103 -0
  125. package/assets/hooks/window-fill-guard.sh +22 -41
  126. package/assets/laws/work-conduct.md +9 -8
  127. package/assets/patterns/autonomous-work-run.md +35 -10
  128. package/assets/patterns/browser-verification-measure.md +10 -20
  129. package/assets/patterns/browser-verification-stand.md +30 -42
  130. package/assets/patterns/doc-style-human.md +0 -6
  131. package/assets/patterns/doc-style-sweep.md +7 -7
  132. package/assets/patterns/doc-style-trace.md +5 -4
  133. package/assets/patterns/doc-style-write.md +7 -7
  134. package/assets/patterns/epic-flow-declare.md +15 -8
  135. package/assets/patterns/git-workflow-commit.azure.md +9 -155
  136. package/assets/patterns/git-workflow-commit.github.md +11 -269
  137. package/assets/patterns/git-workflow-commit.gitlab.md +9 -161
  138. package/assets/patterns/git-workflow-docker.md +8 -231
  139. package/assets/patterns/git-workflow-freshness.md +9 -56
  140. package/assets/patterns/git-workflow-merge.md +7 -174
  141. package/assets/patterns/git-workflow-migration.md +5 -73
  142. package/assets/patterns/git-workflow-pr-body.github.md +6 -159
  143. package/assets/patterns/git-workflow-pr-ready.md +9 -69
  144. package/assets/patterns/git-workflow-pr.azure.md +14 -220
  145. package/assets/patterns/git-workflow-pr.github.md +13 -253
  146. package/assets/patterns/git-workflow-pr.gitlab.md +14 -241
  147. package/assets/patterns/git-workflow-restart.md +5 -41
  148. package/assets/patterns/git-workflow-secrets.md +10 -76
  149. package/assets/patterns/git-workflow-stack.md +9 -205
  150. package/assets/patterns/lib-layers-new.md +7 -3
  151. package/assets/patterns/queue-audit-read.github.md +9 -3
  152. package/assets/patterns/spec-driven-domain.md +50 -48
  153. package/assets/patterns/spec-driven-rule.md +18 -19
  154. package/assets/patterns/status-report-table.github.md +2 -2
  155. package/assets/patterns/task-flow-archive.md +15 -256
  156. package/assets/patterns/task-flow-close.md +16 -291
  157. package/assets/patterns/task-flow-cycle.md +13 -39
  158. package/assets/patterns/task-flow-graph.needs-graph.md +8 -58
  159. package/assets/patterns/task-flow-handoff.md +13 -161
  160. package/assets/patterns/task-flow-resume.md +19 -183
  161. package/assets/patterns/task-flow-start.md +9 -248
  162. package/assets/patterns/testing-e2e.md +14 -18
  163. package/assets/patterns/testing-unit.md +9 -13
  164. package/assets/patterns/turn-entry-map.md +15 -5
  165. package/assets/pitfalls/agent-kit-extend.md +200 -0
  166. package/assets/pitfalls/agent-kit.2.md +323 -0
  167. package/assets/pitfalls/angular-patterns.md +98 -0
  168. package/assets/pitfalls/autonomous-work.md +15 -0
  169. package/assets/pitfalls/browser-verification.md +265 -0
  170. package/assets/pitfalls/component-structure.md +98 -0
  171. package/assets/pitfalls/dependencies.md +92 -0
  172. package/assets/pitfalls/deploy-flow.azure.md +171 -0
  173. package/assets/pitfalls/deploy-flow.github.md +211 -0
  174. package/assets/pitfalls/deploy-flow.gitlab.md +173 -0
  175. package/assets/pitfalls/doc-style.2.md +286 -0
  176. package/assets/pitfalls/doc-style.md +3 -3
  177. package/assets/pitfalls/entity-conventions.needs-admin.md +96 -0
  178. package/assets/pitfalls/entity-models.md +89 -0
  179. package/assets/pitfalls/git-workflow-commit.azure.md +190 -0
  180. package/assets/pitfalls/git-workflow-commit.github.md +307 -0
  181. package/assets/pitfalls/git-workflow-commit.gitlab.md +196 -0
  182. package/assets/pitfalls/git-workflow-docker.md +275 -0
  183. package/assets/pitfalls/git-workflow-freshness.md +88 -0
  184. package/assets/pitfalls/git-workflow-hosting.azure.md +31 -0
  185. package/assets/pitfalls/git-workflow-hosting.github.md +32 -0
  186. package/assets/pitfalls/git-workflow-hosting.gitlab.md +31 -0
  187. package/assets/pitfalls/git-workflow-merge.md +220 -0
  188. package/assets/pitfalls/git-workflow-migration.md +103 -0
  189. package/assets/pitfalls/git-workflow-pr-body.github.md +185 -0
  190. package/assets/pitfalls/git-workflow-pr-ready.md +104 -0
  191. package/assets/pitfalls/git-workflow-pr.2.azure.md +172 -0
  192. package/assets/pitfalls/git-workflow-pr.2.github.md +184 -0
  193. package/assets/pitfalls/git-workflow-pr.2.gitlab.md +180 -0
  194. package/assets/pitfalls/git-workflow-pr.azure.md +159 -0
  195. package/assets/pitfalls/git-workflow-pr.github.md +107 -0
  196. package/assets/pitfalls/git-workflow-pr.gitlab.md +151 -0
  197. package/assets/pitfalls/git-workflow-push.azure.md +30 -0
  198. package/assets/pitfalls/git-workflow-push.github.md +30 -0
  199. package/assets/pitfalls/git-workflow-push.gitlab.md +30 -0
  200. package/assets/pitfalls/git-workflow-queue.azure.md +30 -0
  201. package/assets/pitfalls/git-workflow-queue.github.md +30 -0
  202. package/assets/pitfalls/git-workflow-queue.gitlab.md +30 -0
  203. package/assets/pitfalls/git-workflow-restart.md +72 -0
  204. package/assets/pitfalls/git-workflow-secrets.md +114 -0
  205. package/assets/pitfalls/git-workflow-stack.md +254 -0
  206. package/assets/pitfalls/git-workflow.2.azure.md +291 -0
  207. package/assets/pitfalls/git-workflow.2.github.md +294 -0
  208. package/assets/pitfalls/git-workflow.2.gitlab.md +278 -0
  209. package/assets/pitfalls/git-workflow.github.md +5 -9
  210. package/assets/pitfalls/lib-layers.md +114 -0
  211. package/assets/pitfalls/lists.md +117 -0
  212. package/assets/pitfalls/navigation.md +94 -0
  213. package/assets/pitfalls/reuse-first.md +201 -0
  214. package/assets/pitfalls/spec-driven.2.md +318 -0
  215. package/assets/pitfalls/spec-driven.md +9 -7
  216. package/assets/pitfalls/styling-bem.2.md +125 -0
  217. package/assets/pitfalls/task-flow-archive.md +264 -0
  218. package/assets/pitfalls/task-flow-close.2.md +165 -0
  219. package/assets/pitfalls/task-flow-close.md +167 -0
  220. package/assets/pitfalls/task-flow-cycle.md +73 -0
  221. package/assets/pitfalls/task-flow-graph.needs-graph.md +98 -0
  222. package/assets/pitfalls/task-flow-handoff.md +200 -0
  223. package/assets/pitfalls/task-flow-handover.md +30 -0
  224. package/assets/pitfalls/task-flow-owner.md +29 -0
  225. package/assets/pitfalls/task-flow-plan.md +29 -0
  226. package/assets/pitfalls/task-flow-resume.md +257 -0
  227. package/assets/pitfalls/task-flow-start.md +287 -0
  228. package/assets/pitfalls/task-flow.2.md +303 -0
  229. package/assets/pitfalls/task-flow.md +18 -29
  230. package/assets/pitfalls/testing.2.md +279 -0
  231. package/assets/pitfalls/testing.md +11 -12
  232. package/assets/pitfalls/turn-conduct.md +17 -18
  233. package/assets/pitfalls/typescript-conventions.md +161 -0
  234. package/assets/pitfalls/write-a-skill.md +128 -0
  235. package/assets/rules/angular-patterns.md +21 -86
  236. package/assets/rules/autonomous-work.md +37 -29
  237. package/assets/rules/browser-verification.md +28 -251
  238. package/assets/rules/component-structure.md +25 -87
  239. package/assets/rules/dependencies.md +20 -78
  240. package/assets/rules/deploy-flow.azure.md +27 -134
  241. package/assets/rules/deploy-flow.github.md +34 -196
  242. package/assets/rules/deploy-flow.gitlab.md +28 -137
  243. package/assets/rules/doc-style.md +32 -282
  244. package/assets/rules/entity-conventions.needs-admin.md +26 -82
  245. package/assets/rules/entity-models.md +14 -63
  246. package/assets/rules/epic-flow.md +5 -3
  247. package/assets/rules/git-workflow-hosting.azure.md +26 -0
  248. package/assets/rules/git-workflow-hosting.github.md +38 -0
  249. package/assets/rules/git-workflow-hosting.gitlab.md +27 -0
  250. package/assets/rules/git-workflow-push.azure.md +28 -0
  251. package/assets/rules/git-workflow-push.github.md +28 -0
  252. package/assets/rules/git-workflow-push.gitlab.md +28 -0
  253. package/assets/rules/git-workflow-queue.azure.md +23 -0
  254. package/assets/rules/git-workflow-queue.github.md +30 -0
  255. package/assets/rules/git-workflow-queue.gitlab.md +23 -0
  256. package/assets/rules/git-workflow.azure.md +21 -264
  257. package/assets/rules/git-workflow.github.md +24 -285
  258. package/assets/rules/git-workflow.gitlab.md +21 -258
  259. package/assets/rules/lib-layers.md +30 -103
  260. package/assets/rules/lists.md +21 -105
  261. package/assets/rules/navigation.md +10 -69
  262. package/assets/rules/queue-audit.github.md +5 -3
  263. package/assets/rules/reuse-first.md +20 -195
  264. package/assets/rules/spec-driven.md +35 -316
  265. package/assets/rules/status-report.md +5 -3
  266. package/assets/rules/styling-bem.md +20 -117
  267. package/assets/rules/task-flow-handover.md +24 -0
  268. package/assets/rules/task-flow-owner.md +34 -0
  269. package/assets/rules/task-flow-plan.md +38 -0
  270. package/assets/rules/task-flow.md +22 -289
  271. package/assets/rules/testing.md +32 -270
  272. package/assets/rules/turn-conduct.md +109 -111
  273. package/assets/rules/turn-entry.md +2 -2
  274. package/assets/rules/typescript-conventions.md +41 -147
  275. package/assets/samples/tasks/_template/plan.md +30 -6
  276. package/assets/samples/tasks/_template/progress.md +0 -1
  277. package/assets/skills/agent-kit-extend.md +25 -168
  278. package/assets/skills/agent-kit.md +27 -299
  279. package/assets/skills/write-a-skill.md +20 -106
  280. package/assets/task-flow/flow.js +188 -0
  281. package/assets/task-flow/flow.md +102 -0
  282. package/assets/task-flow/measure/agreement.mjs +24 -0
  283. package/assets/task-flow/measure/copy.mjs +22 -0
  284. package/assets/task-flow/measure/epic-of.mjs +50 -0
  285. package/assets/task-flow/measure/epic-text.mjs +35 -0
  286. package/assets/task-flow/measure/epic.mjs +114 -0
  287. package/assets/task-flow/measure/folder.mjs +16 -0
  288. package/assets/task-flow/measure/footprint.mjs +28 -0
  289. package/assets/task-flow/measure/grill.mjs +21 -0
  290. package/assets/task-flow/measure/host.mjs +8 -0
  291. package/assets/task-flow/measure/owner.mjs +20 -0
  292. package/assets/task-flow/measure/plan.mjs +27 -0
  293. package/assets/task-flow/measure/pr.mjs +20 -0
  294. package/assets/task-flow/measure/progress.mjs +50 -0
  295. package/assets/task-flow/measure/session.mjs +175 -0
  296. package/assets/task-flow/measure/task.mjs +23 -0
  297. package/assets/task-flow/measure/text.mjs +77 -0
  298. package/assets/task-flow/source/git.mjs +86 -0
  299. package/assets/task-flow/source/host.mjs +172 -0
  300. package/assets/task-flow/source/marks.mjs +56 -0
  301. package/assets/task-flow/source/owner.mjs +74 -0
  302. package/assets/task-flow/source/records.mjs +116 -0
  303. package/assets/task-flow/source/session.mjs +232 -0
  304. package/assets/task-flow/source/steps.mjs +28 -0
  305. package/assets/task-flow/source/tree.mjs +42 -0
  306. package/assets/templates/rule.md +2 -2
  307. package/bin/agent-kit.d.ts.map +1 -1
  308. package/bin/agent-kit.js +30 -0
  309. package/bin/agent-kit.js.map +1 -1
  310. package/lib/agent-checks.d.ts +55 -0
  311. package/lib/agent-checks.d.ts.map +1 -0
  312. package/lib/agent-checks.js +209 -0
  313. package/lib/agent-checks.js.map +1 -0
  314. package/lib/assets.d.ts.map +1 -1
  315. package/lib/assets.js +7 -2
  316. package/lib/assets.js.map +1 -1
  317. package/lib/cargo-prose.d.ts +2 -1
  318. package/lib/cargo-prose.d.ts.map +1 -1
  319. package/lib/cargo-prose.js.map +1 -1
  320. package/lib/cargo.d.ts +29 -0
  321. package/lib/cargo.d.ts.map +1 -1
  322. package/lib/cargo.js +27 -1
  323. package/lib/cargo.js.map +1 -1
  324. package/lib/cascade.d.ts.map +1 -1
  325. package/lib/cascade.js +3 -1
  326. package/lib/cascade.js.map +1 -1
  327. package/lib/commands.d.ts.map +1 -1
  328. package/lib/commands.js +78 -2
  329. package/lib/commands.js.map +1 -1
  330. package/lib/companion.d.ts +0 -5
  331. package/lib/companion.d.ts.map +1 -1
  332. package/lib/companion.js +1 -1
  333. package/lib/companion.js.map +1 -1
  334. package/lib/config.d.ts +18 -0
  335. package/lib/config.d.ts.map +1 -1
  336. package/lib/config.js +18 -1
  337. package/lib/config.js.map +1 -1
  338. package/lib/cost.d.ts +0 -8
  339. package/lib/cost.d.ts.map +1 -1
  340. package/lib/cost.js +4 -4
  341. package/lib/cost.js.map +1 -1
  342. package/lib/epic-window-send.d.ts +74 -0
  343. package/lib/epic-window-send.d.ts.map +1 -0
  344. package/lib/epic-window-send.js +166 -0
  345. package/lib/epic-window-send.js.map +1 -0
  346. package/lib/hooks-map.d.ts +4 -12
  347. package/lib/hooks-map.d.ts.map +1 -1
  348. package/lib/hooks-map.js +4 -27
  349. package/lib/hooks-map.js.map +1 -1
  350. package/lib/integrity.d.ts +3 -0
  351. package/lib/integrity.d.ts.map +1 -1
  352. package/lib/integrity.js +7 -0
  353. package/lib/integrity.js.map +1 -1
  354. package/lib/metric-lines.d.ts +2 -1
  355. package/lib/metric-lines.d.ts.map +1 -1
  356. package/lib/metric-lines.js +49 -1
  357. package/lib/metric-lines.js.map +1 -1
  358. package/lib/metric-send-mark.d.ts +6 -3
  359. package/lib/metric-send-mark.d.ts.map +1 -1
  360. package/lib/metric-send-mark.js +15 -5
  361. package/lib/metric-send-mark.js.map +1 -1
  362. package/lib/metric-send.d.ts +6 -2
  363. package/lib/metric-send.d.ts.map +1 -1
  364. package/lib/metric-send.js +47 -13
  365. package/lib/metric-send.js.map +1 -1
  366. package/lib/metrics.d.ts +17 -0
  367. package/lib/metrics.d.ts.map +1 -1
  368. package/lib/metrics.js +26 -15
  369. package/lib/metrics.js.map +1 -1
  370. package/lib/observations-cargo.d.ts +1 -5
  371. package/lib/observations-cargo.d.ts.map +1 -1
  372. package/lib/observations-cargo.js +2 -2
  373. package/lib/observations-cargo.js.map +1 -1
  374. package/lib/observations.d.ts +0 -2
  375. package/lib/observations.d.ts.map +1 -1
  376. package/lib/observations.js +3 -3
  377. package/lib/observations.js.map +1 -1
  378. package/lib/order.d.ts +0 -2
  379. package/lib/order.d.ts.map +1 -1
  380. package/lib/order.js +0 -4
  381. package/lib/order.js.map +1 -1
  382. package/lib/outcomes.d.ts +7 -9
  383. package/lib/outcomes.d.ts.map +1 -1
  384. package/lib/outcomes.js +8 -7
  385. package/lib/outcomes.js.map +1 -1
  386. package/lib/proposals.d.ts +0 -1
  387. package/lib/proposals.d.ts.map +1 -1
  388. package/lib/proposals.js +1 -1
  389. package/lib/proposals.js.map +1 -1
  390. package/lib/push-gate.d.ts +13 -0
  391. package/lib/push-gate.d.ts.map +1 -1
  392. package/lib/push-gate.js +11 -7
  393. package/lib/push-gate.js.map +1 -1
  394. package/lib/push-set-usefulness.d.ts +78 -0
  395. package/lib/push-set-usefulness.d.ts.map +1 -0
  396. package/lib/push-set-usefulness.js +225 -0
  397. package/lib/push-set-usefulness.js.map +1 -0
  398. package/lib/shipment.d.ts +2 -11
  399. package/lib/shipment.d.ts.map +1 -1
  400. package/lib/shipment.fixture.d.ts +0 -3
  401. package/lib/shipment.fixture.d.ts.map +1 -1
  402. package/lib/shipment.fixture.js +3 -3
  403. package/lib/shipment.fixture.js.map +1 -1
  404. package/lib/shipment.js +2 -2
  405. package/lib/shipment.js.map +1 -1
  406. package/lib/sync.d.ts +10 -0
  407. package/lib/sync.d.ts.map +1 -1
  408. package/lib/sync.js +14 -1
  409. package/lib/sync.js.map +1 -1
  410. package/lib/traits.d.ts +0 -3
  411. package/lib/traits.d.ts.map +1 -1
  412. package/lib/traits.js +2 -2
  413. package/lib/traits.js.map +1 -1
  414. package/lib/variants.d.ts +0 -1
  415. package/lib/variants.d.ts.map +1 -1
  416. package/lib/variants.js +1 -1
  417. package/lib/variants.js.map +1 -1
  418. package/lib/work-result.d.ts +43 -0
  419. package/lib/work-result.d.ts.map +1 -0
  420. package/lib/work-result.js +39 -0
  421. package/lib/work-result.js.map +1 -0
  422. package/package.json +1 -1
  423. package/assets/checks/signals/ui-kit.json +0 -11
  424. package/assets/hooks/claim-guard.sh +0 -212
  425. package/assets/hooks/grill-gate-ask.sh +0 -26
  426. package/assets/hooks/grill-gate-bypass.sh +0 -61
  427. package/assets/hooks/grill-gate-options.sh +0 -50
  428. package/assets/hooks/grill-gate.sh +0 -482
  429. package/assets/hooks/postmortem-guard.sh +0 -124
  430. package/assets/hooks/proposal-guard.sh +0 -154
  431. package/assets/hooks/stand-login-guard.sh +0 -107
  432. package/assets/hooks/turn-exit-epic.sh +0 -173
  433. package/assets/hooks/turn-exit-patterns.sh +0 -123
  434. package/assets/hooks/turn-exit-verdict.sh +0 -149
  435. package/assets/hooks/waiting-turn-guard.sh +0 -320
  436. package/assets/hooks/work-start-guard.sh +0 -175
@@ -38,7 +38,7 @@ rt_folder_was_in_branch() {
38
38
  # checked-out branch carries a folder the named PR does not have. The tree of the head is read from
39
39
  # the remote ref. Without a head, or without its ref, the checked-out branch is judged, as before.
40
40
  rt_delivery_folder_target() {
41
- _branch="$(git branch --show-current 2>/dev/null)"
41
+ _branch="$(rt_fact_branch)"
42
42
  _tree=HEAD
43
43
  [ -n "$1" ] && [ "$1" != "$_branch" ] || return 0
44
44
  git rev-parse --verify --quiet "refs/remotes/origin/$1" >/dev/null 2>&1 || return 0
@@ -46,6 +46,29 @@ rt_delivery_folder_target() {
46
46
  _tree="refs/remotes/origin/$1"
47
47
  }
48
48
 
49
+ # A sentence for a refusal whose fix is a commit in the branch the folder lies in. Two things refuse
50
+ # that commit next: a copy standing on another branch commits elsewhere — on the main one it is
51
+ # refused outright — and a contribution under a foreign signature refuses every commit until it is
52
+ # rewritten, and the neighbouring guards may want their own move first — the document pair, the
53
+ # exam. Each is named before the commit. Argument: the branch the folder lies in.
54
+ rt_folder_commit_where() {
55
+ # The words go to `_where`, and the facts of that commit to the table: where the copy stands and
56
+ # whether the contribution carries a foreign signature. What the neighbouring guards want before
57
+ # the commit — the document pair, the exam — the decider names from their rows.
58
+ _where=''
59
+ _here="$(rt_fact_branch)"
60
+ if [ -n "$1" ] && [ "$1" != "$_here" ]; then
61
+ [ "$_here" = "$main_branch" ] && fact branch_is_main yes
62
+ _where="$(printf ' The folder lies in the branch «%s», and the copy stands on «%s»: switch to it first — git checkout %s — and commit there.' "$1" "${_here:-a detached head}" "$1")"
63
+ return 0
64
+ fi
65
+ command -v rt_signature_commit_note >/dev/null 2>&1 && _where="$(rt_signature_commit_note)"
66
+ [ -n "$_where" ] && fact commits_signed_declared no
67
+ # No foreign signature: the word of the neighbours the commit meets goes here, the decider puts it.
68
+ [ -n "$_where" ] || _where='{first}'
69
+ return 0
70
+ }
71
+
49
72
  # Condition for opening the PR: the folder is taken apart, and a record from the branch has arrived
50
73
  # in the archive. The refusal accumulates together with the other delivery conditions and is
51
74
  # printed all at once.
@@ -64,7 +87,7 @@ rt_delivery_open_folder() {
64
87
  _folder="$tasks_dir/$branch"
65
88
  _lying="$(rt_folder_in_branch "$_folder")"
66
89
  if [ -n "$_lying" ]; then
67
- fault "the branch carries the task folder «${_lying}» — a request is opened after the tidying, not before it. Move to «${archive_dir:-archive}» what explains the decisions taken, delete the rest, commit it by the last commit and repeat. If the work is merged in parts, put the comment «# Task-folder-skip: <reason>» into the command."
90
+ rt_folder_commit_where "$branch" && unmet task_folder_in_branch yes "the branch carries the task folder «${_lying}» — a request is opened after the tidying, not before it. Move to «${archive_dir:-archive}» what explains the decisions taken, delete the rest, commit it by the last commit and repeat. If the work is merged in parts, put the comment «# Task-folder-skip: <reason>» into the command.${_where}"
68
91
  return 0
69
92
  fi
70
93
 
@@ -81,7 +104,7 @@ rt_delivery_open_folder() {
81
104
  [ -n "$_plan" ] || continue
82
105
  _draft="$(rt_branch_plan_draft "${_plan%/plan.md}" "$_base")"
83
106
  [ -n "$_draft" ] && [ -n "$(git ls-tree -d --name-only HEAD -- "${_draft%/}" 2>/dev/null)" ] \
84
- && fault "the branch carries the unmerged agreement «${_draft}» its plan named — merge its rules and scenarios into the domain spec, remove the directory by a commit and repeat. If the work is merged in parts, put the comment «# Task-folder-skip: <reason>» into the command."
107
+ && unmet draft_spec_merged no "the branch carries the unmerged agreement «${_draft}» its plan named — merge its rules and scenarios into the domain spec, remove the directory by a commit and repeat. If the work is merged in parts, put the comment «# Task-folder-skip: <reason>» into the command."
85
108
  done <<EOF
86
109
  $(git log --format= --name-only "$_base..HEAD" -- "$tasks_dir/*/plan.md" 2>/dev/null | sort -u)
87
110
  EOF
@@ -92,7 +115,7 @@ EOF
92
115
 
93
116
  _gained="$(git diff --name-only --diff-filter=A "$_base" HEAD -- "$archive_dir" 2>/dev/null | head -1)"
94
117
  [ -z "$_gained" ] \
95
- && fault "the task folder was deleted, but the branch added nothing to «${archive_dir}». Deleting is cheaper than taking apart — and together with the folder the analysis of the request is gone, the only record of the words of the owner. Move what explains the decisions taken as one file with a telling name and repeat."
118
+ && rt_folder_commit_where "$branch" && unmet archive_gained no "the task folder was deleted, but the branch added nothing to «${archive_dir}». Deleting is cheaper than taking apart — and together with the folder the analysis of the request is gone, the only record of the words of the owner. Move what explains the decisions taken as one file with a telling name, commit it and repeat.${_where}"
96
119
  }
97
120
 
98
121
  # The base the opening command names. Absent — the host takes the default branch: an empty answer.
@@ -133,7 +156,7 @@ rt_delivery_ready_folder() {
133
156
 
134
157
  _lying="$(rt_folder_in_branch "$tasks_dir/$_branch" "$_tree")"
135
158
  [ -n "$_lying" ] \
136
- && fault "the branch carries the task folder «${_lying}» — a lifted draft reads as «ready to merge», and merging it there is not allowed. The button is pressed by a person on the hosting, and the folder reaches main before their hand does. Move to «${archive_dir:-archive}» what explains the decisions taken, delete the rest, commit and repeat. If the work is merged in parts, put the comment «# Task-folder-skip: <reason>» into the command."
159
+ && rt_folder_commit_where "$_branch" && unmet task_folder_in_branch yes "the branch carries the task folder «${_lying}» — a lifted draft reads as «ready to merge», and merging it there is not allowed. The button is pressed by a person on the hosting, and the folder reaches main before their hand does. Move to «${archive_dir:-archive}» what explains the decisions taken, delete the rest, commit and repeat. If the work is merged in parts, put the comment «# Task-folder-skip: <reason>» into the command.${_where}"
137
160
  }
138
161
 
139
162
  # Condition for the merge: the same subject as a second line. It catches a merge going by command —
@@ -165,7 +188,8 @@ rt_delivery_merge_folder() {
165
188
 
166
189
  _lying="$(rt_folder_in_branch "$_folder" "$_tree")"
167
190
  [ -n "$_lying" ] \
168
- && deny "BLOCKED: the task folder «${_lying}» is left in the branch — it will travel into main. There will be nobody to take it apart later: the work moves on to the next task, and this request closes. Move to «${archive_dir:-archive}» what explains the decisions taken, delete the rest and repeat. If the work is merged in parts, put the line «Task-folder-skip: <reason>» into the body of the request."
191
+ && rt_folder_commit_where "$_branch" && fact task_folder_in_branch yes \
192
+ && refuse pr_merge "$(jq -cn --arg l "$_lying" --arg a "${archive_dir:-archive}" --arg w "${_where%\{first\}}" '{lying:$l, archive_dir:$a, where:$w}')"
169
193
 
170
194
  [ -n "$archive_dir" ] || exit 0
171
195
  _base="$(git merge-base "$main_branch" "$_tree" 2>/dev/null)"
@@ -174,7 +198,8 @@ rt_delivery_merge_folder() {
174
198
 
175
199
  _gained="$(git diff --name-only --diff-filter=A "$_base" "$_tree" -- "$archive_dir" 2>/dev/null | head -1)"
176
200
  [ -z "$_gained" ] \
177
- && deny "BLOCKED: the task folder was deleted, but the branch added nothing to «${archive_dir}». Deleting is cheaper than taking apart — and together with the folder the analysis of the request is gone, the only record of the words of the owner. Move what explains the decisions taken as one file with a telling name and repeat."
201
+ && rt_folder_commit_where "$_branch" && fact archive_gained no \
202
+ && refuse pr_merge "$(jq -cn --arg a "$archive_dir" --arg w "${_where%\{first\}}" '{archive_dir:$a, where:$w}')"
178
203
 
179
204
  exit 0
180
205
  }
@@ -24,9 +24,9 @@ rt_delivery_merge_run() {
24
24
  name="${name:-$ref}"
25
25
  case "$run" in
26
26
  failure)
27
- fault "the run on the tip of the request${name:+ #${name}} is red. A merge over red carries the breakage into the branch, and every next request into it turns red. Read the run — gh run list --commit <tip> — fix it in the branch and repeat." ;;
27
+ unmet pr_tip_run failure "the run on the tip of the request${name:+ #${name}} is red. A merge over red carries the breakage into the branch, and every next request into it turns red. Read the run — gh run list --commit <tip> — fix it in the branch and repeat." ;;
28
28
  running)
29
- fault "the run on the tip of the request${name:+ #${name}} has not finished. A merge before its end carries what it has not checked yet. Wait for its end and read the result by a command." ;;
29
+ unmet pr_tip_run running "the run on the tip of the request${name:+ #${name}} has not finished. A merge before its end carries what it has not checked yet. Wait for its end and read the result by a command." ;;
30
30
  esac
31
31
  return 0
32
32
  }
@@ -61,5 +61,16 @@ rt_delivery_merged() {
61
61
  _merged="$(cd "$root" && rt_pull_merged "$_target" 2>/dev/null)" || return 0
62
62
  [ -n "$_merged" ] || return 0
63
63
 
64
- deny "BLOCKED: the PR #${_merged} of the branch «${_target}» is merged, and the branch has no open PR. The host deleted the branch with the merge, and this push recreates it with commits nobody will merge. Take a new branch from the fresh base and move the commits there: git fetch origin && git checkout -b <new branch> origin/<base> && git cherry-pick <commits>."
64
+ # The move named below is new work: a task and its branch. Both are refused while a conflicting
65
+ # request of one's own stands or the copy has no assignment, so those are asked first and named
66
+ # in place of the creation.
67
+ fact branch_pr_merged yes
68
+ command -v rt_delivery_conflict >/dev/null 2>&1 && rt_delivery_conflict 'moving the commits of a merged branch into a new task'
69
+ faults=''
70
+ command -v rt_assignment_unmet >/dev/null 2>&1 && rt_assignment_unmet '' 'a new task for these commits'
71
+ # The words after the first sentence: the misses that refuse taking the new task, or the way to it.
72
+ _rest="Create a new task for these commits — ${task_new:-npm run task:new} — then take its branch from the fresh base and move the commits there: git fetch origin && git checkout -b <task branch> origin/<base> && git cherry-pick <commits>."
73
+ [ -n "$faults" ] && _rest="The commits move into a new task, and taking it is refused now:
74
+ ${faults}"
75
+ refuse push "$(jq -cn --arg m "$_merged" --arg t "$_target" --arg r "$_rest" '{merged:$m, target:$t, rest:$r}')"
65
76
  }
@@ -95,5 +95,5 @@ rt_delivery_pull_draft() {
95
95
  $bases
96
96
  EOF
97
97
 
98
- fault "a draft into «${base}»: the pipeline «${file##*/}» wakes for a request only into $(printf '%s' "$bases" | tr '\n' ' ' | sed 's/ $//'), so no run will come and the draft will wait for nothing. Open the request ready, without --draft, and set the reviewer in the same call."
98
+ unmet_class pr_create_draft "a draft into «${base}»: the pipeline «${file##*/}» wakes for a request only into $(printf '%s' "$bases" | tr '\n' ' ' | sed 's/ $//'), so no run will come and the draft will wait for nothing. Open the request ready, without --draft, and set the reviewer in the same call."
99
99
  }
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env bash
2
+ # The rerun of the done steps before a PR opens, for the delivery guard. NOT a guard: it has no
3
+ # `rt-hook:` declaration and hooks into no agent event. The delivery guard sources it and calls
4
+ # `rt_delivery_rerun` on a PR opening, before it names what is unmet.
5
+ #
6
+ # Only the engine marks a step done, and the work-conduct guard refuses a hand mark. A script that
7
+ # writes the done mark and a step mark past both is caught here: every step the progress marks done
8
+ # is measured once more, whatever mark lies on disk, and a step that does not match keeps the PR
9
+ # closed. The engine puts a taken-apart task folder back from the history for the run.
10
+ #
11
+ # FAIL-OPEN: no node, no engine, a branch with no plan or a plan with no checks — nothing is judged.
12
+
13
+ rt_delivery_rerun() {
14
+ command -v node >/dev/null 2>&1 || return 0
15
+ local engine="" candidate out code
16
+ for candidate in "$rt_hooks_dir/../checks/task-flow-script.mjs" "${CLAUDE_PROJECT_DIR:-.}/tools/task-flow-script.mjs"; do
17
+ [ -f "$candidate" ] && engine="$candidate" && break
18
+ done
19
+ [ -n "$engine" ] || return 0
20
+ local dir="${root:-${CLAUDE_PROJECT_DIR:-.}}" pinned run_path="$PATH"
21
+ # The checks run on the node the tree pins in .nvmrc, as they ran when measured: the session may
22
+ # carry another default, and a tree with an engines field refuses it.
23
+ pinned="$(tr -d ' \n' < "$dir/.nvmrc" 2>/dev/null)"
24
+ pinned="${NVM_DIR:-$HOME/.nvm}/versions/node/v${pinned#v}/bin"
25
+ [ -x "$pinned/node" ] && run_path="$pinned:$PATH"
26
+ out="$(cd "$dir" && PATH="$run_path" node "$engine" step --done --pr 2>&1)"
27
+ code=$?
28
+ [ "$code" -eq 0 ] && return 0
29
+ unmet steps_remeasured no "the done steps of the plan were measured once more before the PR, and not every one matched:
30
+ $(printf '%s\n' "$out" | sed 's/^/ /')
31
+ Fix what the step measures and run \`node tools/task-flow-script.mjs step N.M\` again: it marks the step done when the check matches."
32
+ }
@@ -34,11 +34,76 @@ rt_delivery_branch_signature() {
34
34
  [ "$tree_email" = "$one" ] && human_email=1 && break
35
35
  done
36
36
  [ -n "$tree_email" ] && [ "$tree_email" != "$commit_email" ] && [ -z "$human_email" ] \
37
- && fault "the working copy signs commits as «${tree_email}», while the tree declared the email of the machine account «${commit_email}». The very first commit leaves under a foreign signature: git config user.email \"${commit_email}\"."
37
+ && unmet worktree_email_declared no "the working copy signs commits as «${tree_email}», while the tree declared the email of the machine account «${commit_email}». The very first commit leaves under a foreign signature: git config user.email \"${commit_email}\"."
38
38
  fi
39
39
  return 0
40
40
  }
41
41
 
42
+ # The commits of the contribution signed past the declaration, in two lists: `strangers` — a machine
43
+ # commit with a foreign mail, `unknown` — a mail the tree never named. Silent with no declared mail
44
+ # or no tip of the main branch. Used by the signature point below and by every refusal that names a
45
+ # commit as its move: such a commit is refused while the divergence stands, so the refusal names the
46
+ # rewrite first.
47
+ rt_signature_divergence() {
48
+ strangers=''
49
+ unknown=''
50
+ [ -n "$commit_email" ] || return 0
51
+ git rev-parse --verify --quiet "refs/remotes/origin/${main_branch}" >/dev/null 2>&1 || return 0
52
+ bot_login="${commit_email%%@*}"
53
+ bot_login="${bot_login##*+}"
54
+ while IFS="$(printf '\t')" read -r short author email; do
55
+ [ -z "$short" ] && continue
56
+ login="${email%%@*}"
57
+ login="${login##*+}"
58
+ [ "$author" = "$bot_login" ] || [ "$login" = "$bot_login" ] || continue
59
+ [ "$email" = "$commit_email" ] && continue
60
+ strangers="${strangers}${strangers:+, }${short} <${email}>"
61
+ done <<EOF
62
+ $(git log --format='%h%x09%an%x09%ae' "origin/${main_branch}..HEAD" 2>/dev/null)
63
+ EOF
64
+
65
+ # A commit under a record the tree has not declared used to pass silently: the helper judged
66
+ # only a commit that called itself the machine record, and five commits in a row under a foreign
67
+ # login did not fall under that condition at all. The hole is wider than the one the helper
68
+ # closes.
69
+ #
70
+ # This half is switched on by the tree, by naming the mails of people in a profile key: without
71
+ # it, demanding a known signature from every commit would refuse work done by a person with
72
+ # their own hands. Named — then the machine record and the listed people are known, and
73
+ # everything else is refused.
74
+ [ -n "${RT_HUMAN_EMAILS:-}" ] || return 0
75
+ while IFS="$(printf '\t')" read -r short author email; do
76
+ [ -z "$short" ] && continue
77
+ [ "$email" = "$commit_email" ] && continue
78
+ known=''
79
+ for one in $RT_HUMAN_EMAILS; do
80
+ [ "$email" = "$one" ] && known=1 && break
81
+ done
82
+ [ -n "$known" ] && continue
83
+ unknown="${unknown}${unknown:+, }${short} <${email}>"
84
+ done <<EOF
85
+ $(git log --format='%h%x09%an%x09%ae' "origin/${main_branch}..HEAD" 2>/dev/null)
86
+ EOF
87
+ return 0
88
+ }
89
+
90
+ # A sentence for a refusal whose fix is a commit while the copy stands on the main branch: the commit
91
+ # guard refuses every commit there, so the first move is a branch. A branch with no task number is
92
+ # judged by no delivery guard and is taken at once.
93
+ rt_signature_where() {
94
+ [ "$(rt_fact_branch)" = "${main_branch:-main}" ] || return 0
95
+ printf ' The copy stands on «%s», where every commit is refused: take a local branch first — git checkout -b <name> — and rewrite there.' "${main_branch:-main}"
96
+ }
97
+
98
+ # A sentence for a refusal that names a commit as its move: while the contribution carries a
99
+ # diverging signature, the signature point refuses that commit, so the rewrite is named first.
100
+ rt_signature_commit_note() {
101
+ rt_signature_divergence
102
+ [ -n "$strangers$unknown" ] || return 0
103
+ printf ' The branch carries commits under a foreign signature — %s: before this commit rewrite it, on your task branch — GIT_AUTHOR_EMAIL="%s" GIT_COMMITTER_EMAIL="%s" git commit --amend --no-edit --reset-author.' \
104
+ "${strangers}${strangers:+${unknown:+, }}${unknown}" "$commit_email" "$commit_email"
105
+ }
106
+
42
107
  rt_delivery_signature() {
43
108
  # --- the signature of a machine commit ----------------------------------------------------
44
109
  #
@@ -124,52 +189,24 @@ if printf '%s' "$cmd" | grep -qE "${RT_CMD_BOUND}git([[:space:]]|\$)" \
124
189
  repair=1
125
190
  fi
126
191
 
127
- strangers=''
128
- while IFS="$(printf '\t')" read -r short author email; do
129
- [ -z "$short" ] && continue
130
- login="${email%%@*}"
131
- login="${login##*+}"
132
- [ "$author" = "$bot_login" ] || [ "$login" = "$bot_login" ] || continue
133
- [ "$email" = "$commit_email" ] && continue
134
- strangers="${strangers}${strangers:+, }${short} <${email}>"
135
- done <<EOF
136
- $(git log --format='%h%x09%an%x09%ae' "origin/${main_branch}..HEAD" 2>/dev/null)
137
- EOF
192
+ rt_signature_divergence
193
+ where="$(rt_signature_where)"
138
194
 
139
- # A commit under a record the tree has not declared used to pass silently: the helper
140
- # judged only a commit that called itself the machine record, and five commits in a row
141
- # under a foreign login did not fall under that condition at all. The hole is wider than the
142
- # one the helper closes.
143
- #
144
- # This half is switched on by the tree, by naming the mails of people in a profile key:
145
- # without it, demanding a known signature from every commit would refuse work done by a
146
- # person with their own hands. Named — then the machine record and the listed people are
147
- # known, and everything else is refused.
148
- unknown=''
149
- if [ -n "${RT_HUMAN_EMAILS:-}" ]; then
150
- while IFS="$(printf '\t')" read -r short author email; do
151
- [ -z "$short" ] && continue
152
- [ "$email" = "$commit_email" ] && continue
153
- known=''
154
- for one in $RT_HUMAN_EMAILS; do
155
- [ "$email" = "$one" ] && known=1 && break
156
- done
157
- [ -n "$known" ] && continue
158
- unknown="${unknown}${unknown:+, }${short} <${email}>"
159
- done <<EOF
160
- $(git log --format='%h%x09%an%x09%ae' "origin/${main_branch}..HEAD" 2>/dev/null)
161
- EOF
195
+ # The decision and the words come from the decision table; the hook names the diverging
196
+ # commits, where the copy stands and the ready-made rewrite.
197
+ if [ -z "$repair" ] && [ -n "$unknown$strangers" ]; then
198
+ fact commits_signed_declared no
199
+ [ -n "$where" ] && fact branch_is_main yes
200
+ if [ -n "$unknown" ]; then
201
+ _problem="a commit of the contribution is signed by an account the tree never declared. Known are the machine account ${commit_email} and the emails of people named by the profile; everything else the hosting attributes to whoever owns that address, and from inside the history the miss is invisible. Diverging: ${unknown}."
202
+ _last="GIT_AUTHOR_EMAIL=\"${commit_email}\" GIT_COMMITTER_EMAIL=\"${commit_email}\" git commit --amend --no-edit --reset-author"
203
+ else
204
+ _problem="a machine commit is signed by an email other than the one the tree declared. The hosting matches a service address by the number in it, and a commit with a foreign number it attributes to an outside person — from inside the miss is invisible, because the name of the account next to it is right. Diverging: ${strangers}. Declared: ${commit_email} — the email is taken from there, not typed from memory."
205
+ _last="GIT_AUTHOR_NAME=\"${bot_login}\" GIT_AUTHOR_EMAIL=\"${commit_email}\" GIT_COMMITTER_NAME=\"${bot_login}\" GIT_COMMITTER_EMAIL=\"${commit_email}\" git commit --amend --no-edit --reset-author"
206
+ fi
207
+ refuse "?commit" "$(jq -cn --arg p "$_problem" --arg w "$where" --arg l "$_last" --arg e "$commit_email" --arg m "$main_branch" \
208
+ '{problem:$p, where:$w, last:$l, commit_email:$e, main_branch:$m}')"
162
209
  fi
163
-
164
- [ -n "$unknown" ] && [ -z "$repair" ] \
165
- && deny "BLOCKED: a commit of the contribution is signed by an account the tree never declared. Known are the machine account ${commit_email} and the emails of people named by the profile; everything else the hosting attributes to whoever owns that address, and from inside the history the miss is invisible. Diverging: ${unknown}. Rewrite the signature before the push, after it only a force push fixes this:
166
- the last commit — GIT_AUTHOR_EMAIL=\"${commit_email}\" GIT_COMMITTER_EMAIL=\"${commit_email}\" git commit --amend --no-edit --reset-author
167
- the whole contribution of the branch — git filter-branch -f --env-filter 'GIT_AUTHOR_EMAIL=\"${commit_email}\"; GIT_COMMITTER_EMAIL=\"${commit_email}\"' origin/${main_branch}..HEAD"
168
-
169
- [ -n "$strangers" ] && [ -z "$repair" ] \
170
- && deny "BLOCKED: a machine commit is signed by an email other than the one the tree declared. The hosting matches a service address by the number in it, and a commit with a foreign number it attributes to an outside person — from inside the miss is invisible, because the name of the account next to it is right. Diverging: ${strangers}. Declared: ${commit_email} — the email is taken from there, not typed from memory. Rewrite the signature before the push, after it only a force push fixes this:
171
- the last commit — GIT_AUTHOR_NAME=\"${bot_login}\" GIT_AUTHOR_EMAIL=\"${commit_email}\" GIT_COMMITTER_NAME=\"${bot_login}\" GIT_COMMITTER_EMAIL=\"${commit_email}\" git commit --amend --no-edit --reset-author
172
- the whole contribution of the branch — git filter-branch -f --env-filter 'GIT_AUTHOR_EMAIL=\"${commit_email}\"; GIT_COMMITTER_EMAIL=\"${commit_email}\"' origin/${main_branch}..HEAD"
173
210
  fi
174
211
  fi
175
212
  # This point has no exit of its own: a push happens to be a compound command too, and its second
@@ -0,0 +1,47 @@
1
+ #!/usr/bin/env bash
2
+ # The task of a branch, for the delivery guard: the task exists, is open, stands in the work queue,
3
+ # has an assignee and a numbered title, and is not left in the first column.
4
+ #
5
+ # NOT a guard: it has no `rt-hook:` declaration and hooks into no agent event. The delivery guard
6
+ # sources it — one tier of its verdict, moved out when the guard reached its length limit. It reads
7
+ # the guard's variables (`task_new`, `board_check`, `task_bot`, `task_move`, `backlog_column`) and
8
+ # adds what is unmet by the guard's `fault`; it refuses nothing by itself.
9
+ #
10
+ # Parameters: the task number, the words that name where the number came from, and `yes` when the
11
+ # column is judged.
12
+
13
+ check_task() {
14
+ number="$1"
15
+ where="$2"
16
+ # The column is asked about where it should already have been moved. At branch creation it has
17
+ # not been moved yet — the work pattern moves the column with the next command — and the
18
+ # requirement here would refuse the very first command of the work together with the one that
19
+ # lifts it.
20
+ judge_column="${3:-no}"
21
+ rt_needs rt_task_state git-guard-delivery || return 0
22
+ state="$(rt_delivery_task_state "$number" 2>/dev/null)" || return 0
23
+ [ -z "$state" ] && return 0
24
+
25
+ printf '%s' "$state" | jq -e '.exists' >/dev/null 2>&1 \
26
+ || unmet task_exists no "${where} refers to the task #${number}, which does not exist. Check the number or create the task — ${task_new}."
27
+ printf '%s' "$state" | jq -e '.open' >/dev/null 2>&1 \
28
+ || unmet task_open no "the task #${number} is closed, and a task has one branch. Work behind a closed task is created as a new task — ${task_new}."
29
+ printf '%s' "$state" | jq -e '.onBoard' >/dev/null 2>&1 \
30
+ || unmet task_on_board no "the task #${number} is not in the work queue — the edit behind it is invisible. The queue is not bound to the repository and does not take a task by itself; add it and check — ${board_check}."
31
+ printf '%s' "$state" | jq -e '.assigned' >/dev/null 2>&1 \
32
+ || unmet task_assigned no "the task #${number} has no assignee — by the work queue there is no seeing who took it. Set the assignee${task_bot:+: }${task_bot}."
33
+ printf '%s' "$state" | jq -e '.numbered' >/dev/null 2>&1 \
34
+ || unmet task_title_numbered no "the title of the task #${number} does not start with its number — one work would have to be recognised by the text of the title. Fix the title and check the queue — ${board_check}."
35
+
36
+ # The task column. The work queue answer has been giving it for a long time, and nobody read it:
37
+ # the column was judged only by the queue audit, that is, already after the PR is opened. A task
38
+ # left in the first column reads through the queue as not taken — while the work is done and put
39
+ # out.
40
+ if [ -n "$backlog_column" ] && [ "$judge_column" = "yes" ]; then
41
+ column="$(printf '%s' "$state" | jq -r '.status // empty' 2>/dev/null)"
42
+ [ "$column" = "$backlog_column" ] \
43
+ && unmet task_column_taken no "the task #${number} stands in the column «${column}» — by the work queue it is not taken, though the work on it is going. Move it: ${task_move}."
44
+ fi
45
+
46
+ return 0
47
+ }