@rt-tools/agent-kit 0.24.0 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (279) hide show
  1. package/assets/agents/business-analyst.md +51 -50
  2. package/assets/agents/conscience.md +37 -35
  3. package/assets/agents/project-manager.md +49 -48
  4. package/assets/agents/prose-editor.md +31 -29
  5. package/assets/agents/qa-engineer.md +50 -48
  6. package/assets/agents/rules-reviewer.md +63 -58
  7. package/assets/agents/skill-curator.md +83 -78
  8. package/assets/agents/spec-critic.md +34 -29
  9. package/assets/agents/spec-writer.md +35 -32
  10. package/assets/agents/strict-teacher.md +39 -37
  11. package/assets/checks/archive-age.mjs +48 -28
  12. package/assets/checks/archive-prune.mjs +16 -14
  13. package/assets/checks/board-epics.github.mjs +75 -41
  14. package/assets/checks/board-folders.mjs +61 -0
  15. package/assets/checks/board-gh.github.mjs +35 -26
  16. package/assets/checks/board-long-work.github.mjs +24 -24
  17. package/assets/checks/board-paths.github.mjs +21 -16
  18. package/assets/checks/board-runs.github.mjs +45 -43
  19. package/assets/checks/board-titles.github.mjs +19 -17
  20. package/assets/checks/board.github.mjs +149 -127
  21. package/assets/checks/check-archive-age.mjs +23 -19
  22. package/assets/checks/check-board.github.mjs +172 -164
  23. package/assets/checks/check-descriptions.mjs +30 -29
  24. package/assets/checks/check-doc-paths.mjs +91 -88
  25. package/assets/checks/check-dupes.mjs +84 -80
  26. package/assets/checks/check-file-size.mjs +74 -71
  27. package/assets/checks/check-glossary.mjs +47 -37
  28. package/assets/checks/check-hook-scope.mjs +30 -27
  29. package/assets/checks/check-lib-layers.mjs +22 -21
  30. package/assets/checks/check-profile-drift.mjs +48 -43
  31. package/assets/checks/check-prose-style.mjs +120 -37
  32. package/assets/checks/check-push-gate.mjs +53 -50
  33. package/assets/checks/check-reuse.mjs +50 -40
  34. package/assets/checks/check-schema-drift.mjs +87 -83
  35. package/assets/checks/check-specs.mjs +155 -134
  36. package/assets/checks/check-state-next.mjs +66 -52
  37. package/assets/checks/check-states.mjs +32 -30
  38. package/assets/checks/check-styles.mjs +52 -51
  39. package/assets/checks/check-turn-map.mjs +54 -46
  40. package/assets/checks/lib-boundaries.mjs +32 -30
  41. package/assets/checks/lib-common.mjs +30 -29
  42. package/assets/checks/lib-domains.mjs +34 -34
  43. package/assets/checks/lib-manifests.mjs +17 -15
  44. package/assets/checks/lib-reexports.mjs +18 -18
  45. package/assets/checks/rt-kit-checks.config.mjs +174 -142
  46. package/assets/checks/signals.mjs +43 -39
  47. package/assets/checks/spec-anchors.mjs +114 -87
  48. package/assets/checks/spec-common.mjs +128 -84
  49. package/assets/checks/spec-contract.mjs +30 -30
  50. package/assets/checks/spec-proposed.mjs +27 -24
  51. package/assets/checks/spec-scenarios.mjs +51 -28
  52. package/assets/checks/task-new.github.mjs +85 -56
  53. package/assets/commands/feedback.md +65 -59
  54. package/assets/commands/next-session.md +64 -57
  55. package/assets/commands/skill-curator.md +83 -79
  56. package/assets/defaults/gate-map.sh +108 -97
  57. package/assets/defaults/project.sh +225 -185
  58. package/assets/defaults/shell.sh +73 -68
  59. package/assets/defaults/turn-map.md +45 -44
  60. package/assets/docs/GLOSSARY.md +142 -65
  61. package/assets/hooks/browser-device-id.sh +12 -12
  62. package/assets/hooks/browser-guard-device-id.sh +30 -28
  63. package/assets/hooks/browser-guard-no-asking.sh +5 -4
  64. package/assets/hooks/browser-guard-no-listing.sh +12 -11
  65. package/assets/hooks/browser-guard-no-other-drivers.sh +48 -42
  66. package/assets/hooks/browser-guard-require-select.sh +34 -23
  67. package/assets/hooks/claim-guard.sh +62 -56
  68. package/assets/hooks/commit-msg.sh +11 -10
  69. package/assets/hooks/conscience-guard.sh +91 -45
  70. package/assets/hooks/constitution-index.sh +16 -16
  71. package/assets/hooks/deny-tail.sh +28 -26
  72. package/assets/hooks/dev-server-guard.sh +46 -43
  73. package/assets/hooks/dispatch.sh +60 -46
  74. package/assets/hooks/docs-guard.sh +100 -91
  75. package/assets/hooks/exam-guard.sh +105 -93
  76. package/assets/hooks/git-guard-delivery-conflict.sh +38 -36
  77. package/assets/hooks/git-guard-delivery-draft.sh +45 -38
  78. package/assets/hooks/git-guard-delivery-folder.sh +50 -43
  79. package/assets/hooks/git-guard-delivery-signature.sh +88 -52
  80. package/assets/hooks/git-guard-delivery.sh +196 -180
  81. package/assets/hooks/git-guard-main.sh +38 -34
  82. package/assets/hooks/git-guard-push-tests.sh +99 -87
  83. package/assets/hooks/glossary-load.sh +23 -22
  84. package/assets/hooks/grill-gate-ask.sh +12 -11
  85. package/assets/hooks/grill-gate.sh +94 -87
  86. package/assets/hooks/guard-note.sh +20 -19
  87. package/assets/hooks/handoff-entry-guard.sh +26 -24
  88. package/assets/hooks/handoff-write.sh +74 -67
  89. package/assets/hooks/hook-input.sh +67 -58
  90. package/assets/hooks/lint-after-edit.sh +95 -61
  91. package/assets/hooks/observe.sh +28 -26
  92. package/assets/hooks/override-write-guard.sh +23 -21
  93. package/assets/hooks/postmortem-guard.sh +42 -39
  94. package/assets/hooks/profile-check.sh +22 -20
  95. package/assets/hooks/proposal-guard.sh +57 -49
  96. package/assets/hooks/prose-style-guard.sh +19 -17
  97. package/assets/hooks/qa-dataid-guard.sh +52 -49
  98. package/assets/hooks/rerun-guard.sh +31 -30
  99. package/assets/hooks/reuse-first-guard.sh +108 -87
  100. package/assets/hooks/roles.sh +14 -14
  101. package/assets/hooks/rule-article.sh +36 -34
  102. package/assets/hooks/rule-source-guard.sh +47 -42
  103. package/assets/hooks/skill-gate-layers.sh +59 -57
  104. package/assets/hooks/skill-gate-rearm.sh +15 -8
  105. package/assets/hooks/skill-gate.sh +89 -81
  106. package/assets/hooks/skill-loaded.sh +6 -6
  107. package/assets/hooks/sql-guard-parse.sh +68 -66
  108. package/assets/hooks/sql-guard-request.sh +48 -46
  109. package/assets/hooks/sql-guard-target.sh +57 -51
  110. package/assets/hooks/sql-guard-write.sh +84 -79
  111. package/assets/hooks/sql-guard.sh +52 -47
  112. package/assets/hooks/stand-login-guard.sh +40 -37
  113. package/assets/hooks/task-context-load.sh +60 -55
  114. package/assets/hooks/task-flow-context.sh +87 -69
  115. package/assets/hooks/task-flow-draft-guard.sh +55 -48
  116. package/assets/hooks/task-flow-guard.sh +67 -64
  117. package/assets/hooks/turn-entry-load.sh +39 -32
  118. package/assets/hooks/turn-exit-guard.sh +256 -204
  119. package/assets/hooks/turn-exit-patterns.sh +53 -0
  120. package/assets/hooks/utf8.sh +11 -11
  121. package/assets/hooks/waiting-turn-guard.sh +94 -94
  122. package/assets/hooks/window-fill-guard.sh +70 -62
  123. package/assets/hooks/work-start-guard.sh +52 -49
  124. package/assets/hooks/write-targets.sh +96 -44
  125. package/assets/laws/autonomous-work.md +29 -27
  126. package/assets/laws/code-structure.md +31 -30
  127. package/assets/laws/delivery.md +148 -137
  128. package/assets/laws/entity-editing.md +52 -50
  129. package/assets/laws/entity-models.md +14 -13
  130. package/assets/laws/frontend-application.md +39 -38
  131. package/assets/laws/lib-imports.md +27 -27
  132. package/assets/laws/lists.md +31 -29
  133. package/assets/laws/navigation.md +37 -37
  134. package/assets/laws/observability.md +41 -40
  135. package/assets/laws/project-documentation.md +106 -99
  136. package/assets/laws/reuse-first.md +31 -29
  137. package/assets/laws/shared-code.md +27 -27
  138. package/assets/laws/verifiability.md +131 -124
  139. package/assets/laws/work-conduct.md +250 -244
  140. package/assets/patterns/admin-lists-screen.md +72 -69
  141. package/assets/patterns/admin-nav-item.md +51 -46
  142. package/assets/patterns/angular-patterns-state.md +32 -31
  143. package/assets/patterns/api-layer-pair.md +33 -31
  144. package/assets/patterns/autonomous-work-run.md +50 -49
  145. package/assets/patterns/browser-verification-measure.md +124 -88
  146. package/assets/patterns/browser-verification-stand.md +169 -157
  147. package/assets/patterns/component-structure-new.md +51 -42
  148. package/assets/patterns/dependencies-upgrade.md +55 -39
  149. package/assets/patterns/doc-style-human.md +55 -37
  150. package/assets/patterns/doc-style-sweep.md +82 -79
  151. package/assets/patterns/doc-style-trace.md +87 -81
  152. package/assets/patterns/doc-style-write.md +130 -122
  153. package/assets/patterns/entity-aside.md +77 -63
  154. package/assets/patterns/entity-models-new.md +37 -37
  155. package/assets/patterns/entity-store.md +33 -33
  156. package/assets/patterns/git-workflow-commit.azure.md +93 -86
  157. package/assets/patterns/git-workflow-commit.github.md +152 -141
  158. package/assets/patterns/git-workflow-commit.gitlab.md +95 -89
  159. package/assets/patterns/git-workflow-docker.md +165 -147
  160. package/assets/patterns/git-workflow-freshness.md +45 -45
  161. package/assets/patterns/git-workflow-merge.md +98 -93
  162. package/assets/patterns/git-workflow-migration.md +54 -52
  163. package/assets/patterns/git-workflow-pr-ready.md +57 -56
  164. package/assets/patterns/git-workflow-pr.azure.md +126 -121
  165. package/assets/patterns/git-workflow-pr.github.md +179 -175
  166. package/assets/patterns/git-workflow-pr.gitlab.md +138 -131
  167. package/assets/patterns/git-workflow-restart.md +35 -31
  168. package/assets/patterns/git-workflow-secrets.md +80 -73
  169. package/assets/patterns/git-workflow-stack.md +131 -106
  170. package/assets/patterns/lib-layers-move.md +62 -53
  171. package/assets/patterns/lib-layers-new.md +59 -45
  172. package/assets/patterns/observability-record.md +72 -67
  173. package/assets/patterns/platform-access-di.md +31 -29
  174. package/assets/patterns/reuse-first-extend.md +66 -61
  175. package/assets/patterns/shared-code-new.md +39 -38
  176. package/assets/patterns/spec-driven-domain.md +161 -151
  177. package/assets/patterns/spec-driven-rule.md +179 -168
  178. package/assets/patterns/spec-driven-sweep.md +41 -39
  179. package/assets/patterns/status-report-table.github.md +37 -36
  180. package/assets/patterns/styling-bem-component.md +42 -42
  181. package/assets/patterns/styling-bem-layout.md +39 -34
  182. package/assets/patterns/styling-bem-sheet.md +59 -58
  183. package/assets/patterns/task-flow-archive.md +222 -215
  184. package/assets/patterns/task-flow-close.md +215 -203
  185. package/assets/patterns/task-flow-handoff.md +154 -145
  186. package/assets/patterns/task-flow-resume.md +138 -133
  187. package/assets/patterns/task-flow-start.md +204 -192
  188. package/assets/patterns/testing-e2e.md +102 -101
  189. package/assets/patterns/testing-unit.md +77 -70
  190. package/assets/patterns/ts-procedure.md +32 -29
  191. package/assets/patterns/turn-entry-map.md +50 -48
  192. package/assets/pitfalls/agent-kit.md +152 -141
  193. package/assets/pitfalls/doc-style.md +96 -91
  194. package/assets/pitfalls/git-workflow.azure.md +49 -46
  195. package/assets/pitfalls/git-workflow.github.md +264 -234
  196. package/assets/pitfalls/git-workflow.gitlab.md +49 -45
  197. package/assets/pitfalls/spec-driven.md +73 -71
  198. package/assets/pitfalls/styling-bem.md +46 -40
  199. package/assets/pitfalls/task-flow.md +262 -246
  200. package/assets/pitfalls/testing.md +99 -92
  201. package/assets/pitfalls/turn-conduct.md +96 -81
  202. package/assets/rules/angular-patterns.md +81 -80
  203. package/assets/rules/api-layer.md +77 -74
  204. package/assets/rules/autonomous-work.md +75 -74
  205. package/assets/rules/browser-verification.md +223 -214
  206. package/assets/rules/component-structure.md +72 -69
  207. package/assets/rules/dependencies.md +74 -67
  208. package/assets/rules/deploy-flow.azure.md +118 -108
  209. package/assets/rules/deploy-flow.github.md +145 -135
  210. package/assets/rules/deploy-flow.gitlab.md +120 -110
  211. package/assets/rules/doc-style.md +198 -173
  212. package/assets/rules/entity-conventions.needs-admin.md +81 -79
  213. package/assets/rules/entity-models.md +73 -70
  214. package/assets/rules/git-workflow.azure.md +224 -228
  215. package/assets/rules/git-workflow.github.md +250 -239
  216. package/assets/rules/git-workflow.gitlab.md +218 -217
  217. package/assets/rules/lib-layers.md +85 -86
  218. package/assets/rules/lists.md +101 -97
  219. package/assets/rules/navigation.md +78 -78
  220. package/assets/rules/observability.needs-app.md +165 -153
  221. package/assets/rules/platform-access.md +76 -75
  222. package/assets/rules/reuse-first.md +153 -143
  223. package/assets/rules/shared-code.md +82 -79
  224. package/assets/rules/spec-driven.md +272 -260
  225. package/assets/rules/status-report.md +55 -58
  226. package/assets/rules/styling-bem.md +81 -77
  227. package/assets/rules/task-flow.md +282 -270
  228. package/assets/rules/testing.md +224 -209
  229. package/assets/rules/turn-conduct.md +255 -258
  230. package/assets/rules/turn-entry.md +92 -87
  231. package/assets/rules/typescript-conventions.md +94 -88
  232. package/assets/samples/specs/_template/spec.md +47 -47
  233. package/assets/samples/tasks/_template/grill.md +20 -20
  234. package/assets/samples/tasks/_template/plan.md +32 -30
  235. package/assets/samples/tasks/_template/progress.md +16 -16
  236. package/assets/skills/agent-kit-extend.md +129 -113
  237. package/assets/skills/agent-kit.md +235 -211
  238. package/assets/skills/write-a-skill.md +76 -71
  239. package/assets/templates/findings.md +19 -19
  240. package/assets/templates/gate-map.sh +16 -14
  241. package/assets/templates/implementation.md +28 -27
  242. package/assets/templates/pattern.md +17 -17
  243. package/assets/templates/pitfalls.md +6 -6
  244. package/assets/templates/postmortem.md +24 -23
  245. package/assets/templates/project.sh +24 -24
  246. package/assets/templates/proposal.md +62 -60
  247. package/assets/templates/rule.md +38 -38
  248. package/assets/workflows/feature.js +46 -46
  249. package/assets/workflows/plan.js +54 -54
  250. package/lib/catalog.d.ts +2 -0
  251. package/lib/catalog.d.ts.map +1 -1
  252. package/lib/catalog.js +4 -3
  253. package/lib/catalog.js.map +1 -1
  254. package/lib/commands.d.ts.map +1 -1
  255. package/lib/commands.js +5 -2
  256. package/lib/commands.js.map +1 -1
  257. package/lib/companion.js +3 -2
  258. package/lib/companion.js.map +1 -1
  259. package/lib/enroll.d.ts +7 -1
  260. package/lib/enroll.d.ts.map +1 -1
  261. package/lib/enroll.js +12 -3
  262. package/lib/enroll.js.map +1 -1
  263. package/lib/plan.d.ts +11 -0
  264. package/lib/plan.d.ts.map +1 -1
  265. package/lib/plan.js +10 -1
  266. package/lib/plan.js.map +1 -1
  267. package/lib/ship.d.ts +0 -7
  268. package/lib/ship.d.ts.map +1 -1
  269. package/lib/ship.js +10 -2
  270. package/lib/ship.js.map +1 -1
  271. package/lib/shipment.d.ts.map +1 -1
  272. package/lib/shipment.js +6 -2
  273. package/lib/shipment.js.map +1 -1
  274. package/lib/sync.d.ts.map +1 -1
  275. package/lib/sync.js +45 -11
  276. package/lib/sync.js.map +1 -1
  277. package/package.json +1 -1
  278. package/rt-tools-agent-kit-0.26.0.tgz +0 -0
  279. package/rt-tools-agent-kit-0.24.0.tgz +0 -0
@@ -1,26 +1,26 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * Сверка длины описаний правил и паттернов.
3
+ * The audit of the length of rule and pattern descriptions.
4
4
  *
5
- * Описание едет в системный промпт каждого захода — все, сколько их есть в дереве, — и
6
- * платит их заход, чем бы ни занимался. Тем оно и отличается от тела правила: тело
7
- * исполнитель читает сам и платит за это ходом, описание приходит даром. Даром — пока
8
- * оно короткое.
5
+ * A description travels into the system prompt of every session — all of them, as many as
6
+ * the tree has — and that session pays for them whatever it is doing. That is how it differs
7
+ * from the body of the rule: the body the executor reads itself and pays for it with a turn,
8
+ * while the description comes free. Free — as long as it is short.
9
9
  *
10
- * Растёт оно само: описание пишут вслед за правилом и пересказывают в нём содержимое.
11
- * Ни одна проверка длины не считала, и на дереве, где эта сверка заводилась, сорок
12
- * описаний из семидесяти четырёх переросли предел.
10
+ * It grows by itself: a description is written after the rule and retells its content.
11
+ * No check counted the length, and in the tree where this audit was created forty
12
+ * descriptions out of seventy-four had outgrown the limit.
13
13
  *
14
- * Отвечает описание на один вопрос — брать это правило или нет. Всё, что отвечает на
15
- * вопрос «а что там внутри», приходит вторым разом вместе с самим правилом.
14
+ * A description answers one question — take this rule or not. Everything that answers the
15
+ * question "and what is inside" comes a second time together with the rule itself.
16
16
  *
17
- * FAIL-OPEN: каталога скилов в дереве нет — сверять нечего, нулевой код.
17
+ * FAIL-OPEN: there is no skills directory in the tree — nothing to check, zero code.
18
18
  *
19
- * Описание длиннее предела, оставленное намеренно, называется в перечне принятого долга
20
- * рядом — по имени скила, с причиной. Молчаливое превышение и осознанное выглядят
21
- * одинаково, поэтому второе называется списком.
19
+ * A description longer than the limit, left deliberately, is named in the list of accepted
20
+ * debt next to it — by the skill name, with a reason. A silent excess and a deliberate one
21
+ * look the same, so the second is named in a list.
22
22
  *
23
- * Ненулевой код возврата и перечень превысивших с числами.
23
+ * A non-zero exit code and the list of those over the limit with the numbers.
24
24
  */
25
25
  import { existsSync, readFileSync, readdirSync } from 'node:fs';
26
26
  import { join } from 'node:path';
@@ -30,21 +30,22 @@ const SKILLS = join(ROOT, '.claude/skills');
30
30
  const DEBT = join(ROOT, '.claude/rt-kit/description-debt.json');
31
31
 
32
32
  /**
33
- * Предел длины описания в знаках.
33
+ * The limit of a description length in characters.
34
34
  *
35
- * Считаются знаки, а не байты: байт о цене окна не говорит, а кириллица делает его в
36
- * полтора раза больше знака. Триста — число владельца, назначенное от первого замера.
35
+ * Characters are counted, not bytes: a byte says nothing about the cost of the window, and
36
+ * Cyrillic makes it one and a half times bigger than a character. Three hundred is the owner's
37
+ * number, set from the first measurement.
37
38
  */
38
39
  const LIMIT = 300;
39
40
 
40
- /** Описание из шапки: строка `description:` до конца строки. */
41
+ /** The description from the header: the `description:` line up to the end of the line. */
41
42
  function descriptionOf(text) {
42
43
  const match = /^description:\s*(.+)$/m.exec(text);
43
44
 
44
45
  return match === null ? null : match[1].trim();
45
46
  }
46
47
 
47
- /** Перечень принятого долга: имя скила → причина. Нет файла — долга нет. */
48
+ /** The list of accepted debt: skill name → reason. No file — no debt. */
48
49
  function debt() {
49
50
  if (!existsSync(DEBT)) {
50
51
  return {};
@@ -59,7 +60,7 @@ function debt() {
59
60
 
60
61
  function main() {
61
62
  if (!existsSync(SKILLS)) {
62
- console.log('check-descriptions: каталога скилов нет — сверять нечего');
63
+ console.log('check-descriptions: there is no directory of rules — there is nothing to check');
63
64
 
64
65
  return 0;
65
66
  }
@@ -89,7 +90,7 @@ function main() {
89
90
  }
90
91
 
91
92
  if (Object.hasOwn(accepted, name)) {
92
- owed.push(`${name}: ${description.length} знаков — ${accepted[name]}`);
93
+ owed.push(`${name}: ${description.length} characters — ${accepted[name]}`);
93
94
  continue;
94
95
  }
95
96
 
@@ -97,25 +98,25 @@ function main() {
97
98
  }
98
99
 
99
100
  for (const line of owed) {
100
- console.log(` долг ${line}`);
101
+ console.log(` debt ${line}`);
101
102
  }
102
103
 
103
104
  if (over.length > 0) {
104
105
  over.sort((first, second) => second.length - first.length);
105
- console.log(`check-descriptions: длиннее предела ${over.length} из ${counted}, предел ${LIMIT} знаков\n`);
106
+ console.log(`check-descriptions: longer than the limit ${over.length} of ${counted}, the limit is ${LIMIT} characters\n`);
106
107
 
107
108
  for (const item of over) {
108
- console.log(` ${item.name}: ${item.length} знаков, лишних ${item.length - LIMIT}`);
109
+ console.log(` ${item.name}: ${item.length} characters, ${item.length - LIMIT} over`);
109
110
  }
110
111
 
111
- console.log('\nОписание отвечает на один вопрос — брать это правило или нет. Перечисление разделов');
112
- console.log('и пересказ статей приходят вторым разом вместе с самим правилом.');
113
- console.log('Оставленное намеренно называется в .claude/rt-kit/description-debt.json с причиной.');
112
+ console.log('\nA description answers one question — load this rule or not. A list of sections');
113
+ console.log('and a retelling of the articles arrive a second time together with the rule itself.');
114
+ console.log('What is left longer on purpose is named in .claude/rt-kit/description-debt.json with a reason.');
114
115
 
115
116
  return 1;
116
117
  }
117
118
 
118
- console.log(`check-descriptions: описаний ${counted}, все в пределе ${LIMIT} знаков` + (owed.length > 0 ? `, принятого долга ${owed.length}` : ''));
119
+ console.log(`check-descriptions: descriptions ${counted}, all within the limit of ${LIMIT} characters` + (owed.length > 0 ? `, accepted debt ${owed.length}` : ''));
119
120
 
120
121
  return 0;
121
122
  }
@@ -1,30 +1,30 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * Проверка того, что адреса, названные в документации, существуют.
3
+ * The check that the addresses named in the documentation exist.
4
4
  *
5
- * Документ, ссылающийся на исчезнувший файл, хуже отсутствующего: он выглядит
6
- * действующей справкой и уводит читателя в каталог, которого нет. Накапливается
7
- * это молча — перекладка дерева правит код и ломает текст, а текст никто не
8
- * собирает.
5
+ * A document referring to a file that has disappeared is worse than a missing one: it looks like
6
+ * a working reference and takes the reader into a directory that is not there. This accumulates
7
+ * silently — a rearrangement of the tree fixes the code and breaks the text, and nobody collects
8
+ * the text.
9
9
  *
10
- * Считаются только адреса в обратных кавычках и вне блоков кода: в блоках лежат
11
- * команды и вывод, где путь до собранного — результат сборки, а не файл
12
- * репозитория. Шаблоны (`*`, `<…>`, `{…}`) пропускаются: это форма адреса, а не адрес.
10
+ * Only addresses in backticks and outside code blocks count: the blocks hold commands and output,
11
+ * where a path to something built is the result of a build, not a file of the repository. Patterns
12
+ * (`*`, `<…>`, `{…}`) are skipped: that is the form of an address, not an address.
13
13
  *
14
- * Адрес бывает трёх родов, и все три судятся одинаково: укоренённый в дереве путь,
15
- * голое имя файла и каталог. Каталогами занята половина таблиц «Где это лежит», и
16
- * проверка, знающая только строку с расширением, их не видит вовсе.
14
+ * An address comes in three kinds, and all three are judged alike: a path rooted in the tree, a
15
+ * bare file name and a directory. Half of the "Where this lies" tables are taken by directories,
16
+ * and a check that knows only a string with an extension does not see them at all.
17
17
  *
18
- * Документы, которые по устройству говорят о несуществующем — планы будущего, архив
19
- * и папки задач, — из проверки выведены. Там же переносимый текст: его адреса
20
- * принадлежат тому дереву, куда правило ложится, и в этом они примеры, а не ссылки.
18
+ * Documents that by their nature speak of what does not exist — plans of the future, the archive
19
+ * and task folders — are taken out of the check. So is portable text: its addresses belong to the
20
+ * tree the rule is laid out into, and in that they are examples, not links.
21
21
  *
22
- * Вторым заходом сверяется полнота указателя каталога: обзорный документ перечисляет
23
- * записи таблицей, и читатель ищет по ней, а не обходом. Это обратная сторона той же
24
- * договорённости — не только адрес из текста ведёт в файл, но и файл назван в тексте,
25
- * по которому его ищут.
22
+ * On a second pass the completeness of a directory index is audited: the overview document lists
23
+ * the records in a table, and the reader searches by it, not by walking. This is the reverse side
24
+ * of the same agreement — not only does an address in a text lead to a file, but a file is named
25
+ * in the text people look for it by.
26
26
  *
27
- * Ненулевой код возврата и перечень расхождений.
27
+ * A non-zero return code and a list of divergences.
28
28
  */
29
29
  import { spawnSync } from 'node:child_process';
30
30
  import { existsSync, readFileSync, readdirSync } from 'node:fs';
@@ -33,48 +33,50 @@ import { join, posix } from 'node:path';
33
33
  import { allowlistOf, CONFIG, ROOT, parseAllowlist } from './rt-kit-checks.config.mjs';
34
34
 
35
35
  const ALLOWLIST = allowlistOf('doc-paths');
36
- // `worktrees` — копии репозитория под каталогом агента: их документы описывают раскладку
37
- // своей ветки, а проверка ищет адреса в дереве текущей. Одна брошенная копия дала 73
38
- // расхождения и красный сквозной прогон на ветке, которая её не заводила.
36
+ // `worktrees` — copies of the repository under the agent's directory: their documents describe the
37
+ // layout of their own branch, while the check looks for addresses in the tree of the current one.
38
+ // One abandoned copy gave 73 divergences and a red end-to-end run on a branch that did not start it.
39
39
  const SKIPPED_DIRS = CONFIG.skippedDirs;
40
40
  /**
41
- * Архив описывает раскладку, бывшую на момент записи. Править в нём адреса — значит
42
- * переписывать историю задним числом, поэтому он выведен из проверки целиком.
41
+ * The archive describes the layout as it was at the moment of writing. Fixing addresses in it means
42
+ * rewriting history after the fact, so it is taken out of the check entirely.
43
43
  */
44
44
  const ARCHIVE_DIR = CONFIG.archiveDir;
45
45
  /**
46
- * Папка задачи описывает ход работы, и снятое она называет по имени: раздел находок
47
- * перечисляет ровно то, чего в дереве нет. Отличить такое упоминание от ссылки машине
48
- * нечем, а живёт папка до слияния — поэтому она выведена из проверки, как архив.
46
+ * A task folder describes the progress, and what has been removed it names by name: the findings
47
+ * section lists exactly what is not in the tree. A machine has nothing to tell such a mention from
48
+ * a link by, and the folder lives until the merge — so it is taken out of the check, like the
49
+ * archive.
49
50
  */
50
51
  const TASKS_DIR = CONFIG.tasksDir.endsWith('/') ? CONFIG.tasksDir : `${CONFIG.tasksDir}/`;
51
52
  /**
52
- * Каталоги, чей указатель сверяется с содержимым. Каталог, выведенный из проверки адресов,
53
- * иначе не судит ничто: запись, приехавшая слиянием соседней ветки, остаётся неназванной, а
54
- * читатель ищет по указателю. Сверенный руками указатель расходится снова через сутки.
53
+ * Directories whose index is audited against the content. Nothing else judges a directory taken out
54
+ * of the address check: a record that arrived by a merge of a neighbouring branch stays unnamed,
55
+ * while the reader searches by the index. An index audited by hand diverges again within a day.
55
56
  */
56
57
  const INDEXED_DIRS = (CONFIG.indexedDirs ?? []).map((dir) => (dir.endsWith('/') ? dir : `${dir}/`));
57
58
  /**
58
- * Исходники переносимых текстов: правило, которое ложится в другое дерево, называет адреса
59
- * того дерева. Разложенная копия узнаётся по шапке, а исходник шапки не несёт — её ставит
60
- * раскладка, — поэтому его каталог называется настройкой.
59
+ * The sources of portable texts: a rule that is laid out into another tree names the addresses of
60
+ * that tree. A laid-out copy is recognised by its header, and the source carries no header — the
61
+ * layout puts it there — so its directory is named by a setting.
61
62
  */
62
63
  const PORTABLE_DIRS = (CONFIG.portableDirs ?? []).map((dir) => (dir.endsWith('/') ? dir : `${dir}/`));
63
- /** Шапка разложенного файла: версия пакета, ресурс и сумма тела. */
64
+ /** The header of a laid-out file: the package version, the resource and the sum of the body. */
64
65
  const STAMP_LINE = /rt-kit\s+v\S+\s+·\s+\S+\s+·\s+[0-9a-f]{12}/;
65
- /** Шапка встаёт первой строкой тела, а тело начинается после вступления скила. */
66
+ /** The header stands as the first line of the body, and the body starts after the skill's intro. */
66
67
  const STAMP_LOOKAHEAD = 12;
67
- /** Расширения, по которым голое имя считается файлом, а не именем сущности */
68
+ /** The extensions by which a bare name counts as a file and not as the name of a record */
68
69
  const EXTENSIONS = 'ts|mts|cts|js|mjs|cjs|json|jsonc|scss|css|html|proto|conf|ya?ml|sh|md|sql|txt|xml|svg|webp|png|ico|env|Dockerfile|lock';
69
70
  /**
70
- * Берётся любая строка в кавычках: каталог расширения не несёт, и требовать его в самой
71
- * выборке значило бы не видеть половину таблиц «Где это лежит». Отсев — в `looksLikePath`.
71
+ * Any string in backticks is taken: a directory carries no extension, and requiring one in the
72
+ * selection itself would mean not seeing half of the "Where this lies" tables. The sifting is in
73
+ * `looksLikePath`.
72
74
  */
73
75
  const PATH_IN_BACKTICKS = /`([^`\n]+?)`/g;
74
76
 
75
77
  const problems = [];
76
78
  const indexProblems = [];
77
- const report = (doc, line, path) => problems.push(`${doc}:${line}: нет файла \`${path}\``);
79
+ const report = (doc, line, path) => problems.push(`${doc}:${line}: no file \`${path}\``);
78
80
 
79
81
  function collectDocs(dir = '.') {
80
82
  const entries = readdirSync(join(ROOT, dir), { withFileTypes: true });
@@ -95,28 +97,27 @@ function collectDocs(dir = '.') {
95
97
  }
96
98
 
97
99
  /**
98
- * Документы, которые в репозиторий не попадут: личный черновик, лежащий в дереве и
99
- * закрытый настройкой неотслеживаемого. Проверка судит репозиторий, а не рабочий стол того,
100
- * кто её запустил: мёртвая ссылка в чужом черновике держала гейт пуша, хотя ни в одну ветку
101
- * этот файл не едет.
100
+ * Documents that will not reach the repository: a personal draft lying in the tree and covered by
101
+ * the ignore settings. The check judges the repository, not the desk of whoever started it: a dead
102
+ * link in someone's draft held the push gate, though that file goes into no branch at all.
102
103
  */
103
104
  function droppedByGit(docs) {
104
105
  if (docs.length === 0) {
105
106
  return new Set();
106
107
  }
107
108
 
108
- // `--stdin` вместо аргументов: список длиннее ограничения командной строки
109
+ // `--stdin` instead of arguments: the list is longer than the command line limit
109
110
  const ignored = spawnSync('git', ['check-ignore', '--stdin'], {
110
111
  cwd: ROOT,
111
112
  encoding: 'utf8',
112
113
  input: docs.join('\n'),
113
114
  });
114
115
 
115
- // Нет git — судить нечем, и проверка остаётся строже нужного
116
+ // No git — there is nothing to judge by, and the check stays stricter than needed
116
117
  return new Set((ignored.stdout ?? '').split('\n').filter(Boolean));
117
118
  }
118
119
 
119
- /** Верхний уровень дерева: по нему узнаётся адрес, укоренённый в репозитории */
120
+ /** The top level of the tree: an address rooted in the repository is recognised by it */
120
121
  const ROOTED_IN = new Set(
121
122
  readdirSync(ROOT, { withFileTypes: true })
122
123
  .filter((entry) => entry.isDirectory() && !SKIPPED_DIRS.includes(entry.name))
@@ -124,10 +125,10 @@ const ROOTED_IN = new Set(
124
125
  );
125
126
 
126
127
  /**
127
- * Дерево спрашивается у системы контроля версий, а не обходом каталогов: каталоги агента и
128
- * конвейера начинаются с точки, и обход мимо них проходит молча — всё, что в них лежит,
129
- * читалось бы как несуществующее. Неотслеживаемое берётся вместе с отслеживаемым: файл,
130
- * заведённый этой же веткой и ещё не добавленный, существует ничуть не меньше.
128
+ * The tree is asked of the version control system, not walked directory by directory: the agent's
129
+ * and the pipeline's directories start with a dot, and a walk passes them by silently — everything
130
+ * lying in them would read as non-existent. The untracked is taken together with the tracked: a
131
+ * file started by this very branch and not yet added exists no less.
131
132
  */
132
133
  function treeOfRepo() {
133
134
  const listed = spawnSync('git', ['ls-files', '--cached', '--others', '--exclude-standard'], {
@@ -157,10 +158,11 @@ function treeOfRepo() {
157
158
  const TREE = treeOfRepo();
158
159
 
159
160
  /**
160
- * Адрес ли это вообще. Отсекается всё, что описывает форму, а не адрес: шаблоны, сетевые
161
- * ссылки, имена пакетов, флаги и привязка «путь:символ» — её судит сверка спеков. Дальше
162
- * кандидат бывает двух родов: укоренённый в дереве и голое имя. Голым именем зовут и файл, и
163
- * каталог — оба ищутся по дереву, потому что адрес у них один, а написан он коротко.
161
+ * Whether this is an address at all. Everything describing a form rather than an address is cut
162
+ * off: patterns, network links, package names, flags and the binding "path:symbol" — that one is
163
+ * judged by the spec audit. After that a candidate comes in two kinds: rooted in the tree and a
164
+ * bare name. A bare name is used for both a file and a directory — both are looked for across the
165
+ * tree, because their address is one and the same, only written short.
164
166
  */
165
167
  function looksLikePath(candidate) {
166
168
  if (/[*<>{}$|\s()[\]'",;=]|\.\.\.|…/.test(candidate)) {
@@ -169,11 +171,11 @@ function looksLikePath(candidate) {
169
171
  if (/^(https?:|@|~|\/|-)/.test(candidate) || candidate.includes(':')) {
170
172
  return false;
171
173
  }
172
- // Каталог, который проверка не обходит, она и не судит: там чужое, сборка и служебное
174
+ // A directory the check does not walk it does not judge either: what lies there is foreign code, the build and service files
173
175
  if (SKIPPED_DIRS.some((dir) => candidate.startsWith(`${dir}/`))) {
174
176
  return false;
175
177
  }
176
- // Начинается с точки и стоит без каталога — род файла, а не файл
178
+ // Starts with a dot and stands without a directory — a kind of file, not a file
177
179
  if (/^\.[^/]+$/.test(candidate)) {
178
180
  return false;
179
181
  }
@@ -182,19 +184,19 @@ function looksLikePath(candidate) {
182
184
  }
183
185
 
184
186
  /**
185
- * Есть ли такой адрес в дереве. Укоренённый спрашивается у файловой системы: он назван
186
- * целиком, и промах в нём — промах. Голое имя ищется по дереву целиком — и среди файлов, и
187
- * среди каталогов: имя каталога в обзорном документе либы означает каталог рядом, а не
188
- * каталог в корне.
187
+ * Whether such an address is in the tree. A rooted one is asked of the file system: it is named in
188
+ * full, and a miss in it is a miss. A bare name is looked for across the whole tree — among files
189
+ * and among directories: a directory name in a lib's overview document means a directory next to
190
+ * it, not a directory at the root.
189
191
  */
190
192
  function existsInTree(candidate, fromDir = '') {
191
193
  const bare = candidate.replace(/\/$/, '');
192
194
 
193
195
  /**
194
- * Относительный адрес принадлежит каталогу документа, а не корню дерева: `../routes.ts` из
195
- * `libs/x/shell/src/shell/README.md` — это `libs/x/shell/src/routes.ts`. Без разрешения от
196
- * каталога такой адрес ищется по дереву строкой и не находится никогда, то есть проверка
197
- * краснеет на каждой ссылке, написанной так, как её пишут в разметке.
196
+ * A relative address belongs to the document's directory, not to the tree root: `../routes.ts`
197
+ * from `libs/x/shell/src/shell/README.md` is `libs/x/shell/src/routes.ts`. Without resolving
198
+ * from the directory such an address is looked for across the tree as a string and is never
199
+ * found, that is, the check reddens at every link written the way links are written in markup.
198
200
  */
199
201
  if (/^\.{1,2}(\/|$)/.test(bare)) {
200
202
  const resolved = posix.normalize(posix.join(fromDir, bare));
@@ -216,10 +218,11 @@ function existsInTree(candidate, fromDir = '') {
216
218
  }
217
219
 
218
220
  /**
219
- * Переносимый текст: разложенный пакетом — по шапке, его исходник — по каталогу из настройки.
220
- * Адреса в нём принадлежат тому дереву, куда правило ложится: `libs/common/util` в дереве,
221
- * которое зовёт свои корни иначе, — не мёртвая ссылка, а пример. Судить их здесь значит
222
- * краснеть на полтораста строк, ни одна из которых не чинится правкой этого дерева.
221
+ * A portable text: one laid out by the package is known by its header, its source by the directory
222
+ * from the settings. The addresses in it belong to the tree the rule is laid out into:
223
+ * `libs/common/util` in a tree that calls its roots otherwise is not a dead link but an example.
224
+ * Judging them here means reddening at a hundred and fifty lines, not one of which is fixed by an
225
+ * edit of this tree.
223
226
  */
224
227
  function isPortable(doc) {
225
228
  if (PORTABLE_DIRS.some((dir) => doc.startsWith(dir))) {
@@ -231,15 +234,15 @@ function isPortable(doc) {
231
234
  .some((line) => STAMP_LINE.test(line));
232
235
  }
233
236
 
234
- /** Из проверки адресов выведены документы, которые по устройству говорят о несуществующем. */
237
+ /** Documents that by their nature speak of what does not exist are taken out of the address check. */
235
238
  const isSkipped = (doc) => doc.startsWith(ARCHIVE_DIR) || doc.startsWith(TASKS_DIR) || isPortable(doc);
236
239
 
237
240
  /**
238
- * Полнота указателя каталога: у каждой записи каталога есть строка в таблице, у каждой
239
- * строки — запись. Записью считается первое имя в обратных кавычках строки таблицы: во
240
- * второй колонке стоит проза, и брать оттуда было бы нечего. Каталог берётся у системы
241
- * контроля версий той же выборкой, что и дерево: черновик, закрытый настройкой
242
- * неотслеживаемого, в репозиторий не едет и указателю не нужен.
241
+ * The completeness of a directory index: every record of the directory has a line in the table,
242
+ * every line has a record. The record is the first name in backticks of a table line: the second
243
+ * column holds prose, and there would be nothing to take from there. The directory is asked of the
244
+ * version control system by the same selection as the tree: a draft covered by the ignore settings
245
+ * does not reach the repository and is not needed in the index.
243
246
  */
244
247
  function checkIndex(dir) {
245
248
  const index = `${dir}README.md`;
@@ -263,11 +266,11 @@ function checkIndex(dir) {
263
266
  [...stored]
264
267
  .filter((name) => !named.has(name))
265
268
  .sort()
266
- .forEach((name) => indexProblems.push(`${index}: запись \`${name}\` лежит в каталоге, но в таблице не названа`));
269
+ .forEach((name) => indexProblems.push(`${index}: the record \`${name}\` lies in the directory and is not named in the table`));
267
270
  [...named]
268
271
  .filter((name) => !stored.has(name))
269
272
  .sort()
270
- .forEach((name) => indexProblems.push(`${index}: строка \`${name}\` названа в таблице, но записи в каталоге нет`));
273
+ .forEach((name) => indexProblems.push(`${index}: the line \`${name}\` is named in the table, and there is no record in the directory`));
271
274
  }
272
275
 
273
276
  function checkDoc(doc, allowed) {
@@ -296,16 +299,16 @@ function checkDoc(doc, allowed) {
296
299
  });
297
300
  }
298
301
 
299
- /** Расхождение указателя печатается своим списком: чинится оно строкой в таблице, а не молчанием. */
302
+ /** An index divergence is printed as a list of its own: it is fixed by a line in the table, not by silence. */
300
303
  function reportIndex() {
301
304
  if (indexProblems.length === 0) {
302
305
  return;
303
306
  }
304
307
 
305
- console.error(`\nуказатель разошёлся с каталогом, расхождений ${indexProblems.length}\n`);
308
+ console.error(`\nthe index diverged from the directory, divergences ${indexProblems.length}\n`);
306
309
  indexProblems.forEach((problem) => console.error(` ${problem}`));
307
310
  console.error(
308
- '\nЗапись называется в таблице указателя тем же изменением, которым кладётся:\nчитатель ищет по указателю, а не обходом каталога.'
311
+ '\nA record is named in the table of the index by the same change that lays it down:\nthe reader searches by the index, not by walking the directory.'
309
312
  );
310
313
  }
311
314
 
@@ -319,16 +322,16 @@ docs.forEach((doc) => checkDoc(doc, allowedPaths));
319
322
  INDEXED_DIRS.forEach((dir) => checkIndex(dir));
320
323
 
321
324
  if (problems.length > 0) {
322
- console.error(`check-doc-paths: расхождений ${problems.length}\n`);
325
+ console.error(`check-doc-paths: divergences ${problems.length}\n`);
323
326
  problems.forEach((problem) => console.error(` ${problem}`));
324
- // Вариантов три, и третий назван: список известного хранит принятое, а не результаты
325
- // сломанной проверки. Прежний текст предлагал вносить в список всё спорное — учил обходу,
326
- // который закон о проверяемости запрещает; один разбор дал 51 ложный отказ из 264, каждый
327
- // на существующий адрес.
327
+ // There are three ways out, and the third is named: the known list holds what is accepted, not
328
+ // the results of a broken check. The former text offered to enter everything doubtful into the
329
+ // list — it taught the bypass the verifiability law forbids; one review gave 51 false refusals
330
+ // out of 264, every one of them on an address that exists.
328
331
  console.error(
329
- `\nХодов отсюда три: поправить устаревший адрес; внести имя в ${ALLOWLIST}, если документ` +
330
- `\nописывает ещё не созданное; починить саму проверку, если ошибается она, — разобрать` +
331
- `\nотказы поимённо и показать разбор владельцу. Спорное в список не вносится.`
332
+ `\nThree moves from here: fix the stale address; enter the name into ${ALLOWLIST} if the document` +
333
+ `\ndescribes what is not created yet; fix the check itself, if it is the one that is wrong — take` +
334
+ `\nthe refusals apart one by one and show the analysis to the owner. What is in dispute is not listed.`
332
335
  );
333
336
  }
334
337
 
@@ -338,4 +341,4 @@ if (problems.length > 0 || indexProblems.length > 0) {
338
341
  process.exit(1);
339
342
  }
340
343
 
341
- console.log(`check-doc-paths: проверено документов ${docs.length}, расхождений нет`);
344
+ console.log(`check-doc-paths: documents checked ${docs.length}, no divergences`);