@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,19 +1,21 @@
1
1
  #!/usr/bin/env bash
2
2
  # rt-hook: PreToolUse Bash|mcp__webstorm__execute_terminal_command|mcp__webstorm__execute_tool
3
- # Требует: hooks/deny-tail.sh, hooks/guard-note.sh
4
- # Гард главной ветки. PreToolUse на вызове коммита.
3
+ # Requires: hooks/deny-tail.sh, hooks/guard-note.sh
4
+ # Guard of the main branch. PreToolUse on a commit call.
5
5
  #
6
- # Коммит в главную ветку минует ветку, PR и разбор, а поставка построена на них целиком —
7
- # правило `git-workflow`. Прямой коммит туда почти всегда промах: «остался на главной после
8
- # слияния предыдущего PR».
6
+ # A commit into the main branch bypasses the branch, the PR and the review, while delivery is built
7
+ # on them entirely — rule `git-workflow`. A direct commit there is almost always a miss: "stayed on
8
+ # main after merging the previous PR".
9
9
  #
10
- # Имя главной ветки не зашито строкой: сначала спрашивается указатель удалённого репозитория,
11
- # затем пробуются существующие `origin/main` и `origin/master`, и лишь в конце берётся `main`.
10
+ # The name of the main branch is not hard-wired as a string: first the pointer of the remote
11
+ # repository is asked, then the existing `origin/main` and `origin/master` are tried, and only at
12
+ # the end `main` is taken.
12
13
  #
13
- # ОТКАЗ В ПОЛЬЗУ РАБОТЫ: не репозиторий, нет гита, открепившийся HEAD, битый ввод — пропуск.
14
- # Сломанный гард не должен мешать работать.
14
+ # FAIL-OPEN: not a repository, no git, a detached HEAD, broken input — pass. A broken guard must not
15
+ # get in the way of work.
15
16
 
16
- # Своё имя в наблюдениях: отбой пишет общий хвост отказа, а не сам гард.
17
+ # Its own name in the observations: the refusal is written by the shared deny tail, not by the
18
+ # guard itself.
17
19
  RT_GUARD_NAME=git-guard-main
18
20
 
19
21
  . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utf8.sh" 2>/dev/null || true
@@ -24,8 +26,8 @@ input="$RT_HOOK_INPUT"
24
26
  [ -z "$input" ] && exit 0
25
27
 
26
28
  tool="$(rt_hook_tool)"
27
- # Терминал среды разработки исполняет ту же командную строку и кладёт её в то же поле. Пока
28
- # гард проверял только оболочку, весь его смысл обходился сменой инструмента.
29
+ # The terminal of the development environment runs the same command line and puts it into the same
30
+ # field. While the guard judged the shell alone, its whole point was bypassed by switching tools.
29
31
  case "$tool" in
30
32
  Bash | mcp__webstorm__execute_terminal_command | mcp__webstorm__execute_tool) ;;
31
33
  *) exit 0 ;;
@@ -33,9 +35,9 @@ esac
33
35
 
34
36
  cmd="$(rt_hook_cmd)"
35
37
 
36
- # Универсальный исполнитель среды передаёт настоящую команду вложенной строкой. Разбирать надо
37
- # её, а не обёртку: иначе имя команды стоит сразу за кавычкой и ни одно правило до него не
38
- # дотягивается.
38
+ # The universal executor of the environment passes the real command as a nested string. It is the
39
+ # one to parse, not the wrapper: otherwise the command name stands right after a quote and no rule
40
+ # reaches it.
39
41
  if [ "$tool" = "mcp__webstorm__execute_tool" ] && command -v perl >/dev/null 2>&1; then
40
42
  inner="$(printf '%s' "$cmd" | perl -0ne '
41
43
  if (/--command(?:=|\s+)(?:"((?:[^"\\]|\\.)*)"|\x27([^\x27]*)\x27|(.+))/s) {
@@ -44,18 +46,19 @@ if [ "$tool" = "mcp__webstorm__execute_tool" ] && command -v perl >/dev/null 2>&
44
46
  ' 2>/dev/null)"
45
47
  [ -n "$inner" ] && cmd="$inner"
46
48
  fi
47
- # Глагол ищется в позиции команды, а не подстрокой в строке.
49
+ # The verb is looked for in the command position, not as a substring in the line.
48
50
  #
49
- # Голый поиск «git commit» промахивается в обе стороны. Мимо него уходит вызов, у которого между
50
- # `git` и глаголом стоит ключ — `git -c user.name=… commit`, `git -C <дерево> commit`, — и ровно
51
- # так коммитят машинной учётной записью. В него же попадает строка, где эти два слова стоят
52
- # рядом по другому поводу: `git log --grep 'git commit'`, разбор чужого вывода, текст сообщения.
53
- # Отбой на чтении истории стоит дороже пропуска: гард, мешающий читать, выключают в первый день.
51
+ # A bare search for "git commit" misses in both directions. A call with an option between `git` and
52
+ # the verb slips past it — `git -c user.name=… commit`, `git -C <tree> commit` — and that is exactly
53
+ # how one commits under the machine account. And it catches a line where these two words stand next
54
+ # to each other for another reason: `git log --grep 'git commit'`, parsing someone else's output,
55
+ # the text of a message. A refusal on reading the history costs more than a miss: a guard that gets
56
+ # in the way of reading is switched off on the first day.
54
57
  #
55
- # Разбор простой: у каждого слова `git` в строке пропускаются ключи — сами по себе и вместе со
56
- # значением, если ключ его берёт, — и первое слово без дефиса и есть глагол. Слов `git` в строке
57
- # бывает несколько (`git add . && git commit`), поэтому печатаются глаголы всех, а судится
58
- # список целиком.
58
+ # The parsing is simple: for every word `git` in the line the options are skipped — on their own and
59
+ # together with a value, if the option takes one — and the first word without a dash is the verb.
60
+ # There can be several `git` words in a line (`git add . && git commit`), so the verbs of all of
61
+ # them are printed and the list is judged as a whole.
59
62
  if command -v awk >/dev/null 2>&1; then
60
63
  verbs="$(printf '%s\n' "$cmd" | awk '
61
64
  {
@@ -76,16 +79,17 @@ if command -v awk >/dev/null 2>&1; then
76
79
  ' 2>/dev/null)"
77
80
  printf '%s\n' "$verbs" | grep -qx 'commit' || exit 0
78
81
  else
79
- # Разборщика нет — остаётся прежний признак: он врёт в обе стороны, но гард без него не
80
- # судит вовсе.
82
+ # No parser — the former sign remains: it lies in both directions, but without it the guard
83
+ # judges nothing at all.
81
84
  case "$cmd" in
82
85
  *git\ commit*) ;;
83
86
  *) exit 0 ;;
84
87
  esac
85
88
  fi
86
89
 
87
- # Коммит выполнится в рабочем каталоге вызова, поэтому и ветку смотрим там же; корень проекта
88
- # — запасной вариант, и он важен для отдельного рабочего дерева, где ветка своя.
90
+ # The commit will run in the working directory of the call, so the branch is looked at there too;
91
+ # the project root is the fallback, and it matters for a separate working tree with a branch of its
92
+ # own.
89
93
  workdir="$(rt_hook_cwd)"
90
94
  [ -z "$workdir" ] && workdir="${CLAUDE_PROJECT_DIR:-.}"
91
95
  cd "$workdir" 2>/dev/null || exit 0
@@ -93,7 +97,7 @@ cd "$workdir" 2>/dev/null || exit 0
93
97
  git rev-parse --is-inside-work-tree >/dev/null 2>&1 || exit 0
94
98
 
95
99
  branch="$(git branch --show-current 2>/dev/null)"
96
- [ -z "$branch" ] && exit 0 # открепившийся HEAD — не про этот случай
100
+ [ -z "$branch" ] && exit 0 # a detached HEAD is not about this case
97
101
 
98
102
  default="$(git symbolic-ref --quiet --short refs/remotes/origin/HEAD 2>/dev/null | sed 's#^origin/##')"
99
103
  if [ -z "$default" ]; then
@@ -108,10 +112,10 @@ fi
108
112
 
109
113
  [ "$branch" = "$default" ] || exit 0
110
114
 
111
- reason="Отбито: коммит прямо в «${default}». Работа едет через ветку и PR — правило git-workflow. Заведи ветку отдельным вызовом и коммить в неё: подготовленные изменения при этом сохранятся. Если коммит в ${default} действительно нужен — спроси владельца, сам не обходи."
115
+ reason="Refused: a commit straight into «${default}». Work travels through a branch and a PR — the rule git-workflow. Create a branch by a separate call and commit into it: the staged changes stay in place. If a commit into ${default} really is needed — ask the owner, do not bypass it yourself."
112
116
 
113
- # Общий хвост отказа: два законных хода и законная форма обхода, если она у отказа есть.
114
- # Файл может быть не разложен — тогда хвоста нет, а причина отказа остаётся прежней.
117
+ # The shared deny tail: the two lawful moves and the lawful form of bypass, if the refusal has one.
118
+ # The file may not be laid out — then there is no tail, and the refusal reason stays as it is.
115
119
  # shellcheck disable=SC1090
116
120
  [ -f "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/deny-tail.sh" ] \
117
121
  && . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/deny-tail.sh" 2>/dev/null
@@ -122,6 +126,6 @@ deny_tail_text="$(rt_deny_tail "")"
122
126
  ${deny_tail_text}"
123
127
 
124
128
  jq -n --arg r "$reason" '{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:$r}}' 2>/dev/null \
125
- || printf '{"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"deny","permissionDecisionReason":"Коммит в главную ветку отбит. Заведи ветку."}}\n'
129
+ || printf '{"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"deny","permissionDecisionReason":"A commit into the main branch is refused. Create a branch."}}\n'
126
130
 
127
131
  exit 0
@@ -1,31 +1,32 @@
1
1
  #!/usr/bin/env bash
2
2
  # rt-hook: PreToolUse Bash|mcp__webstorm__execute_terminal_command|mcp__webstorm__execute_tool
3
- # Требует: hooks/profile-check.sh, hooks/deny-tail.sh
4
- # Гард проверок перед пушем. PreToolUse на вызове пуша.
3
+ # Requires: hooks/profile-check.sh, hooks/deny-tail.sh
4
+ # The guard of the checks before a push. PreToolUse on the push call.
5
5
  #
6
- # Пуш — это вход в конвейер: слияние в главную ветку запускает выкатку, и всё, что не
7
- # проверено локально, проверяется уже на проде. Сюда дважды подряд уезжают правки, зелёные в
8
- # выборочном прогоне и красные в конвейере: один раз прогонялись только сквозные спеки, другой
9
- # — только затронутый проект.
6
+ # A push is the entry into the pipeline: a merge into the main branch starts the rollout, and
7
+ # everything not checked locally gets checked on production already. Edits go out this way twice in
8
+ # a row, green in a selective run and red in the pipeline: one time only the end-to-end specs were
9
+ # run, the other only the affected project.
10
10
  #
11
- # Гард не верит на слово: он сам гоняет то, что перечислил профиль дерева, и пускает пуш только
12
- # при нулевом коде возврата. Если прогонщик кэширует результат, набор на неизменившемся дереве
13
- # занимает секунды, а после правки гоняется заново.
11
+ # The guard does not take it on trust: it runs what the tree profile listed itself, and lets the
12
+ # push through only on a zero return code. If the runner caches the result, the set takes seconds
13
+ # on an unchanged tree, and after an edit it is run anew.
14
14
  #
15
- # Что гонять, знает профиль: функция `rt_push_checks <база>` — по команде на строку. База —
16
- # ветка, относительно которой считается вклад; пустая означает, что удалённого нет. Функция
17
- # зовётся из каталога, откуда идёт пуш, и вправе решать по нему сама: шаг, проверки которого в
18
- # дереве нет, она просто не печатает. Нет профиля или нет функции — гард пропускает: список
19
- # проверок пакет выдумать не может.
15
+ # What to run is known by the profile: the function `rt_push_checks <base>` — one command per line.
16
+ # The base is the branch the contribution is counted against; empty means there is no remote. The
17
+ # function is called from the directory the push goes from and may decide by it itself: a step
18
+ # whose checks the tree does not have it simply does not print. There is no profile or no function
19
+ # — the guard passes: the package cannot invent the list of checks.
20
20
  #
21
- # База берётся у удалённого, а не у локальной главной ветки: локальная отстаёт или расходится
22
- # молча. Это уже случалось — локальная стояла на слиянии, стёртом из истории силовым пушем, и
23
- # набор от неё посчитался бы не тот. Нет сети или нет удалённого — база пустая, и профиль
24
- # откатывается на полный прогон: гейт может оказаться строже нужного, но НИКОГДА не слабее.
21
+ # The base is taken from the remote, not from the local main branch: the local one falls behind or
22
+ # diverges silently. That has happened already — the local one stood at a merge wiped from the
23
+ # history by a force push, and the set counted against it would have been the wrong one. There is
24
+ # no network or no remote — the base is empty, and the profile falls back to a full run: the gate
25
+ # may turn out stricter than needed, but NEVER weaker.
25
26
  #
26
- # ОТКАЗ В ПОЛЬЗУ РАБОТЫ: не репозиторий, битый ввод, нет профиля — пропуск.
27
+ # FAIL-OPEN: not a repository, broken input, no profile — pass.
27
28
 
28
- # Своё имя в наблюдениях: отбой пишет общий хвост отказа, а не сам гард.
29
+ # Its own name in the observations: the refusal is written by the shared deny tail, not by the guard.
29
30
  RT_GUARD_NAME=git-guard-push-tests
30
31
 
31
32
  . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utf8.sh" 2>/dev/null || true
@@ -37,48 +38,51 @@ input="$RT_HOOK_INPUT"
37
38
 
38
39
  tool="$(rt_hook_tool)"
39
40
  case "$tool" in
40
- # Терминал среды и универсальный исполнитель кладут команду в то же поле.
41
+ # The environment terminal and the universal runner put the command into the same field.
41
42
  Bash | mcp__webstorm__execute_terminal_command | mcp__webstorm__execute_tool) ;;
42
43
  *) exit 0 ;;
43
44
  esac
44
45
 
45
46
  cmd="$(rt_hook_cmd)"
46
47
 
47
- # Вызов пуша узнаётся по двум признакам сразу — команда `git` в начале строки или за
48
- # разделителем и слово `push` отдельным словом. Тем же приёмом, что у гарда поставки: одной
49
- # подстрокой «git push» пуш не поймать — помощник учётных данных и заголовок запроса ставятся
50
- # ключами `-c` между ними, и ровно этой формой здесь и пушат. Пока признаком была подстрока,
51
- # весь набор гейта на таком пуше не гонялся вовсе, а молчание гарда читалось как «зелено».
48
+ # A push call is recognised by two signs at once — the `git` command at the start of the line or
49
+ # after a separator, and the word `push` as a separate word. By the same technique as the delivery
50
+ # guard: the substring "git push" alone does not catch a push — the credentials helper and the
51
+ # request header are put between them by `-c` keys, and that is exactly the form pushed with here.
52
+ # While the sign was a substring, the whole gate set was not run at all on such a push, and the
53
+ # silence of the guard read as "green".
52
54
  printf '%s' "$cmd" | grep -qE "${RT_CMD_BOUND}git([[:space:]]|\$)" || exit 0
53
55
 
54
- # Отложенная правка пушем не бывает: `git stash push` кладёт правку в тайник этой же машины и
55
- # наружу не отправляет ничего. Слово `push` в ней стоит отдельным, и без этой строки гард гонял
56
- # на ней весь набор, а потом отбивал вызов на первой красной проверке — то есть отбивал команду,
57
- # которая ничего никуда не отправляет. Тайник вырезается из строки, и признак считается по
58
- # остатку: в составной команде рядом с ним может стоять и настоящий пуш.
56
+ # A stashed edit is never a push: `git stash push` puts the edit into the stash of this same
57
+ # machine and sends nothing outside. The word `push` in it stands separate, and without this line
58
+ # the guard ran the whole set on it and then refused the call on the first red check — that is, it
59
+ # refused a command that sends nothing anywhere. The stash is cut out of the line, and the sign is
60
+ # counted on the remainder: in a compound command a real push may stand next to it.
59
61
  probe="$(printf '%s' "$cmd" | sed -E 's/git[[:space:]]+stash[[:space:]]+push/git stash/g')"
60
62
  printf '%s' "$probe" | grep -qE '(^|[[:space:]])push([[:space:]]|$)' || exit 0
61
63
 
62
- # Пробный пуш ничего не отправляет: гонять ради него весь набор незачем.
64
+ # A dry-run push sends nothing: there is no point running the whole set for it.
63
65
  case "$cmd" in
64
66
  *--dry-run*) exit 0 ;;
65
67
  esac
66
68
 
67
- # Переключение ветки в той же команде отбивается целиком.
69
+ # A branch switch in the same command is refused whole.
68
70
  #
69
- # Гард — это разбор команды ДО её запуска: набор он гоняет в том дереве, какое лежит сейчас.
70
- # Составная «переключиться и запушить» проходит гейт по ПРЕЖНЕЙ ветке — молча, проверяя не то.
71
- # Отказа при этом нет, и зелёный набор читается как проверка того, что уходит на хостинг.
72
- # Поймано это было случайно: гейт отбил пуш красной проверкой длины файла, которого в пушимой
73
- # ветке нет вовсе — он смотрел ветку, с которой в этой же команде уходили.
71
+ # The guard is a parse of the command BEFORE it runs: it runs the set in the tree that lies there
72
+ # now. A compound "switch and push" passes the gate on the FORMER branch — silently, checking the
73
+ # wrong thing. There is no refusal at that, and a green set reads as a check of what goes to the
74
+ # hosting. This was caught by chance: the gate refused a push on a red check of file length for a
75
+ # file that is not in the pushed branch at all — it was looking at the branch the same command was
76
+ # leaving.
74
77
  #
75
- # Судится переключение на существующую ветку. Заведение новой (`checkout -b`, `switch -c`)
76
- # сюда не попадает: у свежей ветки дерево то же самое, что и было.
78
+ # What is judged is a switch to an existing branch. Creating a new one (`checkout -b`, `switch -c`)
79
+ # does not fall here: a fresh branch has the same tree as it had.
77
80
  if printf '%s' "$cmd" | grep -qE "${RT_CMD_BOUND}git[[:space:]]+(checkout|switch)[[:space:]]+" &&
78
- ! printf '%s' "$cmd" | grep -qE 'git[[:space:]]+(checkout[[:space:]]+-b|switch[[:space:]]+-c)([[:space:]]|$)'; then
79
- reason="BLOCKED: переключение ветки и пуш одной командой. Набор гейта гоняется в том дереве, какое лежит на момент разбора команды, — то есть по ПРЕЖНЕЙ ветке, а не по той, что уходит на хостинг. Зелёный набор при этом читается как проверка ушедшего, хотя проверял он другое. Раздели вызовы: сперва переключись, затем отдельной командой пушь."
80
- # Общий хвост отказа: два законных хода и законная форма обхода, если она у отказа есть.
81
- # Файл может быть не разложен — тогда хвоста нет, а причина отказа остаётся прежней.
81
+ ! printf '%s' "$cmd" | grep -qE 'git[[:space:]]+(checkout([[:space:]]+-[A-Za-z-]+)*[[:space:]]+-b|switch([[:space:]]+-[A-Za-z-]+)*[[:space:]]+-c)([[:space:]]|$)'; then
82
+ reason="BLOCKED: switching the branch and pushing by one command. The gate set runs on the tree that lies there at the minute the command is parsed — that is, on the FORMER branch, not the one that leaves for the hosting. A green set then reads as a check of what left, though it checked something else. Split the calls: switch first, then push by a separate command."
83
+ # The shared deny tail: the two lawful moves and the lawful form of bypass, if the refusal has
84
+ # one. The file may not be laid out — then there is no tail, and the reason for the refusal
85
+ # stays as it was.
82
86
  # shellcheck disable=SC1090
83
87
  [ -f "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/deny-tail.sh" ] \
84
88
  && . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/deny-tail.sh" 2>/dev/null
@@ -89,7 +93,7 @@ if printf '%s' "$cmd" | grep -qE "${RT_CMD_BOUND}git[[:space:]]+(checkout|switch
89
93
  ${deny_tail_text}"
90
94
 
91
95
  jq -n --arg r "$reason" '{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:$r}}' 2>/dev/null \
92
- || printf '{"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"deny","permissionDecisionReason":"Переключение ветки и пуш одной командой."}}\n'
96
+ || printf '{"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"deny","permissionDecisionReason":"Switching the branch and pushing by one command."}}\n'
93
97
  exit 0
94
98
  fi
95
99
 
@@ -99,27 +103,27 @@ cd "$workdir" 2>/dev/null || exit 0
99
103
  git rev-parse --is-inside-work-tree >/dev/null 2>&1 || exit 0
100
104
  [ -f package.json ] || exit 0
101
105
 
102
- # Профиль дерева: сперва умолчание пакета, поверх него — надстройка проекта, если она есть.
103
- # Объявленная в надстройке функция замещает умолчание целиком и вправе позвать его обратно
104
- # суффиксом `_default`. Нет ни того ни другого — хук пропускает: пустой гард лучше гарда,
105
- # отбивающего наугад.
106
+ # The tree profile: first the package default, over it the project override, if there is one. A
107
+ # function declared in the override replaces the default whole and may call it back by the
108
+ # `_default` suffix. There is neither — the hook passes: an empty guard is better than a guard
109
+ # that refuses at random.
106
110
  rt_hooks_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
107
111
  for profile in "$rt_hooks_dir/../rt-kit/defaults/project.sh" "$rt_hooks_dir/../defaults/project.sh" "${CLAUDE_PROJECT_DIR:-.}/.claude/rt-kit/defaults/project.sh" "${CLAUDE_PROJECT_DIR:-.}/.claude/rt-kit/project.sh"; do
108
112
  # shellcheck disable=SC1090
109
113
  [ -f "$profile" ] && . "$profile" 2>/dev/null
110
114
  done
111
115
 
112
- # Слово о нехватке функции профиля: хук, вышедший молча, неотличим от работающего. Файл может
113
- # быть не разложен — тогда остаётся прежнее поведение, молчаливое.
116
+ # A word about a missing profile function: a hook that exited silently is indistinguishable from a
117
+ # working one. The file may not be laid out — then the former, silent behaviour stays.
114
118
  # shellcheck disable=SC1090
115
119
  [ -f "$rt_hooks_dir/profile-check.sh" ] && . "$rt_hooks_dir/profile-check.sh"
116
120
  command -v rt_needs >/dev/null 2>&1 || rt_needs() { command -v "$1" >/dev/null 2>&1; }
117
121
 
118
- # Строка наблюдения на каждый исход. Гард, пишущий только отбои, отвечает на один вопрос из
119
- # трёх: сколько пушей он остановил. «Набор прогнан и зелёный» и «набора не нашлось» выглядят в
120
- # записи одинаково — молчанием, — и гейт, не гонявший ни одной проверки за неделю, неотличим от
121
- # гейта, у которого всё зелено. Пишется это той же записью наблюдений, что и отбои гардов, и
122
- # гаснет тем же выключателем дерева.
122
+ # An observation line on every outcome. A guard that writes only refusals answers one question out
123
+ # of three: how many pushes it stopped. "The set was run and is green" and "no set was found" look
124
+ # the same in the record — as silence — and a gate that has not run a single check in a week is
125
+ # indistinguishable from a gate where everything is green. This is written into the same
126
+ # observations record as guard refusals, and goes out by the same tree switch.
123
127
  rt_push_gate_note() {
124
128
  local outcome="$1" sid
125
129
  # shellcheck disable=SC1090
@@ -145,10 +149,11 @@ if git fetch --quiet origin "$main_branch" 2>/dev/null && git rev-parse --verify
145
149
  base="origin/$main_branch"
146
150
  fi
147
151
 
148
- # Код, которым проверка объявляет, что смотреть было не на что: ни «сошлось», ни «расхождение».
149
- # Прежде такая проверка говорила о себе строкой вывода и выходила нулём — в наборе этот ноль
150
- # стоял рядом с пройденными и ничем от них не отличался, а сводка читалась как проверенная
151
- # целиком. Пуш он не отбивает: проверка, которой нечего смотреть, поломкой не является.
152
+ # The code by which a check declares that there was nothing to look at: neither "it matched" nor
153
+ # "a divergence". Before, such a check said so by a line of output and exited with zero — in the
154
+ # set that zero stood next to the passed ones and differed from them in nothing, while the summary
155
+ # read as checked whole. It does not refuse the push: a check with nothing to look at is not a
156
+ # breakage.
152
157
  rt_skip_code="${RT_SKIP_CODE:-7}"
153
158
 
154
159
  failed=""
@@ -173,37 +178,42 @@ done <<EOF
173
178
  $(rt_push_checks "$base")
174
179
  EOF
175
180
 
176
- # Пропущенное называется вслух и тогда, когда набор прошёл: молчание о нём и есть та самая
177
- # неотличимость, ради которой код заведён. Пуш при этом идёт — отказа здесь нет.
178
- # Функция профиля есть, а печатать ей в этом дереве нечего: исход тот же, что и без неё, —
179
- # набора не нашлось, и молчание о нём читалось бы как зелёный прогон.
181
+ # What was skipped is named aloud even when the set passed: silence about it is exactly the
182
+ # indistinguishability this code was created for. The push goes through at that — there is no
183
+ # refusal here.
184
+ # The profile function is there, but it has nothing to print in this tree: the outcome is the same
185
+ # as without it — no set was found, and silence about that would read as a green run.
180
186
  if [ "$ran" -eq 0 ]; then
181
187
  rt_push_gate_note no-checks
182
188
  exit 0
183
189
  fi
184
190
 
185
191
  if [ -z "$failed" ] && [ -n "$skipped" ]; then
186
- printf 'гейт пуша: набор прошёл, но эти проверки смотреть было не на что:\n%s\n' "$skipped" >&2
192
+ printf 'the push gate: the set passed, but these checks had nothing to look at:\n%s\n' "$skipped" >&2
187
193
  fi
188
194
 
189
- # Чем набор гейта уже набора конвейера — сказанное один раз за сессию.
195
+ # How the gate set is narrower than the pipeline set — said once per session.
190
196
  #
191
- # Правило поставки требует, чтобы гейт не был уже конвейера, а собрать это требование нечем:
192
- # файл конвейера у каждого дерева свой, и вывести из него шаги набора пакет не может. Молчание
193
- # при этом читается как «проверено всё»: расхождение узнаётся из красного конвейера после
194
- # заявки, когда правка уже отдана человеку.
197
+ # The delivery rule demands that the gate not be narrower than the pipeline, and there is nothing
198
+ # to assemble that requirement from: the pipeline file differs from tree to tree, and the package
199
+ # cannot derive the steps of the set from it. Silence at that reads as "everything is checked": the
200
+ # divergence is learnt from a red pipeline after the PR, when the edit has already been handed to a
201
+ # person.
195
202
  #
196
- # Отметка живёт в каталоге временных файлов, как у слова о нехватке функции профиля: на каждый
197
- # пуш та же строка повторялась бы за заход десятки раз и перестала бы читаться.
203
+ # The mark lives in the temporary files directory, as with the word about a missing profile
204
+ # function: on every push the same line would repeat dozens of times per session and would stop
205
+ # being read.
198
206
  gap_key="$(printf '%s' "$input" | jq -r '.session_id // empty' 2>/dev/null)"
199
207
  [ -z "$gap_key" ] && gap_key="$(date +%Y%m%d 2>/dev/null || printf 'nosession')"
200
208
  gap_mark="${TMPDIR:-/tmp}/rt-kit-push-gate-gap-$gap_key"
201
209
  if [ ! -f "$gap_mark" ]; then
202
- printf 'гейт пуша: набор гейта — не набор конвейера. Сборка образов, снимки показа и проверка
210
+ printf 'the push gate: the gate set is not the pipeline set. Image builds, showcase snapshots and
203
211
  ' >&2
204
- printf 'собранных пакетов в него не входят: что в нём стоит, показывает разбор состояния
212
+ printf 'the check of assembled packages are not part of it: what stands in it is shown by the
205
213
  ' >&2
206
- printf '(agent-kit doctor, раздел «набор перед пушем»), — прогони недостающее до заявки.
214
+ printf 'state review (agent-kit doctor, the section on the set before a push) — run what is
215
+ ' >&2
216
+ printf 'missing before the request.
207
217
  ' >&2
208
218
  : >"$gap_mark" 2>/dev/null || true
209
219
  fi
@@ -215,23 +225,25 @@ fi
215
225
 
216
226
  rt_push_gate_note red
217
227
 
218
- # Хвост вывода, а не весь: у прогонщика он длинный, а нужна причина отказа.
228
+ # The tail of the output, not all of it: the runner prints a long one, and what is needed is the
229
+ # reason for the refusal.
219
230
  tail_out="$(printf '%s' "$output" | tail -n 40 | tr -d '\000')"
220
- # Красное бывает двух родов, и гард их не различает: он проверяет только код возврата. Когда
221
- # падает проверка кода, «почини и пушь снова» верно. Когда ошибается сама проверка, тот же текст
222
- # велит чинить код, которого никто не трогал: разобранный однажды отказ целиком лежал в
223
- # документах, не тронутых ни одним коммитом ветки. Закон о проверяемости говорит, что сломанная
224
- # проверка работу не останавливает, и до этой строки такого варианта в отказе не было.
225
- reason="BLOCKED: пуш без зелёного локального прогона. «${failed}» упала — почини и пушь снова, обходить гард нельзя. Пуш — вход в конвейер, и красное отсюда проверяется уже на проде.
231
+ # Red comes in two kinds, and the guard does not tell them apart: it checks only the return code.
232
+ # When a check of the code fails, "fix it and push again" is right. When the check itself is wrong,
233
+ # the same text orders fixing code nobody touched: a refusal once taken apart lay wholly in
234
+ # documents untouched by any commit of the branch. The verifiability law says a broken check does
235
+ # not stop the work, and until this line there was no such option in the refusal.
236
+ reason="BLOCKED: a push without a green local run. «${failed}» failed — fix it and push again, the guard must not be bypassed. A push is the entry into the pipeline, and red from here is checked already in production.
226
237
 
227
- Ходов отсюда три: починить названное и повторить вызов; починить саму проверку, если ошибается она, — разобрать отказы поимённо, показать разбор владельцу и поправить проверку; либо принести владельцу цену обхода и ждать его слова. Спорное в список известного не вносится: он хранит принятое, а не результаты сломанной проверки.
238
+ Three moves from here: fix what is named and repeat the call; fix the check itself, if it is the one that is wrong — take the refusals apart one by one, show the analysis to the owner and correct the check; or bring the owner the price of a bypass and wait for their word. What is in dispute is not added to the known list: it holds what was accepted, not the results of a broken check.
228
239
 
229
- Хвост вывода:
240
+ The tail of the output:
230
241
 
231
242
  ${tail_out}"
232
243
 
233
- # Общий хвост отказа: два законных хода и законная форма обхода, если она у отказа есть.
234
- # Файл может быть не разложен — тогда хвоста нет, а причина отказа остаётся прежней.
244
+ # The shared deny tail: the two lawful moves and the lawful form of bypass, if the refusal has one.
245
+ # The file may not be laid out — then there is no tail, and the reason for the refusal stays as it
246
+ # was.
235
247
  # shellcheck disable=SC1090
236
248
  [ -f "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/deny-tail.sh" ] \
237
249
  && . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/deny-tail.sh" 2>/dev/null
@@ -242,6 +254,6 @@ deny_tail_text="$(rt_deny_tail "")"
242
254
  ${deny_tail_text}"
243
255
 
244
256
  jq -n --arg r "$reason" '{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:$r}}' 2>/dev/null \
245
- || printf '{"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"deny","permissionDecisionReason":"Проверки перед пушем не прошли."}}\n'
257
+ || printf '{"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"deny","permissionDecisionReason":"The checks before the push did not pass."}}\n'
246
258
 
247
259
  exit 0
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env bash
2
2
  # rt-hook: SessionStart startup|resume|compact|clear
3
- # SessionStart: словарь проекта уезжает в контекст целиком, на каждом запуске сессии.
3
+ # SessionStart: the project glossary goes into the context in full, on every session start.
4
4
  #
5
- # Памятью это не держится: словарь читают перед тем, как написать текст, а разговор с
6
- # владельцем идёт без чтения — и слово из левой колонки «Так не пишем» всплывает в ответе,
7
- # хотя в файлах его уже нет. Здесь словарь приходит до первой реплики и действует и на
8
- # тексты, и на ответы.
5
+ # Memory does not hold this: the glossary is read before a text is written, while the conversation
6
+ # with the owner goes on without reading — and a word from the left column of "Not written here"
7
+ # surfaces in a reply, though the files no longer have it. Here the glossary arrives before the
8
+ # first message and applies to texts and replies alike.
9
9
  #
10
- # FAIL-OPEN: нет файла или нет `jq` — выходим молча. Сессия важнее словаря.
10
+ # FAIL-OPEN: no file or no `jq` — leave silently. The session matters more than the glossary.
11
11
 
12
12
  . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utf8.sh" 2>/dev/null || true
13
13
 
@@ -15,32 +15,33 @@ GLOSSARY="${CLAUDE_PROJECT_DIR:-.}/docs/GLOSSARY.md"
15
15
  [ -f "$GLOSSARY" ] || exit 0
16
16
  command -v jq >/dev/null 2>&1 || exit 0
17
17
 
18
- # Где слово заводят. Словарь бывает разложен пакетом — тогда правка на его месте теряется на
19
- # следующей раскладке, а до тех пор раскладка отказывает по нему целиком. Вводная, которую читает
20
- # каждая сессия, обязана вести в надстройку: она — единственный текст о словаре, доезжающий до
21
- # читателя гарантированно, и, ведя в собранный файл, она отменяет собой всё сказанное на других
22
- # слоях. Опровержение стоит строкой ниже, в шапке раскладки, но читается служебной строкой сборки:
23
- # начинается оно с версии и суммы, а не со слова.
18
+ # Where a word is introduced. The glossary may be laid out by the package — then an edit in its
19
+ # place is lost on the next layout, and until then the layout refuses the whole file. The preamble
20
+ # that every session reads must point to the override: it is the only text about the glossary that
21
+ # is guaranteed to reach the reader, and by pointing to the assembled file it would cancel
22
+ # everything said on the other layers. The correction stands one line lower, in the layout header,
23
+ # but reads as a service line of the build: it begins with a version and a digest, not with a word.
24
24
  #
25
- # Адрес выводится из идентификатора ресурса в самой шапке, а не зашивается: каталог надстроек у
26
- # каждого дерева свой, и зашитый путь врал бы в первом же, которое держит их иначе. Шапки нет —
27
- # словарь принадлежит дереву целиком, и «заводится здесь же» верно как есть.
25
+ # The address is derived from the resource id in the header itself, not hard-coded: each tree has
26
+ # its own override directory, and a hard-coded path would lie in the first tree that keeps them
27
+ # differently. No header — the glossary belongs to the tree as a whole, and "introduced right here"
28
+ # is true as it is.
28
29
  header="$(head -1 "$GLOSSARY" 2>/dev/null)"
29
30
  resource="$(printf '%s' "$header" | sed -n 's/.*rt-kit v[^ ]* · \([^ ]*\) · .*/\1/p')"
30
31
 
31
32
  if [ -n "$resource" ]; then
32
- where="$(printf 'Словарь разложен пакетом и на месте не правится: новое слово идёт в надстройку\n.claude/rt-kit/overrides/%s — она сливается по разделу «## » и раскладку переживает.\n' "$resource")"
33
+ where="$(printf 'The glossary is laid out by the package and is not edited in place: a new word goes to the override\n.claude/rt-kit/overrides/%s — it merges by `## ` section and survives the layout.\n' "$resource")"
33
34
  else
34
- where='Словарь принадлежит дереву целиком: новое слово заводится в нём же той же правкой.
35
+ where='The glossary belongs to the tree as a whole: a new word is added right here, by the same edit.
35
36
  '
36
37
  fi
37
38
 
38
39
  {
39
- printf 'СЛОВАРЬ ПРОЕКТА — `docs/GLOSSARY.md`, ниже целиком.\n\n'
40
- printf 'Слово отсюда употребляется в том значении, что здесь: и в файлах, и в ответах владельцу.\n'
41
- printf 'Раздел «Так не пишем» действует так же — левая колонка не пишется и не произносится нигде.\n'
42
- printf 'Слова, которого здесь нет, у читателя нет тоже: оно вводится тем же изменением, которым\n'
43
- printf 'впервые употреблено, либо заменяется тем, что уже есть.\n'
40
+ printf 'PROJECT GLOSSARY — `docs/GLOSSARY.md`, in full below.\n\n'
41
+ printf 'A word from here is used in the meaning given here: in files and in replies to the owner alike.\n'
42
+ printf 'The "Not written here" section works the same way: its left column is neither written nor said anywhere.\n'
43
+ printf 'A word that is not here does not exist for the reader either: it is introduced by the same change\n'
44
+ printf 'that first uses it, or replaced with a word that already exists.\n'
44
45
  printf '%s\n' "$where"
45
46
  cat "$GLOSSARY"
46
47
  } | jq -Rs '{hookSpecificOutput:{hookEventName:"SessionStart",additionalContext:.}}'