@rt-tools/agent-kit 0.36.0 → 0.37.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.
- package/assets/checks/board-pull-state.github.mjs +82 -13
- package/assets/checks/board.github.mjs +1 -1
- package/assets/checks/check-board.github.mjs +20 -12
- package/assets/checks/check-specs.mjs +2 -2
- package/assets/checks/epic-table.github.mjs +4 -3
- package/assets/checks/lib-common.mjs +10 -2
- package/assets/checks/lib-domains.mjs +1 -1
- package/assets/checks/lib-manifests.mjs +34 -2
- package/assets/checks/push-inputs.mjs +401 -0
- package/assets/checks/push-trace.mjs +108 -0
- package/assets/checks/rt-kit-checks.config.mjs +17 -2
- package/assets/checks/spec-anchors.mjs +4 -4
- package/assets/checks/spec-contract.mjs +5 -5
- package/assets/commands/next-session.md +3 -1
- package/assets/commands/night.md +28 -18
- package/assets/defaults/project.sh +37 -8
- package/assets/defaults/push.sh +23 -0
- package/assets/defaults/turn-map.md +10 -6
- package/assets/docs/GLOSSARY.md +3 -1
- package/assets/hooks/epic-stop-guard.sh +62 -15
- package/assets/hooks/git-guard-push-ahead.sh +31 -1
- package/assets/hooks/git-guard-push-marks.sh +173 -29
- package/assets/hooks/git-guard-push-tests.sh +22 -3
- package/assets/hooks/handoff-entry-guard.sh +2 -2
- package/assets/hooks/pre-push.sh +6 -0
- package/assets/hooks/push-set.sh +29 -4
- package/assets/hooks/task-flow-context.sh +15 -4
- package/assets/hooks/task-flow-guard.sh +4 -3
- package/assets/hooks/turn-exit-epic.sh +1 -1
- package/assets/hooks/turn-exit-guard.sh +8 -8
- package/assets/hooks/turn-exit-role.sh +45 -0
- package/assets/laws/work-conduct.md +9 -8
- package/assets/patterns/autonomous-work-run.md +35 -10
- package/assets/patterns/browser-verification-measure.md +10 -20
- package/assets/patterns/browser-verification-stand.md +30 -42
- package/assets/patterns/doc-style-human.md +0 -6
- package/assets/patterns/doc-style-sweep.md +7 -7
- package/assets/patterns/doc-style-trace.md +5 -4
- package/assets/patterns/doc-style-write.md +7 -7
- package/assets/patterns/epic-flow-declare.md +15 -8
- package/assets/patterns/git-workflow-commit.github.md +1 -1
- package/assets/patterns/git-workflow-freshness.md +12 -11
- package/assets/patterns/git-workflow-merge.md +14 -11
- package/assets/patterns/git-workflow-migration.md +4 -2
- package/assets/patterns/git-workflow-pr-body.github.md +1 -1
- package/assets/patterns/git-workflow-pr-ready.md +5 -4
- package/assets/patterns/git-workflow-pr.azure.md +91 -25
- package/assets/patterns/git-workflow-pr.github.md +17 -19
- package/assets/patterns/git-workflow-pr.gitlab.md +75 -29
- package/assets/patterns/git-workflow-restart.md +3 -2
- package/assets/patterns/git-workflow-stack.md +25 -21
- package/assets/patterns/lib-layers-new.md +7 -3
- package/assets/patterns/queue-audit-read.github.md +9 -3
- package/assets/patterns/spec-driven-domain.md +50 -48
- package/assets/patterns/spec-driven-rule.md +18 -19
- package/assets/patterns/status-report-table.github.md +1 -1
- package/assets/patterns/task-flow-archive.md +14 -34
- package/assets/patterns/task-flow-close.md +3 -2
- package/assets/patterns/task-flow-graph.needs-graph.md +98 -0
- package/assets/patterns/task-flow-handoff.md +4 -4
- package/assets/patterns/task-flow-resume.md +56 -20
- package/assets/patterns/task-flow-start.md +3 -4
- package/assets/patterns/testing-e2e.md +14 -18
- package/assets/patterns/testing-unit.md +9 -13
- package/assets/patterns/turn-entry-map.md +13 -3
- package/assets/pitfalls/autonomous-work.md +15 -0
- package/assets/pitfalls/doc-style.md +3 -3
- package/assets/pitfalls/git-workflow.github.md +5 -9
- package/assets/pitfalls/spec-driven.md +9 -7
- package/assets/pitfalls/task-flow.md +14 -25
- package/assets/pitfalls/testing.md +11 -12
- package/assets/pitfalls/turn-conduct.md +6 -6
- package/assets/rules/autonomous-work.md +37 -29
- package/assets/rules/browser-verification.md +27 -22
- package/assets/rules/dependencies.md +3 -3
- package/assets/rules/deploy-flow.azure.md +35 -12
- package/assets/rules/deploy-flow.github.md +10 -6
- package/assets/rules/deploy-flow.gitlab.md +40 -17
- package/assets/rules/doc-style.md +21 -17
- package/assets/rules/epic-flow.md +5 -3
- package/assets/rules/git-workflow.azure.md +140 -122
- package/assets/rules/git-workflow.github.md +7 -8
- package/assets/rules/git-workflow.gitlab.md +128 -117
- package/assets/rules/queue-audit.github.md +5 -3
- package/assets/rules/spec-driven.md +17 -25
- package/assets/rules/status-report.md +5 -3
- package/assets/rules/task-flow.md +33 -15
- package/assets/rules/testing.md +35 -32
- package/assets/rules/turn-conduct.md +26 -24
- package/assets/templates/rule.md +2 -2
- package/assets/traits.json +3 -0
- package/lib/cargo-prose.d.ts +2 -1
- package/lib/cargo-prose.d.ts.map +1 -1
- package/lib/cargo-prose.js.map +1 -1
- package/lib/companion.d.ts +0 -5
- package/lib/companion.d.ts.map +1 -1
- package/lib/companion.js +1 -1
- package/lib/companion.js.map +1 -1
- package/lib/cost.d.ts +0 -8
- package/lib/cost.d.ts.map +1 -1
- package/lib/cost.js +4 -4
- package/lib/cost.js.map +1 -1
- package/lib/hooks-map.d.ts +0 -12
- package/lib/hooks-map.d.ts.map +1 -1
- package/lib/hooks-map.js +2 -25
- package/lib/hooks-map.js.map +1 -1
- package/lib/observations-cargo.d.ts +1 -5
- package/lib/observations-cargo.d.ts.map +1 -1
- package/lib/observations-cargo.js +2 -2
- package/lib/observations-cargo.js.map +1 -1
- package/lib/observations.d.ts +0 -2
- package/lib/observations.d.ts.map +1 -1
- package/lib/observations.js.map +1 -1
- package/lib/order.d.ts +0 -2
- package/lib/order.d.ts.map +1 -1
- package/lib/order.js +0 -4
- package/lib/order.js.map +1 -1
- package/lib/outcomes.d.ts +2 -7
- package/lib/outcomes.d.ts.map +1 -1
- package/lib/outcomes.js +3 -3
- package/lib/outcomes.js.map +1 -1
- package/lib/proposals.d.ts +0 -1
- package/lib/proposals.d.ts.map +1 -1
- package/lib/proposals.js +1 -1
- package/lib/proposals.js.map +1 -1
- package/lib/shipment.d.ts +2 -11
- package/lib/shipment.d.ts.map +1 -1
- package/lib/shipment.fixture.d.ts +0 -3
- package/lib/shipment.fixture.d.ts.map +1 -1
- package/lib/shipment.fixture.js +3 -3
- package/lib/shipment.fixture.js.map +1 -1
- package/lib/shipment.js +2 -2
- package/lib/shipment.js.map +1 -1
- package/lib/traits.d.ts +0 -3
- package/lib/traits.d.ts.map +1 -1
- package/lib/traits.js +2 -2
- package/lib/traits.js.map +1 -1
- package/lib/variants.d.ts +0 -1
- package/lib/variants.d.ts.map +1 -1
- package/lib/variants.js +1 -1
- package/lib/variants.js.map +1 -1
- package/package.json +1 -1
- package/assets/checks/signals/ui-kit.json +0 -11
package/assets/commands/night.md
CHANGED
|
@@ -20,12 +20,8 @@ The boundary stands in the arguments — take it as it is written. There is none
|
|
|
20
20
|
they are still here at the minute of the call, and by morning there will be nobody to ask. The
|
|
21
21
|
question is one, and the work does not start before the answer.
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
window before the night ends.
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
printf 'граница ночи: %s\n' "$ARGUMENTS"
|
|
28
|
-
```
|
|
23
|
+
The boundary is written into the head of the morning list (section 6): the session will be long,
|
|
24
|
+
and the first message goes out of the window before the night ends.
|
|
29
25
|
|
|
30
26
|
## 2. Raise the rule and the pattern
|
|
31
27
|
|
|
@@ -52,13 +48,13 @@ printf 'главная: %s · задачи: %s · передача: %s\n' \
|
|
|
52
48
|
|
|
53
49
|
## 4. Checks before the first work
|
|
54
50
|
|
|
55
|
-
All
|
|
51
|
+
All of them are made before the first task is taken. Each of them by morning costs a whole night: a
|
|
56
52
|
session that runs into them at three o'clock has nobody to ask.
|
|
57
53
|
|
|
58
54
|
```bash
|
|
59
55
|
git status --short # uncommitted work
|
|
60
56
|
git fetch origin # the tip of the main branch
|
|
61
|
-
git log --oneline -1 origin
|
|
57
|
+
git log --oneline -1 "origin/${RT_MAIN_BRANCH:-main}"
|
|
62
58
|
```
|
|
63
59
|
|
|
64
60
|
- **The tree holds uncommitted changes.** Name them to the owner and ask what to do with them:
|
|
@@ -68,6 +64,10 @@ git log --oneline -1 origin/main
|
|
|
68
64
|
copy switch branches under each other.
|
|
69
65
|
- **The tip of the main branch has moved.** The first branch of the night is created from a fresh
|
|
70
66
|
base, not from the local ref: the local one is yesterday's snapshot and is silent about it.
|
|
67
|
+
- **The epic branch does not carry the tip of the main branch.** Asked by
|
|
68
|
+
`git merge-base --is-ancestor "origin/${RT_MAIN_BRANCH:-main}" origin/<ветка эпика>`. The owner
|
|
69
|
+
is asked to have main merged into it now: at night that merge cannot be sent, and the first
|
|
70
|
+
branch of the night is refused on it.
|
|
71
71
|
- **The source of the work is named.** An epic plan if there is one, the work queue otherwise. A
|
|
72
72
|
night that takes tasks by their look at the list takes somebody else's first.
|
|
73
73
|
|
|
@@ -86,12 +86,22 @@ The law demands a trace on disk at every step: a session breaks off without warn
|
|
|
86
86
|
window, on a refusal, on the network — and what was not written vanishes with it. The last reply
|
|
87
87
|
does not survive such a break.
|
|
88
88
|
|
|
89
|
-
The list lies next to the handover of the session, is created by this command
|
|
90
|
-
after each closed piece of work
|
|
89
|
+
The list lies next to the handover of the session, is created by this command with the boundary in
|
|
90
|
+
its head, and is appended to after each closed piece of work. A list of the last day already on
|
|
91
|
+
disk means a broken night resumed — after midnight too: it is read and continued, not written over.
|
|
92
|
+
The block reads the profile itself: the shell keeps nothing between calls.
|
|
91
93
|
|
|
92
94
|
```bash
|
|
93
|
-
|
|
94
|
-
|
|
95
|
+
for profile in .claude/rt-kit/defaults/project.sh .claude/rt-kit/project.sh; do
|
|
96
|
+
[ -f "$profile" ] && . "$profile"
|
|
97
|
+
done
|
|
98
|
+
dir="${RT_HANDOFF_DIR:-.claude/handoff}"
|
|
99
|
+
list="$(find "$dir" -maxdepth 1 -name '*-ночь.md' -mtime -1 2>/dev/null | sort | tail -1)"
|
|
100
|
+
[ -n "$list" ] || {
|
|
101
|
+
list="$dir/$(date +%Y-%m-%d)-ночь.md"
|
|
102
|
+
printf '# Список к утру · ночь с %s\n\nГраница: %s\n\n' "$(date +%d.%m.%Y)" "$ARGUMENTS" > "$list"
|
|
103
|
+
}
|
|
104
|
+
echo "$list"
|
|
95
105
|
```
|
|
96
106
|
|
|
97
107
|
A row per closed piece of work, and the row order is the merge order. The shape of the row and
|
|
@@ -99,13 +109,13 @@ the line of a postponed task are in the pattern `autonomous-work-run`.
|
|
|
99
109
|
|
|
100
110
|
## 7. The cycle
|
|
101
111
|
|
|
102
|
-
Then the work goes by the rule and the pattern
|
|
103
|
-
|
|
104
|
-
description of the past. A default is written where the owner's answer would have been written. A
|
|
105
|
-
guard's refusal is a step of the work, not the end of the night.
|
|
112
|
+
Then the work goes by the rule and the pattern. The night ends at the named boundary, and the last
|
|
113
|
+
reply gives the list — the same one that lies in the file.
|
|
106
114
|
|
|
107
|
-
|
|
108
|
-
|
|
115
|
+
Where a turn-exit guard holds a working turn under an open epic, silence does not end the night:
|
|
116
|
+
the guard does not know the boundary. The last turn appends the list and ends with a question
|
|
117
|
+
through the question tool — the night is over, the list is in the file. The owner answers it in the
|
|
118
|
+
morning.
|
|
109
119
|
|
|
110
120
|
## What this command does not do
|
|
111
121
|
|
|
@@ -110,9 +110,9 @@ RT_WINDOW_WARN_PCT="${RT_WINDOW_WARN_PCT:-40}"
|
|
|
110
110
|
RT_WINDOW_STOP_PCT="${RT_WINDOW_STOP_PCT:-50}"
|
|
111
111
|
RT_WINDOW_MARGIN_PCT="${RT_WINDOW_MARGIN_PCT:-5}"
|
|
112
112
|
|
|
113
|
-
# Where the session handover
|
|
114
|
-
#
|
|
115
|
-
# history.
|
|
113
|
+
# Where the session-closing command puts the handover file. Outside the tree: the work state and the
|
|
114
|
+
# handover section live in the progress and are committed, while the file retells them and does not
|
|
115
|
+
# travel into history.
|
|
116
116
|
RT_HANDOFF_DIR="${RT_HANDOFF_DIR:-.claude/handoff}"
|
|
117
117
|
|
|
118
118
|
# The commands that pass after the stop threshold: the session closes with them. Refusing them would
|
|
@@ -168,19 +168,45 @@ rt_report_body_default() {
|
|
|
168
168
|
# occurs outside the repository too, and an edit of a file outside the root does not dispose of this
|
|
169
169
|
# branch's plan at all. The guards hand the whole absolute path here, and a substring pattern would
|
|
170
170
|
# match the agent's home directory exactly as it matches the tree's code.
|
|
171
|
+
#
|
|
172
|
+
# A second working copy of the same repository is the same tree: a session that moved into it keeps
|
|
173
|
+
# the project directory of the tree it started in, and its edits there are judged against the root
|
|
174
|
+
# of that copy. Another repository stays outside. The variables carry a prefix of their own — the
|
|
175
|
+
# function is called inside guards, and a bare name like `root` overwrote the guard's own.
|
|
171
176
|
rt_is_app_code_default() {
|
|
172
|
-
|
|
177
|
+
rt_iac_root="${CLAUDE_PROJECT_DIR:-$PWD}"
|
|
173
178
|
case "$1" in
|
|
174
|
-
"$
|
|
175
|
-
/*) return 1 ;;
|
|
176
|
-
*)
|
|
179
|
+
"$rt_iac_root"/*) rt_iac_rel="${1#"$rt_iac_root"/}" ;;
|
|
180
|
+
/*) rt_iac_rel="$(rt_copy_relative "$1" "$rt_iac_root")" || return 1 ;;
|
|
181
|
+
*) rt_iac_rel="$1" ;;
|
|
177
182
|
esac
|
|
178
|
-
case "$
|
|
183
|
+
case "$rt_iac_rel" in
|
|
179
184
|
apps/* | libs/* | projects/*) return 0 ;;
|
|
180
185
|
*) return 1 ;;
|
|
181
186
|
esac
|
|
182
187
|
}
|
|
183
188
|
|
|
189
|
+
# The path relative to the root of its working copy, when that copy belongs to the same repository
|
|
190
|
+
# as the tree; nothing and a failure otherwise. The file may not exist yet, so the question goes to
|
|
191
|
+
# the nearest directory on the way up that does.
|
|
192
|
+
rt_copy_relative() {
|
|
193
|
+
rt_cr_dir="$(dirname "$1")"
|
|
194
|
+
while [ ! -d "$rt_cr_dir" ] && [ "$rt_cr_dir" != / ]; do
|
|
195
|
+
rt_cr_dir="$(dirname "$rt_cr_dir")"
|
|
196
|
+
done
|
|
197
|
+
rt_cr_top="$(git -C "$rt_cr_dir" rev-parse --show-toplevel 2>/dev/null)" || return 1
|
|
198
|
+
rt_cr_own="$(git -C "$rt_cr_dir" rev-parse --path-format=absolute --git-common-dir 2>/dev/null)" || return 1
|
|
199
|
+
rt_cr_tree="$(git -C "$2" rev-parse --path-format=absolute --git-common-dir 2>/dev/null)" || return 1
|
|
200
|
+
[ -n "$rt_cr_own" ] && [ "$rt_cr_own" = "$rt_cr_tree" ] || return 1
|
|
201
|
+
# git names the root by its real path, and a temporary directory on macOS is reached through a
|
|
202
|
+
# link; the named path is brought to the real one before the root is cut off.
|
|
203
|
+
rt_cr_real="$(cd "$rt_cr_dir" 2>/dev/null && pwd -P)${1#"$rt_cr_dir"}"
|
|
204
|
+
case "$rt_cr_real" in
|
|
205
|
+
"$rt_cr_top"/*) printf '%s' "${rt_cr_real#"$rt_cr_top"/}" ;;
|
|
206
|
+
*) return 1 ;;
|
|
207
|
+
esac
|
|
208
|
+
}
|
|
209
|
+
|
|
184
210
|
# Parsing a shell command — whether it writes and which paths it names — lives in a neighbouring
|
|
185
211
|
# file: together with it the profile outgrew the length limit, and these two functions are read
|
|
186
212
|
# apart.
|
|
@@ -440,6 +466,9 @@ rt_qa_decorative_default() {
|
|
|
440
466
|
# same name from here with the `_default` suffix for everything it did not name itself.
|
|
441
467
|
rt_push_checks() { rt_push_checks_default "$@"; }
|
|
442
468
|
rt_push_check_heavy() { rt_push_check_heavy_default "$@"; }
|
|
469
|
+
rt_push_check_budget() { rt_push_check_budget_default "$@"; }
|
|
470
|
+
rt_push_set_budget() { rt_push_set_budget_default "$@"; }
|
|
471
|
+
rt_push_over_budget_words() { rt_push_over_budget_words_default "$@"; }
|
|
443
472
|
rt_push_docs_only() { rt_push_docs_only_default "$@"; }
|
|
444
473
|
|
|
445
474
|
rt_docs_pair_for() { rt_docs_pair_for_default "$@"; }
|
package/assets/defaults/push.sh
CHANGED
|
@@ -84,6 +84,11 @@ rt_push_checks_default() {
|
|
|
84
84
|
[ -f "$root/$RT_CHECKS_DIR/$check.mjs" ] && printf '%s\n' "node $RT_CHECKS_DIR/$check.mjs"
|
|
85
85
|
done
|
|
86
86
|
|
|
87
|
+
# The table of what each step reads against what the steps read now. The selection starts it
|
|
88
|
+
# only when a step or the table itself is touched: a step's reads change with its code.
|
|
89
|
+
[ -f "$root/$RT_CHECKS_DIR/push-inputs.mjs" ] && [ -f "$root/.claude/rt-kit/push-inputs.json" ] &&
|
|
90
|
+
printf '%s\n' "node $RT_CHECKS_DIR/push-inputs.mjs verify"
|
|
91
|
+
|
|
87
92
|
return 0
|
|
88
93
|
}
|
|
89
94
|
|
|
@@ -98,3 +103,21 @@ rt_push_check_heavy_default() {
|
|
|
98
103
|
|
|
99
104
|
return 1
|
|
100
105
|
}
|
|
106
|
+
|
|
107
|
+
# How many seconds a check of the set may take, by the tree's own measurements. Silence — no limit.
|
|
108
|
+
# A check that went over its limit is red even when it passed: a set that grew silently costs every
|
|
109
|
+
# push, and nobody notices the minutes until the owner does. The package measures nothing itself.
|
|
110
|
+
rt_push_check_budget_default() {
|
|
111
|
+
return 0
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
# How many seconds the whole set of one push may take, by the tree's own measurement. Silence — no
|
|
115
|
+
# limit. Each step may stay within its own limit while the set holds steps the change did not need.
|
|
116
|
+
rt_push_set_budget_default() {
|
|
117
|
+
return 0
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
# What the refusal of an over-limit check says after the numbers. Silence — the numbers alone.
|
|
121
|
+
rt_push_over_budget_words_default() {
|
|
122
|
+
return 0
|
|
123
|
+
}
|
|
@@ -16,11 +16,11 @@ mandatory action is done, the work stays in the same state.
|
|
|
16
16
|
- `задача-взята` — write the plan; leads `task-flow-start`
|
|
17
17
|
- `замысел-записан` — do the first stage; leads `task-flow-start`
|
|
18
18
|
- `этап-идёт` — finish the stage and mark it in the progress; leads `task-flow-resume`
|
|
19
|
-
- `этапы-кончились` —
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
- `влито` — the
|
|
19
|
+
- `этапы-кончились` — merge the agreement, bring the texts up to date, run the suite; leads `task-flow-close`
|
|
20
|
+
- `разбор-кончился` — take the folder apart by the last commit; leads `task-flow-archive`
|
|
21
|
+
- `папка-разобрана` — the queue audit, then open the PR, a draft only where a run is waited for; leads `task-flow-close`
|
|
22
|
+
- `работа-отдана` — the rules review in the background, then the next task; leads `task-flow-archive`
|
|
23
|
+
- `влито` — the epic plan marks the task merged by the next task's branch; leads `task-flow-resume`
|
|
24
24
|
- `задачи-эпика-кончились` — open the PR of the epic into the main branch; leads `task-flow-close`
|
|
25
25
|
|
|
26
26
|
No state has a mandatory action that sounds like "wait". The run, the owner's review and the
|
|
@@ -28,13 +28,17 @@ merge go on without the executor and do not get faster from being watched.
|
|
|
28
28
|
|
|
29
29
|
## What a turn ends with
|
|
30
30
|
|
|
31
|
-
There are four ways, and no others.
|
|
31
|
+
There are four ways, and no others. While the epic runs the fourth does not end a turn: the next
|
|
32
|
+
task goes on in it.
|
|
32
33
|
|
|
33
34
|
- **a question to the owner that the rules do not answer** — the question is asked, and the rules were read in the same turn
|
|
34
35
|
- **a guard refusal** — the refusal is named to the owner, no workaround was looked for
|
|
35
36
|
- **the window filled where there is no compaction** — the progress is written up, the handover is written
|
|
36
37
|
- **work handed over, and the next one started** — the PR is open, and an action on the next task is done, not announced
|
|
37
38
|
|
|
39
|
+
The end of the epic is a fifth way, and only it waits: the table of the epic's tasks is shown, and
|
|
40
|
+
the session waits for the owner's word.
|
|
41
|
+
|
|
38
42
|
Where the tree has set the compaction threshold below the stop threshold, a filled window does
|
|
39
43
|
not end the turn: the context is compacted, the handover arrives as the entry, and the work goes
|
|
40
44
|
on in the same session. The stop threshold there is insurance for the case when compaction did
|
package/assets/docs/GLOSSARY.md
CHANGED
|
@@ -28,6 +28,8 @@ sections through the override; they merge here by heading, and a package edit do
|
|
|
28
28
|
- **Layout** — the transfer of a resource from the package into the tree, by its kind and by the layer settings
|
|
29
29
|
- **Laid-out file** — a file in the tree with the package header. Edited through the override, not in place: an in-place edit is lost on the next layout
|
|
30
30
|
- **Override** — a file of the tree that merges with the laid-out file by section headings
|
|
31
|
+
- **Trait** — what a tree has: a storage, an admin, an application, a code graph. Named in a list in the tree settings; a resource that needs a trait is laid out only to a tree that named it
|
|
32
|
+
- **Code graph** — a build artefact next to the tree: which file calls, imports and contains what. Answers relations, not numbers or behaviour; it is fresh when it was built from the head
|
|
31
33
|
- **Disabled role** — a role whose call the tree no longer treats as mandatory: the guard stays silent about it. Named in a list in the tree settings, not removed from the layout, and called by hand
|
|
32
34
|
- **Observation** — a line about an event of the rules layer: a rule was loaded, a gate refused, a guard declined. Written by a guard, lives in the tree, leaves as counters. Not called a log
|
|
33
35
|
- **Digest** — what the observations say over a span of days: what was used, what never was, what people stumbled on
|
|
@@ -47,7 +49,7 @@ sections through the override; they merge here by heading, and a package edit do
|
|
|
47
49
|
- **Task footprint** — a section of the plan: which specs, laws, rules and parts of the code the work touches
|
|
48
50
|
- **Session** — one sitting of work on a task. Work lives longer than a session, and between sessions its state is held by the progress
|
|
49
51
|
- **Window fill** — the share of the session's room already taken: the input, the cache write, the cache read and the last reply's output, divided by the window size. Not "spend" and not "budget": it is about room, not cost
|
|
50
|
-
- **Handover** — the text that closes a session: working tree, branch, task, where the progress lies, what is done, the next step, what was special about the session.
|
|
52
|
+
- **Handover** — the text that closes a session: working tree, branch, task, where the progress lies, what is done, the next step, what was special about the session. Written as a section of the progress and travels with the branch; without a task folder, and from the session-closing command, it is a file outside the tree
|
|
51
53
|
- **Epic** — a series of tasks on one theme in an assigned order, wider than one branch. Lives in two places: a card with the epic label and a plan next to it. Not called a work line
|
|
52
54
|
- **Archive** — records of what has happened: what explains a closed decision. Not edited after the rollout
|
|
53
55
|
- **Mission** — what a product exists for and what changes for whom. A session only proposes a wording; the owner's approval sets it. It names no features. A milestone that serves no mission is a finding
|
|
@@ -92,15 +92,26 @@ rt_epic_over || exit 0
|
|
|
92
92
|
# The number is read from the call; the words of the executor do not count.
|
|
93
93
|
taken="$(printf '%s' "$cmd" | sed -nE 's/.*(checkout|switch)[[:space:]]+(-[A-Za-z]+[[:space:]]+)*-(b|c)[[:space:]]+[A-Za-z]+-([0-9]+)-.*/\4/p; s/.*(task:move|board\.mjs[[:space:]]+move)[^0-9|;&]*([0-9]+).*/\2/p; s/.*--epic-of[[:space:]=]+([0-9]+).*/\1/p' | head -1)"
|
|
94
94
|
transcript="$(printf '%s' "$input" | jq -r '.transcript_path // empty' 2>/dev/null)"
|
|
95
|
+
|
|
96
|
+
# The words of the owner are looked for among what the owner side wrote, not among the last lines
|
|
97
|
+
# of the record. A window of lines is spent by the work itself: every command adds two, and a
|
|
98
|
+
# «yes» given an hour of work ago fell out of it while the executor was fixing what refused it.
|
|
99
|
+
# Results of commands are dropped before the count, the answers to menus stay.
|
|
100
|
+
owner_side() {
|
|
101
|
+
LC_ALL=C grep -F '"type":"user"' "$1" 2>/dev/null \
|
|
102
|
+
| awk '!/"tool_result"/ || /The user answered:|Your questions have been answered:|the user said:/' \
|
|
103
|
+
| tail -n 400
|
|
104
|
+
}
|
|
95
105
|
if [ -n "$taken" ] && [ -n "$transcript" ] && [ -f "$transcript" ]; then
|
|
96
106
|
# A menu answer comes in two forms, «The user answered:» and «Your questions have been answered:»,
|
|
97
107
|
# followed by "question"="answer" pairs. Only the answers count: the question is written by the
|
|
98
108
|
# executor, and a number in «take RT-N?» answered «no» is not the owner's word.
|
|
99
|
-
named="$(
|
|
109
|
+
named="$(owner_side "$transcript" | jq -s -r --arg n "$taken" '
|
|
100
110
|
def menu_answers: if test("^(The user answered|Your questions have been answered):")
|
|
101
111
|
then ([match("\"=\"([^\"]*)\""; "g") | .captures[0].string] | join("\n")) else "" end;
|
|
102
112
|
[.[] | select(.type == "user")
|
|
103
113
|
| select(((.isMeta // false) or (.isCompactSummary // false)) | not)
|
|
114
|
+
| select((.origin.kind // "human") == "human")
|
|
104
115
|
| (.message.content // "")
|
|
105
116
|
| if type == "string" then .
|
|
106
117
|
elif type == "array" then (map(
|
|
@@ -118,18 +129,46 @@ fi
|
|
|
118
129
|
|
|
119
130
|
# A created task has no number yet, so no menu answer can name it, and the owner's answer to «create
|
|
120
131
|
# a task for these findings?» left the call refused. The word of the owner here is their latest
|
|
121
|
-
# answer to a menu:
|
|
122
|
-
#
|
|
123
|
-
#
|
|
124
|
-
|
|
132
|
+
# answer to a menu: the answer agrees to a task — a word of a task, of creating it, or a plain
|
|
133
|
+
# «yes» — and it is not a refusal. Any answer was too wide: «not now» and an answer about a button
|
|
134
|
+
# colour passed alike. A new epic needs the word of an epic.
|
|
135
|
+
#
|
|
136
|
+
# The number after `--epic-of` names the epic, not the work taken: said by the owner, it releases
|
|
137
|
+
# the call above, and its absence from their answer refuses nothing here. Read as the number of the
|
|
138
|
+
# work, it left two answers «yes» in a row refused, and the owner was asked a third time.
|
|
139
|
+
#
|
|
140
|
+
# The answer agrees when it names the creating of a task, not a task alone: on the real record of
|
|
141
|
+
# a session ten answers of twenty-three named a task while agreeing to something else. A plain
|
|
142
|
+
# «yes» agrees only to the question it answers: it counts when that question names the creating.
|
|
143
|
+
# Every pair of the latest menu is read, not the first one, and an answer that puts the task off
|
|
144
|
+
# is no consent.
|
|
145
|
+
#
|
|
146
|
+
# What stands after the answer is judged by who wrote it. A notice of a background command and the
|
|
147
|
+
# mark of an interrupted turn are written by no person and cancel nothing. A message of the owner
|
|
148
|
+
# cancels their answer only when one of its lines begins with a refusal — «stop», «wait», «no»,
|
|
149
|
+
# «do not create»: their other words after a «yes» are not a second decision. The words the owner
|
|
150
|
+
# typed while declining a call are read the same way.
|
|
151
|
+
if [ -n "$transcript" ] && [ -f "$transcript" ] \
|
|
125
152
|
&& printf '%s' "$cmd" | grep -qE 'task:new|task-new\.mjs' 2>/dev/null; then
|
|
126
|
-
|
|
153
|
+
topic='задач|карточ|task|issue'
|
|
154
|
+
deed='заве|завод|созда|нов(ая|ую|ой) (задач|карточ)|create|new (task|issue)'
|
|
127
155
|
if printf '%s' "$cmd" | grep -qE -- '--epic([[:space:]=]|$)' 2>/dev/null; then
|
|
128
|
-
|
|
156
|
+
topic='эпик|epic'
|
|
157
|
+
deed='эпик|epic'
|
|
129
158
|
fi
|
|
130
|
-
|
|
159
|
+
yes='^\s*(да|yes|ок|ok)([^[:alpha:]]|$)'
|
|
160
|
+
refusal='^\s*(нет([^[:alpha:]]|$)|не (надо|нужно|заводи|создавай|делай)|нельзя|no([^[:alpha:]]|$)|стоп|stop|отмен|cancel|подожд|wait|позже|later|пока ничего|ничего не (надо|нужно|заводи|делай)|nothing)'
|
|
161
|
+
put_off='отлож|на потом|позже|завтра|не сейчас|пока не|not now|later'
|
|
162
|
+
# A denial inside the answer: «не создавать задачу», «без задачи», «do not create». The list
|
|
163
|
+
# above reads only the opening of a line, and an answer that opened with it by another form —
|
|
164
|
+
# an infinitive, «без» — read as consent by its word of a task.
|
|
165
|
+
denial='(^|[^[:alpha:]])(не|без|ничего не|do not|don.?t|skip)[[:space:]]+([^[:space:]]+[[:space:]]+)?(созда|завод|заве|задач|карточ|create|task|issue)'
|
|
166
|
+
latest="$(owner_side "$transcript" | jq -s -r --arg topic "$topic" --arg deed "$deed" --arg yes "$yes" \
|
|
167
|
+
--arg refusal "$refusal" --arg put_off "$put_off" --arg denial "$denial" '
|
|
168
|
+
def refuses: split("\n") | map(test($refusal; "i")) | any;
|
|
131
169
|
[.[] | select(.type == "user")
|
|
132
170
|
| select(((.isMeta // false) or (.isCompactSummary // false)) | not)
|
|
171
|
+
| select((.origin.kind // "human") == "human")
|
|
133
172
|
| (.message.content // "")
|
|
134
173
|
| if type == "string" then {said: .}
|
|
135
174
|
elif type == "array" then (map(
|
|
@@ -138,15 +177,23 @@ if [ -z "$taken" ] && [ -n "$transcript" ] && [ -f "$transcript" ] \
|
|
|
138
177
|
| if type == "string" then . elif type == "array"
|
|
139
178
|
then (map(if type == "object" then (.text // "") else "" end) | join(" ")) else "" end)
|
|
140
179
|
| if test("^(The user answered|Your questions have been answered):")
|
|
141
|
-
then {menu:
|
|
180
|
+
then {menu: [match("\"([^\"]*)\"=\"([^\"]*)\""; "g") | {asked: .captures[0].string, chose: .captures[1].string}]}
|
|
181
|
+
elif test("^The user doesn.t want to proceed") and test("the user said:")
|
|
182
|
+
then {said: (split("the user said:") | .[1:] | join("\n") | ltrimstr("\n"))}
|
|
142
183
|
else empty end)
|
|
143
184
|
else empty end) | .[])
|
|
144
|
-
else empty end
|
|
145
|
-
|
|
146
|
-
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
185
|
+
else empty end
|
|
186
|
+
| select(((.said // "") | test("^\\s*\\[Request interrupted")) | not)]
|
|
187
|
+
| (map(has("menu")) | rindex(true)) as $at
|
|
188
|
+
| if $at == null then "no"
|
|
189
|
+
else (.[$at].menu | map(
|
|
190
|
+
((.chose | refuses) or (.chose | test($put_off; "i")) or (.chose | test($denial; "i")) | not)
|
|
191
|
+
and ((.chose | test($deed; "i"))
|
|
192
|
+
or ((.chose | test($yes + "|" + $topic; "i")) and (.asked | test($deed; "i"))))
|
|
193
|
+
) | any) as $agreed
|
|
194
|
+
| (.[$at + 1:] | map((.said // "") | refuses) | any) as $taken_back
|
|
195
|
+
| if $agreed and ($taken_back | not) then "yes" else "no" end
|
|
196
|
+
end
|
|
150
197
|
' 2>/dev/null)"
|
|
151
198
|
[ "$latest" = "yes" ] && exit 0
|
|
152
199
|
fi
|
|
@@ -38,6 +38,10 @@ command -v rt_push_checks >/dev/null 2>&1 || {
|
|
|
38
38
|
exit "$not_started"
|
|
39
39
|
}
|
|
40
40
|
command -v rt_push_check_heavy >/dev/null 2>&1 || rt_push_check_heavy() { return 1; }
|
|
41
|
+
command -v rt_push_over_budget >/dev/null 2>&1 || rt_push_over_budget() { return 0; }
|
|
42
|
+
command -v rt_push_set_over_budget >/dev/null 2>&1 || rt_push_set_over_budget() { return 0; }
|
|
43
|
+
command -v rt_push_mark_drop >/dev/null 2>&1 || rt_push_mark_drop() { return 0; }
|
|
44
|
+
command -v rt_push_select >/dev/null 2>&1 || rt_push_select() { cat; }
|
|
41
45
|
# The line of a run for the metrics. No file — the checks run and record nothing.
|
|
42
46
|
# shellcheck disable=SC1091
|
|
43
47
|
[ -f "$rt_hooks_dir/metric-marks.sh" ] && . "$rt_hooks_dir/metric-marks.sh" 2>/dev/null
|
|
@@ -53,10 +57,18 @@ rt_push_mark_clean || {
|
|
|
53
57
|
|
|
54
58
|
base="$(rt_push_base "${RT_MAIN_BRANCH:-main}")"
|
|
55
59
|
skip_code="${RT_SKIP_CODE:-7}"
|
|
60
|
+
|
|
61
|
+
if command -v rt_push_adds_nothing >/dev/null 2>&1 && rt_push_adds_nothing "$base"; then
|
|
62
|
+
printf 'push ahead: the head adds no commit to %s — there is nothing to run, the push passes\n' "$base"
|
|
63
|
+
exit 0
|
|
64
|
+
fi
|
|
65
|
+
|
|
56
66
|
printf 'push ahead: base %s, tree %s\n' "${base:-none}" "$(git rev-parse --short 'HEAD^{tree}')"
|
|
57
67
|
sign="$(rt_tree_sign .)"
|
|
58
68
|
|
|
59
69
|
red=""
|
|
70
|
+
marked=""
|
|
71
|
+
set_started="$(date +%s)"
|
|
60
72
|
while IFS= read -r check; do
|
|
61
73
|
[ -z "$check" ] && continue
|
|
62
74
|
if rt_push_mark_has "$check" "$base"; then
|
|
@@ -73,9 +85,16 @@ while IFS= read -r check; do
|
|
|
73
85
|
out="$(eval "$check" 2>&1)"
|
|
74
86
|
status=$?
|
|
75
87
|
took=$(($(date +%s) - started))
|
|
88
|
+
over="$(rt_push_over_budget "$check" "$took")"
|
|
89
|
+
if [ "$status" -eq 0 ] && [ -n "$over" ]; then
|
|
90
|
+
status=1
|
|
91
|
+
out="$over"
|
|
92
|
+
fi
|
|
76
93
|
if [ "$status" -eq 0 ]; then
|
|
77
94
|
rt_run_note "$sign" "$started" green "$check"
|
|
78
95
|
rt_push_mark_put "$check" "$base" "$key_before"
|
|
96
|
+
marked="${marked}${marked:+
|
|
97
|
+
}${check}"
|
|
79
98
|
printf '+ green in %ss: %s\n' "$took" "$check"
|
|
80
99
|
elif [ "$status" -eq "$skip_code" ]; then
|
|
81
100
|
rt_run_note "$sign" "$started" skipped "$check"
|
|
@@ -87,9 +106,20 @@ while IFS= read -r check; do
|
|
|
87
106
|
printf '✗ red in %ss: %s\n%s\n' "$took" "$check" "$(printf '%s' "$out" | tail -n 25)"
|
|
88
107
|
fi
|
|
89
108
|
done <<EOF
|
|
90
|
-
$(rt_push_checks "$base")
|
|
109
|
+
$(rt_push_checks "$base" | rt_push_select "$base")
|
|
91
110
|
EOF
|
|
92
111
|
|
|
112
|
+
set_took=$(($(date +%s) - set_started))
|
|
113
|
+
set_over="$(rt_push_set_over_budget "$set_took")"
|
|
114
|
+
if [ -n "$set_over" ]; then
|
|
115
|
+
printf '✗ the whole set in %ss: %s\n' "$set_took" "$set_over"
|
|
116
|
+
printf '%s\n' "$marked" | while IFS= read -r check; do
|
|
117
|
+
[ -n "$check" ] && rt_push_mark_drop "$check" "$base"
|
|
118
|
+
done
|
|
119
|
+
red="${red}${red:+
|
|
120
|
+
}the whole set: ${set_took}s"
|
|
121
|
+
fi
|
|
122
|
+
|
|
93
123
|
if [ -n "$red" ]; then
|
|
94
124
|
printf '\npush ahead: red —\n%s\n' "$red"
|
|
95
125
|
exit 1
|