@rt-tools/agent-kit 0.24.0 → 0.27.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 (312) hide show
  1. package/assets/agents/business-analyst.md +51 -50
  2. package/assets/agents/cargo-writer.md +54 -0
  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-epic-link.github.mjs +29 -0
  15. package/assets/checks/board-epics.github.mjs +286 -49
  16. package/assets/checks/board-folders.mjs +61 -0
  17. package/assets/checks/board-gh.github.mjs +35 -26
  18. package/assets/checks/board-long-work.github.mjs +29 -25
  19. package/assets/checks/board-paths.github.mjs +21 -16
  20. package/assets/checks/board-pull-state.github.mjs +168 -0
  21. package/assets/checks/board-runs.github.mjs +45 -43
  22. package/assets/checks/board-task-dirs.github.mjs +98 -0
  23. package/assets/checks/board-titles.github.mjs +19 -17
  24. package/assets/checks/board.github.mjs +133 -194
  25. package/assets/checks/check-archive-age.mjs +23 -19
  26. package/assets/checks/check-board.github.mjs +131 -263
  27. package/assets/checks/check-descriptions.mjs +30 -29
  28. package/assets/checks/check-doc-paths.mjs +91 -88
  29. package/assets/checks/check-dupes.mjs +84 -80
  30. package/assets/checks/check-file-size.mjs +74 -71
  31. package/assets/checks/check-glossary.mjs +47 -37
  32. package/assets/checks/check-hook-scope.mjs +30 -27
  33. package/assets/checks/check-lib-layers.mjs +22 -21
  34. package/assets/checks/check-profile-drift.mjs +48 -43
  35. package/assets/checks/check-prose-style.mjs +138 -39
  36. package/assets/checks/check-push-gate.mjs +53 -50
  37. package/assets/checks/check-reuse.mjs +50 -40
  38. package/assets/checks/check-schema-drift.mjs +104 -84
  39. package/assets/checks/check-specs.mjs +155 -134
  40. package/assets/checks/check-state-next.mjs +66 -52
  41. package/assets/checks/check-states.mjs +32 -30
  42. package/assets/checks/check-styles.mjs +52 -51
  43. package/assets/checks/check-turn-map.mjs +54 -46
  44. package/assets/checks/epic-table.github.mjs +268 -0
  45. package/assets/checks/lib-boundaries.mjs +32 -30
  46. package/assets/checks/lib-common.mjs +30 -29
  47. package/assets/checks/lib-domains.mjs +34 -34
  48. package/assets/checks/lib-manifests.mjs +17 -15
  49. package/assets/checks/lib-reexports.mjs +18 -18
  50. package/assets/checks/rt-kit-checks.config.mjs +187 -142
  51. package/assets/checks/signals.mjs +43 -39
  52. package/assets/checks/spec-anchors.mjs +114 -87
  53. package/assets/checks/spec-common.mjs +128 -84
  54. package/assets/checks/spec-contract.mjs +30 -30
  55. package/assets/checks/spec-proposed.mjs +27 -24
  56. package/assets/checks/spec-scenarios.mjs +51 -28
  57. package/assets/checks/specs-for.mjs +214 -0
  58. package/assets/checks/task-new.github.mjs +315 -61
  59. package/assets/commands/feedback.md +65 -59
  60. package/assets/commands/next-session.md +64 -57
  61. package/assets/commands/night.md +115 -0
  62. package/assets/commands/skill-curator.md +83 -79
  63. package/assets/defaults/gate-map.sh +108 -97
  64. package/assets/defaults/project.sh +232 -185
  65. package/assets/defaults/shell.sh +73 -68
  66. package/assets/defaults/turn-map.md +47 -44
  67. package/assets/docs/GLOSSARY.md +142 -65
  68. package/assets/hooks/browser-device-id.sh +16 -12
  69. package/assets/hooks/browser-guard-device-id.sh +34 -28
  70. package/assets/hooks/browser-guard-no-asking.sh +5 -4
  71. package/assets/hooks/browser-guard-no-listing.sh +12 -11
  72. package/assets/hooks/browser-guard-no-other-drivers.sh +48 -42
  73. package/assets/hooks/browser-guard-require-select.sh +34 -23
  74. package/assets/hooks/claim-guard.sh +62 -56
  75. package/assets/hooks/commit-msg.sh +14 -10
  76. package/assets/hooks/conscience-guard.sh +91 -45
  77. package/assets/hooks/constitution-index.sh +16 -16
  78. package/assets/hooks/deny-tail.sh +28 -26
  79. package/assets/hooks/dev-server-guard.sh +50 -43
  80. package/assets/hooks/dispatch.sh +60 -46
  81. package/assets/hooks/docs-guard.sh +100 -91
  82. package/assets/hooks/epic-over.sh +49 -0
  83. package/assets/hooks/epic-stop-guard.sh +108 -0
  84. package/assets/hooks/exam-guard.sh +105 -93
  85. package/assets/hooks/git-guard-delivery-conflict.sh +41 -36
  86. package/assets/hooks/git-guard-delivery-draft.sh +48 -38
  87. package/assets/hooks/git-guard-delivery-epic.sh +167 -0
  88. package/assets/hooks/git-guard-delivery-folder.sh +50 -43
  89. package/assets/hooks/git-guard-delivery-signature.sh +119 -53
  90. package/assets/hooks/git-guard-delivery.sh +223 -183
  91. package/assets/hooks/git-guard-main.sh +38 -34
  92. package/assets/hooks/git-guard-push-tests.sh +99 -87
  93. package/assets/hooks/glossary-load.sh +23 -22
  94. package/assets/hooks/grill-gate-ask.sh +12 -11
  95. package/assets/hooks/grill-gate.sh +94 -87
  96. package/assets/hooks/guard-note.sh +20 -19
  97. package/assets/hooks/handoff-entry-guard.sh +45 -25
  98. package/assets/hooks/handoff-write.sh +74 -67
  99. package/assets/hooks/hook-input.sh +67 -58
  100. package/assets/hooks/lint-after-edit.sh +95 -61
  101. package/assets/hooks/observe.sh +28 -26
  102. package/assets/hooks/override-write-guard.sh +23 -21
  103. package/assets/hooks/postmortem-guard.sh +42 -39
  104. package/assets/hooks/profile-check.sh +22 -20
  105. package/assets/hooks/proposal-guard.sh +57 -49
  106. package/assets/hooks/prose-style-guard.sh +49 -24
  107. package/assets/hooks/qa-dataid-guard.sh +83 -58
  108. package/assets/hooks/rerun-guard.sh +31 -30
  109. package/assets/hooks/reuse-first-guard.sh +108 -87
  110. package/assets/hooks/roles.sh +14 -14
  111. package/assets/hooks/rule-article.sh +39 -34
  112. package/assets/hooks/rule-source-guard.sh +47 -42
  113. package/assets/hooks/skill-gate-layers.sh +63 -57
  114. package/assets/hooks/skill-gate-rearm.sh +15 -8
  115. package/assets/hooks/skill-gate.sh +89 -81
  116. package/assets/hooks/skill-loaded.sh +10 -6
  117. package/assets/hooks/sql-guard-parse.sh +71 -66
  118. package/assets/hooks/sql-guard-request.sh +51 -46
  119. package/assets/hooks/sql-guard-target.sh +60 -51
  120. package/assets/hooks/sql-guard-write.sh +87 -79
  121. package/assets/hooks/sql-guard.sh +52 -47
  122. package/assets/hooks/stand-login-guard.sh +43 -37
  123. package/assets/hooks/task-context-load.sh +60 -55
  124. package/assets/hooks/task-flow-context.sh +87 -69
  125. package/assets/hooks/task-flow-draft-guard.sh +55 -48
  126. package/assets/hooks/task-flow-guard.sh +67 -64
  127. package/assets/hooks/turn-entry-load.sh +39 -32
  128. package/assets/hooks/turn-exit-guard.sh +260 -204
  129. package/assets/hooks/turn-exit-patterns.sh +63 -0
  130. package/assets/hooks/utf8.sh +14 -11
  131. package/assets/hooks/waiting-turn-guard.sh +104 -94
  132. package/assets/hooks/window-fill-guard.sh +70 -62
  133. package/assets/hooks/work-start-guard.sh +52 -49
  134. package/assets/hooks/write-targets.sh +99 -44
  135. package/assets/laws/autonomous-work.md +29 -27
  136. package/assets/laws/code-structure.md +31 -30
  137. package/assets/laws/delivery.md +170 -137
  138. package/assets/laws/entity-editing.md +52 -50
  139. package/assets/laws/entity-models.md +14 -13
  140. package/assets/laws/frontend-application.md +39 -38
  141. package/assets/laws/lib-imports.md +27 -27
  142. package/assets/laws/lists.md +31 -29
  143. package/assets/laws/navigation.md +37 -37
  144. package/assets/laws/observability.md +41 -40
  145. package/assets/laws/project-documentation.md +106 -99
  146. package/assets/laws/reuse-first.md +31 -29
  147. package/assets/laws/shared-code.md +27 -27
  148. package/assets/laws/verifiability.md +131 -124
  149. package/assets/laws/work-conduct.md +250 -244
  150. package/assets/patterns/admin-lists-screen.md +72 -69
  151. package/assets/patterns/admin-nav-item.md +51 -46
  152. package/assets/patterns/angular-patterns-state.md +32 -31
  153. package/assets/patterns/api-layer-pair.md +33 -31
  154. package/assets/patterns/autonomous-work-run.md +50 -49
  155. package/assets/patterns/browser-verification-measure.md +124 -88
  156. package/assets/patterns/browser-verification-stand.md +169 -157
  157. package/assets/patterns/component-structure-new.md +51 -42
  158. package/assets/patterns/dependencies-upgrade.md +55 -39
  159. package/assets/patterns/doc-style-human.md +55 -37
  160. package/assets/patterns/doc-style-sweep.md +82 -79
  161. package/assets/patterns/doc-style-trace.md +87 -81
  162. package/assets/patterns/doc-style-write.md +130 -122
  163. package/assets/patterns/entity-aside.md +77 -63
  164. package/assets/patterns/entity-models-new.md +37 -37
  165. package/assets/patterns/entity-store.md +33 -33
  166. package/assets/patterns/git-workflow-commit.azure.md +94 -87
  167. package/assets/patterns/git-workflow-commit.github.md +160 -142
  168. package/assets/patterns/git-workflow-commit.gitlab.md +96 -90
  169. package/assets/patterns/git-workflow-docker.md +165 -147
  170. package/assets/patterns/git-workflow-freshness.md +45 -45
  171. package/assets/patterns/git-workflow-merge.md +102 -94
  172. package/assets/patterns/git-workflow-migration.md +54 -52
  173. package/assets/patterns/git-workflow-pr-ready.md +57 -56
  174. package/assets/patterns/git-workflow-pr.azure.md +127 -122
  175. package/assets/patterns/git-workflow-pr.github.md +186 -177
  176. package/assets/patterns/git-workflow-pr.gitlab.md +139 -132
  177. package/assets/patterns/git-workflow-restart.md +35 -31
  178. package/assets/patterns/git-workflow-secrets.md +80 -73
  179. package/assets/patterns/git-workflow-stack.md +136 -107
  180. package/assets/patterns/lib-layers-move.md +62 -53
  181. package/assets/patterns/lib-layers-new.md +59 -45
  182. package/assets/patterns/observability-record.md +72 -67
  183. package/assets/patterns/platform-access-di.md +31 -29
  184. package/assets/patterns/reuse-first-extend.md +66 -61
  185. package/assets/patterns/shared-code-new.md +39 -38
  186. package/assets/patterns/spec-driven-domain.md +161 -151
  187. package/assets/patterns/spec-driven-rule.md +179 -168
  188. package/assets/patterns/spec-driven-sweep.md +41 -39
  189. package/assets/patterns/status-report-table.github.md +48 -36
  190. package/assets/patterns/styling-bem-component.md +42 -42
  191. package/assets/patterns/styling-bem-layout.md +39 -34
  192. package/assets/patterns/styling-bem-sheet.md +59 -58
  193. package/assets/patterns/task-flow-archive.md +222 -215
  194. package/assets/patterns/task-flow-close.md +234 -203
  195. package/assets/patterns/task-flow-handoff.md +154 -145
  196. package/assets/patterns/task-flow-resume.md +138 -133
  197. package/assets/patterns/task-flow-start.md +228 -202
  198. package/assets/patterns/testing-e2e.md +102 -101
  199. package/assets/patterns/testing-unit.md +77 -70
  200. package/assets/patterns/ts-procedure.md +32 -29
  201. package/assets/patterns/turn-entry-map.md +50 -48
  202. package/assets/pitfalls/agent-kit.md +172 -142
  203. package/assets/pitfalls/doc-style.md +96 -91
  204. package/assets/pitfalls/git-workflow.azure.md +49 -46
  205. package/assets/pitfalls/git-workflow.github.md +270 -234
  206. package/assets/pitfalls/git-workflow.gitlab.md +49 -45
  207. package/assets/pitfalls/spec-driven.md +73 -71
  208. package/assets/pitfalls/styling-bem.md +46 -40
  209. package/assets/pitfalls/task-flow.md +262 -246
  210. package/assets/pitfalls/testing.md +99 -92
  211. package/assets/pitfalls/turn-conduct.md +96 -81
  212. package/assets/rules/angular-patterns.md +81 -80
  213. package/assets/rules/api-layer.md +77 -74
  214. package/assets/rules/autonomous-work.md +87 -74
  215. package/assets/rules/browser-verification.md +223 -214
  216. package/assets/rules/component-structure.md +72 -69
  217. package/assets/rules/dependencies.md +74 -67
  218. package/assets/rules/deploy-flow.azure.md +118 -108
  219. package/assets/rules/deploy-flow.github.md +145 -135
  220. package/assets/rules/deploy-flow.gitlab.md +120 -110
  221. package/assets/rules/doc-style.md +201 -173
  222. package/assets/rules/entity-conventions.needs-admin.md +81 -79
  223. package/assets/rules/entity-models.md +73 -70
  224. package/assets/rules/git-workflow.azure.md +224 -228
  225. package/assets/rules/git-workflow.github.md +268 -239
  226. package/assets/rules/git-workflow.gitlab.md +218 -217
  227. package/assets/rules/lib-layers.md +85 -86
  228. package/assets/rules/lists.md +101 -97
  229. package/assets/rules/navigation.md +78 -78
  230. package/assets/rules/observability.needs-app.md +165 -153
  231. package/assets/rules/platform-access.md +76 -75
  232. package/assets/rules/reuse-first.md +153 -143
  233. package/assets/rules/shared-code.md +82 -79
  234. package/assets/rules/spec-driven.md +279 -260
  235. package/assets/rules/status-report.md +62 -58
  236. package/assets/rules/styling-bem.md +81 -77
  237. package/assets/rules/task-flow.md +303 -270
  238. package/assets/rules/testing.md +224 -209
  239. package/assets/rules/turn-conduct.md +262 -258
  240. package/assets/rules/turn-entry.md +92 -87
  241. package/assets/rules/typescript-conventions.md +94 -88
  242. package/assets/samples/specs/_template/spec.md +47 -47
  243. package/assets/samples/tasks/_template/grill.md +20 -20
  244. package/assets/samples/tasks/_template/plan.md +32 -30
  245. package/assets/samples/tasks/_template/progress.md +16 -16
  246. package/assets/skills/agent-kit-extend.md +129 -113
  247. package/assets/skills/agent-kit.md +259 -233
  248. package/assets/skills/write-a-skill.md +76 -71
  249. package/assets/templates/findings.md +19 -19
  250. package/assets/templates/gate-map.sh +16 -14
  251. package/assets/templates/implementation.md +28 -27
  252. package/assets/templates/pattern.md +17 -17
  253. package/assets/templates/pitfalls.md +6 -6
  254. package/assets/templates/postmortem.md +24 -23
  255. package/assets/templates/project.sh +24 -24
  256. package/assets/templates/proposal.md +62 -60
  257. package/assets/templates/rule.md +38 -38
  258. package/assets/workflows/feature.js +46 -46
  259. package/assets/workflows/plan.js +54 -54
  260. package/bin/agent-kit.d.ts.map +1 -1
  261. package/bin/agent-kit.js +8 -1
  262. package/bin/agent-kit.js.map +1 -1
  263. package/lib/cargo-prose.d.ts +41 -0
  264. package/lib/cargo-prose.d.ts.map +1 -0
  265. package/lib/cargo-prose.js +88 -0
  266. package/lib/cargo-prose.js.map +1 -0
  267. package/lib/cargo.d.ts +12 -1
  268. package/lib/cargo.d.ts.map +1 -1
  269. package/lib/cargo.js +8 -2
  270. package/lib/cargo.js.map +1 -1
  271. package/lib/catalog.d.ts +2 -0
  272. package/lib/catalog.d.ts.map +1 -1
  273. package/lib/catalog.js +4 -3
  274. package/lib/catalog.js.map +1 -1
  275. package/lib/commands.d.ts.map +1 -1
  276. package/lib/commands.js +5 -2
  277. package/lib/commands.js.map +1 -1
  278. package/lib/companion.js +3 -2
  279. package/lib/companion.js.map +1 -1
  280. package/lib/enroll.d.ts +7 -1
  281. package/lib/enroll.d.ts.map +1 -1
  282. package/lib/enroll.js +12 -3
  283. package/lib/enroll.js.map +1 -1
  284. package/lib/fate.d.ts +29 -0
  285. package/lib/fate.d.ts.map +1 -0
  286. package/lib/fate.js +147 -0
  287. package/lib/fate.js.map +1 -0
  288. package/lib/override-marks.d.ts +7 -0
  289. package/lib/override-marks.d.ts.map +1 -1
  290. package/lib/override-marks.js +14 -0
  291. package/lib/override-marks.js.map +1 -1
  292. package/lib/plan.d.ts +11 -0
  293. package/lib/plan.d.ts.map +1 -1
  294. package/lib/plan.js +10 -1
  295. package/lib/plan.js.map +1 -1
  296. package/lib/ship.d.ts +29 -9
  297. package/lib/ship.d.ts.map +1 -1
  298. package/lib/ship.js +44 -2
  299. package/lib/ship.js.map +1 -1
  300. package/lib/shipment.d.ts.map +1 -1
  301. package/lib/shipment.fixture.d.ts +8 -1
  302. package/lib/shipment.fixture.d.ts.map +1 -1
  303. package/lib/shipment.fixture.js +9 -0
  304. package/lib/shipment.fixture.js.map +1 -1
  305. package/lib/shipment.js +38 -5
  306. package/lib/shipment.js.map +1 -1
  307. package/lib/sync.d.ts.map +1 -1
  308. package/lib/sync.js +45 -11
  309. package/lib/sync.js.map +1 -1
  310. package/package.json +1 -1
  311. package/rt-tools-agent-kit-0.27.0.tgz +0 -0
  312. package/rt-tools-agent-kit-0.24.0.tgz +0 -0
@@ -1,32 +1,40 @@
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. Called with `--json`, it reads the text from the input and prints the findings
20
+ * as data with a zero code: a machine decides for itself what to do about them.
18
21
  *
19
- * Границы слова пишутся оглядкой на буквы, а не `\b`: он считается по ASCII, кириллица под `\w`
20
- * не подпадает, и образец с ним молча не срабатывает ни разу.
22
+ * Word boundaries are written with a look at letters, not `\b`: it counts by ASCII, Cyrillic does
23
+ * not fall under `\w`, and a pattern with it silently never fires once.
21
24
  */
22
25
  import { readFileSync } from 'node:fs';
23
26
 
24
- /** Предел длины предложения в словах. Дальше читатель теряет начало. */
27
+ import { CONFIG } from './rt-kit-checks.config.mjs';
28
+
29
+ /** The sentence length limit in words. Beyond it the reader loses the beginning. */
25
30
  const WORDS_LIMIT = 40;
26
31
 
32
+ /** The argument by which the check is asked for findings as data: the text comes in on the input. */
33
+ const JSON_FLAG = '--json';
34
+
27
35
  /**
28
- * Признаки канцелярита. Каждый — образец и то, чем его заменить: без замены находка
29
- * читается как запрет писать.
36
+ * The signs of officialese. Each is a pattern and what to replace it with: without a replacement
37
+ * a finding reads as a ban on writing.
30
38
  */
31
39
  const MARKS = [
32
40
  [/(?<![а-яёА-ЯЁ])является(?![а-яёА-ЯЁ])/giu, 'сказать глаголом: «это», «работает», «стоит»'],
@@ -40,11 +48,11 @@ const MARKS = [
40
48
  [/(?<![а-яёА-ЯЁ])на основании(?![а-яёА-ЯЁ])/giu, '«по»'],
41
49
  [/(?<![а-яёА-ЯЁ])посредством(?![а-яёА-ЯЁ])/giu, '«через», «командой», «вызовом»'],
42
50
  [/(?<![а-яёА-ЯЁ])данн(ый|ая|ое)(?![а-яёА-ЯЁ])/giu, '«этот» или ничего'],
43
- // Форма «данные» бывает и существительным, и заменить его нечем: данные стенда — это данные.
44
- // Проверяется она поэтому по тому, что стоит следом: местоимением она читается перед словом,
45
- // которое сама и определяет. Перечень корней короткий намеренно — распознаётся то, что
46
- // встречалось, а ложный отказ здесь дороже пропуска: проверка стоит в наборе гейта пуша, и
47
- // красное на слове, которому нет замены, останавливает работу целиком.
51
+ // The form «данные» is also a noun, and there is nothing to replace it with: the data of a
52
+ // stand is data. So it is checked by what stands after it: as a pronoun it reads before the
53
+ // word it qualifies itself. The list of stems is deliberately short — what is recognised is
54
+ // what has been met, and a false refusal here costs more than a miss: the check stands in the
55
+ // set of the push gate, and red on a word that has no replacement stops the work entirely.
48
56
  [
49
57
  /(?<![а-яёА-ЯЁ])данные\s+(требовани|услови|значени|обстоятельств|сведени|фактор|параметр|вопрос|правил|подход|принцип|случа)[а-яё]*/giu,
50
58
  '«эти» или ничего',
@@ -59,7 +67,40 @@ const MARKS = [
59
67
  [/(?<![а-яёА-ЯЁ])как уже было сказано(?![а-яёА-ЯЁ])/giu, 'убрать: сказанное дважды не становится вернее'],
60
68
  ];
61
69
 
62
- /** Слова левой колонки словаря: они не пишутся и не произносятся нигде. */
70
+ /**
71
+ * The signs of officialese in English text. The rules layer is written in English, and the Russian
72
+ * set stays silent on it: a pattern with a Cyrillic boundary matches no Latin word at all.
73
+ *
74
+ * Both sets judge every line, and the language of the file is not determined: a Russian pattern
75
+ * does not match on an English line, nor an English one on a Russian line, and determining the
76
+ * language by the directory or by the letters would add branching for nothing. The word boundary is
77
+ * a Latin letter, for the same reason as the Cyrillic one above: `\b` behaves in its own way with
78
+ * an apostrophe and a hyphen.
79
+ */
80
+ const MARKS_EN = [
81
+ [/(?<![A-Za-z])in order to(?![A-Za-z])/giu, '«to»'],
82
+ [/(?<![A-Za-z])for the purpose of(?![A-Za-z])/giu, '«to», «for»'],
83
+ [/(?<![A-Za-z])in the event that(?![A-Za-z])/giu, '«if»'],
84
+ [/(?<![A-Za-z])due to the fact that(?![A-Za-z])/giu, '«because»'],
85
+ [/(?<![A-Za-z])at this point in time(?![A-Za-z])/giu, '«now»'],
86
+ [/(?<![A-Za-z])prior to(?![A-Za-z])/giu, '«before»'],
87
+ [/(?<![A-Za-z])subsequent to(?![A-Za-z])/giu, '«after»'],
88
+ [/(?<![A-Za-z])with regard to(?![A-Za-z])/giu, '«about», «on»'],
89
+ [/(?<![A-Za-z])in terms of(?![A-Za-z])/giu, 'name the relation directly'],
90
+ [/(?<![A-Za-z])utili[sz](e|es|ed|ing|ation)(?![A-Za-z])/giu, '«use»'],
91
+ [/(?<![A-Za-z])leverag(e|es|ed|ing)(?![A-Za-z])/giu, '«use»'],
92
+ [/(?<![A-Za-z])facilitat(e|es|ed|ing)(?![A-Za-z])/giu, 'name the action itself: «helps», «lets», «runs»'],
93
+ [/(?<![A-Za-z])(is|are|was|were) able to(?![A-Za-z])/giu, '«can», «could»'],
94
+ [/(?<![A-Za-z])(has|have|had) the ability to(?![A-Za-z])/giu, '«can», «could»'],
95
+ [/(?<![A-Za-z])it should be noted that(?![A-Za-z])/giu, 'drop it: if it is worth noting, note it'],
96
+ [/(?<![A-Za-z])it is (important|worth) (to note|noting) that(?![A-Za-z])/giu, 'drop it: say the thing'],
97
+ [/(?<![A-Za-z])as (previously|already) (mentioned|stated|noted)(?![A-Za-z])/giu, 'drop it: said twice is not truer'],
98
+ [/(?<![A-Za-z])the aforementioned(?![A-Za-z])/giu, 'name it again'],
99
+ [/(?<![A-Za-z])in a timely manner(?![A-Za-z])/giu, '«on time», «promptly»'],
100
+ [/(?<![A-Za-z])a number of(?![A-Za-z])/giu, '«some», «several», or the number'],
101
+ ];
102
+
103
+ /** The words of the left column of the glossary: they are neither written nor said anywhere. */
63
104
  const GLOSSARY_BANS = [
64
105
  [/(?<![а-яёА-ЯЁ])таск[аиуе](?![а-яёА-ЯЁ])/giu, 'задача'],
65
106
  [/(?<![а-яёА-ЯЁ])тикет[а-яё]*(?![а-яёА-ЯЁ])/giu, 'задача'],
@@ -71,58 +112,104 @@ const GLOSSARY_BANS = [
71
112
  [/(?<![а-яёА-ЯЁ])скилл[а-яё]*(?![а-яёА-ЯЁ])/giu, 'правило, паттерн или скил без закона'],
72
113
  ];
73
114
 
115
+ /**
116
+ * The tree's words beyond the package ones: they are read from the check settings and fall into the
117
+ * same set.
118
+ *
119
+ * A tree writes its own half of the "Not written here" table by a glossary override, and without
120
+ * this nothing judged that half: the set was hard-coded. A tree used to start a check of its own
121
+ * alongside — a second set of patterns for one requirement, and they could diverge silently.
122
+ */
123
+ const TREE_BANS = (CONFIG.prose?.glossaryBans ?? [])
124
+ .filter((one) => one && typeof one.pattern === 'string' && typeof one.fix === 'string')
125
+ .map((one) => {
126
+ try {
127
+ return [new RegExp(one.pattern, 'giu'), one.fix];
128
+ } catch {
129
+ // An unfit pattern does not drop the whole check: the rest of the words are judged as before.
130
+ return null;
131
+ }
132
+ })
133
+ .filter(Boolean);
134
+
74
135
  const CODE_FENCE = /^\s*```/;
75
136
 
76
137
  /**
77
- * Заголовки, которые совпадают с образцом канцелярита, но прозой не являются: это имена
78
- * обязательных разделов спека, и набор разделов требует их дословно.
138
+ * Headings that match a pattern of officialese but are not prose: these are the names of the
139
+ * mandatory spec sections, and the section set requires them word for word.
79
140
  *
80
- * Перечислены поимённо, а не сняты правилом: слово «данные» в предложении канцеляритом быть не
81
- * перестаёт — «данные требования» ловится по-прежнему. Без этого исключения ни один новый спек
82
- * не написать вовсе: набор разделов требует заголовок, а проверка слога его отбивает, и оба
83
- * требования верны каждое по-своему.
141
+ * They are listed by name rather than lifted by a rule: the word «данные» in a sentence does not
142
+ * stop being officialese — «данные требования» is still caught. Without this exception no new spec
143
+ * could be written at all: the section set requires the heading, and the style check refuses it,
144
+ * and both requirements are right each in its own way.
84
145
  */
85
146
  const HEADING_EXCEPTIONS = new Set(['Данные']);
86
147
 
87
- /** Заголовок, чьё имя названо исключением: судить в нём нечего — это имя раздела, а не фраза. */
148
+ /** A heading whose name is named as an exception: there is nothing to judge in it — it is a section name, not a phrase. */
88
149
  function isExemptHeading(line) {
89
150
  const heading = line.match(/^\s*#{1,6}\s+(.+?)\s*$/);
90
151
 
91
152
  return heading !== null && HEADING_EXCEPTIONS.has(heading[1]);
92
153
  }
93
154
 
94
- /** Строки вне блоков кода: в блоках лежат команды и вывод, и слог там не судится. */
155
+ /**
156
+ * A quotation of a law: a quote block introduced by a line with the address of a law.
157
+ *
158
+ * The words the check refuses stand in the laws themselves by the dozen. Having quoted an article
159
+ * word for word, the work runs into a refusal: fix the quotation and you lie, leave it and you
160
+ * cannot push. So only one's own writing is judged, and someone else's text in a quotation stays as
161
+ * it is.
162
+ *
163
+ * The sign is deliberately narrow: not any quotation, but one introduced by the address of a law.
164
+ * Otherwise a quote block would become the place where one's own writing is hidden from the check.
165
+ */
166
+ const LAW_ADDRESS = /docs\/constitution\/[A-Za-z0-9_./-]+\.md/;
167
+ const QUOTE = /^\s*>/;
168
+
169
+ /** Lines outside code blocks and outside quotations of laws: someone else's words lie there, and style is not judged there. */
95
170
  function proseLines(text) {
96
171
  const out = [];
97
172
  let inFence = false;
173
+ let introducesLaw = false;
174
+ let inLawQuote = false;
98
175
  text.split('\n').forEach((line, index) => {
99
176
  if (CODE_FENCE.test(line)) {
100
177
  inFence = !inFence;
101
178
  return;
102
179
  }
103
180
  if (inFence) return;
181
+
182
+ if (QUOTE.test(line)) {
183
+ if (!inLawQuote && (introducesLaw || LAW_ADDRESS.test(line))) inLawQuote = true;
184
+ if (inLawQuote) return;
185
+ } else {
186
+ inLawQuote = false;
187
+ // The line that introduces a quotation is the one before it that names the address of a law.
188
+ if (line.trim() !== '') introducesLaw = LAW_ADDRESS.test(line);
189
+ }
190
+
104
191
  if (isExemptHeading(line)) return;
105
192
  out.push([index + 1, line]);
106
193
  });
107
194
  return out;
108
195
  }
109
196
 
110
- /** Находки одной строки: образец, что нашли, чем заменить. */
197
+ /** The findings of one line: the pattern, what was found, what to replace it with. */
111
198
  function findingsIn(line) {
112
199
  const found = [];
113
- [...MARKS, ...GLOSSARY_BANS].forEach(([re, fix]) => {
200
+ [...MARKS, ...MARKS_EN, ...GLOSSARY_BANS, ...TREE_BANS].forEach(([re, fix]) => {
114
201
  const hit = line.match(re);
115
202
  if (hit) found.push([hit[0], fix]);
116
203
  });
117
204
  return found;
118
205
  }
119
206
 
120
- /** Слишком длинное предложение: читатель теряет начало раньше, чем автор доходит до конца. */
207
+ /** A sentence that is too long: the reader loses the beginning before the author reaches the end. */
121
208
  function longSentences(line) {
122
209
  return line
123
210
  .split(/(?<=[.!?])\s+/)
124
211
  .filter((sentence) => sentence.trim().split(/\s+/).length > WORDS_LIMIT)
125
- .map((sentence) => [`${sentence.trim().split(/\s+/).length} слов в предложении`, `делить: предел ${WORDS_LIMIT}`]);
212
+ .map((sentence) => [`${sentence.trim().split(/\s+/).length} words in a sentence`, `split it: the limit is ${WORDS_LIMIT}`]);
126
213
  }
127
214
 
128
215
  export function checkProse(text) {
@@ -131,16 +218,28 @@ export function checkProse(text) {
131
218
  );
132
219
  }
133
220
 
134
- const files = process.argv.slice(2);
135
- if (files.length > 0) {
221
+ // Запуск строкой отличается от вызова из другого модуля именем в строке запуска: без этого
222
+ // условия модуль, который просто позвали, читал бы доводы чужой команды как имена файлов — и
223
+ // падал бы на первом же из них. Тот же приём стоит у команд груза.
224
+ const called = process.argv[1]?.endsWith('check-prose-style.mjs') === true;
225
+ const asked = called ? process.argv.slice(2) : [];
226
+ const files = asked.filter((one) => one !== JSON_FLAG);
227
+
228
+ // Ответ машине: текст приходит на вход, находки уходят разбором. Так проверку зовёт тот, кто
229
+ // держит текст в памяти, а не на диске: уезжающий груз лежит блоками внутри файла дня, и
230
+ // именами файлов его не назвать. Код возврата тут нулевой всегда — находка машине не отказ, а
231
+ // данные: отказ по ней выносит зовущий.
232
+ if (asked.includes(JSON_FLAG)) {
233
+ process.stdout.write(JSON.stringify(checkProse(readFileSync(0, 'utf8'))));
234
+ } else if (files.length > 0) {
136
235
  const problems = files.flatMap((file) =>
137
236
  checkProse(readFileSync(file, 'utf8')).map((p) => ` ${file}:${p.line} — «${p.what}» → ${p.fix}`)
138
237
  );
139
238
  if (problems.length > 0) {
140
- console.error(`check-prose-style: находок ${problems.length}\n`);
239
+ console.error(`check-prose-style: findings ${problems.length}\n`);
141
240
  problems.forEach((p) => console.error(p));
142
- console.error('\nСлог — правило о текстах. Проверка видит перечисленные признаки и только их.');
241
+ console.error('\nWording is the rule about texts. The check sees the listed signs and only them.');
143
242
  process.exit(1);
144
243
  }
145
- console.log(`check-prose-style: проверено файлов ${files.length}, находок нет`);
244
+ console.log(`check-prose-style: files checked ${files.length}, no findings`);
146
245
  }
@@ -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
  );