@rt-tools/agent-kit 0.23.0 → 0.26.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/README.md +8 -2
- package/assets/agents/business-analyst.md +51 -50
- package/assets/agents/conscience.md +37 -35
- package/assets/agents/project-manager.md +49 -48
- package/assets/agents/prose-editor.md +31 -29
- package/assets/agents/qa-engineer.md +50 -48
- package/assets/agents/rules-reviewer.md +63 -58
- package/assets/agents/skill-curator.md +83 -78
- package/assets/agents/spec-critic.md +34 -29
- package/assets/agents/spec-writer.md +35 -32
- package/assets/agents/strict-teacher.md +39 -37
- package/assets/checks/archive-age.mjs +48 -28
- package/assets/checks/archive-prune.mjs +16 -14
- package/assets/checks/board-epics.github.mjs +75 -41
- package/assets/checks/board-folders.mjs +61 -0
- package/assets/checks/board-gh.github.mjs +35 -26
- package/assets/checks/board-long-work.github.mjs +24 -24
- package/assets/checks/board-paths.github.mjs +21 -16
- package/assets/checks/board-runs.github.mjs +45 -43
- package/assets/checks/board-titles.github.mjs +19 -17
- package/assets/checks/board.github.mjs +150 -128
- package/assets/checks/check-archive-age.mjs +23 -19
- package/assets/checks/check-board.github.mjs +179 -157
- package/assets/checks/check-descriptions.mjs +30 -29
- package/assets/checks/check-doc-paths.mjs +104 -82
- package/assets/checks/check-dupes.mjs +84 -80
- package/assets/checks/check-file-size.mjs +79 -70
- package/assets/checks/check-glossary.mjs +47 -37
- package/assets/checks/check-hook-scope.mjs +30 -27
- package/assets/checks/check-lib-layers.mjs +22 -21
- package/assets/checks/check-profile-drift.mjs +48 -43
- package/assets/checks/check-prose-style.mjs +125 -33
- package/assets/checks/check-push-gate.mjs +53 -50
- package/assets/checks/check-reuse.mjs +50 -40
- package/assets/checks/check-schema-drift.mjs +87 -83
- package/assets/checks/check-specs.mjs +155 -134
- package/assets/checks/check-state-next.mjs +66 -52
- package/assets/checks/check-states.mjs +32 -30
- package/assets/checks/check-styles.mjs +52 -51
- package/assets/checks/check-turn-map.mjs +54 -46
- package/assets/checks/lib-boundaries.mjs +32 -30
- package/assets/checks/lib-common.mjs +30 -29
- package/assets/checks/lib-domains.mjs +34 -34
- package/assets/checks/lib-manifests.mjs +17 -15
- package/assets/checks/lib-reexports.mjs +18 -18
- package/assets/checks/rt-kit-checks.config.mjs +174 -142
- package/assets/checks/signals.mjs +43 -39
- package/assets/checks/spec-anchors.mjs +114 -87
- package/assets/checks/spec-common.mjs +128 -84
- package/assets/checks/spec-contract.mjs +30 -30
- package/assets/checks/spec-proposed.mjs +27 -24
- package/assets/checks/spec-scenarios.mjs +51 -28
- package/assets/checks/task-new.github.mjs +85 -56
- package/assets/commands/feedback.md +65 -59
- package/assets/commands/next-session.md +64 -57
- package/assets/commands/skill-curator.md +83 -79
- package/assets/defaults/gate-map.sh +115 -91
- package/assets/defaults/project.sh +228 -178
- package/assets/defaults/shell.sh +85 -65
- package/assets/defaults/turn-map.md +45 -44
- package/assets/docs/GLOSSARY.md +142 -65
- package/assets/hooks/browser-device-id.sh +12 -12
- package/assets/hooks/browser-guard-device-id.sh +46 -14
- package/assets/hooks/browser-guard-no-asking.sh +5 -4
- package/assets/hooks/browser-guard-no-listing.sh +12 -11
- package/assets/hooks/browser-guard-no-other-drivers.sh +48 -42
- package/assets/hooks/browser-guard-require-select.sh +34 -23
- package/assets/hooks/claim-guard.sh +62 -56
- package/assets/hooks/commit-msg.sh +11 -10
- package/assets/hooks/conscience-guard.sh +91 -45
- package/assets/hooks/constitution-index.sh +16 -16
- package/assets/hooks/deny-tail.sh +28 -26
- package/assets/hooks/dev-server-guard.sh +46 -43
- package/assets/hooks/dispatch.sh +84 -39
- package/assets/hooks/docs-guard.sh +105 -86
- package/assets/hooks/exam-guard.sh +146 -84
- package/assets/hooks/git-guard-delivery-conflict.sh +38 -36
- package/assets/hooks/git-guard-delivery-draft.sh +85 -0
- package/assets/hooks/git-guard-delivery-folder.sh +50 -43
- package/assets/hooks/git-guard-delivery-signature.sh +88 -52
- package/assets/hooks/git-guard-delivery.sh +207 -253
- package/assets/hooks/git-guard-main.sh +65 -26
- package/assets/hooks/git-guard-push-tests.sh +133 -75
- package/assets/hooks/glossary-load.sh +23 -22
- package/assets/hooks/grill-gate-ask.sh +12 -11
- package/assets/hooks/grill-gate.sh +94 -87
- package/assets/hooks/guard-note.sh +20 -19
- package/assets/hooks/handoff-entry-guard.sh +26 -24
- package/assets/hooks/handoff-write.sh +74 -67
- package/assets/hooks/hook-input.sh +70 -50
- package/assets/hooks/lint-after-edit.sh +95 -61
- package/assets/hooks/observe.sh +28 -26
- package/assets/hooks/override-write-guard.sh +23 -21
- package/assets/hooks/postmortem-guard.sh +42 -39
- package/assets/hooks/profile-check.sh +22 -20
- package/assets/hooks/proposal-guard.sh +57 -49
- package/assets/hooks/prose-style-guard.sh +19 -17
- package/assets/hooks/qa-dataid-guard.sh +52 -49
- package/assets/hooks/rerun-guard.sh +31 -30
- package/assets/hooks/reuse-first-guard.sh +108 -87
- package/assets/hooks/roles.sh +14 -14
- package/assets/hooks/rule-article.sh +36 -34
- package/assets/hooks/rule-source-guard.sh +52 -36
- package/assets/hooks/skill-gate-layers.sh +59 -57
- package/assets/hooks/skill-gate-rearm.sh +15 -8
- package/assets/hooks/skill-gate.sh +89 -81
- package/assets/hooks/skill-loaded.sh +6 -6
- package/assets/hooks/sql-guard-parse.sh +68 -66
- package/assets/hooks/sql-guard-request.sh +48 -46
- package/assets/hooks/sql-guard-target.sh +57 -51
- package/assets/hooks/sql-guard-write.sh +84 -79
- package/assets/hooks/sql-guard.sh +52 -47
- package/assets/hooks/stand-login-guard.sh +104 -0
- package/assets/hooks/task-context-load.sh +60 -55
- package/assets/hooks/task-flow-context.sh +87 -69
- package/assets/hooks/task-flow-draft-guard.sh +55 -48
- package/assets/hooks/task-flow-guard.sh +67 -64
- package/assets/hooks/turn-entry-load.sh +39 -32
- package/assets/hooks/turn-exit-guard.sh +256 -204
- package/assets/hooks/turn-exit-patterns.sh +53 -0
- package/assets/hooks/utf8.sh +11 -11
- package/assets/hooks/waiting-turn-guard.sh +94 -94
- package/assets/hooks/window-fill-guard.sh +70 -62
- package/assets/hooks/work-start-guard.sh +52 -49
- package/assets/hooks/write-targets.sh +115 -30
- package/assets/laws/autonomous-work.md +29 -27
- package/assets/laws/code-structure.md +31 -30
- package/assets/laws/delivery.md +148 -137
- package/assets/laws/entity-editing.md +52 -50
- package/assets/laws/entity-models.md +14 -13
- package/assets/laws/frontend-application.md +39 -38
- package/assets/laws/lib-imports.md +27 -27
- package/assets/laws/lists.md +31 -29
- package/assets/laws/navigation.md +37 -37
- package/assets/laws/observability.md +41 -40
- package/assets/laws/project-documentation.md +106 -99
- package/assets/laws/reuse-first.md +31 -29
- package/assets/laws/shared-code.md +27 -27
- package/assets/laws/verifiability.md +131 -114
- package/assets/laws/work-conduct.md +250 -250
- package/assets/patterns/admin-lists-screen.md +72 -69
- package/assets/patterns/admin-nav-item.md +51 -46
- package/assets/patterns/angular-patterns-state.md +32 -31
- package/assets/patterns/api-layer-pair.md +33 -31
- package/assets/patterns/autonomous-work-run.md +50 -49
- package/assets/patterns/browser-verification-measure.md +143 -67
- package/assets/patterns/browser-verification-stand.md +181 -128
- package/assets/patterns/component-structure-new.md +51 -42
- package/assets/patterns/dependencies-upgrade.md +55 -39
- package/assets/patterns/doc-style-human.md +93 -0
- package/assets/patterns/doc-style-sweep.md +82 -79
- package/assets/patterns/doc-style-trace.md +87 -81
- package/assets/patterns/doc-style-write.md +130 -122
- package/assets/patterns/entity-aside.md +77 -63
- package/assets/patterns/entity-models-new.md +37 -37
- package/assets/patterns/entity-store.md +33 -33
- package/assets/patterns/git-workflow-commit.azure.md +94 -75
- package/assets/patterns/git-workflow-commit.github.md +153 -129
- package/assets/patterns/git-workflow-commit.gitlab.md +96 -78
- package/assets/patterns/git-workflow-docker.md +165 -147
- package/assets/patterns/git-workflow-freshness.md +45 -45
- package/assets/patterns/git-workflow-merge.md +99 -86
- package/assets/patterns/git-workflow-migration.md +54 -52
- package/assets/patterns/git-workflow-pr-ready.md +57 -56
- package/assets/patterns/git-workflow-pr.azure.md +126 -121
- package/assets/patterns/git-workflow-pr.github.md +179 -175
- package/assets/patterns/git-workflow-pr.gitlab.md +138 -131
- package/assets/patterns/git-workflow-restart.md +35 -31
- package/assets/patterns/git-workflow-secrets.md +80 -73
- package/assets/patterns/git-workflow-stack.md +131 -106
- package/assets/patterns/lib-layers-move.md +62 -53
- package/assets/patterns/lib-layers-new.md +59 -45
- package/assets/patterns/observability-record.md +72 -67
- package/assets/patterns/platform-access-di.md +31 -29
- package/assets/patterns/reuse-first-extend.md +66 -61
- package/assets/patterns/shared-code-new.md +39 -38
- package/assets/patterns/spec-driven-domain.md +161 -151
- package/assets/patterns/spec-driven-rule.md +179 -168
- package/assets/patterns/spec-driven-sweep.md +41 -39
- package/assets/patterns/status-report-table.github.md +37 -36
- package/assets/patterns/styling-bem-component.md +42 -42
- package/assets/patterns/styling-bem-layout.md +39 -34
- package/assets/patterns/styling-bem-sheet.md +59 -58
- package/assets/patterns/task-flow-archive.md +222 -215
- package/assets/patterns/task-flow-close.md +215 -203
- package/assets/patterns/task-flow-handoff.md +154 -145
- package/assets/patterns/task-flow-resume.md +138 -133
- package/assets/patterns/task-flow-start.md +204 -192
- package/assets/patterns/testing-e2e.md +103 -92
- package/assets/patterns/testing-unit.md +77 -70
- package/assets/patterns/ts-procedure.md +32 -29
- package/assets/patterns/turn-entry-map.md +50 -48
- package/assets/pitfalls/agent-kit.md +152 -141
- package/assets/pitfalls/doc-style.md +96 -91
- package/assets/pitfalls/git-workflow.azure.md +49 -46
- package/assets/pitfalls/git-workflow.github.md +264 -234
- package/assets/pitfalls/git-workflow.gitlab.md +49 -45
- package/assets/pitfalls/spec-driven.md +73 -71
- package/assets/pitfalls/styling-bem.md +46 -40
- package/assets/pitfalls/task-flow.md +262 -246
- package/assets/pitfalls/testing.md +99 -92
- package/assets/pitfalls/turn-conduct.md +96 -81
- package/assets/rules/angular-patterns.md +81 -80
- package/assets/rules/api-layer.md +77 -74
- package/assets/rules/autonomous-work.md +75 -74
- package/assets/rules/browser-verification.md +223 -188
- package/assets/rules/component-structure.md +72 -69
- package/assets/rules/dependencies.md +74 -67
- package/assets/rules/deploy-flow.azure.md +118 -108
- package/assets/rules/deploy-flow.github.md +145 -135
- package/assets/rules/deploy-flow.gitlab.md +120 -110
- package/assets/rules/doc-style.md +209 -148
- package/assets/rules/entity-conventions.needs-admin.md +81 -79
- package/assets/rules/entity-models.md +73 -70
- package/assets/rules/git-workflow.azure.md +224 -228
- package/assets/rules/git-workflow.github.md +250 -242
- package/assets/rules/git-workflow.gitlab.md +218 -217
- package/assets/rules/lib-layers.md +85 -86
- package/assets/rules/lists.md +101 -97
- package/assets/rules/navigation.md +78 -78
- package/assets/rules/observability.needs-app.md +165 -153
- package/assets/rules/platform-access.md +76 -75
- package/assets/rules/reuse-first.md +153 -137
- package/assets/rules/shared-code.md +82 -79
- package/assets/rules/spec-driven.md +272 -260
- package/assets/rules/status-report.md +55 -58
- package/assets/rules/styling-bem.md +83 -72
- package/assets/rules/task-flow.md +282 -270
- package/assets/rules/testing.md +224 -188
- package/assets/rules/turn-conduct.md +255 -258
- package/assets/rules/turn-entry.md +92 -87
- package/assets/rules/typescript-conventions.md +94 -88
- package/assets/samples/specs/_template/spec.md +47 -47
- package/assets/samples/tasks/_template/grill.md +20 -20
- package/assets/samples/tasks/_template/plan.md +32 -30
- package/assets/samples/tasks/_template/progress.md +16 -16
- package/assets/skills/agent-kit-extend.md +129 -113
- package/assets/skills/agent-kit.md +236 -222
- package/assets/skills/write-a-skill.md +76 -71
- package/assets/templates/findings.md +19 -19
- package/assets/templates/gate-map.sh +16 -14
- package/assets/templates/implementation.md +28 -27
- package/assets/templates/pattern.md +17 -17
- package/assets/templates/pitfalls.md +6 -6
- package/assets/templates/postmortem.md +24 -23
- package/assets/templates/project.sh +24 -24
- package/assets/templates/proposal.md +62 -60
- package/assets/templates/rule.md +38 -38
- package/assets/workflows/feature.js +46 -46
- package/assets/workflows/plan.js +54 -54
- package/lib/catalog.d.ts +2 -0
- package/lib/catalog.d.ts.map +1 -1
- package/lib/catalog.js +4 -3
- package/lib/catalog.js.map +1 -1
- package/lib/commands.d.ts.map +1 -1
- package/lib/commands.js +68 -4
- package/lib/commands.js.map +1 -1
- package/lib/companion.js +3 -2
- package/lib/companion.js.map +1 -1
- package/lib/enroll.d.ts +7 -1
- package/lib/enroll.d.ts.map +1 -1
- package/lib/enroll.js +13 -4
- package/lib/enroll.js.map +1 -1
- package/lib/observations.d.ts +10 -1
- package/lib/observations.d.ts.map +1 -1
- package/lib/observations.js +1 -0
- package/lib/observations.js.map +1 -1
- package/lib/override-marks.d.ts +24 -0
- package/lib/override-marks.d.ts.map +1 -0
- package/lib/override-marks.js +98 -0
- package/lib/override-marks.js.map +1 -0
- package/lib/plan.d.ts +11 -0
- package/lib/plan.d.ts.map +1 -1
- package/lib/plan.js +10 -1
- package/lib/plan.js.map +1 -1
- package/lib/ship.d.ts +0 -7
- package/lib/ship.d.ts.map +1 -1
- package/lib/ship.js +10 -2
- package/lib/ship.js.map +1 -1
- package/lib/shipment.d.ts.map +1 -1
- package/lib/shipment.js +7 -3
- package/lib/shipment.js.map +1 -1
- package/lib/sync.d.ts.map +1 -1
- package/lib/sync.js +45 -11
- package/lib/sync.js.map +1 -1
- package/package.json +1 -1
- package/rt-tools-agent-kit-0.26.0.tgz +0 -0
- package/rt-tools-agent-kit-0.23.0.tgz +0 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# The patterns of the turn-exit guard. NOT a guard: it has no `rt-hook:` declaration and hooks into
|
|
3
|
+
# no agent event. The turn-exit guard sources it — the same way guards source the shared reading of
|
|
4
|
+
# the input and the deny tail. It was moved out when the guard outgrew the file length limit: the
|
|
5
|
+
# patterns and the reasons beside them read apart from the tiers that apply them.
|
|
6
|
+
#
|
|
7
|
+
# Every pattern is a shell variable; the guard passes them as arguments to the parsing of the turn
|
|
8
|
+
# record.
|
|
9
|
+
|
|
10
|
+
# A command that changes the tree or its state. Reading and searching are deliberately not included
|
|
11
|
+
# here: they are exactly what a stalled turn is filled with.
|
|
12
|
+
#
|
|
13
|
+
# Output redirection is not here, and it was taken out after an analysis: the guard refused two
|
|
14
|
+
# turns out of the seven that stood without work, and counted five as work by that very sign. The
|
|
15
|
+
# body of a future PR was written into the session's temporary directory — outside the working tree
|
|
16
|
+
# — and one of the waits carried only a diversion of the error stream into the null device. Neither
|
|
17
|
+
# of the two changes the tree, and to the pattern they were indistinguishable from writing to a
|
|
18
|
+
# working file: it saw the arrow itself and did not ask where it led. What stays as the sign is an
|
|
19
|
+
# edit of a file by the editing tool and the commands listed here.
|
|
20
|
+
work_re='git (add|commit|push|checkout|merge|rm)|npm run|pnpm (run|exec)|nx (build|test|run)|gh (pr|issue|api|run)|task:(new|move)|mkdir|cp |mv |rm |sed -i|tee '
|
|
21
|
+
|
|
22
|
+
# Exploration. The same words as in the work pattern, but the subcommand is a reading one:
|
|
23
|
+
# switching a branch, pulling, looking through the history, reading PRs and runs. The work pattern
|
|
24
|
+
# calls them work, because it knows only the first word — `git` and `gh` stand in it whole — and a
|
|
25
|
+
# turn in which the executor switched to the main branch, read the history and wrote the owner a
|
|
26
|
+
# report left here with a zero. The analysis is the record
|
|
27
|
+
# "2026-08-25-read-only-turn-counted-as-work" in the intake.
|
|
28
|
+
#
|
|
29
|
+
# Exploration looks like work better than anything else: it has commands, numbers and exact answers.
|
|
30
|
+
# That is what makes it dangerous — a turn stuffed with it reads as full both to the owner and to
|
|
31
|
+
# the session itself.
|
|
32
|
+
read_re='^[[:space:]]*(([^[:space:]]*/)?git[[:space:]]+(show|log|ls-tree|ls-files|ls-remote|diff|status|branch|tag|rev-parse|remote|describe|blame|fetch|pull|(checkout|switch)(?!([[:space:]]+-[A-Za-z-]+)*[[:space:]]+-[bc][[:space:]]))|([^[:space:]]*/)?gh[[:space:]]+(pr|issue|run|repo)[[:space:]]+(list|view|status|checks|diff|download|logs))([[:space:]]|$)'
|
|
33
|
+
|
|
34
|
+
# The parts of a compound command are judged one by one: a turn gathers reading and work into one
|
|
35
|
+
# line through `&&`, and judging it whole would release exploration on the very first changing part.
|
|
36
|
+
part_re='&&|\|\||;|\n'
|
|
37
|
+
|
|
38
|
+
# Waiting for someone else's step. A run, the owner's review and a merge go on without the executor
|
|
39
|
+
# and do not get faster from being looked at — the rule says outright that this is never a work
|
|
40
|
+
# state. Only the LAST action of the turn is judged: waiting in the middle is lawful, and starting
|
|
41
|
+
# work in the background stays work. The analysis is the record "2026-08-25-turn-ended-on-waiting"
|
|
42
|
+
# in the intake.
|
|
43
|
+
#
|
|
44
|
+
# The former sign asked one thing: was there work during the turn. A turn where a conflict was
|
|
45
|
+
# resolved, a commit and a push were made, and the last action became a loop until the run was ready
|
|
46
|
+
# passed it whole — there was work, and plenty. It is exactly that fullness that deceives: the
|
|
47
|
+
# emptiness behind such a turn is not visible.
|
|
48
|
+
wait_re='gh[[:space:]]+(run[[:space:]]+watch|pr[[:space:]]+checks[^|]*--watch)|until[[:space:]].*sleep|while[[:space:]].*sleep|^[[:space:]]*sleep[[:space:]]'
|
|
49
|
+
|
|
50
|
+
# Handing work over and starting the next. The rule calls handed-over work a lawful end of a turn —
|
|
51
|
+
# but on a condition: the next one is started, and an ACTION has been done on it, not spoken.
|
|
52
|
+
handover_re='gh[[:space:]]+pr[[:space:]]+create'
|
|
53
|
+
started_re='task:new|task:move|board\.mjs[[:space:]]+move|git[[:space:]]+checkout([[:space:]]+-[A-Za-z-]+)*[[:space:]]+-b|git[[:space:]]+switch([[:space:]]+-[A-Za-z-]+)*[[:space:]]+-c'
|
package/assets/hooks/utf8.sh
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
#
|
|
2
|
+
# The locale a guard runs in. Sourced as the first line of the body: `. "<guards directory>/utf8.sh"`.
|
|
3
3
|
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
# «В дереве этого нет»
|
|
7
|
-
#
|
|
8
|
-
#
|
|
4
|
+
# Guard patterns are written in the words of the language the tree speaks, and matching against
|
|
5
|
+
# them depends on the process locale. In the C locale case folding works only for Latin letters:
|
|
6
|
+
# «В дереве этого нет» is not found under the pattern `(в дереве|здесь)…` at all, the guard exits
|
|
7
|
+
# with zero and lets through the turn it was bound to return. The `{0,30}` count there counts bytes,
|
|
8
|
+
# not letters, and a non-Latin letter weighs two.
|
|
9
9
|
#
|
|
10
|
-
#
|
|
11
|
-
#
|
|
12
|
-
#
|
|
10
|
+
# There is nothing to notice this with on one's own machine: the developer's terminal runs in UTF-8,
|
|
11
|
+
# while the service that runs the same work inherits an empty locale. Three scenarios failed in the
|
|
12
|
+
# pipeline exactly so, passing on the machine where they were written.
|
|
13
13
|
#
|
|
14
|
-
# FAIL-OPEN:
|
|
15
|
-
#
|
|
14
|
+
# FAIL-OPEN: no UTF-8 locale found in the system — nothing is declared, and the guard works as
|
|
15
|
+
# before. Taking its work away over a missing locale is worse than keeping the old behaviour.
|
|
16
16
|
|
|
17
17
|
rt_use_utf8_locale() {
|
|
18
18
|
case "${LC_ALL:-${LC_CTYPE:-${LANG:-}}}" in
|
|
@@ -1,37 +1,38 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
# rt-hook: Stop
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
3
|
+
# Requires: hooks/deny-tail.sh
|
|
4
|
+
# Waiting guard: a turn that tells the owner about someone else's step does not end until it holds
|
|
5
|
+
# at least one action on the next task. Stop.
|
|
6
6
|
#
|
|
7
|
-
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
11
|
-
#
|
|
7
|
+
# Why this way. The article "waiting for a run is not what work is spent on" is held by the
|
|
8
|
+
# executor's memory, and held badly: the sample message to the owner ends with a phrase about the
|
|
9
|
+
# next task, and the phrase is carried out as a promise — the session says it and ends the turn. A
|
|
10
|
+
# turn in which nothing was done gives itself away by nothing: no file edit, no command — and the
|
|
11
|
+
# miss is seen only by the owner, only by the work not moving, and only when they ask directly.
|
|
12
12
|
#
|
|
13
|
-
#
|
|
14
|
-
# PR:
|
|
15
|
-
#
|
|
16
|
-
#
|
|
17
|
-
#
|
|
13
|
+
# Someone else's step is known by two signs, and both are taken from the turn, not from the
|
|
14
|
+
# network. The first is a PR opened: the work is handed in, and from there the owner moves it. The
|
|
15
|
+
# second is a red run read: it has to be fixed, but a turn that read it and did nothing is the same
|
|
16
|
+
# emptiness. Reading the run is not a sign by itself: the end of a run is also read to go and fix
|
|
17
|
+
# it; the sign is a red answer, and it lies in the command output — in the same turn record.
|
|
18
18
|
#
|
|
19
|
-
#
|
|
20
|
-
#
|
|
19
|
+
# Asking the hosting would be more precise, but a network call at the end of a turn fails together
|
|
20
|
+
# with the connection and would refuse the work instead of the miss.
|
|
21
21
|
#
|
|
22
|
-
#
|
|
23
|
-
#
|
|
24
|
-
#
|
|
25
|
-
#
|
|
22
|
+
# What counts as an action: creating a task, creating a branch, moving the task to the work column,
|
|
23
|
+
# creating the task folder. Moving to the review column and removing the folder are not in it —
|
|
24
|
+
# those are steps of closing the previous work, not the start of the next. The set is open and
|
|
25
|
+
# grows by edits — its completeness is an open question, not a promise.
|
|
26
26
|
#
|
|
27
|
-
#
|
|
28
|
-
#
|
|
29
|
-
#
|
|
27
|
+
# What the guard does not judge. A turn that says nothing about someone else's step — here it stays
|
|
28
|
+
# silent: an empty turn cannot be told from a turn that had nothing to do. This is its known
|
|
29
|
+
# boundary. A green run it does not judge either: after it comes work of one's own — cleanup and
|
|
30
|
+
# lifting the draft — not someone else's step.
|
|
30
31
|
#
|
|
31
|
-
#
|
|
32
|
-
#
|
|
32
|
+
# FAIL-OPEN: on any error, missing `jq`, missing turn record or a repeated call on the same turn
|
|
33
|
+
# the turn is ALLOWED (exit 0). A broken guard has no right to jam the conversation.
|
|
33
34
|
|
|
34
|
-
#
|
|
35
|
+
# Its own name in observations: the refusal is written by the shared deny tail, not by the guard.
|
|
35
36
|
RT_GUARD_NAME=waiting-turn-guard
|
|
36
37
|
|
|
37
38
|
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utf8.sh" 2>/dev/null || true
|
|
@@ -43,7 +44,7 @@ input="$RT_HOOK_INPUT"
|
|
|
43
44
|
|
|
44
45
|
command -v jq >/dev/null 2>&1 || exit 0
|
|
45
46
|
|
|
46
|
-
#
|
|
47
|
+
# A repeated call on the same turn is not judged: the guard said its word once and lets go.
|
|
47
48
|
active="$(printf '%s' "$input" | jq -r '.stop_hook_active // false' 2>/dev/null)"
|
|
48
49
|
[ "$active" = "true" ] && exit 0
|
|
49
50
|
|
|
@@ -51,52 +52,51 @@ transcript="$(printf '%s' "$input" | jq -r '.transcript_path // empty' 2>/dev/nu
|
|
|
51
52
|
[ -z "$transcript" ] && exit 0
|
|
52
53
|
[ -f "$transcript" ] || exit 0
|
|
53
54
|
|
|
54
|
-
#
|
|
55
|
-
#
|
|
56
|
-
# ничего.
|
|
55
|
+
# Opening a PR differs per hosting, and the guard moves between them whole: the set names all
|
|
56
|
+
# three forms, not the one this tree uses. Editing the PR body is not in it — it opens nothing.
|
|
57
57
|
opened_re='gh[^|;&]*pr[[:space:]]+create|api[^|;&]*-X[[:space:]]+POST[^|;&]*/pulls|glab[^|;&]*mr[[:space:]]+create|az[[:space:]]+repos[[:space:]]+pr[[:space:]]+create'
|
|
58
58
|
|
|
59
|
-
#
|
|
60
|
-
#
|
|
61
|
-
#
|
|
59
|
+
# Reading a run is the second case of someone else's step. By itself it means nothing: the end of
|
|
60
|
+
# a run is also read to go and fix it. The sign is a red answer, and it lies not in the command
|
|
61
|
+
# but in its output — in the same turn record, and no network is needed for that.
|
|
62
62
|
read_re='run[[:space:]]+(list|view|watch)|pipelines[[:space:]]+runs'
|
|
63
63
|
red_re='completed[[:space:]]+failure|"conclusion"[[:space:]]*:[[:space:]]*"failure"|conclusion:[[:space:]]*failure|completed with .failure.|run[[:space:]]+failed'
|
|
64
64
|
|
|
65
|
-
#
|
|
66
|
-
#
|
|
67
|
-
#
|
|
65
|
+
# The first action on the next task. Listed is what taking a task CAN BE, not what counts as an
|
|
66
|
+
# action: the list of work-closing steps is open and grows, while the list of actions on the next
|
|
67
|
+
# task is closed — a list of "what it can be" has no hole for a closing step.
|
|
68
68
|
#
|
|
69
|
-
#
|
|
70
|
-
#
|
|
71
|
-
#
|
|
72
|
-
#
|
|
69
|
+
# Moving the closed task to the review column and removing its folder are left out on purpose:
|
|
70
|
+
# both are mandatory steps of closing work, and both stand in the same turn that opened the PR.
|
|
71
|
+
# While the sign listed them alongside taking a task, it always matched, and the guard let through
|
|
72
|
+
# the very turn it was made for — work stopped three times in one session that way.
|
|
73
73
|
#
|
|
74
|
-
#
|
|
75
|
-
#
|
|
76
|
-
taken_re='task:new|checkout[[:space:]]+-b|task:move[^|;&]*in-progress|(cp|mkdir)[^|;&]*/tasks/'
|
|
74
|
+
# A code edit in the branch of the same PR does not count as an action on the next task — it fixes
|
|
75
|
+
# the previous one and does not move the work on.
|
|
76
|
+
taken_re='task:new|checkout([[:space:]]+-[A-Za-z-]+)*[[:space:]]+-b|task:move[^|;&]*in-progress|(cp|mkdir)[^|;&]*/tasks/'
|
|
77
77
|
|
|
78
|
-
#
|
|
79
|
-
#
|
|
80
|
-
#
|
|
78
|
+
# The task folder is also created without the shell: the file-editing tool writes its first file,
|
|
79
|
+
# and no command line stands behind that. So next to the commands the edit path is judged — with a
|
|
80
|
+
# pattern of its own, since no command name is in it.
|
|
81
81
|
taken_path_re='/tasks/'
|
|
82
82
|
|
|
83
|
-
#
|
|
84
|
-
#
|
|
85
|
-
#
|
|
86
|
-
#
|
|
83
|
+
# How the turn shows it carried the handed-in work to the end rather than leaving it a draft.
|
|
84
|
+
# Lifting the draft is the obvious case; reading the run is the one where there is nothing to lift
|
|
85
|
+
# yet, but the executor looked instead of saying "waiting". Two ready PRs stood as drafts precisely
|
|
86
|
+
# because the next task was taken instead of this, not on top of it.
|
|
87
87
|
ready_re='pr[[:space:]]+ready|run[[:space:]]+(list|view|watch)|pr[[:space:]]+checks|check-runs|check:board|board\.mjs'
|
|
88
88
|
|
|
89
|
-
#
|
|
90
|
-
#
|
|
91
|
-
#
|
|
92
|
-
#
|
|
93
|
-
#
|
|
89
|
+
# One's own named action. An empty turn that declared what it will do next gives itself away by
|
|
90
|
+
# nothing: it opened no PR, read no run, and both earlier signs are silent. It is caught by form —
|
|
91
|
+
# a set of future-tense patterns about one's own step — not by understanding the meaning; and no
|
|
92
|
+
# call may stand behind the words, otherwise the declaration was said along the work, not instead
|
|
93
|
+
# of it.
|
|
94
94
|
vow_re='дальше беру|дальше возьму|дальше иду|следующим шагом|следующий шаг:|затем сделаю|затем возьму|потом сделаю|после этого сделаю|далее беру'
|
|
95
95
|
|
|
96
|
-
#
|
|
97
|
-
#
|
|
96
|
+
# The turn is everything recorded after the owner's last real input. A tool result arrives under
|
|
97
|
+
# the same role, so lines with `tool_result` do not count as input.
|
|
98
98
|
#
|
|
99
|
-
#
|
|
99
|
+
# A 400-line tail: the turn record grows all session, and only the last turn is judged.
|
|
100
100
|
verdict="$(tail -n 400 "$transcript" 2>/dev/null | jq -s -r \
|
|
101
101
|
--arg opened "$opened_re" --arg taken "$taken_re" --arg taken_path "$taken_path_re" \
|
|
102
102
|
--arg read "$read_re" --arg red "$red_re" --arg ready "$ready_re" --arg vow "$vow_re" '
|
|
@@ -111,13 +111,13 @@ verdict="$(tail -n 400 "$transcript" 2>/dev/null | jq -s -r \
|
|
|
111
111
|
| (if $i == null then [] else .[$i:] end) as $turn
|
|
112
112
|
| [$turn[] | select(.type == "assistant") | (.message.content // [])[] | select(.type == "tool_use")] as $uses
|
|
113
113
|
| ($uses | map((.input.command // "")) | join("\n")) as $ran
|
|
114
|
-
#
|
|
115
|
-
#
|
|
114
|
+
# The edit path is the second way to create a task folder. Only the writing tools are judged:
|
|
115
|
+
# reading has the same path and is not work.
|
|
116
116
|
| ($uses | map(select(.name == "Write" or .name == "Edit" or .name == "MultiEdit")
|
|
117
117
|
| (.input.file_path // "")) | join("\n")) as $wrote
|
|
118
|
-
#
|
|
119
|
-
#
|
|
120
|
-
#
|
|
118
|
+
# The tool result is taken as text, not as the JSON record: there a tab and a quote leave
|
|
119
|
+
# escaped, and the pattern misses them entirely. It arrives both as a string and as a list of
|
|
120
|
+
# blocks — both forms are brought to one text.
|
|
121
121
|
| ([$turn[] | select(.type == "user") | .message.content // [] | select(type == "array") | .[]
|
|
122
122
|
| select(.type == "tool_result") | .content
|
|
123
123
|
| if type == "string" then .
|
|
@@ -140,18 +140,18 @@ verdict="$(tail -n 400 "$transcript" 2>/dev/null | jq -s -r \
|
|
|
140
140
|
else "pass" end
|
|
141
141
|
' 2>/dev/null)"
|
|
142
142
|
|
|
143
|
-
#
|
|
144
|
-
#
|
|
145
|
-
#
|
|
143
|
+
# Neither of the two actions: the refusal names both at once. Before, it named only the first and
|
|
144
|
+
# was lifted by the first too — the executor took the next task, the open-PR sign left with the
|
|
145
|
+
# turn, and the second demand evaporated without ever sounding.
|
|
146
146
|
if [ "$verdict" = "owe:both" ]; then
|
|
147
|
-
reason="BLOCKED by waiting-turn-guard:
|
|
147
|
+
reason="BLOCKED by waiting-turn-guard: a PR was opened in this turn, and neither of the two actions was done about the handed-over work — its state was not asked, and the next task was not taken.
|
|
148
148
|
|
|
149
|
-
|
|
149
|
+
There are exactly two actions, and one of them does not lift the refusal: what was handed over is brought to a lifted draft by the one who handed it over, and the next task is taken on top of that, not instead. A taken next task carries the sign of the open request away with it — the second requirement will never sound after it.
|
|
150
150
|
|
|
151
151
|
gh run list # состояние отданного
|
|
152
152
|
npm run task:new -- <заголовок> # следующая работа
|
|
153
153
|
|
|
154
|
-
|
|
154
|
+
The guard judges one turn: the next session is not refused."
|
|
155
155
|
|
|
156
156
|
# shellcheck disable=SC1090
|
|
157
157
|
[ -f "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/deny-tail.sh" ] \
|
|
@@ -163,18 +163,18 @@ if [ "$verdict" = "owe:both" ]; then
|
|
|
163
163
|
${deny_tail_text}"
|
|
164
164
|
|
|
165
165
|
jq -n --arg r "$reason" '{decision:"block",reason:$r}' 2>/dev/null \
|
|
166
|
-
|| printf '{"decision":"block","reason":"waiting-turn-guard:
|
|
166
|
+
|| printf '{"decision":"block","reason":"waiting-turn-guard: neither of the two actions was done about the handed-over work."}\n'
|
|
167
167
|
exit 0
|
|
168
168
|
fi
|
|
169
169
|
|
|
170
|
-
#
|
|
171
|
-
#
|
|
170
|
+
# A turn that declared its next action and did nothing on it. The refusal names the declaration
|
|
171
|
+
# itself: an executor told "the turn is empty" will rewrite the words rather than take the step.
|
|
172
172
|
if [ "$verdict" = "owe:vow" ]; then
|
|
173
|
-
reason="BLOCKED by waiting-turn-guard:
|
|
173
|
+
reason="BLOCKED by waiting-turn-guard: not a single edit was made in the turn and not a single command was called, while the next action is named in words — «дальше беру», «следующим шагом», «затем сделаю».
|
|
174
174
|
|
|
175
|
-
|
|
175
|
+
An announcement of your own step is never work: it is more precise than any promise, and the emptiness behind it is visible to nobody. Do what is named in this same turn — or tell the owner what stops the work, and name exactly what.
|
|
176
176
|
|
|
177
|
-
|
|
177
|
+
The guard judges one turn: the next session is not refused."
|
|
178
178
|
|
|
179
179
|
# shellcheck disable=SC1090
|
|
180
180
|
[ -f "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/deny-tail.sh" ] \
|
|
@@ -186,22 +186,22 @@ if [ "$verdict" = "owe:vow" ]; then
|
|
|
186
186
|
${deny_tail_text}"
|
|
187
187
|
|
|
188
188
|
jq -n --arg r "$reason" '{decision:"block",reason:$r}' 2>/dev/null \
|
|
189
|
-
|| printf '{"decision":"block","reason":"waiting-turn-guard:
|
|
189
|
+
|| printf '{"decision":"block","reason":"waiting-turn-guard: the next action is named in words, and nothing was done in the turn."}\n'
|
|
190
190
|
exit 0
|
|
191
191
|
fi
|
|
192
192
|
|
|
193
|
-
#
|
|
194
|
-
#
|
|
193
|
+
# A draft left while the next task is taken is a separate refusal: there the demand is not about
|
|
194
|
+
# the next task but about carrying the handed-in one to the end.
|
|
195
195
|
if [ "$verdict" = "owe:draft" ]; then
|
|
196
|
-
reason="BLOCKED by waiting-turn-guard:
|
|
196
|
+
reason="BLOCKED by waiting-turn-guard: a PR was opened in this turn, the next task is taken, and the state of the handed-over work was asked by no command.
|
|
197
197
|
|
|
198
|
-
|
|
198
|
+
A draft is read by the owner as «the work is not finished»: its merge button is locked by the hosting itself, and in the list of requests the ready cannot be told from the unfinished — grey in both. Bringing what was handed over to a lifted draft is owed by the one who handed it over.
|
|
199
199
|
|
|
200
|
-
|
|
200
|
+
Ask the run on the tip in this same turn — `gh run list`, `gh pr checks` or the audit of the work queue — and lift the draft when it is green and the branch merges. The run is still going — then say so to the owner, naming its output.
|
|
201
201
|
|
|
202
|
-
|
|
202
|
+
The next task is taken on top of that, not instead: both ready requests stood as drafts on exactly this substitution.
|
|
203
203
|
|
|
204
|
-
|
|
204
|
+
The guard judges one turn: the next session is not refused."
|
|
205
205
|
|
|
206
206
|
# shellcheck disable=SC1090
|
|
207
207
|
[ -f "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/deny-tail.sh" ] \
|
|
@@ -213,31 +213,31 @@ if [ "$verdict" = "owe:draft" ]; then
|
|
|
213
213
|
${deny_tail_text}"
|
|
214
214
|
|
|
215
215
|
jq -n --arg r "$reason" '{decision:"block",reason:$r}' 2>/dev/null \
|
|
216
|
-
|| printf '{"decision":"block","reason":"waiting-turn-guard:
|
|
216
|
+
|| printf '{"decision":"block","reason":"waiting-turn-guard: the handed-over work stayed a draft — ask the run and lift the draft."}\n'
|
|
217
217
|
exit 0
|
|
218
218
|
fi
|
|
219
219
|
|
|
220
220
|
case "$verdict" in
|
|
221
|
-
owe:pr) said="
|
|
222
|
-
owe:run) said="
|
|
221
|
+
owe:pr) said="a PR was opened in this turn" ;;
|
|
222
|
+
owe:run) said="a red run was read in this turn" ;;
|
|
223
223
|
*) exit 0 ;;
|
|
224
224
|
esac
|
|
225
225
|
|
|
226
|
-
reason="BLOCKED by waiting-turn-guard: ${said},
|
|
226
|
+
reason="BLOCKED by waiting-turn-guard: ${said}, and there is not a single action about the next task in it. Waiting for someone else's step is not what a session is spent on: the run, the review and the merge go on elsewhere and do not get faster from being watched.
|
|
227
227
|
|
|
228
|
-
|
|
228
|
+
Saying «беру следующую задачу» is not the same as taking it: the phrase lives to the end of the turn while the work does not move, and only the owner can notice that.
|
|
229
229
|
|
|
230
|
-
|
|
230
|
+
The first action about the next task is done in this same turn — creating the task, the branch or the folder:
|
|
231
231
|
|
|
232
232
|
npm run task:new -- --title '<Что не так>' --slug <slug>
|
|
233
|
-
git checkout -b
|
|
233
|
+
git checkout -b <KEY>-<number>-<slug>
|
|
234
234
|
|
|
235
|
-
|
|
235
|
+
The end of a run is learned from the return of a background command, not from a look at the page.
|
|
236
236
|
|
|
237
|
-
|
|
237
|
+
The guard judges one turn: the next session is not refused."
|
|
238
238
|
|
|
239
|
-
#
|
|
240
|
-
#
|
|
239
|
+
# The shared deny tail: two lawful moves. The file may not be laid out — then there is no tail,
|
|
240
|
+
# and the reason for the refusal stays as it was.
|
|
241
241
|
# shellcheck disable=SC1090
|
|
242
242
|
[ -f "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/deny-tail.sh" ] \
|
|
243
243
|
&& . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/deny-tail.sh" 2>/dev/null
|
|
@@ -248,6 +248,6 @@ deny_tail_text="$(rt_deny_tail "")"
|
|
|
248
248
|
${deny_tail_text}"
|
|
249
249
|
|
|
250
250
|
jq -n --arg r "$reason" '{decision:"block",reason:$r}' 2>/dev/null \
|
|
251
|
-
|| printf '{"decision":"block","reason":"waiting-turn-guard: PR
|
|
251
|
+
|| printf '{"decision":"block","reason":"waiting-turn-guard: a PR is open — the next task is taken in the same turn."}\n'
|
|
252
252
|
|
|
253
253
|
exit 0
|