@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
|
@@ -10,38 +10,90 @@
|
|
|
10
10
|
|
|
11
11
|
# The base the contribution is counted against. Prints `origin/<branch>` or nothing.
|
|
12
12
|
#
|
|
13
|
-
#
|
|
14
|
-
#
|
|
15
|
-
#
|
|
16
|
-
#
|
|
17
|
-
#
|
|
18
|
-
#
|
|
13
|
+
# The base is the remote branch the head has the fewest commits over: what the head carries past
|
|
14
|
+
# it is what this push adds to what the remote already holds. A stacked branch is so counted
|
|
15
|
+
# against the branch under it and a task branch against the branch of its epic, not against the
|
|
16
|
+
# main one: against the main one a branch of texts ran the snapshot sets, the end-to-end suites
|
|
17
|
+
# and the image builds of the whole epic.
|
|
18
|
+
#
|
|
19
|
+
# A branch that does not lie in the history of the head is a candidate only when the host moved
|
|
20
|
+
# it past the head by merging a request: the branch of an epic that took a neighbouring task in
|
|
21
|
+
# stays the base of every task standing on it, and a lower branch merged and removed is replaced
|
|
22
|
+
# by the branch it was merged into. A branch moved by plain commits is one that stands on this
|
|
23
|
+
# one, and git alone cannot tell which of two branches was taken from the other.
|
|
24
|
+
#
|
|
25
|
+
# The main branch wins a tie: another branch is taken only when it is strictly nearer.
|
|
26
|
+
#
|
|
27
|
+
# Three kinds of branches are no base, because they are this branch's own content:
|
|
28
|
+
# - its own remote copy — the set answers for the whole contribution, not for the last commit;
|
|
29
|
+
# - a branch that stands on that copy — it carries this branch inside itself;
|
|
30
|
+
# - a branch the host merged into this one by a request. Without that the branch of an epic was
|
|
31
|
+
# counted against its last merged task, and nothing checked the epic against the main branch
|
|
32
|
+
# before the push. The host's merge is told by the committer of the commit: the host signs
|
|
33
|
+
# its merges itself, and the subject there is the title of the request, which says nothing.
|
|
34
|
+
# A tree whose host signs otherwise names the signature in `RT_PUSH_HOST_COMMITTER`.
|
|
35
|
+
#
|
|
36
|
+
# What this trusts: a branch on the remote got there through this set. The answer is read from the
|
|
37
|
+
# remote refs of the working copy after one fetch: no call to the host, and it works on the first
|
|
38
|
+
# push, when no request is open yet. A head that is no branch gets the main branch.
|
|
19
39
|
rt_push_base() {
|
|
20
|
-
local main="$1" branch
|
|
21
|
-
|
|
22
|
-
git
|
|
40
|
+
local main="$1" branch own ref name count best best_count merge merged='' host
|
|
41
|
+
host="${RT_PUSH_HOST_COMMITTER:-GitHub <noreply@github.com>}"
|
|
42
|
+
git fetch --quiet --no-prune origin 2>/dev/null
|
|
43
|
+
git rev-parse --verify --quiet "refs/remotes/origin/$main" >/dev/null 2>&1 || return 0
|
|
23
44
|
|
|
45
|
+
best="origin/$main"
|
|
46
|
+
best_count="$(git rev-list --count "refs/remotes/origin/$main..HEAD" 2>/dev/null)"
|
|
47
|
+
case "$best_count" in '' | *[!0-9]*) printf '%s' "$best" && return 0 ;; esac
|
|
24
48
|
branch="$(git symbolic-ref --quiet --short HEAD 2>/dev/null)"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
49
|
+
[ -n "$branch" ] || { printf '%s' "$best" && return 0; }
|
|
50
|
+
|
|
51
|
+
own="refs/remotes/origin/$branch"
|
|
52
|
+
# The copy is told by the name alone: a branch taken straight from a remote one tracks that
|
|
53
|
+
# one, and by the tracking the branch of the epic would pass for this branch's own copy.
|
|
54
|
+
git rev-parse --verify --quiet "$own" >/dev/null 2>&1 || own=''
|
|
55
|
+
|
|
56
|
+
# The refs the host merged into this line: reachable from the merged side of a request merge
|
|
57
|
+
# on the first-parent line of the head and not from the side it was merged into.
|
|
58
|
+
for merge in $(git rev-list --first-parent --merges --fixed-strings \
|
|
59
|
+
--committer="$host" "refs/remotes/origin/$main..HEAD" 2>/dev/null); do
|
|
60
|
+
merged="$merged
|
|
61
|
+
$(git for-each-ref --merged "$merge^2" --no-merged "$merge^1" --format='%(refname)' refs/remotes/origin 2>/dev/null)"
|
|
62
|
+
done
|
|
63
|
+
|
|
64
|
+
while IFS= read -r ref; do
|
|
65
|
+
name="${ref#refs/remotes/origin/}"
|
|
66
|
+
case "$name" in
|
|
67
|
+
'' | HEAD | "$main" | "$branch" | *[!A-Za-z0-9._/-]*) continue ;;
|
|
41
68
|
esac
|
|
42
|
-
|
|
69
|
+
printf '%s\n' "$merged" | grep -qxF -- "$ref" && continue
|
|
70
|
+
# A branch that carries the own copy stands on this one — unless the two are one commit:
|
|
71
|
+
# a branch pushed before its first commit still lies at the tip it was taken from.
|
|
72
|
+
[ -n "$own" ] && [ "$(git rev-parse "$own")" != "$(git rev-parse "$ref")" ] &&
|
|
73
|
+
git merge-base --is-ancestor "$own" "$ref" 2>/dev/null && continue
|
|
74
|
+
if ! git merge-base --is-ancestor "$ref" HEAD 2>/dev/null; then
|
|
75
|
+
[ -n "$(git rev-list -n 1 --first-parent --merges --fixed-strings --committer="$host" \
|
|
76
|
+
"HEAD..$ref" 2>/dev/null)" ] || continue
|
|
77
|
+
fi
|
|
78
|
+
# What the main branch already holds is not counted: a task that took the main branch in
|
|
79
|
+
# would otherwise look farther from the branch of its epic than from the main one.
|
|
80
|
+
count="$(git rev-list --count HEAD --not "$ref" "refs/remotes/origin/$main" 2>/dev/null)" || continue
|
|
81
|
+
case "$count" in '' | *[!0-9]*) continue ;; esac
|
|
82
|
+
# Strictly nearer, or equally near and lying under the one already taken: a neighbouring
|
|
83
|
+
# task taken from the branch of the epic is as near as that branch, and the base is the
|
|
84
|
+
# branch both stand on. The main branch is never displaced on a tie; of two unrelated
|
|
85
|
+
# branches the first by name stays — the refs come sorted.
|
|
86
|
+
if [ "$count" -lt "$best_count" ] ||
|
|
87
|
+
{ [ "$count" -eq "$best_count" ] && [ "$best" != "origin/$main" ] &&
|
|
88
|
+
git merge-base --is-ancestor "$ref" "refs/remotes/$best" 2>/dev/null; }; then
|
|
89
|
+
best="origin/$name"
|
|
90
|
+
best_count="$count"
|
|
91
|
+
fi
|
|
92
|
+
done <<EOF
|
|
93
|
+
$(git for-each-ref --format='%(refname)' refs/remotes/origin 2>/dev/null)
|
|
94
|
+
EOF
|
|
43
95
|
|
|
44
|
-
printf '
|
|
96
|
+
printf '%s' "$best"
|
|
45
97
|
}
|
|
46
98
|
|
|
47
99
|
# A mark is trusted only on a clean working copy. The checks run over the working copy, while the
|
|
@@ -52,12 +104,44 @@ rt_push_mark_clean() {
|
|
|
52
104
|
[ -z "$(git status --porcelain -- . ':(exclude).claude/rt-kit/observations' 2>/dev/null)" ]
|
|
53
105
|
}
|
|
54
106
|
|
|
107
|
+
# Whether the head adds nothing to its base: every commit of it already lies in that branch on the
|
|
108
|
+
# remote. Such a push sends content the set already judged there, and running the set over it costs
|
|
109
|
+
# its whole length and can find nothing — a branch of an epic just taken from the main branch paid
|
|
110
|
+
# forty minutes for a tree equal to the main one. A base that is no remote ref answers «it adds».
|
|
111
|
+
rt_push_adds_nothing() {
|
|
112
|
+
local base="$1" count
|
|
113
|
+
[ -n "$base" ] || return 1
|
|
114
|
+
git rev-parse --verify --quiet "refs/remotes/$base" >/dev/null 2>&1 || return 1
|
|
115
|
+
count="$(git rev-list --count "refs/remotes/$base..HEAD" 2>/dev/null)"
|
|
116
|
+
[ "$count" = 0 ]
|
|
117
|
+
}
|
|
118
|
+
|
|
55
119
|
# The key of a mark: the check line, the tree of the head and the commit of the base. The tree and
|
|
56
120
|
# not the commit — an amended commit with the same content does not pay again; the base too — a
|
|
57
121
|
# step chosen by what the branch touched answers for that base alone.
|
|
122
|
+
#
|
|
123
|
+
# A check that reads a part of the tree only is keyed by that part. The profile names the paths the
|
|
124
|
+
# check does not read — `rt_push_check_unread <check>` prints path specs, one per line — and a
|
|
125
|
+
# commit of those paths alone leaves the mark in force. Without it the task folder taken apart by
|
|
126
|
+
# the last commit of a branch, or one line in a plan, ran the whole set again over code the set had
|
|
127
|
+
# just judged. A check the profile says nothing about is keyed by the whole tree, as before. The
|
|
128
|
+
# index is read rather than the head: a mark is trusted on a clean copy alone, where the two match.
|
|
58
129
|
rt_push_mark_key() {
|
|
59
|
-
local tree base_sha=''
|
|
60
|
-
|
|
130
|
+
local tree base_sha='' unread=''
|
|
131
|
+
command -v rt_push_check_unread >/dev/null 2>&1 && unread="$(rt_push_check_unread "$1" 2>/dev/null)"
|
|
132
|
+
if [ -n "$unread" ]; then
|
|
133
|
+
# shellcheck disable=SC2086
|
|
134
|
+
# A listing that failed gives no key: its empty output would hash to one constant, and a
|
|
135
|
+
# mark under it would outlive every edit. The listing goes from the root of the copy.
|
|
136
|
+
local listed
|
|
137
|
+
listed="$(IFS='
|
|
138
|
+
'; git -c core.quotePath=false ls-files -s -- ':(top)' $unread 2>/dev/null)" || return 1
|
|
139
|
+
[ -n "$listed" ] || return 1
|
|
140
|
+
tree="$(printf '%s\n' "$listed" | git hash-object --stdin 2>/dev/null)"
|
|
141
|
+
[ -n "$tree" ] || return 1
|
|
142
|
+
else
|
|
143
|
+
tree="$(git rev-parse --verify --quiet 'HEAD^{tree}' 2>/dev/null)" || return 1
|
|
144
|
+
fi
|
|
61
145
|
[ -n "$2" ] && base_sha="$(git rev-parse --verify --quiet "$2" 2>/dev/null)"
|
|
62
146
|
printf '%s\n%s\n%s\n' "$1" "$tree" "$base_sha" | git hash-object --stdin 2>/dev/null
|
|
63
147
|
}
|
|
@@ -91,9 +175,69 @@ rt_push_mark_put() {
|
|
|
91
175
|
return 0
|
|
92
176
|
}
|
|
93
177
|
|
|
178
|
+
# Removes the mark of a check on this base, if there is one. Used when the whole set went over its
|
|
179
|
+
# time limit: the next run of the same code then runs every step again instead of passing by marks.
|
|
180
|
+
rt_push_mark_drop() {
|
|
181
|
+
local key dir
|
|
182
|
+
key="$(rt_push_mark_key "$1" "$2")" || return 0
|
|
183
|
+
dir="$(rt_push_mark_dir)" || return 0
|
|
184
|
+
[ -n "$key" ] && rm -f "$dir/$key" 2>/dev/null
|
|
185
|
+
return 0
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
# The steps of the set on stdin, the ones the change reaches on stdout, a line per step with its
|
|
189
|
+
# reason to stderr. What a step reads is taken from the table `push-inputs.mjs record` wrote from
|
|
190
|
+
# the step's own calls; a step absent from the table runs. No program, no table or a failure of the
|
|
191
|
+
# program — every step goes through, as before.
|
|
192
|
+
rt_push_select() {
|
|
193
|
+
local steps root program chosen
|
|
194
|
+
steps="$(cat)"
|
|
195
|
+
root="${CLAUDE_PROJECT_DIR:-.}"
|
|
196
|
+
program="$root/${RT_CHECKS_DIR:-tools}/push-inputs.mjs"
|
|
197
|
+
if [ -n "$1" ] && [ -f "$program" ] && [ -f "$root/.claude/rt-kit/push-inputs.json" ] &&
|
|
198
|
+
chosen="$(printf '%s\n' "$steps" | (cd "$root" && node "$program" select "$1"))"; then
|
|
199
|
+
printf '%s\n' "$chosen"
|
|
200
|
+
return 0
|
|
201
|
+
fi
|
|
202
|
+
printf '%s\n' "$steps"
|
|
203
|
+
}
|
|
204
|
+
|
|
94
205
|
# The tree runs its heavy steps ahead and the guard only reads their marks. Declared by the
|
|
95
206
|
# profile: in a tree whose heavy steps fit the hook limit a refusal for a missing mark is a new step
|
|
96
207
|
# for nothing, and the package does not know how long another tree's steps take.
|
|
97
208
|
rt_push_heavy_ahead() {
|
|
98
209
|
[ "${RT_PUSH_HEAVY_AHEAD:-}" = 1 ]
|
|
99
210
|
}
|
|
211
|
+
|
|
212
|
+
# The refusal of a check that passed but took longer than the profile allows it, or nothing. The
|
|
213
|
+
# limit is the tree's measurement of that step: over it, the set grew, and the push is refused so
|
|
214
|
+
# that the minutes are seen at the push that added them, not weeks later by the owner.
|
|
215
|
+
rt_push_over_budget() {
|
|
216
|
+
local check="$1" took="$2" limit words
|
|
217
|
+
command -v rt_push_check_budget >/dev/null 2>&1 || return 0
|
|
218
|
+
limit="$(rt_push_check_budget "$check" 2>/dev/null)"
|
|
219
|
+
case "$limit" in '' | *[!0-9]*) return 0 ;; esac
|
|
220
|
+
case "$took" in '' | *[!0-9]*) return 0 ;; esac
|
|
221
|
+
# No margin over the limit: a limit is only ever lowered, and a margin would raise every one.
|
|
222
|
+
[ "$took" -gt "$limit" ] || return 0
|
|
223
|
+
words="$(command -v rt_push_over_budget_words >/dev/null 2>&1 && rt_push_over_budget_words "$check" 2>/dev/null)"
|
|
224
|
+
printf 'over the time limit: %ss against %ss measured for this step. Find what the step runs that the change does not need.%s\n' \
|
|
225
|
+
"$took" "$limit" "${words:+ $words}"
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
# The refusal of a whole set that took longer than the profile allows a push, or nothing. Every
|
|
229
|
+
# step can stay within its own limit while the set holds steps the change did not need: only the
|
|
230
|
+
# sum shows it. The runners drop the marks this run put, so a second push of the same code runs
|
|
231
|
+
# the whole set again and does not pass by marks: the executor finds out why the set ran so long and
|
|
232
|
+
# makes it fit, not repeats the push.
|
|
233
|
+
rt_push_set_over_budget() {
|
|
234
|
+
local took="$1" limit words
|
|
235
|
+
command -v rt_push_set_budget >/dev/null 2>&1 || return 0
|
|
236
|
+
limit="$(rt_push_set_budget 2>/dev/null)"
|
|
237
|
+
case "$limit" in '' | *[!0-9]*) return 0 ;; esac
|
|
238
|
+
case "$took" in '' | *[!0-9]*) return 0 ;; esac
|
|
239
|
+
[ "$took" -gt "$limit" ] || return 0
|
|
240
|
+
words="$(command -v rt_push_over_budget_words >/dev/null 2>&1 && rt_push_over_budget_words 'the whole set' 2>/dev/null)"
|
|
241
|
+
printf 'the push went over its time limit: %ss against %ss measured for a whole set. Find out why before the next push: name every step that ran, the file of the change that called it and its minutes.%s\n' \
|
|
242
|
+
"$took" "$limit" "${words:+ $words}"
|
|
243
|
+
}
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
#
|
|
22
22
|
# The base is taken from the remote, not from the local main branch: the local one falls behind or
|
|
23
23
|
# diverges silently. That has happened already — the local one stood at a merge wiped from the
|
|
24
|
-
# history by a force push, and the set counted against it would have been the wrong one.
|
|
25
|
-
#
|
|
26
|
-
#
|
|
24
|
+
# history by a force push, and the set counted against it would have been the wrong one. The base
|
|
25
|
+
# is the remote branch the head has the fewest commits over — the helper `git-guard-push-marks.sh`
|
|
26
|
+
# picks it. There is no network or no remote — the base is empty, and
|
|
27
27
|
# the profile falls back to a full run: the gate may turn out stricter than needed, but NEVER weaker.
|
|
28
28
|
#
|
|
29
29
|
# A check green on the same tree against the same base is not run again, and a tree that declares
|
|
@@ -206,6 +206,25 @@ fi
|
|
|
206
206
|
|
|
207
207
|
base="$(rt_push_set_base)"
|
|
208
208
|
|
|
209
|
+
# Whether the command sends the checked-out branch under its own name: it names that branch as a
|
|
210
|
+
# word and carries no `source:target` pair. Only such a push is told by the head — a push of another
|
|
211
|
+
# branch, or of the head into a branch of another name, sends what the head says nothing about.
|
|
212
|
+
push_sends_head() {
|
|
213
|
+
local branch
|
|
214
|
+
branch="$(git symbolic-ref --quiet --short HEAD 2>/dev/null)" || return 1
|
|
215
|
+
printf '%s' "$cmd" | grep -qE '[[:space:]][A-Za-z0-9_./@^~+-]+:[A-Za-z0-9_./-]+([[:space:];&|]|$)' && return 1
|
|
216
|
+
case " $cmd " in *" $branch "* | *" $branch;"* | *" $branch&"* | *" $branch|"*) return 0 ;; esac
|
|
217
|
+
|
|
218
|
+
return 1
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
# A head that adds nothing to its base is not judged: the set has nothing new to look at.
|
|
222
|
+
if command -v rt_push_adds_nothing >/dev/null 2>&1 && push_sends_head && rt_push_adds_nothing "$base"; then
|
|
223
|
+
rt_push_gate_note nothing-new
|
|
224
|
+
printf 'the push gate: the head adds no commit to %s — the set is not run\n' "$base" >&2
|
|
225
|
+
exit 0
|
|
226
|
+
fi
|
|
227
|
+
|
|
209
228
|
# Every red among the light checks is named by one refusal. The gate used to leave on the first red
|
|
210
229
|
# one, and each fix opened the next reason by a push of its own: three pushes in a row went so on one
|
|
211
230
|
# branch — a repeated function, a name shared by two kits, a paint probe. A check with nothing to look
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
# Handover entry guard: a session started from a handover edits no file until the work-conduct rule
|
|
5
5
|
# is loaded.
|
|
6
6
|
#
|
|
7
|
-
# The handover was written by the previous session
|
|
7
|
+
# The handover was written by the previous session and is read by no check.
|
|
8
8
|
# It gets read as an assignment, and work begins past the rule: the state is not checked against the
|
|
9
9
|
# tree, the numbers are taken on trust, the entry order is followed from memory. An order written
|
|
10
10
|
# only in words is followed as long as someone remembers it.
|
|
@@ -73,7 +73,7 @@ verdict="$(jq -s -r --arg rule "$rule" '
|
|
|
73
73
|
|
|
74
74
|
reason="BLOCKED by handoff-entry-guard: the session began from a handover, and the rule of work conduct is not loaded for it.
|
|
75
75
|
|
|
76
|
-
The handover was written by the previous session
|
|
76
|
+
The handover was written by the previous session and is read by no check: everything standing in it is verified against the tree. The order of entry is four steps:
|
|
77
77
|
|
|
78
78
|
1. the rule of work conduct and the pattern of returning — by the first move;
|
|
79
79
|
2. the branch and the state of the work are read in the tree, not in the handover;
|
package/assets/hooks/pre-push.sh
CHANGED
|
@@ -85,6 +85,12 @@ rt_push_set_profile "$hooks_dir" "$repo_root"
|
|
|
85
85
|
command -v rt_push_checks >/dev/null 2>&1 || exit 0
|
|
86
86
|
|
|
87
87
|
base="$(rt_push_set_base)"
|
|
88
|
+
|
|
89
|
+
if command -v rt_push_adds_nothing >/dev/null 2>&1 && rt_push_adds_nothing "$base"; then
|
|
90
|
+
printf 'pre-push: the head adds no commit to %s — the set is not run\n' "$base" >&2
|
|
91
|
+
exit 0
|
|
92
|
+
fi
|
|
93
|
+
|
|
88
94
|
total="$(rt_push_checks "$base" | grep -c .)"
|
|
89
95
|
[ "${total:-0}" -eq 0 ] && exit 0
|
|
90
96
|
|
package/assets/hooks/push-set.sh
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
# been checked at all. Here lives the single one.
|
|
9
9
|
#
|
|
10
10
|
# rt_push_set_profile <hooks dir> <tree root> — the package default and the tree override
|
|
11
|
-
# rt_push_set_base — the
|
|
11
|
+
# rt_push_set_base — the nearest remote branch, or empty
|
|
12
12
|
# rt_push_set_run <base> — every line of `rt_push_checks <base>`
|
|
13
13
|
# rt_push_mark_path / rt_push_mark_covers <commit> / rt_push_mark_write — the mark of green
|
|
14
14
|
#
|
|
@@ -28,7 +28,7 @@ rt_push_set_profile() {
|
|
|
28
28
|
# shellcheck disable=SC1090
|
|
29
29
|
[ -f "$profile" ] && . "$profile" 2>/dev/null
|
|
30
30
|
done
|
|
31
|
-
# The base of
|
|
31
|
+
# The base of the branch and the marks of a green run. No helper — the base is the main
|
|
32
32
|
# branch, no mark is read and none is written: the set runs whole.
|
|
33
33
|
# shellcheck disable=SC1091
|
|
34
34
|
[ -f "$hooks_dir/git-guard-push-marks.sh" ] && . "$hooks_dir/git-guard-push-marks.sh" 2>/dev/null
|
|
@@ -37,6 +37,10 @@ rt_push_set_profile() {
|
|
|
37
37
|
command -v rt_push_mark_clean >/dev/null 2>&1 || rt_push_mark_clean() { return 1; }
|
|
38
38
|
command -v rt_push_mark_key >/dev/null 2>&1 || rt_push_mark_key() { return 1; }
|
|
39
39
|
command -v rt_push_heavy_ahead >/dev/null 2>&1 || rt_push_heavy_ahead() { return 1; }
|
|
40
|
+
command -v rt_push_over_budget >/dev/null 2>&1 || rt_push_over_budget() { return 0; }
|
|
41
|
+
command -v rt_push_set_over_budget >/dev/null 2>&1 || rt_push_set_over_budget() { return 0; }
|
|
42
|
+
command -v rt_push_mark_drop >/dev/null 2>&1 || rt_push_mark_drop() { return 0; }
|
|
43
|
+
command -v rt_push_select >/dev/null 2>&1 || rt_push_select() { cat; }
|
|
40
44
|
# The line of a run for the metrics. No file — the set runs and records nothing.
|
|
41
45
|
# shellcheck disable=SC1091
|
|
42
46
|
[ -f "$hooks_dir/metric-marks.sh" ] && . "$hooks_dir/metric-marks.sh" 2>/dev/null
|
|
@@ -69,7 +73,7 @@ rt_push_set_base() {
|
|
|
69
73
|
# named in `rt_push_set_ahead` instead of being started. The git hook has no such limit, leaves the
|
|
70
74
|
# variable empty and runs the step itself.
|
|
71
75
|
rt_push_set_run() {
|
|
72
|
-
local base="$1" check out status key_before skip_code="${RT_SKIP_CODE:-7}" sign started
|
|
76
|
+
local base="$1" check out status key_before skip_code="${RT_SKIP_CODE:-7}" sign started set_started set_took set_over over marked=""
|
|
73
77
|
case "$skip_code" in '' | 0 | 1 | *[!0-9]*) skip_code=7 ;; esac
|
|
74
78
|
command -v rt_push_check_heavy >/dev/null 2>&1 || rt_push_check_heavy() { return 1; }
|
|
75
79
|
sign="$(rt_tree_sign .)"
|
|
@@ -81,6 +85,7 @@ rt_push_set_run() {
|
|
|
81
85
|
rt_push_set_ahead=""
|
|
82
86
|
rt_push_set_ran=0
|
|
83
87
|
rt_push_set_passed=0
|
|
88
|
+
set_started="$(date +%s 2>/dev/null)"
|
|
84
89
|
while IFS= read -r check; do
|
|
85
90
|
[ -z "$check" ] && continue
|
|
86
91
|
if rt_push_mark_has "$check" "$base"; then
|
|
@@ -104,9 +109,16 @@ rt_push_set_run() {
|
|
|
104
109
|
started="$(date +%s 2>/dev/null)"
|
|
105
110
|
out="$(eval "$check" 2>&1 </dev/null)"
|
|
106
111
|
status=$?
|
|
112
|
+
over="$(rt_push_over_budget "$check" "$(($(date +%s 2>/dev/null) - started))")"
|
|
113
|
+
if [ "$status" -eq 0 ] && [ -n "$over" ]; then
|
|
114
|
+
status=1
|
|
115
|
+
out="$over"
|
|
116
|
+
fi
|
|
107
117
|
if [ "$status" -eq 0 ]; then
|
|
108
118
|
rt_push_set_passed=$((rt_push_set_passed + 1))
|
|
109
119
|
rt_push_mark_put "$check" "$base" "$key_before"
|
|
120
|
+
marked="${marked}${marked:+
|
|
121
|
+
}${check}"
|
|
110
122
|
rt_run_note "$sign" "$started" green "$check"
|
|
111
123
|
continue
|
|
112
124
|
fi
|
|
@@ -124,8 +136,21 @@ rt_push_set_run() {
|
|
|
124
136
|
}── ${check}
|
|
125
137
|
$(printf '%s' "$out" | tail -n 25)"
|
|
126
138
|
done <<EOF
|
|
127
|
-
$(rt_push_checks "$base")
|
|
139
|
+
$(rt_push_checks "$base" | rt_push_select "$base")
|
|
128
140
|
EOF
|
|
141
|
+
set_took=$(($(date +%s 2>/dev/null) - set_started))
|
|
142
|
+
set_over="$(rt_push_set_over_budget "$set_took")"
|
|
143
|
+
if [ -n "$set_over" ]; then
|
|
144
|
+
printf '%s\n' "$marked" | while IFS= read -r check; do
|
|
145
|
+
[ -n "$check" ] && rt_push_mark_drop "$check" "$base"
|
|
146
|
+
done
|
|
147
|
+
rt_push_set_failed="${rt_push_set_failed}${rt_push_set_failed:+
|
|
148
|
+
}the whole set: ${set_took}s"
|
|
149
|
+
rt_push_set_output="${rt_push_set_output}${rt_push_set_output:+
|
|
150
|
+
|
|
151
|
+
}── the whole set
|
|
152
|
+
${set_over}"
|
|
153
|
+
fi
|
|
129
154
|
return 0
|
|
130
155
|
}
|
|
131
156
|
|
|
@@ -163,9 +163,11 @@ rt_task_flow_context() {
|
|
|
163
163
|
! git -C "$rt_tf_askdir" ls-files --error-unmatch -- "$rt_tf_candidate" >/dev/null 2>&1; then
|
|
164
164
|
continue
|
|
165
165
|
fi
|
|
166
|
+
# A relative path belongs to the directory the command runs in. The project directory of the
|
|
167
|
+
# session is a different tree once the session moved into a second working copy.
|
|
166
168
|
case "$rt_tf_candidate" in
|
|
167
169
|
/*) ;;
|
|
168
|
-
*) rt_tf_candidate="$
|
|
170
|
+
*) rt_tf_candidate="$rt_tf_askdir/$rt_tf_candidate" ;;
|
|
169
171
|
esac
|
|
170
172
|
if rt_is_app_code "$rt_tf_candidate" || rt_tf_laid_out "$rt_tf_candidate"; then
|
|
171
173
|
RT_TF_PATH="$rt_tf_candidate"
|
|
@@ -177,9 +179,18 @@ EOF
|
|
|
177
179
|
[ -z "$RT_TF_PATH" ] && return 1
|
|
178
180
|
RT_TF_CANDIDATES="$rt_tf_candidates"
|
|
179
181
|
|
|
180
|
-
# The branch is looked at where the edit will go: a worktree has one of its own.
|
|
181
|
-
|
|
182
|
-
|
|
182
|
+
# The branch is looked at where the edit will go: a worktree has one of its own. The edited
|
|
183
|
+
# file names that copy itself — the directory of the call may stay in another copy while a
|
|
184
|
+
# tool writes by the full path — so the nearest existing directory of the file is asked first,
|
|
185
|
+
# and the directory of the call only when that is not a working copy.
|
|
186
|
+
rt_tf_workdir="$(dirname "$RT_TF_PATH")"
|
|
187
|
+
while [ ! -d "$rt_tf_workdir" ] && [ "$rt_tf_workdir" != / ]; do
|
|
188
|
+
rt_tf_workdir="$(dirname "$rt_tf_workdir")"
|
|
189
|
+
done
|
|
190
|
+
if ! git -C "$rt_tf_workdir" rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
|
191
|
+
rt_tf_workdir="$(rt_hook_cwd)"
|
|
192
|
+
[ -z "$rt_tf_workdir" ] && rt_tf_workdir="${CLAUDE_PROJECT_DIR:-.}"
|
|
193
|
+
fi
|
|
183
194
|
cd "$rt_tf_workdir" 2>/dev/null || return 1
|
|
184
195
|
git rev-parse --is-inside-work-tree >/dev/null 2>&1 || return 1
|
|
185
196
|
|
|
@@ -65,9 +65,10 @@ merge_conflict_only() {
|
|
|
65
65
|
seen=0
|
|
66
66
|
while IFS= read -r candidate; do
|
|
67
67
|
[ -z "$candidate" ] && continue
|
|
68
|
+
# A relative path belongs to the directory of the call, as in the context above.
|
|
68
69
|
case "$candidate" in
|
|
69
70
|
/*) ;;
|
|
70
|
-
*) candidate="${CLAUDE_PROJECT_DIR:-.}/$candidate" ;;
|
|
71
|
+
*) candidate="${rt_tf_askdir:-${CLAUDE_PROJECT_DIR:-.}}/$candidate" ;;
|
|
71
72
|
esac
|
|
72
73
|
rt_is_app_code "$candidate" || rt_tf_laid_out "$candidate" || continue
|
|
73
74
|
[ -n "$(git -C "$root" ls-files -u -- "$candidate" 2>/dev/null | head -1)" ] || return 1
|
|
@@ -130,8 +131,8 @@ state_action() {
|
|
|
130
131
|
договорённость-записана) printf '%s' 'create the task, the branch and the task folder' ;;
|
|
131
132
|
задача-взята) printf '%s' 'write the plan' ;;
|
|
132
133
|
замысел-записан) printf '%s' 'do the first stage' ;;
|
|
133
|
-
папка-разобрана) printf '%s' '
|
|
134
|
-
влито) printf '%s' '
|
|
134
|
+
папка-разобрана) printf '%s' 'the work queue audit, then open the PR' ;;
|
|
135
|
+
влито) printf '%s' 'mark the task merged in the epic plan by the next task branch' ;;
|
|
135
136
|
*) printf '%s' '' ;;
|
|
136
137
|
esac
|
|
137
138
|
}
|
|
@@ -87,7 +87,7 @@ rt_te_epic_deny() {
|
|
|
87
87
|
esac
|
|
88
88
|
rt_te_deny "BLOCKED by turn-exit-guard: the epic is open — its unfinished tasks: $(rt_te_epic_left) — and ${ended}.
|
|
89
89
|
|
|
90
|
-
Until the epic is closed the executor does not stop on its own: the owner said so outright. A turn ends in
|
|
90
|
+
Until the epic is closed the executor does not stop on its own: the owner said so outright. Under an open epic work handed over does not end a turn: the next task is worked on in it. A turn ends in three ways: a question to the owner through the question tool, when the work does not go without the answer; a refusal of a guard as the last action of the turn; the session handover written by the hook on window fill, or the refusal of the window guard. The word of the owner about stopping, quoted in the reply or in the line «Waiting for the owner», releases the guard as well. The end of the epic is a stop of its own: not one task of it is left.
|
|
91
91
|
|
|
92
92
|
The next step is written in the progress: ${next_step}
|
|
93
93
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
# rt-hook: Stop
|
|
3
|
-
# Requires: hooks/deny-tail.sh, hooks/epic-over.sh, hooks/turn-exit-patterns.sh, hooks/turn-exit-epic.sh
|
|
3
|
+
# Requires: hooks/deny-tail.sh, hooks/epic-over.sh, hooks/turn-exit-patterns.sh, hooks/turn-exit-epic.sh, hooks/turn-exit-role.sh
|
|
4
4
|
# Turn exit guard: a turn in which nothing was done on the work does not end until the work is
|
|
5
5
|
# handed over. Stop.
|
|
6
6
|
#
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
# 4. A guard refusal — it ends the turn by the rule.
|
|
25
25
|
# 5. The session handover is written — the window has run out.
|
|
26
26
|
# 6. The owner said to stop.
|
|
27
|
+
# 7. The session runs as a role with no edit tool: its report is its work, `turn-exit-role.sh`.
|
|
27
28
|
#
|
|
28
29
|
# Under an open epic the second and the fifth do not release, and a second pass is judged again:
|
|
29
30
|
# until the epic is closed the executor does not stop on its own. The tiers lie in `turn-exit-epic.sh`.
|
|
@@ -38,8 +39,7 @@
|
|
|
38
39
|
# FAIL-OPEN: on any error, a missing `jq`, a missing turn record, task folder or state line the
|
|
39
40
|
# turn is ALLOWED (exit 0). A broken guard has no right to jam the conversation.
|
|
40
41
|
|
|
41
|
-
# Its own name in the observations: the
|
|
42
|
-
# guard itself.
|
|
42
|
+
# Its own name in the observations: the shared deny tail writes the refusal, not the guard.
|
|
43
43
|
RT_GUARD_NAME=turn-exit-guard
|
|
44
44
|
RT_GUARD_RULE=turn-conduct
|
|
45
45
|
|
|
@@ -87,6 +87,7 @@ git rev-parse --is-inside-work-tree >/dev/null 2>&1 || exit 0
|
|
|
87
87
|
|
|
88
88
|
root="$(git rev-parse --show-toplevel 2>/dev/null)"
|
|
89
89
|
[ -z "$root" ] && exit 0
|
|
90
|
+
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/turn-exit-role.sh" 2>/dev/null && rt_te_read_only_role && exit 0
|
|
90
91
|
|
|
91
92
|
# The tiers of the open epic lie in a neighbouring file. A second pass over the same turn is judged
|
|
92
93
|
# only under an open epic: outside it the guard has said its piece once and lets go.
|
|
@@ -152,9 +153,8 @@ next_step=""
|
|
|
152
153
|
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/turn-exit-patterns.sh" 2>/dev/null || exit 0
|
|
153
154
|
[ -n "${work_re:-}" ] || exit 0
|
|
154
155
|
|
|
155
|
-
# The parsing of the turn record lies in a neighbouring file
|
|
156
|
-
#
|
|
157
|
-
# guard stays silent — fail-open, as on any breakage of its own.
|
|
156
|
+
# The parsing of the turn record lies in a neighbouring file, apart from the tiers that apply its
|
|
157
|
+
# answer. Without the file the guard stays silent — fail-open, as on any breakage of its own.
|
|
158
158
|
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/turn-exit-verdict.sh" 2>/dev/null || exit 0
|
|
159
159
|
command -v rt_te_verdict >/dev/null 2>&1 || exit 0
|
|
160
160
|
rt_te_verdict
|
|
@@ -454,7 +454,7 @@ The guard judges one turn: the next session is not refused."
|
|
|
454
454
|
elif [ -z "$state" ]; then
|
|
455
455
|
reason="BLOCKED by turn-exit-guard: nothing was done in this turn — neither an edit nor a command changing the tree. This work has no task folder, and there is nowhere to take the state from, but that does not end the turn.
|
|
456
456
|
|
|
457
|
-
A turn ends in four ways
|
|
457
|
+
A turn ends in four ways: a question to the owner the rules do not answer; a refusal of a guard; a filled session window; work handed over with the next one begun — outside an open epic. The end of the epic is the fifth. A command named and not run is not an exit: the line «сейчас запущу» is an announcement of intent, and that is named outright as a false end of a turn.
|
|
458
458
|
|
|
459
459
|
Work by the word of the owner — «разложи», «обнови», «посмотри» — goes without a task and without a branch, and there is nothing to stop it by except this sign.
|
|
460
460
|
|
|
@@ -464,7 +464,7 @@ The guard judges one turn: the next session is not refused."
|
|
|
464
464
|
else
|
|
465
465
|
reason="BLOCKED by turn-exit-guard: the work is in the state '${state}', and nothing was done about it in this turn — neither an edit nor a command changing the tree.
|
|
466
466
|
|
|
467
|
-
A turn ends in four ways
|
|
467
|
+
A turn ends in four ways: a question to the owner the rules do not answer; a refusal of a guard; a filled session window; work handed over with the next one begun — outside an open epic. The end of the epic is the fifth. A report about what was done is not an exit — it looks more like work than any other, and the emptiness behind it is invisible.
|
|
468
468
|
|
|
469
469
|
The next step is written in the progress: ${next_step}
|
|
470
470
|
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# The role a session runs as, for the turn-exit guard. NOT a guard: it has no `rt-hook:` declaration
|
|
3
|
+
# and hooks into no agent event. The guard sources it right after the root of the tree is known.
|
|
4
|
+
#
|
|
5
|
+
# Why it exists. A role started as the main agent, `claude -p --agent <role>`, is judged as an
|
|
6
|
+
# executor, and a role without an edit tool can never pass that judgement: there is no edit in its
|
|
7
|
+
# turn, no word of the owner about a stop, and no owner to ask. Under an open epic the guard gave
|
|
8
|
+
# such a turn back on every pass. A run ended on the turn limit, or the refusal took up the final
|
|
9
|
+
# message in place of the report it was started for. The report is the whole work of such a role.
|
|
10
|
+
#
|
|
11
|
+
# How the role is recognised. The client puts the name into the field `agent_type` of the event; a
|
|
12
|
+
# role called through the agent tool ends with another event and never reaches the guard. The tools
|
|
13
|
+
# are read from the `tools:` line in the header of the role file. A role with no such line, or with
|
|
14
|
+
# `tools: *`, gets every tool the session has, so it stays judged as an executor; so does a role
|
|
15
|
+
# with no file in the tree, a built-in or a plugin one: there is nothing to read its tools from.
|
|
16
|
+
#
|
|
17
|
+
# Expects `$input` and `$root` to be set; the answer is the return code.
|
|
18
|
+
#
|
|
19
|
+
# FAIL-OPEN towards the judgement: no field, no file, an unusual name or an unreadable header — the
|
|
20
|
+
# session reads as an executor, and the guard works as it did before this reading existed.
|
|
21
|
+
|
|
22
|
+
rt_te_read_only_role() {
|
|
23
|
+
local role file tools
|
|
24
|
+
role="$(printf '%s' "$input" | jq -r '.agent_type // empty' 2>/dev/null)"
|
|
25
|
+
[ -n "$role" ] || return 1
|
|
26
|
+
case "$role" in
|
|
27
|
+
*/* | .*) return 1 ;;
|
|
28
|
+
esac
|
|
29
|
+
file="$root/.claude/agents/$role.md"
|
|
30
|
+
[ -f "$file" ] || return 1
|
|
31
|
+
|
|
32
|
+
# Only the header is read: the body of a role may quote the line itself.
|
|
33
|
+
tools="$(awk '
|
|
34
|
+
NR == 1 { if ($0 != "---") exit; next }
|
|
35
|
+
$0 == "---" { exit }
|
|
36
|
+
/^tools:/ { sub(/^tools:[[:space:]]*/, ""); print; exit }
|
|
37
|
+
' "$file" 2>/dev/null)"
|
|
38
|
+
[ -n "$tools" ] || return 1
|
|
39
|
+
case "$tools" in
|
|
40
|
+
*'*'*) return 1 ;;
|
|
41
|
+
esac
|
|
42
|
+
|
|
43
|
+
! printf '%s' "$tools" \
|
|
44
|
+
| grep -qE '(^|[^[:alnum:]_])(Write|Edit|MultiEdit|NotebookEdit)([^[:alnum:]_]|$)' 2>/dev/null
|
|
45
|
+
}
|
|
@@ -15,7 +15,8 @@ one session and keeps its whole context and state when it passes to the next.
|
|
|
15
15
|
line. The part the work repeats is read in full — another tree's structure is not judged by one
|
|
16
16
|
file.
|
|
17
17
|
- **A sample named in the progress must be reachable by every session while the work goes on.** The
|
|
18
|
-
|
|
18
|
+
progress carries a reference to it; a full path that names another tree lies outside the history,
|
|
19
|
+
among the records that belong to no branch.
|
|
19
20
|
- **A question with an obvious answer does not stop the work.** The executor names the assumption,
|
|
20
21
|
moves on and writes it where the work goes on. Only a gap where any guess makes the work dangerous
|
|
21
22
|
or useless stops it.
|
|
@@ -172,9 +173,9 @@ one session and keeps its whole context and state when it passes to the next.
|
|
|
172
173
|
The owner follows the epic by one card, not by its tasks; a card that stays where the epic was
|
|
173
174
|
declared reads as an epic nobody started, however many of its tasks are already done. The card
|
|
174
175
|
moves by the same motion as the first task's, not by a separate step remembered later.
|
|
175
|
-
- **An executor's session does not end together with the task.** The end of a task is
|
|
176
|
-
stop
|
|
177
|
-
|
|
176
|
+
- **An executor's session does not end together with the task.** The end of a task is no sign to
|
|
177
|
+
stop; the epic's end is, until the owner's word. A session closed on a finished task costs a whole
|
|
178
|
+
session to return to the work.
|
|
178
179
|
- **The window fill limit stops a session only where the tool does not compact the context itself.**
|
|
179
180
|
Where compaction is declared and comes before the limit, the window is not the end of the session
|
|
180
181
|
but its continuation: the context is compacted, the written state returns into it, and the work
|
|
@@ -254,10 +255,10 @@ one session and keeps its whole context and state when it passes to the next.
|
|
|
254
255
|
number, fresh tasks on top; it does not hold the epic's order and cannot — tasks of all epics lie
|
|
255
256
|
there at once. The epic plan is opened before a task is taken and answers in one call: which task
|
|
256
257
|
is next, and whether it moved to a neighbouring epic.
|
|
257
|
-
- **An ended epic is
|
|
258
|
-
the epic goes on, the next
|
|
259
|
-
|
|
260
|
-
epic continues.
|
|
258
|
+
- **An ended epic is a stop: the owner is shown what was done and is asked for the next work.** While
|
|
259
|
+
the epic goes on, the next work is taken silently; once it has ended, the next step is not
|
|
260
|
+
obvious to both. Work taken outside an ended epic without the owner's word leaves them sure
|
|
261
|
+
the epic continues.
|
|
261
262
|
- **An epic is not closed while even one sign of its end is confirmed only by reading.** A sign
|
|
262
263
|
checked by eye closes the work only after a command or a measurement checks it, with their output.
|
|
263
264
|
The note "confirmed by a live measurement" is a promise to check, not a check. Closed on two signs
|