@rt-tools/agent-kit 0.24.0 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (279) hide show
  1. package/assets/agents/business-analyst.md +51 -50
  2. package/assets/agents/conscience.md +37 -35
  3. package/assets/agents/project-manager.md +49 -48
  4. package/assets/agents/prose-editor.md +31 -29
  5. package/assets/agents/qa-engineer.md +50 -48
  6. package/assets/agents/rules-reviewer.md +63 -58
  7. package/assets/agents/skill-curator.md +83 -78
  8. package/assets/agents/spec-critic.md +34 -29
  9. package/assets/agents/spec-writer.md +35 -32
  10. package/assets/agents/strict-teacher.md +39 -37
  11. package/assets/checks/archive-age.mjs +48 -28
  12. package/assets/checks/archive-prune.mjs +16 -14
  13. package/assets/checks/board-epics.github.mjs +75 -41
  14. package/assets/checks/board-folders.mjs +61 -0
  15. package/assets/checks/board-gh.github.mjs +35 -26
  16. package/assets/checks/board-long-work.github.mjs +24 -24
  17. package/assets/checks/board-paths.github.mjs +21 -16
  18. package/assets/checks/board-runs.github.mjs +45 -43
  19. package/assets/checks/board-titles.github.mjs +19 -17
  20. package/assets/checks/board.github.mjs +149 -127
  21. package/assets/checks/check-archive-age.mjs +23 -19
  22. package/assets/checks/check-board.github.mjs +172 -164
  23. package/assets/checks/check-descriptions.mjs +30 -29
  24. package/assets/checks/check-doc-paths.mjs +91 -88
  25. package/assets/checks/check-dupes.mjs +84 -80
  26. package/assets/checks/check-file-size.mjs +74 -71
  27. package/assets/checks/check-glossary.mjs +47 -37
  28. package/assets/checks/check-hook-scope.mjs +30 -27
  29. package/assets/checks/check-lib-layers.mjs +22 -21
  30. package/assets/checks/check-profile-drift.mjs +48 -43
  31. package/assets/checks/check-prose-style.mjs +120 -37
  32. package/assets/checks/check-push-gate.mjs +53 -50
  33. package/assets/checks/check-reuse.mjs +50 -40
  34. package/assets/checks/check-schema-drift.mjs +87 -83
  35. package/assets/checks/check-specs.mjs +155 -134
  36. package/assets/checks/check-state-next.mjs +66 -52
  37. package/assets/checks/check-states.mjs +32 -30
  38. package/assets/checks/check-styles.mjs +52 -51
  39. package/assets/checks/check-turn-map.mjs +54 -46
  40. package/assets/checks/lib-boundaries.mjs +32 -30
  41. package/assets/checks/lib-common.mjs +30 -29
  42. package/assets/checks/lib-domains.mjs +34 -34
  43. package/assets/checks/lib-manifests.mjs +17 -15
  44. package/assets/checks/lib-reexports.mjs +18 -18
  45. package/assets/checks/rt-kit-checks.config.mjs +174 -142
  46. package/assets/checks/signals.mjs +43 -39
  47. package/assets/checks/spec-anchors.mjs +114 -87
  48. package/assets/checks/spec-common.mjs +128 -84
  49. package/assets/checks/spec-contract.mjs +30 -30
  50. package/assets/checks/spec-proposed.mjs +27 -24
  51. package/assets/checks/spec-scenarios.mjs +51 -28
  52. package/assets/checks/task-new.github.mjs +85 -56
  53. package/assets/commands/feedback.md +65 -59
  54. package/assets/commands/next-session.md +64 -57
  55. package/assets/commands/skill-curator.md +83 -79
  56. package/assets/defaults/gate-map.sh +108 -97
  57. package/assets/defaults/project.sh +225 -185
  58. package/assets/defaults/shell.sh +73 -68
  59. package/assets/defaults/turn-map.md +45 -44
  60. package/assets/docs/GLOSSARY.md +142 -65
  61. package/assets/hooks/browser-device-id.sh +12 -12
  62. package/assets/hooks/browser-guard-device-id.sh +30 -28
  63. package/assets/hooks/browser-guard-no-asking.sh +5 -4
  64. package/assets/hooks/browser-guard-no-listing.sh +12 -11
  65. package/assets/hooks/browser-guard-no-other-drivers.sh +48 -42
  66. package/assets/hooks/browser-guard-require-select.sh +34 -23
  67. package/assets/hooks/claim-guard.sh +62 -56
  68. package/assets/hooks/commit-msg.sh +11 -10
  69. package/assets/hooks/conscience-guard.sh +91 -45
  70. package/assets/hooks/constitution-index.sh +16 -16
  71. package/assets/hooks/deny-tail.sh +28 -26
  72. package/assets/hooks/dev-server-guard.sh +46 -43
  73. package/assets/hooks/dispatch.sh +60 -46
  74. package/assets/hooks/docs-guard.sh +100 -91
  75. package/assets/hooks/exam-guard.sh +105 -93
  76. package/assets/hooks/git-guard-delivery-conflict.sh +38 -36
  77. package/assets/hooks/git-guard-delivery-draft.sh +45 -38
  78. package/assets/hooks/git-guard-delivery-folder.sh +50 -43
  79. package/assets/hooks/git-guard-delivery-signature.sh +88 -52
  80. package/assets/hooks/git-guard-delivery.sh +196 -180
  81. package/assets/hooks/git-guard-main.sh +38 -34
  82. package/assets/hooks/git-guard-push-tests.sh +99 -87
  83. package/assets/hooks/glossary-load.sh +23 -22
  84. package/assets/hooks/grill-gate-ask.sh +12 -11
  85. package/assets/hooks/grill-gate.sh +94 -87
  86. package/assets/hooks/guard-note.sh +20 -19
  87. package/assets/hooks/handoff-entry-guard.sh +26 -24
  88. package/assets/hooks/handoff-write.sh +74 -67
  89. package/assets/hooks/hook-input.sh +67 -58
  90. package/assets/hooks/lint-after-edit.sh +95 -61
  91. package/assets/hooks/observe.sh +28 -26
  92. package/assets/hooks/override-write-guard.sh +23 -21
  93. package/assets/hooks/postmortem-guard.sh +42 -39
  94. package/assets/hooks/profile-check.sh +22 -20
  95. package/assets/hooks/proposal-guard.sh +57 -49
  96. package/assets/hooks/prose-style-guard.sh +19 -17
  97. package/assets/hooks/qa-dataid-guard.sh +52 -49
  98. package/assets/hooks/rerun-guard.sh +31 -30
  99. package/assets/hooks/reuse-first-guard.sh +108 -87
  100. package/assets/hooks/roles.sh +14 -14
  101. package/assets/hooks/rule-article.sh +36 -34
  102. package/assets/hooks/rule-source-guard.sh +47 -42
  103. package/assets/hooks/skill-gate-layers.sh +59 -57
  104. package/assets/hooks/skill-gate-rearm.sh +15 -8
  105. package/assets/hooks/skill-gate.sh +89 -81
  106. package/assets/hooks/skill-loaded.sh +6 -6
  107. package/assets/hooks/sql-guard-parse.sh +68 -66
  108. package/assets/hooks/sql-guard-request.sh +48 -46
  109. package/assets/hooks/sql-guard-target.sh +57 -51
  110. package/assets/hooks/sql-guard-write.sh +84 -79
  111. package/assets/hooks/sql-guard.sh +52 -47
  112. package/assets/hooks/stand-login-guard.sh +40 -37
  113. package/assets/hooks/task-context-load.sh +60 -55
  114. package/assets/hooks/task-flow-context.sh +87 -69
  115. package/assets/hooks/task-flow-draft-guard.sh +55 -48
  116. package/assets/hooks/task-flow-guard.sh +67 -64
  117. package/assets/hooks/turn-entry-load.sh +39 -32
  118. package/assets/hooks/turn-exit-guard.sh +256 -204
  119. package/assets/hooks/turn-exit-patterns.sh +53 -0
  120. package/assets/hooks/utf8.sh +11 -11
  121. package/assets/hooks/waiting-turn-guard.sh +94 -94
  122. package/assets/hooks/window-fill-guard.sh +70 -62
  123. package/assets/hooks/work-start-guard.sh +52 -49
  124. package/assets/hooks/write-targets.sh +96 -44
  125. package/assets/laws/autonomous-work.md +29 -27
  126. package/assets/laws/code-structure.md +31 -30
  127. package/assets/laws/delivery.md +148 -137
  128. package/assets/laws/entity-editing.md +52 -50
  129. package/assets/laws/entity-models.md +14 -13
  130. package/assets/laws/frontend-application.md +39 -38
  131. package/assets/laws/lib-imports.md +27 -27
  132. package/assets/laws/lists.md +31 -29
  133. package/assets/laws/navigation.md +37 -37
  134. package/assets/laws/observability.md +41 -40
  135. package/assets/laws/project-documentation.md +106 -99
  136. package/assets/laws/reuse-first.md +31 -29
  137. package/assets/laws/shared-code.md +27 -27
  138. package/assets/laws/verifiability.md +131 -124
  139. package/assets/laws/work-conduct.md +250 -244
  140. package/assets/patterns/admin-lists-screen.md +72 -69
  141. package/assets/patterns/admin-nav-item.md +51 -46
  142. package/assets/patterns/angular-patterns-state.md +32 -31
  143. package/assets/patterns/api-layer-pair.md +33 -31
  144. package/assets/patterns/autonomous-work-run.md +50 -49
  145. package/assets/patterns/browser-verification-measure.md +124 -88
  146. package/assets/patterns/browser-verification-stand.md +169 -157
  147. package/assets/patterns/component-structure-new.md +51 -42
  148. package/assets/patterns/dependencies-upgrade.md +55 -39
  149. package/assets/patterns/doc-style-human.md +55 -37
  150. package/assets/patterns/doc-style-sweep.md +82 -79
  151. package/assets/patterns/doc-style-trace.md +87 -81
  152. package/assets/patterns/doc-style-write.md +130 -122
  153. package/assets/patterns/entity-aside.md +77 -63
  154. package/assets/patterns/entity-models-new.md +37 -37
  155. package/assets/patterns/entity-store.md +33 -33
  156. package/assets/patterns/git-workflow-commit.azure.md +93 -86
  157. package/assets/patterns/git-workflow-commit.github.md +152 -141
  158. package/assets/patterns/git-workflow-commit.gitlab.md +95 -89
  159. package/assets/patterns/git-workflow-docker.md +165 -147
  160. package/assets/patterns/git-workflow-freshness.md +45 -45
  161. package/assets/patterns/git-workflow-merge.md +98 -93
  162. package/assets/patterns/git-workflow-migration.md +54 -52
  163. package/assets/patterns/git-workflow-pr-ready.md +57 -56
  164. package/assets/patterns/git-workflow-pr.azure.md +126 -121
  165. package/assets/patterns/git-workflow-pr.github.md +179 -175
  166. package/assets/patterns/git-workflow-pr.gitlab.md +138 -131
  167. package/assets/patterns/git-workflow-restart.md +35 -31
  168. package/assets/patterns/git-workflow-secrets.md +80 -73
  169. package/assets/patterns/git-workflow-stack.md +131 -106
  170. package/assets/patterns/lib-layers-move.md +62 -53
  171. package/assets/patterns/lib-layers-new.md +59 -45
  172. package/assets/patterns/observability-record.md +72 -67
  173. package/assets/patterns/platform-access-di.md +31 -29
  174. package/assets/patterns/reuse-first-extend.md +66 -61
  175. package/assets/patterns/shared-code-new.md +39 -38
  176. package/assets/patterns/spec-driven-domain.md +161 -151
  177. package/assets/patterns/spec-driven-rule.md +179 -168
  178. package/assets/patterns/spec-driven-sweep.md +41 -39
  179. package/assets/patterns/status-report-table.github.md +37 -36
  180. package/assets/patterns/styling-bem-component.md +42 -42
  181. package/assets/patterns/styling-bem-layout.md +39 -34
  182. package/assets/patterns/styling-bem-sheet.md +59 -58
  183. package/assets/patterns/task-flow-archive.md +222 -215
  184. package/assets/patterns/task-flow-close.md +215 -203
  185. package/assets/patterns/task-flow-handoff.md +154 -145
  186. package/assets/patterns/task-flow-resume.md +138 -133
  187. package/assets/patterns/task-flow-start.md +204 -192
  188. package/assets/patterns/testing-e2e.md +102 -101
  189. package/assets/patterns/testing-unit.md +77 -70
  190. package/assets/patterns/ts-procedure.md +32 -29
  191. package/assets/patterns/turn-entry-map.md +50 -48
  192. package/assets/pitfalls/agent-kit.md +152 -141
  193. package/assets/pitfalls/doc-style.md +96 -91
  194. package/assets/pitfalls/git-workflow.azure.md +49 -46
  195. package/assets/pitfalls/git-workflow.github.md +264 -234
  196. package/assets/pitfalls/git-workflow.gitlab.md +49 -45
  197. package/assets/pitfalls/spec-driven.md +73 -71
  198. package/assets/pitfalls/styling-bem.md +46 -40
  199. package/assets/pitfalls/task-flow.md +262 -246
  200. package/assets/pitfalls/testing.md +99 -92
  201. package/assets/pitfalls/turn-conduct.md +96 -81
  202. package/assets/rules/angular-patterns.md +81 -80
  203. package/assets/rules/api-layer.md +77 -74
  204. package/assets/rules/autonomous-work.md +75 -74
  205. package/assets/rules/browser-verification.md +223 -214
  206. package/assets/rules/component-structure.md +72 -69
  207. package/assets/rules/dependencies.md +74 -67
  208. package/assets/rules/deploy-flow.azure.md +118 -108
  209. package/assets/rules/deploy-flow.github.md +145 -135
  210. package/assets/rules/deploy-flow.gitlab.md +120 -110
  211. package/assets/rules/doc-style.md +198 -173
  212. package/assets/rules/entity-conventions.needs-admin.md +81 -79
  213. package/assets/rules/entity-models.md +73 -70
  214. package/assets/rules/git-workflow.azure.md +224 -228
  215. package/assets/rules/git-workflow.github.md +250 -239
  216. package/assets/rules/git-workflow.gitlab.md +218 -217
  217. package/assets/rules/lib-layers.md +85 -86
  218. package/assets/rules/lists.md +101 -97
  219. package/assets/rules/navigation.md +78 -78
  220. package/assets/rules/observability.needs-app.md +165 -153
  221. package/assets/rules/platform-access.md +76 -75
  222. package/assets/rules/reuse-first.md +153 -143
  223. package/assets/rules/shared-code.md +82 -79
  224. package/assets/rules/spec-driven.md +272 -260
  225. package/assets/rules/status-report.md +55 -58
  226. package/assets/rules/styling-bem.md +81 -77
  227. package/assets/rules/task-flow.md +282 -270
  228. package/assets/rules/testing.md +224 -209
  229. package/assets/rules/turn-conduct.md +255 -258
  230. package/assets/rules/turn-entry.md +92 -87
  231. package/assets/rules/typescript-conventions.md +94 -88
  232. package/assets/samples/specs/_template/spec.md +47 -47
  233. package/assets/samples/tasks/_template/grill.md +20 -20
  234. package/assets/samples/tasks/_template/plan.md +32 -30
  235. package/assets/samples/tasks/_template/progress.md +16 -16
  236. package/assets/skills/agent-kit-extend.md +129 -113
  237. package/assets/skills/agent-kit.md +235 -211
  238. package/assets/skills/write-a-skill.md +76 -71
  239. package/assets/templates/findings.md +19 -19
  240. package/assets/templates/gate-map.sh +16 -14
  241. package/assets/templates/implementation.md +28 -27
  242. package/assets/templates/pattern.md +17 -17
  243. package/assets/templates/pitfalls.md +6 -6
  244. package/assets/templates/postmortem.md +24 -23
  245. package/assets/templates/project.sh +24 -24
  246. package/assets/templates/proposal.md +62 -60
  247. package/assets/templates/rule.md +38 -38
  248. package/assets/workflows/feature.js +46 -46
  249. package/assets/workflows/plan.js +54 -54
  250. package/lib/catalog.d.ts +2 -0
  251. package/lib/catalog.d.ts.map +1 -1
  252. package/lib/catalog.js +4 -3
  253. package/lib/catalog.js.map +1 -1
  254. package/lib/commands.d.ts.map +1 -1
  255. package/lib/commands.js +5 -2
  256. package/lib/commands.js.map +1 -1
  257. package/lib/companion.js +3 -2
  258. package/lib/companion.js.map +1 -1
  259. package/lib/enroll.d.ts +7 -1
  260. package/lib/enroll.d.ts.map +1 -1
  261. package/lib/enroll.js +12 -3
  262. package/lib/enroll.js.map +1 -1
  263. package/lib/plan.d.ts +11 -0
  264. package/lib/plan.d.ts.map +1 -1
  265. package/lib/plan.js +10 -1
  266. package/lib/plan.js.map +1 -1
  267. package/lib/ship.d.ts +0 -7
  268. package/lib/ship.d.ts.map +1 -1
  269. package/lib/ship.js +10 -2
  270. package/lib/ship.js.map +1 -1
  271. package/lib/shipment.d.ts.map +1 -1
  272. package/lib/shipment.js +6 -2
  273. package/lib/shipment.js.map +1 -1
  274. package/lib/sync.d.ts.map +1 -1
  275. package/lib/sync.js +45 -11
  276. package/lib/sync.js.map +1 -1
  277. package/package.json +1 -1
  278. package/rt-tools-agent-kit-0.26.0.tgz +0 -0
  279. package/rt-tools-agent-kit-0.24.0.tgz +0 -0
@@ -2,197 +2,207 @@
2
2
  name: spec-driven-domain
3
3
  kind: pattern
4
4
  rule: spec-driven
5
- description: Паттерн правила spec-driven. Брать при заведении или правке спека домена в docs/specs — обязательные разделы, форма сценария, привязка правила к коду, порядок работы от спека к коду. Не брать для заведения закона, правила или паттерна — это паттерн spec-driven-rule.
5
+ description: Pattern of rule spec-driven. Load when creating or editing a domain spec in docs/specs — the mandatory sections, the scenario form, binding a rule to code, the order of work from spec to code. Not for creating a law, a rule or a pattern — that is pattern spec-driven-rule.
6
6
  ---
7
7
 
8
- # Спек домена
8
+ # Domain spec
9
9
 
10
- Паттерн правила `spec-driven`. Что при этом должно быть верно — закон
10
+ Pattern of the rule `spec-driven`. What must be true — the law
11
11
  `docs/constitution/project-documentation.md`.
12
12
 
13
- ## Когда брать
13
+ ## When to use
14
14
 
15
- - Заводится новый домен или фича в `proposed/`.
16
- - Правится `.proto` — спеки задетых доменов едут той же веткой.
17
- - Замечено расхождение спека с кодом.
15
+ - A new domain or a feature in `proposed/` is created.
16
+ - A `.proto` is edited — the specs of the touched domains go in the same branch.
17
+ - A divergence between a spec and the code was noticed.
18
18
 
19
- ## Раскладка
19
+ ## Layout
20
20
 
21
21
  ```
22
- docs/specs/<домен>/
23
- spec.md — как домен работает
24
- implementation.md — таблица «правило → файл:символ»
25
- scenarios.md — сценарии SC-<ПРЕФИКС>-<НОМЕР>
26
- <поддомен>/ — свой spec.md, implementation.md и scenarios.md
27
- proposed/<фича>/ — только то, чего ещё нет
22
+ docs/specs/<domain>/
23
+ spec.md — how the domain works
24
+ implementation.md — the table "rule → file:symbol"
25
+ scenarios.md — scenarios SC-<PREFIX>-<NUMBER>
26
+ <subdomain>/ — its own spec.md, implementation.md and scenarios.md
27
+ proposed/<feature>/ — only what does not exist yet
28
28
  ```
29
29
 
30
- Шаблон — `docs/specs/_template/spec.md`, указатель с префиксами — `docs/specs/README.md`.
30
+ The template is `docs/specs/_template/spec.md`, the index with prefixes is `docs/specs/README.md`.
31
31
 
32
- Поддомен спрашивается наравне с доменом: те же обязательные разделы, тот же компаньон рядом,
33
- та же связь сценариев с тестами. Домен, у которого половина поддоменов описана, а половина
34
- заведена пустыми каталогами, зелёным не бывает.
32
+ A subdomain is asked the same as a domain: the same mandatory sections, the same companion next
33
+ to it, the same link between scenarios and tests. A domain with half its subdomains described and
34
+ half created as empty directories is never green.
35
35
 
36
- Работа, задевшая домен и его поддомен, пишет две договорённости, а не одну. Префикс сценариев у
37
- поддомена свой, а второго префикса одному спеку сверка не даёт: сценарии такой работы
38
- разъезжаются по двум нумерациям — по одной на каждый спек, в который вольются. Замысел называет
39
- обе, и вливаются они порознь, каждая в свой спек.
36
+ Work that touched a domain and its subdomain writes two product agreements, not one. A subdomain
37
+ has a scenario prefix of its own, and the audit gives no spec a second prefix: the scenarios of
38
+ such work part into two numberings — one per spec they will merge into. The plan names both, and
39
+ they merge apart, each into its own spec.
40
40
 
41
- ## Обязательные разделы
41
+ ## Mandatory sections
42
42
 
43
- `## Зачем` · `## Терминология` с подразделом `### Как это называется в интерфейсе` ·
44
- `## Правила` · `## Что не входит` · `## Контракт` с подразделом `### Коды отказов` ·
45
- `## Данные` · `## Экраны и состояния` · `## Сквозные требования` с четырьмя подразделами
43
+ `## Зачем` · `## Терминология` with the subsection `### Как это называется в интерфейсе` ·
44
+ `## Правила` · `## Что не входит` · `## Контракт` with the subsection `### Коды отказов` ·
45
+ `## Данные` · `## Экраны и состояния` · `## Сквозные требования` with four subsections
46
46
  `### Локали`, `### SEO`, `### Мобильная раскладка`, `### Мультиобъектность` · `## Решения` ·
47
47
  `## Открытые вопросы` · `## История изменений`.
48
48
 
49
- Текст заголовка сверяется дословно. «Не применимо» — законный ответ, отсутствие раздела — нет.
49
+ The heading text is checked verbatim. "Not applicable" is a legitimate answer, a missing section
50
+ is not.
50
51
 
51
- `## Решения` — временное место. Решение живёт в нём, пока не найден слой, которому оно
52
- принадлежит; найденный слой забирает его пунктом, а в спеке не остаётся ничего. Разросшийся
53
- раздел читается как признак незаведённого правила, а не как свойство сложного домена: делить
54
- такой спек по строкам бесполезно, потому что делится в нём не описание домена, а ненаписанное
55
- правило.
52
+ `## Решения` is a temporary place. A decision lives in it until the layer it belongs to is found;
53
+ the found layer takes it as an item, and nothing stays in the spec. A section that has grown reads
54
+ as a sign of a rule not yet created, not as a trait of a complex domain: splitting such a spec by
55
+ lines is useless, because what splits in it is not the description of the domain but the unwritten
56
+ rule.
56
57
 
57
- **Заголовок записи раздела решений датой не называется.** Дата говорит, когда решение приняли, а
58
- раздел отвечает на «почему так, а не иначе»: по дате решение не отобрать и не найти, зато
59
- названная ею запись читается описанием прошлого и остаётся в спеке навсегда. Запись начинается с
60
- самого решения.
58
+ **The heading of a decisions-section entry is not a date.** A date says when the decision was
59
+ made, while the section answers "why so and not otherwise": a decision cannot be selected or
60
+ found by date, yet an entry named by one reads as archive and stays in the spec forever. An entry
61
+ starts with the decision itself.
61
62
 
62
- **Утверждение, стоящее в другом разделе того же спека, вторым пунктом правил не заводится.**
63
- Устройство записи живёт в разделе данных, порядок вызовов — в разделе контракта, причина
64
- существования домена — в разделе «Зачем»: все три говорят о том же, о чём говорило бы правило.
65
- Второй экземпляр расходится с первым молча, и заметить это нечем — сверка знает пункт правила
66
- против якоря, а два утверждения об одном не сравнивает никто. Решение при этом из раздела решений
67
- уезжает целиком: место, где требование живёт, найдено.
63
+ **A statement standing in another section of the same spec is not created as a second rule
64
+ item.** The structure of a record lives in the data section, the order of calls in the contract
65
+ section, the reason the domain exists in the `## Зачем` section: all three say what the rule would
66
+ say. The second copy diverges from the first silently, and there is nothing to notice it by — the
67
+ audit knows a rule item against an anchor, and nobody compares two statements about one thing.
68
+ The decision at that point leaves the decisions section whole: the place where the requirement
69
+ lives is found.
68
70
 
69
- Шапка несёт статус, дату ревизии, префикс сценариев, зависимости от других доменов, строку
70
- `**Законы:**` — законы, которые домен применяет, — и строку `**Процедуры:**` — корни либ, чьи
71
- процедуры домен обслуживает.
71
+ The header carries the status, the revision date, the scenario prefix, the dependencies on other
72
+ domains, the `**Законы:**` line — the laws the domain applies — and the `**Процедуры:**` line —
73
+ the lib roots whose procedures the domain serves.
72
74
 
73
75
  ```markdown
74
- **Зависимости:** `catalog` (состав заявки), `availability` (занятость дат)
76
+ **Зависимости:** `catalog` (booking request contents), `availability` (date occupancy)
75
77
  **Законы:** `access`, `locales`, `lists`
76
- **Процедуры:** `libs/api/<домен>`
78
+ **Процедуры:** `libs/api/<domain>`
77
79
  ```
78
80
 
79
- Закон, названный где-нибудь в тексте спека, обязан стоять в этой строке: связь сверяется в
80
- обе стороны.
81
+ A law named anywhere in the spec text must stand in this line: the link is checked both ways.
81
82
 
82
- ## Правило и его привязка
83
+ ## A rule and its binding
83
84
 
84
- Правило формулируется так, чтобы его можно было нарушить, и начинается с жирной фразы:
85
+ A rule is worded so that it can be broken, and starts with a bold phrase:
85
86
 
86
87
  ```markdown
87
- - **Применяется одна максимальная скидка.** Сложение скидок даёт цену ниже себестоимости.
88
+ - **One maximum discount is applied.** Adding discounts up gives a price below cost.
88
89
  ```
89
90
 
90
- Привязка живёт в `implementation.md` рядом, ключ связи — сам текст правила:
91
+ The binding lives in `implementation.md` next to it, and the key of the link is the rule text
92
+ itself:
91
93
 
92
94
  ```markdown
93
- | Правило | Где исполняется |
94
- | ------------------------------------- | ------------------------------------------------------------------ |
95
- | Применяется одна максимальная скидка. | `libs/api/<домен>/util/src/lib/quote.calculator.ts:calculateQuote` |
95
+ | Rule | Where it is carried out |
96
+ | -------------------------------- | ------------------------------------------------------------------ |
97
+ | One maximum discount is applied. | `libs/api/<domain>/util/src/lib/quote.calculator.ts:calculateQuote` |
96
98
  ```
97
99
 
98
- Правило, которому места в коде не нашлось, — намерение: ему место в «Открытых вопросах» как
99
- `Q-<буква закона>-<номер>`, а не формальный якорь.
100
+ A rule that found no place in code is an intention: its place is "Open questions" as
101
+ `Q-<law letter>-<number>`, not a formal anchor.
100
102
 
101
- ## Сценарий
103
+ ## Scenario
102
104
 
103
105
  ```markdown
104
- ### SC-BK-19 — подтверждение на занятые даты отбивается
106
+ ### SC-BK-19 — confirmation for occupied dates is refused
105
107
 
106
- Дано у объекта есть подтверждённая бронь на пересекающиеся даты
107
- Когда владелец подтверждает заявку
108
- Тогда отказ подаётся владельцу как занятые даты, а не как ошибка базы
108
+ Given the property has a confirmed booking on overlapping dates
109
+ When the owner confirms the booking request
110
+ Then the refusal is shown to the owner as occupied dates, not as a database error
109
111
  ```
110
112
 
111
- **«Тогда» называет один исход.** Формулировка через «либо» описывает два устройства сразу, и
112
- какое из них работает, по сценарию не узнать: сценарий зелен при любом. Развилка описывается
113
- двумя сценариями с разным «Дано» — тогда смена поведения роняет ровно тот из них, который
114
- перестал быть верным, а не проходит молча.
115
-
116
- Идентификатор ставится в начало заголовка теста, через тире. Сценарий без теста помечается
117
- `Не покрыто: <причина>`, сценарий с неполным тестом — `Покрытие: частичное — <чего не
118
- хватает>`.
119
-
120
- Сценарий, который проверить нечем в принципе, не заводится вовсе. Пометка о непокрытом говорит
121
- «теста ещё нет» и обещает, что он появится; там, где проверки не существует, обещания нет, а
122
- помеченный сценарий висит в наборе вечно, читается как долг и заставляет каждого следующего
123
- заново выяснять, не пора ли его закрыть. Правило, ради которого сценарий хотели завести,
124
- остаётся правилом: его держат строка в компаньоне и запись в истории изменений, и этого довольно.
125
-
126
- Номер в идентификаторе живёт так:
127
-
128
- | Что случилось | Что делается с номером |
129
- | ----------------------- | ---------------------------------------------------------------------------------------------------- |
130
- | сценарий добавили | берётся следующий свободный — наибольший выданный **во всех ветках** плюс один, а не дырка в середине |
131
- | обещание изменили | номер тот же, заголовок теста правится тем же коммитом |
132
- | сценарий удалили | номер остаётся пустым и новому сценарию не отдаётся; тест удаляется вместе со сценарием |
133
- | номера захотелось сжать | не пересчитываются: связь с тестами держит только номер, а прогон остаётся зелёным при обеих правках |
134
-
135
- Номер записывается так же, как у соседей в этом же файле: сверка ищет его шаблоном, и номер,
136
- записанный иначе, не совпадёт ни в спеке, ни в заголовке теста.
137
-
138
- **Свободный номер ищется во всех ветках, а не в одной главной.** Соседняя работа держит свои
139
- номера на диске и в главную ещё не въехала: шесть номеров так раздали дважды, и двигаться
140
- пришлось той работе, чья договорённость не влита. Номер — единственное, чем сценарий связан с
141
- тестом, и отданный второй раз он оставляет старую ссылку правильной на вид и ведущей не туда.
142
-
143
- Спрашивается это командой дерева, если дерево её завело: она читает заголовки сценариев во всех
144
- ветках — своих и удалённых — и печатает первый свободный за наибольшим занятым. Имя команды
145
- называет компаньон правила.
146
-
147
- ## Порядок работы
148
-
149
- 1. Задача заводится сценариями: что станет верно, когда работа закончится.
150
- 2. Спек домена (или `proposed/<фича>/`) правится **до** кода.
151
- 3. Код пишется под сценарии, тесты называются их идентификаторами.
152
- 4. `npm run check:specs` — до пуша.
153
- 5. Приёмка идёт по сценариям, а не по пересказу правки.
154
-
155
- Правило, обещающее человеку видимый результат, подтверждается на работающем приложении, а не
156
- выводом из графа вызовов. Чтением подтверждаются заголовки, связь с привязками и форма данных;
157
- правило, которое подтвердить не на чем, уезжает открытым вопросом и утверждением не пишется.
158
-
159
- ## Частые промахи
160
-
161
- - Выросший домен делят на новые домены, а не на поддомены: новый домен приходится заводить в
162
- указателе, сверять с кодом отдельно и объяснять, чем он соседу не поддомен, — а поддомен
163
- остаётся в своём домене и наследует его контракт. Соседний домен заводится только тогда,
164
- когда предмет живёт своей сущностью. Границу проводит владелец: деление переписывает номера
165
- во всех заголовках тестов домена, и вернуть его назад тем же движением нельзя.
166
- - Счётчик правил или сценариев в указателе доменов: он пересчитывается при каждой правке
167
- любого спека, и через год большая часть таких чисел молча описывает позавчерашний спек.
168
- Указатель держит домен, префикс и одну строку «о чём».
169
- - `tasks.md` в спеке: шаги — артефакт сессии, им место в ветке или в описании PR.
170
- - Скопированная из контракта таблица полей: источник — `libs/common/proto/proto/<область>/v1/`,
171
- и компилируется из двух только одна.
172
- - Колонки и индексы в спеке: они в `prisma/schema.prisma`, а в спеке остаётся правило, которое
173
- ограничение выражает.
174
- - Место, где правило исполняется, внутри текста правила: оно меняется при первом рефакторинге,
175
- и для него заведён `implementation.md`.
176
- - Пометка «Не покрыто» при существующем тесте — отказ: долг закрыли, а отметку не сняли.
177
- - Пометка «Не покрыто» читается дословно и с начала строки. Любое слово между ней и двоеточием
178
- — «Не покрыто, и прогоном не покрывается вовсе: …» — и сценарий считается непомеченным вовсе,
179
- а причина, ради которой пометку и писали, до PR не доезжает.
180
- - Закон, названный в тексте, но забытый в строке `**Законы:**`: по закону тогда не узнать,
181
- какие домены на нём стоят.
182
- - Правка `.proto` без спеков задетых доменов: `docs-guard` отбивает такой коммит.
183
- - **Правило, выведенное из графа вызовов, ошибается беззвучно.** Читается оно так же уверенно,
184
- как замеренное, и сверка привязки его пропускает — символ на месте, просто описывает он не то.
185
- Два правила одного спека оказались перевёрнутыми: связь шла не между хранилищами, а через
186
- слушающий их компонент, — и оба чуть не стали задачей на дефект, которого нет.
187
-
188
- - **Выросший домен делится на поддомены, а не на новые домены.** Новый домен пришлось бы
189
- заводить в указателе, сверять с кодом отдельно и объяснять, чем он соседу не поддомен;
190
- поддомен остаётся в своём домене и наследует его контракт. Соседний домен заводится только
191
- тогда, когда предмет живёт своей сущностью.
192
- - **Наибольший выданный номер ищется по всему домену командой, а не глазами по хвосту файла.**
193
- Номера в файле сценариев идут не по порядку: правки вставляли их к соседям по смыслу, и
194
- последняя строка максимума не показывает. Шесть новых номеров из одиннадцати легли на занятые
195
- — поймала это сверка спеков, а не чтение, и переписывать пришлось заодно заголовки тестов.
196
- - **Границу между доменами проводит владелец, а не автор очередной правки.** Автор видит свою
197
- правку, а не то, чем предмет обрастёт: домен, заведённый по ходу дела, через месяц оказывается
198
- половиной соседнего, и разводить их приходится вместе с номерами сценариев.
113
+ **"Then" names one outcome.** A wording through "either … or" describes two structures at once,
114
+ and the scenario gives no way to learn which one works: it is green under either. A fork is
115
+ described by two scenarios with different "Given" — then a change of behaviour fails exactly the
116
+ one that stopped being true, instead of passing silently.
117
+
118
+ The identifier is put at the start of the test title, followed by a dash. A scenario without a
119
+ test is marked `Не покрыто: <reason>`, a scenario with an incomplete test — `Покрытие: частичное
120
+ — <what is missing>`.
121
+
122
+ A scenario that cannot be checked by anything at all is not created. The "not covered" mark says
123
+ "there is no test yet" and promises one will appear; where no check exists, there is no promise,
124
+ and the marked scenario hangs in the suite forever, reads as debt and makes every next reader
125
+ find out anew whether it is time to close it. The rule the scenario was meant for stays a rule:
126
+ it is held by the line in the companion and the entry in the change history, and that is enough.
127
+
128
+ The number in the identifier lives like this:
129
+
130
+ | What happened | What is done with the number |
131
+ | ------------------------- | ----------------------------------------------------------------------------------------------------------- |
132
+ | a scenario was added | the next free one is taken — the largest issued **across all branches** plus one, not a gap in the middle |
133
+ | the promise changed | the number stays, the test title is edited by the same commit |
134
+ | a scenario was deleted | the number stays empty and is not given to a new scenario; the test is deleted with the scenario |
135
+ | the numbers looked worth compacting | they are not renumbered: only the number ties them to the tests, and the run stays green under both edits |
136
+
137
+ The number is written the same way as its neighbours' in the same file: the audit looks for it by
138
+ a pattern, and a number written differently matches neither in the spec nor in the test title.
139
+
140
+ **A free number is looked for across all branches, not in the main one alone.** Neighbouring work
141
+ keeps its numbers on disk and has not reached main yet: six numbers were issued twice this way,
142
+ and the work whose agreement was not merged had to move. The number is the only thing tying a
143
+ scenario to its test, and issued a second time it leaves the old reference looking right and
144
+ leading elsewhere.
145
+
146
+ This is asked by a tree command, if the tree created one: it reads scenario headings across all
147
+ branches — local and remote — and prints the first free number past the largest taken. The
148
+ command's name is given by the rule's companion.
149
+
150
+ ## Order of work
151
+
152
+ 1. A task is created by scenarios: what will become true when the work is finished.
153
+ 2. The domain spec (or `proposed/<feature>/`) is edited **before** the code.
154
+ 3. The code is written to the scenarios, and the tests are named by their identifiers.
155
+ 4. `npm run check:specs` — before the push.
156
+ 5. Acceptance goes by the scenarios, not by a retelling of the edit.
157
+
158
+ A rule promising a result a person sees is confirmed on the running application, not by
159
+ inference from the call graph. Reading confirms headings, the link to bindings and the shape of
160
+ data; a rule with nothing to confirm it on leaves as an open question and is not written as a
161
+ statement.
162
+
163
+ ## Common misses
164
+
165
+ - A grown domain is split into new domains instead of subdomains: a new domain has to be entered
166
+ in the index, audited against the code separately and explained as to why it is not a subdomain
167
+ of its neighbour — while a subdomain stays in its domain and inherits its contract. A
168
+ neighbouring domain is created only when the subject lives as an entity of its own. The
169
+ boundary is drawn by the owner: a split rewrites the numbers in all the domain's test titles,
170
+ and it cannot be put back by the same move.
171
+ - A count of rules or scenarios in the domain index: it is recomputed at every edit of any spec,
172
+ and a year later most such numbers silently describe the spec of the day before yesterday. The
173
+ index holds the domain, the prefix and one line of "what it is about".
174
+ - `tasks.md` in a spec: steps are a session artefact; their place is the branch or the PR
175
+ description.
176
+ - A field table copied from the contract: the source is `libs/common/proto/proto/<area>/v1/`,
177
+ and only one of the two compiles.
178
+ - Columns and indexes in a spec: they are in `prisma/schema.prisma`, and the spec keeps the rule
179
+ the constraint expresses.
180
+ - The place where a rule is carried out inside the rule text: it changes at the first
181
+ refactoring, and `implementation.md` exists for it.
182
+ - A `Не покрыто` mark with an existing test is a refusal: the debt was closed, and the mark was
183
+ not removed.
184
+ - The `Не покрыто` mark is read verbatim and from the start of the line. Any word between it and
185
+ the colon — `Не покрыто, и прогоном не покрывается вовсе: …` — and the scenario counts as not
186
+ marked at all, and the reason the mark was written for never reaches the PR.
187
+ - A law named in the text but forgotten in the `**Законы:**` line: then the law gives no way to
188
+ learn which domains stand on it.
189
+ - A `.proto` edit without the specs of the touched domains: `docs-guard` refuses such a commit.
190
+ - **A rule inferred from the call graph errs silently.** It reads as confidently as a measured
191
+ one, and the binding audit lets it through — the symbol is in place, it just describes the wrong
192
+ thing. Two rules of one spec turned out inverted: the link went not between the stores but
193
+ through the component listening to them — and both nearly became a task for a defect that does
194
+ not exist.
195
+
196
+ - **A grown domain splits into subdomains, not into new domains.** A new domain would have to be
197
+ entered in the index, audited against the code separately and explained as to why it is not a
198
+ subdomain of its neighbour; a subdomain stays in its domain and inherits its contract. A
199
+ neighbouring domain is created only when the subject lives as an entity of its own.
200
+ - **The largest issued number is looked for across the whole domain by a command, not by eye at
201
+ the tail of the file.** Numbers in the scenarios file are out of order: edits inserted them next
202
+ to their neighbours by meaning, and the last line does not show the maximum. Six new numbers out
203
+ of eleven landed on taken ones — the spec audit caught it, not reading, and the test titles had
204
+ to be rewritten along the way.
205
+ - **The boundary between domains is drawn by the owner, not by the author of the next edit.** The
206
+ author sees their edit, not what the subject will grow into: a domain created along the way
207
+ turns out a month later to be half of its neighbour, and parting them means parting the scenario
208
+ numbers too.