@rt-tools/agent-kit 0.27.0 → 0.29.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.
- package/assets/checks/board-epic-link.github.mjs +13 -1
- package/assets/checks/board-epic-plan.github.mjs +86 -0
- package/assets/checks/board-epics.github.mjs +12 -67
- package/assets/checks/board-pull-state.github.mjs +6 -11
- package/assets/checks/board-runs.github.mjs +102 -2
- package/assets/checks/check-board.github.mjs +63 -3
- package/assets/checks/check-glossary.mjs +10 -2
- package/assets/checks/check-lib-layers.mjs +24 -1
- package/assets/checks/check-reuse.mjs +26 -2
- package/assets/checks/check-specs.mjs +8 -1
- package/assets/checks/lib-boundaries.mjs +2 -2
- package/assets/checks/lib-common.mjs +46 -0
- package/assets/checks/lib-manifests.mjs +18 -13
- package/assets/checks/main-run.github.mjs +69 -0
- package/assets/checks/rt-kit-checks.config.mjs +21 -0
- package/assets/checks/signals.mjs +39 -5
- package/assets/checks/spec-anchors.mjs +48 -4
- package/assets/checks/spec-common.mjs +40 -6
- package/assets/checks/spec-contract.mjs +33 -7
- package/assets/checks/spec-scenarios.mjs +24 -1
- package/assets/checks/task-new.github.mjs +9 -3
- package/assets/checks/tree-assignment.mjs +169 -0
- package/assets/defaults/gate-map.sh +20 -5
- package/assets/defaults/project.sh +6 -0
- package/assets/hooks/dev-server-guard.sh +61 -32
- package/assets/hooks/end-conversation-guard.sh +59 -0
- package/assets/hooks/epic-over.sh +11 -2
- package/assets/hooks/exam-guard.sh +10 -10
- package/assets/hooks/git-guard-delivery-conflict.sh +53 -1
- package/assets/hooks/git-guard-delivery-draft.sh +7 -6
- package/assets/hooks/git-guard-delivery-epic.sh +7 -0
- package/assets/hooks/git-guard-delivery-tree.sh +50 -0
- package/assets/hooks/git-guard-delivery.sh +45 -24
- package/assets/hooks/git-guard-discard.sh +144 -0
- package/assets/hooks/git-guard-push-tests.sh +36 -16
- package/assets/hooks/git-guard-tree-assignment.sh +77 -0
- package/assets/hooks/hook-input.sh +8 -1
- package/assets/hooks/main-run-context.sh +45 -0
- package/assets/hooks/reuse-first-guard.sh +29 -4
- package/assets/hooks/rule-source-guard.sh +17 -2
- package/assets/hooks/skill-gate.sh +7 -0
- package/assets/hooks/sql-guard-write.sh +18 -2
- package/assets/hooks/tree-assignment-guard.sh +101 -0
- package/assets/hooks/turn-exit-epic.sh +110 -0
- package/assets/hooks/turn-exit-guard.sh +80 -82
- package/assets/hooks/turn-exit-patterns.sh +18 -10
- package/assets/hooks/turn-exit-verdict.sh +96 -0
- package/assets/laws/delivery.md +20 -6
- package/assets/laws/verifiability.md +22 -4
- package/assets/laws/work-conduct.md +4 -0
- package/assets/patterns/git-workflow-merge.md +13 -0
- package/assets/patterns/git-workflow-pr-body.github.md +156 -0
- package/assets/patterns/git-workflow-pr.github.md +42 -119
- package/assets/patterns/git-workflow-stack.md +38 -2
- package/assets/patterns/task-flow-close.md +66 -79
- package/assets/patterns/task-flow-resume.md +8 -0
- package/assets/patterns/ts-procedure.md +6 -0
- package/assets/pitfalls/git-workflow.github.md +44 -0
- package/assets/pitfalls/task-flow.md +25 -23
- package/assets/pitfalls/turn-conduct.md +18 -0
- package/assets/rules/browser-verification.md +8 -0
- package/assets/rules/deploy-flow.github.md +6 -0
- package/assets/rules/doc-style.md +9 -2
- package/assets/rules/git-workflow.azure.md +10 -0
- package/assets/rules/git-workflow.github.md +128 -130
- package/assets/rules/git-workflow.gitlab.md +10 -0
- package/assets/rules/lib-layers.md +11 -0
- package/assets/rules/spec-driven.md +10 -1
- package/assets/rules/task-flow.md +82 -79
- package/assets/rules/testing.md +7 -0
- package/assets/rules/turn-conduct.md +47 -28
- package/assets/samples/tasks/_template/plan.md +4 -1
- package/assets/samples/tasks/_template/progress.md +1 -1
- package/assets/skills/agent-kit.md +17 -4
- package/bin/agent-kit.d.ts.map +1 -1
- package/bin/agent-kit.js +3 -2
- package/bin/agent-kit.js.map +1 -1
- package/lib/cargo.d.ts +49 -1
- package/lib/cargo.d.ts.map +1 -1
- package/lib/cargo.js +9 -2
- package/lib/cargo.js.map +1 -1
- package/lib/commands.d.ts +1 -1
- package/lib/commands.d.ts.map +1 -1
- package/lib/commands.js +59 -2
- package/lib/commands.js.map +1 -1
- package/lib/hooks-map.d.ts +5 -0
- package/lib/hooks-map.d.ts.map +1 -1
- package/lib/hooks-map.js +9 -3
- package/lib/hooks-map.js.map +1 -1
- package/lib/observations-cargo.d.ts +20 -0
- package/lib/observations-cargo.d.ts.map +1 -0
- package/lib/observations-cargo.js +88 -0
- package/lib/observations-cargo.js.map +1 -0
- package/lib/plan.d.ts +2 -0
- package/lib/plan.d.ts.map +1 -1
- package/lib/plan.js +8 -0
- package/lib/plan.js.map +1 -1
- package/lib/proposals.d.ts +25 -0
- package/lib/proposals.d.ts.map +1 -1
- package/lib/proposals.js +43 -1
- package/lib/proposals.js.map +1 -1
- package/lib/shipment.d.ts +8 -20
- package/lib/shipment.d.ts.map +1 -1
- package/lib/shipment.js +30 -50
- package/lib/shipment.js.map +1 -1
- package/lib/tree-mark.d.ts +17 -0
- package/lib/tree-mark.d.ts.map +1 -0
- package/lib/tree-mark.js +41 -0
- package/lib/tree-mark.js.map +1 -0
- package/package.json +1 -1
- package/rt-tools-agent-kit-0.29.0.tgz +0 -0
- package/rt-tools-agent-kit-0.27.0.tgz +0 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# The parsing of the turn record for the turn-exit guard. NOT a guard: it has no `rt-hook:`
|
|
3
|
+
# declaration and hooks into no agent event. The guard sources it right after the patterns —
|
|
4
|
+
# it was moved out when the guard crossed the file length limit, and the parsing reads apart
|
|
5
|
+
# from the tiers that apply its answer.
|
|
6
|
+
#
|
|
7
|
+
# It expects the patterns to be sourced already and `$transcript` to be set; it prints nothing
|
|
8
|
+
# and leaves the answer in `$verdict`.
|
|
9
|
+
|
|
10
|
+
rt_te_verdict() {
|
|
11
|
+
verdict="$(tail -n 400 "$transcript" 2>/dev/null | jq -s -r --arg work "$work_re" --arg read "$read_re" --arg part "$part_re" --arg wait "$wait_re" --arg handover "$handover_re" --arg started "$started_re" --arg promise "$promise_re" --arg standing "$standing_work_re" '
|
|
12
|
+
# A service message — a skill load, a compaction summary — carries the user type and is not the word
|
|
13
|
+
# of the owner: it neither starts a turn nor is read as one.
|
|
14
|
+
def is_service:
|
|
15
|
+
((.isCompactSummary // false) or (.isMeta // false))
|
|
16
|
+
or ((.message.content // "") | if type == "string" then . elif type == "array"
|
|
17
|
+
then (map(if type == "object" then (.text // "") else "" end) | join("\n")) else "" end
|
|
18
|
+
| test("^[[:space:]]*Stop hook feedback"));
|
|
19
|
+
def is_input:
|
|
20
|
+
.type == "user"
|
|
21
|
+
and (is_service | not)
|
|
22
|
+
and (((.message.content // []) | if type == "array"
|
|
23
|
+
then ([.[] | select(.type == "tool_result")] | length)
|
|
24
|
+
else 0 end) == 0);
|
|
25
|
+
|
|
26
|
+
(map(is_input) | rindex(true)) as $i
|
|
27
|
+
| (if $i == null then [] else .[$i:] end) as $turn
|
|
28
|
+
| [$turn[] | select(.type == "assistant") | (.message.content // [])[] | select(.type == "tool_use")] as $uses
|
|
29
|
+
# An edit of a file is work by definition, whatever tool it goes through.
|
|
30
|
+
| ($uses | map(.name // "") | any(test("^(Edit|Write|MultiEdit|NotebookEdit)$"))) as $edited
|
|
31
|
+
| ($uses | map(.name // "") | any(test("AskUserQuestion"))) as $asked
|
|
32
|
+
| ($uses | map((.input.command // "")) | join("\n")) as $ran
|
|
33
|
+
# Work is a part of the command that matched the work pattern and did not match the exploration
|
|
34
|
+
# pattern: switching a branch and reading history in the same turn do not become work.
|
|
35
|
+
| ([$ran | splits($part)] | map(test($work) and (test($read) | not)) | any) as $ran_work
|
|
36
|
+
# The last action of the turn. Waiting for a step by anyone else is never the end of a turn,
|
|
37
|
+
# however much work there was before: the work stays exactly where it stood.
|
|
38
|
+
| ([$uses[] | select((.name // "") == "Bash") | ((.input.command // "") + (if (.input.run_in_background // false) then " &" else "" end))] | last // "") as $last
|
|
39
|
+
| ([$uses[] | (.name // "")] | last // "") as $last_name
|
|
40
|
+
| (($last_name == "Bash") and ($last | test($wait))) as $waited
|
|
41
|
+
# Handing the work over: the tail of the turn after the PR was opened. Everything before it was
|
|
42
|
+
# done on the task handed in and says nothing about the next one.
|
|
43
|
+
| ([$uses[] | select((.name // "") == "Bash") | (.input.command // "")]) as $cmds
|
|
44
|
+
| (($cmds | map(test($handover)) | index(true))) as $handover_at
|
|
45
|
+
| ($handover_at != null) as $handed_over
|
|
46
|
+
| (if $handover_at == null then [] else $cmds[$handover_at:] end) as $tail
|
|
47
|
+
| (($tail | map(test($started)) | any)
|
|
48
|
+
or ($uses | map(.name // "") | any(test("^(Edit|Write|MultiEdit|NotebookEdit)$")))) as $started_next
|
|
49
|
+
# THE LAST ACTION OF THE TURN is the shared sign, and the particular tiers below only derive an
|
|
50
|
+
# understandable refusal from it. Nine incident analyses in a day describe nine different stops,
|
|
51
|
+
# and in all nine the last action of the turn was a text to the owner: a report, a summary, an
|
|
52
|
+
# announcement of intent. A tier for every kind of stop is an endless race: there are as many
|
|
53
|
+
# kinds as there are reasons to start talking. Hence one sign — the LAST action must be work.
|
|
54
|
+
| ([$uses[] | (.name // "")] | last // "") as $last_tool
|
|
55
|
+
| (($last_tool | test("^(Edit|Write|MultiEdit|NotebookEdit)$"))
|
|
56
|
+
or ([$last | splits($part)] | map(test($work) and (test($read) | not)) | any)) as $ended_working
|
|
57
|
+
# A guard refusal and a session handover — both end the turn by the rule. The refusal is read
|
|
58
|
+
# from the LAST tool result: a refusal in the middle of the turn was answered by the work that
|
|
59
|
+
# followed it, and a turn that went on after it is judged by how it ended.
|
|
60
|
+
| ([$turn[] | select(.type == "user") | .message.content // [] | select(type == "array") | .[]
|
|
61
|
+
| select(.type == "tool_result") | .content
|
|
62
|
+
| if type == "string" then .
|
|
63
|
+
elif type == "array" then (map(if type == "object" then (.text // "") else tostring end) | join("\n"))
|
|
64
|
+
else tostring end]) as $outs
|
|
65
|
+
| ($outs | join("\n")) as $out
|
|
66
|
+
| ($outs | last // "") as $last_out
|
|
67
|
+
# The refusal of the closing tool is left out: the refused call was itself the stop, not work.
|
|
68
|
+
| ($last_out | test("BLOCKED by (?!end-conversation-guard)|Refused by the rules gate|Отбито гейтом")) as $denied
|
|
69
|
+
| ($ran | test("handoff")) as $handed
|
|
70
|
+
# The word of the owner about stopping: the reply itself is judged, not its retelling.
|
|
71
|
+
| ([$turn[] | select(.type == "user") | select(is_service | not) | .message.content
|
|
72
|
+
| if type == "string" then . elif type == "array"
|
|
73
|
+
then (map(if type == "object" then (.text // "") else "" end) | join("\n")) else "" end] | join("\n")) as $said
|
|
74
|
+
| ([.[] | select(.type == "user") | select(is_service | not) | .message.content
|
|
75
|
+
| if type == "string" then . elif type == "array"
|
|
76
|
+
then (map(if type == "object" then (.text // "") else "" end) | join("\n")) else "" end] | join("\n")) as $session_said
|
|
77
|
+
| ($session_said | test($standing)) as $standing_work
|
|
78
|
+
| (($said | test("останов|стоп|хватит|подожди|не надо|прерв|отложи|не двигайся|не продолжай|прекрати")) and ($said | test($standing) | not)) as $told_stop
|
|
79
|
+
# A question refused by the conversation guard, and a question appended as prose at the end of
|
|
80
|
+
# the reply. The conversation guard judges the call of the question tool and does not see prose
|
|
81
|
+
# at all: a refused question came back in the same wording one turn later and passed freely.
|
|
82
|
+
| ($out | test("BLOCKED by grill-gate")) as $ask_denied
|
|
83
|
+
| ([$turn[] | select(.type == "assistant") | (.message.content // [])[]
|
|
84
|
+
| select(.type == "text") | (.text // "")] | last // "") as $last_say
|
|
85
|
+
| (($last_say | test("\\?[[:space:]]*$")) and $ask_denied) as $asked_in_prose
|
|
86
|
+
# Waiting for the word of the owner, announced by the executor. That word is read from
|
|
87
|
+
# the owner: without his word in the turn and without a question to him through the tool, the
|
|
88
|
+
# phrase "waiting for your word" is a stop announced by the one it suits. The set of patterns is
|
|
89
|
+
# named and closed.
|
|
90
|
+
| (($last_say | test("[Жж]ду (твоего|вашего|его|её) (слова|указани|решени|ответа|команды|отмашки)|[Жж]ду слова владельца|[Жж]ду, что скаж|[Оо]стаюсь ждать|[Бб]уду ждать (твоего|вашего)"))
|
|
91
|
+
and (($asked or $told_stop or $handed) | not)) as $awaits_word
|
|
92
|
+
| ($last_say | test($promise)) as $promised
|
|
93
|
+
| (($last_name == "Bash") and ($last | test($started)) and ($handed_over | not)) as $only_took
|
|
94
|
+
| { promised: $promised, only_took: $only_took, asked: $asked, handed_by_hand: ($handed and (($asked or $denied or $told_stop) | not)), standing_work: $standing_work, worked: ($edited or $ran_work), released: ($asked or $denied or $handed or $told_stop), waited: $waited, handed_over: $handed_over, started_next: $started_next, ended_working: $ended_working, asked_in_prose: $asked_in_prose, awaits_word: $awaits_word, ran: $ran }
|
|
95
|
+
' 2>/dev/null)"
|
|
96
|
+
}
|
package/assets/laws/delivery.md
CHANGED
|
@@ -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.
|
|
@@ -135,16 +141,24 @@ application stops responding, and the reason is found from the history.
|
|
|
135
141
|
PR is open, the work does not count as done: there is no review of it, and the person does not
|
|
136
142
|
know about it. The PR is opened in the same turn in which the executor says the work is handed
|
|
137
143
|
over — not in the next session and not on a reminder.
|
|
138
|
-
- **A PR
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
144
|
+
- **A PR that waits for something is marked as a draft, and one that waits for nothing opens
|
|
145
|
+
ready.** An open PR reads as an invitation to merge, and a person presses merge without asking
|
|
146
|
+
whether the work is finished. The draft separates two states that otherwise look the same: the
|
|
147
|
+
change is put up for viewing — and the change is ready to go to the main branch. It is set on
|
|
148
|
+
what waits for a run, for rework or for an answer to a question; the question is asked in the PR
|
|
149
|
+
itself, not kept in the executor's head. Where there is nothing to wait for, a draft costs an
|
|
150
|
+
extra turn and a locked button, and it shows the owner work in progress where the work is done.
|
|
151
|
+
- **Where the run comes from is part of the order of handing in, and the tree names it.** The
|
|
152
|
+
draft holds because the run is had on the PR itself: to get it the PR must be opened, and an
|
|
153
|
+
opened one already reads as an invitation. A tree whose pipeline wakes earlier — or does not wake
|
|
154
|
+
on this kind of PR at all — has nothing for the draft to wait for there, and the PR opens ready.
|
|
155
|
+
A law that named one source of the run would promise the other tree an order it cannot carry out.
|
|
143
156
|
- **Lifting the draft is a separate turn, and with it the executor answers for readiness.** The
|
|
144
157
|
draft is lifted when the checks have passed, no rework remains and the work matches what the task
|
|
145
158
|
was created for. While it stands, the executor's silence means "not ready yet", and the person has
|
|
146
159
|
to ask nothing; after it is lifted, silence means "can be merged", and the price of a mistake here
|
|
147
|
-
is a change in the main branch.
|
|
160
|
+
is a change in the main branch. A PR opened ready carries the same answer, given at the minute of
|
|
161
|
+
opening.
|
|
148
162
|
- **A PR about what was done stays true until the merge itself.** It describes the tree on the day
|
|
149
163
|
it was written, and waits for review for days. In that time the main branch is merged into the
|
|
150
164
|
branch, and the PR's statement about neighbouring files becomes false silently — no check reads PR
|
|
@@ -78,11 +78,18 @@ that "should work" and code that was checked look the same in the history.
|
|
|
78
78
|
tool's settings, not bypassed in every place.** The bypass has to be repeated as many times as
|
|
79
79
|
there are such places, and none of them says why: from outside it looks like the author's mistake,
|
|
80
80
|
not a decision.
|
|
81
|
+
- **A check and a guard outrank the executor's judgement of their own work.** The executor judges
|
|
82
|
+
their own code with an interest: they remember the intent and see it instead of the result, while
|
|
83
|
+
the check reads only the result. A divergence is closed by an edit of the code, and the
|
|
84
|
+
executor's argument that the check is wrong is no argument at all — neither in their own decision
|
|
85
|
+
nor in a question to the owner.
|
|
81
86
|
- **A red check means wrong code, not a wrong check.** A place taken out from under the check so
|
|
82
87
|
that it goes quiet fixes the reading, not what the check pointed at: the code stays the same, and
|
|
83
|
-
nobody has a signal about it any more.
|
|
84
|
-
|
|
85
|
-
|
|
88
|
+
nobody has a signal about it any more. There is one move out of a red check — fix what it pointed
|
|
89
|
+
at. Stopping the work and a question to the owner are not a move: the question names them a
|
|
90
|
+
choice that does not exist, and it costs as much as the fix. The known list is accumulated by the
|
|
91
|
+
day the check is created and only shrinks — it is not added to by the executor's decision, nor by
|
|
92
|
+
the word of the owner: a line in it silences the signal about code that stayed the same.
|
|
86
93
|
- **The usefulness of a rule is confirmed by observing how it is used, not by an opinion about it.**
|
|
87
94
|
A rule that was never opened and a rule half the work rests on look the same in the text — and
|
|
88
95
|
what gets edited first is usually what was remembered, not what gets in the way. Observation is
|
|
@@ -98,6 +105,16 @@ that "should work" and code that was checked look the same in the history.
|
|
|
98
105
|
the analysis — how many lines, of what kind, how their falsity is proven — and fixes the check
|
|
99
106
|
itself. The known list is not used for this: it holds what was accepted, not the results of a
|
|
100
107
|
broken check.
|
|
108
|
+
- **A check that did not find what to compare says so and does not count as matched.** An empty
|
|
109
|
+
input is three different states — there is no subject at all, the subject is declared and not
|
|
110
|
+
found, the declaration was not parsed — and merged into one they give a green where nothing was
|
|
111
|
+
compared. The lawful answer "there is nothing to compare" is said by a word in the text being
|
|
112
|
+
checked, not derived from an empty parse.
|
|
113
|
+
- **A declaration read by a check as text is written as a literal in the place of the
|
|
114
|
+
declaration.** What is moved into a constant or assembled by an expression such a check does not
|
|
115
|
+
see at all: the application works, the check is silent, and the miss shows itself by nothing.
|
|
116
|
+
Where a value has to be a literal, that is said in the same place where it is said what declares
|
|
117
|
+
it.
|
|
101
118
|
- **A decision that depends on the current moment gets the moment from outside.** Otherwise it can
|
|
102
119
|
be checked only by turning the clock, and a turned clock acts on everything that happens to be
|
|
103
120
|
nearby: the check starts depending on what has no relation to it.
|
|
@@ -124,7 +141,8 @@ that "should work" and code that was checked look the same in the history.
|
|
|
124
141
|
indistinguishable from one the tree never had at all: the run is green because nobody called it.
|
|
125
142
|
The neighbouring article judges a place taken out from under the check — here it is not a place
|
|
126
143
|
that is taken out but the whole check, and no trace remains in the code. The discrepancy is closed
|
|
127
|
-
by what the check pointed at
|
|
144
|
+
by what the check pointed at: the check is returned to the set, and the discrepancy under it is
|
|
145
|
+
fixed.
|
|
128
146
|
- **A change to the look is checked at every layout threshold, not at one width.** Thresholds are
|
|
129
147
|
the places where the layout changes, and a slip lives exactly there: on either side of the
|
|
130
148
|
threshold the layout is assembled differently, and in the middle it looks correct. A change
|
|
@@ -158,6 +158,10 @@ one session and keeps its whole context and state when it passes to the next.
|
|
|
158
158
|
looks at it. An epic with one card out of ten looks there like one step of work. The card number
|
|
159
159
|
goes into the plan by the same edit: otherwise the plan answers "take the next one" with a title,
|
|
160
160
|
and the card is created again under a new number.
|
|
161
|
+
- **Taking the first task of an epic takes the epic itself into work, and the epic card says so.**
|
|
162
|
+
The owner follows the epic by one card, not by its tasks; a card that stays where the epic was
|
|
163
|
+
declared reads as an epic nobody started, however many of its tasks are already done. The card
|
|
164
|
+
moves by the same motion as the first task's, not by a separate step remembered later.
|
|
161
165
|
- **An executor's session does not end together with the task.** The end of a task is not a sign to
|
|
162
166
|
stop: only the window fill limit allows stopping. A session closed on a finished task leaves the
|
|
163
167
|
owner a blank and costs a whole session to return to what was at hand.
|
|
@@ -131,6 +131,19 @@ repository refuses about Projects (classic) and never reaches the edit:
|
|
|
131
131
|
/opt/homebrew/bin/gh api -X PATCH repos/<владелец>/<репозиторий>/pulls/<номер> -f body="$(cat тело.md)"
|
|
132
132
|
```
|
|
133
133
|
|
|
134
|
+
## The task of a merged PR is asked, not assumed closed
|
|
135
|
+
|
|
136
|
+
The host closes the task by the `Closes` line only when the base is the default branch. A PR
|
|
137
|
+
merged into an epic branch or into the previous branch of a chain leaves its task open unless the
|
|
138
|
+
tree closes it by a pipeline of its own — and the column of the board lags the work until then.
|
|
139
|
+
After every known merge with such a base the task's state is asked by a command; one still open
|
|
140
|
+
is closed by hand with a comment naming the PR — the calls are in the pattern
|
|
141
|
+
`git-workflow-stack`.
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
gh issue view <номер> --json state --jq .state
|
|
145
|
+
```
|
|
146
|
+
|
|
134
147
|
## A green run ages together with the main branch
|
|
135
148
|
|
|
136
149
|
A run speaks about the base it went on. While it goes and the PR awaits review, the main branch
|
|
@@ -0,0 +1,156 @@
|
|
|
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 --base <ветка эпика> --title '[<КЛЮЧ>-86] Письмо владельцу с незаполненным адресом попадает в логи' \
|
|
29
|
+
--reviewer <владелец> --assignee <бот> --label bug --label area:api \
|
|
30
|
+
--body 'Closes #86
|
|
31
|
+
|
|
32
|
+
…'
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The reviewer is always the owner: without a review request the PR does not show in their queue.
|
|
36
|
+
The assignee is the same account the machine work goes from. Labels are taken from the task
|
|
37
|
+
whole — both the kind of edit and all its areas; they are read from the task, not picked from
|
|
38
|
+
memory:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
/opt/homebrew/bin/gh issue view 86 --json labels --jq '.labels | map(.name) | join(",")'
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The line `Closes #<номер>` is mandatory: without it the PR is not attached to the task, and the
|
|
45
|
+
queue audit finds this. It also means the task closes whole — half a task is not rolled out by
|
|
46
|
+
one PR: work that does not fit one branch is split into tasks before the branch is created.
|
|
47
|
+
|
|
48
|
+
**The host reads the line only on a merge into the default branch.** A PR into an epic branch or
|
|
49
|
+
into the previous branch of a chain merges, and its task stays open: two chain PRs promised a
|
|
50
|
+
closing this way, and the board column lagged the work until a person noticed. So the body of a
|
|
51
|
+
PR with such a base says how the task closes, and the tree decides which of the two it is:
|
|
52
|
+
|
|
53
|
+
- the tree closes such tasks by a pipeline of its own on the merge of a PR — the `Closes` line
|
|
54
|
+
stays, and the body names the pipeline; where it is named for this tree is said by the
|
|
55
|
+
override next to this pattern;
|
|
56
|
+
- the tree has no such pipeline — the body names the task in words, «Задача #86 закрывается
|
|
57
|
+
рукой после слияния череды», and the cleanup step after the merge closes it with a comment
|
|
58
|
+
naming the PR: pattern `git-workflow-stack`.
|
|
59
|
+
|
|
60
|
+
The queue audit reads the `Closes` line as the link between the PR and the task on every base;
|
|
61
|
+
a PR without it is named a divergence whichever way the task closes.
|
|
62
|
+
|
|
63
|
+
A refusal about an exceeded query-language quota (`API rate limit already exceeded`) creates no
|
|
64
|
+
PR at all; the opening then goes by a REST call — `$GH api -X POST "repos/$REPO/pulls" -f head=… -f
|
|
65
|
+
base=… -f title=… -F body=@<файл>` — and labels and reviewer are set after it. The text of such
|
|
66
|
+
a refusal reads as temporary, but the account's quota is not exhausted — it equals zero: there
|
|
67
|
+
is nothing to wait for.
|
|
68
|
+
|
|
69
|
+
On an already open PR the same is set by three REST calls. `gh pr edit` will not do here: it
|
|
70
|
+
queries Projects (classic) cards, gets a refusal about a removed API and never reaches the edit.
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
GH=/opt/homebrew/bin/gh
|
|
74
|
+
REPO=<владелец>/<репозиторий>
|
|
75
|
+
|
|
76
|
+
$GH api -X POST "repos/$REPO/issues/205/labels" -f 'labels[]=bug' -f 'labels[]=area:api'
|
|
77
|
+
$GH api -X POST "repos/$REPO/issues/205/assignees" -f 'assignees[]=<бот>'
|
|
78
|
+
$GH api -X POST "repos/$REPO/pulls/205/requested_reviewers" -f 'reviewers[]=<владелец>'
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
The same call edits the body itself: `-f body=` rewrites it whole, so the line
|
|
82
|
+
`Closes #<номер>` is written anew together with the rest of the text.
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
$GH api -X PATCH "repos/$REPO/pulls/205" -f body="$(cat тело.md)"
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
The body is reread whenever something merged into the branch after publishing: the PR states
|
|
89
|
+
things about the tree, and the tree has changed since.
|
|
90
|
+
|
|
91
|
+
## PR body sample
|
|
92
|
+
|
|
93
|
+
Four sections, and one order between them: the link line, what was done, what confirms it, the
|
|
94
|
+
remaining step. A section with nothing to say says so in words — an empty heading and a removed
|
|
95
|
+
heading read alike and mean different things.
|
|
96
|
+
|
|
97
|
+
```markdown
|
|
98
|
+
Closes #86
|
|
99
|
+
|
|
100
|
+
## Что сделано
|
|
101
|
+
|
|
102
|
+
- <правка, названная тем, что она меняет для читателя, а не тем, какие файлы задела>
|
|
103
|
+
|
|
104
|
+
## Чем подтверждено
|
|
105
|
+
|
|
106
|
+
- <проверка>: <её вывод одной строкой>
|
|
107
|
+
- Не гонялось: <что в набор не вошло и почему>
|
|
108
|
+
|
|
109
|
+
## Оставшийся шаг
|
|
110
|
+
|
|
111
|
+
Папка задачи разобрана коммитом `<sha>` — за работой убрано. Осталось дождаться прогона и снять
|
|
112
|
+
черновик; до этого кнопка слияния заблокирована хостингом.
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
With a base other than the main branch the link line carries the way the task closes — one of
|
|
116
|
+
the two, by the tree's decision:
|
|
117
|
+
|
|
118
|
+
```markdown
|
|
119
|
+
Closes #86 — задача закрывается конвейером дерева при слиянии в ветку эпика.
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
```markdown
|
|
123
|
+
Задача #86 — закрывается рукой после слияния череды, с комментарием со ссылкой на этот PR.
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
The "Remaining step" section stands last and is rewritten by the same call as the rest of the
|
|
127
|
+
body — in the turn that lifts the draft:
|
|
128
|
+
|
|
129
|
+
```markdown
|
|
130
|
+
## Оставшийся шаг
|
|
131
|
+
|
|
132
|
+
Не осталось: прогон зелёный, черновик снят. Можно вливать.
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
It stands there because the merge decision is made on that page, not in the conversation: what
|
|
136
|
+
was said to the owner aloud lives until the next reply, and the body lies right by the button.
|
|
137
|
+
One does not cancel the other — the order of both messages to the owner is described by the
|
|
138
|
+
pattern for closing work.
|
|
139
|
+
|
|
140
|
+
There is nothing to check the body by machine: no audit reads it, and the host asks only about
|
|
141
|
+
the title. The sample is held by whoever writes the body — like the words said aloud.
|
|
142
|
+
|
|
143
|
+
## Common misses
|
|
144
|
+
|
|
145
|
+
- A second `Closes` line in one PR no longer closes a task: two tasks in one branch roll back
|
|
146
|
+
only together. Either it is one task — and the second is absorbed — or two branches.
|
|
147
|
+
- Half a task that left by its own PR is a miss too: the body of such a PR starts with the words
|
|
148
|
+
`Часть #<номер>` instead of `Closes`, and the task stays open. Work that does not fit one
|
|
149
|
+
branch is split into tasks before the branch is created.
|
|
150
|
+
- Labels set by the PR title, not read from the task: the area is lost, and the board does not
|
|
151
|
+
show that the edit touched the site too.
|
|
152
|
+
- The task closed not in full, but the labels carried over whole: the task stays open, and the
|
|
153
|
+
PR body says so instead of implying it by a `Closes` line.
|
|
154
|
+
- A `Closes` line in a PR whose base is not the main branch, in a tree without a closing pipeline:
|
|
155
|
+
the task looks attached and stays open after the merge. The body names the task in words, and
|
|
156
|
+
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
|
|
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
|
|
@@ -48,130 +48,59 @@ Type and scope — `fix(site):`, `docs(common):` — do not go into the PR title
|
|
|
48
48
|
subject format, and `commitlint` checks it there. In the PR list it takes room and adds nothing:
|
|
49
49
|
the kind of edit and the area are already visible by the labels.
|
|
50
50
|
|
|
51
|
-
##
|
|
51
|
+
## A draft where a run is waited for, ready where it is not
|
|
52
52
|
|
|
53
53
|
A code edit is handed to a person by an open PR: a pushed branch is shown to them nowhere. An
|
|
54
54
|
open PR reads as an invitation to merge, so unfinished work opens it as a draft — the host locks
|
|
55
|
-
a draft's merge button itself
|
|
55
|
+
a draft's merge button itself.
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
**The base is the epic branch, and it is named by the command.** Without `--base` the host takes
|
|
62
|
-
the default branch of the repository, that is the main branch: the request then carries the task
|
|
63
|
-
past the epic, and the epic branch stays a copy nobody merges. The epic's own request is the only
|
|
64
|
-
one whose base is the main branch, and it opens when the last folder of its tasks is taken apart.
|
|
65
|
-
|
|
66
|
-
Everything waiting for a pipeline run, a rework or an answer to a question goes as a draft. The
|
|
67
|
-
question is asked in the PR itself, not kept in the executor's head: a person reads the PR, not
|
|
68
|
-
the session's conversation.
|
|
69
|
-
|
|
70
|
-
The draft is lifted by a separate call, and that is the very turn in which the executor says the
|
|
71
|
-
solution is ready:
|
|
57
|
+
**Which bases the pipeline wakes for is read from its file, not from memory.** That one line decides
|
|
58
|
+
which of the two orders applies, and taking the wrong one means either waiting for a run that never
|
|
59
|
+
comes or handing over unchecked work as finished:
|
|
72
60
|
|
|
73
61
|
```bash
|
|
74
|
-
|
|
62
|
+
# the bases the checks wake for; nothing printed means every base
|
|
63
|
+
sed -n '/^on:/,/^[a-z]/p' .github/workflows/<файл конвейера>
|
|
75
64
|
```
|
|
76
65
|
|
|
77
|
-
|
|
78
|
-
Lifting the draft and asking to merge go in one turn: a lifted draft nobody told the person
|
|
79
|
-
about waits for review just like one not lifted.
|
|
80
|
-
|
|
81
|
-
## The PR is attached to the task
|
|
82
|
-
|
|
83
|
-
The body starts with the link line — by it the board fills the linked PRs field. Reviewer,
|
|
84
|
-
assignee and labels are set by the same command, and a PR does not open without them:
|
|
66
|
+
A base the pipeline wakes for — the PR opens as a draft, and the draft is lifted on the green run:
|
|
85
67
|
|
|
86
68
|
```bash
|
|
87
|
-
GH_TOKEN="$TOKEN" gh pr create --base <ветка эпика> --title '[<КЛЮЧ>-86]
|
|
88
|
-
--reviewer <владелец> --assignee <бот> --label bug --label area:api \
|
|
89
|
-
--body 'Closes #86
|
|
90
|
-
|
|
91
|
-
…'
|
|
69
|
+
GH_TOKEN="$TOKEN" gh pr create --draft --base <ветка эпика> --title '[<КЛЮЧ>-86] …' --body-file тело.md
|
|
92
70
|
```
|
|
93
71
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
whole — both the kind of edit and all its areas; they are read from the task, not picked from
|
|
97
|
-
memory:
|
|
72
|
+
A base it does not wake for — nothing to wait for, and the PR opens without the draft key. The push
|
|
73
|
+
gate is then the only blocking check behind the work, green before the branch is sent:
|
|
98
74
|
|
|
99
75
|
```bash
|
|
100
|
-
|
|
76
|
+
GH_TOKEN="$TOKEN" gh pr create --base <ветка эпика> --title '[<КЛЮЧ>-86] …' --body-file тело.md
|
|
101
77
|
```
|
|
102
78
|
|
|
103
|
-
The
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
A refusal about an exceeded query-language quota (`API rate limit already exceeded`) creates no
|
|
108
|
-
PR at all; the opening then goes by a REST call — `$GH api -X POST "repos/$REPO/pulls" -f head=… -f
|
|
109
|
-
base=… -f title=… -F body=@<файл>` — and labels and reviewer are set after it. The text of such
|
|
110
|
-
a refusal reads as temporary, but the account's quota is not exhausted — it equals zero: there
|
|
111
|
-
is nothing to wait for.
|
|
112
|
-
|
|
113
|
-
On an already open PR the same is set by three REST calls. `gh pr edit` will not do here: it
|
|
114
|
-
queries Projects (classic) cards, gets a refusal about a removed API and never reaches the edit.
|
|
115
|
-
|
|
116
|
-
```bash
|
|
117
|
-
GH=/opt/homebrew/bin/gh
|
|
118
|
-
REPO=<владелец>/<репозиторий>
|
|
79
|
+
**The base is the epic branch, and it is named by the command.** Without `--base` the host takes
|
|
80
|
+
the repository's default branch: the request then carries the task past the epic, and the epic
|
|
81
|
+
branch stays a copy nobody merges. The epic's own request is the only one based on the main branch,
|
|
82
|
+
and it opens when the last folder of its tasks is taken apart.
|
|
119
83
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
$GH api -X POST "repos/$REPO/pulls/205/requested_reviewers" -f 'reviewers[]=<владелец>'
|
|
123
|
-
```
|
|
84
|
+
Everything waiting for a pipeline run, a rework or an answer goes as a draft, and the question is
|
|
85
|
+
asked in the PR itself: a person reads the PR, not the session's conversation.
|
|
124
86
|
|
|
125
|
-
The
|
|
126
|
-
|
|
87
|
+
The draft is lifted by a separate call, and that is the very turn in which the executor says the
|
|
88
|
+
solution is ready:
|
|
127
89
|
|
|
128
90
|
```bash
|
|
129
|
-
$
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
The body is reread whenever something merged into the branch after publishing: the PR states
|
|
133
|
-
things about the tree, and the tree has changed since.
|
|
134
|
-
|
|
135
|
-
## PR body sample
|
|
136
|
-
|
|
137
|
-
Four sections, and one order between them: the link line, what was done, what confirms it, the
|
|
138
|
-
remaining step. A section with nothing to say says so in words — an empty heading and a removed
|
|
139
|
-
heading read alike and mean different things.
|
|
140
|
-
|
|
141
|
-
```markdown
|
|
142
|
-
Closes #86
|
|
143
|
-
|
|
144
|
-
## Что сделано
|
|
145
|
-
|
|
146
|
-
- <правка, названная тем, что она меняет для читателя, а не тем, какие файлы задела>
|
|
147
|
-
|
|
148
|
-
## Чем подтверждено
|
|
149
|
-
|
|
150
|
-
- <проверка>: <её вывод одной строкой>
|
|
151
|
-
- Не гонялось: <что в набор не вошло и почему>
|
|
152
|
-
|
|
153
|
-
## Оставшийся шаг
|
|
154
|
-
|
|
155
|
-
Папка задачи разобрана коммитом `<sha>` — за работой убрано. Осталось дождаться прогона и снять
|
|
156
|
-
черновик; до этого кнопка слияния заблокирована хостингом.
|
|
91
|
+
GH_TOKEN="$TOKEN" gh pr ready 86
|
|
157
92
|
```
|
|
158
93
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
## Оставшийся шаг
|
|
164
|
-
|
|
165
|
-
Не осталось: прогон зелёный, черновик снят. Можно вливать.
|
|
166
|
-
```
|
|
94
|
+
Before the lifting the executor's silence means "not ready yet", after — "may be merged".
|
|
95
|
+
Lifting the draft and asking to merge go in one turn: a lifted draft nobody told the person about
|
|
96
|
+
waits for review just like one not lifted. A PR opened without the draft key needs no such call,
|
|
97
|
+
and the request to merge goes in the turn that opened it.
|
|
167
98
|
|
|
168
|
-
|
|
169
|
-
was said to the owner aloud lives until the next reply, and the body lies right by the button.
|
|
170
|
-
One does not cancel the other — the order of both messages to the owner is described by the
|
|
171
|
-
pattern for closing work.
|
|
99
|
+
## The link to the task and the body
|
|
172
100
|
|
|
173
|
-
|
|
174
|
-
the
|
|
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.
|
|
175
104
|
|
|
176
105
|
## The PR state is read, not guessed
|
|
177
106
|
|
|
@@ -272,10 +201,14 @@ push gate — below is what it does not know.
|
|
|
272
201
|
the showcase snapshots: since the merge the pipeline runs them on its code, and the red
|
|
273
202
|
comes to its PR.
|
|
274
203
|
|
|
275
|
-
|
|
276
|
-
while work goes on, the person is shown what
|
|
277
|
-
Items 1–15 are passed before `gh pr ready`, and an unmet item means the draft
|
|
278
|
-
that the PR does not open.
|
|
204
|
+
Where the pipeline wakes for this base, the list is about lifting the draft: the PR opens as a
|
|
205
|
+
draft earlier, while work goes on, and the person is shown what exists together with what is
|
|
206
|
+
still missing. Items 1–15 are then passed before `gh pr ready`, and an unmet item means the draft
|
|
207
|
+
is not lifted — not that the PR does not open.
|
|
208
|
+
|
|
209
|
+
Where it does not wake, the same list is about opening: there is no second state to hold the work
|
|
210
|
+
in, so an unmet item means the PR does not open yet. Item 1 changes with it — no run is asked for,
|
|
211
|
+
and its place is taken by the push gate, green before the sending.
|
|
279
212
|
|
|
280
213
|
Right after publishing the task is moved to review — `npm run task:move -- <номер>
|
|
281
214
|
in-review` — and `npm run check:board` is run once more: before the PR opens it does not judge
|
|
@@ -284,24 +217,14 @@ the column, after the opening it sees the discrepancy.
|
|
|
284
217
|
What was done by reasoning and what was done by measurement are told apart plainly in the PR
|
|
285
218
|
body: the unchecked named as checked, the reviewer takes as checked.
|
|
286
219
|
|
|
287
|
-
**The "What confirms it" section names what was not run too.** A list of one run cannot be told
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
it is rechecked whole.
|
|
220
|
+
**The "What confirms it" section names what was not run too.** A list of one run cannot be told from
|
|
221
|
+
the full set, and by it the reviewer decides what need not be rechecked. The price of a mistake here
|
|
222
|
+
is trust in the section: once read as complete, from then on it is rechecked whole.
|
|
291
223
|
|
|
292
224
|
## Common misses
|
|
293
225
|
|
|
294
226
|
Misses about creating the task, the branch and the commit — pattern
|
|
295
|
-
`git-workflow-commit`.
|
|
227
|
+
`git-workflow-commit`; about the link line, the labels and the body — `git-workflow-pr-body`.
|
|
296
228
|
|
|
297
|
-
- A second `Closes` line in one PR no longer closes a task: two tasks in one branch roll back
|
|
298
|
-
only together. Either it is one task — and the second is absorbed — or two branches.
|
|
299
|
-
- Half a task that left by its own PR is a miss too: the body of such a PR starts with the words
|
|
300
|
-
`Часть #<номер>` instead of `Closes`, and the task stays open. Work that does not fit one
|
|
301
|
-
branch is split into tasks before the branch is created.
|
|
302
229
|
- A PR opened without a reviewer: it never reaches the owner's inbox at all, and the queue stands
|
|
303
230
|
while looking as if it works. That is how sixteen PRs waited for a review nobody had requested.
|
|
304
|
-
- Labels set by the PR title, not read from the task: the area is lost, and the board does not
|
|
305
|
-
show that the edit touched the site too.
|
|
306
|
-
- The task closed not in full, but the labels carried over whole: the task stays open, and the
|
|
307
|
-
PR body says so instead of implying it by a `Closes` line.
|