@rt-tools/agent-kit 0.36.0 → 0.37.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/assets/checks/board-pull-state.github.mjs +82 -13
  2. package/assets/checks/board.github.mjs +1 -1
  3. package/assets/checks/check-board.github.mjs +20 -12
  4. package/assets/checks/check-specs.mjs +2 -2
  5. package/assets/checks/epic-table.github.mjs +4 -3
  6. package/assets/checks/lib-common.mjs +10 -2
  7. package/assets/checks/lib-domains.mjs +1 -1
  8. package/assets/checks/lib-manifests.mjs +34 -2
  9. package/assets/checks/push-inputs.mjs +401 -0
  10. package/assets/checks/push-trace.mjs +108 -0
  11. package/assets/checks/rt-kit-checks.config.mjs +17 -2
  12. package/assets/checks/spec-anchors.mjs +4 -4
  13. package/assets/checks/spec-contract.mjs +5 -5
  14. package/assets/commands/next-session.md +3 -1
  15. package/assets/commands/night.md +28 -18
  16. package/assets/defaults/project.sh +37 -8
  17. package/assets/defaults/push.sh +23 -0
  18. package/assets/defaults/turn-map.md +10 -6
  19. package/assets/docs/GLOSSARY.md +3 -1
  20. package/assets/hooks/epic-stop-guard.sh +62 -15
  21. package/assets/hooks/git-guard-push-ahead.sh +31 -1
  22. package/assets/hooks/git-guard-push-marks.sh +173 -29
  23. package/assets/hooks/git-guard-push-tests.sh +22 -3
  24. package/assets/hooks/handoff-entry-guard.sh +2 -2
  25. package/assets/hooks/pre-push.sh +6 -0
  26. package/assets/hooks/push-set.sh +29 -4
  27. package/assets/hooks/task-flow-context.sh +15 -4
  28. package/assets/hooks/task-flow-guard.sh +4 -3
  29. package/assets/hooks/turn-exit-epic.sh +1 -1
  30. package/assets/hooks/turn-exit-guard.sh +8 -8
  31. package/assets/hooks/turn-exit-role.sh +45 -0
  32. package/assets/laws/work-conduct.md +9 -8
  33. package/assets/patterns/autonomous-work-run.md +35 -10
  34. package/assets/patterns/browser-verification-measure.md +10 -20
  35. package/assets/patterns/browser-verification-stand.md +30 -42
  36. package/assets/patterns/doc-style-human.md +0 -6
  37. package/assets/patterns/doc-style-sweep.md +7 -7
  38. package/assets/patterns/doc-style-trace.md +5 -4
  39. package/assets/patterns/doc-style-write.md +7 -7
  40. package/assets/patterns/epic-flow-declare.md +15 -8
  41. package/assets/patterns/git-workflow-commit.github.md +1 -1
  42. package/assets/patterns/git-workflow-freshness.md +12 -11
  43. package/assets/patterns/git-workflow-merge.md +14 -11
  44. package/assets/patterns/git-workflow-migration.md +4 -2
  45. package/assets/patterns/git-workflow-pr-body.github.md +1 -1
  46. package/assets/patterns/git-workflow-pr-ready.md +5 -4
  47. package/assets/patterns/git-workflow-pr.azure.md +91 -25
  48. package/assets/patterns/git-workflow-pr.github.md +17 -19
  49. package/assets/patterns/git-workflow-pr.gitlab.md +75 -29
  50. package/assets/patterns/git-workflow-restart.md +3 -2
  51. package/assets/patterns/git-workflow-stack.md +25 -21
  52. package/assets/patterns/lib-layers-new.md +7 -3
  53. package/assets/patterns/queue-audit-read.github.md +9 -3
  54. package/assets/patterns/spec-driven-domain.md +50 -48
  55. package/assets/patterns/spec-driven-rule.md +18 -19
  56. package/assets/patterns/status-report-table.github.md +1 -1
  57. package/assets/patterns/task-flow-archive.md +14 -34
  58. package/assets/patterns/task-flow-close.md +3 -2
  59. package/assets/patterns/task-flow-graph.needs-graph.md +98 -0
  60. package/assets/patterns/task-flow-handoff.md +4 -4
  61. package/assets/patterns/task-flow-resume.md +56 -20
  62. package/assets/patterns/task-flow-start.md +3 -4
  63. package/assets/patterns/testing-e2e.md +14 -18
  64. package/assets/patterns/testing-unit.md +9 -13
  65. package/assets/patterns/turn-entry-map.md +13 -3
  66. package/assets/pitfalls/autonomous-work.md +15 -0
  67. package/assets/pitfalls/doc-style.md +3 -3
  68. package/assets/pitfalls/git-workflow.github.md +5 -9
  69. package/assets/pitfalls/spec-driven.md +9 -7
  70. package/assets/pitfalls/task-flow.md +14 -25
  71. package/assets/pitfalls/testing.md +11 -12
  72. package/assets/pitfalls/turn-conduct.md +6 -6
  73. package/assets/rules/autonomous-work.md +37 -29
  74. package/assets/rules/browser-verification.md +27 -22
  75. package/assets/rules/dependencies.md +3 -3
  76. package/assets/rules/deploy-flow.azure.md +35 -12
  77. package/assets/rules/deploy-flow.github.md +10 -6
  78. package/assets/rules/deploy-flow.gitlab.md +40 -17
  79. package/assets/rules/doc-style.md +21 -17
  80. package/assets/rules/epic-flow.md +5 -3
  81. package/assets/rules/git-workflow.azure.md +140 -122
  82. package/assets/rules/git-workflow.github.md +7 -8
  83. package/assets/rules/git-workflow.gitlab.md +128 -117
  84. package/assets/rules/queue-audit.github.md +5 -3
  85. package/assets/rules/spec-driven.md +17 -25
  86. package/assets/rules/status-report.md +5 -3
  87. package/assets/rules/task-flow.md +33 -15
  88. package/assets/rules/testing.md +35 -32
  89. package/assets/rules/turn-conduct.md +26 -24
  90. package/assets/templates/rule.md +2 -2
  91. package/assets/traits.json +3 -0
  92. package/lib/cargo-prose.d.ts +2 -1
  93. package/lib/cargo-prose.d.ts.map +1 -1
  94. package/lib/cargo-prose.js.map +1 -1
  95. package/lib/companion.d.ts +0 -5
  96. package/lib/companion.d.ts.map +1 -1
  97. package/lib/companion.js +1 -1
  98. package/lib/companion.js.map +1 -1
  99. package/lib/cost.d.ts +0 -8
  100. package/lib/cost.d.ts.map +1 -1
  101. package/lib/cost.js +4 -4
  102. package/lib/cost.js.map +1 -1
  103. package/lib/hooks-map.d.ts +0 -12
  104. package/lib/hooks-map.d.ts.map +1 -1
  105. package/lib/hooks-map.js +2 -25
  106. package/lib/hooks-map.js.map +1 -1
  107. package/lib/observations-cargo.d.ts +1 -5
  108. package/lib/observations-cargo.d.ts.map +1 -1
  109. package/lib/observations-cargo.js +2 -2
  110. package/lib/observations-cargo.js.map +1 -1
  111. package/lib/observations.d.ts +0 -2
  112. package/lib/observations.d.ts.map +1 -1
  113. package/lib/observations.js.map +1 -1
  114. package/lib/order.d.ts +0 -2
  115. package/lib/order.d.ts.map +1 -1
  116. package/lib/order.js +0 -4
  117. package/lib/order.js.map +1 -1
  118. package/lib/outcomes.d.ts +2 -7
  119. package/lib/outcomes.d.ts.map +1 -1
  120. package/lib/outcomes.js +3 -3
  121. package/lib/outcomes.js.map +1 -1
  122. package/lib/proposals.d.ts +0 -1
  123. package/lib/proposals.d.ts.map +1 -1
  124. package/lib/proposals.js +1 -1
  125. package/lib/proposals.js.map +1 -1
  126. package/lib/shipment.d.ts +2 -11
  127. package/lib/shipment.d.ts.map +1 -1
  128. package/lib/shipment.fixture.d.ts +0 -3
  129. package/lib/shipment.fixture.d.ts.map +1 -1
  130. package/lib/shipment.fixture.js +3 -3
  131. package/lib/shipment.fixture.js.map +1 -1
  132. package/lib/shipment.js +2 -2
  133. package/lib/shipment.js.map +1 -1
  134. package/lib/traits.d.ts +0 -3
  135. package/lib/traits.d.ts.map +1 -1
  136. package/lib/traits.js +2 -2
  137. package/lib/traits.js.map +1 -1
  138. package/lib/variants.d.ts +0 -1
  139. package/lib/variants.d.ts.map +1 -1
  140. package/lib/variants.js +1 -1
  141. package/lib/variants.js.map +1 -1
  142. package/package.json +1 -1
  143. package/assets/checks/signals/ui-kit.json +0 -11
@@ -9,7 +9,7 @@ description: Rule under the delivery law for a tree on GitLab — the part about
9
9
 
10
10
  Rule under the law `docs/constitution/delivery.md` — the part of it about production. The law
11
11
  says what must be true; here — by which technique it is held in a tree that lives on GitLab.
12
- Working with the queue, the branch, the commit and the PR — the rule `git-workflow` under the
12
+ Working with the queue, the branch, the commit and the MR — the rule `git-workflow` under the
13
13
  same law.
14
14
 
15
15
  ## What it is called here
@@ -43,7 +43,7 @@ flowchart TD
43
43
  G --> H[Old images are removed, the last three sha stay as rollback depth]
44
44
  H --> I{Production answers with what was rolled out}
45
45
  I -->|No| J[Rollout analysis: the restart goes by sha, not by the latest tag]
46
- I -->|Yes| K[The work queue audit reads the last run of the main branch]
46
+ I -->|Yes| K[The work queue audit counts the lag of the main branch from the last successful rollout]
47
47
  C --> K
48
48
  J --> K
49
49
  ```
@@ -70,6 +70,10 @@ flowchart TD
70
70
  the stack acts only on a container raised by that stack; a manual run of the same image goes
71
71
  with an empty value, and empty here means localhost — with all the debugging defaults it allows.
72
72
  The image default is set in the image itself.
73
+ - **The image carries every file its own startup steps read.** The storage schema, the client
74
+ settings, the environment template — everything lying next to it in the repository does not get
75
+ inside the image by itself, and the build answers only whether it built. The failure comes on the
76
+ first startup, that is, already on the rolled-out one.
73
77
  - **Images are rolled out by commit sha, not by the tag "latest".** The tag in the registry lags
74
78
  behind the main branch, and production silently falls back to the previous version while still
75
79
  answering.
@@ -77,6 +81,15 @@ flowchart TD
77
81
  with a sha is never dangling, and a dangling cleanup does not touch it: in half a year they eat
78
82
  the server disk whole. Three sha is the rollback depth, and fewer cannot be taken: a breakage
79
83
  noticed two rollouts later has nowhere left to roll back to.
84
+ - **A production breakage that has happened is analysed in a record, not by a fix alone.** The fix
85
+ leaves as a branch, the task closes — and the reason the application stopped stays the knowledge
86
+ of one executor. The record names what broke, how it became visible and why the fix fixes the
87
+ cause and not the sign; it lies among the records of what has happened, and the directory is named
88
+ by the companion of the wording rule.
89
+ - **An edit to the rollout itself is run before the merge, and "I will check after the merge" is
90
+ never the executor's decision.** There is no other way to run it: it executes only where it rolls
91
+ out. When there is no way to run it by hand either, that is said to the owner in words, together
92
+ with what the check would cost, and the decision to postpone is theirs.
80
93
  - **The description of production is edited together with the production stack.** The layout,
81
94
  the request path, the gates and the backups are described in texts outside the rules layers, and
82
95
  neither linter nor build reads them: the divergence piles up silently, and these texts are read
@@ -87,9 +100,16 @@ flowchart TD
87
100
  does not cover it: that checks the commands, not the pipeline file — the correctness of the file
88
101
  itself is read only from the list of pipelines after the push, and the syntax is judged
89
102
  separately by the `.gitlab-ci.yml` check in the project.
90
- - **A PR is checked before the merge by the same pipeline as the main branch.** Checks and image
103
+ - **An MR is checked before the merge by the same pipeline as the main branch.** Checks and image
91
104
  builds go on the MR pipeline, the rollout does not: it is held by the main-branch
92
- rule on its step, and a PR image does not leave for the registry.
105
+ rule on its step, and an MR image does not leave for the registry.
106
+ - **Which MRs the pipeline wakes for is named by the tree, and it sets the order of handing in.** A
107
+ filter by the target branch is not a detail of the settings: an MR the pipeline does not wake for
108
+ has nothing to wait for, and a draft on it costs a locked button and an extra turn. A tree with a
109
+ single runner pays a whole run for every MR into an epic branch, and pays it for checks the push
110
+ gate has already run on the same machine; a tree with runners to spare buys the earlier refusal.
111
+ The answer is written in the pipeline file next to the rule that filters by the target branch,
112
+ together with what is lost by it.
93
113
  - **A package the tree's own applications install is released from a tip their end-to-end suites
94
114
  went green on.** Where the release pipeline runs none of these suites, an MR merged past the
95
115
  pipeline reaches them first after the release. When an MR without a green pipeline of its own
@@ -105,13 +125,12 @@ flowchart TD
105
125
  - **The migration chain is run from an empty storage before the merge.** The apply order is
106
126
  lexicographic by directory name, and the timestamp is set at creation: a migration from a branch
107
127
  started earlier lands before the one it depends on.
108
- - **A migration without a reverse is merged only after a copy of the production storage, and the PR
109
- body names the copy.** Rolling back the image does not bring a dropped column or table back. When
128
+ - **A migration without a reverse is merged only after a copy of the production storage, and the MR description names the copy.** Rolling back the image does not bring a dropped column or table back. When
110
129
  the executor cannot reach the server, the owner is told which step is blocked and what opens it:
111
130
  the owner's word replaces a check only when the owner was told the check did not run.
112
131
  - **The divergence of migrations from the schema is measured on a shadow storage, not on the one
113
132
  the pusher works with.** That one lawfully carries the trace of any unfinished branch, and a
114
- check against it would hold up someone else's edit. The gate and the rollout call one and the
133
+ check against it would hold up someone else's edit. The gate and the pipeline call one and the
115
134
  same check — otherwise "matched" would mean different things in two places.
116
135
  - **Skipping the schema audit is lawful while the branch has not touched the storage.** A stopped
117
136
  database is a state of the machine, not a reason to refuse a documentation push; but a branch
@@ -122,19 +141,23 @@ flowchart TD
122
141
  is not yet a rollout: a failed one leaves the main branch ahead of the server, and merges on top
123
142
  go the same way. The lag is counted from the last successful rollout and does not tell "not
124
143
  started" from "failed".
125
-
126
- - **A check standing in the gate set refuses when it could not do its work.** "Nowhere to check"
127
- and "the check is broken" are different things: the first the tree names itself — no subject, no
128
- address set, the service not answering — and each such exit returns zero with its own line. The
129
- second — a missing package, an empty name in the settings, an unexpected exception — returns a
130
- non-zero code and says that the check itself broke, not the subject. A shared zero for both makes
131
- a broken check indistinguishable from a passed one: the schema-to-migrations audit stood like that
132
- in the gate set, checking nothing, and hid three causes at once behind its zero.
144
+ - **A check standing in the gate set refuses when it could not do its work.** "Nowhere to check" and
145
+ "the check is broken" are different things: the first the tree names itself — no subject, no
146
+ address set, the service not answering — and each such exit returns the skip code with its own
147
+ line. The second — a missing package, an empty name in the settings, an unexpected exception —
148
+ returns a non-zero code and says that the check itself broke, not the subject. A shared zero for
149
+ both makes a broken check indistinguishable from a passed one: the schema-to-migrations audit
150
+ stood like that in the gate set, checking nothing, and hid three causes at once behind its zero.
151
+ - **The merge button and the manual rollout run get their requirement at the host.** Both are
152
+ pressed at the host, where the guards of the session do not stand. The requirement is set at the
153
+ host — a protected branch, the setting "Pipelines must succeed" or a protected environment — or is
154
+ named to the one who presses, in the section of the MR description about the remaining step,
155
+ before the press.
133
156
 
134
157
  ## What of the law is not here
135
158
 
136
- The state of production is not visible to the machine: the work queue audit asks for the last
137
- run of the main branch and judges by it, and nobody asks whether production answers with the
159
+ The state of production is not visible to the machine: the work queue audit counts how far the
160
+ main branch has gone from the last successful rollout, and nobody asks whether production answers with the
138
161
  build it rolled out. That is held by whoever rolled out.
139
162
 
140
163
  Nothing counts the completeness of the registry cleanup: the script keeps the last three sha,
@@ -18,9 +18,9 @@ together with the rule.
18
18
 
19
19
  | In the law | Here |
20
20
  | ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
21
- | document | any `.md` outside `docs/archive/`, plus code comments, commit bodies and PR descriptions |
21
+ | document | any `.md` outside `docs/archive/` and the task folders, plus code comments, commit bodies and PR descriptions |
22
22
  | a path named in a document | a string in backticks with a slash or a file extension — that is what the check looks for. A name with a slash that is no address, such as a story title, goes without backticks |
23
- | the change a document describes | a pair from `docs-guard`: a rule and its mirror, a `.proto` and a spec, a hook and its scenarios, a moved file and both libs' READMEs |
23
+ | the change a document describes | a pair `docs-guard` demands: a rule and its companion, a lib and its README; the rest is named by the tree profile, such as a `.proto` and a spec |
24
24
  | description of the past | `docs/archive/` — excluded from the path check entirely |
25
25
 
26
26
  ## Where it lives
@@ -119,9 +119,9 @@ flowchart TD
119
119
  <!-- rt-when: *.md -->
120
120
 
121
121
  - **A file of the tree is edited by the edit tool, not by a shell command.** A guard judges a
122
- shell command by its whole body as new text: the pattern being replaced, the old markup, a loop
123
- and the headers next to a heredoc. A one-liner is then one sentence of fifty words, and the
124
- guard refuses the edit for lines it does not add. A post-edit hook does not see such a write at
122
+ shell command by its body as new text: the heredoc bodies, and with no heredoc the whole command
123
+ — the pattern being replaced, the old markup, a loop. A one-liner is then one sentence of fifty
124
+ words, and the guard refuses the edit for lines it does not add. A post-edit hook does not see such a write at
125
125
  all, and a replacement whose pattern matched nothing exits zero with the file untouched. A
126
126
  command that must write a document gets it as a file written by the edit tool beforehand.
127
127
 
@@ -136,7 +136,7 @@ flowchart TD
136
136
  stand in the checks settings, not in the text; a rule at the ceiling takes a new article only
137
137
  by folding an argument next to it, or by a split. The description of the past is excluded
138
138
  from the count: by design the archive lists what the tree no longer has, and the task folder
139
- dies with the merge.
139
+ is taken apart before the PR opens.
140
140
  <!-- rt-when: *.md -->
141
141
 
142
142
  - **A file leaving for the description of the past names its former address in its header.**
@@ -185,12 +185,10 @@ flowchart TD
185
185
  the run turned red for something other than the branch's change.
186
186
  <!-- rt-when: *.md -->
187
187
 
188
- - **The removal by expiry travels as a commit of its own.** The check stands in the gate of every
189
- branch and counts age by the calendar, so it refuses whatever branch reaches it first — commits
190
- too, not only pushes. A task of its own per record is no cure: one record expires every day. The
191
- prune command makes the cleanup a separate commit with its own subject in the branch it blocked,
192
- and the PR body names it as unrelated to the work. The lasting cure is moving the check out of the
193
- commit and push gate into the pipeline of the main branch.
188
+ - **The removal by expiry travels as a commit of its own.** The check stands in the push gate of
189
+ every branch and counts age by the calendar, so it refuses whatever branch reaches it first. A
190
+ task per record is no cure: one expires every day. The prune command
191
+ drops the expired records; they go as a commit of their own, and the PR body names it unrelated.
194
192
  <!-- rt-when: *.md -->
195
193
 
196
194
  - **A link to a record of the past in a live text lives exactly until the record's expiry.** The
@@ -198,11 +196,9 @@ flowchart TD
198
196
  text that referenced it. A live text names the decision in words, not by the record's address.
199
197
  <!-- rt-when: *.md -->
200
198
 
201
- - **A diagram is edited by the same change as the text it depicts.** Once they diverge, the
202
- diagram and the prose both remain readable, and the first to notice is whoever followed the
203
- diagram: it is shorter, it is read instead of the text, and the divergence derails the work
204
- entirely. No check sees this — the diagram is set in words and can be told from the text next
205
- to it only by reading.
199
+ - **A diagram is edited by the same change as the text it depicts.** A diverged diagram is read
200
+ instead of the text, being shorter, and the work goes by the wrong one. No check sees this: the diagram is set
201
+ in words and is told from the text only by reading.
206
202
  <!-- rt-when: *.md -->
207
203
 
208
204
  ## Texts for a person
@@ -274,6 +270,14 @@ held by the author's memory — and the cost of that shows: words from the gloss
274
270
  live in hook comments and `tools/*.mjs` by the dozen, including the refusal text the guard prints
275
271
  to the agent.
276
272
 
273
+ No check tells a "do later" list in a document from any other list: the law's article about the
274
+ work queue is held by the author, and a task plan leaves with the work.
275
+
276
+ A dropped word is purged from files by a search; in PR titles, commit subjects and task cards
277
+ nothing finds it, and whoever drops the word holds it. Completeness of texts from the side of the
278
+ work is asked by the pattern `doc-style-trace` and, where the rule `task-flow` is laid out, by its
279
+ closing step; no check counts it.
280
+
277
281
  ## Patterns
278
282
 
279
283
  - `doc-style-write` — how to word: "do" and "don't" examples, rules for comments.
@@ -7,8 +7,10 @@ description: Rule under the work-conduct law — the epic as the unit of deliver
7
7
 
8
8
  # Epics — how it works here
9
9
 
10
- Rule under the law `docs/constitution/work-conduct.md`. The law says that the main branch takes the
11
- whole or does not take it; here — how a series of tasks is held together as one epic. The course of
10
+ Rule under the law `docs/constitution/work-conduct.md`. The law says that a series of tasks is
11
+ declared an epic before the first of them and keeps the order assigned at planning; the law
12
+ `docs/constitution/delivery.md` adds that the main branch takes the epic whole. Here — how a series
13
+ of tasks is held together as one epic. The course of
12
14
  one task is rule `task-flow`, the end of a turn is `turn-conduct`, both under the same law.
13
15
 
14
16
  **Requires:** `hooks/tree-assignment-guard.sh`, `checks/tree-assignment.mjs`
@@ -17,7 +19,7 @@ one task is rule `task-flow`, the end of a turn is `turn-conduct`, both under th
17
19
 
18
20
  | In the law | Here |
19
21
  | --- | --- |
20
- | an epic — the unit of delivery | a card in the work queue with the epic label, a branch of its own from the main branch and a plan next to it. The plan holds the opportunity, the tasks and their order |
22
+ | an epic — the unit of delivery | a card in the work queue with the epic label, a branch of its own from the main branch and a plan next to it. The plan holds the capability, the tasks and their order |
21
23
  | the epic branch | `<КЛЮЧ>-<номер эпика>-<короткий-slug>`; the branches of its tasks are taken from it, and their PRs go into it |
22
24
  | the epic plan | a record outside the task folder: the folder dies with the merge, the epic outlives it; the directory — in the rule's companion |
23
25
  | who leads which epic | the table of assignments: a row for each working copy, written by the owner |