@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,32 +1,36 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * Проверка слога: канцелярит и обороты, которых в этом дереве не пишут.
3
+ * The check of style: officialese and turns of phrase that are not written in this tree.
4
4
  *
5
- * Правило о текстах требует простых слов, а проверки на это не было: формулировочные
6
- * договорённости закон оставлял автору целиком, и держались они памятью того, кто пишет.
7
- * Держались плохо — владелец читает написанное и видит машинный слог там, где договорённость
8
- * требует человеческого.
5
+ * The rule about texts requires plain words, and there was no check for that: the law left the
6
+ * wording agreements entirely to the author, and they held by the memory of whoever writes. They
7
+ * held badly — the owner reads what is written and sees machine style where the agreement requires
8
+ * a human one.
9
9
  *
10
- * Ловится не стиль вообще, а перечисленные признаки, и каждый назван вместе с заменой: список
11
- * запретов без замены читается как запрет писать, и автор обходит его, а не правит текст.
10
+ * What is caught is not style in general but the listed signs, and each is named together with its
11
+ * replacement: a list of bans without replacements reads as a ban on writing, and the author
12
+ * bypasses it instead of fixing the text.
12
13
  *
13
- * Чего проверка не видит и видеть не будет: связности, повторов мысли, верности утверждения.
14
- * Абзац из коротких предложений с чистыми словами проходит её целиком, ничего при этом не
15
- * значая. Это её граница, а не обещание.
14
+ * What the check does not see and will not see: coherence, a thought said twice, the truth of a
15
+ * statement. A paragraph of short sentences with clean words passes it whole while meaning nothing
16
+ * by that. This is its boundary, not its promise.
16
17
  *
17
- * Ненулевой код возврата и перечень находок: файл, строка, что нашли, чем заменить.
18
+ * A non-zero return code and a list of findings: the file, the line, what was found, what to
19
+ * replace it with.
18
20
  *
19
- * Границы слова пишутся оглядкой на буквы, а не `\b`: он считается по ASCII, кириллица под `\w`
20
- * не подпадает, и образец с ним молча не срабатывает ни разу.
21
+ * Word boundaries are written with a look at letters, not `\b`: it counts by ASCII, Cyrillic does
22
+ * not fall under `\w`, and a pattern with it silently never fires once.
21
23
  */
22
24
  import { readFileSync } from 'node:fs';
23
25
 
24
- /** Предел длины предложения в словах. Дальше читатель теряет начало. */
26
+ import { CONFIG } from './rt-kit-checks.config.mjs';
27
+
28
+ /** The sentence length limit in words. Beyond it the reader loses the beginning. */
25
29
  const WORDS_LIMIT = 40;
26
30
 
27
31
  /**
28
- * Признаки канцелярита. Каждый — образец и то, чем его заменить: без замены находка
29
- * читается как запрет писать.
32
+ * The signs of officialese. Each is a pattern and what to replace it with: without a replacement
33
+ * a finding reads as a ban on writing.
30
34
  */
31
35
  const MARKS = [
32
36
  [/(?<![а-яёА-ЯЁ])является(?![а-яёА-ЯЁ])/giu, 'сказать глаголом: «это», «работает», «стоит»'],
@@ -39,7 +43,16 @@ const MARKS = [
39
43
  [/(?<![а-яёА-ЯЁ])в рамках(?![а-яёА-ЯЁ])/giu, 'назвать отношение прямо: «в», «при», «для»'],
40
44
  [/(?<![а-яёА-ЯЁ])на основании(?![а-яёА-ЯЁ])/giu, '«по»'],
41
45
  [/(?<![а-яёА-ЯЁ])посредством(?![а-яёА-ЯЁ])/giu, '«через», «командой», «вызовом»'],
42
- [/(?<![а-яёА-ЯЁ])данн(ый|ая|ое|ые)(?![а-яёА-ЯЁ])/giu, '«этот» или ничего'],
46
+ [/(?<![а-яёА-ЯЁ])данн(ый|ая|ое)(?![а-яёА-ЯЁ])/giu, '«этот» или ничего'],
47
+ // The form «данные» is also a noun, and there is nothing to replace it with: the data of a
48
+ // stand is data. So it is checked by what stands after it: as a pronoun it reads before the
49
+ // word it qualifies itself. The list of stems is deliberately short — what is recognised is
50
+ // what has been met, and a false refusal here costs more than a miss: the check stands in the
51
+ // set of the push gate, and red on a word that has no replacement stops the work entirely.
52
+ [
53
+ /(?<![а-яёА-ЯЁ])данные\s+(требовани|услови|значени|обстоятельств|сведени|фактор|параметр|вопрос|правил|подход|принцип|случа)[а-яё]*/giu,
54
+ '«эти» или ничего',
55
+ ],
43
56
  [/(?<![а-яёА-ЯЁ])соответствующ(ий|ая|ее|ие)(?![а-яёА-ЯЁ])/giu, 'назвать, чему именно соответствует'],
44
57
  [/(?<![а-яёА-ЯЁ])необходимо(?![а-яёА-ЯЁ])/giu, '«надо» или повелительное наклонение'],
45
58
  [/(?<![а-яёА-ЯЁ])должен быть (выполнен|произведён|осуществлён)(?![а-яёА-ЯЁ])/giu, 'сказать, кто это делает'],
@@ -50,7 +63,40 @@ const MARKS = [
50
63
  [/(?<![а-яёА-ЯЁ])как уже было сказано(?![а-яёА-ЯЁ])/giu, 'убрать: сказанное дважды не становится вернее'],
51
64
  ];
52
65
 
53
- /** Слова левой колонки словаря: они не пишутся и не произносятся нигде. */
66
+ /**
67
+ * The signs of officialese in English text. The rules layer is written in English, and the Russian
68
+ * set stays silent on it: a pattern with a Cyrillic boundary matches no Latin word at all.
69
+ *
70
+ * Both sets judge every line, and the language of the file is not determined: a Russian pattern
71
+ * does not match on an English line, nor an English one on a Russian line, and determining the
72
+ * language by the directory or by the letters would add branching for nothing. The word boundary is
73
+ * a Latin letter, for the same reason as the Cyrillic one above: `\b` behaves in its own way with
74
+ * an apostrophe and a hyphen.
75
+ */
76
+ const MARKS_EN = [
77
+ [/(?<![A-Za-z])in order to(?![A-Za-z])/giu, '«to»'],
78
+ [/(?<![A-Za-z])for the purpose of(?![A-Za-z])/giu, '«to», «for»'],
79
+ [/(?<![A-Za-z])in the event that(?![A-Za-z])/giu, '«if»'],
80
+ [/(?<![A-Za-z])due to the fact that(?![A-Za-z])/giu, '«because»'],
81
+ [/(?<![A-Za-z])at this point in time(?![A-Za-z])/giu, '«now»'],
82
+ [/(?<![A-Za-z])prior to(?![A-Za-z])/giu, '«before»'],
83
+ [/(?<![A-Za-z])subsequent to(?![A-Za-z])/giu, '«after»'],
84
+ [/(?<![A-Za-z])with regard to(?![A-Za-z])/giu, '«about», «on»'],
85
+ [/(?<![A-Za-z])in terms of(?![A-Za-z])/giu, 'name the relation directly'],
86
+ [/(?<![A-Za-z])utili[sz](e|es|ed|ing|ation)(?![A-Za-z])/giu, '«use»'],
87
+ [/(?<![A-Za-z])leverag(e|es|ed|ing)(?![A-Za-z])/giu, '«use»'],
88
+ [/(?<![A-Za-z])facilitat(e|es|ed|ing)(?![A-Za-z])/giu, 'name the action itself: «helps», «lets», «runs»'],
89
+ [/(?<![A-Za-z])(is|are|was|were) able to(?![A-Za-z])/giu, '«can», «could»'],
90
+ [/(?<![A-Za-z])(has|have|had) the ability to(?![A-Za-z])/giu, '«can», «could»'],
91
+ [/(?<![A-Za-z])it should be noted that(?![A-Za-z])/giu, 'drop it: if it is worth noting, note it'],
92
+ [/(?<![A-Za-z])it is (important|worth) (to note|noting) that(?![A-Za-z])/giu, 'drop it: say the thing'],
93
+ [/(?<![A-Za-z])as (previously|already) (mentioned|stated|noted)(?![A-Za-z])/giu, 'drop it: said twice is not truer'],
94
+ [/(?<![A-Za-z])the aforementioned(?![A-Za-z])/giu, 'name it again'],
95
+ [/(?<![A-Za-z])in a timely manner(?![A-Za-z])/giu, '«on time», «promptly»'],
96
+ [/(?<![A-Za-z])a number of(?![A-Za-z])/giu, '«some», «several», or the number'],
97
+ ];
98
+
99
+ /** The words of the left column of the glossary: they are neither written nor said anywhere. */
54
100
  const GLOSSARY_BANS = [
55
101
  [/(?<![а-яёА-ЯЁ])таск[аиуе](?![а-яёА-ЯЁ])/giu, 'задача'],
56
102
  [/(?<![а-яёА-ЯЁ])тикет[а-яё]*(?![а-яёА-ЯЁ])/giu, 'задача'],
@@ -62,58 +108,104 @@ const GLOSSARY_BANS = [
62
108
  [/(?<![а-яёА-ЯЁ])скилл[а-яё]*(?![а-яёА-ЯЁ])/giu, 'правило, паттерн или скил без закона'],
63
109
  ];
64
110
 
111
+ /**
112
+ * The tree's words beyond the package ones: they are read from the check settings and fall into the
113
+ * same set.
114
+ *
115
+ * A tree writes its own half of the "Not written here" table by a glossary override, and without
116
+ * this nothing judged that half: the set was hard-coded. A tree used to start a check of its own
117
+ * alongside — a second set of patterns for one requirement, and they could diverge silently.
118
+ */
119
+ const TREE_BANS = (CONFIG.prose?.glossaryBans ?? [])
120
+ .filter((one) => one && typeof one.pattern === 'string' && typeof one.fix === 'string')
121
+ .map((one) => {
122
+ try {
123
+ return [new RegExp(one.pattern, 'giu'), one.fix];
124
+ } catch {
125
+ // An unfit pattern does not drop the whole check: the rest of the words are judged as before.
126
+ return null;
127
+ }
128
+ })
129
+ .filter(Boolean);
130
+
65
131
  const CODE_FENCE = /^\s*```/;
66
132
 
67
133
  /**
68
- * Заголовки, которые совпадают с образцом канцелярита, но прозой не являются: это имена
69
- * обязательных разделов спека, и набор разделов требует их дословно.
134
+ * Headings that match a pattern of officialese but are not prose: these are the names of the
135
+ * mandatory spec sections, and the section set requires them word for word.
70
136
  *
71
- * Перечислены поимённо, а не сняты правилом: слово «данные» в предложении канцеляритом быть не
72
- * перестаёт — «данные требования» ловится по-прежнему. Без этого исключения ни один новый спек
73
- * не написать вовсе: набор разделов требует заголовок, а проверка слога его отбивает, и оба
74
- * требования верны каждое по-своему.
137
+ * They are listed by name rather than lifted by a rule: the word «данные» in a sentence does not
138
+ * stop being officialese — «данные требования» is still caught. Without this exception no new spec
139
+ * could be written at all: the section set requires the heading, and the style check refuses it,
140
+ * and both requirements are right each in its own way.
75
141
  */
76
142
  const HEADING_EXCEPTIONS = new Set(['Данные']);
77
143
 
78
- /** Заголовок, чьё имя названо исключением: судить в нём нечего — это имя раздела, а не фраза. */
144
+ /** A heading whose name is named as an exception: there is nothing to judge in it — it is a section name, not a phrase. */
79
145
  function isExemptHeading(line) {
80
146
  const heading = line.match(/^\s*#{1,6}\s+(.+?)\s*$/);
81
147
 
82
148
  return heading !== null && HEADING_EXCEPTIONS.has(heading[1]);
83
149
  }
84
150
 
85
- /** Строки вне блоков кода: в блоках лежат команды и вывод, и слог там не судится. */
151
+ /**
152
+ * A quotation of a law: a quote block introduced by a line with the address of a law.
153
+ *
154
+ * The words the check refuses stand in the laws themselves by the dozen. Having quoted an article
155
+ * word for word, the work runs into a refusal: fix the quotation and you lie, leave it and you
156
+ * cannot push. So only one's own writing is judged, and someone else's text in a quotation stays as
157
+ * it is.
158
+ *
159
+ * The sign is deliberately narrow: not any quotation, but one introduced by the address of a law.
160
+ * Otherwise a quote block would become the place where one's own writing is hidden from the check.
161
+ */
162
+ const LAW_ADDRESS = /docs\/constitution\/[A-Za-z0-9_./-]+\.md/;
163
+ const QUOTE = /^\s*>/;
164
+
165
+ /** Lines outside code blocks and outside quotations of laws: someone else's words lie there, and style is not judged there. */
86
166
  function proseLines(text) {
87
167
  const out = [];
88
168
  let inFence = false;
169
+ let introducesLaw = false;
170
+ let inLawQuote = false;
89
171
  text.split('\n').forEach((line, index) => {
90
172
  if (CODE_FENCE.test(line)) {
91
173
  inFence = !inFence;
92
174
  return;
93
175
  }
94
176
  if (inFence) return;
177
+
178
+ if (QUOTE.test(line)) {
179
+ if (!inLawQuote && (introducesLaw || LAW_ADDRESS.test(line))) inLawQuote = true;
180
+ if (inLawQuote) return;
181
+ } else {
182
+ inLawQuote = false;
183
+ // The line that introduces a quotation is the one before it that names the address of a law.
184
+ if (line.trim() !== '') introducesLaw = LAW_ADDRESS.test(line);
185
+ }
186
+
95
187
  if (isExemptHeading(line)) return;
96
188
  out.push([index + 1, line]);
97
189
  });
98
190
  return out;
99
191
  }
100
192
 
101
- /** Находки одной строки: образец, что нашли, чем заменить. */
193
+ /** The findings of one line: the pattern, what was found, what to replace it with. */
102
194
  function findingsIn(line) {
103
195
  const found = [];
104
- [...MARKS, ...GLOSSARY_BANS].forEach(([re, fix]) => {
196
+ [...MARKS, ...MARKS_EN, ...GLOSSARY_BANS, ...TREE_BANS].forEach(([re, fix]) => {
105
197
  const hit = line.match(re);
106
198
  if (hit) found.push([hit[0], fix]);
107
199
  });
108
200
  return found;
109
201
  }
110
202
 
111
- /** Слишком длинное предложение: читатель теряет начало раньше, чем автор доходит до конца. */
203
+ /** A sentence that is too long: the reader loses the beginning before the author reaches the end. */
112
204
  function longSentences(line) {
113
205
  return line
114
206
  .split(/(?<=[.!?])\s+/)
115
207
  .filter((sentence) => sentence.trim().split(/\s+/).length > WORDS_LIMIT)
116
- .map((sentence) => [`${sentence.trim().split(/\s+/).length} слов в предложении`, `делить: предел ${WORDS_LIMIT}`]);
208
+ .map((sentence) => [`${sentence.trim().split(/\s+/).length} words in a sentence`, `split it: the limit is ${WORDS_LIMIT}`]);
117
209
  }
118
210
 
119
211
  export function checkProse(text) {
@@ -128,10 +220,10 @@ if (files.length > 0) {
128
220
  checkProse(readFileSync(file, 'utf8')).map((p) => ` ${file}:${p.line} — «${p.what}» → ${p.fix}`)
129
221
  );
130
222
  if (problems.length > 0) {
131
- console.error(`check-prose-style: находок ${problems.length}\n`);
223
+ console.error(`check-prose-style: findings ${problems.length}\n`);
132
224
  problems.forEach((p) => console.error(p));
133
- console.error('\nСлог — правило о текстах. Проверка видит перечисленные признаки и только их.');
225
+ console.error('\nWording is the rule about texts. The check sees the listed signs and only them.');
134
226
  process.exit(1);
135
227
  }
136
- console.log(`check-prose-style: проверено файлов ${files.length}, находок нет`);
228
+ console.log(`check-prose-style: files checked ${files.length}, no findings`);
137
229
  }
@@ -1,31 +1,30 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * Проверка того, что набор гейта пуша не уже набора конвейера.
3
+ * The check that the set of the push gate is not narrower than the set of the pipeline.
4
4
  *
5
- * Гейт пуша — обещание, что пуш не приедет красным. Пока его набор уже набора
6
- * конвейера, обещание шире того, что гейт проверяет, и неверно оно молча: ни
7
- * гейт, ни его вывод не говорят, чего в нём нет. Дважды подряд правка, прошедшая
8
- * гейт целиком, была отбита конвейером — и оба раза зелёный гейт был прочитан
9
- * как «локально всё зелено».
5
+ * The push gate is a promise that the push will not arrive red. While its set is narrower than the
6
+ * set of the pipeline, the promise is wider than what the gate checks, and it is wrong silently:
7
+ * neither the gate nor its output says what is missing from it. Twice in a row an edit that passed
8
+ * the gate whole was refused by the pipeline — and both times the green gate was read as
9
+ * «everything is green locally».
10
10
  *
11
- * Файл конвейера машиной не толкуется: команды там произвольны, а часть шагов
12
- * локально неисполнима вовсе — кэш, выгрузка следов, вход в реестр. Отсюда
13
- * берутся только ИМЕНА шагов, а чем каждое из них закрывается в гейте,
14
- * объявляет дерево. Необъявленное имя краснеет: дыра видна на месте, а не
15
- * выводится сверкой двух списков глазами.
11
+ * The pipeline file is not interpreted by a machine: the commands there are arbitrary, and part of
12
+ * the steps cannot be run locally at all — the cache, uploading traces, signing in to the registry.
13
+ * Only the NAMES of the steps are taken from there, and what each of them is closed by in the gate
14
+ * is declared by the tree. An undeclared name turns red: the hole is seen on the spot and is not
15
+ * deduced by comparing two lists with the eyes.
16
16
  *
17
- * Объявление бывает двух родов. Строка — та самая команда, которую печатает
18
- * `rt_push_checks` профиля; она сверяется с его выводом, потому что объявление
19
- * без исполнения — та же дыра. Исключение — причина, по которой шага в гейте
20
- * нет; пустая причина исключением не считается: она единственное, чем
21
- * постоянная дыра отличается от забытой строки. Причина, называющая задачу,
22
- * судится ещё и на живость этой задачи: отсрочка со сроком и отсрочка без срока
23
- * выглядят одинаково, пока номер никто не спросил.
17
+ * A declaration comes in two kinds. A line is the very command the `rt_push_checks` of the profile
18
+ * prints; it is checked against its output, because a declaration without a run is the same hole.
19
+ * An exception is the reason why the step is not in the gate; an empty reason does not count as an
20
+ * exception: it is the only thing by which a permanent hole differs from a forgotten line. A reason
21
+ * naming a task is judged on the liveness of that task as well: a deferral with a deadline and a
22
+ * deferral without one look alike while nobody has asked about the number.
24
23
  *
25
- * Дерево без файла конвейера сверки не получает: проверка, падающая там, где
26
- * конвейера нет, отбивала бы работу вместо промаха.
24
+ * A tree without a pipeline file gets no comparison: a check falling where there is no pipeline
25
+ * would refuse the work instead of a miss.
27
26
  *
28
- * Ненулевой код возврата и перечень расхождений.
27
+ * A non-zero exit code and the list of discrepancies.
29
28
  */
30
29
  import { execFileSync } from 'node:child_process';
31
30
  import { existsSync, readFileSync } from 'node:fs';
@@ -36,23 +35,25 @@ import { CONFIG, ROOT } from './rt-kit-checks.config.mjs';
36
35
  const GATE = CONFIG.pushGate ?? {};
37
36
  const PIPELINE = GATE.pipelineFile ?? '';
38
37
  const DECLARED = GATE.steps ?? {};
39
- /** Ключ задач дерева: по нему номер в причине отличается от версии, порта и года. */
38
+ /** The task key of the tree: by it a number in a reason differs from a version, a port and a year. */
40
39
  const TASK_KEY = CONFIG.board?.taskKey ?? '';
41
40
 
42
41
  /**
43
- * Профиль дерева ищется той же цепочкой, что и у гарда пуша: умолчание пакета, поверх него
44
- * надстройка проекта. Разойдись они — проверка судила бы не тот набор, который гоняет гард.
42
+ * The profile of the tree is looked for by the same chain as at the push guard: the package
43
+ * default, and the override of the project on top of it. Were they to diverge, the check would
44
+ * judge a set other than the one the guard runs.
45
45
  */
46
46
  const PROFILES = ['.claude/rt-kit/defaults/project.sh', '.claude/rt-kit/project.sh'];
47
47
 
48
48
  if (!PIPELINE || !existsSync(join(ROOT, PIPELINE))) {
49
- console.log('check-push-gate: пропущено — файла конвейера в дереве нет');
49
+ console.log('check-push-gate: skipped — the tree has no pipeline file');
50
50
  process.exit(0);
51
51
  }
52
52
 
53
53
  /**
54
- * Имена шагов конвейера. Образец задаёт дерево: у каждого хостинга своя форма записи, и
55
- * угадывать её за все три пакет не берётся. Умолчание — форма GitHub Actions.
54
+ * The names of the pipeline steps. The template is set by the tree: every hosting has its own form
55
+ * of writing, and the package does not undertake to guess it for all three. The default is the
56
+ * GitHub Actions form.
56
57
  */
57
58
  const stepPattern = new RegExp(GATE.stepPattern ?? '^\\s*-\\s*name:\\s*(.+?)\\s*$');
58
59
 
@@ -65,11 +66,12 @@ function pipelineSteps() {
65
66
  }
66
67
 
67
68
  /**
68
- * Набор гейта берётся у профиля его же оболочкой, а не переписывается сюда: два списка одного
69
- * набора расходятся молча, и расходиться начинают в тот день, когда правят один из них.
69
+ * The set of the gate is taken from the profile by its own shell, not rewritten here: two lists of
70
+ * one set diverge silently, and they start diverging the day one of them is edited.
70
71
  *
71
- * Профиля нет, функции в нём нет или оболочка отказала — набор неизвестен, и тогда проверка
72
- * судит только полноту объявлений: сверять строки не с чем.
72
+ * There is no profile, no function in it, or the shell refused — the set is unknown, and then the
73
+ * check judges only the completeness of the declarations: there is nothing to compare the lines
74
+ * against.
73
75
  */
74
76
  function gateChecks() {
75
77
  const present = PROFILES.filter((path) => existsSync(join(ROOT, path)));
@@ -90,8 +92,9 @@ rt_push_checks ""`;
90
92
  }
91
93
 
92
94
  /**
93
- * Номера задач, названные причиной. Ключ дерева обязателен: без него «663» неотличимо от порта,
94
- * года и номера редакции, и проверка спрашивала бы очередь работ обо всём подряд.
95
+ * The task numbers named by a reason. The key of the tree is mandatory: without it «663» is
96
+ * indistinguishable from a port, a year and an edition number, and the check would ask the work
97
+ * queue about everything in a row.
95
98
  */
96
99
  function taskNumbers(reason) {
97
100
  if (!TASK_KEY) {
@@ -101,9 +104,9 @@ function taskNumbers(reason) {
101
104
  }
102
105
 
103
106
  /**
104
- * Очередь работ ищется разрешением модуля, а не собирается здесь: у каждого хостинга она своя, и
105
- * дерево, у которого её нет, судится как прежде. Ярус тот же, что у гарда поставки: есть чем
106
- * спросить — спрашивает, нет — молчит.
107
+ * The work queue is looked for by module resolution, not assembled here: every hosting has its own,
108
+ * and a tree that has none is judged as before. The tier is the same as at the delivery guard:
109
+ * there is something to ask with — it asks, there is not — it stays silent.
107
110
  */
108
111
  async function boardModule() {
109
112
  if (!TASK_KEY) {
@@ -120,7 +123,7 @@ async function boardModule() {
120
123
  const steps = pipelineSteps();
121
124
  const checks = gateChecks();
122
125
  const problems = [];
123
- /** Задачи, названные причинами исключений: спрашиваются пачкой после разбора всех шагов. */
126
+ /** The tasks named by the reasons of exceptions: asked in one batch after all the steps are read. */
124
127
  const deferrals = [];
125
128
 
126
129
  for (const step of steps) {
@@ -128,7 +131,7 @@ for (const step of steps) {
128
131
 
129
132
  if (declaration === undefined) {
130
133
  problems.push(
131
- `шаг конвейера «${step}» не объявлен: закрой его строкой набора в pushGate.steps ` + 'либо объяви исключением с причиной'
134
+ `the pipeline step «${step}» is not declared: close it by a line of the set in pushGate.steps ` + 'or declare it an exclusion with a reason'
132
135
  );
133
136
  continue;
134
137
  }
@@ -136,7 +139,7 @@ for (const step of steps) {
136
139
  if (typeof declaration === 'object' && declaration !== null) {
137
140
  const reason = String(declaration.skip ?? '').trim();
138
141
  if (!reason) {
139
- problems.push(`шаг конвейера «${step}» объявлен исключением без причины — пустая причина не считается`);
142
+ problems.push(`the pipeline step «${step}» is declared an exclusion without a reason — an empty reason does not count`);
140
143
  continue;
141
144
  }
142
145
  for (const number of taskNumbers(reason)) {
@@ -147,27 +150,27 @@ for (const step of steps) {
147
150
 
148
151
  const line = String(declaration).trim();
149
152
  if (!line) {
150
- problems.push(`шаг конвейера «${step}» объявлен пустой строкой — назови команду либо объяви исключение`);
153
+ problems.push(`the pipeline step «${step}» is declared by an empty line — name the command or declare an exclusion`);
151
154
  continue;
152
155
  }
153
156
 
154
157
  if (checks && !checks.some((check) => check.includes(line))) {
155
- problems.push(`шаг конвейера «${step}» объявлен строкой «${line}», а набор гейта её не печатает`);
158
+ problems.push(`the pipeline step «${step}» is declared by the line «${line}», and the gate set does not print it`);
156
159
  }
157
160
  }
158
161
 
159
- /** Строка о шаге, которого в конвейере нет, — устаревшая: иначе объявления копят мёртвое. */
162
+ /** A line about a step the pipeline does not have is stale: otherwise declarations pile up the dead. */
160
163
  const known = new Set(steps);
161
164
  for (const step of Object.keys(DECLARED)) {
162
165
  if (!known.has(step)) {
163
- problems.push(`объявление «${step}» устарело — такого шага в ${PIPELINE} нет`);
166
+ problems.push(`the declaration «${step}» is stale — there is no such step in ${PIPELINE}`);
164
167
  }
165
168
  }
166
169
 
167
170
  /**
168
- * Мёртвый номер в причине делает исключение бессрочным, не сказав об этом ни строкой. Первый же
169
- * отказ сети кончает опрос целиком: спрашивать остальные незачем, а падать проверке, которую
170
- * гоняют в самолёте, — тем более.
171
+ * A dead number in a reason makes the exception open-ended without saying so by a single line. The
172
+ * very first refusal of the network ends the whole polling: there is no point asking the rest, and
173
+ * still less point in falling for a check that is run on a plane.
171
174
  */
172
175
  const board = deferrals.length > 0 ? await boardModule() : null;
173
176
  if (board) {
@@ -179,19 +182,19 @@ if (board) {
179
182
  break;
180
183
  }
181
184
  if (state && state.exists === false) {
182
- problems.push(`шаг конвейера «${step}» отложен до задачи ${TASK_KEY}-${number}, а такой задачи в очереди работ нет — отсрочка бессрочная`);
185
+ problems.push(`the pipeline step «${step}» is postponed until the task ${TASK_KEY}-${number}, and there is no such task in the work queue — the postponement is perpetual`);
183
186
  }
184
187
  }
185
188
  }
186
189
 
187
190
  if (problems.length > 0) {
188
- console.error(`check-push-gate: расхождений ${problems.length}\n`);
191
+ console.error(`check-push-gate: divergences ${problems.length}\n`);
189
192
  problems.forEach((problem) => console.error(` ${problem}`));
190
- console.error('\nНабор гейта пуша не бывает уже набора конвейера — правило поставки.');
193
+ console.error('\nThe push gate set is never narrower than the pipeline set — the rule of delivery.');
191
194
  process.exit(1);
192
195
  }
193
196
 
194
197
  const skipped = Object.values(DECLARED).filter((value) => typeof value === 'object' && value !== null).length;
195
198
  console.log(
196
- `check-push-gate: шагов конвейера ${steps.length}, закрыто набором ${steps.length - skipped}, ` + `объявлено исключениями ${skipped}`
199
+ `check-push-gate: pipeline steps ${steps.length}, closed by the set ${steps.length - skipped}, ` + `declared as exclusions ${skipped}`
197
200
  );