@rt-tools/agent-kit 0.33.1 → 0.35.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.
Files changed (159) hide show
  1. package/README.md +14 -13
  2. package/assets/agents/goal-critic.md +76 -0
  3. package/assets/agents/product-strategist.md +95 -0
  4. package/assets/agents/qa-engineer.md +3 -0
  5. package/assets/checks/check-specs.mjs +11 -2
  6. package/assets/checks/rt-kit-checks.config.mjs +6 -0
  7. package/assets/checks/spec-common.mjs +6 -3
  8. package/assets/checks/spec-scenarios.mjs +9 -1
  9. package/assets/checks/task-new.github.mjs +6 -0
  10. package/assets/defaults/project.sh +49 -81
  11. package/assets/defaults/push.sh +100 -0
  12. package/assets/docs/GLOSSARY.md +4 -0
  13. package/assets/hooks/browser-guard-device-id.sh +1 -0
  14. package/assets/hooks/browser-guard-no-asking.sh +1 -0
  15. package/assets/hooks/browser-guard-no-listing.sh +1 -0
  16. package/assets/hooks/browser-guard-no-other-drivers.sh +7 -3
  17. package/assets/hooks/browser-guard-require-select.sh +1 -0
  18. package/assets/hooks/claim-guard.sh +7 -6
  19. package/assets/hooks/dev-server-guard.sh +1 -0
  20. package/assets/hooks/dispatch.sh +56 -3
  21. package/assets/hooks/docs-guard.sh +1 -0
  22. package/assets/hooks/end-conversation-guard.sh +1 -0
  23. package/assets/hooks/epic-stop-guard.sh +1 -0
  24. package/assets/hooks/exam-guard.sh +6 -1
  25. package/assets/hooks/git-guard-delivery-body.sh +25 -3
  26. package/assets/hooks/git-guard-delivery-draft.sh +23 -0
  27. package/assets/hooks/git-guard-delivery-folder.sh +38 -1
  28. package/assets/hooks/git-guard-delivery-pipeline.sh +99 -0
  29. package/assets/hooks/git-guard-delivery-signature.sh +19 -0
  30. package/assets/hooks/git-guard-delivery.sh +15 -19
  31. package/assets/hooks/git-guard-discard.sh +1 -0
  32. package/assets/hooks/git-guard-main.sh +18 -4
  33. package/assets/hooks/git-guard-no-verify.sh +1 -0
  34. package/assets/hooks/git-guard-push-ahead.sh +98 -0
  35. package/assets/hooks/git-guard-push-marks.sh +99 -0
  36. package/assets/hooks/git-guard-push-tests.sh +102 -83
  37. package/assets/hooks/grill-gate.sh +1 -0
  38. package/assets/hooks/guard-note.sh +11 -3
  39. package/assets/hooks/handover-mark.sh +37 -0
  40. package/assets/hooks/metric-marks.sh +233 -0
  41. package/assets/hooks/metric-send-start.sh +38 -0
  42. package/assets/hooks/observe.sh +103 -0
  43. package/assets/hooks/owner-corrections.sh +36 -0
  44. package/assets/hooks/pre-push.sh +113 -0
  45. package/assets/hooks/prose-style-guard.sh +1 -0
  46. package/assets/hooks/pull-outcomes.sh +59 -0
  47. package/assets/hooks/push-set.sh +160 -0
  48. package/assets/hooks/push-sign.sh +433 -0
  49. package/assets/hooks/qa-dataid-guard.sh +1 -0
  50. package/assets/hooks/rerun-guard.sh +15 -6
  51. package/assets/hooks/reuse-first-guard.sh +1 -0
  52. package/assets/hooks/role-calls.sh +120 -0
  53. package/assets/hooks/rule-source-guard.sh +16 -0
  54. package/assets/hooks/skill-gate.sh +11 -0
  55. package/assets/hooks/task-flow-draft-guard.sh +1 -0
  56. package/assets/hooks/task-flow-guard.sh +1 -0
  57. package/assets/hooks/tree-assignment-guard.sh +1 -0
  58. package/assets/hooks/turn-exit-epic.sh +24 -0
  59. package/assets/hooks/turn-exit-guard.sh +3 -23
  60. package/assets/hooks/turn-exit-patterns.sh +4 -3
  61. package/assets/hooks/turn-exit-verdict.sh +18 -1
  62. package/assets/hooks/waiting-turn-guard.sh +3 -1
  63. package/assets/hooks/window-fill-guard.sh +1 -0
  64. package/assets/hooks/work-start-guard.sh +1 -0
  65. package/assets/hooks/write-targets.sh +21 -0
  66. package/assets/patterns/git-workflow-commit.azure.md +5 -3
  67. package/assets/patterns/git-workflow-commit.github.md +16 -3
  68. package/assets/patterns/git-workflow-commit.gitlab.md +5 -3
  69. package/assets/patterns/git-workflow-pr-body.github.md +20 -3
  70. package/assets/patterns/git-workflow-pr.azure.md +30 -0
  71. package/assets/patterns/git-workflow-pr.github.md +57 -1
  72. package/assets/patterns/git-workflow-pr.gitlab.md +33 -0
  73. package/assets/patterns/mockups-measure.needs-mockups.md +19 -3
  74. package/assets/patterns/task-flow-close.md +32 -22
  75. package/assets/patterns/task-flow-cycle.md +72 -0
  76. package/assets/patterns/task-flow-start.md +3 -3
  77. package/assets/rules/browser-verification.md +4 -0
  78. package/assets/rules/deploy-flow.azure.md +5 -0
  79. package/assets/rules/deploy-flow.github.md +5 -0
  80. package/assets/rules/deploy-flow.gitlab.md +5 -0
  81. package/assets/rules/git-workflow.azure.md +15 -0
  82. package/assets/rules/git-workflow.github.md +15 -0
  83. package/assets/rules/git-workflow.gitlab.md +15 -0
  84. package/assets/rules/mockups.needs-mockups.md +13 -5
  85. package/assets/rules/task-flow.md +31 -25
  86. package/assets/samples/tasks/_template/plan.md +8 -0
  87. package/assets/skills/interface-review-annotate.needs-mockups.md +142 -0
  88. package/assets/skills/interface-review-icons.needs-app.md +136 -0
  89. package/assets/skills/interface-review-motion-states.needs-app.md +230 -0
  90. package/assets/skills/interface-review-motion.needs-app.md +209 -0
  91. package/assets/skills/interface-review-performance.needs-app.md +110 -0
  92. package/assets/skills/interface-review-principles.needs-app.md +263 -0
  93. package/assets/skills/interface-review-surfaces.needs-app.md +249 -0
  94. package/assets/skills/interface-review.needs-app.md +199 -0
  95. package/assets/skills/write-a-skill.md +16 -3
  96. package/assets/templates/postmortem.md +2 -0
  97. package/assets/workflows/feature.js +33 -5
  98. package/assets/workflows/plan.js +71 -4
  99. package/bin/agent-kit.d.ts.map +1 -1
  100. package/bin/agent-kit.js +28 -0
  101. package/bin/agent-kit.js.map +1 -1
  102. package/lib/cargo.d.ts +35 -0
  103. package/lib/cargo.d.ts.map +1 -1
  104. package/lib/cargo.js +76 -0
  105. package/lib/cargo.js.map +1 -1
  106. package/lib/commands.d.ts +9 -0
  107. package/lib/commands.d.ts.map +1 -1
  108. package/lib/commands.js +32 -19
  109. package/lib/commands.js.map +1 -1
  110. package/lib/config.d.ts +5 -0
  111. package/lib/config.d.ts.map +1 -1
  112. package/lib/config.js +1 -0
  113. package/lib/config.js.map +1 -1
  114. package/lib/file-lock.d.ts +4 -0
  115. package/lib/file-lock.d.ts.map +1 -0
  116. package/lib/file-lock.js +23 -0
  117. package/lib/file-lock.js.map +1 -0
  118. package/lib/metric-lines.d.ts +20 -0
  119. package/lib/metric-lines.d.ts.map +1 -0
  120. package/lib/metric-lines.js +117 -0
  121. package/lib/metric-lines.js.map +1 -0
  122. package/lib/metric-send-mark.d.ts +52 -0
  123. package/lib/metric-send-mark.d.ts.map +1 -0
  124. package/lib/metric-send-mark.js +69 -0
  125. package/lib/metric-send-mark.js.map +1 -0
  126. package/lib/metric-send.d.ts +18 -0
  127. package/lib/metric-send.d.ts.map +1 -0
  128. package/lib/metric-send.js +226 -0
  129. package/lib/metric-send.js.map +1 -0
  130. package/lib/metric-usage.d.ts +34 -0
  131. package/lib/metric-usage.d.ts.map +1 -0
  132. package/lib/metric-usage.js +111 -0
  133. package/lib/metric-usage.js.map +1 -0
  134. package/lib/metrics.d.ts +92 -0
  135. package/lib/metrics.d.ts.map +1 -0
  136. package/lib/metrics.js +263 -0
  137. package/lib/metrics.js.map +1 -0
  138. package/lib/observations-cargo.d.ts +2 -0
  139. package/lib/observations-cargo.d.ts.map +1 -1
  140. package/lib/observations-cargo.js +1 -1
  141. package/lib/observations-cargo.js.map +1 -1
  142. package/lib/observations.d.ts +22 -2
  143. package/lib/observations.d.ts.map +1 -1
  144. package/lib/observations.js +40 -13
  145. package/lib/observations.js.map +1 -1
  146. package/lib/outcomes.d.ts +89 -0
  147. package/lib/outcomes.d.ts.map +1 -0
  148. package/lib/outcomes.js +274 -0
  149. package/lib/outcomes.js.map +1 -0
  150. package/lib/ship.js +1 -1
  151. package/lib/ship.js.map +1 -1
  152. package/lib/shipment.d.ts.map +1 -1
  153. package/lib/shipment.js +7 -1
  154. package/lib/shipment.js.map +1 -1
  155. package/lib/snapshot.d.ts +2 -0
  156. package/lib/snapshot.d.ts.map +1 -1
  157. package/lib/snapshot.js +6 -0
  158. package/lib/snapshot.js.map +1 -1
  159. package/package.json +1 -1
package/README.md CHANGED
@@ -27,6 +27,8 @@ npx agent-kit sync # разложить выбранное в docs/constitu
27
27
  npx agent-kit doctor # что разложено, что отстало, чего не хватает
28
28
  npx agent-kit adopt # отдать пакету файлы, лежащие на его путях не от него
29
29
  npx agent-kit stats # чем пользовались, чем ни разу, обо что спотыкались
30
+ npx agent-kit metrics # отказы, повторы, мёртвые правила и вес входа за месяц
31
+ npx agent-kit send # отправить числа по дням: проверки и сессии делают это сами
30
32
  npx agent-kit cost # сколько весит вход в работу, одно правило и весь слой
31
33
  ```
32
34
 
@@ -268,8 +270,7 @@ npx agent-kit init --laws access,delivery,verifiability
268
270
  самого в ней нет — значение со слэшем не пишется вовсе.
269
271
 
270
272
  ```bash
271
- npx agent-kit stats --days 3 # за отрезок; без довода — за три дня
272
- npx agent-kit stats --json # то же машиночитаемо
273
+ npx agent-kit stats --days 3 --json # за отрезок, машиночитаемо; без довода — за три дня
273
274
  ```
274
275
 
275
276
  Самая ценная строка сводки — не «чем пользовались», а **что разложено и не загружено ни разу**:
@@ -352,8 +353,7 @@ npx agent-kit enroll --token <токен> # положить токе
352
353
 
353
354
  ### Что для этого нужно
354
355
 
355
- Наблюдения и сводка живут целиком на машине; в сеть ходит только отправка, и только по команде
356
- человека. Приём — своя служба, а не чужая: она поднимается там, где решит владелец пакета.
356
+ Наблюдения и сводка живут на машине. Текст уходит по команде человека, числа дерево шлёт само (выключает `send: false`).
357
357
 
358
358
  | Где | Что нужно |
359
359
  | --- | --- |
@@ -372,29 +372,30 @@ npx agent-kit enroll --token <токен> # положить токе
372
372
  репозитория: адрес по нему не восстанавливается, а у двух рабочих копий одного репозитория он
373
373
  один. Репозитория нет — признак называется ключом `tree`.
374
374
 
375
- Адреса нет, токена нет, токен отозван — отправка отказывает ненулевым кодом и называет, чего
376
- именно не хватило и где это объявляется. Молчаливая отправка выглядела бы работающей.
375
+ Адреса нет, токена нет, токен отозван — команда человека отказывает ненулевым кодом и называет, чего
376
+ не хватило. Тихий запуск пишет сбой в метку, его называют `agent-kit doctor` и начало сессии.
377
377
 
378
378
  ## Роли и конвейеры
379
379
 
380
- Пакет везёт шесть ролей субагентов и два конвейера из них.
380
+ Пакет везёт роли субагентов и два конвейера из них. Роли, которые входят в конвейеры:
381
381
 
382
382
  | Роль | Что делает |
383
383
  | --- | --- |
384
384
  | `business-analyst` | что работа даёт владельцу, что выкидывается без потери цели |
385
+ | `product-strategist` | пытается доказать, что работа не дошла до своей точки и не ведёт к вехе эпика |
386
+ | `goal-critic` | сравнивает результат с дословными словами владельца, план сессии не читает |
385
387
  | `project-manager` | декомпозиция с границами и признаками готовности, приёмка по исходному запросу |
386
388
  | `qa-engineer` | тесты, сборка, линтеры, замеры в браузере, состязательный разбор правки |
387
389
  | `spec-writer` | договорённость о продукте до кода — спек фичи по разбору просьбы |
388
390
  | `spec-critic` | что в договорённости недосказано и где два прочтения |
389
391
  | `skill-curator` | разбор закрытой задачи: что из правил помогло, чего не хватило |
390
392
 
391
- Конвейер `plan` ведёт от разбора просьбы владельца до замысла — нужность, договорённость,
392
- критика, этапы. Конвейер `feature` — от плана до приёмки, с веером проверок посередине.
393
+ Конвейер `plan`: нужность, точки, договорённость, критика, этапы, сравнение со словами владельца.
394
+ Конвейер `feature`: план, веер проверок, приёмка, точки, то же сравнение; аргумент `{ task, grill }`.
393
395
 
394
- Роль вопросов владельцу не задаёт: ни она, ни конвейер до него не достучатся. Поэтому разбор
395
- ведёт главный агент, а роли стоят по обе стороны от него — разведка до, конвейер после.
396
-
397
- `skill-curator` приезжает и слеш-командой — о ней и остальных двух ниже.
396
+ Таблицы в описании PR проверяются, если профиль задал `RT_PULL_POINTS_SECTION` и
397
+ `RT_PULL_GOAL_SECTION`: пустые значения не проверяют ничего. Вопросов роль не задаёт, разбор ведёт
398
+ главный агент. `skill-curator` приезжает и слеш-командой — о ней и остальных двух ниже.
398
399
 
399
400
  ## Слеш-команды
400
401
 
@@ -0,0 +1,76 @@
1
+ ---
2
+ name: goal-critic
3
+ description: Compares the result with the owner's words and tries to prove the goal is not met. Takes neither the plan nor the session's account of the work as evidence. Use on a plan before its first stage, before a PR opens and before work is reported as done.
4
+ tools: Read, Grep, Glob, Bash
5
+ ---
6
+
7
+ You judge whether what was built is what the owner asked for. You answer **in the owner's language**.
8
+
9
+ You have neither `Write` nor `Edit`, and you change neither the code nor the texts. `Bash` is for
10
+ reading and for running what the result claims to do.
11
+
12
+ A copy a check needs goes into a directory named after you under the session's scratchpad, and
13
+ nothing is removed — neither by `rm` nor by a cleanup at the end: the scratchpad is shared with the
14
+ session that called you, and a removing command waits in the background for a permission nobody
15
+ answers.
16
+
17
+ A session writes its own plan, points and signs and then checks itself against them. Everything can
18
+ turn green while the goal stays unchecked. You are the check that does not stand on what the session
19
+ wrote.
20
+
21
+ ## What you read
22
+
23
+ - **The owner's words, verbatim.** They come in the prompt, from the quoted request in the grill or
24
+ from the card. They are the only statement of the goal. A retelling is not a goal: where you have
25
+ no quote, say so and stop.
26
+ - **The result itself:** the diff, a command you run, the host, the published package, the page.
27
+
28
+ The plan, the progress, the points, commit bodies, the PR description and the replies of other roles
29
+ are claims of the session. You read them only to test them, and they prove nothing.
30
+
31
+ ## How you work
32
+
33
+ 1. **Split the owner's words into requirements.** Quote each one. Where the owner changed their mind,
34
+ the later word stands.
35
+ 2. **Assume every requirement is not met.** Only evidence you failed to break changes that.
36
+ 3. **Look for the evidence in the result.** A text that promises behaviour is not the behaviour:
37
+ "written" and "works" are two different results, and each is named as what it is.
38
+ 4. **Name what moved.** What was quietly narrowed, what was dropped, what was done that nobody asked
39
+ for.
40
+
41
+ ## What is proved in each mode
42
+
43
+ The prompt names the mode.
44
+
45
+ **Plan.** Does every requirement have a stage? What did the plan narrow or replace with a goal of its
46
+ own? What does it add that the owner did not ask for?
47
+
48
+ **Result.** For every requirement, what can the owner do now that they could not before, shown from
49
+ their side? What stands only in a branch, only in a text, or only on this machine?
50
+
51
+ **Cycle.** The prompt gives the metric of an edit, its direction, baseline and noise, and the report
52
+ after it. Over the same trees, did the number move past the noise in that direction? If not, the
53
+ verdict is «не сдвинулось», with both numbers. The executor's explanation of why is not evidence.
54
+
55
+ **PR description.** The prompt gives the description and the replies of the roles. Every "done" and
56
+ "reached" in the description is tried against the result. A word of a role that differs from its
57
+ reply is a miss, whatever the session's reason was.
58
+
59
+ ## Rules
60
+
61
+ - **Every statement has a source:** `file:line`, a URL or a command with its output. With no data
62
+ write "hypothesis" and how to check it.
63
+ - **An objection carries a step.** For every miss give the shortest step that closes it.
64
+ - **Do not soften, and do not manufacture.** A requirement you failed to refute is called met, with
65
+ the evidence that withstood you.
66
+
67
+ ## Reply format
68
+
69
+ The final text is a return value, without preambles.
70
+
71
+ 1. The verdict in one phrase: the goal is met, partly met or not met.
72
+ 2. A table: the owner's words, what the result shows, met or not. It goes into the PR description as
73
+ it stands.
74
+ 3. What was narrowed, dropped or added.
75
+ 4. The shortest step for every miss.
76
+ 5. Sources, and the list of hypotheses to check.
@@ -0,0 +1,95 @@
1
+ ---
2
+ name: product-strategist
3
+ description: Tries to prove that work misses its point and does not lead to the milestone of its epic. Reads the mission of the product, names where the product stands and what each task must change. Use while planning work and while reviewing done work.
4
+ tools: Read, Grep, Glob, Bash, WebSearch, WebFetch
5
+ ---
6
+
7
+ You judge work in this repository by where it moves the product. Code is written by others; your
8
+ zone is what is built, why and in what order. You answer **in the owner's language**.
9
+
10
+ You have neither `Write` nor `Edit`, and you change neither the code nor the texts. `Bash` is for
11
+ reading and for running the sign of a point: `git log`, `ls`, `grep`, `find`, `gh` reads, the tree's
12
+ read commands and the command a sign names.
13
+
14
+ A copy a sign needs goes into a directory named after you under the session's scratchpad, and
15
+ nothing is removed — neither by `rm` nor by a cleanup at the end: the scratchpad is shared with the
16
+ session that called you, and a removing command waits in the background for a permission nobody
17
+ answers.
18
+
19
+ ## The points
20
+
21
+ - **A** — where the product stands now, by what the tree and the host show today.
22
+ - **B, C, D** — the point each task must reach. A point is a change a person can observe: what they
23
+ can do afterwards that they could not do before. "The rule is written", "the PR is merged" and "the
24
+ check is green" are steps, not points.
25
+ - **G** — the milestone of the epic: the state of the product the tasks exist for. Work outside an
26
+ epic has no G: it is judged by A and its own point.
27
+
28
+ A point has a sign: the command, the page or the number that shows it is reached, and who sees it.
29
+ A point with no sign cannot be reached or missed, and that is a finding in itself.
30
+
31
+ The mission of each product stands in the tree's missions document, named in the companion of the
32
+ rule `task-flow`. A milestone that serves no mission is a finding. You never set a mission: a guess
33
+ about one is confirmed by the owner. Where there is no mission, propose a wording from your analysis
34
+ of the project, name it a proposal and wait for the owner's approval. A document marked as a draft
35
+ is not a norm yet: what differs from it is a question to the owner, not a finding.
36
+
37
+ ## How you work
38
+
39
+ 1. **Read the work:** the owner's words verbatim, the epic plan, the task plan, and for done work
40
+ the diff, the record of closed work and the state on the host.
41
+ 2. **While planning, fix the product passport** in five to seven lines: for whom, which problem it
42
+ solves, the main path of a person, what exists and what is unfinished. Take it from the code, the
43
+ specs, the routes and the analytics events the code sends, not from the plan's own words.
44
+ 3. **Name the points** A, B, C, D and G. A point the plan does not name is reconstructed from the
45
+ owner's words and marked as reconstructed.
46
+ 4. **Assume the miss, and try to prove it.** The default verdict is "missed". Only evidence you
47
+ failed to break changes it.
48
+ 5. **While planning, rate each idea on five axes:** the person's problem, the effect on the business
49
+ metric where the tree has one, the cost by the modules it touches, the risks, the alternatives
50
+ including "do not do it".
51
+
52
+ ## What is proved in each mode
53
+
54
+ **Planning.** The work has not started, so the question is whether the route exists.
55
+
56
+ - Does each point move the product, or only the tree?
57
+ - Does B + C + D add up to G, or does G hold something no task reaches?
58
+ - Is there a shorter route: a step to drop, a merge of two tasks, a ready thing in the tree, a task
59
+ that should go first because the others depend on it?
60
+ - What makes G unreachable even if every task closes: a release nobody planned, a person who must
61
+ act, a consumer who never installs it?
62
+
63
+ **Review.** The work is done, so the question is whether it arrived.
64
+
65
+ - For each point, run its sign. A sign not run counts as not reached.
66
+ - What changed for the person who was named? "They can" is checked from their side: the host, the
67
+ published package, the page, not the working copy.
68
+ - Where did the work stop short of the point: merged but unreleased, written but unchecked, promised
69
+ in a text nothing enforces?
70
+ - Was the path optimal: what was spent that G did not need, and what G needed that was not done?
71
+ - Name the point the work actually reached, even when it differs from the one planned.
72
+
73
+ ## Rules
74
+
75
+ - **Every number has a source:** `file:line`, a URL, a command with its output, or the owner's data.
76
+ With no data write "hypothesis" and how to check it. Metrics are not invented.
77
+ - **An objection carries a proposal.** For every miss give the shortest step that closes it and what
78
+ it costs.
79
+ - **Do not soften, and do not manufacture.** A point you failed to refute is called reached, with the
80
+ evidence that withstood you. A miss for the sake of a miss is worth as little as a false "reached".
81
+ - **Check the tree before proposing a feature:** what already exists is not proposed.
82
+ - **The market is searched only when the conclusion needs it.**
83
+
84
+ ## Reply format
85
+
86
+ The final text is a return value, without preambles.
87
+
88
+ 1. The verdict in one phrase: reaches G, reaches G by a longer route, or does not reach G.
89
+ 2. While planning, the passport of the product, five to seven lines.
90
+ 3. A table of the points: the point, its sign, the result of the sign, reached or missed. It goes
91
+ into the PR body as it stands.
92
+ 4. The proof of each miss, and the shortest step that closes it.
93
+ 5. Whether the route is optimal: what to drop, what to reorder, what is missing; while planning, the
94
+ ratings of the ideas.
95
+ 6. Sources, and the list of hypotheses to check.
@@ -44,6 +44,9 @@ id from `.claude/rt-kit/browser-device-id`, otherwise the hook will not let you
44
44
  Check **with numbers**, not by eye: `getComputedStyle`, `getBoundingClientRect`, contrast,
45
45
  matching centres, viewport bounds. "Looks fine" is not a result.
46
46
 
47
+ A review of a screen as a whole — accessibility, layout, writing, typography and polish in one
48
+ report — goes by the skill `interface-review` where the tree has it laid out.
49
+
47
50
  Remember how the stand differs from the development server: the incremental build can go stale
48
51
  piece by piece, and if the live render diverges from what the same address returns by `curl`,
49
52
  say so separately — it is not a code bug. What is true only on the stand — pattern
@@ -162,7 +162,12 @@ for (const domain of domains) {
162
162
  // the count silently: the coverage marks under it are not read either, and a test referring to
163
163
  // its number does not turn red — references are looked for among the parsed ones.
164
164
  for (const heading of walk(base, (name) => name === 'scenarios.md').flatMap(unparsedHeadings)) {
165
- report(`${heading.file}:${heading.line}`, `the scenario heading is not taken by the template and counts as ordinary prose: ${heading.text}`);
165
+ report(
166
+ `${heading.file}:${heading.line}`,
167
+ heading.row
168
+ ? `the scenario is written as a table row, not as a heading, and the audit does not read it: ${heading.text}`
169
+ : `the scenario heading is not taken by the template and counts as ordinary prose: ${heading.text}`
170
+ );
166
171
  }
167
172
 
168
173
  // The prefix belongs to the domain together with its subdomains, not to a separate directory.
@@ -324,7 +329,11 @@ const skippedPatterns = () => {
324
329
  try {
325
330
  const skip = JSON.parse(read(path)).skip ?? [];
326
331
 
327
- return new Set(skip.map((resource) => resource.match(/^patterns\/(.+)\.md$/)?.[1]).filter(Boolean));
332
+ // A pattern carried only as a hosting variant is skipped by its variant name —
333
+ // `status-report-table.github.md` — while the rule names it without the variant. A pattern
334
+ // name holds no dot — `patternsNamedBy` below reads it as `[\w-]+` — so everything after the
335
+ // first one is the variant. A dot let into that sample breaks this cut in silence.
336
+ return new Set(skip.map((resource) => resource.match(/^patterns\/([^./]+)(?:\.[^/]+)?\.md$/)?.[1]).filter(Boolean));
328
337
  } catch {
329
338
  return new Set();
330
339
  }
@@ -40,6 +40,12 @@ const DEFAULTS = {
40
40
  * Empty — the suites are searched for under the source roots alone, as before.
41
41
  */
42
42
  testRoots: [],
43
+ /**
44
+ * How many capitals a scenario prefix holds, from and to: the heading and the test reference are
45
+ * read by one width. A tree writing ten-letter prefixes had none of its scenarios recognised
46
+ * while the width stood at six.
47
+ */
48
+ scenarioPrefixWidth: [2, 10],
43
49
  /** Where never to go: the build, the dependencies, the generated. */
44
50
  skippedDirs: ['node_modules', 'dist', '.git', '.nx', 'tmp', 'coverage', 'worktrees', 'gen', 'generated'],
45
51
  /** Where the project texts lie. */
@@ -41,12 +41,15 @@ const SKIPPED_DIRS = CONFIG.skippedDirs;
41
41
  /**
42
42
  * `### SC-BK-03 — a request for dates already taken`
43
43
  *
44
- * The number is accepted from one digit to four, the prefix from two letters to six. A heading the
44
+ * The number is accepted from one digit to four, the prefix by the width the tree names, two to ten
45
+ * letters unless it names its own. A heading the
45
46
  * template did not take used to start no scenario and give no refusal: this tree crossed a
46
47
  * thousand scenarios and lost the whole thousandth series at once — neither in coverage nor in
47
48
  * debts, with a green audit. Now such a heading is named as a discrepancy of its own.
48
49
  */
49
- const SCENARIO_HEADING = /^###\s+(SC-([A-Z]{2,6})-(\d{1,4}))\s+—\s+(.+?)\s*$/;
50
+ const [PREFIX_MIN, PREFIX_MAX] = CONFIG.scenarioPrefixWidth ?? [2, 10];
51
+ const PREFIX = `[A-Z]{${PREFIX_MIN},${PREFIX_MAX}}`;
52
+ const SCENARIO_HEADING = new RegExp(`^###\\s+(SC-(${PREFIX})-(\\d{1,4}))\\s+—\\s+(.+?)\\s*$`);
50
53
  /**
51
54
  * The keys of a spec are read under two names, English and the owner's. A tree translates its
52
55
  * specs one domain at a time, and a key that moved instead of learning the second name takes the
@@ -82,7 +85,7 @@ const UNCOVERED = /^(?:Not covered|Не покрыто):\s*\S/;
82
85
  /** The test exists, but checks not everything promised or goes another way */
83
86
  const PARTIAL = /^(?:Coverage:\s*partial|Покрытие:\s*частичное)\s*—\s*\S/;
84
87
  /** A mention of the scenario in the title of a test; the number is as long as in the heading */
85
- const SCENARIO_REFERENCE = /\bSC-[A-Z]{2,6}-\d{1,4}\b/g;
88
+ const SCENARIO_REFERENCE = new RegExp(`\\bSC-${PREFIX}-\\d{1,4}\\b`, 'g');
86
89
  /** The promise line of a scenario; its continuations go with an indent */
87
90
  const PROMISE = /^(?:Then|Тогда)\s+\S/;
88
91
  /**
@@ -26,8 +26,14 @@ import {
26
26
  * passed green with thirteen of its scenarios not counted at all.
27
27
  */
28
28
  const SCENARIO_HEADING_START = /^###\s+SC-/;
29
+ /**
30
+ * A table row begun by a scenario number. Such a row carries no promise line and no coverage mark,
31
+ * so it is named rather than read: a tree kept 203 scenarios this way, and the repeated numbers hid
32
+ * exactly there.
33
+ */
34
+ const SCENARIO_ROW = /^\|\s*SC-[A-Z]+-\d+\s*\|/;
29
35
 
30
- /** The headings of a file that begin as a scenario and are not taken by the template. */
36
+ /** The lines of a file that begin as a scenario and are not taken by the template. */
31
37
  function unparsedHeadings(file) {
32
38
  const found = [];
33
39
  read(file)
@@ -35,6 +41,8 @@ function unparsedHeadings(file) {
35
41
  .forEach((line, index) => {
36
42
  if (SCENARIO_HEADING_START.test(line) && !SCENARIO_HEADING.test(line)) {
37
43
  found.push({ file, line: index + 1, text: line.trim() });
44
+ } else if (SCENARIO_ROW.test(line)) {
45
+ found.push({ file, line: index + 1, text: line.trim(), row: true });
38
46
  }
39
47
  });
40
48
 
@@ -430,6 +430,12 @@ function writeEpicPlan() {
430
430
  '',
431
431
  '<Возможность, ради которой эпик заведён: что владелец получит и чего не может сегодня.>',
432
432
  '',
433
+ '## Точки',
434
+ '',
435
+ '- **A:** <где продукт стоит сейчас>',
436
+ `- **B (${TASK_KEY}-<номер>):** <изменение, которое увидит человек>. Признак: <команда, страница или число>`,
437
+ '- **G (веха эпика):** <состояние продукта, ради которого заведены задачи>. Признак: <команда, страница или число>',
438
+ '',
433
439
  '## Как стоят ветки',
434
440
  '',
435
441
  `Ветка эпика отведена от главной, ветки задач — от неё, заявки задач идут в неё. <Стопкой`,
@@ -39,87 +39,10 @@ RT_STANDS_RAISED_BY="${RT_STANDS_RAISED_BY:-}"
39
39
  RT_CHECKS_DIR="${RT_CHECKS_DIR:-tools}"
40
40
  RT_HOOKS_TESTS="${RT_HOOKS_TESTS:-.claude/hooks/tests/run.sh}"
41
41
 
42
- # The commands that must pass before a push. One per line; the first one that fails refuses the
43
- # push. The style linter on a separate line: the code linter does not read style files at all.
44
- #
45
- # The first parameter is the base: the branch against which the contribution is counted. Empty means
46
- # there is no remote, and then everything runs: a set stricter than needed is safe, a set narrower
47
- # than needed is not.
48
- #
49
- # The build runs alongside the lint and the specs. The linter does not read types, and the specs
50
- # read only what someone brought into them by an import: a type error in uncovered code lives until
51
- # the image build, that is, until the merge. It costs little — beyond that the runner cache works.
52
- #
53
- # A newly created check goes here, not only into the general run that nobody calls by themselves. A
54
- # new line in its list of known cases leaves for the main branch silently, while the list is read as
55
- # a working guard.
56
- #
57
- # The layout audit goes as the first line, for two reasons. It costs seconds, so it refuses before
58
- # the long run begins. And before it, a drift of the laid-out copy from the package refused nothing.
59
- # An edit put into the laid-out copy past the source breaks nothing on the day it is made, and
60
- # surfaces on someone else's work: the layout refuses on the whole edited file and lays down not one
61
- # other. The sign is the layout settings themselves: a tree without them does not install the
62
- # package, and there is nothing to call in it.
63
- #
64
- # Whether the branch touched only texts. Zero code — only texts, otherwise — code.
65
- #
66
- # The sign is needed by the tree that added a heavy step to the gate set: a stand, showcase
67
- # snapshots, image builds. Without it such a step runs every time, whatever the branch is, and the
68
- # push of a commit that changed one line in a markdown table takes minutes. In those minutes the
69
- # owner manages to read it as hung and refuse it. The delivery rule demands the same from the
70
- # pipeline: a branch that touched not one line of code raises no stand, takes no frames and builds
71
- # no images.
72
- #
73
- # A branch counts as textual when every touched file is either `.md` or lies under the texts
74
- # directory. Everything else, including the harness and settings, counts as code: the sign must err
75
- # towards an extra run, not a missed one. An empty base means there is nothing to compare with —
76
- # then the sign stays silent and everything runs.
77
- rt_push_docs_only_default() {
78
- [ -z "$1" ] && return 1
79
- changed="$(git diff --name-only "$1"...HEAD 2>/dev/null)"
80
- [ -z "$changed" ] && return 1
81
- printf '%s\n' "$changed" | grep -qvE "(^${RT_DOCS_DIR:-docs}/|\.md\$)" && return 1
82
-
83
- return 0
84
- }
85
-
86
- rt_push_checks_default() {
87
- runner="$(rt_runner)"
88
- root="${CLAUDE_PROJECT_DIR:-.}"
89
- [ -f "$root/.claude/rt-kit.json" ] && printf '%s\n' "$runner agent-kit sync --check"
90
- if [ -n "$1" ]; then
91
- printf '%s\n' "$runner nx affected -t lint test build --base=$1"
92
- else
93
- printf '%s\n' "$runner nx run-many -t lint test build --all"
94
- fi
95
- [ -f "$root/stylelint.config.js" ] && printf '%s\n' "$runner stylelint \"**/*.scss\" --max-warnings 0"
96
-
97
- # The guard scenarios are the same code as everything else: both the branch review and the
98
- # confidence that the harness still works rest on them. The run takes seconds: it builds
99
- # nothing.
100
- [ -x "$root/$RT_HOOKS_TESTS" ] && printf '%s\n' "bash $RT_HOOKS_TESTS"
101
-
102
- for check in check-doc-paths check-specs check-file-size check-dupes check-styles \
103
- check-glossary check-lib-layers check-reuse check-schema-drift check-states check-state-next \
104
- check-turn-map check-work-steps check-spec-coverage check-archive-age check-profile-drift \
105
- check-hook-scope check-push-gate; do
106
- [ -f "$root/$RT_CHECKS_DIR/$check.mjs" ] && printf '%s\n' "node $RT_CHECKS_DIR/$check.mjs"
107
- done
108
-
109
- return 0
110
- }
111
-
112
- # Is a check of the gate set heavy: success — it builds, raises or shoots, and costs minutes. After
113
- # the first red check the gate still runs the light ones, so that one refusal names every red among
114
- # them; a heavy one is not started then — its minutes buy nothing while the push is refused anyway.
115
- # Before, the gate left on the first red, and every fix opened the next reason by a push of its own.
116
- rt_push_check_heavy_default() {
117
- case "$1" in
118
- *' nx '* | *'nx affected'* | *'nx run'* | *'docker '* | *playwright* | *e2e*) return 0 ;;
119
- esac
120
-
121
- return 1
122
- }
42
+ # The push set — what runs before a push, which of it is heavy, whether the branch touched only
43
+ # texts — lives in a neighbouring file: together with it the profile outgrew the length limit.
44
+ # shellcheck disable=SC1090
45
+ [ -f "$(dirname "${BASH_SOURCE[0]}")/push.sh" ] && . "$(dirname "${BASH_SOURCE[0]}")/push.sh"
123
46
 
124
47
  # Which document must travel by the same commit as this file. Prints a path pattern or stays silent.
125
48
  rt_docs_pair_for_default() {
@@ -359,6 +282,12 @@ rt_pull_token_login() { :; }
359
282
  # foreign words: a section not named by the tree is not judged at all.
360
283
  RT_PULL_BODY_SECTION="${RT_PULL_BODY_SECTION:-}"
361
284
 
285
+ # The section with the table of points, judged the same way: named by the tree, silent otherwise.
286
+ RT_PULL_POINTS_SECTION="${RT_PULL_POINTS_SECTION:-}"
287
+
288
+ # The section with the table of the critic, judged the same way.
289
+ RT_PULL_GOAL_SECTION="${RT_PULL_GOAL_SECTION:-}"
290
+
362
291
  # The PR body line closing the branch's task (`{number}`); the keyword is the hosting's, so silent.
363
292
  RT_PULL_CLOSES_LINE="${RT_PULL_CLOSES_LINE:-}"
364
293
 
@@ -432,6 +361,44 @@ rt_conflicting_pulls_default() {
432
361
  printf '%s' "$state" | jq -r '.conflicting[]? | "#\(.number) \(.branch)"'
433
362
  }
434
363
 
364
+ # The requests merged or closed since a day, for the package metrics: one JSON object per line. The
365
+ # default asks GitHub, and another hosting declares the function by the same shape, which is named in
366
+ # `hooks/pull-outcomes.sh`. A failing exit code means «nobody to ask», and such a tree is counted
367
+ # apart. The task comes from the title: the head of a revert request names the request, not the task.
368
+ # An epic is told by the label of its card, as the delivery guard tells it: a request carries none.
369
+ # A request never handed over counts apart, so the hosting is asked no more about it: one call per
370
+ # request made a first read of a busy tree outlive the report.
371
+ rt_pull_outcomes_default() {
372
+ command -v gh >/dev/null 2>&1 || return 3
373
+ command -v jq >/dev/null 2>&1 || return 3
374
+ list="$(gh pr list --state all --limit 1000 --search "closed:>=$1" \
375
+ --json number,state,headRefName,title,closedAt 2>/dev/null)" || return 4
376
+ printf '%s' "$list" | jq -c '.[] | select(.state != "OPEN")' | while IFS= read -r pull; do
377
+ number="$(printf '%s' "$pull" | jq -r '.number')"
378
+ head="$(printf '%s' "$pull" | jq -r '.headRefName')"
379
+ task="$(printf '%s' "$pull" | jq -r '(.title | capture("\\[[A-Za-z]+-(?<n>[0-9]+)\\]").n)? // empty')"
380
+ commits='[]'
381
+ labels='[]'
382
+ if ! command -v rt_handover_known >/dev/null 2>&1 || rt_handover_known "$head"; then
383
+ commits="$(gh api "repos/{owner}/{repo}/pulls/$number/commits?per_page=100" \
384
+ --jq '[.[] | {sha, tree: .commit.tree.sha, parents: (.parents | length)}]' 2>/dev/null)"
385
+ [ -n "$commits" ] || return 4
386
+ [ -z "$task" ] || labels="$(gh api "repos/{owner}/{repo}/issues/$task" --jq '[.labels[].name]' 2>/dev/null)"
387
+ fi
388
+ printf '%s' "$pull" | jq -c --argjson commits "$commits" --argjson labels "${labels:-[]}" \
389
+ --arg task "$task" --arg epic "${RT_BOARD_EPIC_LABEL:-}" '{
390
+ number,
391
+ commits: $commits,
392
+ head: .headRefName,
393
+ merged: (.state == "MERGED"),
394
+ closed: (.closedAt // "" | .[0:10]),
395
+ task: (if $task == "" then null else ($task | tonumber) end),
396
+ revert: (.title | startswith("Revert")),
397
+ epic: ($epic != "" and ($labels | index($epic) != null))
398
+ }'
399
+ done
400
+ }
401
+
435
402
  # What counts as reinvention in this tree. One line per "pattern<tab>replacement". The patterns are
436
403
  # narrow on purpose: the guard checks only NEW text, and a wide pattern would refuse an edit that
437
404
  # creates nothing new.
@@ -479,6 +446,7 @@ rt_docs_pair_for() { rt_docs_pair_for_default "$@"; }
479
446
  rt_lint_for() { rt_lint_for_default "$@"; }
480
447
  rt_task_branch_ok() { rt_task_branch_ok_default "$@"; }
481
448
  rt_task_branch_number() { rt_task_branch_number_default "$@"; }
449
+ rt_pull_outcomes() { rt_pull_outcomes_default "$@"; }
482
450
  rt_reinvented_in() { rt_reinvented_in_default "$@"; }
483
451
  rt_is_app_code() { rt_is_app_code_default "$@"; }
484
452
  # The directory of the rules package sources in this tree, from the root. Empty — the tree does not
@@ -0,0 +1,100 @@
1
+ #!/usr/bin/env bash
2
+ # The push set: what runs before a push, which of it is heavy, and whether the branch touched only
3
+ # texts.
4
+ #
5
+ # The package default, part of the tree profile — loaded from `project.sh`, next to which it lies. A
6
+ # separate file because together they outgrow the length limit.
7
+
8
+ # The commands that must pass before a push. One per line; the first one that fails refuses the
9
+ # push. The style linter on a separate line: the code linter does not read style files at all.
10
+ #
11
+ # The first parameter is the base: the branch against which the contribution is counted. Empty means
12
+ # there is no remote, and then everything runs: a set stricter than needed is safe, a set narrower
13
+ # than needed is not.
14
+ #
15
+ # The build runs alongside the lint and the specs. The linter does not read types, and the specs
16
+ # read only what someone brought into them by an import: a type error in uncovered code lives until
17
+ # the image build, that is, until the merge. It costs little — beyond that the runner cache works.
18
+ #
19
+ # A newly created check goes here, not only into the general run that nobody calls by themselves. A
20
+ # new line in its list of known cases leaves for the main branch silently, while the list is read as
21
+ # a working guard.
22
+ #
23
+ # The layout audit goes as the first line, for two reasons. It costs seconds, so it refuses before
24
+ # the long run begins. And before it, a drift of the laid-out copy from the package refused nothing.
25
+ # An edit put into the laid-out copy past the source breaks nothing on the day it is made, and
26
+ # surfaces on someone else's work: the layout refuses on the whole edited file and lays down not one
27
+ # other. The sign is the layout settings themselves: a tree without them does not install the
28
+ # package, and there is nothing to call in it.
29
+ #
30
+ # Whether the branch touched only texts. Zero code — only texts, otherwise — code.
31
+ #
32
+ # The sign is needed by the tree that added a heavy step to the gate set: a stand, showcase
33
+ # snapshots, image builds. Without it such a step runs every time, whatever the branch is, and the
34
+ # push of a commit that changed one line in a markdown table takes minutes. In those minutes the
35
+ # owner manages to read it as hung and refuse it. The delivery rule demands the same from the
36
+ # pipeline: a branch that touched not one line of code raises no stand, takes no frames and builds
37
+ # no images.
38
+ #
39
+ # A branch counts as textual when every touched file is either `.md` or lies under the texts
40
+ # directory. Everything else, including the harness and settings, counts as code: the sign must err
41
+ # towards an extra run, not a missed one. An empty base means there is nothing to compare with —
42
+ # then the sign stays silent and everything runs.
43
+ rt_push_docs_only_default() {
44
+ [ -z "$1" ] && return 1
45
+ changed="$(git diff --name-only "$1"...HEAD 2>/dev/null)"
46
+ [ -z "$changed" ] && return 1
47
+ printf '%s\n' "$changed" | grep -qvE "(^${RT_DOCS_DIR:-docs}/|\.md\$)" && return 1
48
+
49
+ return 0
50
+ }
51
+
52
+ # A push that edits the guards in a tree without a run file names the missing file. Without the
53
+ # file the line of the guard scenarios dropped out of the set in silence, and a push editing the
54
+ # guards ran not one scenario. The line passes rather than refuses: a tree that installs the package
55
+ # gets its guards by the layout, and every upgrade edits them. Scenario SC-AK-1248.
56
+ rt_push_hooks_gap() {
57
+ [ -n "$2" ] || return 0
58
+ [ -x "$1/$RT_HOOKS_TESTS" ] && return 0
59
+ git -C "$1" diff --name-only "$2...HEAD" 2>/dev/null | grep -q '^\.claude/hooks/' || return 0
60
+ printf '%s\n' "echo 'guard scenarios: $RT_HOOKS_TESTS is missing, the edited guards run no scenario'"
61
+ }
62
+
63
+ rt_push_checks_default() {
64
+ runner="$(rt_runner)"
65
+ root="${CLAUDE_PROJECT_DIR:-.}"
66
+ [ -f "$root/.claude/rt-kit.json" ] && printf '%s\n' "$runner agent-kit sync --check"
67
+ if [ -n "$1" ]; then
68
+ printf '%s\n' "$runner nx affected -t lint test build --base=$1"
69
+ else
70
+ printf '%s\n' "$runner nx run-many -t lint test build --all"
71
+ fi
72
+ [ -f "$root/stylelint.config.js" ] && printf '%s\n' "$runner stylelint \"**/*.scss\" --max-warnings 0"
73
+
74
+ # The guard scenarios are the same code as everything else: both the branch review and the
75
+ # confidence that the harness still works rest on them. The run takes seconds: it builds
76
+ # nothing.
77
+ [ -x "$root/$RT_HOOKS_TESTS" ] && printf '%s\n' "bash $RT_HOOKS_TESTS"
78
+ rt_push_hooks_gap "$root" "$1"
79
+
80
+ for check in check-doc-paths check-specs check-file-size check-dupes check-styles \
81
+ check-glossary check-lib-layers check-reuse check-schema-drift check-states check-state-next \
82
+ check-turn-map check-work-steps check-spec-coverage check-archive-age check-profile-drift \
83
+ check-hook-scope check-push-gate; do
84
+ [ -f "$root/$RT_CHECKS_DIR/$check.mjs" ] && printf '%s\n' "node $RT_CHECKS_DIR/$check.mjs"
85
+ done
86
+
87
+ return 0
88
+ }
89
+
90
+ # Is a check of the gate set heavy: success — it builds, raises or shoots, and costs minutes. After
91
+ # the first red check the gate still runs the light ones, so that one refusal names every red among
92
+ # them; a heavy one is not started then — its minutes buy nothing while the push is refused anyway.
93
+ # Before, the gate left on the first red, and every fix opened the next reason by a push of its own.
94
+ rt_push_check_heavy_default() {
95
+ case "$1" in
96
+ *' nx '* | *'nx affected'* | *'nx run'* | *'docker '* | *playwright* | *e2e*) return 0 ;;
97
+ esac
98
+
99
+ return 1
100
+ }
@@ -50,6 +50,10 @@ sections through the override; they merge here by heading, and a package edit do
50
50
  - **Handover** — the text that closes a session: working tree, branch, task, where the progress lies, what is done, the next step, what was special about the session. Placed outside the tree and not committed
51
51
  - **Epic** — a series of tasks on one theme in an assigned order, wider than one branch. Lives in two places: a card with the epic label and a plan next to it. Not called a work line
52
52
  - **Archive** — records of what has happened: what explains a closed decision. Not edited after the rollout
53
+ - **Mission** — what a product exists for and what changes for whom. A session only proposes a wording; the owner's approval sets it. It names no features. A milestone that serves no mission is a finding
54
+ - **Point** — a change a person can observe after a task, with a sign that shows it is reached. A is where the product stands now, B, C and D are the points of the tasks. A written rule, a merged PR and a green check are steps, not points
55
+ - **Milestone** — point G: the state of the product an epic exists for. Not a date and not a part of the work
56
+ - **Product passport** — five to seven lines fixed while planning: for whom, which problem, the main path of a person, what exists and what is unfinished
53
57
 
54
58
  ## Checks
55
59