@rt-tools/agent-kit 0.37.0 → 0.38.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 +5 -5
- package/assets/checks/action-of.mjs +154 -0
- package/assets/checks/board-pull-state.github.mjs +82 -13
- package/assets/checks/board-runs.github.mjs +40 -5
- package/assets/checks/board.github.mjs +1 -1
- package/assets/checks/check-board.github.mjs +58 -19
- package/assets/checks/check-specs.mjs +2 -2
- package/assets/checks/check-state-next.mjs +22 -10
- package/assets/checks/check-turn-map.mjs +26 -6
- package/assets/checks/check-work-steps.mjs +4 -173
- package/assets/checks/decide.mjs +285 -0
- package/assets/checks/decision-table.json +21365 -0
- package/assets/checks/decision-table.mjs +495 -0
- package/assets/checks/epic-table.github.mjs +4 -3
- package/assets/checks/epic-window.mjs +98 -0
- package/assets/checks/flow-condition.mjs +64 -0
- package/assets/checks/flow-data.mjs +136 -0
- package/assets/checks/flow-forecast.mjs +330 -0
- package/assets/checks/flow-guard-run.mjs +90 -0
- package/assets/checks/flow-guard.mjs +294 -0
- package/assets/checks/flow-model.mjs +271 -0
- package/assets/checks/flow-override.mjs +130 -0
- package/assets/checks/flow-plan.mjs +206 -0
- package/assets/checks/flow-scaffold.mjs +224 -0
- package/assets/checks/flow-step.mjs +365 -0
- package/assets/checks/flow-sync.mjs +296 -0
- package/assets/checks/flow-syntax.mjs +292 -0
- package/assets/checks/flow-verdict.mjs +112 -0
- 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/merge-read.mjs +239 -0
- package/assets/checks/owner-nudges.mjs +389 -0
- package/assets/checks/push-inputs.mjs +444 -0
- package/assets/checks/push-trace.mjs +108 -0
- package/assets/checks/record-count.mjs +410 -0
- package/assets/checks/record-recount.mjs +187 -0
- package/assets/checks/record-turn.mjs +155 -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/checks/task-flow-script.mjs +292 -0
- package/assets/checks/tree-assignment.mjs +26 -7
- package/assets/checks/work-result.mjs +281 -0
- package/assets/checks/work-steps-lib.mjs +205 -0
- package/assets/commands/next-session.md +3 -1
- package/assets/commands/night.md +28 -18
- package/assets/defaults/gate-map.sh +39 -12
- package/assets/defaults/merges.sh +48 -0
- package/assets/defaults/project.sh +43 -13
- package/assets/defaults/push.sh +23 -0
- package/assets/defaults/turn-map.md +24 -21
- package/assets/docs/GLOSSARY.md +6 -2
- package/assets/hooks/ask-judge.md +65 -0
- package/assets/hooks/browser-guard-device-id.sh +11 -9
- package/assets/hooks/browser-guard-no-asking.sh +12 -6
- package/assets/hooks/browser-guard-no-listing.sh +13 -7
- package/assets/hooks/browser-guard-no-other-drivers.sh +25 -17
- package/assets/hooks/browser-guard-require-select.sh +15 -15
- package/assets/hooks/commit-msg.sh +13 -3
- package/assets/hooks/conscience-guard.sh +9 -25
- package/assets/hooks/decide.sh +141 -0
- package/assets/hooks/deny-tail.sh +16 -11
- package/assets/hooks/dev-server-guard.sh +27 -20
- package/assets/hooks/dispatch.sh +47 -4
- package/assets/hooks/docs-guard.sh +31 -200
- package/assets/hooks/end-conversation-guard.sh +12 -21
- package/assets/hooks/epic-stop-guard.sh +54 -105
- package/assets/hooks/exam-guard.sh +32 -65
- package/assets/hooks/facts-docs.sh +221 -0
- package/assets/hooks/facts-flow.sh +173 -0
- package/assets/hooks/facts.sh +308 -0
- package/assets/hooks/flow-step-guard.sh +93 -0
- package/assets/hooks/git-guard-delivery-body.sh +4 -4
- package/assets/hooks/git-guard-delivery-conflict.sh +16 -10
- package/assets/hooks/git-guard-delivery-draft.sh +3 -3
- package/assets/hooks/git-guard-delivery-epic.sh +18 -9
- package/assets/hooks/git-guard-delivery-folder.sh +32 -7
- package/assets/hooks/git-guard-delivery-merge.sh +2 -2
- package/assets/hooks/git-guard-delivery-merged.sh +12 -1
- package/assets/hooks/git-guard-delivery-pipeline.sh +1 -1
- package/assets/hooks/git-guard-delivery-rerun.sh +32 -0
- package/assets/hooks/git-guard-delivery-signature.sh +82 -45
- package/assets/hooks/git-guard-delivery-task.sh +47 -0
- package/assets/hooks/git-guard-delivery.sh +112 -101
- package/assets/hooks/git-guard-discard.sh +8 -18
- package/assets/hooks/git-guard-main.sh +13 -19
- package/assets/hooks/git-guard-no-verify.sh +56 -16
- package/assets/hooks/git-guard-push-ahead.sh +46 -5
- package/assets/hooks/git-guard-push-marks.sh +227 -31
- package/assets/hooks/git-guard-push-tests.sh +51 -53
- package/assets/hooks/git-guard-tree-assignment.sh +7 -4
- package/assets/hooks/guard-note.sh +8 -6
- package/assets/hooks/handoff-entry-guard.sh +20 -39
- package/assets/hooks/handoff-write.sh +3 -1
- package/assets/hooks/hook-input.sh +0 -41
- package/assets/hooks/metric-marks.sh +19 -7
- package/assets/hooks/observe.sh +1 -1
- package/assets/hooks/override-write-guard.sh +27 -9
- package/assets/hooks/pre-push.sh +20 -10
- package/assets/hooks/prose-style-guard.sh +6 -19
- package/assets/hooks/pull-merges.sh +76 -0
- package/assets/hooks/push-set.sh +39 -7
- package/assets/hooks/qa-dataid-guard.sh +7 -17
- package/assets/hooks/record-turn.sh +52 -0
- package/assets/hooks/rerun-guard.sh +11 -16
- package/assets/hooks/reuse-first-guard.sh +7 -21
- package/assets/hooks/role-calls.sh +25 -3
- package/assets/hooks/rule-source-guard.sh +54 -21
- package/assets/hooks/skill-gate-rearm.sh +18 -5
- package/assets/hooks/skill-gate.sh +156 -20
- package/assets/hooks/skill-loaded.sh +18 -3
- package/assets/hooks/sql-guard-target.sh +2 -2
- package/assets/hooks/sql-guard-write.sh +12 -12
- package/assets/hooks/sql-guard.sh +58 -16
- package/assets/hooks/task-context-load.sh +3 -1
- package/assets/hooks/task-flow-context.sh +20 -22
- package/assets/hooks/task-flow-draft-guard.sh +25 -74
- package/assets/hooks/task-flow-guard.sh +28 -129
- package/assets/hooks/tree-assignment-guard.sh +25 -14
- package/assets/hooks/turn-entry-load.sh +3 -1
- package/assets/hooks/turn-exit-guard.sh +92 -452
- package/assets/hooks/turn-exit-role.sh +47 -0
- package/assets/hooks/turn-judge.md +103 -0
- package/assets/hooks/window-fill-guard.sh +22 -41
- 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.azure.md +9 -155
- package/assets/patterns/git-workflow-commit.github.md +11 -269
- package/assets/patterns/git-workflow-commit.gitlab.md +9 -161
- package/assets/patterns/git-workflow-docker.md +8 -231
- package/assets/patterns/git-workflow-freshness.md +9 -56
- package/assets/patterns/git-workflow-merge.md +7 -174
- package/assets/patterns/git-workflow-migration.md +5 -73
- package/assets/patterns/git-workflow-pr-body.github.md +6 -159
- package/assets/patterns/git-workflow-pr-ready.md +9 -69
- package/assets/patterns/git-workflow-pr.azure.md +14 -220
- package/assets/patterns/git-workflow-pr.github.md +13 -253
- package/assets/patterns/git-workflow-pr.gitlab.md +14 -241
- package/assets/patterns/git-workflow-restart.md +5 -41
- package/assets/patterns/git-workflow-secrets.md +10 -76
- package/assets/patterns/git-workflow-stack.md +9 -205
- 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 +2 -2
- package/assets/patterns/task-flow-archive.md +15 -256
- package/assets/patterns/task-flow-close.md +16 -291
- package/assets/patterns/task-flow-cycle.md +13 -39
- package/assets/patterns/task-flow-graph.needs-graph.md +8 -58
- package/assets/patterns/task-flow-handoff.md +13 -161
- package/assets/patterns/task-flow-resume.md +19 -183
- package/assets/patterns/task-flow-start.md +9 -248
- package/assets/patterns/testing-e2e.md +14 -18
- package/assets/patterns/testing-unit.md +9 -13
- package/assets/patterns/turn-entry-map.md +15 -5
- package/assets/pitfalls/agent-kit-extend.md +200 -0
- package/assets/pitfalls/agent-kit.2.md +323 -0
- package/assets/pitfalls/angular-patterns.md +98 -0
- package/assets/pitfalls/autonomous-work.md +15 -0
- package/assets/pitfalls/browser-verification.md +265 -0
- package/assets/pitfalls/component-structure.md +98 -0
- package/assets/pitfalls/dependencies.md +92 -0
- package/assets/pitfalls/deploy-flow.azure.md +171 -0
- package/assets/pitfalls/deploy-flow.github.md +211 -0
- package/assets/pitfalls/deploy-flow.gitlab.md +173 -0
- package/assets/pitfalls/doc-style.2.md +286 -0
- package/assets/pitfalls/doc-style.md +3 -3
- package/assets/pitfalls/entity-conventions.needs-admin.md +96 -0
- package/assets/pitfalls/entity-models.md +89 -0
- package/assets/pitfalls/git-workflow-commit.azure.md +190 -0
- package/assets/pitfalls/git-workflow-commit.github.md +307 -0
- package/assets/pitfalls/git-workflow-commit.gitlab.md +196 -0
- package/assets/pitfalls/git-workflow-docker.md +275 -0
- package/assets/pitfalls/git-workflow-freshness.md +88 -0
- package/assets/pitfalls/git-workflow-hosting.azure.md +31 -0
- package/assets/pitfalls/git-workflow-hosting.github.md +32 -0
- package/assets/pitfalls/git-workflow-hosting.gitlab.md +31 -0
- package/assets/pitfalls/git-workflow-merge.md +220 -0
- package/assets/pitfalls/git-workflow-migration.md +103 -0
- package/assets/pitfalls/git-workflow-pr-body.github.md +185 -0
- package/assets/pitfalls/git-workflow-pr-ready.md +104 -0
- package/assets/pitfalls/git-workflow-pr.2.azure.md +172 -0
- package/assets/pitfalls/git-workflow-pr.2.github.md +184 -0
- package/assets/pitfalls/git-workflow-pr.2.gitlab.md +180 -0
- package/assets/pitfalls/git-workflow-pr.azure.md +159 -0
- package/assets/pitfalls/git-workflow-pr.github.md +107 -0
- package/assets/pitfalls/git-workflow-pr.gitlab.md +151 -0
- package/assets/pitfalls/git-workflow-push.azure.md +30 -0
- package/assets/pitfalls/git-workflow-push.github.md +30 -0
- package/assets/pitfalls/git-workflow-push.gitlab.md +30 -0
- package/assets/pitfalls/git-workflow-queue.azure.md +30 -0
- package/assets/pitfalls/git-workflow-queue.github.md +30 -0
- package/assets/pitfalls/git-workflow-queue.gitlab.md +30 -0
- package/assets/pitfalls/git-workflow-restart.md +72 -0
- package/assets/pitfalls/git-workflow-secrets.md +114 -0
- package/assets/pitfalls/git-workflow-stack.md +254 -0
- package/assets/pitfalls/git-workflow.2.azure.md +291 -0
- package/assets/pitfalls/git-workflow.2.github.md +294 -0
- package/assets/pitfalls/git-workflow.2.gitlab.md +278 -0
- package/assets/pitfalls/git-workflow.github.md +5 -9
- package/assets/pitfalls/lib-layers.md +114 -0
- package/assets/pitfalls/lists.md +117 -0
- package/assets/pitfalls/navigation.md +94 -0
- package/assets/pitfalls/reuse-first.md +201 -0
- package/assets/pitfalls/spec-driven.2.md +318 -0
- package/assets/pitfalls/spec-driven.md +9 -7
- package/assets/pitfalls/styling-bem.2.md +125 -0
- package/assets/pitfalls/task-flow-archive.md +264 -0
- package/assets/pitfalls/task-flow-close.2.md +165 -0
- package/assets/pitfalls/task-flow-close.md +167 -0
- package/assets/pitfalls/task-flow-cycle.md +73 -0
- package/assets/pitfalls/task-flow-graph.needs-graph.md +98 -0
- package/assets/pitfalls/task-flow-handoff.md +200 -0
- package/assets/pitfalls/task-flow-handover.md +30 -0
- package/assets/pitfalls/task-flow-owner.md +29 -0
- package/assets/pitfalls/task-flow-plan.md +29 -0
- package/assets/pitfalls/task-flow-resume.md +257 -0
- package/assets/pitfalls/task-flow-start.md +287 -0
- package/assets/pitfalls/task-flow.2.md +303 -0
- package/assets/pitfalls/task-flow.md +18 -29
- package/assets/pitfalls/testing.2.md +279 -0
- package/assets/pitfalls/testing.md +11 -12
- package/assets/pitfalls/turn-conduct.md +17 -18
- package/assets/pitfalls/typescript-conventions.md +161 -0
- package/assets/pitfalls/write-a-skill.md +128 -0
- package/assets/rules/angular-patterns.md +21 -86
- package/assets/rules/autonomous-work.md +37 -29
- package/assets/rules/browser-verification.md +28 -251
- package/assets/rules/component-structure.md +25 -87
- package/assets/rules/dependencies.md +20 -78
- package/assets/rules/deploy-flow.azure.md +27 -134
- package/assets/rules/deploy-flow.github.md +34 -196
- package/assets/rules/deploy-flow.gitlab.md +28 -137
- package/assets/rules/doc-style.md +32 -282
- package/assets/rules/entity-conventions.needs-admin.md +26 -82
- package/assets/rules/entity-models.md +14 -63
- package/assets/rules/epic-flow.md +5 -3
- package/assets/rules/git-workflow-hosting.azure.md +26 -0
- package/assets/rules/git-workflow-hosting.github.md +38 -0
- package/assets/rules/git-workflow-hosting.gitlab.md +27 -0
- package/assets/rules/git-workflow-push.azure.md +28 -0
- package/assets/rules/git-workflow-push.github.md +28 -0
- package/assets/rules/git-workflow-push.gitlab.md +28 -0
- package/assets/rules/git-workflow-queue.azure.md +23 -0
- package/assets/rules/git-workflow-queue.github.md +30 -0
- package/assets/rules/git-workflow-queue.gitlab.md +23 -0
- package/assets/rules/git-workflow.azure.md +21 -264
- package/assets/rules/git-workflow.github.md +24 -285
- package/assets/rules/git-workflow.gitlab.md +21 -258
- package/assets/rules/lib-layers.md +30 -103
- package/assets/rules/lists.md +21 -105
- package/assets/rules/navigation.md +10 -69
- package/assets/rules/queue-audit.github.md +5 -3
- package/assets/rules/reuse-first.md +20 -195
- package/assets/rules/spec-driven.md +35 -316
- package/assets/rules/status-report.md +5 -3
- package/assets/rules/styling-bem.md +20 -117
- package/assets/rules/task-flow-handover.md +24 -0
- package/assets/rules/task-flow-owner.md +34 -0
- package/assets/rules/task-flow-plan.md +38 -0
- package/assets/rules/task-flow.md +22 -289
- package/assets/rules/testing.md +32 -270
- package/assets/rules/turn-conduct.md +109 -111
- package/assets/rules/turn-entry.md +2 -2
- package/assets/rules/typescript-conventions.md +41 -147
- package/assets/samples/tasks/_template/plan.md +30 -6
- package/assets/samples/tasks/_template/progress.md +0 -1
- package/assets/skills/agent-kit-extend.md +25 -168
- package/assets/skills/agent-kit.md +27 -299
- package/assets/skills/write-a-skill.md +20 -106
- package/assets/task-flow/flow.js +188 -0
- package/assets/task-flow/flow.md +102 -0
- package/assets/task-flow/measure/agreement.mjs +24 -0
- package/assets/task-flow/measure/copy.mjs +22 -0
- package/assets/task-flow/measure/epic-of.mjs +50 -0
- package/assets/task-flow/measure/epic-text.mjs +35 -0
- package/assets/task-flow/measure/epic.mjs +114 -0
- package/assets/task-flow/measure/folder.mjs +16 -0
- package/assets/task-flow/measure/footprint.mjs +28 -0
- package/assets/task-flow/measure/grill.mjs +21 -0
- package/assets/task-flow/measure/host.mjs +8 -0
- package/assets/task-flow/measure/owner.mjs +20 -0
- package/assets/task-flow/measure/plan.mjs +27 -0
- package/assets/task-flow/measure/pr.mjs +20 -0
- package/assets/task-flow/measure/progress.mjs +50 -0
- package/assets/task-flow/measure/session.mjs +175 -0
- package/assets/task-flow/measure/task.mjs +23 -0
- package/assets/task-flow/measure/text.mjs +77 -0
- package/assets/task-flow/source/git.mjs +86 -0
- package/assets/task-flow/source/host.mjs +172 -0
- package/assets/task-flow/source/marks.mjs +56 -0
- package/assets/task-flow/source/owner.mjs +74 -0
- package/assets/task-flow/source/records.mjs +116 -0
- package/assets/task-flow/source/session.mjs +232 -0
- package/assets/task-flow/source/steps.mjs +28 -0
- package/assets/task-flow/source/tree.mjs +42 -0
- package/assets/templates/rule.md +2 -2
- package/bin/agent-kit.d.ts.map +1 -1
- package/bin/agent-kit.js +30 -0
- package/bin/agent-kit.js.map +1 -1
- package/lib/agent-checks.d.ts +55 -0
- package/lib/agent-checks.d.ts.map +1 -0
- package/lib/agent-checks.js +209 -0
- package/lib/agent-checks.js.map +1 -0
- package/lib/assets.d.ts.map +1 -1
- package/lib/assets.js +7 -2
- package/lib/assets.js.map +1 -1
- 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/cargo.d.ts +29 -0
- package/lib/cargo.d.ts.map +1 -1
- package/lib/cargo.js +27 -1
- package/lib/cargo.js.map +1 -1
- package/lib/cascade.d.ts.map +1 -1
- package/lib/cascade.js +3 -1
- package/lib/cascade.js.map +1 -1
- package/lib/commands.d.ts.map +1 -1
- package/lib/commands.js +78 -2
- package/lib/commands.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/config.d.ts +18 -0
- package/lib/config.d.ts.map +1 -1
- package/lib/config.js +18 -1
- package/lib/config.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/epic-window-send.d.ts +74 -0
- package/lib/epic-window-send.d.ts.map +1 -0
- package/lib/epic-window-send.js +166 -0
- package/lib/epic-window-send.js.map +1 -0
- package/lib/hooks-map.d.ts +4 -12
- package/lib/hooks-map.d.ts.map +1 -1
- package/lib/hooks-map.js +4 -27
- package/lib/hooks-map.js.map +1 -1
- package/lib/integrity.d.ts +3 -0
- package/lib/integrity.d.ts.map +1 -1
- package/lib/integrity.js +7 -0
- package/lib/integrity.js.map +1 -1
- package/lib/metric-lines.d.ts +2 -1
- package/lib/metric-lines.d.ts.map +1 -1
- package/lib/metric-lines.js +49 -1
- package/lib/metric-lines.js.map +1 -1
- package/lib/metric-send-mark.d.ts +6 -3
- package/lib/metric-send-mark.d.ts.map +1 -1
- package/lib/metric-send-mark.js +15 -5
- package/lib/metric-send-mark.js.map +1 -1
- package/lib/metric-send.d.ts +6 -2
- package/lib/metric-send.d.ts.map +1 -1
- package/lib/metric-send.js +47 -13
- package/lib/metric-send.js.map +1 -1
- package/lib/metrics.d.ts +17 -0
- package/lib/metrics.d.ts.map +1 -1
- package/lib/metrics.js +26 -15
- package/lib/metrics.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 +3 -3
- 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 +7 -9
- package/lib/outcomes.d.ts.map +1 -1
- package/lib/outcomes.js +8 -7
- 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/push-gate.d.ts +13 -0
- package/lib/push-gate.d.ts.map +1 -1
- package/lib/push-gate.js +11 -7
- package/lib/push-gate.js.map +1 -1
- package/lib/push-set-usefulness.d.ts +78 -0
- package/lib/push-set-usefulness.d.ts.map +1 -0
- package/lib/push-set-usefulness.js +225 -0
- package/lib/push-set-usefulness.js.map +1 -0
- 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/sync.d.ts +10 -0
- package/lib/sync.d.ts.map +1 -1
- package/lib/sync.js +14 -1
- package/lib/sync.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/lib/work-result.d.ts +43 -0
- package/lib/work-result.d.ts.map +1 -0
- package/lib/work-result.js +39 -0
- package/lib/work-result.js.map +1 -0
- package/package.json +1 -1
- package/assets/checks/signals/ui-kit.json +0 -11
- package/assets/hooks/claim-guard.sh +0 -212
- package/assets/hooks/grill-gate-ask.sh +0 -26
- package/assets/hooks/grill-gate-bypass.sh +0 -61
- package/assets/hooks/grill-gate-options.sh +0 -50
- package/assets/hooks/grill-gate.sh +0 -482
- package/assets/hooks/postmortem-guard.sh +0 -124
- package/assets/hooks/proposal-guard.sh +0 -154
- package/assets/hooks/stand-login-guard.sh +0 -107
- package/assets/hooks/turn-exit-epic.sh +0 -173
- package/assets/hooks/turn-exit-patterns.sh +0 -123
- package/assets/hooks/turn-exit-verdict.sh +0 -149
- package/assets/hooks/waiting-turn-guard.sh +0 -320
- package/assets/hooks/work-start-guard.sh +0 -175
|
@@ -28,7 +28,9 @@ ROOT="${CLAUDE_PROJECT_DIR:-.}"
|
|
|
28
28
|
cd "$ROOT" 2>/dev/null || exit 0
|
|
29
29
|
git rev-parse --is-inside-work-tree >/dev/null 2>&1 || exit 0
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
# shellcheck disable=SC1091
|
|
32
|
+
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/facts.sh" 2>/dev/null
|
|
33
|
+
branch="$(rt_fact_branch)"
|
|
32
34
|
|
|
33
35
|
# The tree profile: first the package default, and over it the project override, if there is one.
|
|
34
36
|
rt_hooks_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
@@ -1,478 +1,118 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
# rt-hook: Stop
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
3
|
+
# rt-hook-timeout: 90
|
|
4
|
+
# Requires: checks/task-flow-script.mjs, checks/decide.mjs, hooks/decide.sh, hooks/facts.sh, hooks/deny-tail.sh, hooks/turn-exit-role.sh
|
|
5
|
+
# Turn exit guard: a turn does not end before the scenario of the task flow does. Stop.
|
|
6
6
|
#
|
|
7
|
-
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
11
|
-
#
|
|
12
|
-
# outright: stopping in the middle of work is not allowed, and the ban must be held by the machine.
|
|
7
|
+
# The engine measures the branch by the description and answers with a verdict: the turn is released
|
|
8
|
+
# by a release case of the description — the end of the scenario, a stop word of the owner, a session
|
|
9
|
+
# that wrote nothing, a role, the silent hosting, a menu that did not reach the owner — or held with
|
|
10
|
+
# one move named, the next step of the scenario. This file hands the engine the input and turns its
|
|
11
|
+
# verdict into the answer of the hook.
|
|
13
12
|
#
|
|
14
|
-
#
|
|
15
|
-
#
|
|
16
|
-
#
|
|
17
|
-
#
|
|
18
|
-
#
|
|
13
|
+
# Three cases the description cannot express live here: a role session with no edit tool ends with
|
|
14
|
+
# its report (`turn-exit-role.sh`), a window past the stop threshold of `window-fill-guard.sh` ends
|
|
15
|
+
# with the handover, and an engine that fails, runs past its limit of 75 seconds or cannot
|
|
16
|
+
# be called releases the turn with the outcome «движок упал» written to the journal; the next turn
|
|
17
|
+
# starts with that line.
|
|
19
18
|
#
|
|
20
|
-
#
|
|
21
|
-
#
|
|
22
|
-
# 2. There was work in the turn: an edit of a file or a command that changes the tree.
|
|
23
|
-
# 3. A question to the owner through the question tool.
|
|
24
|
-
# 4. A guard refusal — it ends the turn by the rule.
|
|
25
|
-
# 5. The session handover is written — the window has run out.
|
|
26
|
-
# 6. The owner said to stop.
|
|
27
|
-
#
|
|
28
|
-
# Under an open epic the second and the fifth do not release, and a second pass is judged again:
|
|
29
|
-
# until the epic is closed the executor does not stop on its own. The tiers lie in `turn-exit-epic.sh`.
|
|
30
|
-
#
|
|
31
|
-
# Work without a branch and without a task folder is judged by the second sign. It has no state,
|
|
32
|
-
# and there is nowhere to take the first sign from — but a turn without a single edit of the tree
|
|
33
|
-
# does not end here either: the owner's request "lay it out", "update it", "take a look" lives
|
|
34
|
-
# without a task and without a branch, and it was protected least of all. Such a turn is released
|
|
35
|
-
# by the same four things: a question, a guard refusal, a written handover and the owner's word
|
|
36
|
-
# about stopping.
|
|
37
|
-
#
|
|
38
|
-
# FAIL-OPEN: on any error, a missing `jq`, a missing turn record, task folder or state line the
|
|
39
|
-
# turn is ALLOWED (exit 0). A broken guard has no right to jam the conversation.
|
|
19
|
+
# FAIL-OPEN: no node, no jq, no engine, an engine that fails or runs past its limit → the turn is
|
|
20
|
+
# released, and the failure is written to the journal. A broken guard must not jam the conversation.
|
|
40
21
|
|
|
41
|
-
# Its own name in the observations: the refusal is written by the shared deny tail, not by the
|
|
42
|
-
# guard itself.
|
|
43
22
|
RT_GUARD_NAME=turn-exit-guard
|
|
44
23
|
RT_GUARD_RULE=turn-conduct
|
|
45
24
|
|
|
46
|
-
|
|
47
|
-
. "$
|
|
48
|
-
|
|
25
|
+
rt_hooks_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
26
|
+
. "$rt_hooks_dir/utf8.sh" 2>/dev/null || true
|
|
27
|
+
. "$rt_hooks_dir/hook-input.sh" 2>/dev/null || true
|
|
28
|
+
command -v rt_hook_read >/dev/null 2>&1 || exit 0
|
|
49
29
|
rt_hook_read
|
|
50
|
-
|
|
51
|
-
# The refusal is printed in one form: the reason, the shared tail about the two lawful moves and a
|
|
52
|
-
# fallback line in case there is no parser. These twelve lines used to stand as eight copies — the
|
|
53
|
-
# file grew faster on every new tier than on the requirement itself.
|
|
54
|
-
rt_te_deny() {
|
|
55
|
-
# The end of an epic releases the turn whatever tier came here: the epic is read only on this road.
|
|
56
|
-
command -v rt_te_epic_over >/dev/null 2>&1 && rt_te_epic_over && exit 0
|
|
57
|
-
rt_te_reason="$(printf '%s\n\n%s' "$1" 'The owner said to stop — quote their word in the progress: `- **Waiting for the owner:** «<their words>»`. Where the task folder is gone, quote it in « » in the reply: the guard checks the quote against their message.')"
|
|
58
|
-
rt_te_short="$2"
|
|
59
|
-
# shellcheck disable=SC1090
|
|
60
|
-
[ -f "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/deny-tail.sh" ] \
|
|
61
|
-
&& . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/deny-tail.sh" 2>/dev/null
|
|
62
|
-
command -v rt_deny_tail >/dev/null 2>&1 || rt_deny_tail() { :; }
|
|
63
|
-
rt_te_tail="$(rt_deny_tail "")"
|
|
64
|
-
[ -n "$rt_te_tail" ] && rt_te_reason="${rt_te_reason}
|
|
65
|
-
|
|
66
|
-
${rt_te_tail}"
|
|
67
|
-
|
|
68
|
-
jq -n --arg r "$rt_te_reason" '{decision:"block",reason:$r}' 2>/dev/null \
|
|
69
|
-
|| printf '{"decision":"block","reason":"turn-exit-guard: %s"}\n' "$rt_te_short"
|
|
70
|
-
exit 0
|
|
71
|
-
}
|
|
72
|
-
|
|
73
30
|
input="$RT_HOOK_INPUT"
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
[ -z "$workdir" ] && workdir="${CLAUDE_PROJECT_DIR:-.}"
|
|
85
|
-
cd "$workdir" 2>/dev/null || exit 0
|
|
86
|
-
git rev-parse --is-inside-work-tree >/dev/null 2>&1 || exit 0
|
|
87
|
-
|
|
88
|
-
root="$(git rev-parse --show-toplevel 2>/dev/null)"
|
|
89
|
-
[ -z "$root" ] && exit 0
|
|
90
|
-
|
|
91
|
-
# The tiers of the open epic lie in a neighbouring file. A second pass over the same turn is judged
|
|
92
|
-
# only under an open epic: outside it the guard has said its piece once and lets go.
|
|
93
|
-
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/turn-exit-epic.sh" 2>/dev/null || exit 0
|
|
94
|
-
command -v rt_te_epic_open >/dev/null 2>&1 || exit 0
|
|
95
|
-
[ "$active" = "true" ] && ! rt_te_epic_open && exit 0
|
|
96
|
-
|
|
97
|
-
# The branch, the task folder and the state line are taken while they are there. Empty — the turn
|
|
98
|
-
# is judged by the second sign, not released: this is where it used to leave with zero, and work by
|
|
99
|
-
# the owner's word ended with an announcement of intent, silently.
|
|
100
|
-
branch="$(git branch --show-current 2>/dev/null)"
|
|
101
|
-
tasks_dir="${RT_TASKS_DIR:-docs/tasks}"
|
|
102
|
-
progress=""
|
|
103
|
-
state=""
|
|
104
|
-
if [ -n "$branch" ] && [ -f "$root/$tasks_dir/$branch/progress.md" ]; then
|
|
105
|
-
progress="$root/$tasks_dir/$branch/progress.md"
|
|
106
|
-
state="$(sed -nE 's/^[[:space:]]*[-*][[:space:]]*\*\*(State|Состояние):\*\*[[:space:]]*`([^`]*)`.*/\2/p' "$progress" 2>/dev/null | head -1)"
|
|
107
|
-
fi
|
|
108
|
-
|
|
109
|
-
# Work that has reached these two states has already waited out someone else's step: from here on
|
|
110
|
-
# the owner moves it, and a turn closed here drops nothing.
|
|
111
|
-
case "$state" in
|
|
112
|
-
работа-отдана | влито) exit 0 ;;
|
|
113
|
-
esac
|
|
114
|
-
rt_te_owner_word_quoted && exit 0 # the owner's standing word quoted in the waiting line
|
|
115
|
-
|
|
116
|
-
# A written plan is never the end of a turn at all. The mandatory action of this state is to do the
|
|
117
|
-
# first stage, and whoever starts it moves the state by the same edit: a turn left in the previous
|
|
118
|
-
# state has not started the first stage by definition. The second sign is no good here — it counts
|
|
119
|
-
# creating the task, the branch, the column and the folder as work, and a turn with only the
|
|
120
|
-
# preparation done passes straight through it. In one session this happened three times; twice the
|
|
121
|
-
# neighbouring guard over the open PR caught it, the third time nothing caught it, and for the
|
|
122
|
-
# owner a report about a taken task is indistinguishable from a stop.
|
|
123
|
-
if [ "$state" = "замысел-записан" ]; then
|
|
124
|
-
plan="$root/$tasks_dir/$branch/plan.md"
|
|
125
|
-
first_stage="$(grep -m1 '^### ' "$plan" 2>/dev/null | sed 's/^### //')"
|
|
126
|
-
[ -z "$first_stage" ] && first_stage="the first stage of the plan"
|
|
127
|
-
reason="BLOCKED by turn-exit-guard: the work stands in the state 'замысел-записан', and the mandatory action of this state — do the first stage — was not begun in the turn.
|
|
128
|
-
|
|
129
|
-
Creating the task, the branch, the column and the folder does not count as that step: all of it is preparation for work, not work. To the owner a report about a taken task is indistinguishable from a stop — they see the executor standing still.
|
|
130
|
-
|
|
131
|
-
The first stage of the plan: ${first_stage}
|
|
132
|
-
|
|
133
|
-
Begin it in this same turn and rewrite the state to '- **State:** \`этап-идёт\`'. The owner said to stop — then write so: the guard reads their word, not a retelling.
|
|
134
|
-
|
|
135
|
-
The guard judges one turn: the next session is not refused."
|
|
136
|
-
|
|
137
|
-
rt_te_deny "$reason" "the plan is written and the first stage is not begun."
|
|
138
|
-
fi
|
|
139
|
-
|
|
140
|
-
archived=false
|
|
141
|
-
[ -z "$progress" ] && folder_archived && archived=true
|
|
142
|
-
|
|
143
|
-
# The next step out of the progress is what the guard names in the refusal: an executor told only
|
|
144
|
-
# "the work is not finished" re-reads the same line himself.
|
|
145
|
-
next_step=""
|
|
146
|
-
[ -n "$progress" ] && next_step="$(sed -nE 's/^[[:space:]]*[-*][[:space:]]*\*\*(Next step|Следующий шаг):\*\*[[:space:]]*(.*)/\2/p' "$progress" 2>/dev/null | head -1)"
|
|
147
|
-
[ -z "$next_step" ] && next_step="what stands in the section «Where we stand» of the progress"
|
|
148
|
-
|
|
149
|
-
# The patterns of work, of exploration, of waiting and of the handover lie in a neighbouring file:
|
|
150
|
-
# the guard outgrew the length limit, and patterns with their reasons read apart from the tiers.
|
|
151
|
-
# Without the patterns file the guard stays silent — fail-open, as on any breakage of its own.
|
|
152
|
-
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/turn-exit-patterns.sh" 2>/dev/null || exit 0
|
|
153
|
-
[ -n "${work_re:-}" ] || exit 0
|
|
154
|
-
|
|
155
|
-
# The parsing of the turn record lies in a neighbouring file: the guard crossed the file length
|
|
156
|
-
# limit, and the parsing reads apart from the tiers that apply its answer. Without the file the
|
|
157
|
-
# guard stays silent — fail-open, as on any breakage of its own.
|
|
158
|
-
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/turn-exit-verdict.sh" 2>/dev/null || exit 0
|
|
159
|
-
command -v rt_te_verdict >/dev/null 2>&1 || exit 0
|
|
160
|
-
rt_te_verdict
|
|
161
|
-
|
|
162
|
-
[ -z "$verdict" ] && exit 0 # also a turn woken while an own background task runs, SC-AK-1247
|
|
163
|
-
|
|
164
|
-
# Every sign of the verdict becomes a variable of its own name; the commands go apart, they are text.
|
|
165
|
-
eval "$(printf '%s' "$verdict" | jq -r 'del(.ran) | to_entries[] | "\(.key)=\(.value | tostring | @sh)"' 2>/dev/null)"
|
|
166
|
-
commands="$(printf '%s' "$verdict" | jq -r '.ran // ""' 2>/dev/null)"
|
|
167
|
-
|
|
168
|
-
# A question refused by the conversation guard and asked as prose in the same turn. A guard refusal
|
|
169
|
-
# releases the turn — it is the lawful end itself — but there is nothing to release here: the same
|
|
170
|
-
# question came back a line later, and the work stalled on what the tree had already answered. The
|
|
171
|
-
# tier stands before the lawful exits on purpose: a guard refusal covers exactly this case.
|
|
172
|
-
if [ "${asked_in_prose:-false}" = "true" ]; then
|
|
173
|
-
rt_te_deny "BLOCKED by turn-exit-guard: in this turn the conversation guard refused a question to the owner, and the reply ends with a question in prose — the same question, asked in another form.
|
|
174
|
-
|
|
175
|
-
The refusal of the guard named the reason: the answer lies in the tree or the owner has already given it. Read the place it named and work on; what is asked is what the tree does not hold.
|
|
176
|
-
|
|
177
|
-
The guard judges one turn: the next session is not refused." "the question returned in prose after the refusal of the conversation guard."
|
|
178
|
-
fi
|
|
179
|
-
|
|
180
|
-
# The turn ended with waiting for the owner's word. The guard reads the word about stopping from
|
|
181
|
-
# the owner, and here the executor announced it: in this turn the owner said nothing about stopping
|
|
182
|
-
# and was asked no question through the tool. The shared tiers refuse such a turn without a name,
|
|
183
|
-
# and after one step it ended with the same phrase again — three turns in a row in a consuming
|
|
184
|
-
# tree. The tier stands before the lawful exits: a neighbouring guard's refusal releases a turn that
|
|
185
|
-
# named a refusal to the owner, not a turn that said "waiting".
|
|
186
|
-
# Incident analysis — the record
|
|
187
|
-
# "2026-09-04-hod-konchalsya-ozhidaniem-pri-deystvuyushchem-ukazanii" in the intake.
|
|
188
|
-
# A promise to do the work in the next turn. The same announcement of intent as a command named and
|
|
189
|
-
# not run: the tier stands before the lawful exits, because the promise most often stands next to a
|
|
190
|
-
# report about what was done, and by the fullness of the turn it is indistinguishable from a finish.
|
|
191
|
-
if [ "$promised" = "true" ] && [ "$released" != "true" ]; then
|
|
192
|
-
rt_te_deny "BLOCKED by turn-exit-guard: the reply ends with a promise to do the work in the next turn.
|
|
193
|
-
|
|
194
|
-
A promise is the same announcement of intent as a command named and not run, and it only sounds politer. An offer to the owner to object to the announced intent is part of the promise, not a question: a turn ends with a question when the work does not go without the answer.
|
|
195
|
-
|
|
196
|
-
Do the promised in this same turn, and the account of it can come after.
|
|
197
|
-
|
|
198
|
-
The next step is written in the progress: ${next_step}
|
|
199
|
-
|
|
200
|
-
The guard judges one turn: the next session is not refused." "the turn ended with a promise to do the work in the next turn."
|
|
201
|
-
fi
|
|
202
|
-
|
|
203
|
-
# Taking a task as the last action of the turn. Creating the task, the branch and the move of the
|
|
204
|
-
# column is preparation, and the work of the taken task did not begin. Taking it after handed-over
|
|
205
|
-
# work is a lawful end: there the taking answers for the handed-over one.
|
|
206
|
-
if [ "$only_took" = "true" ] && [ "$released" != "true" ]; then
|
|
207
|
-
rt_te_deny "BLOCKED by turn-exit-guard: the last action of the turn is taking a task, and the work of the taken task was not begun.
|
|
208
|
-
|
|
209
|
-
Creating the task, the branch and moving the column is preparation for work, not work. To the owner a report about a taken task is indistinguishable from a stop: they see the executor standing still.
|
|
210
|
-
|
|
211
|
-
Write the plan and begin its first stage in this same turn.
|
|
212
|
-
|
|
213
|
-
The guard judges one turn: the next session is not refused." "the turn ended with taking a task."
|
|
214
|
-
fi
|
|
215
|
-
|
|
216
|
-
# The owner said to work without stops and did not cancel it. Their word holds until they cancel
|
|
217
|
-
# it, and a turn ending with waiting for that same word invents the cancellation. Judged whether or
|
|
218
|
-
# not there was work in the turn: the work stood three turns in a row, and each of them was full.
|
|
219
|
-
if [ "$standing_work" = "true" ] && [ "$awaits_word" = "true" ]; then
|
|
220
|
-
rt_te_deny "BLOCKED by turn-exit-guard: the turn ended with waiting for the word of the owner, and the owner said in this session to work without stops and did not cancel it.
|
|
221
|
-
|
|
222
|
-
Their word holds until they cancel it themselves, and a new fact against it is a line about the price in the reply, not waiting. A decision the tree does not hold is needed — then ask the question by the tool.
|
|
223
|
-
|
|
224
|
-
The next step is written in the progress: ${next_step}
|
|
225
|
-
|
|
226
|
-
The guard judges one turn: the next session is not refused." "the turn ended with waiting under the standing word of the owner to work."
|
|
227
|
-
fi
|
|
228
|
-
|
|
229
|
-
if [ "$awaits_word" = "true" ]; then
|
|
230
|
-
rt_te_deny "BLOCKED by turn-exit-guard: the turn ended with words about waiting for the word of the owner, and the word about stopping the guard reads from the owner: in this turn they announced no stop, and no question was put to them by the tool.
|
|
231
|
-
|
|
232
|
-
The phrase «жду твоего слова» is a stop announced by the executor. The instruction of the owner to work holds until they cancel it, and a new fact against it is a line about the price in the reply, not waiting. A decision the tree does not hold is needed — then ask the question by the tool; otherwise do the next step in this same turn.
|
|
233
|
-
|
|
234
|
-
The next step is written in the progress: ${next_step}
|
|
235
|
-
|
|
236
|
-
The guard judges one turn: the next session is not refused." "the turn ended with waiting for the word of the owner."
|
|
237
|
-
fi
|
|
238
|
-
|
|
239
|
-
# A question without a single piece of work in a running stage: the parts that do not depend on
|
|
240
|
-
# the answer go first, and the question after them.
|
|
241
|
-
if [ "${asked:-false}" = "true" ] && [ "$worked" != "true" ] && [ "$state" = "этап-идёт" ]; then
|
|
242
|
-
rt_te_question_without_work_deny
|
|
243
|
-
fi
|
|
244
|
-
|
|
245
|
-
# A handover written by the hand of the executor before the window filled is a stop announced by
|
|
246
|
-
# the one it suits: under an open epic it releases nothing. The window guard's refusal releases as
|
|
247
|
-
# any refusal, and the handover on compaction is written by the hook, not by a command in the turn.
|
|
248
|
-
if [ "${handed_by_hand:-false}" = "true" ] && rt_te_epic_open; then
|
|
249
|
-
rt_te_epic_deny handed-by-hand
|
|
31
|
+
root="${CLAUDE_PROJECT_DIR:-$(pwd)}"
|
|
32
|
+
|
|
33
|
+
# The engine measures the copy the session works in: the directory the hook input names. A worktree
|
|
34
|
+
# copy whose branch does not carry the engine is not judged by this scenario, and the turn ends.
|
|
35
|
+
dir="$(printf '%s' "$input" | jq -r '.cwd // empty' 2>/dev/null)"
|
|
36
|
+
[ -d "$dir" ] || dir="$root"
|
|
37
|
+
copy_top="$(git -C "$dir" rev-parse --show-toplevel 2>/dev/null)"
|
|
38
|
+
root_top="$(git -C "$root" rev-parse --show-toplevel 2>/dev/null)"
|
|
39
|
+
if [ -n "$copy_top" ] && [ "$copy_top" != "$root_top" ] && [ -z "${RT_FLOW_ENGINE:-}" ] && [ ! -f "$copy_top/tools/task-flow-script.mjs" ]; then
|
|
40
|
+
exit 0
|
|
250
41
|
fi
|
|
251
42
|
|
|
252
|
-
|
|
43
|
+
# A role with no edit tool: its report is its work.
|
|
44
|
+
. "$rt_hooks_dir/turn-exit-role.sh" 2>/dev/null && rt_te_read_only_role && exit 0
|
|
253
45
|
|
|
254
|
-
#
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
# The tier stands after the lawful exits: a question to the owner, a guard refusal, a session
|
|
261
|
-
# handover and the owner's word about stopping end the turn by the rule, and locking them behind a
|
|
262
|
-
# state is not allowed.
|
|
263
|
-
case "$state" in
|
|
264
|
-
этапы-кончились | разбор-кончился)
|
|
265
|
-
if ! printf '%s' "$commands" | grep -qE "$handover_re"; then
|
|
266
|
-
if [ "$state" = "этапы-кончились" ]; then
|
|
267
|
-
action="merge the agreement, bring the texts up to what was done and run the suite"
|
|
268
|
-
else
|
|
269
|
-
action="take the task folder apart by the last commit"
|
|
270
|
-
fi
|
|
271
|
-
reason="BLOCKED by turn-exit-guard: the work stands in the state '${state}', and no request was opened in the turn.
|
|
272
|
-
|
|
273
|
-
The mandatory action of this state is ${action}, and after it the work is brought to a request in the same turn. A report about what was done is never the end of a turn: the edit lies in a branch the owner does not see, and the former state they read as «nothing was done».
|
|
274
|
-
|
|
275
|
-
The next step from the progress: ${next_step}
|
|
276
|
-
|
|
277
|
-
Bring the work to a request in this same turn and rewrite the state. The owner said to stop — then write so: the guard reads their word, not a retelling.
|
|
278
|
-
|
|
279
|
-
The guard judges one turn: the next session is not refused."
|
|
280
|
-
|
|
281
|
-
rt_te_deny "$reason" "the work reached handing over and there is no request in the turn."
|
|
282
|
-
fi
|
|
283
|
-
;;
|
|
46
|
+
# The journal of the engine failures and of the refusals in a row lies in the common directory of git.
|
|
47
|
+
journal_dir="$(git -C "$root" rev-parse --git-common-dir 2>/dev/null)"
|
|
48
|
+
case "$journal_dir" in
|
|
49
|
+
'') journal_dir="" ;;
|
|
50
|
+
/*) journal_dir="$journal_dir/rt-kit" ;;
|
|
51
|
+
*) journal_dir="$root/$journal_dir/rt-kit" ;;
|
|
284
52
|
esac
|
|
53
|
+
journal() {
|
|
54
|
+
[ -n "$journal_dir" ] || return 0
|
|
55
|
+
mkdir -p "$journal_dir" 2>/dev/null || return 0
|
|
56
|
+
printf '%s\t%s\n' "$(date -u +%Y-%m-%dT%H:%M:%SZ)" "$1" >> "$journal_dir/turn-exit.log" 2>/dev/null
|
|
57
|
+
}
|
|
285
58
|
|
|
286
|
-
#
|
|
287
|
-
#
|
|
288
|
-
#
|
|
289
|
-
|
|
290
|
-
#
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
# "was there work in the turn" confirms it: there was work.
|
|
296
|
-
# Incident analysis — the record "2026-08-25-task-taken-and-turn-ended" in the intake.
|
|
297
|
-
#
|
|
298
|
-
# A folder taken apart by a branch commit does not get here: `archived` means handed-over work, and
|
|
299
|
-
# the previous tier judges it. A branch without a task number is not judged at all — such ones are
|
|
300
|
-
# created for a trial too.
|
|
301
|
-
# An epic branch is not judged either: it carries no folder by the rule, and the epic plan names it.
|
|
302
|
-
if [ "$archived" != "true" ] && [ -z "$progress" ] && [ -n "$branch" ] && [ ! -d "$root/$tasks_dir/$branch" ] && ! rt_te_epic_branch; then
|
|
303
|
-
task_key="${RT_TASK_KEY:-}"
|
|
304
|
-
if [ -z "$task_key" ] && [ -f "$root/.claude/rt-kit/checks.json" ]; then
|
|
305
|
-
task_key="$(jq -r '.board.taskKey // empty' "$root/.claude/rt-kit/checks.json" 2>/dev/null)"
|
|
306
|
-
fi
|
|
307
|
-
[ -z "$task_key" ] && task_key='[A-Za-z][A-Za-z0-9]*'
|
|
308
|
-
if printf '%s' "$branch" | grep -qE "^${task_key}-[0-9]+-" 2>/dev/null; then
|
|
309
|
-
reason="BLOCKED by turn-exit-guard: the work is taken and not begun — the branch \`$branch\` is created, and there is no task folder next to it.
|
|
310
|
-
|
|
311
|
-
A created branch means the state «задача-взята», and it has one mandatory action — write the plan. A turn ending here leaves the work announced and not begun: the number is named, the column is moved, and on disk there is neither the analysis of the request nor the stages. The commands creating the branch and moving the column do not replace it — such a turn is filled with exactly those.
|
|
312
|
-
|
|
313
|
-
npm run task:new -- <number> # if there is no folder at all
|
|
314
|
-
|
|
315
|
-
Assemble \`$tasks_dir/$branch/\` and write the plan in this same turn.
|
|
316
|
-
|
|
317
|
-
The guard judges one turn: the next session is not refused."
|
|
318
|
-
|
|
319
|
-
rt_te_deny "$reason" "the work is taken and not begun — write the plan."
|
|
320
|
-
fi
|
|
321
|
-
fi
|
|
322
|
-
|
|
323
|
-
# The stage contract. The mark "the stage is done" is a statement about the tree, and it is backed
|
|
324
|
-
# by the output of a command, not by words: a stage marked from memory is, a session later,
|
|
325
|
-
# indistinguishable from a checked one. The guard compares the stage number with what lies in the
|
|
326
|
-
# branch history, and on a grown number it demands the commands from the verification line — it
|
|
327
|
-
# stands in the plan in backticks. A technique written as prose the guard does not read: there is
|
|
328
|
-
# nothing to back it with output, and this is its known limit.
|
|
329
|
-
stage_now=""
|
|
330
|
-
stage_was=""
|
|
331
|
-
if [ -n "$progress" ]; then
|
|
332
|
-
stage_now="$(sed -nE 's/^[[:space:]]*[-*][[:space:]]*\*\*(Stage|Этап):\*\*[[:space:]]*([0-9][0-9]*).*/\2/p' "$progress" 2>/dev/null | head -1)"
|
|
333
|
-
stage_was="$(git -C "$root" show "HEAD:$tasks_dir/$branch/progress.md" 2>/dev/null | sed -nE 's/^[[:space:]]*[-*][[:space:]]*\*\*(Stage|Этап):\*\*[[:space:]]*([0-9][0-9]*).*/\2/p' | head -1)"
|
|
334
|
-
fi
|
|
335
|
-
|
|
336
|
-
if [ -n "$progress" ] && [ -n "$stage_now" ] && [ -n "$stage_was" ] && [ "$stage_now" -gt "$stage_was" ] 2>/dev/null; then
|
|
337
|
-
plan="$root/$tasks_dir/$branch/plan.md"
|
|
338
|
-
# The contract of the closed stage, not of the started one: what is declared done is what is backed.
|
|
339
|
-
contract="$(awk -v n="$stage_was" '
|
|
340
|
-
$0 ~ "^### " n "\\." { inside = 1; next }
|
|
341
|
-
/^### / { inside = 0 }
|
|
342
|
-
inside && /\*\*(Verified by|Чем проверяется):\*\*/ { print }
|
|
343
|
-
' "$plan" 2>/dev/null)"
|
|
344
|
-
missing=""
|
|
345
|
-
while IFS= read -r cmd; do
|
|
346
|
-
[ -z "$cmd" ] && continue
|
|
347
|
-
printf '%s' "$commands" | grep -qF -- "$cmd" || missing="$missing\n $cmd"
|
|
348
|
-
done <<EOF
|
|
349
|
-
$(printf '%s' "$contract" | grep -o '`[^`]*`' | tr -d '`')
|
|
350
|
-
EOF
|
|
351
|
-
if [ -n "$missing" ]; then
|
|
352
|
-
reason="BLOCKED by turn-exit-guard: the stage ${stage_was} is declared closed, and the commands it is verified by were not run in this turn:$(printf '%b' "$missing")
|
|
353
|
-
|
|
354
|
-
The mark «этап сделан» is a statement about the tree, and it is backed by the output of a command, not by words: a session later what was marked from memory is indistinguishable from what was checked.
|
|
355
|
-
|
|
356
|
-
Run them in this same turn or return the former stage number to the progress.
|
|
357
|
-
|
|
358
|
-
The guard judges one turn: the next session is not refused."
|
|
359
|
-
rt_te_deny "$reason" "a closed stage is not backed by the output of a command."
|
|
360
|
-
fi
|
|
361
|
-
fi
|
|
362
|
-
# The next step rewritten into the progress and not begun: the tier lies next to the epic tiers.
|
|
363
|
-
command -v rt_te_next_step_deny >/dev/null 2>&1 && rt_te_next_step_deny
|
|
364
|
-
|
|
365
|
-
# The work is handed over and the next one is only named. There is more work in such a turn than in
|
|
366
|
-
# any other — and all of it is on the task handed in: the handover finishes the previous work, not
|
|
367
|
-
# the turn. Nine incident analyses in a day describe nine different stops, and in all nine the last
|
|
368
|
-
# action of the turn was a text to the owner: a report, a summary, an announcement of intent.
|
|
369
|
-
# Incident analysis — the record "2026-08-25-handover-turn-ends-on-intent" in the intake.
|
|
370
|
-
if [ "$handed_over" = "true" ] && [ "$started_next" != "true" ]; then
|
|
371
|
-
reason="BLOCKED by turn-exit-guard: a request is open, and nothing was done about the next work in this turn.
|
|
372
|
-
|
|
373
|
-
Handed-over work ends a turn only together with the next one begun — an action about it must be done, not said. «Беру такую-то» is not an exit: the rule calls that an announcement of intent.
|
|
374
|
-
|
|
375
|
-
Everything that happened before the request was opened was done on the handed-over task and says nothing about the next one.
|
|
376
|
-
|
|
377
|
-
npm run task:new -- <title> # create the next one
|
|
378
|
-
git checkout -b <KEY>-<number>-<slug> # take it into work
|
|
379
|
-
|
|
380
|
-
Do the first step of the next work in this same turn. The owner said to stop — then write so: the guard reads their word, not a retelling.
|
|
381
|
-
|
|
382
|
-
The guard judges one turn: the next session is not refused."
|
|
383
|
-
|
|
384
|
-
rt_te_deny "$reason" "the work is handed over and the next one is not begun."
|
|
59
|
+
# A window past its stop threshold: the window guard refuses every next step of work and lets only
|
|
60
|
+
# the closing through — the progress, the handover, a rule, a question. Naming the next step here
|
|
61
|
+
# would name a move that guard denies, so the turn is released, and the reason goes to the journal.
|
|
62
|
+
sid="$(printf '%s' "$input" | jq -r '.session_id // "unknown"' 2>/dev/null)"
|
|
63
|
+
# shellcheck disable=SC1091
|
|
64
|
+
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/facts.sh" 2>/dev/null
|
|
65
|
+
if [ -f "$(rt_fact_window_stop_file "$sid")" ]; then
|
|
66
|
+
journal "окно за порогом: ход отпущен к передаче"
|
|
67
|
+
exit 0
|
|
385
68
|
fi
|
|
386
69
|
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
The next step is written in the progress: ${next_step}
|
|
396
|
-
|
|
397
|
-
Do it in this same turn or take the next task. Waiting in the middle of a turn is lawful — what is refused is the end.
|
|
398
|
-
|
|
399
|
-
The guard judges one turn: the next session is not refused."
|
|
400
|
-
|
|
401
|
-
rt_te_deny "$reason" "the turn ended with waiting for a step by someone else."
|
|
70
|
+
engine="${RT_FLOW_ENGINE:-}"
|
|
71
|
+
[ -n "$engine" ] || for candidate in "$rt_hooks_dir/../checks/task-flow-script.mjs" "${copy_top:-$root}/tools/task-flow-script.mjs" "$root/tools/task-flow-script.mjs"; do
|
|
72
|
+
[ -f "$candidate" ] && engine="$candidate" && break
|
|
73
|
+
done
|
|
74
|
+
if [ ! -f "$engine" ] || ! command -v node >/dev/null 2>&1 || ! command -v jq >/dev/null 2>&1; then
|
|
75
|
+
journal "движок упал: the engine cannot be called"
|
|
76
|
+
exit 0
|
|
402
77
|
fi
|
|
403
|
-
command -v rt_te_launch_last_deny >/dev/null 2>&1 && rt_te_launch_last_deny
|
|
404
|
-
# The shared line. There was work in the turn — but the last action was not it, it was a text to the
|
|
405
|
-
# owner. The particular tiers above name the kind of stop more precisely; what reaches here is what
|
|
406
|
-
# they do not know by name.
|
|
407
|
-
if [ "$worked" = "true" ] && [ "$ended_working" != "true" ]; then
|
|
408
|
-
reason="BLOCKED by turn-exit-guard: there was work in the turn, but the last action of the turn was not it.
|
|
409
|
-
|
|
410
|
-
A turn ends with work, not with an account of it. A report, a summary and an announcement of intent are not an exit: the more was done, the more convincingly they look like completion — and the next action takes exactly that place.
|
|
411
|
-
|
|
412
|
-
The next step is written in the progress: ${next_step}
|
|
413
|
-
|
|
414
|
-
Do it in this same turn, and telling about what was done can come after. The owner said to stop — then write so: the guard reads their word, not a retelling.
|
|
415
78
|
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
79
|
+
limit="${RT_FLOW_VERDICT_LIMIT:-75}"
|
|
80
|
+
verdict="$(cd "$dir" && printf '%s' "$input" | perl -e 'alarm shift; exec @ARGV' "$limit" node "$engine" verdict 2>/dev/null)"
|
|
81
|
+
code=$?
|
|
82
|
+
if [ "$code" -ne 0 ] || [ -z "$verdict" ]; then
|
|
83
|
+
journal "движок упал: exit $code"
|
|
84
|
+
exit 0
|
|
419
85
|
fi
|
|
420
86
|
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
#
|
|
425
|
-
#
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
The owner sees the former state and reads it as «nothing was done». Two moves from here: bring the work to the hosting — push the branch and open a request — or remove what was done if it is not needed. What is left in the tree is named with a reason — in the words of the owner, not as a list of leftovers: the line «Не отправлено: <reason>» in the reply releases this tier.
|
|
432
|
-
|
|
433
|
-
The guard judges one turn: the next session is not refused."
|
|
434
|
-
|
|
435
|
-
rt_te_deny "$reason" "the work stayed in the working tree."
|
|
436
|
-
fi
|
|
87
|
+
release="$(printf '%s' "$verdict" | jq -r '.release // empty' 2>/dev/null)"
|
|
88
|
+
if [ -n "$release" ]; then
|
|
89
|
+
rm -f "$journal_dir/refusals-in-row" 2>/dev/null
|
|
90
|
+
# A turn released on a wait is woken only by the notice of its task. The journal keeps the
|
|
91
|
+
# release with the session: the records of that session then show what woke it.
|
|
92
|
+
case "$release" in
|
|
93
|
+
'a background task of the session runs') journal "ход отпущен на ожидании: $release · сессия $sid" ;;
|
|
94
|
+
esac
|
|
95
|
+
exit 0
|
|
437
96
|
fi
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
# closed one alone. Under an open epic the work stands where it stood, and the next step is named.
|
|
443
|
-
[ "$worked" = "true" ] && rt_te_epic_open && rt_te_epic_deny worked
|
|
444
|
-
[ "$worked" = "true" ] && exit 0
|
|
445
|
-
|
|
446
|
-
if [ "$archived" = "true" ]; then
|
|
447
|
-
reason="BLOCKED by turn-exit-guard: the task folder was removed by a commit of the branch, and nothing was done in this turn — neither an edit nor a command changing the tree.
|
|
448
|
-
|
|
449
|
-
A removed folder means the middle of handing over, not its end: it is taken away BEFORE the request is opened, and between these two motions nobody but the one who did the work sees it. From this minute there is nothing to declare the state of the work by, so the turn is judged by the second sign — whether there was work in it.
|
|
450
|
-
|
|
451
|
-
One step is left: open the request as a draft. The request is already open — then take the next task: waiting for a run by someone else is not work and does not end a turn.
|
|
452
|
-
|
|
453
|
-
The guard judges one turn: the next session is not refused."
|
|
454
|
-
elif [ -z "$state" ]; then
|
|
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
|
-
|
|
457
|
-
A turn ends in four ways and there are no others: 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. 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
|
-
|
|
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
|
-
|
|
461
|
-
Run what is named in this same turn. The owner said to stop — then write so: the guard reads their word, not a retelling.
|
|
462
|
-
|
|
463
|
-
The guard judges one turn: the next session is not refused."
|
|
464
|
-
else
|
|
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
|
-
|
|
467
|
-
A turn ends in four ways and there are no others: 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. 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
|
-
|
|
469
|
-
The next step is written in the progress: ${next_step}
|
|
470
|
-
|
|
471
|
-
Do it in this same turn. The owner said to stop — then write so: the guard reads their word, not a retelling.
|
|
472
|
-
|
|
473
|
-
The guard judges one turn: the next session is not refused."
|
|
97
|
+
reason="$(printf '%s' "$verdict" | jq -r '.block // empty' 2>/dev/null)"
|
|
98
|
+
if [ -z "$reason" ]; then
|
|
99
|
+
journal "движок упал: no verdict"
|
|
100
|
+
exit 0
|
|
474
101
|
fi
|
|
475
102
|
|
|
476
|
-
|
|
477
|
-
|
|
103
|
+
# Claude Code ends the turn itself after eight continuations in a row; the eighth refusal is written.
|
|
104
|
+
row=$(( $(cat "$journal_dir/refusals-in-row" 2>/dev/null || echo 0) + 1 ))
|
|
105
|
+
printf '%s\n' "$row" > "$journal_dir/refusals-in-row" 2>/dev/null
|
|
106
|
+
[ "$row" -ge 8 ] && journal "the eighth refusal in a row: $reason"
|
|
107
|
+
|
|
108
|
+
# The decision and its text come from the decision table. The engine gives the reason; whether the
|
|
109
|
+
# reason names the owner's menu is read from the engine's own fixed sentence for it.
|
|
110
|
+
menu_due=no
|
|
111
|
+
case "$reason" in *"The one move is the owner's menu:"*) menu_due=yes ;; esac
|
|
112
|
+
facts="$(jq -cn --arg m "$menu_due" \
|
|
113
|
+
'{flow_scenario_over:"no", menu_due:$m, read_only_role:"no", window_over_stop:"no"}')"
|
|
114
|
+
params="$(jq -cn --arg r "$reason" '{reason:$r}')"
|
|
115
|
+
# shellcheck disable=SC1091
|
|
116
|
+
. "$rt_hooks_dir/decide.sh" 2>/dev/null
|
|
117
|
+
command -v rt_decide >/dev/null 2>&1 && rt_decide turn-exit-guard.sh end_turn "$facts" "$params" Stop
|
|
478
118
|
exit 0
|