@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
@@ -1,40 +1,40 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * Проверка того, что образец не написан второй раз.
3
+ * A check that a pattern is not written a second time.
4
4
  *
5
- * Повтор заводится молча: домен пишет своё перечисление статусов, потому что
6
- * чужое лежит в либе, которая ему не видна, — и дальше два набора расходятся
7
- * по одному значению за раз. Ни линт, ни сборка, ни тесты этого не видят:
8
- * каждая копия сама по себе исправна.
5
+ * A duplicate appears silently: a domain writes its own enumeration of statuses because
6
+ * someone else's lies in a lib it cannot see — and from then on the two sets drift apart
7
+ * one value at a time. Neither lint, nor the build, nor the tests see this: each copy
8
+ * on its own is sound.
9
9
  *
10
- * Ловится двумя признаками:
10
+ * It is caught by these signs:
11
11
  *
12
- * 1. Одно имя экспортировано из двух разных либ. Имя совпадает не случайно —
13
- * его выбирали под одно и то же понятие.
14
- * 2. Два перечисления с одинаковым набором членов под разными именами.
15
- * Имя разошлось, а понятие осталось одно.
16
- * 3. Настройка под одним именем объявлена в двух либах. Экспорта у неё нет,
17
- * поэтому первый признак её не видел: `DEFAULT_PAGE_SIZE` разошёлся на
18
- * шесть объявлений, и одно из них успело стать `25` против `20` у
19
- * остальных. Считаются только имена вида `SCREAMING_SNAKE_CASE` — форма,
20
- * которой в этом коде записывают настройки, а не местные переменные.
21
- * 4. Перечисление, повторяющее набор из внешнего пакета. Наборы `@rt-tools/utils`
22
- * читаются из его `.d.ts` наравне с либами: копия оператора условия и
23
- * направления порядка лежала на бэкенде дословно, а признак 2 сравнивал
24
- * только либы между собой и до `node_modules` не доходил.
12
+ * 1. One name exported from two different libs. The name is not the same by chance —
13
+ * it was chosen for one and the same notion.
14
+ * 2. Two enumerations with the same set of members under different names.
15
+ * The name drifted, the notion stayed one.
16
+ * 3. A setting under one name declared in two libs. It has no export, so the first
17
+ * sign did not see it: `DEFAULT_PAGE_SIZE` drifted into six declarations, and one
18
+ * of them had already become `25` against `20` in the others. Only names of the
19
+ * form `SCREAMING_SNAKE_CASE` count — the form in which this code writes settings,
20
+ * not local variables.
21
+ * 4. An enumeration repeating a set from an external package. The sets of `@rt-tools/utils`
22
+ * are read from its `.d.ts` alongside the libs: a copy of the condition operator and of
23
+ * the sort direction lay on the backend verbatim, while sign 2 compared only libs
24
+ * with each other and never reached `node_modules`.
25
25
  *
26
- * Сравнение членов идёт по нижнему регистру без подчёркиваний, поэтому
27
- * `NOT_EQUALS` контракта и `NotEquals` приложения считаются одним членом.
26
+ * Members are compared in lower case without underscores, so `NOT_EQUALS` of the contract
27
+ * and `NotEquals` of the application count as one member.
28
28
  *
29
- * Ключ повтора несёт и список либ: без него третья копия уже известного имени
30
- * проходила молча — состав менялся, а ключ оставался прежним.
29
+ * The duplicate key carries the list of libs too: without it a third copy of an already
30
+ * known name passed silently — the set changed, the key stayed the same.
31
31
  *
32
- * Накопленное к моменту заведения проверки лежит в tools/dupes-allowlist.json
33
- * и отказом не считается: гейт падает на НОВОМ повторе, а старое остаётся
34
- * видимым числом в сводке. Разбор долга идёт отдельными задачами — иначе
35
- * проверку пришлось бы заводить вместе с правкой сорока мест.
32
+ * What had piled up by the time the check was created lies in tools/dupes-allowlist.json
33
+ * and is not counted as a refusal: the gate fails on a NEW duplicate, and the old ones stay
34
+ * visible as a number in the summary. The debt is handled by separate tasks — otherwise
35
+ * the check would have to be created together with an edit of forty places.
36
36
  *
37
- * Ненулевой код возврата и перечень расхождений.
37
+ * A non-zero exit code and the list of discrepancies.
38
38
  */
39
39
  import { createRequire } from 'node:module';
40
40
  import { existsSync, readFileSync, readdirSync } from 'node:fs';
@@ -44,17 +44,18 @@ import { allowlistOf, baselineOf, CONFIG, ROOT, parseAllowlist } from './rt-kit-
44
44
 
45
45
  const ALLOWLIST = allowlistOf('dupes');
46
46
  /**
47
- * Где ищутся повторы. Корни берутся из настройки: зашитое имя молча не находило ни одного файла
48
- * у дерева, которое держит код иначе, и проверка зеленела на пустом обходе.
47
+ * Where duplicates are looked for. The roots come from the settings: a hard-coded name silently
48
+ * found not a single file in a tree that keeps its code differently, and the check went green
49
+ * on an empty walk.
49
50
  */
50
51
  const SOURCE_ROOTS = CONFIG.sourceRoots;
51
52
  /**
52
- * `gen` и `generated` — контракт и клиент Prisma: их объявления и есть источник, с
53
- * которым сверяются остальные. Считать их копией значит требовать правки того, что
54
- * пересобирается генератором.
53
+ * `gen` and `generated` are the contract and the Prisma client: their declarations are the
54
+ * source the rest is compared against. Counting them as a copy would mean demanding an edit
55
+ * of what the generator rebuilds.
55
56
  */
56
57
  const SKIPPED_DIRS = CONFIG.skippedDirs;
57
- /** Минимум членов, при котором совпадение набора перечислений о чём-то говорит */
58
+ /** The minimum of members at which a matching enumeration set says something */
58
59
  const MIN_ENUM_MEMBERS = 2;
59
60
 
60
61
  const allowlist = parseAllowlist('dupes');
@@ -78,15 +79,17 @@ function collectFiles(dir) {
78
79
  }
79
80
 
80
81
  /**
81
- * Каталог объявлений внешнего пакета — разрешением модуля, а не путём в `node_modules`.
82
+ * The declarations directory of an external package — by module resolution, not by a path
83
+ * in `node_modules`.
82
84
  *
83
- * Точек разрешения несколько: корень дерева и каждый его подпроект, объявивший этот пакет
84
- * зависимостью. Пакет подпроекта в корне не лежит вовсе, и разрешение от корня его не находит;
85
- * менеджер при этом вправе держать рядом несколько версий сразу, и обход хранилища по образцу
86
- * пути выбрал бы ту, которую никто не ставит.
85
+ * There are several resolution points: the root of the tree and each of its subprojects that
86
+ * declared this package as a dependency. A subproject's package does not lie in the root at all,
87
+ * and resolution from the root does not find it; the package manager meanwhile may keep several
88
+ * versions side by side, and walking the store by a path pattern would pick the one nobody
89
+ * installs.
87
90
  *
88
- * Не нашлось — `null`, и внешние наборы просто не считаются: дерево без этого пакета должно
89
- * получать сверку своих повторов, а не отказ чтения каталога.
91
+ * Not found — `null`, and external sets are simply not counted: a tree without this package
92
+ * must get an audit of its own duplicates, not a refusal to read the directory.
90
93
  */
91
94
  function resolveExternalDir({ package: name, dir }) {
92
95
  for (const from of [ROOT, ...holdersOf(name)]) {
@@ -97,14 +100,14 @@ function resolveExternalDir({ package: name, dir }) {
97
100
  return found;
98
101
  }
99
102
  } catch {
100
- // Эта точка пакета не видит — пробуется следующая.
103
+ // This point does not see the package — the next one is tried.
101
104
  }
102
105
  }
103
106
 
104
107
  return null;
105
108
  }
106
109
 
107
- /** Подпроекты, объявившие пакет зависимостью: их манифесты и есть точки разрешения. */
110
+ /** Subprojects that declared the package as a dependency: their manifests are the resolution points. */
108
111
  function holdersOf(name) {
109
112
  const found = [];
110
113
  for (const root of SOURCE_ROOTS) {
@@ -127,7 +130,7 @@ function holdersOf(name) {
127
130
  return found;
128
131
  }
129
132
 
130
- /** Корень либы: путь до каталога `src`. Повтор внутри одной либы повтором не считается */
133
+ /** The root of a lib: the path up to the `src` directory. A duplicate inside one lib is not a duplicate */
131
134
  function libOf(path) {
132
135
  const parts = path.split('/');
133
136
  const at = parts.indexOf('src');
@@ -138,58 +141,59 @@ const EXPORT_RE = /^export (?:const|function|interface|enum|type|class|abstract
138
141
  const ENUM_RE = /export (?:declare )?enum (\w+)\s*\{([^}]*)\}/g;
139
142
  const MEMBER_RE = /(\w+)\s*=/g;
140
143
  /**
141
- * Настройка-число: имя в верхнем регистре и значение из одних чисел — предел,
142
- * размер, длительность. Строки и таблицы соответствий сюда не подпадают
143
- * намеренно: `LOG_CONTEXT` объявлен в восьми либах, и у каждой он свой по смыслу,
144
- * а совпадение имени числа означает совпадение понятия.
144
+ * A numeric setting: an upper-case name and a value made of digits only — a limit,
145
+ * a size, a duration. Strings and lookup tables are deliberately left out:
146
+ * `LOG_CONTEXT` is declared in eight libs, and in each one it means its own thing,
147
+ * while a matching name of a number means a matching notion.
145
148
  */
146
149
  const SETTING_RE = /^(?:export )?const ([A-Z][A-Z0-9_]*)\s*(?::\s*number\s*)?=\s*\d[\d\s*+\-/_.]*;/gm;
147
150
  /**
148
- * Настройка-строка и настройка-список. Сверяются по значению, а не по имени: одно имя
149
- * значит здесь разное — `BEM_BLOCK` объявлен в тридцати шести либах, `LOG_CONTEXT` в
150
- * десяти, и у каждой либы своё. Одинаковое значение под разными именами — наоборот,
151
- * почти всегда одно понятие, записанное дважды: имя события правки, код отказа о повторе,
152
- * набор принимаемых типов вложений.
151
+ * A string setting and a list setting. They are compared by value, not by name: one name
152
+ * means different things here — `BEM_BLOCK` is declared in thirty-six libs, `LOG_CONTEXT`
153
+ * in ten, and each lib has its own. The same value under different names is the opposite:
154
+ * almost always one notion written twice — the name of an edit event, the refusal code
155
+ * about a duplicate, the set of accepted attachment types.
153
156
  */
154
157
  const STRING_SETTING_RE =
155
158
  /^(?:export )?const ([A-Z][A-Z0-9_]*)\s*(?::[^=]*)?=\s*('[^']*'|"[^"]*"|`[^`]*`|\[[^\]]*\])\s*(?:as const\s*)?;/gm;
156
- /** Таблица соответствий: перевод статуса в контракт, колонки в поля сортировки, ключи подписей */
159
+ /** A lookup table: status into contract, columns into sort fields, label keys */
157
160
  const TABLE_RE = /^(?:export )?const ([A-Z][A-Z0-9_]*)\s*(?::[^=]*)?=\s*\{([^}]*?)\}\s*(?:as const\s*)?;/gms;
158
161
  const PAIR_RE = /([\w'"[\].]+)\s*:\s*([^,\n]+)/g;
159
162
  /**
160
- * Значение короче этого о совпадении понятий не говорит: пустая строка, дефис и `id`
161
- * совпадают у всех подряд.
163
+ * A value shorter than this says nothing about matching notions: an empty string, a hyphen
164
+ * and `id` match everywhere.
162
165
  */
163
166
  const MIN_VALUE_LENGTH = 4;
164
- /** Минимум пар, при котором совпадение таблиц о чём-то говорит */
167
+ /** The minimum of pairs at which matching tables say something */
165
168
  const MIN_TABLE_PAIRS = 2;
166
169
  /**
167
- * Доля совпавших пар, начиная с которой таблицы считаются одной. Полное равенство слепо ровно
168
- * там, где копия разошлась с оригиналом на строку, — а это и есть тот случай, ради которого
169
- * копии сводят. Порог высокий: таблицы одного домена делят по две-три пары без всякого родства.
170
+ * The share of matching pairs from which tables count as one. Full equality is blind exactly
171
+ * where a copy drifted from the original by one line — and that is the very case for which
172
+ * copies are merged. The threshold is high: tables of one domain share two or three pairs
173
+ * without any kinship.
170
174
  */
171
175
  const MIN_TABLE_SHARE = 0.8;
172
176
 
173
177
  /**
174
- * Пакеты, чьи наборы считаются наравне с либами. Своё перечисление под уже
175
- * объявленный там набор — такая же копия, как и между двумя либами.
178
+ * Packages whose sets count alongside the libs. An enumeration of one's own under a set
179
+ * already declared there is the same copy as one between two libs.
176
180
  *
177
- * Имя пакета и каталог внутри него объявляет дерево; путь в `node_modules` здесь не
178
- * зашивается. Пакет, объявленный зависимостью подпроекта, в корневом `node_modules` не лежит
179
- * вовсе — менеджер держит его в своём хранилище, — и проверка кончалась отказом чтения
180
- * каталога, не дойдя до сверки ни разу.
181
+ * The package name and the directory inside it are declared by the tree; the path in
182
+ * `node_modules` is not hard-coded here. A package declared as a subproject dependency does not
183
+ * lie in the root `node_modules` at all — the package manager keeps it in its store — and the
184
+ * check ended with a refusal to read the directory without reaching the audit even once.
181
185
  */
182
186
  const EXTERNAL_ENUM_SOURCES = CONFIG.externalEnums ?? [];
183
187
 
184
188
  const exportsByName = new Map();
185
189
  const settingsByName = new Map();
186
190
  const enums = [];
187
- /** Строковые настройки и списки под ключом значения: `значение → [{ имя, либа }]` */
191
+ /** String settings and lists keyed by value: `value → [{ name, lib }]` */
188
192
  const namesByValue = new Map();
189
- /** Таблицы соответствий: набор пар под ключом, имя и либа рядом */
193
+ /** Lookup tables: the set of pairs under a key, with the name and the lib next to it */
190
194
  const tables = [];
191
195
 
192
- /** Значение без кавычек и пробелов; список — отсортированным набором членов */
196
+ /** The value without quotes and spaces; a list — as a sorted set of members */
193
197
  function valueOf(raw) {
194
198
  if (raw.startsWith('[')) {
195
199
  const items = [...raw.matchAll(/'([^']*)'|"([^"]*)"|`([^`]*)`/g)].map((item) => item[1] ?? item[2] ?? item[3]);
@@ -269,7 +273,7 @@ for (const [name, libs] of [...exportsByName.entries()].sort()) {
269
273
  continue;
270
274
  }
271
275
  const where = [...libs].sort().join(', ');
272
- findings.push({ key: `export ${name} @ ${where}`, text: `${name} экспортируется из ${libs.size} либ: ${where}` });
276
+ findings.push({ key: `export ${name} @ ${where}`, text: `${name} is exported from ${libs.size} libs: ${where}` });
273
277
  }
274
278
 
275
279
  for (const [name, libs] of [...settingsByName.entries()].sort()) {
@@ -277,7 +281,7 @@ for (const [name, libs] of [...settingsByName.entries()].sort()) {
277
281
  continue;
278
282
  }
279
283
  const where = [...libs].sort().join(', ');
280
- findings.push({ key: `setting ${name} @ ${where}`, text: `${name} объявлена в ${libs.size} либах: ${where}` });
284
+ findings.push({ key: `setting ${name} @ ${where}`, text: `${name} is declared in ${libs.size} libs: ${where}` });
281
285
  }
282
286
 
283
287
  for (const [value, places] of [...namesByValue.entries()].sort()) {
@@ -289,12 +293,12 @@ for (const [value, places] of [...namesByValue.entries()].sort()) {
289
293
  .map((place) => `${place.name} @ ${place.lib}`)
290
294
  .sort()
291
295
  .join(' ~ ');
292
- findings.push({ key: `value ${value} @ ${where}`, text: `значение ${value} объявлено в ${libs.size} либах: ${where}` });
296
+ findings.push({ key: `value ${value} @ ${where}`, text: `the value ${value} is declared in ${libs.size} libs: ${where}` });
293
297
  }
294
298
 
295
299
  /**
296
- * Доля совпавших пар считается от большей таблицы: от меньшей таблица из двух пар, целиком
297
- * лежащая внутри таблицы из двадцати, читалась бы полной копией.
300
+ * The share of matching pairs is counted from the larger table: from the smaller one, a table
301
+ * of two pairs lying entirely inside a table of twenty would read as a full copy.
298
302
  */
299
303
  const tableOverlap = (first, second) => {
300
304
  let same = 0;
@@ -320,8 +324,8 @@ for (let i = 0; i < tables.length; i++) {
320
324
  }
321
325
  const key = `table ${[`${first.name} @ ${first.lib}`, `${second.name} @ ${second.lib}`].sort().join(' ~ ')}`;
322
326
  const apart = larger - same;
323
- const tail = apart === 0 ? 'одна таблица соответствий' : `одна таблица соответствий, разошедшаяся на ${apart} из ${larger} пар`;
324
- findings.push({ key, text: `${first.name} (${first.lib}) и ${second.name} (${second.lib}) — ${tail}` });
327
+ const tail = apart === 0 ? 'one table of matches' : `one table of matches, diverged on ${apart} of ${larger} pairs`;
328
+ findings.push({ key, text: `${first.name} (${first.lib}) and ${second.name} (${second.lib}) — ${tail}` });
325
329
  }
326
330
  }
327
331
 
@@ -337,7 +341,7 @@ for (let i = 0; i < enums.length; i++) {
337
341
  const key = `enum ${[`${first.name} @ ${first.lib}`, `${second.name} @ ${second.lib}`].sort().join(' ~ ')}`;
338
342
  findings.push({
339
343
  key,
340
- text: `${first.name} (${first.lib}) и ${second.name} (${second.lib}) — один набор членов: ${[...first.members].sort().join(', ')}`,
344
+ text: `${first.name} (${first.lib}) and ${second.name} (${second.lib}) — one set of members: ${[...first.members].sort().join(', ')}`,
341
345
  });
342
346
  }
343
347
  }
@@ -352,13 +356,13 @@ if (process.argv.includes('--baseline')) {
352
356
 
353
357
  const problems = [
354
358
  ...fresh.map((finding) => finding.text),
355
- ...staleKeys.map((key) => `${key}: значится в ${ALLOWLIST}, но повтора больше нет — строку убрать`),
359
+ ...staleKeys.map((key) => `${key}: listed in ${ALLOWLIST}, and the duplication is gone — remove the line`),
356
360
  ];
357
361
 
358
362
  if (problems.length > 0) {
359
- console.error(`check-dupes: расхождений ${problems.length}\n`);
363
+ console.error(`check-dupes: divergences ${problems.length}\n`);
360
364
  problems.forEach((problem) => console.error(` ${problem}`));
361
365
  process.exit(1);
362
366
  }
363
367
 
364
- console.log(`check-dupes: повторов ${findings.length}, из них принято ${findings.length - debt.size}, долг ${debt.size} — новых нет`);
368
+ console.log(`check-dupes: duplications ${findings.length}, of them accepted ${findings.length - debt.size}, debt ${debt.size} — no new ones`);
@@ -1,32 +1,31 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * Проверка того, что файл не длиннее предела.
3
+ * The check that a file is no longer than the limit.
4
4
  *
5
- * Файл, который не влезает на экран целиком, читают по частям, и правку в нём
6
- * делают, не увидев остального. У кода длину стережёт линтер; здесь — всё, до
7
- * чего он не доходит: проза, стили, шаблоны, обвязка разработки и сами гарды.
5
+ * A file that does not fit on the screen whole is read in parts, and an edit in it is made without
6
+ * having seen the rest. For code the linter watches the length; here is everything it does not
7
+ * reach: prose, styles, templates, the development harness and the guards themselves.
8
8
  *
9
- * Судятся `.md`, `.scss`, `.html`, `.js`, `.mjs` и `.sh`. Данные не судятся
10
- * вовсе: словарь локали и настройка сборки читаются поиском, а не подряд, и
11
- * делить их не на что. Код на языке, где длину стережёт линтер, тоже не
12
- * судится — два отказа на один файл читаются как две разные претензии.
9
+ * Judged are `.md`, `.scss`, `.html`, `.js`, `.mjs` and `.sh`. Data is not judged at all: a locale
10
+ * dictionary and a build setting are read by search, not in a row, and there is nothing to split
11
+ * them into. Code in a language where the linter watches the length is not judged either — two
12
+ * refusals on one file read as two different claims.
13
13
  *
14
- * Строки считаются все, включая пустые и комментарии, и тем же способом, каким
15
- * их считает линтер: по числу разрывов плюс один. Файл, кончающийся переводом
16
- * строки, поэтому весит на строку больше, чем показывает `wc -l`, — зато у обеих
17
- * проверок дерева одно понятие длины.
14
+ * All lines are counted, empty ones and comments included, and the same way the linter counts
15
+ * them: by the number of breaks plus one. A file ending with a line break therefore weighs one
16
+ * line more than `wc -l` shows — but both checks of the tree have one notion of length.
18
17
  *
19
- * Описание прошлого из счёта выведено: архив по устройству перечисляет то, чего
20
- * в дереве уже нет, а папка задачи умирает со слиянием. Сгенерированное выведено
21
- * каталогом: его переписывает генератор целиком, и спорить с ним о длине некому.
18
+ * The archive is taken out of the count: by its make-up it lists what is no longer in the tree,
19
+ * and a task folder dies with the merge. What is generated is taken out by directory: the
20
+ * generator rewrites it whole, and there is no one there to argue with it about length.
22
21
  *
23
- * Накопленное к моменту заведения проверки лежит в списке известного и отказом
24
- * не считается: гейт падает на НОВОМ длинном файле, а старое остаётся видимым
25
- * числом в сводке. Принятое и долг там различаются: принятое дерево делить не
26
- * собирается, на долг заведена работа. Строка снимается вместе с делением своего
27
- * файла, и проверка сама говорит, какую строку пора убрать.
22
+ * What piled up by the moment the check was started lies in the known list and does not count as a
23
+ * refusal: the gate falls on a NEW long file, while the old stays a visible number in the digest.
24
+ * Accepted and debt differ there: what is accepted the tree is not going to split, for a debt work
25
+ * has been started. A line is removed together with the splitting of its file, and the check
26
+ * itself says which line it is time to take away.
28
27
  *
29
- * Ненулевой код возврата и перечень расхождений.
28
+ * A non-zero exit code and the list of discrepancies.
30
29
  */
31
30
  import { execFileSync } from 'node:child_process';
32
31
  import { existsSync, readFileSync } from 'node:fs';
@@ -35,40 +34,41 @@ import { join } from 'node:path';
35
34
  import { allowlistOf, baselineOf, CONFIG, ROOT, parseAllowlist } from './rt-kit-checks.config.mjs';
36
35
 
37
36
  const ALLOWLIST = allowlistOf('file-size');
38
- /** Пределов два: код и текст слоя правил. Какой из них применён, каждая строка отказа называет. */
37
+ /** There are two limits: code and the text of the rules layer; each refusal line names which one. */
39
38
  const LIMIT = CONFIG.fileSizeLimit;
40
39
  const PROSE_LIMIT = CONFIG.proseSizeLimit ?? CONFIG.fileSizeLimit;
41
40
  /**
42
- * Второй предел текста — в знаках. Строки меряют, сколько текста помещается на экран, но веса
43
- * не меряют вовсе: правило о заявках занимает 282 строки при 13 595 знаках, а правило поставки —
44
- * 272 строки при 21 508. Сжатие слоя срезает знаки, а число переносов оставляет прежним, и
45
- * строковый предел достигнутого не закрепляет. Дерево, не назвавшее этого числа, судится
46
- * по-прежнему одними строками.
41
+ * The second limit of text is in characters. Lines measure how much text fits on the screen, but do
42
+ * not measure the weight at all: the rule about PRs takes 282 lines at 13 595 characters, and the
43
+ * delivery rule 272 lines at 21 508. Squeezing the layer cuts characters and leaves the number of
44
+ * breaks as it was, so the line limit does not fix what has been reached. A tree that has not named
45
+ * this number is judged by lines alone, as before.
47
46
  */
48
47
  const PROSE_CHARS = CONFIG.proseCharLimit ?? 0;
49
- /** Корни текста слоя правил; дерево, их не назвавшее, судится одним пределом. */
48
+ /** The roots of the rules-layer text; a tree that has not named them is judged by one limit. */
50
49
  const PROSE_ROOTS = CONFIG.proseRoots ?? [];
51
50
 
52
- /** Предел для файла и имя предела для отказа: по корню, а не по расширению — код лежит и в `.md`. */
51
+ /** The limit for a file and its name for a refusal: by root, not by extension — code lies in `.md` too. */
53
52
  function limitOf(path) {
54
53
  return PROSE_ROOTS.some((root) => root && path.startsWith(root))
55
- ? { limit: PROSE_LIMIT, title: 'предел текста' }
56
- : { limit: LIMIT, title: 'предел кода' };
54
+ ? { limit: PROSE_LIMIT, title: 'the limit for prose' }
55
+ : { limit: LIMIT, title: 'the limit for code' };
57
56
  }
58
57
 
59
- /** Роды файлов, которых не читает линтер. Код остаётся за ним. */
58
+ /** The kinds of files the linter does not read. Code stays with it. */
60
59
  const JUDGED = ['.md', '.scss', '.html', '.js', '.mjs', '.sh'];
61
60
 
62
- /** Описание прошлого, папка задачи и то, что переписывает генератор. */
61
+ /** The archive, the task folder and what the generator rewrites. */
63
62
  const SKIPPED_PREFIXES = [CONFIG.archiveDir, `${CONFIG.tasksDir}/`, ...CONFIG.generatedDirs];
64
63
 
65
64
  /**
66
- * Дерево спрашивается у системы контроля версий: иначе каталоги с точки не видны, а сборка видна.
65
+ * The tree is asked of the version control system: otherwise directories with a dot are not seen,
66
+ * while the build is.
67
67
  *
68
- * Снятое из рабочего дерева отсеивается здесь, а не в счётчиках: система контроля версий помнит
69
- * файл, пока снос не заведён в историю, а прочитать его нечем — проверка падала трассировкой
70
- * `ENOENT` и читалась как сломанная, хотя сломан был только незаведённый снос. Счётчиков два, и
71
- * охрана при каждом разошлась бы.
68
+ * What was taken out of the working tree is sifted out here, not in the counters: version control
69
+ * remembers a file until the removal is entered into the history, and there is nothing to read it
70
+ * with — the check fell with an `ENOENT` trace and read as broken, though only the unrecorded
71
+ * removal was broken. There are two counters, and the protection at each of them would diverge.
72
72
  */
73
73
  function trackedFiles() {
74
74
  return execFileSync('git', ['ls-files'], { cwd: ROOT, encoding: 'utf8', maxBuffer: 1024 * 1024 * 32 })
@@ -85,29 +85,29 @@ function judged(path) {
85
85
  return JUDGED.some((extension) => path.endsWith(extension));
86
86
  }
87
87
 
88
- /** Тем же способом, каким считает линтер: число разрывов плюс один. */
88
+ /** The same way the linter counts: the number of breaks plus one. */
89
89
  function lineCount(path) {
90
90
  return readFileSync(join(ROOT, path), 'utf8').split('\n').length;
91
91
  }
92
92
 
93
- /** Спутник — таблица связи, а не проза: компаньон правила и перечень сценариев спека. */
93
+ /** A companion is a table of links, not prose: the companion of a rule and the scenario list of a spec. */
94
94
  function companion(path) {
95
95
  return path.endsWith('/implementation.md') || path.endsWith('/scenarios.md');
96
96
  }
97
97
 
98
- /** Знаки, а не байты: кириллица весит по два байта, и байтовый счёт судил бы язык, а не текст. */
98
+ /** Characters, not bytes: Cyrillic weighs two bytes, and a byte count would judge the language, not the text. */
99
99
  function charCount(path) {
100
100
  return readFileSync(join(ROOT, path), 'utf8').length;
101
101
  }
102
102
 
103
103
  /**
104
- * Список известного читается отдельно от общего читателя: у этой проверки нет файла — это
105
- * не пустой список, а нечитаемая настройка, и молчать о ней нельзя. Пустой список законен
106
- * ровно один раз — в дереве, где длинных файлов нет вовсе.
104
+ * The known list is read apart from the common reader: this check has no file — that is not an
105
+ * empty list but an unreadable setting, and staying silent about it is not allowed. An empty list
106
+ * is lawful exactly once — in a tree where there are no long files at all.
107
107
  */
108
108
  const allowlist = parseAllowlist('file-size');
109
109
  const { accepted, debt } = allowlist;
110
- const known = new Map([...[...accepted.keys()].map((path) => [path, 'принято']), ...[...debt.keys()].map((path) => [path, 'долг'])]);
110
+ const known = new Map([...[...accepted.keys()].map((path) => [path, 'accepted']), ...[...debt.keys()].map((path) => [path, 'debt'])]);
111
111
 
112
112
  const tooLong = new Map();
113
113
  const tracked = trackedFiles().filter(judged);
@@ -120,15 +120,17 @@ for (const path of tracked) {
120
120
  tooLong.set(path, lines);
121
121
  }
122
122
 
123
- // Вес судится только у текста слоя правил и только там, где дерево назвало число: у кода
124
- // длину стережёт ещё и линтер, а у прозы — одни эти два предела.
123
+ // Weight is judged only for the text of the rules layer and only where the tree has named the
124
+ // number: for code the length is watched by the linter as well, and for prose by these two
125
+ // limits alone.
125
126
  //
126
- // Спутники из счёта веса выведены. Компаньон правила и перечень сценариев — таблицы связи:
127
- // заголовок привязки дословно повторяет утверждение, потому что связь идёт по его тексту, и
128
- // резать там нечего, не порвав саму связь. Вес такого файла растёт с числом утверждений, а
129
- // не с многословием: у правила поставки семьдесят шесть привязок на 24 326 знаков, из них
130
- // пояснений всего 5 729. Строковый предел на них остаётся — он ловит другое.
131
- if (PROSE_CHARS > 0 && PROSE_ROOTS.length > 0 && limitOf(path).title === 'предел текста' && !companion(path)) {
127
+ // Companions are taken out of the weight count. The companion of a rule and the scenario list
128
+ // are tables of links: the heading of a binding repeats the statement word for word, because
129
+ // the link goes by its text, and there is nothing to cut there without tearing the link itself.
130
+ // The weight of such a file grows with the number of statements, not with wordiness: the
131
+ // delivery rule has seventy-six bindings at 24 326 characters, of which the explanations are
132
+ // only 5 729. The line limit on them stays — it catches something else.
133
+ if (PROSE_CHARS > 0 && PROSE_ROOTS.length > 0 && limitOf(path).title === 'the limit for prose' && !companion(path)) {
132
134
  const chars = charCount(path);
133
135
  if (chars > PROSE_CHARS) {
134
136
  overweight.set(path, chars);
@@ -142,40 +144,47 @@ if (process.argv.includes('--baseline')) {
142
144
  }
143
145
 
144
146
  const fresh = [...tooLong].filter(([path]) => !known.has(path));
145
- /** Строка на файл, которого в дереве нет, — устаревшая: иначе список копит мёртвое. */
147
+ /** A line about a file that is not in the tree is stale: otherwise the list piles up the dead. */
146
148
  const gone = [...known.keys()].filter((path) => !existsSync(join(ROOT, path)));
147
- /** Файл поделили, а строку оставили: список перестал бы отвечать за то, что в нём стоит. */
148
- const shrunk = [...known.keys()].filter((path) => !tooLong.has(path) && existsSync(join(ROOT, path)));
149
+ /**
150
+ * The file was split and the line was left: the list would stop answering for what stands in it.
151
+ * A file heavy by characters does not fall under the line limit, and without the second check its
152
+ * record would read as stale — a debt could be neither written down nor left.
153
+ */
154
+ const shrunk = [...known.keys()].filter(
155
+ (path) => !tooLong.has(path) && !overweight.has(path) && existsSync(join(ROOT, path))
156
+ );
149
157
 
150
- /** Тяжёлое по знакам судится тем же списком известного: один долг на файл, а не два. */
158
+ /** What is heavy by characters is judged by the same known list: one debt per file, not two. */
151
159
  const heavy = [...overweight].filter(([path]) => !known.has(path) && !tooLong.has(path));
152
160
 
153
161
  const problems = [
154
- ...heavy.map(([path, chars]) => `${path}: ${chars} знаков, предел веса текста ${PROSE_CHARS} — резать довод, а не дописывать строку в ${ALLOWLIST}`),
162
+ ...heavy.map(([path, chars]) => `${path}: ${chars} characters, the weight limit for prose is ${PROSE_CHARS} — cut the argument instead of adding a line to ${ALLOWLIST}`),
155
163
  ...fresh.map(([path, lines]) => {
156
164
  const { limit, title } = limitOf(path);
157
- return `${path}: ${lines} строк, ${title} ${limit} — делить, а не дописывать строку в ${ALLOWLIST}`;
165
+ return `${path}: ${lines} lines, ${title} ${limit} — split it instead of adding a line to ${ALLOWLIST}`;
158
166
  }),
159
- ...gone.map((path) => `${path}: строка в ${ALLOWLIST} устарела — файла в дереве нет`),
160
- ...shrunk.map((path) => `${path}: значится в ${ALLOWLIST}, но уже короче предела — строку убрать`),
167
+ ...gone.map((path) => `${path}: the line in ${ALLOWLIST} is stale — there is no such file in the tree`),
168
+ ...shrunk.map((path) => `${path}: listed in ${ALLOWLIST}, and it is already shorter than the limit — remove the line`),
161
169
  ];
162
170
 
163
171
  if (problems.length > 0) {
164
- console.error(`check-file-size: расхождений ${problems.length}\n`);
172
+ console.error(`check-file-size: divergences ${problems.length}\n`);
165
173
  problems.forEach((problem) => console.error(` ${problem}`));
166
- console.error('\nПредел длины файла — правило о языке для кода и правило о текстах для прозы.');
174
+ console.error('\nThe file length limit is the rule about the language for code and the rule about texts for prose.');
167
175
  process.exit(1);
168
176
  }
169
177
 
170
- const limits = PROSE_ROOTS.length > 0 ? `предел кода ${LIMIT}, предел текста ${PROSE_LIMIT}` : `предел ${LIMIT}`;
178
+ const limits = PROSE_ROOTS.length > 0 ? `the limit for code ${LIMIT}, the limit for prose ${PROSE_LIMIT}` : `the limit ${LIMIT}`;
171
179
  /**
172
- * Предел веса называется только там, где дерево задало и число, и корни текста: вес судится у
173
- * прозы слоя правил, а дерево, её корней не назвавшее, судится одним числом строк — и вторая
174
- * цифра в сводке говорила бы о проверке, которая там не работает.
180
+ * The weight limit is named only where the tree has set both the number and the roots of the text:
181
+ * weight is judged for the prose of the rules layer, and a tree that has not named its roots is
182
+ * judged by the number of lines alone — a second figure in the digest would speak of a check that
183
+ * does not work there.
175
184
  */
176
- const weight = PROSE_CHARS > 0 && PROSE_ROOTS.length > 0 ? `, предел веса текста ${PROSE_CHARS} знаков` : '';
185
+ const weight = PROSE_CHARS > 0 && PROSE_ROOTS.length > 0 ? `, the weight limit for prose ${PROSE_CHARS} characters` : '';
177
186
 
178
187
  console.log(
179
- `check-file-size: проверено ${tracked.length} файлов, ${limits}${weight}, длиннее предела ${tooLong.size}, ` +
180
- `из них принято ${accepted.size}, долг ${debt.size} — новых нет`
188
+ `check-file-size: checked ${tracked.length} files, ${limits}${weight}, longer than the limit ${tooLong.size}, ` +
189
+ `of them accepted ${accepted.size}, debt ${debt.size} — no new ones`
181
190
  );