@rt-tools/agent-kit 0.23.0 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (288) hide show
  1. package/README.md +8 -2
  2. package/assets/agents/business-analyst.md +51 -50
  3. package/assets/agents/conscience.md +37 -35
  4. package/assets/agents/project-manager.md +49 -48
  5. package/assets/agents/prose-editor.md +31 -29
  6. package/assets/agents/qa-engineer.md +50 -48
  7. package/assets/agents/rules-reviewer.md +63 -58
  8. package/assets/agents/skill-curator.md +83 -78
  9. package/assets/agents/spec-critic.md +34 -29
  10. package/assets/agents/spec-writer.md +35 -32
  11. package/assets/agents/strict-teacher.md +39 -37
  12. package/assets/checks/archive-age.mjs +48 -28
  13. package/assets/checks/archive-prune.mjs +16 -14
  14. package/assets/checks/board-epics.github.mjs +75 -41
  15. package/assets/checks/board-folders.mjs +61 -0
  16. package/assets/checks/board-gh.github.mjs +35 -26
  17. package/assets/checks/board-long-work.github.mjs +24 -24
  18. package/assets/checks/board-paths.github.mjs +21 -16
  19. package/assets/checks/board-runs.github.mjs +45 -43
  20. package/assets/checks/board-titles.github.mjs +19 -17
  21. package/assets/checks/board.github.mjs +150 -128
  22. package/assets/checks/check-archive-age.mjs +23 -19
  23. package/assets/checks/check-board.github.mjs +179 -157
  24. package/assets/checks/check-descriptions.mjs +30 -29
  25. package/assets/checks/check-doc-paths.mjs +104 -82
  26. package/assets/checks/check-dupes.mjs +84 -80
  27. package/assets/checks/check-file-size.mjs +79 -70
  28. package/assets/checks/check-glossary.mjs +47 -37
  29. package/assets/checks/check-hook-scope.mjs +30 -27
  30. package/assets/checks/check-lib-layers.mjs +22 -21
  31. package/assets/checks/check-profile-drift.mjs +48 -43
  32. package/assets/checks/check-prose-style.mjs +125 -33
  33. package/assets/checks/check-push-gate.mjs +53 -50
  34. package/assets/checks/check-reuse.mjs +50 -40
  35. package/assets/checks/check-schema-drift.mjs +87 -83
  36. package/assets/checks/check-specs.mjs +155 -134
  37. package/assets/checks/check-state-next.mjs +66 -52
  38. package/assets/checks/check-states.mjs +32 -30
  39. package/assets/checks/check-styles.mjs +52 -51
  40. package/assets/checks/check-turn-map.mjs +54 -46
  41. package/assets/checks/lib-boundaries.mjs +32 -30
  42. package/assets/checks/lib-common.mjs +30 -29
  43. package/assets/checks/lib-domains.mjs +34 -34
  44. package/assets/checks/lib-manifests.mjs +17 -15
  45. package/assets/checks/lib-reexports.mjs +18 -18
  46. package/assets/checks/rt-kit-checks.config.mjs +174 -142
  47. package/assets/checks/signals.mjs +43 -39
  48. package/assets/checks/spec-anchors.mjs +114 -87
  49. package/assets/checks/spec-common.mjs +128 -84
  50. package/assets/checks/spec-contract.mjs +30 -30
  51. package/assets/checks/spec-proposed.mjs +27 -24
  52. package/assets/checks/spec-scenarios.mjs +51 -28
  53. package/assets/checks/task-new.github.mjs +85 -56
  54. package/assets/commands/feedback.md +65 -59
  55. package/assets/commands/next-session.md +64 -57
  56. package/assets/commands/skill-curator.md +83 -79
  57. package/assets/defaults/gate-map.sh +115 -91
  58. package/assets/defaults/project.sh +228 -178
  59. package/assets/defaults/shell.sh +85 -65
  60. package/assets/defaults/turn-map.md +45 -44
  61. package/assets/docs/GLOSSARY.md +142 -65
  62. package/assets/hooks/browser-device-id.sh +12 -12
  63. package/assets/hooks/browser-guard-device-id.sh +46 -14
  64. package/assets/hooks/browser-guard-no-asking.sh +5 -4
  65. package/assets/hooks/browser-guard-no-listing.sh +12 -11
  66. package/assets/hooks/browser-guard-no-other-drivers.sh +48 -42
  67. package/assets/hooks/browser-guard-require-select.sh +34 -23
  68. package/assets/hooks/claim-guard.sh +62 -56
  69. package/assets/hooks/commit-msg.sh +11 -10
  70. package/assets/hooks/conscience-guard.sh +91 -45
  71. package/assets/hooks/constitution-index.sh +16 -16
  72. package/assets/hooks/deny-tail.sh +28 -26
  73. package/assets/hooks/dev-server-guard.sh +46 -43
  74. package/assets/hooks/dispatch.sh +84 -39
  75. package/assets/hooks/docs-guard.sh +105 -86
  76. package/assets/hooks/exam-guard.sh +146 -84
  77. package/assets/hooks/git-guard-delivery-conflict.sh +38 -36
  78. package/assets/hooks/git-guard-delivery-draft.sh +85 -0
  79. package/assets/hooks/git-guard-delivery-folder.sh +50 -43
  80. package/assets/hooks/git-guard-delivery-signature.sh +88 -52
  81. package/assets/hooks/git-guard-delivery.sh +207 -253
  82. package/assets/hooks/git-guard-main.sh +65 -26
  83. package/assets/hooks/git-guard-push-tests.sh +133 -75
  84. package/assets/hooks/glossary-load.sh +23 -22
  85. package/assets/hooks/grill-gate-ask.sh +12 -11
  86. package/assets/hooks/grill-gate.sh +94 -87
  87. package/assets/hooks/guard-note.sh +20 -19
  88. package/assets/hooks/handoff-entry-guard.sh +26 -24
  89. package/assets/hooks/handoff-write.sh +74 -67
  90. package/assets/hooks/hook-input.sh +70 -50
  91. package/assets/hooks/lint-after-edit.sh +95 -61
  92. package/assets/hooks/observe.sh +28 -26
  93. package/assets/hooks/override-write-guard.sh +23 -21
  94. package/assets/hooks/postmortem-guard.sh +42 -39
  95. package/assets/hooks/profile-check.sh +22 -20
  96. package/assets/hooks/proposal-guard.sh +57 -49
  97. package/assets/hooks/prose-style-guard.sh +19 -17
  98. package/assets/hooks/qa-dataid-guard.sh +52 -49
  99. package/assets/hooks/rerun-guard.sh +31 -30
  100. package/assets/hooks/reuse-first-guard.sh +108 -87
  101. package/assets/hooks/roles.sh +14 -14
  102. package/assets/hooks/rule-article.sh +36 -34
  103. package/assets/hooks/rule-source-guard.sh +52 -36
  104. package/assets/hooks/skill-gate-layers.sh +59 -57
  105. package/assets/hooks/skill-gate-rearm.sh +15 -8
  106. package/assets/hooks/skill-gate.sh +89 -81
  107. package/assets/hooks/skill-loaded.sh +6 -6
  108. package/assets/hooks/sql-guard-parse.sh +68 -66
  109. package/assets/hooks/sql-guard-request.sh +48 -46
  110. package/assets/hooks/sql-guard-target.sh +57 -51
  111. package/assets/hooks/sql-guard-write.sh +84 -79
  112. package/assets/hooks/sql-guard.sh +52 -47
  113. package/assets/hooks/stand-login-guard.sh +104 -0
  114. package/assets/hooks/task-context-load.sh +60 -55
  115. package/assets/hooks/task-flow-context.sh +87 -69
  116. package/assets/hooks/task-flow-draft-guard.sh +55 -48
  117. package/assets/hooks/task-flow-guard.sh +67 -64
  118. package/assets/hooks/turn-entry-load.sh +39 -32
  119. package/assets/hooks/turn-exit-guard.sh +256 -204
  120. package/assets/hooks/turn-exit-patterns.sh +53 -0
  121. package/assets/hooks/utf8.sh +11 -11
  122. package/assets/hooks/waiting-turn-guard.sh +94 -94
  123. package/assets/hooks/window-fill-guard.sh +70 -62
  124. package/assets/hooks/work-start-guard.sh +52 -49
  125. package/assets/hooks/write-targets.sh +115 -30
  126. package/assets/laws/autonomous-work.md +29 -27
  127. package/assets/laws/code-structure.md +31 -30
  128. package/assets/laws/delivery.md +148 -137
  129. package/assets/laws/entity-editing.md +52 -50
  130. package/assets/laws/entity-models.md +14 -13
  131. package/assets/laws/frontend-application.md +39 -38
  132. package/assets/laws/lib-imports.md +27 -27
  133. package/assets/laws/lists.md +31 -29
  134. package/assets/laws/navigation.md +37 -37
  135. package/assets/laws/observability.md +41 -40
  136. package/assets/laws/project-documentation.md +106 -99
  137. package/assets/laws/reuse-first.md +31 -29
  138. package/assets/laws/shared-code.md +27 -27
  139. package/assets/laws/verifiability.md +131 -114
  140. package/assets/laws/work-conduct.md +250 -250
  141. package/assets/patterns/admin-lists-screen.md +72 -69
  142. package/assets/patterns/admin-nav-item.md +51 -46
  143. package/assets/patterns/angular-patterns-state.md +32 -31
  144. package/assets/patterns/api-layer-pair.md +33 -31
  145. package/assets/patterns/autonomous-work-run.md +50 -49
  146. package/assets/patterns/browser-verification-measure.md +143 -67
  147. package/assets/patterns/browser-verification-stand.md +181 -128
  148. package/assets/patterns/component-structure-new.md +51 -42
  149. package/assets/patterns/dependencies-upgrade.md +55 -39
  150. package/assets/patterns/doc-style-human.md +93 -0
  151. package/assets/patterns/doc-style-sweep.md +82 -79
  152. package/assets/patterns/doc-style-trace.md +87 -81
  153. package/assets/patterns/doc-style-write.md +130 -122
  154. package/assets/patterns/entity-aside.md +77 -63
  155. package/assets/patterns/entity-models-new.md +37 -37
  156. package/assets/patterns/entity-store.md +33 -33
  157. package/assets/patterns/git-workflow-commit.azure.md +94 -75
  158. package/assets/patterns/git-workflow-commit.github.md +153 -129
  159. package/assets/patterns/git-workflow-commit.gitlab.md +96 -78
  160. package/assets/patterns/git-workflow-docker.md +165 -147
  161. package/assets/patterns/git-workflow-freshness.md +45 -45
  162. package/assets/patterns/git-workflow-merge.md +99 -86
  163. package/assets/patterns/git-workflow-migration.md +54 -52
  164. package/assets/patterns/git-workflow-pr-ready.md +57 -56
  165. package/assets/patterns/git-workflow-pr.azure.md +126 -121
  166. package/assets/patterns/git-workflow-pr.github.md +179 -175
  167. package/assets/patterns/git-workflow-pr.gitlab.md +138 -131
  168. package/assets/patterns/git-workflow-restart.md +35 -31
  169. package/assets/patterns/git-workflow-secrets.md +80 -73
  170. package/assets/patterns/git-workflow-stack.md +131 -106
  171. package/assets/patterns/lib-layers-move.md +62 -53
  172. package/assets/patterns/lib-layers-new.md +59 -45
  173. package/assets/patterns/observability-record.md +72 -67
  174. package/assets/patterns/platform-access-di.md +31 -29
  175. package/assets/patterns/reuse-first-extend.md +66 -61
  176. package/assets/patterns/shared-code-new.md +39 -38
  177. package/assets/patterns/spec-driven-domain.md +161 -151
  178. package/assets/patterns/spec-driven-rule.md +179 -168
  179. package/assets/patterns/spec-driven-sweep.md +41 -39
  180. package/assets/patterns/status-report-table.github.md +37 -36
  181. package/assets/patterns/styling-bem-component.md +42 -42
  182. package/assets/patterns/styling-bem-layout.md +39 -34
  183. package/assets/patterns/styling-bem-sheet.md +59 -58
  184. package/assets/patterns/task-flow-archive.md +222 -215
  185. package/assets/patterns/task-flow-close.md +215 -203
  186. package/assets/patterns/task-flow-handoff.md +154 -145
  187. package/assets/patterns/task-flow-resume.md +138 -133
  188. package/assets/patterns/task-flow-start.md +204 -192
  189. package/assets/patterns/testing-e2e.md +103 -92
  190. package/assets/patterns/testing-unit.md +77 -70
  191. package/assets/patterns/ts-procedure.md +32 -29
  192. package/assets/patterns/turn-entry-map.md +50 -48
  193. package/assets/pitfalls/agent-kit.md +152 -141
  194. package/assets/pitfalls/doc-style.md +96 -91
  195. package/assets/pitfalls/git-workflow.azure.md +49 -46
  196. package/assets/pitfalls/git-workflow.github.md +264 -234
  197. package/assets/pitfalls/git-workflow.gitlab.md +49 -45
  198. package/assets/pitfalls/spec-driven.md +73 -71
  199. package/assets/pitfalls/styling-bem.md +46 -40
  200. package/assets/pitfalls/task-flow.md +262 -246
  201. package/assets/pitfalls/testing.md +99 -92
  202. package/assets/pitfalls/turn-conduct.md +96 -81
  203. package/assets/rules/angular-patterns.md +81 -80
  204. package/assets/rules/api-layer.md +77 -74
  205. package/assets/rules/autonomous-work.md +75 -74
  206. package/assets/rules/browser-verification.md +223 -188
  207. package/assets/rules/component-structure.md +72 -69
  208. package/assets/rules/dependencies.md +74 -67
  209. package/assets/rules/deploy-flow.azure.md +118 -108
  210. package/assets/rules/deploy-flow.github.md +145 -135
  211. package/assets/rules/deploy-flow.gitlab.md +120 -110
  212. package/assets/rules/doc-style.md +209 -148
  213. package/assets/rules/entity-conventions.needs-admin.md +81 -79
  214. package/assets/rules/entity-models.md +73 -70
  215. package/assets/rules/git-workflow.azure.md +224 -228
  216. package/assets/rules/git-workflow.github.md +250 -242
  217. package/assets/rules/git-workflow.gitlab.md +218 -217
  218. package/assets/rules/lib-layers.md +85 -86
  219. package/assets/rules/lists.md +101 -97
  220. package/assets/rules/navigation.md +78 -78
  221. package/assets/rules/observability.needs-app.md +165 -153
  222. package/assets/rules/platform-access.md +76 -75
  223. package/assets/rules/reuse-first.md +153 -137
  224. package/assets/rules/shared-code.md +82 -79
  225. package/assets/rules/spec-driven.md +272 -260
  226. package/assets/rules/status-report.md +55 -58
  227. package/assets/rules/styling-bem.md +83 -72
  228. package/assets/rules/task-flow.md +282 -270
  229. package/assets/rules/testing.md +224 -188
  230. package/assets/rules/turn-conduct.md +255 -258
  231. package/assets/rules/turn-entry.md +92 -87
  232. package/assets/rules/typescript-conventions.md +94 -88
  233. package/assets/samples/specs/_template/spec.md +47 -47
  234. package/assets/samples/tasks/_template/grill.md +20 -20
  235. package/assets/samples/tasks/_template/plan.md +32 -30
  236. package/assets/samples/tasks/_template/progress.md +16 -16
  237. package/assets/skills/agent-kit-extend.md +129 -113
  238. package/assets/skills/agent-kit.md +236 -222
  239. package/assets/skills/write-a-skill.md +76 -71
  240. package/assets/templates/findings.md +19 -19
  241. package/assets/templates/gate-map.sh +16 -14
  242. package/assets/templates/implementation.md +28 -27
  243. package/assets/templates/pattern.md +17 -17
  244. package/assets/templates/pitfalls.md +6 -6
  245. package/assets/templates/postmortem.md +24 -23
  246. package/assets/templates/project.sh +24 -24
  247. package/assets/templates/proposal.md +62 -60
  248. package/assets/templates/rule.md +38 -38
  249. package/assets/workflows/feature.js +46 -46
  250. package/assets/workflows/plan.js +54 -54
  251. package/lib/catalog.d.ts +2 -0
  252. package/lib/catalog.d.ts.map +1 -1
  253. package/lib/catalog.js +4 -3
  254. package/lib/catalog.js.map +1 -1
  255. package/lib/commands.d.ts.map +1 -1
  256. package/lib/commands.js +68 -4
  257. package/lib/commands.js.map +1 -1
  258. package/lib/companion.js +3 -2
  259. package/lib/companion.js.map +1 -1
  260. package/lib/enroll.d.ts +7 -1
  261. package/lib/enroll.d.ts.map +1 -1
  262. package/lib/enroll.js +13 -4
  263. package/lib/enroll.js.map +1 -1
  264. package/lib/observations.d.ts +10 -1
  265. package/lib/observations.d.ts.map +1 -1
  266. package/lib/observations.js +1 -0
  267. package/lib/observations.js.map +1 -1
  268. package/lib/override-marks.d.ts +24 -0
  269. package/lib/override-marks.d.ts.map +1 -0
  270. package/lib/override-marks.js +98 -0
  271. package/lib/override-marks.js.map +1 -0
  272. package/lib/plan.d.ts +11 -0
  273. package/lib/plan.d.ts.map +1 -1
  274. package/lib/plan.js +10 -1
  275. package/lib/plan.js.map +1 -1
  276. package/lib/ship.d.ts +0 -7
  277. package/lib/ship.d.ts.map +1 -1
  278. package/lib/ship.js +10 -2
  279. package/lib/ship.js.map +1 -1
  280. package/lib/shipment.d.ts.map +1 -1
  281. package/lib/shipment.js +7 -3
  282. package/lib/shipment.js.map +1 -1
  283. package/lib/sync.d.ts.map +1 -1
  284. package/lib/sync.js +45 -11
  285. package/lib/sync.js.map +1 -1
  286. package/package.json +1 -1
  287. package/rt-tools-agent-kit-0.26.0.tgz +0 -0
  288. package/rt-tools-agent-kit-0.23.0.tgz +0 -0
@@ -2,98 +2,107 @@
2
2
  name: lib-layers-move
3
3
  kind: pattern
4
4
  rule: lib-layers
5
- description: Паттерн правила lib-layers. Брать при переносе кода или символа между либами — с чего начинать, в каком порядке двигать домены, что делать с границами, импортами и README обеих либ, и чем проверять. Заведение и удаление самой либы — паттерн lib-layers-new.
5
+ description: Pattern of rule lib-layers. Load when moving code or a symbol between libs — where to start, in which order to move domains, what to do with boundaries, imports and the README of both libs, and what to check with. Creating and removing a lib itself — pattern lib-layers-new.
6
6
  ---
7
7
 
8
- # Перенести код между либами
8
+ # Moving code between libs
9
9
 
10
- Паттерн правила `lib-layers`. Что при этом должно быть верно — закон
10
+ Pattern of the rule `lib-layers`. What must be true — the law
11
11
  `docs/constitution/lib-imports.md`.
12
12
 
13
- ## Когда брать
13
+ ## When to use
14
14
 
15
- - Символ переезжает из одной либы в другую.
16
- - Домен переносится в новую раскладку.
17
- - Общий код собирается из копий в одно место.
15
+ - A symbol moves from one lib to another.
16
+ - A domain is moved into a new layout.
17
+ - Shared code is collected from copies into one place.
18
18
 
19
- ## Начинать с `docs/plans/`
19
+ ## Start with `docs/plans/`
20
20
 
21
21
  ```bash
22
- grep -rn "<имя либы>" docs/
22
+ grep -rn "<lib name>" docs/
23
23
  ```
24
24
 
25
- Решение о том, куда переезжает код, часто уже принято и записано, а принятое заново с ним
26
- расходится. Перенос утилит списка из-за этого делался дважды: первая редакция положила их в
27
- `libs/common/util`, что запрещено первым же пунктом того самого плана, и её пришлось
28
- откатывать целиком.
25
+ The decision about where the code moves is often already made and written down, and one made
26
+ anew drifts from it. That is why the move of the list utilities was done twice: the first edition
27
+ put them into `libs/common/util`, which the very first item of that same plan forbids, and it had
28
+ to be rolled back whole.
29
29
 
30
- ## Порядок задаёт граф зависимостей, а не список в плане
30
+ ## The order is set by the dependency graph, not by the list in the plan
31
31
 
32
- Домен переносится после всех, от кого он зависит. Списки доменов в планах отсортированы по
33
- важности, и следование им в лоб заставляет временно расширять границы.
32
+ A domain is moved after everyone it depends on. Domain lists in plans are sorted by importance,
33
+ and following them head-on forces the boundaries to be widened for a while.
34
34
 
35
35
  ```bash
36
- grep -rn "@<область>/<семья>/<домен>" libs/ apps/ | sed 's/:.*//' | sort -u
36
+ grep -rn "@<scope>/<family>/<domain>" libs/ apps/ | sed 's/:.*//' | sort -u
37
37
  ```
38
38
 
39
- Рёбра выписываются грепом по алиасам домена и сортируются топологически. Каждая временная
40
- строка в границах — это ослабленная механическая проверка, ради которой нарезка и затевалась.
39
+ The edges are written out by grepping the domain aliases and sorted topologically. Every
40
+ temporary line in the boundaries is a weakened mechanical check — the one the cutting was started
41
+ for.
41
42
 
42
- ## Куда именно кладётся общее
43
+ ## Where exactly the shared goes
43
44
 
44
- Своя либа заводится тогда, когда ни одна существующая код не видит.
45
+ A lib of its own is created when no existing lib sees the code.
45
46
 
46
- | Кому нужно | Куда |
47
- | -------------------------------------- | ----------------------------------------------------------- |
48
- | бэкенду или обоим фронтам, без Angular | `libs/common/util` |
49
- | только фронтам, тянет Angular | `common/platform` — сервис и токен, `common/ui` — компонент |
50
- | предмету, у которого уже есть либа | в неё: `site-routing`, `i18n`, `photo`, `captcha` |
51
- | всем доменам одной семьи | основание семейства `<семья>/core` |
52
- | всему бэкенду | тот слой `util`, что уже перечислен у каждого домена |
47
+ | Who needs it | Where |
48
+ | ----------------------------------------------- | ----------------------------------------------------------- |
49
+ | the backend or both frontends, without Angular | `libs/common/util` |
50
+ | the frontends only, pulls Angular | `common/platform` — a service and a token, `common/ui` — a component |
51
+ | a subject that already has a lib | into it: `site-routing`, `i18n`, `photo`, `captcha` |
52
+ | every domain of one family | the family base `<family>/core` |
53
+ | the whole backend | the `util` layer already listed with every domain |
53
54
 
54
- Новых строк в границах при таком переезде не появляется — кроме права видеть контракт, если
55
- код его читает.
55
+ No new lines appear in the boundaries with such a move — except the right to see the contract,
56
+ if the code reads it.
56
57
 
57
- ## После переезда
58
+ ## After the move
58
59
 
59
- 1. **README обеих либ.** У той, откуда файл ушёл, и у той, куда пришёл: README перечисляет, что
60
- в либе лежит и кто её зовёт. Ни одна проверка эти тексты не читает.
61
- 2. **Порядок импортов.** Переезд алиаса его ломает, и приходит это ошибкой `prettier/prettier`
62
- из линта, а не из сборки:
60
+ 1. **The README of both libs.** The one the file left and the one it came to: the README lists
61
+ what lies in the lib and who calls it. No check reads these texts.
62
+ 2. **Import order.** Moving an alias breaks it, and it arrives as a `prettier/prettier` error
63
+ from the lint, not from the build:
63
64
 
64
65
  ```bash
65
66
  npx nx lint <project> --fix
66
67
  ```
67
68
 
68
- Флага `--fix` нет у `test` и `build`, поэтому в `run-many -t lint test` его передавать
69
- нельзя — падает весь вызов.
69
+ `test` and `build` have no `--fix` flag, so it cannot be passed to `run-many -t lint test` —
70
+ the whole call fails.
70
71
 
71
- 3. **Линт по всем затронутым проектам, а не по одному приложению.** Скрипт ошибается молча и не
72
- так, как человек: строка импорта не переписывается, а исчезает целиком. При переносе утилит
73
- списка так пропали импорты в шести файлах из восьми, и нашёл их прогон по списку проектов —
74
- сборка одного приложения до этих файлов не дошла.
72
+ 3. **Lint over all touched projects, not over one application.** The script errs silently and
73
+ not the way a person does: the import line is not rewritten, it disappears whole. When the
74
+ list utilities were moved, imports vanished this way in six files out of eight, and the run
75
+ over the project list found them — the build of one application never reached these files.
75
76
 
76
77
  ```bash
77
- npx nx run-many -t lint --projects=<список по изменённым файлам>
78
+ npx nx run-many -t lint --projects=<list by changed files>
78
79
  ```
79
80
 
80
- Этот прогон — быстрый, по горячим следам переноса, и набором перед пушем он не бывает:
81
- набор, собранный по изменённым файлам, пропускает то, до чего правка дошла связями. Перед
82
- пушем идёт тот же набор, что гоняет конвейер, и теми же командами.
81
+ This run is quick, hot on the heels of the move, and it never serves as the set before the
82
+ push: a set assembled by changed files skips what the edit reached through dependencies.
83
+ Before the push goes the same set the pipeline runs, by the same commands.
83
84
 
84
- ## Проверить
85
+ ## Check
85
86
 
86
87
  ```bash
87
88
  npm run check:layers
88
89
  npm run check:dupes
89
90
  ```
90
91
 
91
- Второе обязательно: перенос и есть тот момент, когда копия остаётся на старом месте.
92
+ The second is mandatory: a move is the very moment when a copy stays in the old place.
92
93
 
93
- ## Частые промахи
94
+ **Moved routes are checked by the screen, by the whole scenario: open the panel, close it, go
95
+ back with the browser.** The outlet address is assembled at runtime, and neither the linter, nor
96
+ the build, nor the layout check looks into it: a panel that stayed closed throws no error and
97
+ leaves the browser output clean. The three actions check three different places — opening takes
98
+ the command from the current route, closing goes from its parent, going back reads the address
99
+ from the browser history. After a move each of them breaks apart from the other two.
94
100
 
95
- - Новый адрес выбран без чтения `docs/plans/` — расходится с уже принятым решением.
96
- - Порядок переноса взят из списка в плане — приходится временно расширять границы.
97
- - README поправлен только у одной либы.
98
- - Линт прогнан по приложению, а не по списку затронутых проектов — пропавшие импорты не видно.
99
- - Копия осталась на старом месте, а `check:dupes` не гонялся.
101
+ ## Common misses
102
+
103
+ - A new address chosen without reading `docs/plans/` — drifts from the decision already made.
104
+ - The move order taken from the list in the plan — the boundaries have to be widened for a while.
105
+ - The README fixed in only one lib.
106
+ - Lint run over the application, not over the list of touched projects — vanished imports are
107
+ not seen.
108
+ - A copy left in the old place, and `check:dupes` not run.
@@ -2,81 +2,95 @@
2
2
  name: lib-layers-new
3
3
  kind: pattern
4
4
  rule: lib-layers
5
- description: Паттерн правила lib-layers. Брать при заведении, переименовании или удалении либы — генератор вместо голого nx g, тег, алиас, барель, README, и чем добивать удаление. Перенос кода между уже существующими либами — паттерн lib-layers-move.
5
+ description: Pattern of rule lib-layers. Load when creating, renaming or removing a lib — the generator instead of bare nx g, the tag, the alias, the barrel, the README, and how to finish a removal. Moving code between existing libs — pattern lib-layers-move.
6
6
  ---
7
7
 
8
- # Завести или удалить либу
8
+ # Creating or removing a lib
9
9
 
10
- Паттерн правила `lib-layers`. Что при этом должно быть верно — закон
10
+ Pattern of the rule `lib-layers`. What must be true — the law
11
11
  `docs/constitution/lib-imports.md`.
12
12
 
13
- ## Когда брать
13
+ ## When to use
14
14
 
15
- - Заводится новый домен или новый слой существующего домена.
16
- - Либа переименовывается.
17
- - Либа удаляется.
15
+ - A new domain or a new layer of an existing domain is created.
16
+ - A lib is renamed.
17
+ - A lib is removed.
18
18
 
19
- ## Сначала — нужна ли либа вообще
19
+ ## First — is a lib needed at all
20
20
 
21
- У домена есть экраны, состояние и запросы. Механика, общая нескольким доменам, доменом не
22
- заводится: слои под неё останутся пустыми навсегда.
21
+ A domain has screens, state and requests. Mechanics shared by several domains is not started as
22
+ a domain: the layers under it would stay empty forever.
23
23
 
24
- Признак: если ни `feature`, ни `data-access`, ни `api` наполнить не из чего — это утилиты, и
25
- им место в либе, которой они уже видны. У фронта такая либа есть всегда — основание семейства;
26
- у бэкенда — тот слой `util`, что уже перечислен у каждого домена.
24
+ The sign: if there is nothing to fill `feature`, `data-access` or `api` with — these are
25
+ utilities, and their place is the lib that already sees them. The frontend always has such a
26
+ lib — the family base; the backend — the `util` layer already listed with every domain.
27
27
 
28
- Так домен `list` жил девятью либами на три файла кода: семь либ пустых, и у каждой свои
29
- `project.json`, `vitest.config.mts`, барель, тег и алиас.
28
+ That is how the `list` domain lived as nine libs for three files of code: seven libs empty, and
29
+ each with its own `project.json`, `vitest.config.mts`, barrel, tag and alias.
30
30
 
31
- ## Заводится генератором, а не голым `nx g`
31
+ ## Created by the generator, not by bare `nx g`
32
32
 
33
33
  ```bash
34
34
  node tools/generate-domain-lib.mjs
35
35
  ```
36
36
 
37
- Генератор кладёт `project.json`, `tsconfig.json`, `vitest.config.mts` и барель. Голый `nx g`
38
- даёт конфиг vitest без `passWithNoTests`, и либа, у которой спек ещё нет, роняет
39
- `nx run-many -t test` строкой «No test files found». Проверка раскладки смотрит на наличие
40
- файла, а не на его содержимое, поэтому такую либу она пропустит.
37
+ The generator lays out `project.json`, `tsconfig.json`, `vitest.config.mts` and the barrel. Bare
38
+ `nx g` gives a vitest config without `passWithNoTests`, and a lib that has no tests yet fails
39
+ `nx run-many -t test` with the line "No test files found". The layout check looks at the
40
+ presence of the file, not at its content, so it lets such a lib through.
41
41
 
42
- ## Что дописывается руками
42
+ ## What is added by hand
43
43
 
44
- 1. Тег в `eslint/boundaries/domains/<семья>-<домен>.config.mjs` — один на либу, равный имени и
45
- пути.
46
- 2. Алиас в `tsconfig.base.json`.
47
- 3. README либы: что в ней лежит и кто её зовёт.
44
+ 1. The tag in `eslint/boundaries/domains/<family>-<domain>.config.mjs` — one per lib, equal to
45
+ the name and the path.
46
+ 2. The alias in `tsconfig.base.json`.
47
+ 3. The lib's README: what lies in it and who calls it.
48
48
 
49
- Права на чужие либы выписываются строками с комментарием, зачем. Импорт, который «просто
50
- заработал», означает, что тег ещё не сужен.
49
+ Rights to foreign libs are written out as lines with a comment saying why. An import that "just
50
+ worked" means the tag is not narrowed yet.
51
51
 
52
- ## Удаление
52
+ ## Removing and moving a lib
53
53
 
54
54
  ```bash
55
- git rm -r libs/<семья>/<домен>/<слой>
56
- rm -rf libs/<семья>/<домен>/<слой>
55
+ git rm -r libs/<family>/<domain>/<layer>
56
+ rm -rf libs/<family>/<domain>/<layer>
57
57
  ```
58
58
 
59
- `git rm -r` оставляет за собой `node_modules/.vite` внутри удаляемого каталога, и проверка
60
- раскладки продолжает видеть его как домен без слоёв. Добивать `rm -rf`.
59
+ `git rm -r` leaves `node_modules/.vite` inside the removed directory, and the layout check keeps
60
+ seeing it as a domain without layers. Finish with `rm -rf`.
61
61
 
62
- Следом снимаются тег, алиас и строки прав у тех, кто либу видел.
62
+ Then the tag, the alias and the rights lines of everyone who saw the lib are removed.
63
63
 
64
- ## Проверить
64
+ **A move is the same action plus a graph reset.** A directory moved by `mv` is not recounted by
65
+ the builder's graph: the project stays in the cache under the old path, and under the new one it
66
+ does not exist at all.
67
+
68
+ ```bash
69
+ mv <old lib path> <new lib path>
70
+ npx nx reset
71
+ ```
72
+
73
+ Without the reset the run over all projects stays green and goes over one project fewer: it
74
+ takes the set from the graph cache, and the dropped project is no longer there. Such a run can
75
+ be told from a full one only by the number of projects in its output — it does not name the
76
+ missing one, and the miss lives until the first edit in the dropped lib.
77
+
78
+ ## Check
65
79
 
66
80
  ```bash
67
81
  npm run check:layers
68
82
  ```
69
83
 
70
- Проверка смотрит слои, единственный тег = имя = путь, алиас, наличие `project.json`,
71
- `vitest.config.mts` и `src/index.ts`, пустой список зависимостей у `common/util`, границы
72
- основания семейства и реэкспорты. Секунды — гонять после любого создания, переименования или
73
- удаления.
84
+ The check looks at the layers, the single tag = name = path, the alias, the presence of
85
+ `project.json`, `vitest.config.mts` and `src/index.ts`, the empty dependency list of
86
+ `common/util`, the family base boundaries and re-exports. Seconds — run after any creation,
87
+ rename or removal.
74
88
 
75
- ## Частые промахи
89
+ ## Common misses
76
90
 
77
- - Либа заведена под механику: слои пустые и заполнять их нечем.
78
- - Голый `nx g` — конфиг vitest без `passWithNoTests`, и общий прогон тестов краснеет.
79
- - Удаление без `rm -rf` — проверка видит призрак домена без слоёв.
80
- - **Либа, которую никто не импортирует, не проверена ничем.** `nx lint` и `nx test` проверяют
81
- её саму, а не договор с потребителем. Первый импортёр и есть первая проверка: слой моделей
82
- принимается после `nx build` и живого прогона сценария, а не по зелёному `lint test`.
91
+ - A lib created for mechanics: the layers are empty and there is nothing to fill them with.
92
+ - Bare `nx g` — a vitest config without `passWithNoTests`, and the shared test run goes red.
93
+ - Removal without `rm -rf` — the check sees the ghost of a domain without layers.
94
+ - **A lib nobody imports is checked by nothing.** `nx lint` and `nx test` check the lib itself,
95
+ not its contract with the consumer. The first importer is the first check: the models layer is
96
+ accepted after `nx build` and a live run of the scenario, not by a green `lint test`.
@@ -2,21 +2,21 @@
2
2
  name: observability-record
3
3
  kind: pattern
4
4
  rule: observability
5
- description: Паттерн правила observability. Брать, когда в коде заводится новая строка лога — готовый вызов логгера, выбор уровня, имя строки, поля объектом, отказ внешней службы и предел ожидания. Не брать для правки самого логгера и контекста запроса — это правило observability.
5
+ description: Pattern of rule observability. Load when a new log line is added in code — the ready-made logger call, choosing the level, the line name, fields as an object, an external service failure and the wait limit. Not for editing the logger itself and the request context — that is rule observability.
6
6
  ---
7
7
 
8
- # Новая строка лога
8
+ # A new log line
9
9
 
10
- Паттерн правила `observability`. Что при этом должно быть верно — закон
10
+ Pattern of the rule `observability`. What must be true — the law
11
11
  `docs/constitution/observability.md`.
12
12
 
13
- ## Когда брать
13
+ ## When to use
14
14
 
15
- - В домене появилось место, о котором владелец должен узнать: не сработала автоматика,
16
- отказала внешняя служба, упала процедура.
17
- - Хочется поставить `console.log` — вместо него ставится строка лога.
15
+ - A place appeared in the domain that the owner must learn about: an automatic step did not
16
+ fire, an external service refused, a procedure fell.
17
+ - One wants to put a `console.log` — a log line is put instead.
18
18
 
19
- ## Логгер домена берётся один раз
19
+ ## The domain logger is taken once
20
20
 
21
21
  ```ts
22
22
  const LOG_CONTEXT: string = 'PageCache';
@@ -28,49 +28,51 @@ constructor(logger: AppLoggerService) {
28
28
  }
29
29
  ```
30
30
 
31
- Контекст задаётся один раз и константой модуля, а не литералом в вызове: соседние классы одного
32
- домена пишут под тем же источником, а отбор отказов судит именно по нему. Номер обращения,
33
- процедуру и того, кто в системе, логгер подставляет сам — передавать их полями не надо.
31
+ The context is set once and as a module constant, not as a literal in the call: neighbouring
32
+ classes of one domain write under the same source, and the failure selection judges exactly by
33
+ it. The request number, the procedure and who is in the system the logger substitutes itself —
34
+ there is no need to pass them as fields.
34
35
 
35
- ## Имя строки постоянное, всё изменяемое — в поля
36
+ ## The line name is constant, everything that changes goes into the fields
36
37
 
37
38
  ```ts
38
39
  ✓ this.#log.warn('cache.refresh.rejected', { url, attempt, status, durationMs });
39
40
  ✗ this.#log.warn(`cache refresh rejected for ${url} after ${attempt} attempts`);
40
41
  ```
41
42
 
42
- Первый аргумент — имя строки, а не предложение. По нему строки об одном и том же собираются
43
- вместе, и по нему же они схлопываются в одну строку ленты отказов. Подставленное в имя значение
44
- делает каждую строку уникальной.
43
+ The first argument is the line name, not a sentence. By it the lines about the same thing are
44
+ gathered together, and by it they collapse into one row of the failure feed. A value substituted
45
+ into the name makes every line unique.
45
46
 
46
- Имя пишется точками от общего к частному: `cache.refresh.rejected`, `mail.owner.skipped`.
47
+ The name is written with dots from the general to the particular: `cache.refresh.rejected`,
48
+ `mail.owner.skipped`.
47
49
 
48
- Поля вычищаются автоматически. Имя строки проходит вычистку только по пути в хранилище отказов
49
- — в выводе оно печатается как есть, — поэтому подставлять в него значения нельзя ещё и по этой
50
- причине.
50
+ The fields are scrubbed automatically. The line name passes scrubbing only on its way to the
51
+ failure store — in the output it is printed as is — so substituting values into it is forbidden
52
+ for this reason too.
51
53
 
52
- ## Строке нижнего уровня нужна строка в списке отобранных
54
+ ## A lower-level line needs an entry in the selected list
53
55
 
54
- Уровень отказа и всё, что выше, уезжает в хранилище отказов само. Строка уровнем ниже попадает
55
- туда, только если её имя стоит в списке отобранных имён. Список сравнивается по началу имени и
56
- правится тем же коммитом, что и место, которое эту строку пишет.
56
+ The failure level and everything above it goes to the failure store by itself. A line of a lower
57
+ level gets there only if its name stands in the list of selected names. The list is compared by
58
+ the start of the name and edited by the same commit as the place that writes this line.
57
59
 
58
- Забыли дописать — строка останется только в выводе контейнера, и владелец о ней не узнает. Не
59
- сверяет это ничто.
60
+ Forgot to append — the line stays only in the container output, and the owner never learns of it.
61
+ Nothing checks this.
60
62
 
61
- ## Уровень выбирается по тому, сломалось ли что-то
63
+ ## The level is chosen by whether something broke
62
64
 
63
- | Уровень | Когда |
64
- | ----------- | -------------------------------------------------------------------------------------------------------- |
65
- | отказ | приложение не сделало того, что должно: упала процедура, не прошла запись в хранилище |
66
- | ниже | не сработала автоматика: перевод, обновление кэша, опрос внешней службы. Сюда же отказ по вводу и правам |
67
- | сообщение | состоявшееся действие, о котором стоит знать: вызов прошёл, письмо ушло |
68
- | подробность | то, что нужно при разборе, а на проде не нужно |
65
+ | Level | When |
66
+ | ----------- | ------------------------------------------------------------------------------------------------------------------------ |
67
+ | failure | the application did not do what it must: a procedure fell, a write to the storage did not go through |
68
+ | below | an automatic step did not fire: a translation, a cache refresh, a poll of an external service. Also a failure on input and rights |
69
+ | message | an action that took place and is worth knowing about: the call went through, the mail went out |
70
+ | detail | what is needed in an investigation and not needed in production |
69
71
 
70
- Отказ гостя пройти проверку, промах в форме и «не найдено» — это уровень ниже отказа. Проверка
71
- сработала, приложение работает.
72
+ A guest failing a check, a miss in a form and "not found" are the level below failure. The check
73
+ fired, the application works.
72
74
 
73
- ## Отказ внешней службы записывается разобранным
75
+ ## An external service failure is written parsed
74
76
 
75
77
  ```ts
76
78
  } catch (error: unknown) {
@@ -78,46 +80,49 @@ constructor(logger: AppLoggerService) {
78
80
  }
79
81
  ```
80
82
 
81
- Разбор причины кладёт класс, текст, код и срезанный стек одной формой — той же, что у остальных
82
- отказов. Подставлять ошибку в текст (`` `failed: ${String(error)}` ``) нельзя: так в лог уедет
83
- чужой текст целиком, вместе с адресом, ключом или почтой гостя.
83
+ Parsing the cause puts the class, the text, the code and a trimmed stack in one shape — the same as
84
+ the other failures have. Substituting the error into text (`` `failed: ${String(error)}` ``) is
85
+ forbidden: that way a foreign text goes into the log whole, together with the guest's address, key
86
+ or mail.
84
87
 
85
- Почту маскируют на месте вызова, если она приходит отдельным значением: вычистка узнаёт её по
86
- имени поля, а имя вроде `to` на почту не похоже.
88
+ Mail is masked at the call site if it comes as a separate value: scrubbing recognises it by field
89
+ name, and a name like `to` does not look like mail.
87
90
 
88
- ## Отказ наступает только тогда, когда у обращения есть предел ожидания
91
+ ## A failure comes only when the call has a wait limit
89
92
 
90
93
  ```ts
91
94
  /**
92
- * Ожидание источника курсов. Курс справочный и обновляется раз в сутки: пять
93
- * секунд ожидания и прежний курс на месте лучше, чем пять минут занятого
94
- * расписания.
95
+ * Waiting for the rates source. The rate is a reference value and is refreshed once
96
+ * a day: five seconds of waiting with the previous rate in place is better than
97
+ * five minutes of a busy schedule.
95
98
  */
96
99
  const RATES_TIMEOUT_MS: number = 5_000;
97
100
 
98
101
  const response: Response = await fetch(RATES_URL, { signal: AbortSignal.timeout(RATES_TIMEOUT_MS) });
99
102
  ```
100
103
 
101
- Без предела соединение с молчащей службой живёт до умолчания среды — минуты, — и всё это время
102
- `catch` не наступает: писать нечего. Число стоит рядом с клиентом со своим доводом, потому что
103
- цена ожидания у каждой службы своя: гость внутри запроса ждёт иначе, чем ночное расписание.
104
-
105
- ## Частые промахи
106
-
107
- - **Одно и то же имя строки стоит в двух местах.** Тогда две разные ситуации читаются как одна.
108
- Либо имена разные, либо место одно.
109
- - **`console.log` вместо строки лога.** У него нет ни уровня, ни номера обращения, и в отбор он
110
- не попадает. На проде это строка, которую никто не увидит.
111
- - **Уровень выбран по тому, насколько неприятно.** Отказ гостя пройти проверку неприятен, но
112
- приложение при этом работает.
113
- - **Ошибка положена в поле как есть, без разбора причины.** Объект ошибки сериализуется в
114
- пустой `{}`, и в логе не останется ни текста, ни класса.
115
- - **Незаполненная часть ключа группы стоит пропуском, а не пустой строкой.** Два отказа без
116
- процедуры и без предмета работы обязаны сойтись в одну группу; с пропуском в ключе каждый
117
- заводит свою, и лента наполняется одиночными строками об одном и том же.
118
- - **Одинаковые отказы, пришедшие разом, дают две группы.** Между «такой группы ещё нет» и
119
- вставкой успевает пройти второй, поэтому случай разбирается не проверкой перед вставкой, а
120
- после того, как вставка не прошла.
121
- - **Имя строки лога длиннее предела ключа не записывается вовсе.** Оно собирается подстановкой
122
- и ничем не ограничено, а у ключа предел есть: без обрезки отказ с длинным именем теряется
123
- молча — ни строки в ленте, ни отказа в логах.
104
+ Without a limit the connection to a silent service lives up to the environment default — minutes
105
+ — and all that time `catch` does not come: there is nothing to write. The number stands next to
106
+ the client with its own reason, because the price of waiting differs per service: a guest inside a
107
+ request waits differently from a night schedule.
108
+
109
+ ## Common misses
110
+
111
+ - **The same line name stands in two places.** Then two different situations read as one. Either
112
+ the names differ, or the place is one.
113
+ - **`console.log` instead of a log line.** It has neither a level nor a request number, and it
114
+ does not get into the selection. In production it is a line nobody will see.
115
+ - **The level is chosen by how unpleasant it is.** A guest failing a check is unpleasant, but the
116
+ application works meanwhile.
117
+ - **The error is put into a field as is, without parsing the cause.** The error object serialises
118
+ into an empty `{}`, and neither the text nor the class is left in the log.
119
+ - **An unfilled part of the group key stands as an omission, not as an empty string.** Two
120
+ failures without a procedure and without a work subject must fall into one group; with an
121
+ omission in the key each opens its own, and the feed fills with single rows about the same
122
+ thing.
123
+ - **Identical failures that came at once give two groups.** Between "no such group yet" and the
124
+ insert the second one gets through, so the case is handled not by a check before the insert but
125
+ after the insert did not go through.
126
+ - **A log line name longer than the key limit is not written at all.** It is assembled by
127
+ substitution and limited by nothing, while the key has a limit: without trimming, a failure
128
+ with a long name is lost silently — no row in the feed, no failure in the logs.