@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,6 +1,6 @@
1
1
  /**
2
- * Связь задачи с эпиком. Живёт своим файлом: сверка очереди работ и без неё стоит у предела
3
- * длины, а читают эти две проверки порознь.
2
+ * The link between a task and an epic. Lives in a file of its own: the work queue audit stands at
3
+ * the length limit even without it, and these two checks are read separately.
4
4
  */
5
5
  import { existsSync, readFileSync } from 'node:fs';
6
6
  import { join } from 'node:path';
@@ -9,17 +9,18 @@ import { TASK_KEY } from './board.mjs';
9
9
  import { CONFIG, ROOT } from './rt-kit-checks.config.mjs';
10
10
 
11
11
  /**
12
- * Метка карточки эпика. Не названа — связь не судится: отличить карточку эпика от обычной
13
- * задачи станет нечем.
12
+ * The label of an epic card. Not named — the link is not judged: there would be nothing left to
13
+ * tell an epic card from an ordinary task by.
14
14
  */
15
15
  const EPIC_LABEL = CONFIG.board?.epicLabel ?? '';
16
16
 
17
17
  /**
18
- * Строки состава эпика — те, что стоят в таблице с колонкой «Задача».
18
+ * The rows of the epic makeup — those standing in the table with the task column.
19
19
  *
20
- * Замысел эпика держит и другие таблицы: источники находок, состав семей, счёт пунктов. Номера,
21
- * взятые из всего текста и даже из всех таблиц, делали бы задачей эпика всё, что он упомянул, —
22
- * прошлый эпик, из находок которого он вырос, разбор, задачу соседнего дерева.
20
+ * The epic plan holds other tables too: the sources of findings, the makeup of families, the count
21
+ * of items. Numbers taken from the whole text, and even from all the tables, would make an epic
22
+ * task out of everything it mentioned — the previous epic its findings grew from, a review, a task
23
+ * of a neighbouring tree.
23
24
  */
24
25
  function planRows(plan) {
25
26
  const rows = [];
@@ -31,9 +32,11 @@ function planRows(plan) {
31
32
  continue;
32
33
  }
33
34
  if (!inside) {
34
- // Граница слова здесь не годится: `\b` знает только латиницу, и с кириллицей она не
35
- // совпадает никогда — проверка молчала бы на любом замысле.
36
- inside = /\|[^|]*Задача/.test(line);
35
+ // The column has two names, English and the owner's: a tree translates its plans one at
36
+ // a time, and one name would take the untranslated epics out of the check silently. A
37
+ // word boundary is no good here either: `\b` knows only Latin letters and never matches
38
+ // Cyrillic — the check would stay silent on any plan.
39
+ inside = /\|[^|]*(?:Task|Задача)/.test(line);
37
40
  continue;
38
41
  }
39
42
  rows.push(line);
@@ -42,27 +45,43 @@ function planRows(plan) {
42
45
  }
43
46
 
44
47
  /**
45
- * Связь задачи с эпиком, прочитанная в обе стороны.
48
+ * The epic a task body declares itself under — or `undefined` where nothing is declared. With a
49
+ * number given, it answers whether that very epic is declared.
46
50
  *
47
- * Задача, заведённая под эпик, называет его в теле, а замысел эпика называет её со своей
48
- * стороны. Односторонняя привязка выглядит целой ровно так же, как двусторонняя: читатель
49
- * приходит то от замысла эпика, то от его карточки, и вторая сторона существует только для одного из
50
- * них. Держалась она подражанием — пока тело писали с образца соседней задачи того же эпика,
51
- * строка ехала вместе с формой, а задача, заведённая посреди работы находкой, писалась не с
52
- * образца.
51
+ * Belonging is declared by a word about the task standing right before the word about the epic —
52
+ * the very shape the refusal dictates. Read by a bare mention of the number, every task that
53
+ * explains something about an epic got a false line: the number stands there in the reasoning, in
54
+ * a quoted refusal, in the list of what the work does not do. Both sides of the link read this one
55
+ * declaration: read differently, one side would demand what the other does not see.
56
+ */
57
+ function declaredEpicOf(body, number = null) {
58
+ const named = body.match(new RegExp(`задач[аи]\\s+эпика?\\s+(?:#|${TASK_KEY}-)(\\d+)`, 'i'))?.[1];
59
+ return number === null ? named : named !== undefined && Number(named) === number;
60
+ }
61
+
62
+ /**
63
+ * The link between a task and an epic, read in both directions.
64
+ *
65
+ * A task created under an epic names it in its body, and the epic plan names the task from its own
66
+ * side. A one-sided binding looks whole exactly as a two-sided one does: the reader comes now from
67
+ * the epic plan, now from its card, and the second side exists only for one of them. It held by
68
+ * imitation — while a body was written from the sample of a neighbouring task of the same epic, the
69
+ * line travelled with the shape, and a task created in the middle of work out of a finding was not
70
+ * written from a sample.
53
71
  *
54
- * Путь к замыслу берётся из тела карточки эпика: называть его она обязана и так, а настройка
55
- * каталога завела бы второй источник правды. Путём считается написание с каталогом — голое имя
56
- * файла в теле встречается прозой и уводило бы проверку на первое же упоминание. Замысла нет на
57
- * диске — это своё расхождение: карточка ссылается в пустоту.
72
+ * The path to the plan is taken from the body of the epic card: it has to name it anyway, and a
73
+ * directory setting would create a second source of truth. A path counts as a spelling with a
74
+ * directory — a bare file name in the body occurs in prose and would lead the check to the very
75
+ * first mention. A plan absent from disk is a discrepancy of its own: the card points into
76
+ * emptiness.
58
77
  *
59
- * Судится только открытое, как и вся остальная сверка: закрытая задача эпика — история, и
60
- * строку о ней нечем закрыть.
78
+ * Only what is open is judged, as in the rest of the audit: a closed task of an epic is history,
79
+ * and there is nothing to close a line about it with.
61
80
  */
62
81
  export function checkEpicLinks(open, report) {
63
- // Метка не названа — карточку эпика отличить от обычной задачи нечем, и проверка молчит.
64
- // Молчит именно так, а не «эпиков нет»: дерево без эпиков и дерево, не назвавшее метки,
65
- // здесь неразличимы.
82
+ // The label is not named — there is nothing to tell an epic card from an ordinary task by, and
83
+ // the check stays silent. Silent exactly so, not "there are no epics": a tree without epics and
84
+ // a tree that has not named the label are indistinguishable here.
66
85
  if (!EPIC_LABEL) {
67
86
  return;
68
87
  }
@@ -70,20 +89,35 @@ export function checkEpicLinks(open, report) {
70
89
  const byNumber = new Map(open.map((issue) => [issue.number, issue]));
71
90
  const epics = open.filter((issue) => (issue.labels ?? []).some((label) => label.name === EPIC_LABEL));
72
91
  const listedBy = new Map();
73
- // Эпики, состав которых прочитать не вышло. Их задачи обратной стороной не судятся: о
74
- // непрочитанном замысле уже сказано своей строкой, и четыре строки «задачи нет в замысле»
75
- // рядом с ней говорят о том же промахе ещё раз, называя виноватыми чужие задачи.
92
+ // Epics whose makeup could not be read. Their tasks are not judged from the other side: an
93
+ // unread plan has already been reported by a line of its own, and four lines "the task is not in
94
+ // the plan" beside it speak of the same miss again, naming other tasks as guilty.
76
95
  const unreadable = new Set();
77
96
 
78
97
  for (const epic of epics) {
79
- const planPath = String(epic.body ?? '').match(/(?:^|[\s(`])([\w.-]+(?:\/[\w.-]+)+\.md)/)?.[1] ?? null;
80
- if (planPath === null) {
81
- report(`#${epic.number}: карточка эпика не называет путь к замыслу — состав эпика читать негде`);
98
+ const named = [...String(epic.body ?? '').matchAll(/(?:^|[\s(`])([\w.-]+(?:\/[\w.-]+)+\.md)/g)].map((match) => match[1]);
99
+ if (named.length === 0) {
100
+ report(`#${epic.number}: the epic card names no path to the plan — there is nowhere to read what the epic holds`);
82
101
  unreadable.add(epic.number);
83
102
  continue;
84
103
  }
85
- if (!existsSync(join(ROOT, planPath))) {
86
- report(`#${epic.number}: замысла эпика «${planPath}» нет на диске — карточка ссылается в пустоту`);
104
+
105
+ // The plan is the document that carries the makeup, not the first path in the body. A card
106
+ // names its decision next to its plan, and the decision has no table of tasks: read as the
107
+ // plan, it made the makeup empty and every open task of the epic read as not belonging to
108
+ // it — fourteen false lines at once, and the true ones drowned among them.
109
+ const onDisk = named.filter((path) => existsSync(join(ROOT, path)));
110
+ if (onDisk.length === 0) {
111
+ report(`#${epic.number}: the epic plan «${named[0]}» is not on disk — the card points into emptiness`);
112
+ unreadable.add(epic.number);
113
+ continue;
114
+ }
115
+
116
+ const planPath = onDisk.find((path) => planRows(readFileSync(join(ROOT, path), 'utf8')) !== '') ?? null;
117
+ if (planPath === null) {
118
+ report(
119
+ `#${epic.number}: none of the documents the card names carries the makeup of the epic — «${onDisk.join('», «')}». The makeup is a table with a task column`
120
+ );
87
121
  unreadable.add(epic.number);
88
122
  continue;
89
123
  }
@@ -97,27 +131,27 @@ export function checkEpicLinks(open, report) {
97
131
  }
98
132
  listedBy.set(number, epic.number);
99
133
  const body = String(byNumber.get(number).body ?? '');
100
- if (!new RegExp(`(?:#|${TASK_KEY}-)${epic.number}\\b`).test(body)) {
134
+ if (!declaredEpicOf(body, epic.number)) {
101
135
  report(
102
- `#${number}: замысел эпика #${epic.number} задачу называет, а её тело эпика — нет. Допиши строку «Задача эпика #${epic.number}, замысел — ${planPath}»`
136
+ `#${number}: the plan of the epic #${epic.number} names the task, and its body does not name the epic. Add the line «Задача эпика #${epic.number}, замысел — ${planPath}»`
103
137
  );
104
138
  }
105
139
  }
106
140
  }
107
141
 
108
- // Обратная сторона: тело назвало эпик, а замысел эпика этой задачи не знает. Читается
109
- // это как задача под эпиком, но «взять следующую» её не отдаст никогда.
142
+ // The other side: the body named the epic, and the epic plan does not know this task. It reads
143
+ // as a task under an epic, but "take the next one" will never hand it out.
110
144
  const epicNumbers = new Set(epics.map((issue) => issue.number));
111
145
  for (const issue of open) {
112
146
  if (epicNumbers.has(issue.number)) {
113
147
  continue;
114
148
  }
115
- const named = String(issue.body ?? '').match(new RegExp(`эпика?\\s+(?:#|${TASK_KEY}-)(\\d+)`, 'i'))?.[1];
149
+ const named = declaredEpicOf(String(issue.body ?? ''));
116
150
  if (named === undefined || !epicNumbers.has(Number(named)) || unreadable.has(Number(named))) {
117
151
  continue;
118
152
  }
119
153
  if (listedBy.get(issue.number) !== Number(named)) {
120
- report(`#${issue.number}: тело называет эпик #${named}, а в его замысле задачи нет — «взять следующую» её не отдаст`);
154
+ report(`#${issue.number}: the body names the epic #${named}, and its plan does not carry the task — «take the next one» will not give it out`);
121
155
  }
122
156
  }
123
157
  }
@@ -0,0 +1,61 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Task branches that have not carried their folder in by a single commit — a part of the work queue
4
+ * audit.
5
+ *
6
+ * Moved into a file of its own because the audit itself has grown to the length limit: it has many
7
+ * subjects, and this one stands apart — it is the only one that reads the local repository and does
8
+ * without the network and without the hosting.
9
+ */
10
+ import { execFileSync } from 'node:child_process';
11
+
12
+ import { TASK_KEY } from './board.mjs';
13
+ import { CONFIG, ROOT } from './rt-kit-checks.config.mjs';
14
+
15
+ /**
16
+ * The plan guard asks the folder from the disk, so an uncommitted one lets edits through for the
17
+ * whole of the work, and the refusal comes at the very end: the turn exit guard takes the sign of
18
+ * handed-over work from the branch history, and there is no folder there. At that minute there is
19
+ * nothing left to fix with — the folder was taken apart by one's own hands, and one assembled anew
20
+ * gives two extra commits in a ready PR.
21
+ *
22
+ * The branch history is judged, not its tip: the folder is taken apart by the last commit before
23
+ * the PR is opened, and the tip of finished work lawfully carries no folder.
24
+ *
25
+ * Read from the local repository, without the network: branches of other machines are not visible
26
+ * from here, and this check says nothing about them.
27
+ */
28
+ export function checkBranchFolders(report, mainBranch) {
29
+ const git = (args) => execFileSync('git', args, { cwd: ROOT, encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] });
30
+
31
+ let branches;
32
+ try {
33
+ branches = git(['branch', '--format=%(refname:short)', '--list', `${TASK_KEY}-*`]).split('\n');
34
+ } catch {
35
+ return;
36
+ }
37
+
38
+ // A branch without a task number is lawful and lives locally — for a trial and a grill; it is
39
+ // due no folder, and demanding one would mean refusing work that will not go into the main
40
+ // branch.
41
+ const numbered = new RegExp(`^${TASK_KEY}-\\d+-`);
42
+
43
+ for (const branch of branches.map((one) => one.trim()).filter((one) => numbered.test(one))) {
44
+ try {
45
+ // The branch contribution is empty — nothing to judge: a folder is put in by the very
46
+ // first commit, not by creating it.
47
+ if (!git(['log', '--format=%h', '-1', `${mainBranch}..${branch}`]).trim()) {
48
+ continue;
49
+ }
50
+ if (git(['log', '--format=%h', '-1', branch, '--', `${CONFIG.tasksDir}/${branch}`]).trim()) {
51
+ continue;
52
+ }
53
+ } catch {
54
+ continue;
55
+ }
56
+ report(
57
+ `${branch}: the task folder never travelled into the branch — commit ${CONFIG.tasksDir}/${branch}/, ` +
58
+ `otherwise the refusal arrives at the exit of a turn, when there is nothing left to fix`
59
+ );
60
+ }
61
+ }
@@ -1,10 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * Вызов клиента хостинга: как его находят, чем подписывают и что считается временным отказом.
3
+ * The call to the hosting client: how it is found, what it is signed with and what counts as a
4
+ * temporary refusal.
4
5
  *
5
- * Отделено от работы с очередью работ потому, что предмет здесь другой — не задача и не колонка,
6
- * а сам вызов: где взять исполняемый файл, каким токеном его подписать, что читать как «сети
7
- * нет» и что повторить. Вместе с очередью это переросло предел длины файла.
6
+ * Separated from the work with the work queue because the subject here is another one — not a task
7
+ * and not a column, but the call itself: where to get the executable, which token to sign it with,
8
+ * what to read as "there is no network" and what to repeat. Together with the queue this outgrew
9
+ * the file length limit.
8
10
  */
9
11
  import { execFileSync } from 'node:child_process';
10
12
  import { existsSync, readFileSync } from 'node:fs';
@@ -16,8 +18,8 @@ const BOARD = CONFIG.board ?? {};
16
18
  const BOT_TOKEN_FILE = BOARD.tokenPath ? BOARD.tokenPath.replace(/^~/, homedir()) : '';
17
19
 
18
20
  /**
19
- * `gh` у владельца подменён обёрткой менеджера паролей, и вызов по имени уходит в неё.
20
- * Поэтому сначала пробуется настоящий исполняемый файл, и только потом имя из PATH.
21
+ * The owner's `gh` is substituted by a password manager wrapper, and a call by name goes into it.
22
+ * So the real executable is tried first, and only then the name from PATH.
21
23
  */
22
24
  function ghBinary() {
23
25
  if (process.env.GH_BIN) {
@@ -28,9 +30,14 @@ function ghBinary() {
28
30
  }
29
31
 
30
32
  /**
31
- * Токен машинной записи лежит вне репозитория и в вывод не попадает. Его отсутствие — не отказ:
32
- * дерево, не назвавшее токена в `board.tokenPath`, работает с очередью учётной записью, под
33
- * которой залогинен клиент хостинга.
33
+ * The machine account token lies outside the repository and does not get into the output. Its
34
+ * absence is not a refusal: a tree that has not named a token in `board.tokenPath` works with the
35
+ * queue under the account the hosting client is signed in as.
36
+ *
37
+ * The token is supplied by reading a task, moving a column and listing one's own PRs in dispute.
38
+ * Reading a PR goes without it deliberately: the review fields need rights to the organisation
39
+ * accounts, which the machine account was not given, and a request with the token is refused
40
+ * entirely. Whose eyes the answer was taken by is told by the `viewer` field in it.
34
41
  */
35
42
  export function botToken() {
36
43
  if (!existsSync(BOT_TOKEN_FILE)) {
@@ -43,9 +50,9 @@ export function botToken() {
43
50
  export class OfflineError extends Error {}
44
51
 
45
52
  /**
46
- * Отказ сети от отказа по существу отличается только текстом: `gh` на оба отвечает
47
- * ненулевым кодом. Сюда попадает то, после чего проверять нечем, — а не то, что
48
- * проверено и оказалось не так.
53
+ * A network refusal differs from a refusal on the merits only by its text: `gh` answers
54
+ * both with a non-zero code. What lands here is what leaves nothing to check by — not
55
+ * what was checked and turned out wrong.
49
56
  */
50
57
  function isOffline(stderr) {
51
58
  return /dial tcp|no such host|network is unreachable|timeout|TLS handshake|connection refused|Bad credentials|authentication|not logged/i.test(
@@ -54,25 +61,26 @@ function isOffline(stderr) {
54
61
  }
55
62
 
56
63
  /**
57
- * Отказ, который проходит сам: хостинг ответил, но не смог.
64
+ * A refusal that passes by itself: the hosting answered but could not.
58
65
  *
59
- * Отличается от отказа по существу тем, что повтор его снимает: пятисотые коды, шлюз и его
60
- * таймаут. Отказ по праву, по несуществующей записи и по незнакомой колонке сюда не попадают —
61
- * они не пройдут и на третий раз, а ждать заставят.
66
+ * It differs from a refusal on the merits in that a repeat lifts it: the five-hundred codes, the
67
+ * gateway and its timeout. A refusal by right, by a non-existent record and by an unknown column do
68
+ * not land here — they will not pass on the third try either, and would make one wait.
62
69
  */
63
70
  function isUnavailable(stderr) {
64
71
  return /HTTP 50[0234]\b|Bad Gateway|Service Unavailable|Gateway Time-?out|Server Error/i.test(stderr);
65
72
  }
66
73
 
67
- /** Сколько раз пробовать вызов, который отбит недоступностью хостинга. */
74
+ /** How many times to try a call refused by the hosting being unavailable. */
68
75
  const TRIES = 3;
69
76
 
70
77
  /**
71
- * Пауза перед следующей попыткой, вдвое длиннее прежней. Синхронная: вызов хостинга здесь тоже
72
- * синхронный, и уводить его в обещание пришлось бы вместе со всеми, кто его зовёт.
78
+ * The pause before the next attempt, twice as long as the previous one. Synchronous: the hosting
79
+ * call here is synchronous too, and moving it into a promise would mean moving everyone who calls
80
+ * it along with it.
73
81
  *
74
- * Число берётся из окружения ради проб: своей паузы им не нужно, а ждать три секунды на каждый
75
- * сценарий они не обязаны.
82
+ * The number is taken from the environment for the sake of the tests: they need no pause of their
83
+ * own, and are not obliged to wait three seconds for every scenario.
76
84
  */
77
85
  const PAUSE_MS = Number(process.env.RT_GH_RETRY_MS ?? 1000) || 0;
78
86
 
@@ -95,17 +103,18 @@ export function gh(args, { token } = {}) {
95
103
  } catch (error) {
96
104
  const stderr = String(error.stderr ?? error.message ?? '');
97
105
  if (error.code === 'ENOENT' || isOffline(stderr)) {
98
- throw new OfflineError(stderr.trim() || 'gh недоступен');
106
+ throw new OfflineError(stderr.trim() || 'gh is unavailable');
99
107
  }
100
- // Правило требует двигать колонку тем же движением, что и работу, а хостинг отвечал
101
- // недоступностью час подряд: без повтора исполнитель либо крутит вызов руками, либо
102
- // оставляет колонку отставшей — и находит это сверка уже после открытия заявки.
108
+ // The rule demands moving the column by the same motion as the work, and the hosting
109
+ // answered with unavailability for an hour straight: without a repeat the executor
110
+ // either turns the call by hand or leaves the column behind — and the audit finds that
111
+ // only after the PR is opened.
103
112
  if (isUnavailable(stderr) && attempt < TRIES) {
104
113
  pause(waited);
105
114
  waited *= 2;
106
115
  continue;
107
116
  }
108
- const failure = new Error(stderr.trim() || `gh ${args[0]} завершился с ошибкой`);
117
+ const failure = new Error(stderr.trim() || `gh ${args[0]} finished with an error`);
109
118
  failure.stderr = stderr;
110
119
  throw failure;
111
120
  }
@@ -1,13 +1,13 @@
1
1
  /**
2
- * Работа, которую одним заходом не закрыть: метка карточки против записи в линии работ.
2
+ * Work that cannot be closed in one session: the card label against the entry in the work plan.
3
3
  *
4
- * Своим файлом по той же причине, что и связь с эпиком: сверка очереди работ и без них стоит у
5
- * предела длины, а читают эти проверки порознь.
4
+ * In a file of its own for the same reason as the epic link: the work queue audit stands at the
5
+ * length limit even without them, and these checks are read separately.
6
6
  *
7
- * Помечена такая работа в двух местах, и одна метка без другой лжёт молча: исполнитель открывает
8
- * карточку раньше, чем линию работ, а планирует по линии. Карточка без записи обещает
9
- * многозаходность, которой линия не знает; запись без метки оставляет карточку выглядеть работой
10
- * на один заход — и следующий заход берёт её, рассчитывая закрыть за раз.
7
+ * Such work is marked in two places, and one mark without the other lies silently: the executor
8
+ * opens the card before the work plan, and plans by the plan. A card without an entry promises
9
+ * several sessions the plan does not know about; an entry without a label leaves the card looking
10
+ * like work for one session — and the next session takes it expecting to close it in one go.
11
11
  */
12
12
  import { existsSync, readdirSync, readFileSync } from 'node:fs';
13
13
  import { join } from 'node:path';
@@ -16,14 +16,14 @@ import { TASK_KEY } from './board.mjs';
16
16
  import { CONFIG, ROOT } from './rt-kit-checks.config.mjs';
17
17
 
18
18
  /**
19
- * Метка многозаходной карточки и каталог линий работ. Не названо любое из двух — связь не
20
- * судится вовсе: отличить многозаходную карточку от обычной станет нечем, а каталог линий у
21
- * каждого дерева свой.
19
+ * The label of a multi-session card and the directory of work plans. Either of the two not named —
20
+ * the link is not judged at all: there would be nothing to tell a multi-session card from an
21
+ * ordinary one by, and every tree has its own directory of plans.
22
22
  */
23
23
  const LONG_LABEL = CONFIG.longWork?.label ?? '';
24
24
  const PLANS_DIR = CONFIG.longWork?.plansDir ?? '';
25
25
 
26
- /** Строки линий работ, где стоит слово метки: только они считаются записью о многозаходности. */
26
+ /** Work plan lines carrying the label word: only they count as an entry about several sessions. */
27
27
  function markedRows() {
28
28
  const dir = join(ROOT, PLANS_DIR);
29
29
  if (!existsSync(dir)) {
@@ -43,14 +43,14 @@ function markedRows() {
43
43
  }
44
44
 
45
45
  /**
46
- * Связь метки с линией работ, прочитанная в обе стороны.
46
+ * The link between the label and the work plan, read in both directions.
47
47
  *
48
- * Записью считается строка, где стоят и слово метки, и номер задачи. Голое упоминание номера не
49
- * годится: линия работ называет все свои задачи, и большинство из них однозаходные — обратная
50
- * сторона краснела бы на каждой.
48
+ * An entry is a line carrying both the label word and the task number. A bare mention of the number
49
+ * is no good: a work plan names all of its tasks, and most of them take one session — the other
50
+ * side would go red on every one.
51
51
  *
52
- * Судится только открытое, как и вся остальная сверка: закрытая задача — история, и строку о ней
53
- * нечем закрыть.
52
+ * Only what is open is judged, as in the rest of the audit: a closed task is history, and there is
53
+ * nothing to close a line about it with.
54
54
  */
55
55
  export function checkLongWork(open, report) {
56
56
  if (!LONG_LABEL || !PLANS_DIR) {
@@ -59,13 +59,13 @@ export function checkLongWork(open, report) {
59
59
 
60
60
  const rows = markedRows();
61
61
  if (rows === null) {
62
- report(`каталога линий работ «${PLANS_DIR}» нет на диске — многозаходную работу сверять не с чем`);
62
+ report(`the directory of work plans «${PLANS_DIR}» is not on disk — there is nothing to check multi-session work against`);
63
63
 
64
64
  return;
65
65
  }
66
66
 
67
- // Номера, названные в помеченных строках. Ключ задачи и решётка читаются оба: линия пишется
68
- // человеком, и форма номера в ней от строки к строке разная.
67
+ // The numbers named in the marked lines. Both the task key and the hash are read: a plan is
68
+ // written by a person, and the shape of a number in it differs from line to line.
69
69
  const written = new Set();
70
70
  const whereWritten = new Map();
71
71
  for (const row of rows) {
@@ -85,17 +85,17 @@ export function checkLongWork(open, report) {
85
85
  for (const number of labelled) {
86
86
  if (!written.has(number)) {
87
87
  report(
88
- `#${number}: помечена как «${LONG_LABEL}», а в линиях работ «${PLANS_DIR}» такой строки нет — планируют по линии, а не по карточке`
88
+ `#${number}: marked as «${LONG_LABEL}», and the work plans «${PLANS_DIR}» carry no such line — the planning goes by the plan, not by the card`
89
89
  );
90
90
  }
91
91
  }
92
92
 
93
- // Обратная сторона: линия знает работу многозаходной, а карточка выглядит работой на один
94
- // заход — и следующий заход берёт её, рассчитывая закрыть за раз.
93
+ // The other side: the plan knows the work takes several sessions, while the card looks like
94
+ // work for one — and the next session takes it expecting to close it in one go.
95
95
  const byNumber = new Set(open.map((issue) => issue.number));
96
96
  for (const number of written) {
97
97
  if (byNumber.has(number) && !labelled.has(number)) {
98
- report(`#${number}: линия работ «${whereWritten.get(number)}» знает её многозаходной, а метки «${LONG_LABEL}» на карточке нет`);
98
+ report(`#${number}: the work plan «${whereWritten.get(number)}» knows it as multi-session, and the card carries no label «${LONG_LABEL}»`);
99
99
  }
100
100
  }
101
101
  }
@@ -1,7 +1,8 @@
1
- // Пути, которых не слушает конвейер, и заявка, чей вклад целиком под ними.
1
+ // The paths the pipeline does not listen to, and a PR whose contribution lies entirely under them.
2
2
  //
3
- // Вынесено из сверки очереди отдельным модулем: разбор образцов конвейера к состоянию борды
4
- // отношения не имеет и читается сам по себе, а сверка от него росла быстрее предела длины.
3
+ // Moved out of the queue audit into a module of its own: parsing the pipeline patterns has nothing
4
+ // to do with the state of the work queue and reads on its own, while the audit was growing past the
5
+ // length limit because of it.
5
6
  import { existsSync, readFileSync } from 'node:fs';
6
7
  import { join } from 'node:path';
7
8
 
@@ -12,12 +13,12 @@ const PIPELINE = CONFIG.pushGate?.pipelineFile ?? '';
12
13
  const HAS_PIPELINE = PIPELINE !== '' && existsSync(join(ROOT, PIPELINE));
13
14
 
14
15
  /**
15
- * Пути, которых конвейер не слушает: `paths-ignore` у его событий.
16
+ * The paths the pipeline does not listen to: the `paths-ignore` of its events.
16
17
  *
17
- * Разбирается построчно, а не разборщиком разметки: у проверки его нет, а список — плоский
18
- * перечень строк под одним ключом. Ключей в файле бывает несколько — по событию, — и все они
19
- * складываются в один набор: ветка, чей вклад целиком лежит под ними, прогона не создаёт ни на
20
- * одном событии.
18
+ * Parsed line by line, not by a markup parser: the check has none, and the list is a flat
19
+ * enumeration of lines under one key. There can be several keys in the file — one per event — and
20
+ * they all add up into one set: a branch whose contribution lies entirely under them creates no run
21
+ * on any event.
21
22
  */
22
23
  export function ignoredPaths() {
23
24
  if (!HAS_PIPELINE) {
@@ -49,10 +50,13 @@ export function ignoredPaths() {
49
50
 
50
51
  const IGNORED_PATHS = ignoredPaths();
51
52
 
52
- /** Знаки образца, у которых в выражении своё значение: кроме звёздочек, они значат себя. */
53
+ /**
54
+ * Pattern characters that have a meaning of their own in an expression: apart from the asterisks,
55
+ * they stand for themselves.
56
+ */
53
57
  const escapeForRegExp = (value) => value.replace(/[.+?^${}()|[\]\\-]/g, '\\$&');
54
58
 
55
- /** Подпадает ли путь под образец конвейера: `**` — любой хвост, `*` — кусок имени. */
59
+ /** Whether a path falls under a pipeline pattern: `**` is any tail, `*` a piece of a name. */
56
60
  function underPattern(path, pattern) {
57
61
  const body = pattern
58
62
  .split('**')
@@ -63,14 +67,15 @@ function underPattern(path, pattern) {
63
67
  }
64
68
 
65
69
  /**
66
- * Вклад заявки целиком лежит под путями, которых конвейер не слушает.
70
+ * The contribution of a PR lies entirely under the paths the pipeline does not listen to.
67
71
  *
68
- * Такой ветке прогона не будет никогда, и требовать его — то же, что требовать его у ветки без
69
- * единого коммита: признак верен по букве и лжёт по существу, а действие, которое он советует,
70
- * не исполнимо. Красная строка при этом стоит рядом с настоящими расхождениями и учит
71
- * пропускать сверку целиком.
72
+ * Such a branch will never have a run, and demanding one is the same as demanding it of a branch
73
+ * without a single commit: the sign is true by the letter and lies on the merits, and the action it
74
+ * advises cannot be carried out. Meanwhile the red line stands next to real discrepancies and
75
+ * teaches one to skip the audit whole.
72
76
  *
73
- * Состав не прочитать — отвечаем «нет»: молчать наугад дороже одной лишней строки.
77
+ * The makeup cannot be read — we answer "no": staying silent at random costs more than one extra
78
+ * line.
74
79
  */
75
80
  export function onlyIgnoredPaths(pull, options) {
76
81
  if (!IGNORED_PATHS.length) {