@rt-tools/agent-kit 0.33.1 → 0.35.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 (159) hide show
  1. package/README.md +14 -13
  2. package/assets/agents/goal-critic.md +76 -0
  3. package/assets/agents/product-strategist.md +95 -0
  4. package/assets/agents/qa-engineer.md +3 -0
  5. package/assets/checks/check-specs.mjs +11 -2
  6. package/assets/checks/rt-kit-checks.config.mjs +6 -0
  7. package/assets/checks/spec-common.mjs +6 -3
  8. package/assets/checks/spec-scenarios.mjs +9 -1
  9. package/assets/checks/task-new.github.mjs +6 -0
  10. package/assets/defaults/project.sh +49 -81
  11. package/assets/defaults/push.sh +100 -0
  12. package/assets/docs/GLOSSARY.md +4 -0
  13. package/assets/hooks/browser-guard-device-id.sh +1 -0
  14. package/assets/hooks/browser-guard-no-asking.sh +1 -0
  15. package/assets/hooks/browser-guard-no-listing.sh +1 -0
  16. package/assets/hooks/browser-guard-no-other-drivers.sh +7 -3
  17. package/assets/hooks/browser-guard-require-select.sh +1 -0
  18. package/assets/hooks/claim-guard.sh +7 -6
  19. package/assets/hooks/dev-server-guard.sh +1 -0
  20. package/assets/hooks/dispatch.sh +56 -3
  21. package/assets/hooks/docs-guard.sh +1 -0
  22. package/assets/hooks/end-conversation-guard.sh +1 -0
  23. package/assets/hooks/epic-stop-guard.sh +1 -0
  24. package/assets/hooks/exam-guard.sh +6 -1
  25. package/assets/hooks/git-guard-delivery-body.sh +25 -3
  26. package/assets/hooks/git-guard-delivery-draft.sh +23 -0
  27. package/assets/hooks/git-guard-delivery-folder.sh +38 -1
  28. package/assets/hooks/git-guard-delivery-pipeline.sh +99 -0
  29. package/assets/hooks/git-guard-delivery-signature.sh +19 -0
  30. package/assets/hooks/git-guard-delivery.sh +15 -19
  31. package/assets/hooks/git-guard-discard.sh +1 -0
  32. package/assets/hooks/git-guard-main.sh +18 -4
  33. package/assets/hooks/git-guard-no-verify.sh +1 -0
  34. package/assets/hooks/git-guard-push-ahead.sh +98 -0
  35. package/assets/hooks/git-guard-push-marks.sh +99 -0
  36. package/assets/hooks/git-guard-push-tests.sh +102 -83
  37. package/assets/hooks/grill-gate.sh +1 -0
  38. package/assets/hooks/guard-note.sh +11 -3
  39. package/assets/hooks/handover-mark.sh +37 -0
  40. package/assets/hooks/metric-marks.sh +233 -0
  41. package/assets/hooks/metric-send-start.sh +38 -0
  42. package/assets/hooks/observe.sh +103 -0
  43. package/assets/hooks/owner-corrections.sh +36 -0
  44. package/assets/hooks/pre-push.sh +113 -0
  45. package/assets/hooks/prose-style-guard.sh +1 -0
  46. package/assets/hooks/pull-outcomes.sh +59 -0
  47. package/assets/hooks/push-set.sh +160 -0
  48. package/assets/hooks/push-sign.sh +433 -0
  49. package/assets/hooks/qa-dataid-guard.sh +1 -0
  50. package/assets/hooks/rerun-guard.sh +15 -6
  51. package/assets/hooks/reuse-first-guard.sh +1 -0
  52. package/assets/hooks/role-calls.sh +120 -0
  53. package/assets/hooks/rule-source-guard.sh +16 -0
  54. package/assets/hooks/skill-gate.sh +11 -0
  55. package/assets/hooks/task-flow-draft-guard.sh +1 -0
  56. package/assets/hooks/task-flow-guard.sh +1 -0
  57. package/assets/hooks/tree-assignment-guard.sh +1 -0
  58. package/assets/hooks/turn-exit-epic.sh +24 -0
  59. package/assets/hooks/turn-exit-guard.sh +3 -23
  60. package/assets/hooks/turn-exit-patterns.sh +4 -3
  61. package/assets/hooks/turn-exit-verdict.sh +18 -1
  62. package/assets/hooks/waiting-turn-guard.sh +3 -1
  63. package/assets/hooks/window-fill-guard.sh +1 -0
  64. package/assets/hooks/work-start-guard.sh +1 -0
  65. package/assets/hooks/write-targets.sh +21 -0
  66. package/assets/patterns/git-workflow-commit.azure.md +5 -3
  67. package/assets/patterns/git-workflow-commit.github.md +16 -3
  68. package/assets/patterns/git-workflow-commit.gitlab.md +5 -3
  69. package/assets/patterns/git-workflow-pr-body.github.md +20 -3
  70. package/assets/patterns/git-workflow-pr.azure.md +30 -0
  71. package/assets/patterns/git-workflow-pr.github.md +57 -1
  72. package/assets/patterns/git-workflow-pr.gitlab.md +33 -0
  73. package/assets/patterns/mockups-measure.needs-mockups.md +19 -3
  74. package/assets/patterns/task-flow-close.md +32 -22
  75. package/assets/patterns/task-flow-cycle.md +72 -0
  76. package/assets/patterns/task-flow-start.md +3 -3
  77. package/assets/rules/browser-verification.md +4 -0
  78. package/assets/rules/deploy-flow.azure.md +5 -0
  79. package/assets/rules/deploy-flow.github.md +5 -0
  80. package/assets/rules/deploy-flow.gitlab.md +5 -0
  81. package/assets/rules/git-workflow.azure.md +15 -0
  82. package/assets/rules/git-workflow.github.md +15 -0
  83. package/assets/rules/git-workflow.gitlab.md +15 -0
  84. package/assets/rules/mockups.needs-mockups.md +13 -5
  85. package/assets/rules/task-flow.md +31 -25
  86. package/assets/samples/tasks/_template/plan.md +8 -0
  87. package/assets/skills/interface-review-annotate.needs-mockups.md +142 -0
  88. package/assets/skills/interface-review-icons.needs-app.md +136 -0
  89. package/assets/skills/interface-review-motion-states.needs-app.md +230 -0
  90. package/assets/skills/interface-review-motion.needs-app.md +209 -0
  91. package/assets/skills/interface-review-performance.needs-app.md +110 -0
  92. package/assets/skills/interface-review-principles.needs-app.md +263 -0
  93. package/assets/skills/interface-review-surfaces.needs-app.md +249 -0
  94. package/assets/skills/interface-review.needs-app.md +199 -0
  95. package/assets/skills/write-a-skill.md +16 -3
  96. package/assets/templates/postmortem.md +2 -0
  97. package/assets/workflows/feature.js +33 -5
  98. package/assets/workflows/plan.js +71 -4
  99. package/bin/agent-kit.d.ts.map +1 -1
  100. package/bin/agent-kit.js +28 -0
  101. package/bin/agent-kit.js.map +1 -1
  102. package/lib/cargo.d.ts +35 -0
  103. package/lib/cargo.d.ts.map +1 -1
  104. package/lib/cargo.js +76 -0
  105. package/lib/cargo.js.map +1 -1
  106. package/lib/commands.d.ts +9 -0
  107. package/lib/commands.d.ts.map +1 -1
  108. package/lib/commands.js +32 -19
  109. package/lib/commands.js.map +1 -1
  110. package/lib/config.d.ts +5 -0
  111. package/lib/config.d.ts.map +1 -1
  112. package/lib/config.js +1 -0
  113. package/lib/config.js.map +1 -1
  114. package/lib/file-lock.d.ts +4 -0
  115. package/lib/file-lock.d.ts.map +1 -0
  116. package/lib/file-lock.js +23 -0
  117. package/lib/file-lock.js.map +1 -0
  118. package/lib/metric-lines.d.ts +20 -0
  119. package/lib/metric-lines.d.ts.map +1 -0
  120. package/lib/metric-lines.js +117 -0
  121. package/lib/metric-lines.js.map +1 -0
  122. package/lib/metric-send-mark.d.ts +52 -0
  123. package/lib/metric-send-mark.d.ts.map +1 -0
  124. package/lib/metric-send-mark.js +69 -0
  125. package/lib/metric-send-mark.js.map +1 -0
  126. package/lib/metric-send.d.ts +18 -0
  127. package/lib/metric-send.d.ts.map +1 -0
  128. package/lib/metric-send.js +226 -0
  129. package/lib/metric-send.js.map +1 -0
  130. package/lib/metric-usage.d.ts +34 -0
  131. package/lib/metric-usage.d.ts.map +1 -0
  132. package/lib/metric-usage.js +111 -0
  133. package/lib/metric-usage.js.map +1 -0
  134. package/lib/metrics.d.ts +92 -0
  135. package/lib/metrics.d.ts.map +1 -0
  136. package/lib/metrics.js +263 -0
  137. package/lib/metrics.js.map +1 -0
  138. package/lib/observations-cargo.d.ts +2 -0
  139. package/lib/observations-cargo.d.ts.map +1 -1
  140. package/lib/observations-cargo.js +1 -1
  141. package/lib/observations-cargo.js.map +1 -1
  142. package/lib/observations.d.ts +22 -2
  143. package/lib/observations.d.ts.map +1 -1
  144. package/lib/observations.js +40 -13
  145. package/lib/observations.js.map +1 -1
  146. package/lib/outcomes.d.ts +89 -0
  147. package/lib/outcomes.d.ts.map +1 -0
  148. package/lib/outcomes.js +274 -0
  149. package/lib/outcomes.js.map +1 -0
  150. package/lib/ship.js +1 -1
  151. package/lib/ship.js.map +1 -1
  152. package/lib/shipment.d.ts.map +1 -1
  153. package/lib/shipment.js +7 -1
  154. package/lib/shipment.js.map +1 -1
  155. package/lib/snapshot.d.ts +2 -0
  156. package/lib/snapshot.d.ts.map +1 -1
  157. package/lib/snapshot.js +6 -0
  158. package/lib/snapshot.js.map +1 -1
  159. package/package.json +1 -1
@@ -27,6 +27,7 @@
27
27
 
28
28
  # The guard's name for the observations: it is written by the shared deny tail.
29
29
  RT_GUARD_NAME=browser-guard-device-id
30
+ RT_GUARD_RULE=browser-verification
30
31
 
31
32
  . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utf8.sh" 2>/dev/null || true
32
33
  . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/hook-input.sh" 2>/dev/null || true
@@ -21,6 +21,7 @@
21
21
  # Its own name in the observations: the refusal is recorded by the shared deny tail, not by the
22
22
  # guard itself.
23
23
  RT_GUARD_NAME=browser-guard-no-asking
24
+ RT_GUARD_RULE=browser-verification
24
25
 
25
26
  . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utf8.sh" 2>/dev/null || true
26
27
  . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/hook-input.sh" 2>/dev/null || true
@@ -13,6 +13,7 @@
13
13
  # Its own name in the observations: the refusal is recorded by the shared deny tail, not by the
14
14
  # guard itself.
15
15
  RT_GUARD_NAME=browser-guard-no-listing
16
+ RT_GUARD_RULE=browser-verification
16
17
 
17
18
  . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utf8.sh" 2>/dev/null || true
18
19
 
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env bash
2
- # rt-hook: PreToolUse mcp__playwright__.*|mcp__chrome-devtools__.*|Bash|mcp__webstorm__execute_terminal_command|mcp__webstorm__execute_tool
2
+ # rt-hook: PreToolUse mcp__playwright__.*|mcp__chrome-devtools__.*|mcp__plugin_.*_playwright__.*|mcp__plugin_.*_chrome-devtools__.*|Bash|mcp__webstorm__execute_terminal_command|mcp__webstorm__execute_tool
3
3
  # Requires: hooks/deny-tail.sh
4
4
  # Guard of the bypass routes to the browser. PreToolUse.
5
5
  #
@@ -23,6 +23,7 @@
23
23
  # Own name in the observations: the refusal is written by the shared refusal tail, not by the
24
24
  # guard itself.
25
25
  RT_GUARD_NAME=browser-guard-no-other-drivers
26
+ RT_GUARD_RULE=browser-verification
26
27
 
27
28
  . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utf8.sh" 2>/dev/null || true
28
29
  . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/hook-input.sh" 2>/dev/null || true
@@ -45,10 +46,13 @@ deny() {
45
46
  exit 2
46
47
  }
47
48
 
49
+ # A driver installed as a plugin carries the plugin name in front of the server name —
50
+ # `mcp__plugin_<plugin>_<server>__<tool>`. The plugin name is chosen by its publisher, so it is
51
+ # matched by a sample: the plain name alone let the same driver open the browser past the profile.
48
52
  case "$tool" in
49
- mcp__playwright__*)
53
+ mcp__playwright__* | mcp__plugin_*_playwright__*)
50
54
  deny "The second browser driver is not used in this project — no sign-in was made in its profile." ;;
51
- mcp__chrome-devtools__*)
55
+ mcp__chrome-devtools__* | mcp__plugin_*_chrome-devtools__*)
52
56
  deny "The third browser driver is not used in this project — it does not ask for the pinned profile." ;;
53
57
  esac
54
58
 
@@ -23,6 +23,7 @@
23
23
  # Its own name in the observations: the refusal is written by the shared deny tail, not by the
24
24
  # guard itself.
25
25
  RT_GUARD_NAME=browser-guard-require-select
26
+ RT_GUARD_RULE=browser-verification
26
27
 
27
28
  . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utf8.sh" 2>/dev/null || true
28
29
  . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/hook-input.sh" 2>/dev/null || true
@@ -35,6 +35,7 @@
35
35
 
36
36
  # Its own name in the observations: the refusal is written by the shared deny tail, not by the guard.
37
37
  RT_GUARD_NAME=claim-guard
38
+ RT_GUARD_RULE=turn-conduct
38
39
 
39
40
  . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utf8.sh" 2>/dev/null || true
40
41
  . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/hook-input.sh" 2>/dev/null || true
@@ -143,22 +144,22 @@ claims=(
143
144
  # phrase was once said with not one run behind it.
144
145
  '@проверк[аи] перед (push|пушем|отправкой)[^.]{0,30}(починен|исправлен)§git push|check:all|pnpm (run|exec)§прогон набора перед push — `git push` или `pnpm run check:all`'
145
146
  '@запушен[аоы]?|@запушил[а]?|@пуш прошёл|@ветка уехала§git push§`git push`'
146
- '(PR|правка|ветка|работа)[^.]{0,20}@(влит|слит|смержен)|@влит[оа] в|@слит[оа] в§git merge|gh pr merge§`git merge` или `gh pr merge`'
147
+ '(PR|правка|ветка|работа)[^.]{0,20}@(влит|слит|смержен)|@влит[оа] в|@слит[оа] в§git merge|gh pr merge|glab mr merge§`git merge`, `gh pr merge` или `glab mr merge`'
147
148
  '(ветки|ветка|файлы|файл|папка|каталог)[^.]{0,40}@(снят|удал[её]н|удалил|почищен|почистил|вычищен|вычистил)|@снят[оыа] с§git branch|git push .*--delete|git rm|gh api|rm §команду удаления — `git branch -d`, `git push --delete` или `git rm`'
148
- '@прогон (зелёный|прошёл|кончился)|@конвейер зелёный|@проверки на PR зелёные§gh run§`gh run list` или `gh run view`'
149
- '@(работа|правка|задача) готова|@можно вливать|@PR открыт|@черновик снят§gh pr §`gh pr create`, `gh pr view` или `gh pr ready`'
149
+ '@прогон (зелёный|прошёл|кончился)|@конвейер зелёный|@проверки на PR зелёные§gh run|glab ci§`gh run list`, `gh run view` или `glab ci status`'
150
+ '@(работа|правка|задача) готова|@можно вливать|@PR открыт|@черновик снят§gh pr |glab mr §`gh pr create`, `gh pr view`, `gh pr ready` или `glab mr`'
150
151
  # Waiting for someone else's step is a claim about the state too, and there is something in it
151
152
  # to lie with: a run is green for an hour, and sometimes never starts at all. Said without a
152
153
  # command, it leaves finished work a draft, and the owner learns of it last — that is exactly
153
154
  # how it went twice in one day.
154
- '@жд[уёя][^.]{0,20}прогон|@дожида[ею][^.]{0,20}прогон|@прогон[^.]{0,20}(ещё идёт|не встал|не кончился|не дошёл)|@черновик[^.]{0,30}(не снимаю|сниму|снимется)§gh run|gh pr checks|check-runs|check:board|board\.mjs§команду о прогоне — `gh run list`, `gh pr checks` или сверку очереди работ'
155
- '@задача заведена|@задача (в|переведена в) колонк|@колонка переведена§gh issue|gh api|task:new|task:move|board\.mjs§команду очереди работ — заведение задачи или перевод колонки'
155
+ '@жд[уёя][^.]{0,20}прогон|@дожида[ею][^.]{0,20}прогон|@прогон[^.]{0,20}(ещё идёт|не встал|не кончился|не дошёл)|@черновик[^.]{0,30}(не снимаю|сниму|снимется)§gh run|gh pr checks|glab ci|check-runs|check:board|board\.mjs§команду о прогоне — `gh run list`, `gh pr checks` или сверку очереди работ'
156
+ '@задача заведена|@задача (в|переведена в) колонк|@колонка переведена§gh issue|gh api|glab issue|glab api|task:new|task:move|board\.mjs§команду очереди работ — заведение задачи или перевод колонки'
156
157
  '(в дереве|в репозитории|здесь|такого файла|такой команды)[^.]{0,30}(нет|не бывает)|@не заводили|@нигде не встречается§grep|rg |ls |find |git ls-files|git grep|git log|cat §команду поиска — `grep`, `git ls-files` или обход каталога'
157
158
  )
158
159
 
159
160
  # A negated claim is a statement about the tree too, but the action command cannot show it: «not
160
161
  # pushed» is shown by a read of the branch state, not by a push.
161
- read_proof='git (status|log|ls-remote|branch|show|rev-parse|fetch|diff)|gh (pr|run|api|issue)|ls |grep|board\.mjs'
162
+ read_proof='git (status|log|ls-remote|branch|show|rev-parse|fetch|diff)|gh (pr|run|api|issue)|glab (mr|ci|api|issue)|ls |grep|board\.mjs'
162
163
 
163
164
  for row in "${claims[@]}"; do
164
165
  words="${row%%§*}"
@@ -32,6 +32,7 @@
32
32
  # Its own name in the observations: the refusal is written by the shared deny tail, not by the
33
33
  # guard itself.
34
34
  RT_GUARD_NAME=dev-server-guard
35
+ RT_GUARD_RULE=browser-verification
35
36
 
36
37
  . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utf8.sh" 2>/dev/null || true
37
38
  . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/hook-input.sh" 2>/dev/null || true
@@ -141,11 +141,64 @@ EOF
141
141
  exit 0
142
142
  fi
143
143
 
144
- [ -n "$branch_out" ] && collected="${collected}${branch_out}
144
+ # Each answer is kept apart, as a JSON string per line: glued together, two objects are no longer
145
+ # one answer, and the merge at the end needs to know where one ends.
146
+ if [ -n "$branch_out" ]; then
147
+ answers="${answers:-}$(printf '%s' "$branch_out" | jq -Rsc . 2>/dev/null)
145
148
  "
149
+ collected="${collected}${branch_out}
150
+ "
151
+ count=$((${count:-0} + 1))
152
+ fi
146
153
  done
147
154
 
148
- # Not one branch refused: what they printed is given out — hints and digests.
149
- [ -n "${collected:-}" ] && printf '%s' "$collected"
155
+ # The answers of several branches are merged into one object. Objects printed one after another are
156
+ # no longer one answer: the agent read them as raw text, and the laws and the handover of a session
157
+ # start arrived cut. The texts of the context and of the system message are joined by an empty line,
158
+ # the plain text of a branch goes into the context, the other fields are taken in the order of the
159
+ # branches. An event without a context field keeps the text in the system message.
160
+ rt_dispatch_merge() {
161
+ case "$event" in
162
+ SessionStart | UserPromptSubmit | PreToolUse | PostToolUse) with_context=true ;;
163
+ *) with_context=false ;;
164
+ esac
165
+ printf '%s' "$answers" | jq -sc --arg ev "$event" --argjson ctx "$with_context" '
166
+ map(. as $s | (try ($s | fromjson) catch null) as $j
167
+ | if ($j | type) == "object" then {obj: $j} else {text: ($s | sub("\\s+$"; ""))} end)
168
+ | [.[] | .obj // empty] as $objs
169
+ | ([$objs[] | .hookSpecificOutput.additionalContext // empty]
170
+ + [.[] | .text // empty | select(length > 0)]) as $texts
171
+ | [$objs[] | .systemMessage // empty] as $sys
172
+ | (reduce $objs[] as $o ({};
173
+ . * ($o | del(.systemMessage)
174
+ | if (.hookSpecificOutput | type) == "object"
175
+ then .hookSpecificOutput |= del(.additionalContext) else . end))) as $base
176
+ | if $ctx then
177
+ $base
178
+ | if ($texts | length) > 0 then
179
+ .hookSpecificOutput = ((.hookSpecificOutput // {})
180
+ + {hookEventName: $ev, additionalContext: ($texts | join("\n\n"))})
181
+ else . end
182
+ | if ($sys | length) > 0 then .systemMessage = ($sys | join("\n\n")) else . end
183
+ else
184
+ ($base | del(.hookSpecificOutput))
185
+ | if (($sys + $texts) | length) > 0 then .systemMessage = (($sys + $texts) | join("\n\n"))
186
+ else . end
187
+ end
188
+ ' 2>/dev/null
189
+ }
190
+
191
+ # Not one branch refused: what they printed is given out — hints and digests. A single answer goes
192
+ # out as it is; where the merge has no parser, the former glued output is better than silence.
193
+ if [ "${count:-0}" -gt 1 ]; then
194
+ merged="$(rt_dispatch_merge)"
195
+ if [ -n "$merged" ]; then
196
+ printf '%s\n' "$merged"
197
+ else
198
+ printf '%s' "$collected"
199
+ fi
200
+ elif [ -n "${collected:-}" ]; then
201
+ printf '%s' "$collected"
202
+ fi
150
203
 
151
204
  exit 0
@@ -30,6 +30,7 @@
30
30
  # Its own name in the observations: the refusal is written by the shared deny tail, not by the
31
31
  # guard itself.
32
32
  RT_GUARD_NAME=docs-guard
33
+ RT_GUARD_RULE=doc-style
33
34
 
34
35
  . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utf8.sh" 2>/dev/null || true
35
36
  . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/hook-input.sh" 2>/dev/null || true
@@ -18,6 +18,7 @@
18
18
 
19
19
  # Its own name in the observations: the refusal is recorded by the shared deny tail.
20
20
  RT_GUARD_NAME=end-conversation-guard
21
+ RT_GUARD_RULE=turn-conduct
21
22
 
22
23
  . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utf8.sh" 2>/dev/null || true
23
24
  . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/hook-input.sh" 2>/dev/null || true
@@ -24,6 +24,7 @@
24
24
  # Its own name in the observations: the refusal is written by the shared deny tail, not by the
25
25
  # guard itself.
26
26
  RT_GUARD_NAME=epic-stop-guard
27
+ RT_GUARD_RULE=task-flow
27
28
 
28
29
  . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utf8.sh" 2>/dev/null || true
29
30
  . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/hook-input.sh" 2>/dev/null || true
@@ -252,12 +252,17 @@ if [ "$ready" = "1" ]; then
252
252
  esac
253
253
  fi
254
254
 
255
+ # The verdict for the metrics. No mark file — nothing is recorded, and the guard judges as before.
256
+ # shellcheck disable=SC1091
257
+ . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/metric-marks.sh" 2>/dev/null \
258
+ && rt_exam_note "$verdict" "$(printf '%s' "$RT_HOOK_INPUT" | jq -r '.session_id // empty' 2>/dev/null)"
259
+
255
260
  case "$verdict" in
256
261
  passed) exit 0 ;;
257
262
  failed)
258
263
  deny "BLOCKED by exam-guard: the exam on the loaded rules is failed. Read the rule whole again — not the piece that was asked about — and call the role strict-teacher anew. The answer shown gives knowledge of one line, not of the rule. The way out through the list of switched-off roles requires removing the protection, and the runtime may forbid such an edit; the second way out does not require it — the bypass is declared by the line «Exam-skip: причина» in the body of the last commit of the branch."
259
264
  ;;
260
265
  *)
261
- deny "BLOCKED by exam-guard: there was no exam on the loaded rules in this session. Call the role strict-teacher, hand it the list of loaded rules, answer its questions from memory and return the answers to it — the verdict it gives by the line «ЭКЗАМЕН: сдано N из 5». It counts from the answer of the role in whatever form the host delivered it, but not from the output of the shell and not from your own text: printing that line as an echo does not release the guard. The role was already called and the verdict received — then it arrived in a form the guard does not see: that is a defect of the guard, and an edit of `.claude/rt-kit.json` is taken out from under it. A loaded rule and a read rule are different things, and the price of that difference is paid by the owner."
266
+ deny "BLOCKED by exam-guard: there was no exam on the loaded rules in this session. Call the role strict-teacher, hand it the list of loaded rules, answer its questions from memory and return the answers to it — the verdict it gives by the line «ЭКЗАМЕН: сдано N из 5». It counts from the answer of the role in whatever form the host delivered it, but not from the output of the shell and not from your own text: printing that line as an echo does not release the guard. The role was already called and the verdict received — then it arrived in a form the guard does not see: that is a defect of the guard, and an edit of «.claude/rt-kit.json» is taken out from under it. A loaded rule and a read rule are different things, and the price of that difference is paid by the owner."
262
267
  ;;
263
268
  esac
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env bash
2
- # The body of a PR being opened, for the delivery guard: the section about the remaining step and the
3
- # line that closes the task.
2
+ # The body of a PR being opened, for the delivery guard: the section about the remaining step, the
3
+ # table of points and the line that closes the task.
4
4
  #
5
5
  # NOT a guard: it has no `rt-hook:` declaration and hooks into no agent event. The delivery guard
6
6
  # sources it — one tier of its verdict, moved out when the guard reached its length limit. It uses
@@ -15,7 +15,9 @@ rt_delivery_pull_body() {
15
15
  # without a body is checked by the guard elsewhere. The flag is recognised only as a separate
16
16
  # word: the tail `-b` of a branch name in the base argument read as the body flag, and the next
17
17
  # word of the command became the body.
18
- [ -z "$pull_body_section" ] && [ -z "$pull_closes_line" ] && return 0
18
+ local pull_goal_section="${RT_PULL_GOAL_SECTION:-}"
19
+ [ -z "$pull_body_section" ] && [ -z "$pull_points_section" ] && [ -z "$pull_goal_section" ] \
20
+ && [ -z "$pull_closes_line" ] && return 0
19
21
  command -v perl >/dev/null 2>&1 || return 0
20
22
 
21
23
  local body body_file closes
@@ -38,6 +40,26 @@ rt_delivery_pull_body() {
38
40
  fault "the body of the request carries no section about the remaining step. The merge button is pressed by a person on the hosting, where there are no guards, and they merge as soon as they see green: all that holds the requirement there is what the owner read on the page. The section stands last and says exactly one thing — whether anything is left before the merge; it is rewritten by the same call that edits the body."
39
41
  fi
40
42
 
43
+ # The table of points: without it the owner learns whether the work reached its point only after
44
+ # the merge. The guard sees the heading, not whether the signs were run.
45
+ if [ -n "$pull_points_section" ] && ! printf '%s' "$body" | grep -qE "$pull_points_section"; then
46
+ fault "the body of the request carries no section with the table of points. The owner decides on the request page whether the work reached its point. Run the role product-strategist and put its table of points into the body; a sign not run is written as not run."
47
+ fi
48
+
49
+ # The table of the critic: the session's own points prove nothing about what the owner asked for.
50
+ # A heading alone is not a table: a header, a divider and one row make three lines.
51
+ if [ -n "$pull_goal_section" ]; then
52
+ local goal_rows
53
+ goal_rows="$(printf '%s\n' "$body" | awk -v head="$pull_goal_section" '
54
+ $0 ~ head { inside = 1; next }
55
+ /^## / { inside = 0 }
56
+ inside && /^\|/ { rows++ }
57
+ END { print rows + 0 }
58
+ ')"
59
+ [ "$goal_rows" -ge 3 ] \
60
+ || fault "the body of the request carries no section with the table of the critic. Give the role goal-critic the owner's words verbatim and the result, and put its table into the body word for word."
61
+ fi
62
+
41
63
  # The line that closes the task. Without it the merged task stays open on the board, and the
42
64
  # work queue audit names that only after the merge — three PRs of one epic went out so, and the
43
65
  # owner closed their tasks by hand. The number is the branch's, not the one the executor
@@ -16,6 +16,27 @@
16
16
  . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utf8.sh" 2>/dev/null || true
17
17
  . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/hook-input.sh" 2>/dev/null || true
18
18
 
19
+ # The handover for the metrics: the call passed every condition here. The next guard in the row may
20
+ # still refuse it, so the branch is only announced: `handover-mark.sh` keeps the sign after the call.
21
+ # No mark file — nothing is kept.
22
+ rt_delivery_handover() {
23
+ local pending
24
+ # shellcheck disable=SC1091
25
+ . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/metric-marks.sh" 2>/dev/null || return 0
26
+ pending="$(rt_handover_pending_file "$(printf '%s' "$RT_HOOK_INPUT" | jq -r '.session_id // empty' 2>/dev/null)" "$cmd")"
27
+ [ -z "$pending" ] || printf '%s' "$1" > "$pending" 2>/dev/null
28
+ return 0
29
+ }
30
+
31
+ # A request that opens ready and names a reviewer is handed over at once. A draft is handed over when
32
+ # it leaves draft, and that guard demands a reviewer itself.
33
+ rt_delivery_open_handover() {
34
+ printf '%s' "$1" | grep -qE '[[:space:]](--draft|-d)([[:space:]=]|$)' && return 0
35
+ printf '%s' "$1" | grep -qE '[[:space:]](--reviewer|-r)([[:space:]=])' || return 0
36
+ rt_delivery_handover "$2"
37
+ return 0
38
+ }
39
+
19
40
  rt_delivery_draft_ready() {
20
41
  # --- leaving draft ----------------------------------------------------------------------
21
42
  #
@@ -88,5 +109,7 @@ rt_delivery_draft_ready() {
88
109
  command -v rt_delivery_ready_folder >/dev/null 2>&1 && rt_delivery_ready_folder "$pull_head"
89
110
 
90
111
  deny_faults
112
+ # The head comes from the hosting: without its answer the number may name another branch.
113
+ [ -z "$pull_head" ] || rt_delivery_handover "$pull_head"
91
114
  fi
92
115
  }
@@ -68,9 +68,26 @@ rt_delivery_open_folder() {
68
68
  return 0
69
69
  fi
70
70
 
71
- [ -n "$archive_dir" ] || return 0
72
71
  _base="$(git merge-base "$main_branch" HEAD 2>/dev/null)"
73
72
  [ -z "$_base" ] && return 0
73
+
74
+ # SC-AK-1249: a draft a plan of the branch named, still lying in the branch, would reach main
75
+ # unmerged. SC-AK-1296: a request into an epic or into a lower branch does not reach main, and
76
+ # the draft of an epic lives until its last task. The request of the epic is judged by the plans
77
+ # of all its tasks.
78
+ _into="$(rt_delivery_open_base)"
79
+ if [ "${_into:-$main_branch}" = "$main_branch" ]; then
80
+ while IFS= read -r _plan; do
81
+ [ -n "$_plan" ] || continue
82
+ _draft="$(rt_branch_plan_draft "${_plan%/plan.md}" "$_base")"
83
+ [ -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."
85
+ done <<EOF
86
+ $(git log --format= --name-only "$_base..HEAD" -- "$tasks_dir/*/plan.md" 2>/dev/null | sort -u)
87
+ EOF
88
+ fi
89
+
90
+ [ -n "$archive_dir" ] || return 0
74
91
  rt_folder_was_in_branch "$_base" "$_folder" || return 0
75
92
 
76
93
  _gained="$(git diff --name-only --diff-filter=A "$_base" HEAD -- "$archive_dir" 2>/dev/null | head -1)"
@@ -78,6 +95,26 @@ rt_delivery_open_folder() {
78
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."
79
96
  }
80
97
 
98
+ # The base the opening command names. Absent — the host takes the default branch: an empty answer.
99
+ rt_delivery_open_base() {
100
+ command -v perl >/dev/null 2>&1 || return 0
101
+ printf '%s' "$cmd" | perl -0ne '
102
+ if (/(?:^|\s)(?:--base|-B)(?:=|\s+)(?:"((?:[^"\\]|\\.)*)"|\x27([^\x27]*)\x27|(\S+))/s) {
103
+ print defined $1 ? $1 : (defined $2 ? $2 : $3);
104
+ }
105
+ ' 2>/dev/null
106
+ }
107
+
108
+ # The draft agreement the plan of the branch named by the line `**Draft:** \`path\``. The plan is
109
+ # read from the history: by the time the PR opens the folder is taken apart, and the last commit
110
+ # touching the plan is the one that removed it — then its parent still holds the plan.
111
+ rt_branch_plan_draft() {
112
+ _commit="$(git log -1 --format=%H "$2..HEAD" -- "$1/plan.md" 2>/dev/null)"
113
+ [ -n "$_commit" ] || return 0
114
+ { git show "$_commit:$1/plan.md" 2>/dev/null || git show "$_commit^:$1/plan.md" 2>/dev/null; } \
115
+ | sed -nE 's/^\*\*Draft:\*\*[[:space:]]*`([^`]+)`.*/\1/p' | head -1
116
+ }
117
+
81
118
  # Condition for leaving draft: the same subject between opening and merging. The owner reads a PR
82
119
  # out of draft as an invitation to merge, and presses the button without waiting for the cleanup
83
120
  # commit: the merge guard does not reach here at all — a person on the hosting presses it. Three
@@ -0,0 +1,99 @@
1
+ #!/usr/bin/env bash
2
+ # A draft on a base the pipeline does not wake for, 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_pull_draft` with the command text on a PR opening.
5
+ #
6
+ # A draft waits for a run. Where no run comes it waits for nothing, and the owner sees a locked
7
+ # merge button and a PR that reads as unfinished: one such draft stood half an hour waiting for a
8
+ # check that would never start. The rule said so in words; nothing held it.
9
+ #
10
+ # The bases are read from the pipeline file the tree already named for the push gate, not from a
11
+ # list of their own: a second list drifts from the file the first day the trigger changes.
12
+ #
13
+ # FAIL-OPEN: no settings, no pipeline file, a trigger without a branch filter, a pipeline of another
14
+ # host — not judged. A wrong refusal here would forbid a lawful draft, and silence costs half an hour.
15
+
16
+ # The pipeline file the tree named. Printed empty where there is none.
17
+ rt_pipeline_file() {
18
+ local settings="${CLAUDE_PROJECT_DIR:-.}/.claude/rt-kit/checks.json" file
19
+ [ -f "$settings" ] || return 0
20
+ file="$(jq -r '.pushGate.pipelineFile // empty' "$settings" 2>/dev/null)"
21
+ [ -n "$file" ] && [ -f "${CLAUDE_PROJECT_DIR:-.}/$file" ] && printf '%s' "${CLAUDE_PROJECT_DIR:-.}/$file"
22
+ return 0
23
+ }
24
+
25
+ # The branch patterns of the `pull_request` trigger, one per line. Prints nothing where the trigger
26
+ # has no such list: then the pipeline wakes for every base, or the file is of another host. Both the
27
+ # list form and the inline form are read; `branches-ignore` and `pull_request_target` are not.
28
+ rt_pipeline_pull_bases() {
29
+ awk '
30
+ function indent(line) { match(line, /^ */); return RLENGTH }
31
+ function clean(word) {
32
+ sub(/[[:space:]]*#.*$/, "", word)
33
+ gsub(/^[[:space:]"\047]+|[[:space:]"\047]+$/, "", word)
34
+ return word
35
+ }
36
+ !trigger {
37
+ if ($0 ~ /^[[:space:]]*pull_request:[[:space:]]*(#.*)?$/) { trigger = 1; trigger_at = indent($0) }
38
+ next
39
+ }
40
+ /^[[:space:]]*(#.*)?$/ { next }
41
+ indent($0) <= trigger_at { exit }
42
+ !list {
43
+ if ($0 ~ /^[[:space:]]*branches:/) {
44
+ line = $0
45
+ sub(/^[[:space:]]*branches:[[:space:]]*/, "", line)
46
+ if (line ~ /^\[/) {
47
+ gsub(/[][]/, "", line)
48
+ count = split(line, words, ",")
49
+ for (i = 1; i <= count; i++) if (clean(words[i]) != "") print clean(words[i])
50
+ exit
51
+ }
52
+ list = 1
53
+ list_at = indent($0)
54
+ }
55
+ next
56
+ }
57
+ indent($0) <= list_at && $0 !~ /^[[:space:]]*-/ { exit }
58
+ /^[[:space:]]*-/ { line = $0; sub(/^[[:space:]]*-[[:space:]]*/, "", line); print clean(line) }
59
+ ' "$1" 2>/dev/null
60
+ }
61
+
62
+ # Quoted text is cut first: a title may mention the flag.
63
+ rt_pull_asks_draft() {
64
+ printf '%s' "$1" | sed -E "s/\"[^\"]*\"//g; s/'[^']*'//g" \
65
+ | grep -qE '(^|[[:space:]])(--draft(=true)?|-d)([[:space:]]|$)'
66
+ }
67
+
68
+ rt_delivery_pull_draft() {
69
+ local command_text="$1" file bases base pattern
70
+ rt_pull_asks_draft "$command_text" || return 0
71
+
72
+ file="$(rt_pipeline_file)"
73
+ [ -n "$file" ] || return 0
74
+ bases="$(rt_pipeline_pull_bases "$file")"
75
+ [ -n "$bases" ] || return 0
76
+
77
+ # The base named by the command. Absent — the host takes the default branch.
78
+ base=''
79
+ if command -v perl >/dev/null 2>&1; then
80
+ base="$(printf '%s' "$command_text" | perl -0ne '
81
+ if (/(?:^|\s)(?:--base|-B)(?:=|\s+)(?:"((?:[^"\\]|\\.)*)"|\x27([^\x27]*)\x27|(\S+))/s) {
82
+ print defined $1 ? $1 : (defined $2 ? $2 : $3);
83
+ }
84
+ ' 2>/dev/null)"
85
+ fi
86
+ base="${base:-${main_branch:-main}}"
87
+
88
+ while IFS= read -r pattern; do
89
+ [ -z "$pattern" ] && continue
90
+ # shellcheck disable=SC2254
91
+ case "$base" in
92
+ $pattern) return 0 ;;
93
+ esac
94
+ done <<EOF
95
+ $bases
96
+ EOF
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."
99
+ }
@@ -20,6 +20,25 @@
20
20
  # for a word over the whole line, that is, into a refusal on every mention of the command.
21
21
  . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/hook-input.sh" 2>/dev/null || true
22
22
 
23
+ rt_delivery_branch_signature() {
24
+ # The signature: the address of the machine account is declared by the tree, and the working
25
+ # copy does not know it — which means the very first commit will travel under someone else's
26
+ # signature, and after the push that is fixed only by a force push.
27
+ #
28
+ # A person the tree named in RT_HUMAN_EMAILS signs with their own mail lawfully: the push
29
+ # accepts it, and refusing it here left such a person no way to start a branch at all.
30
+ if [ -n "$commit_email" ]; then
31
+ tree_email="$(git config user.email 2>/dev/null)"
32
+ human_email=''
33
+ for one in ${RT_HUMAN_EMAILS:-}; do
34
+ [ "$tree_email" = "$one" ] && human_email=1 && break
35
+ done
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}\"."
38
+ fi
39
+ return 0
40
+ }
41
+
23
42
  rt_delivery_signature() {
24
43
  # --- the signature of a machine commit ----------------------------------------------------
25
44
  #
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env bash
2
2
  # rt-hook: PreToolUse Bash|mcp__webstorm__execute_terminal_command|mcp__webstorm__execute_tool
3
- # Requires: hooks/git-guard-delivery-merged.sh, hooks/git-guard-delivery-folder.sh,hooks/git-guard-delivery-epic.sh, hooks/git-guard-tree-assignment.sh, hooks/git-guard-delivery-conflict.sh, hooks/profile-check.sh, hooks/deny-tail.sh, hooks/guard-note.sh
3
+ # Requires: hooks/git-guard-delivery-merged.sh, hooks/git-guard-delivery-folder.sh,hooks/git-guard-delivery-epic.sh, hooks/git-guard-delivery-pipeline.sh, hooks/git-guard-tree-assignment.sh, hooks/git-guard-delivery-conflict.sh, hooks/profile-check.sh, hooks/deny-tail.sh, hooks/guard-note.sh
4
4
  # Delivery guard. PreToolUse on creating a branch, on the push and on opening a PR.
5
5
  #
6
6
  # The delivery law demands three things nothing usually checks: an edit starts from a task visible
@@ -40,6 +40,7 @@
40
40
 
41
41
  # Its own name in the observations: the refusal is written by the shared deny tail, not here.
42
42
  RT_GUARD_NAME=git-guard-delivery
43
+ RT_GUARD_RULE=git-workflow
43
44
 
44
45
  . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utf8.sh" 2>/dev/null || true
45
46
  . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/hook-input.sh" 2>/dev/null || true
@@ -117,6 +118,7 @@ pull_token_hint="${RT_PULL_TOKEN_HINT:-}"
117
118
  # the pattern is named by the tree, not by the package: the package does not know someone else's
118
119
  # words, and an invented default would match nothing.
119
120
  pull_body_section="${RT_PULL_BODY_SECTION:-}"
121
+ pull_points_section="${RT_PULL_POINTS_SECTION:-}"
120
122
  # The line that closes the task on the merge, with `{number}` in place of the task number. Its keyword
121
123
  # belongs to the hosting, so the sample is named by the tree, as the section above.
122
124
  pull_closes_line="${RT_PULL_CLOSES_LINE:-}"
@@ -242,6 +244,10 @@ check_task() {
242
244
  return 0
243
245
  }
244
246
 
247
+ # The signature of a new branch and of a push live in one helper, so it is sourced before both.
248
+ # shellcheck disable=SC1090
249
+ [ -f "$rt_hooks_dir/git-guard-delivery-signature.sh" ] && . "$rt_hooks_dir/git-guard-delivery-signature.sh" 2>/dev/null
250
+
245
251
  # --- creating a branch -------------------------------------------------------------------
246
252
  branch_arg=''
247
253
  if printf '%s' "$cmd" | grep -qE '(^|[;&|[:space:]])git[[:space:]]+(checkout([[:space:]]+-[A-Za-z-]+)*[[:space:]]+-b|switch([[:space:]]+-[A-Za-z-]+)*[[:space:]]+-c)[[:space:]]'; then
@@ -295,14 +301,7 @@ if [ -n "$branch_arg" ]; then
295
301
  fault "your ref origin/${main_branch} lags behind the remote one — ${local_head:0:8} against ${remote_head:0:8}. The branch will grow from yesterday tree, and the owner sees that at the opening of the request. Pull and repeat: git fetch origin."
296
302
  fi
297
303
 
298
- # The signature: the address of the machine account is declared by the tree, and the working
299
- # copy does not know it — which means the very first commit will travel under someone else's
300
- # signature, and after the push that is fixed only by a force push.
301
- if [ -n "$commit_email" ]; then
302
- tree_email="$(git config user.email 2>/dev/null)"
303
- [ -n "$tree_email" ] && [ "$tree_email" != "$commit_email" ] \
304
- && 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}\"."
305
- fi
304
+ command -v rt_delivery_branch_signature >/dev/null 2>&1 && rt_delivery_branch_signature
306
305
 
307
306
  deny_faults
308
307
  fi
@@ -314,28 +313,22 @@ fi
314
313
  # The subject lives in a helper next door — `git-guard-delivery-signature.sh`: the guard grew up to
315
314
  # the length limit, and the signature is the most separate of its subjects. No helper — the
316
315
  # signature is not judged, and the work goes on: the same fail-open as with the other conditions.
317
- # shellcheck disable=SC1090
318
- [ -f "$rt_hooks_dir/git-guard-delivery-signature.sh" ] \
319
- && . "$rt_hooks_dir/git-guard-delivery-signature.sh" 2>/dev/null
320
316
  command -v rt_delivery_signature >/dev/null 2>&1 && rt_delivery_signature
321
317
 
322
318
  # --- the push into a merged branch -----------------------------------------------------------
323
319
  # The helper next door — `git-guard-delivery-merged.sh`. No helper — the push is not judged by it.
324
320
  # shellcheck disable=SC1090
325
- [ -f "$rt_hooks_dir/git-guard-delivery-merged.sh" ] \
326
- && . "$rt_hooks_dir/git-guard-delivery-merged.sh" 2>/dev/null
321
+ [ -f "$rt_hooks_dir/git-guard-delivery-merged.sh" ] && . "$rt_hooks_dir/git-guard-delivery-merged.sh" 2>/dev/null
327
322
  command -v rt_delivery_merged >/dev/null 2>&1 && rt_delivery_merged
328
323
 
329
324
  # --- leaving draft ---------------------------------------------------------------------------
330
325
  # The subject lives in a helper next door — `git-guard-delivery-draft.sh`, by the same technique as
331
326
  # the signature. No helper — leaving draft is not judged, and the work goes on.
332
327
  # shellcheck disable=SC1090
333
- [ -f "$rt_hooks_dir/git-guard-delivery-draft.sh" ] \
334
- && . "$rt_hooks_dir/git-guard-delivery-draft.sh" 2>/dev/null
328
+ [ -f "$rt_hooks_dir/git-guard-delivery-draft.sh" ] && . "$rt_hooks_dir/git-guard-delivery-draft.sh" 2>/dev/null
335
329
  command -v rt_delivery_draft_ready >/dev/null 2>&1 && rt_delivery_draft_ready
336
330
 
337
331
  # --- merging a PR --------------------------------------------------------------------------
338
- #
339
332
  # The second line of the same condition that stands at the opening of a PR: it catches a merge going
340
333
  # by command. We look for the command from the start of the line or after a separator, not anywhere
341
334
  # in the text. Otherwise the guard refuses a message where `gh pr merge` is merely mentioned in
@@ -404,9 +397,12 @@ if [ -n "$title" ]; then
404
397
  fi
405
398
  fi
406
399
 
400
+ # A draft into a base the pipeline does not wake for waits for nothing. No helper — not judged.
401
+ [ -f "$rt_hooks_dir/git-guard-delivery-pipeline.sh" ] && . "$rt_hooks_dir/git-guard-delivery-pipeline.sh" 2>/dev/null
402
+ command -v rt_delivery_pull_draft >/dev/null 2>&1 && rt_delivery_pull_draft "$cmd"
403
+
407
404
  # The main branch is merged in before the PR opens: otherwise the reviewer sees someone else's edit
408
405
  # mixed in with his own, and the checks run from an outdated base.
409
- #
410
406
  # There are two tiers. The first reads the local tip and works without the network. The second asks
411
407
  # the remote reference: without it, silence means only "the local reference is not older than the
412
408
  # branch", while it reads as "the main branch is merged in". No answer from the network — a silent
@@ -477,7 +473,6 @@ fi
477
473
  [ -f "$rt_hooks_dir/git-guard-delivery-body.sh" ] && . "$rt_hooks_dir/git-guard-delivery-body.sh" 2>/dev/null
478
474
  command -v rt_delivery_pull_body >/dev/null 2>&1 && rt_delivery_pull_body
479
475
 
480
-
481
476
  # The task folder is taken apart before the PR opens, not after the approval: the owner merges as
482
477
  # soon as he sees green, and no room is left for a closing commit — three times in a row the folder
483
478
  # travelled into the main branch without being taken apart. After the cleanup the progress guard
@@ -487,5 +482,6 @@ rt_delivery_open_folder
487
482
  # Everything that did not come together is named here, all at once: up to this line the conditions
488
483
  # were being collected, each of which used to refuse the call on its own.
489
484
  deny_faults
485
+ command -v rt_delivery_open_handover >/dev/null 2>&1 && rt_delivery_open_handover "$cmd" "$branch"
490
486
 
491
487
  exit 0
@@ -19,6 +19,7 @@
19
19
  # in the way of work.
20
20
 
21
21
  RT_GUARD_NAME=git-guard-discard
22
+ RT_GUARD_RULE=git-workflow
22
23
 
23
24
  . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utf8.sh" 2>/dev/null || true
24
25
  . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/hook-input.sh" 2>/dev/null || true