@rt-tools/agent-kit 0.28.0 → 0.29.1

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 (81) hide show
  1. package/assets/checks/board-epic-link.github.mjs +13 -1
  2. package/assets/checks/board-epic-plan.github.mjs +128 -9
  3. package/assets/checks/board-epics.github.mjs +6 -10
  4. package/assets/checks/board-folders.mjs +50 -0
  5. package/assets/checks/board-runs.github.mjs +102 -2
  6. package/assets/checks/check-board.github.mjs +63 -3
  7. package/assets/checks/check-lib-layers.mjs +4 -2
  8. package/assets/checks/check-spec-coverage.mjs +65 -0
  9. package/assets/checks/check-work-steps.mjs +238 -0
  10. package/assets/checks/epic-table.github.mjs +15 -6
  11. package/assets/checks/lib-common.mjs +9 -4
  12. package/assets/checks/lib-domains.mjs +7 -4
  13. package/assets/checks/main-run.github.mjs +69 -0
  14. package/assets/checks/rt-kit-checks.config.mjs +16 -1
  15. package/assets/checks/task-new.github.mjs +6 -6
  16. package/assets/checks/tree-assignment.mjs +169 -0
  17. package/assets/defaults/project.sh +15 -1
  18. package/assets/hooks/end-conversation-guard.sh +59 -0
  19. package/assets/hooks/epic-over.sh +11 -2
  20. package/assets/hooks/git-guard-delivery-epic.sh +15 -1
  21. package/assets/hooks/git-guard-delivery.sh +4 -2
  22. package/assets/hooks/git-guard-push-tests.sh +31 -8
  23. package/assets/hooks/git-guard-tree-assignment.sh +77 -0
  24. package/assets/hooks/grill-gate.sh +63 -2
  25. package/assets/hooks/hook-input.sh +8 -1
  26. package/assets/hooks/main-run-context.sh +45 -0
  27. package/assets/hooks/prose-style-guard.sh +49 -3
  28. package/assets/hooks/tree-assignment-guard.sh +101 -0
  29. package/assets/hooks/turn-exit-epic.sh +149 -0
  30. package/assets/hooks/turn-exit-guard.sh +40 -24
  31. package/assets/hooks/turn-exit-patterns.sh +50 -8
  32. package/assets/hooks/turn-exit-verdict.sh +39 -8
  33. package/assets/hooks/waiting-turn-guard.sh +56 -1
  34. package/assets/hooks/write-targets.sh +23 -1
  35. package/assets/laws/delivery.md +6 -0
  36. package/assets/laws/work-conduct.md +26 -0
  37. package/assets/patterns/doc-style-human.md +6 -0
  38. package/assets/patterns/git-workflow-merge.md +14 -0
  39. package/assets/patterns/git-workflow-pr-body.github.md +161 -0
  40. package/assets/patterns/git-workflow-pr.github.md +6 -104
  41. package/assets/patterns/git-workflow-stack.md +19 -2
  42. package/assets/patterns/spec-driven-domain.md +4 -0
  43. package/assets/patterns/status-report-table.github.md +6 -0
  44. package/assets/patterns/task-flow-close.md +1 -1
  45. package/assets/patterns/task-flow-resume.md +8 -0
  46. package/assets/patterns/task-flow-start.md +26 -22
  47. package/assets/patterns/testing-e2e.md +14 -0
  48. package/assets/pitfalls/git-workflow.github.md +6 -0
  49. package/assets/pitfalls/turn-conduct.md +46 -0
  50. package/assets/rules/doc-style.md +3 -2
  51. package/assets/rules/git-workflow.github.md +37 -38
  52. package/assets/rules/observability.needs-app.md +5 -0
  53. package/assets/rules/reuse-first.md +33 -11
  54. package/assets/rules/task-flow.md +57 -56
  55. package/assets/rules/testing.md +15 -0
  56. package/assets/rules/turn-conduct.md +70 -73
  57. package/assets/rules/typescript-conventions.md +8 -0
  58. package/assets/samples/tasks/_template/plan.md +7 -1
  59. package/assets/samples/tasks/_template/progress.md +14 -1
  60. package/bin/agent-kit.d.ts.map +1 -1
  61. package/bin/agent-kit.js +2 -1
  62. package/bin/agent-kit.js.map +1 -1
  63. package/lib/cargo.d.ts +49 -1
  64. package/lib/cargo.d.ts.map +1 -1
  65. package/lib/cargo.js +9 -2
  66. package/lib/cargo.js.map +1 -1
  67. package/lib/observations-cargo.d.ts +32 -0
  68. package/lib/observations-cargo.d.ts.map +1 -0
  69. package/lib/observations-cargo.js +105 -0
  70. package/lib/observations-cargo.js.map +1 -0
  71. package/lib/shipment.d.ts +8 -20
  72. package/lib/shipment.d.ts.map +1 -1
  73. package/lib/shipment.js +22 -39
  74. package/lib/shipment.js.map +1 -1
  75. package/lib/tree-mark.d.ts +17 -0
  76. package/lib/tree-mark.d.ts.map +1 -0
  77. package/lib/tree-mark.js +41 -0
  78. package/lib/tree-mark.js.map +1 -0
  79. package/package.json +1 -1
  80. package/rt-tools-agent-kit-0.29.1.tgz +0 -0
  81. package/rt-tools-agent-kit-0.28.0.tgz +0 -0
@@ -86,6 +86,23 @@ taken_path_re='/tasks/'
86
86
  # because the next task was taken instead of this, not on top of it.
87
87
  ready_re='pr[[:space:]]+ready|run[[:space:]]+(list|view|watch)|pr[[:space:]]+checks|check-runs|check:board|board\.mjs'
88
88
 
89
+ # A run started or rerun in the turn. Its outcome does not call by itself: a rerun went through in
90
+ # one line between other things, its state was read once — «queued» — and the turn ended by a lawful
91
+ # exit while the request stayed without watching; the owner found the green run before the
92
+ # executor. The sign is the pair: a starting command in the turn and no command that waits for the
93
+ # end in the same turn. A wait is a watching command of the hosting client, a loop until the end or
94
+ # the watching tool — in the background or blocking; a single read of the state is not a wait.
95
+ # Incident analysis — the record "2026-09-15-turn-idle-after-green-run" in the intake.
96
+ started_run_re='run[[:space:]]+rerun|workflow[[:space:]]+run|ci[[:space:]]+(retry|run)|pipeline[[:space:]]+(run|retry)|pipelines[[:space:]]+run'
97
+
98
+ # A run nobody started by hand: the pipeline wakes on an opened request by itself, and the tier
99
+ # above stays silent — there is no starting command in the turn at all. The sign is taken from the
100
+ # output rather than from the base of the request: which bases wake the pipeline the guard cannot
101
+ # know, and a demand by the bare fact of opening would refuse every request into an epic branch.
102
+ # So the pair is "the request is opened in the turn" and "its run is read as going".
103
+ going_run_re='queued|in_progress|"status"[[:space:]]*:[[:space:]]*"(queued|in_progress)"|status:[[:space:]]*(queued|in_progress)'
104
+ watched_run_re='run[[:space:]]+watch|pr[[:space:]]+checks[^|;&]*--watch|until[[:space:]][^\n]*sleep|while[[:space:]][^\n]*sleep|ci[[:space:]]+status[^|;&]*--live|pipelines[[:space:]]+runs[[:space:]]+show'
105
+
89
106
  # One's own named action. An empty turn that declared what it will do next gives itself away by
90
107
  # nothing: it opened no PR, read no run, and both earlier signs are silent. It is caught by form —
91
108
  # a set of future-tense patterns about one's own step — not by understanding the meaning; and no
@@ -99,7 +116,9 @@ vow_re='дальше беру|дальше возьму|дальше иду|сл
99
116
  # A 400-line tail: the turn record grows all session, and only the last turn is judged.
100
117
  verdict="$(tail -n 400 "$transcript" 2>/dev/null | jq -s -r \
101
118
  --arg opened "$opened_re" --arg taken "$taken_re" --arg taken_path "$taken_path_re" \
102
- --arg read "$read_re" --arg red "$red_re" --arg ready "$ready_re" --arg vow "$vow_re" '
119
+ --arg read "$read_re" --arg red "$red_re" --arg ready "$ready_re" --arg vow "$vow_re" \
120
+ --arg started_run "$started_run_re" --arg watched_run "$watched_run_re" \
121
+ --arg going_run "$going_run_re" '
103
122
  def is_input:
104
123
  .type == "user"
105
124
  and ((.isCompactSummary // false) | not)
@@ -127,6 +146,11 @@ verdict="$(tail -n 400 "$transcript" 2>/dev/null | jq -s -r \
127
146
  | (($ran | test($read; "i")) and ($out | test($red; "i"))) as $red_run
128
147
  | (($ran | test($taken; "i")) or ($wrote | test($taken_path; "i"))) as $went_on
129
148
  | ($ran | test($ready; "i")) as $checked
149
+ # The run started in the turn and the wait for its end: the watching tool counts as a wait too.
150
+ | ($ran | test($started_run; "i")) as $reran
151
+ # The run of the request opened in this turn: read as going and left without a wait.
152
+ | ($opened_pr and ($out | test($going_run; "i"))) as $own_run_going
153
+ | (($ran | test($watched_run; "i")) or ($uses | map(.name // "") | any(. == "Monitor"))) as $watched_run
130
154
  | ([$turn[] | select(.type == "assistant") | (.message.content // [])[]
131
155
  | select(.type == "text") | .text] | join("\n")) as $said
132
156
  | ($said | test($vow; "i")) as $announced
@@ -134,6 +158,7 @@ verdict="$(tail -n 400 "$transcript" 2>/dev/null | jq -s -r \
134
158
  | if $opened_pr and ($went_on | not) and ($checked | not) then "owe:both"
135
159
  elif $opened_pr and ($went_on | not) then "owe:pr"
136
160
  elif $opened_pr and ($checked | not) then "owe:draft"
161
+ elif ($reran or $own_run_going) and ($watched_run | not) then "owe:watch"
137
162
  elif $went_on then "pass"
138
163
  elif $red_run then "owe:run"
139
164
  elif $announced and $tools == 0 then "owe:vow"
@@ -190,6 +215,36 @@ ${deny_tail_text}"
190
215
  exit 0
191
216
  fi
192
217
 
218
+ # A run started or rerun in the turn without a wait for its end. The next task taken does not lift
219
+ # this: the request stays without watching either way, and its outcome reaches the owner first.
220
+ if [ "$verdict" = "owe:watch" ]; then
221
+ reason="BLOCKED by waiting-turn-guard: a run of this turn was left without a wait for its end — started by hand, or started by the request opened here and read as going.
222
+
223
+ The outcome of a run does not call by itself: a state read once — «queued», «in_progress» — is a moment, not a result. Without a wait the request stays without watching, the draft is not lifted and the merge is not asked, and the owner finds the green run before the executor.
224
+
225
+ Put the wait in this same turn, in the background or blocking:
226
+
227
+ gh run watch <id> --exit-status & # returns the session to the request at the end
228
+ gh pr checks <number> --watch
229
+
230
+ The end of a run is learned from the return of such a command, not from a look at the page.
231
+
232
+ The guard judges one turn: the next session is not refused."
233
+
234
+ # shellcheck disable=SC1090
235
+ [ -f "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/deny-tail.sh" ] \
236
+ && . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/deny-tail.sh" 2>/dev/null
237
+ command -v rt_deny_tail >/dev/null 2>&1 || rt_deny_tail() { :; }
238
+ deny_tail_text="$(rt_deny_tail "")"
239
+ [ -n "$deny_tail_text" ] && reason="${reason}
240
+
241
+ ${deny_tail_text}"
242
+
243
+ jq -n --arg r "$reason" '{decision:"block",reason:$r}' 2>/dev/null \
244
+ || printf '{"decision":"block","reason":"waiting-turn-guard: a run was started in the turn, and nothing waits for its end."}\n'
245
+ exit 0
246
+ fi
247
+
193
248
  # A draft left while the next task is taken is a separate refusal: there the demand is not about
194
249
  # the next task but about carrying the handed-in one to the end.
195
250
  if [ "$verdict" = "owe:draft" ]; then
@@ -42,8 +42,30 @@ rt_write_targets() {
42
42
  rt_wt_text="$(printf '%s' "$rt_wt_text" \
43
43
  | sed -E 's#(&|[0-9]*)>>?[[:space:]]*/dev/(null|stderr)##g; s#[0-9]*>&[0-9-]##g')"
44
44
 
45
+ # The bodies of the heredocs are cut out of the shell parse: they are data of the command, not
46
+ # the command. A markdown quote line inside a body — a caret and a path — read as a redirection,
47
+ # and an edit that wrote nothing into the tree was refused by the path standing in that quote.
48
+ # The bodies are parsed separately, by the interpreter branch below.
49
+ rt_wt_shell="$(printf '%s' "$rt_wt_text" | awk -v q="'" '
50
+ function trim(s) { sub(/^[ \t]+/, "", s); sub(/[ \t]+$/, "", s); return s }
51
+ tag != "" { if (trim($0) == tag) { tag = "" } ; next }
52
+ {
53
+ print
54
+ s = $0
55
+ re = "<<-?[ \t]*(\"[^\"]+\"|" q "[^" q "]+" q "|[A-Za-z_][A-Za-z0-9_]*)"
56
+ while (match(s, re)) {
57
+ t = substr(s, RSTART, RLENGTH)
58
+ s = substr(s, RSTART + RLENGTH)
59
+ sub(/^<<-?[ \t]*/, "", t)
60
+ gsub(/\"/, "", t)
61
+ gsub(q, "", t)
62
+ tag = t
63
+ }
64
+ }
65
+ ')"
66
+
45
67
  {
46
- printf '%s' "$rt_wt_text" \
68
+ printf '%s' "$rt_wt_shell" \
47
69
  | tr "\"'\`" ' ' \
48
70
  | sed -E 's/>>?/\n>/g' \
49
71
  | sed -nE '
@@ -102,6 +102,12 @@ application stops responding, and the reason is found from the history.
102
102
  shown as taken, one waiting for review as waiting. Otherwise untouched, in progress and done look
103
103
  the same: the work is taken a second time, and the PR stands unreviewed. The state is moved at the
104
104
  moment the work goes to the next step: the queue is read between those moments, not after them.
105
+ - **The state of an epic card in the work queue matches the epic's work the same way.** The epic
106
+ is taken into work with its first task and waits for review with its own change into the main
107
+ branch; its card says so at those two moments, the same as a task's card. Otherwise an epic with
108
+ half its tasks merged stands in the queue as never taken, and the owner watching one card per
109
+ epic sees no work at all. The share of tasks done the queue shows on the epic card by itself,
110
+ once the tasks are linked to it; the column it does not move.
105
111
  - **A change entering the main branch means a rollout.** Everything the change depends on outside
106
112
  the code — environment variables, secrets, name records — is put in place before that moment, not
107
113
  after.
@@ -90,6 +90,16 @@ one session and keeps its whole context and state when it passes to the next.
90
90
  check.
91
91
  - **Done work is marked in one place.** Two records of the same thing drift apart silently, and then
92
92
  neither shows what remains.
93
+ - **The steps of the work are written out in full before it starts, and each of them can be called
94
+ done or not done.** A plan of prose alone cannot say how much is left: whoever reads it counts by
95
+ eye and counts differently every time, so the work reads as nearly finished from the first step
96
+ onwards.
97
+ - **The step going on right now is marked at every minute of the work, and there is only ever one.**
98
+ A record that names the whole stage and not the step inside it says nothing about where the work
99
+ broke off, and the session that picks it up starts by guessing.
100
+ - **Work with a step that is not done is not finished, and a report about the done does not finish
101
+ it either.** A report ends the account, not the work: it looks like completeness better than
102
+ anything else, and the emptiness behind it is invisible to whoever wrote it.
93
103
  - **A decision made along the way is written down together with its reason.** Without a reason it
94
104
  reads as accidental and is revoked by the next session, and brought back by the third.
95
105
  - **The boundary of the work is named before it starts.** A boundary not named aloud does not exist:
@@ -158,6 +168,10 @@ one session and keeps its whole context and state when it passes to the next.
158
168
  looks at it. An epic with one card out of ten looks there like one step of work. The card number
159
169
  goes into the plan by the same edit: otherwise the plan answers "take the next one" with a title,
160
170
  and the card is created again under a new number.
171
+ - **Taking the first task of an epic takes the epic itself into work, and the epic card says so.**
172
+ The owner follows the epic by one card, not by its tasks; a card that stays where the epic was
173
+ declared reads as an epic nobody started, however many of its tasks are already done. The card
174
+ moves by the same motion as the first task's, not by a separate step remembered later.
161
175
  - **An executor's session does not end together with the task.** The end of a task is not a sign to
162
176
  stop: only the window fill limit allows stopping. A session closed on a finished task leaves the
163
177
  owner a blank and costs a whole session to return to what was at hand.
@@ -186,6 +200,18 @@ one session and keeps its whole context and state when it passes to the next.
186
200
  being watched. While it runs, the next task is taken, and the check is returned to in the turn
187
201
  that reads its end. A session spent waiting costs as much as one with a task done, and yields
188
202
  nothing.
203
+ - **A check the work started is watched to its end, and watching goes beside the next task.** Not
204
+ waiting and not watching are different things: the first frees the executor, the second abandons
205
+ the work. The return is arranged in the turn that started the check, by something that comes back
206
+ by itself; a state read once is a moment, not an outcome.
207
+ - **A check is started by the work, not only by the command that names it.** Handing the work over
208
+ starts a check by itself where the machine is set up for that, and the executor answers for it as
209
+ for one started by hand.
210
+ - **A check that came back green is carried to the end by the one who handed the work over.** What
211
+ is left after it — a lock to lift, a mark to set — is the executor's step: the owner sees the lock
212
+ and reads it as work still going. A red one is fixed by the same executor, in the same work.
213
+ - **A check left with nobody watching is a miss and is analysed as one.** The work is finished and
214
+ nobody knows it; every minute until the owner asks is paid by them.
189
215
  - **A wait that does stop the work is named to the owner separately and directly.** Sometimes there
190
216
  is no way forward: the next task stands on one not yet reviewed, or the change waits for a
191
217
  decision only the owner has. Then the executor says three things — what stands still, what it
@@ -85,6 +85,12 @@ not choose.
85
85
 
86
86
  ## Pitfalls
87
87
 
88
+ - **An edit made by a shell command is judged by the whole command, the old version inside it
89
+ included.** The style check gets the body of the call, not the text that will end up in the
90
+ file: a rewrite carrying the previous wording inside a heredoc or an interpreter string is
91
+ refused by the words of that previous wording. The refusal repeats at the second attempt,
92
+ because the old text is still there. The new text is written by the edit tool — there only the
93
+ new text is judged — or inserted by line number, and the command is given the path.
88
94
  - **Shorter does not mean clearer.** A text in the layer's words comes out a third shorter and
89
95
  is useless to whoever decides whether the work is urgent.
90
96
  - **"Not X but Y" looks like an explanation and explains nothing.** The owner learns what was
@@ -47,6 +47,7 @@ technique, and different files of one merge are resolved differently.
47
47
  | a build from a description | rebuilt from the description after the description is resolved: a generator writes the lines of such a file, and sides joined by hand give a file it would never output |
48
48
  | a spec in `docs/specs/` | by keeping both sides, if both appended; a section removed by one side stays removed — rule `spec-driven`; after — `npm run check:specs` |
49
49
  | a rule's companion next to the rule | by keeping both sides — the same two additions to one table; after — `npm run check:specs` |
50
+ | the table of working-copy assignments | by the base's side whole. The owner fills it in the main branch, and a session does not write it: the branch's side can only be an older copy. After — the reading the session start prints |
50
51
  | the work list (`docs/BACKLOG.md`) | by the selection sign — pattern `doc-style-sweep` |
51
52
 
52
53
  ## A commit is carried over by a cherry-pick
@@ -131,6 +132,19 @@ repository refuses about Projects (classic) and never reaches the edit:
131
132
  /opt/homebrew/bin/gh api -X PATCH repos/<владелец>/<репозиторий>/pulls/<номер> -f body="$(cat тело.md)"
132
133
  ```
133
134
 
135
+ ## The task of a merged PR is asked, not assumed closed
136
+
137
+ The host closes the task by the `Closes` line only when the base is the default branch. A PR
138
+ merged into an epic branch or into the previous branch of a chain leaves its task open unless the
139
+ tree closes it by a pipeline of its own — and the column of the board lags the work until then.
140
+ After every known merge with such a base the task's state is asked by a command; one still open
141
+ is closed by hand with a comment naming the PR — the calls are in the pattern
142
+ `git-workflow-stack`.
143
+
144
+ ```bash
145
+ gh issue view <номер> --json state --jq .state
146
+ ```
147
+
134
148
  ## A green run ages together with the main branch
135
149
 
136
150
  A run speaks about the base it went on. While it goes and the PR awaits review, the main branch
@@ -0,0 +1,161 @@
1
+ ---
2
+ name: git-workflow-pr-body
3
+ kind: pattern
4
+ rule: git-workflow
5
+ description: Pattern of rule git-workflow. Load when the PR body is written or edited — the Closes line and how the task closes when the base is not the main branch, reviewer, assignee and labels by the opening call, the four sections of the body. Opening the PR itself — pattern git-workflow-pr.
6
+ ---
7
+
8
+ # The PR body and the link to the task
9
+
10
+ Pattern of the rule `git-workflow`. What must be true — the law
11
+ `docs/constitution/delivery.md`. Opening the PR, the draft and its state — pattern
12
+ `git-workflow-pr`; a chain of branches — `git-workflow-stack`.
13
+
14
+ ## When to use
15
+
16
+ - The body of a PR is written or rewritten — at the opening, after a merge into the branch, in
17
+ the turn that lifts the draft.
18
+ - The base of the PR is an epic branch or the previous branch of a chain, and it has to be said
19
+ how the task closes.
20
+ - Reviewer, assignee and labels are set on an already open PR.
21
+
22
+ ## The PR is attached to the task
23
+
24
+ The body starts with the link line — by it the board fills the linked PRs field. Reviewer,
25
+ assignee and labels are set by the same command, and a PR does not open without them:
26
+
27
+ ```bash
28
+ GH_TOKEN="$TOKEN" gh pr create --title '[<КЛЮЧ>-86] Письмо владельцу с незаполненным адресом попадает в логи' \
29
+ --base <ветка эпика> --body-file <файл с телом> \
30
+ --reviewer <владелец> --assignee <бот> --label bug --label area:api
31
+ ```
32
+
33
+ **The title stands first in the call, and the body comes in by a file.** The delivery guard reads
34
+ the title out of the command text and takes the first match of the short key: a body passed as a
35
+ line in the same call may itself hold a word after that key — a quoted command, a label, a run
36
+ line — and it becomes the title in the guard's eyes. The refusal then says the title does not
37
+ start with the task number while the real title is right, and the mistake is looked for where
38
+ there is none. A body in a file leaves the call one title and nothing else to match.
39
+
40
+ The reviewer is always the owner: without a review request the PR does not show in their queue.
41
+ The assignee is the same account the machine work goes from. Labels are taken from the task
42
+ whole — both the kind of edit and all its areas; they are read from the task, not picked from
43
+ memory:
44
+
45
+ ```bash
46
+ /opt/homebrew/bin/gh issue view 86 --json labels --jq '.labels | map(.name) | join(",")'
47
+ ```
48
+
49
+ The line `Closes #<номер>` is mandatory: without it the PR is not attached to the task, and the
50
+ queue audit finds this. It also means the task closes whole — half a task is not rolled out by
51
+ one PR: work that does not fit one branch is split into tasks before the branch is created.
52
+
53
+ **The host reads the line only on a merge into the default branch.** A PR into an epic branch or
54
+ into the previous branch of a chain merges, and its task stays open: two chain PRs promised a
55
+ closing this way, and the board column lagged the work until a person noticed. So the body of a
56
+ PR with such a base says how the task closes, and the tree decides which of the two it is:
57
+
58
+ - the tree closes such tasks by a pipeline of its own on the merge of a PR — the `Closes` line
59
+ stays, and the body names the pipeline; where it is named for this tree is said by the
60
+ override next to this pattern;
61
+ - the tree has no such pipeline — the body names the task in words, «Задача #86 закрывается
62
+ рукой после слияния череды», and the cleanup step after the merge closes it with a comment
63
+ naming the PR: pattern `git-workflow-stack`.
64
+
65
+ The queue audit reads the `Closes` line as the link between the PR and the task on every base;
66
+ a PR without it is named a divergence whichever way the task closes.
67
+
68
+ A refusal about an exceeded query-language quota (`API rate limit already exceeded`) creates no
69
+ PR at all; the opening then goes by a REST call — `$GH api -X POST "repos/$REPO/pulls" -f head=… -f
70
+ base=… -f title=… -F body=@<файл>` — and labels and reviewer are set after it. The text of such
71
+ a refusal reads as temporary, but the account's quota is not exhausted — it equals zero: there
72
+ is nothing to wait for.
73
+
74
+ On an already open PR the same is set by three REST calls. `gh pr edit` will not do here: it
75
+ queries Projects (classic) cards, gets a refusal about a removed API and never reaches the edit.
76
+
77
+ ```bash
78
+ GH=/opt/homebrew/bin/gh
79
+ REPO=<владелец>/<репозиторий>
80
+
81
+ $GH api -X POST "repos/$REPO/issues/205/labels" -f 'labels[]=bug' -f 'labels[]=area:api'
82
+ $GH api -X POST "repos/$REPO/issues/205/assignees" -f 'assignees[]=<бот>'
83
+ $GH api -X POST "repos/$REPO/pulls/205/requested_reviewers" -f 'reviewers[]=<владелец>'
84
+ ```
85
+
86
+ The same call edits the body itself: `-f body=` rewrites it whole, so the line
87
+ `Closes #<номер>` is written anew together with the rest of the text.
88
+
89
+ ```bash
90
+ $GH api -X PATCH "repos/$REPO/pulls/205" -f body="$(cat тело.md)"
91
+ ```
92
+
93
+ The body is reread whenever something merged into the branch after publishing: the PR states
94
+ things about the tree, and the tree has changed since.
95
+
96
+ ## PR body sample
97
+
98
+ Four sections, and one order between them: the link line, what was done, what confirms it, the
99
+ remaining step. A section with nothing to say says so in words — an empty heading and a removed
100
+ heading read alike and mean different things.
101
+
102
+ ```markdown
103
+ Closes #86
104
+
105
+ ## Что сделано
106
+
107
+ - <правка, названная тем, что она меняет для читателя, а не тем, какие файлы задела>
108
+
109
+ ## Чем подтверждено
110
+
111
+ - <проверка>: <её вывод одной строкой>
112
+ - Не гонялось: <что в набор не вошло и почему>
113
+
114
+ ## Оставшийся шаг
115
+
116
+ Папка задачи разобрана коммитом `<sha>` — за работой убрано. Осталось дождаться прогона и снять
117
+ черновик; до этого кнопка слияния заблокирована хостингом.
118
+ ```
119
+
120
+ With a base other than the main branch the link line carries the way the task closes — one of
121
+ the two, by the tree's decision:
122
+
123
+ ```markdown
124
+ Closes #86 — задача закрывается конвейером дерева при слиянии в ветку эпика.
125
+ ```
126
+
127
+ ```markdown
128
+ Задача #86 — закрывается рукой после слияния череды, с комментарием со ссылкой на этот PR.
129
+ ```
130
+
131
+ The "Remaining step" section stands last and is rewritten by the same call as the rest of the
132
+ body — in the turn that lifts the draft:
133
+
134
+ ```markdown
135
+ ## Оставшийся шаг
136
+
137
+ Не осталось: прогон зелёный, черновик снят. Можно вливать.
138
+ ```
139
+
140
+ It stands there because the merge decision is made on that page, not in the conversation: what
141
+ was said to the owner aloud lives until the next reply, and the body lies right by the button.
142
+ One does not cancel the other — the order of both messages to the owner is described by the
143
+ pattern for closing work.
144
+
145
+ There is nothing to check the body by machine: no audit reads it, and the host asks only about
146
+ the title. The sample is held by whoever writes the body — like the words said aloud.
147
+
148
+ ## Common misses
149
+
150
+ - A second `Closes` line in one PR no longer closes a task: two tasks in one branch roll back
151
+ only together. Either it is one task — and the second is absorbed — or two branches.
152
+ - Half a task that left by its own PR is a miss too: the body of such a PR starts with the words
153
+ `Часть #<номер>` instead of `Closes`, and the task stays open. Work that does not fit one
154
+ branch is split into tasks before the branch is created.
155
+ - Labels set by the PR title, not read from the task: the area is lost, and the board does not
156
+ show that the edit touched the site too.
157
+ - The task closed not in full, but the labels carried over whole: the task stays open, and the
158
+ PR body says so instead of implying it by a `Closes` line.
159
+ - A `Closes` line in a PR whose base is not the main branch, in a tree without a closing pipeline:
160
+ the task looks attached and stays open after the merge. The body names the task in words, and
161
+ the cleanup step closes it by hand.
@@ -2,7 +2,7 @@
2
2
  name: git-workflow-pr
3
3
  kind: pattern
4
4
  rule: git-workflow
5
- description: Pattern of rule git-workflow. Load for opening a PR and everything around it — title format, draft and leaving it, the link to the task, reviewer and labels, a body sample, reading the PR state, the checklist. Creating the task and committing — pattern git-workflow-commit.
5
+ description: Pattern of rule git-workflow. Load for opening a PR and everything around it — title format, draft and leaving it, reading the PR state, the checklist. The link to the task, reviewer, labels and the body sample — pattern git-workflow-pr-body; creating the task and committing — git-workflow-commit.
6
6
  ---
7
7
 
8
8
  # The PR
@@ -96,100 +96,11 @@ Lifting the draft and asking to merge go in one turn: a lifted draft nobody told
96
96
  waits for review just like one not lifted. A PR opened without the draft key needs no such call,
97
97
  and the request to merge goes in the turn that opened it.
98
98
 
99
- ## The PR is attached to the task
99
+ ## The link to the task and the body
100
100
 
101
- The body starts with the link line — by it the board fills the linked PRs field. Reviewer,
102
- assignee and labels are set by the same command, and a PR does not open without them:
103
-
104
- ```bash
105
- GH_TOKEN="$TOKEN" gh pr create --base <ветка эпика> --title '[<КЛЮЧ>-86] Письмо владельцу с незаполненным адресом попадает в логи' \
106
- --reviewer <владелец> --assignee <бот> --label bug --label area:api \
107
- --body 'Closes #86
108
-
109
- …'
110
- ```
111
-
112
- The reviewer is always the owner: without a review request the PR does not show in their queue.
113
- The assignee is the same account the machine work goes from. Labels are taken from the task
114
- whole — both the kind of edit and all its areas; they are read from the task, not picked from
115
- memory:
116
-
117
- ```bash
118
- /opt/homebrew/bin/gh issue view 86 --json labels --jq '.labels | map(.name) | join(",")'
119
- ```
120
-
121
- The line `Closes #<номер>` is mandatory: without it the PR is not attached to the task, and the
122
- queue audit finds this. It also means the task closes whole — half a task is not rolled out by
123
- one PR: work that does not fit one branch is split into tasks before the branch is created.
124
-
125
- A refusal about an exceeded query-language quota (`API rate limit already exceeded`) creates no
126
- PR at all; the opening then goes by a REST call — `$GH api -X POST "repos/$REPO/pulls" -f head=… -f
127
- base=… -f title=… -F body=@<файл>` — and labels and reviewer are set after it. The text of such
128
- a refusal reads as temporary, but the account's quota is not exhausted — it equals zero: there
129
- is nothing to wait for.
130
-
131
- On an already open PR the same is set by three REST calls. `gh pr edit` will not do here: it
132
- queries Projects (classic) cards, gets a refusal about a removed API and never reaches the edit.
133
-
134
- ```bash
135
- GH=/opt/homebrew/bin/gh
136
- REPO=<владелец>/<репозиторий>
137
-
138
- $GH api -X POST "repos/$REPO/issues/205/labels" -f 'labels[]=bug' -f 'labels[]=area:api'
139
- $GH api -X POST "repos/$REPO/issues/205/assignees" -f 'assignees[]=<бот>'
140
- $GH api -X POST "repos/$REPO/pulls/205/requested_reviewers" -f 'reviewers[]=<владелец>'
141
- ```
142
-
143
- The same call edits the body itself: `-f body=` rewrites it whole, so the line
144
- `Closes #<номер>` is written anew together with the rest of the text.
145
-
146
- ```bash
147
- $GH api -X PATCH "repos/$REPO/pulls/205" -f body="$(cat тело.md)"
148
- ```
149
-
150
- The body is reread whenever something merged into the branch after publishing: the PR states
151
- things about the tree, and the tree has changed since.
152
-
153
- ## PR body sample
154
-
155
- Four sections, and one order between them: the link line, what was done, what confirms it, the
156
- remaining step. A section with nothing to say says so in words — an empty heading and a removed
157
- heading read alike and mean different things.
158
-
159
- ```markdown
160
- Closes #86
161
-
162
- ## Что сделано
163
-
164
- - <правка, названная тем, что она меняет для читателя, а не тем, какие файлы задела>
165
-
166
- ## Чем подтверждено
167
-
168
- - <проверка>: <её вывод одной строкой>
169
- - Не гонялось: <что в набор не вошло и почему>
170
-
171
- ## Оставшийся шаг
172
-
173
- Папка задачи разобрана коммитом `<sha>` — за работой убрано. Осталось дождаться прогона и снять
174
- черновик; до этого кнопка слияния заблокирована хостингом.
175
- ```
176
-
177
- The "Remaining step" section stands last and is rewritten by the same call as the rest of the
178
- body — in the turn that lifts the draft:
179
-
180
- ```markdown
181
- ## Оставшийся шаг
182
-
183
- Не осталось: прогон зелёный, черновик снят. Можно вливать.
184
- ```
185
-
186
- It stands there because the merge decision is made on that page, not in the conversation: what
187
- was said to the owner aloud lives until the next reply, and the body lies right by the button.
188
- One does not cancel the other — the order of both messages to the owner is described by the
189
- pattern for closing work.
190
-
191
- There is nothing to check the body by machine: no audit reads it, and the host asks only about
192
- the title. The sample is held by whoever writes the body — like the words said aloud.
101
+ The `Closes #<номер>` line, the reviewer, the assignee and the labels set by the opening call,
102
+ the four sections of the body and how the task closes when the base is not the main branch —
103
+ pattern `git-workflow-pr-body`. The pattern was split out of this one by the length limit.
193
104
 
194
105
  ## The PR state is read, not guessed
195
106
 
@@ -313,16 +224,7 @@ is trust in the section: once read as complete, from then on it is rechecked who
313
224
  ## Common misses
314
225
 
315
226
  Misses about creating the task, the branch and the commit — pattern
316
- `git-workflow-commit`.
227
+ `git-workflow-commit`; about the link line, the labels and the body — `git-workflow-pr-body`.
317
228
 
318
- - A second `Closes` line in one PR no longer closes a task: two tasks in one branch roll back
319
- only together. Either it is one task — and the second is absorbed — or two branches.
320
- - Half a task that left by its own PR is a miss too: the body of such a PR starts with the words
321
- `Часть #<номер>` instead of `Closes`, and the task stays open. Work that does not fit one
322
- branch is split into tasks before the branch is created.
323
229
  - A PR opened without a reviewer: it never reaches the owner's inbox at all, and the queue stands
324
230
  while looking as if it works. That is how sixteen PRs waited for a review nobody had requested.
325
- - Labels set by the PR title, not read from the task: the area is lost, and the board does not
326
- show that the edit touched the site too.
327
- - The task closed not in full, but the labels carried over whole: the task stays open, and the
328
- PR body says so instead of implying it by a `Closes` line.
@@ -65,8 +65,25 @@ gh api repos/<владелец>/<дерево>/pulls/<номер наследн
65
65
  ```
66
66
 
67
67
  From the browser the same is done by editing the PR heading, where the base stands as a dropdown.
68
- The miss turns red nowhere: the PR looks merged, the task closes by its `Closes` line, and the work
69
- is not where it was meant to go.
68
+ The miss turns red nowhere: the PR looks merged, and the work is not where it was meant to go.
69
+
70
+ **The `Closes` line of a chain PR is read by nobody at the host.** The host closes a task only
71
+ on a merge into the default branch; a chain PR merges into the neighbour, and the task stays
72
+ open with the column lagging the work. Which of the two the tree has — a pipeline of its own that
73
+ closes the task on such a merge, or the hand — stands in the PR body by the sample of the pattern
74
+ `git-workflow-pr-body`. The tasks of a chain are asked after every merge, not assumed closed:
75
+
76
+ ```bash
77
+ # right after a merge — the task of the merged PR, then the rest of the chain
78
+ gh issue view <номер> --json state --jq .state
79
+ # still open — closed by hand, with a comment naming the PR that merged
80
+ gh issue comment <номер> --body 'Влита в ветку <основание> — PR #<номер PR>.'
81
+ gh issue close <номер> --reason completed
82
+ ```
83
+
84
+ This is the cleanup step after the last merge of the chain: the branches are listed, the tasks
85
+ of the chain are asked, and what is still open is closed with the comment. A task closed in
86
+ silence, without the PR named, cannot be told from one closed by mistake.
70
87
 
71
88
  The merge order stands in every PR body as the line "stands on #<number>, merge after it": the
72
89
  owner merges by the list, and branch kinship is invisible in the list.
@@ -162,6 +162,10 @@ statement.
162
162
 
163
163
  ## Common misses
164
164
 
165
+ - A second table under the contract section: the audit reads every table there as the list of
166
+ procedures, and a set of refusal codes standing next to them comes back as that many
167
+ discrepancies at once — thirty-six on a spec that was right. Under the contract stands the table
168
+ of procedures alone; a set of codes goes into the data section.
165
169
  - A grown domain is split into new domains instead of subdomains: a new domain has to be entered
166
170
  in the index, audited against the code separately and explained as to why it is not a subdomain
167
171
  of its neighbour — while a subdomain stays in its domain and inherits its contract. A
@@ -71,6 +71,12 @@ into an interactive sign-in instead of an answer.
71
71
 
72
72
  ## Common misses
73
73
 
74
+ - **On the epic's own branch the number is asked as an argument.** Without an argument the
75
+ command takes the number from the branch and looks in that card's body for the line declaring
76
+ an epic. On a task branch that line is there; on the epic branch the card is the epic itself
77
+ and declares no other. The answer — "the task declares no epic" — then reads as a broken card
78
+ rather than as a question asked the wrong way.
79
+
74
80
  - **The task on the board is read by a request, not by the view subcommand.** The subcommand
75
81
  drags in boards of the old kind, the host answers with a refusal about them, and the call turns
76
82
  red whole, showing nothing. A direct request is taken.
@@ -117,7 +117,7 @@ the progress and into the PR body. The law file is edited after the answer. The
117
117
  application laws: payments, locales and access are the same agreement, only about this application.
118
118
 
119
119
  What was done at this step is written into the PR body: what was re-read, what was changed, and if
120
- nothing was changed — why. The form of the section — pattern `git-workflow-pr`.
120
+ nothing was changed — why. The form of the section — pattern `git-workflow-pr-body`.
121
121
 
122
122
  **Next move:** the updated texts are committed, and in the same turn the task folder is taken apart
123
123
  — by the last commit of the branch, pattern `task-flow-archive`.
@@ -118,6 +118,14 @@ owner — exactly the retelling all of this was set up to cancel:
118
118
  - **PR:** #1396, ждёт разбора · отвечено 3 замечания из 5 · не сделано: снятие черновика
119
119
  ```
120
120
 
121
+ The waiting line carries the owner's standing word about a stop, quoted in « », when they gave
122
+ one. The exit guard reads their word from this line, not a retelling; a line without a quote
123
+ releases nothing. The quote holds until the owner cancels it, and the line is rewritten then.
124
+
125
+ ```markdown
126
+ - **Waiting for the owner:** «эпик чата пока откладываем» — сказано вчера, работа стоит до его слова.
127
+ ```
128
+
121
129
  With the PR opened the state becomes `работа-отдана`, and its mandatory action is different — the
122
130
  next task, not waiting for review. By that minute there is nothing left to declare it with on disk:
123
131
  the progress left with the folder, and the tail of the work is led by pattern `task-flow-close`.