@rt-tools/agent-kit 0.24.0 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (279) hide show
  1. package/assets/agents/business-analyst.md +51 -50
  2. package/assets/agents/conscience.md +37 -35
  3. package/assets/agents/project-manager.md +49 -48
  4. package/assets/agents/prose-editor.md +31 -29
  5. package/assets/agents/qa-engineer.md +50 -48
  6. package/assets/agents/rules-reviewer.md +63 -58
  7. package/assets/agents/skill-curator.md +83 -78
  8. package/assets/agents/spec-critic.md +34 -29
  9. package/assets/agents/spec-writer.md +35 -32
  10. package/assets/agents/strict-teacher.md +39 -37
  11. package/assets/checks/archive-age.mjs +48 -28
  12. package/assets/checks/archive-prune.mjs +16 -14
  13. package/assets/checks/board-epics.github.mjs +75 -41
  14. package/assets/checks/board-folders.mjs +61 -0
  15. package/assets/checks/board-gh.github.mjs +35 -26
  16. package/assets/checks/board-long-work.github.mjs +24 -24
  17. package/assets/checks/board-paths.github.mjs +21 -16
  18. package/assets/checks/board-runs.github.mjs +45 -43
  19. package/assets/checks/board-titles.github.mjs +19 -17
  20. package/assets/checks/board.github.mjs +149 -127
  21. package/assets/checks/check-archive-age.mjs +23 -19
  22. package/assets/checks/check-board.github.mjs +172 -164
  23. package/assets/checks/check-descriptions.mjs +30 -29
  24. package/assets/checks/check-doc-paths.mjs +91 -88
  25. package/assets/checks/check-dupes.mjs +84 -80
  26. package/assets/checks/check-file-size.mjs +74 -71
  27. package/assets/checks/check-glossary.mjs +47 -37
  28. package/assets/checks/check-hook-scope.mjs +30 -27
  29. package/assets/checks/check-lib-layers.mjs +22 -21
  30. package/assets/checks/check-profile-drift.mjs +48 -43
  31. package/assets/checks/check-prose-style.mjs +120 -37
  32. package/assets/checks/check-push-gate.mjs +53 -50
  33. package/assets/checks/check-reuse.mjs +50 -40
  34. package/assets/checks/check-schema-drift.mjs +87 -83
  35. package/assets/checks/check-specs.mjs +155 -134
  36. package/assets/checks/check-state-next.mjs +66 -52
  37. package/assets/checks/check-states.mjs +32 -30
  38. package/assets/checks/check-styles.mjs +52 -51
  39. package/assets/checks/check-turn-map.mjs +54 -46
  40. package/assets/checks/lib-boundaries.mjs +32 -30
  41. package/assets/checks/lib-common.mjs +30 -29
  42. package/assets/checks/lib-domains.mjs +34 -34
  43. package/assets/checks/lib-manifests.mjs +17 -15
  44. package/assets/checks/lib-reexports.mjs +18 -18
  45. package/assets/checks/rt-kit-checks.config.mjs +174 -142
  46. package/assets/checks/signals.mjs +43 -39
  47. package/assets/checks/spec-anchors.mjs +114 -87
  48. package/assets/checks/spec-common.mjs +128 -84
  49. package/assets/checks/spec-contract.mjs +30 -30
  50. package/assets/checks/spec-proposed.mjs +27 -24
  51. package/assets/checks/spec-scenarios.mjs +51 -28
  52. package/assets/checks/task-new.github.mjs +85 -56
  53. package/assets/commands/feedback.md +65 -59
  54. package/assets/commands/next-session.md +64 -57
  55. package/assets/commands/skill-curator.md +83 -79
  56. package/assets/defaults/gate-map.sh +108 -97
  57. package/assets/defaults/project.sh +225 -185
  58. package/assets/defaults/shell.sh +73 -68
  59. package/assets/defaults/turn-map.md +45 -44
  60. package/assets/docs/GLOSSARY.md +142 -65
  61. package/assets/hooks/browser-device-id.sh +12 -12
  62. package/assets/hooks/browser-guard-device-id.sh +30 -28
  63. package/assets/hooks/browser-guard-no-asking.sh +5 -4
  64. package/assets/hooks/browser-guard-no-listing.sh +12 -11
  65. package/assets/hooks/browser-guard-no-other-drivers.sh +48 -42
  66. package/assets/hooks/browser-guard-require-select.sh +34 -23
  67. package/assets/hooks/claim-guard.sh +62 -56
  68. package/assets/hooks/commit-msg.sh +11 -10
  69. package/assets/hooks/conscience-guard.sh +91 -45
  70. package/assets/hooks/constitution-index.sh +16 -16
  71. package/assets/hooks/deny-tail.sh +28 -26
  72. package/assets/hooks/dev-server-guard.sh +46 -43
  73. package/assets/hooks/dispatch.sh +60 -46
  74. package/assets/hooks/docs-guard.sh +100 -91
  75. package/assets/hooks/exam-guard.sh +105 -93
  76. package/assets/hooks/git-guard-delivery-conflict.sh +38 -36
  77. package/assets/hooks/git-guard-delivery-draft.sh +45 -38
  78. package/assets/hooks/git-guard-delivery-folder.sh +50 -43
  79. package/assets/hooks/git-guard-delivery-signature.sh +88 -52
  80. package/assets/hooks/git-guard-delivery.sh +196 -180
  81. package/assets/hooks/git-guard-main.sh +38 -34
  82. package/assets/hooks/git-guard-push-tests.sh +99 -87
  83. package/assets/hooks/glossary-load.sh +23 -22
  84. package/assets/hooks/grill-gate-ask.sh +12 -11
  85. package/assets/hooks/grill-gate.sh +94 -87
  86. package/assets/hooks/guard-note.sh +20 -19
  87. package/assets/hooks/handoff-entry-guard.sh +26 -24
  88. package/assets/hooks/handoff-write.sh +74 -67
  89. package/assets/hooks/hook-input.sh +67 -58
  90. package/assets/hooks/lint-after-edit.sh +95 -61
  91. package/assets/hooks/observe.sh +28 -26
  92. package/assets/hooks/override-write-guard.sh +23 -21
  93. package/assets/hooks/postmortem-guard.sh +42 -39
  94. package/assets/hooks/profile-check.sh +22 -20
  95. package/assets/hooks/proposal-guard.sh +57 -49
  96. package/assets/hooks/prose-style-guard.sh +19 -17
  97. package/assets/hooks/qa-dataid-guard.sh +52 -49
  98. package/assets/hooks/rerun-guard.sh +31 -30
  99. package/assets/hooks/reuse-first-guard.sh +108 -87
  100. package/assets/hooks/roles.sh +14 -14
  101. package/assets/hooks/rule-article.sh +36 -34
  102. package/assets/hooks/rule-source-guard.sh +47 -42
  103. package/assets/hooks/skill-gate-layers.sh +59 -57
  104. package/assets/hooks/skill-gate-rearm.sh +15 -8
  105. package/assets/hooks/skill-gate.sh +89 -81
  106. package/assets/hooks/skill-loaded.sh +6 -6
  107. package/assets/hooks/sql-guard-parse.sh +68 -66
  108. package/assets/hooks/sql-guard-request.sh +48 -46
  109. package/assets/hooks/sql-guard-target.sh +57 -51
  110. package/assets/hooks/sql-guard-write.sh +84 -79
  111. package/assets/hooks/sql-guard.sh +52 -47
  112. package/assets/hooks/stand-login-guard.sh +40 -37
  113. package/assets/hooks/task-context-load.sh +60 -55
  114. package/assets/hooks/task-flow-context.sh +87 -69
  115. package/assets/hooks/task-flow-draft-guard.sh +55 -48
  116. package/assets/hooks/task-flow-guard.sh +67 -64
  117. package/assets/hooks/turn-entry-load.sh +39 -32
  118. package/assets/hooks/turn-exit-guard.sh +256 -204
  119. package/assets/hooks/turn-exit-patterns.sh +53 -0
  120. package/assets/hooks/utf8.sh +11 -11
  121. package/assets/hooks/waiting-turn-guard.sh +94 -94
  122. package/assets/hooks/window-fill-guard.sh +70 -62
  123. package/assets/hooks/work-start-guard.sh +52 -49
  124. package/assets/hooks/write-targets.sh +96 -44
  125. package/assets/laws/autonomous-work.md +29 -27
  126. package/assets/laws/code-structure.md +31 -30
  127. package/assets/laws/delivery.md +148 -137
  128. package/assets/laws/entity-editing.md +52 -50
  129. package/assets/laws/entity-models.md +14 -13
  130. package/assets/laws/frontend-application.md +39 -38
  131. package/assets/laws/lib-imports.md +27 -27
  132. package/assets/laws/lists.md +31 -29
  133. package/assets/laws/navigation.md +37 -37
  134. package/assets/laws/observability.md +41 -40
  135. package/assets/laws/project-documentation.md +106 -99
  136. package/assets/laws/reuse-first.md +31 -29
  137. package/assets/laws/shared-code.md +27 -27
  138. package/assets/laws/verifiability.md +131 -124
  139. package/assets/laws/work-conduct.md +250 -244
  140. package/assets/patterns/admin-lists-screen.md +72 -69
  141. package/assets/patterns/admin-nav-item.md +51 -46
  142. package/assets/patterns/angular-patterns-state.md +32 -31
  143. package/assets/patterns/api-layer-pair.md +33 -31
  144. package/assets/patterns/autonomous-work-run.md +50 -49
  145. package/assets/patterns/browser-verification-measure.md +124 -88
  146. package/assets/patterns/browser-verification-stand.md +169 -157
  147. package/assets/patterns/component-structure-new.md +51 -42
  148. package/assets/patterns/dependencies-upgrade.md +55 -39
  149. package/assets/patterns/doc-style-human.md +55 -37
  150. package/assets/patterns/doc-style-sweep.md +82 -79
  151. package/assets/patterns/doc-style-trace.md +87 -81
  152. package/assets/patterns/doc-style-write.md +130 -122
  153. package/assets/patterns/entity-aside.md +77 -63
  154. package/assets/patterns/entity-models-new.md +37 -37
  155. package/assets/patterns/entity-store.md +33 -33
  156. package/assets/patterns/git-workflow-commit.azure.md +93 -86
  157. package/assets/patterns/git-workflow-commit.github.md +152 -141
  158. package/assets/patterns/git-workflow-commit.gitlab.md +95 -89
  159. package/assets/patterns/git-workflow-docker.md +165 -147
  160. package/assets/patterns/git-workflow-freshness.md +45 -45
  161. package/assets/patterns/git-workflow-merge.md +98 -93
  162. package/assets/patterns/git-workflow-migration.md +54 -52
  163. package/assets/patterns/git-workflow-pr-ready.md +57 -56
  164. package/assets/patterns/git-workflow-pr.azure.md +126 -121
  165. package/assets/patterns/git-workflow-pr.github.md +179 -175
  166. package/assets/patterns/git-workflow-pr.gitlab.md +138 -131
  167. package/assets/patterns/git-workflow-restart.md +35 -31
  168. package/assets/patterns/git-workflow-secrets.md +80 -73
  169. package/assets/patterns/git-workflow-stack.md +131 -106
  170. package/assets/patterns/lib-layers-move.md +62 -53
  171. package/assets/patterns/lib-layers-new.md +59 -45
  172. package/assets/patterns/observability-record.md +72 -67
  173. package/assets/patterns/platform-access-di.md +31 -29
  174. package/assets/patterns/reuse-first-extend.md +66 -61
  175. package/assets/patterns/shared-code-new.md +39 -38
  176. package/assets/patterns/spec-driven-domain.md +161 -151
  177. package/assets/patterns/spec-driven-rule.md +179 -168
  178. package/assets/patterns/spec-driven-sweep.md +41 -39
  179. package/assets/patterns/status-report-table.github.md +37 -36
  180. package/assets/patterns/styling-bem-component.md +42 -42
  181. package/assets/patterns/styling-bem-layout.md +39 -34
  182. package/assets/patterns/styling-bem-sheet.md +59 -58
  183. package/assets/patterns/task-flow-archive.md +222 -215
  184. package/assets/patterns/task-flow-close.md +215 -203
  185. package/assets/patterns/task-flow-handoff.md +154 -145
  186. package/assets/patterns/task-flow-resume.md +138 -133
  187. package/assets/patterns/task-flow-start.md +204 -192
  188. package/assets/patterns/testing-e2e.md +102 -101
  189. package/assets/patterns/testing-unit.md +77 -70
  190. package/assets/patterns/ts-procedure.md +32 -29
  191. package/assets/patterns/turn-entry-map.md +50 -48
  192. package/assets/pitfalls/agent-kit.md +152 -141
  193. package/assets/pitfalls/doc-style.md +96 -91
  194. package/assets/pitfalls/git-workflow.azure.md +49 -46
  195. package/assets/pitfalls/git-workflow.github.md +264 -234
  196. package/assets/pitfalls/git-workflow.gitlab.md +49 -45
  197. package/assets/pitfalls/spec-driven.md +73 -71
  198. package/assets/pitfalls/styling-bem.md +46 -40
  199. package/assets/pitfalls/task-flow.md +262 -246
  200. package/assets/pitfalls/testing.md +99 -92
  201. package/assets/pitfalls/turn-conduct.md +96 -81
  202. package/assets/rules/angular-patterns.md +81 -80
  203. package/assets/rules/api-layer.md +77 -74
  204. package/assets/rules/autonomous-work.md +75 -74
  205. package/assets/rules/browser-verification.md +223 -214
  206. package/assets/rules/component-structure.md +72 -69
  207. package/assets/rules/dependencies.md +74 -67
  208. package/assets/rules/deploy-flow.azure.md +118 -108
  209. package/assets/rules/deploy-flow.github.md +145 -135
  210. package/assets/rules/deploy-flow.gitlab.md +120 -110
  211. package/assets/rules/doc-style.md +198 -173
  212. package/assets/rules/entity-conventions.needs-admin.md +81 -79
  213. package/assets/rules/entity-models.md +73 -70
  214. package/assets/rules/git-workflow.azure.md +224 -228
  215. package/assets/rules/git-workflow.github.md +250 -239
  216. package/assets/rules/git-workflow.gitlab.md +218 -217
  217. package/assets/rules/lib-layers.md +85 -86
  218. package/assets/rules/lists.md +101 -97
  219. package/assets/rules/navigation.md +78 -78
  220. package/assets/rules/observability.needs-app.md +165 -153
  221. package/assets/rules/platform-access.md +76 -75
  222. package/assets/rules/reuse-first.md +153 -143
  223. package/assets/rules/shared-code.md +82 -79
  224. package/assets/rules/spec-driven.md +272 -260
  225. package/assets/rules/status-report.md +55 -58
  226. package/assets/rules/styling-bem.md +81 -77
  227. package/assets/rules/task-flow.md +282 -270
  228. package/assets/rules/testing.md +224 -209
  229. package/assets/rules/turn-conduct.md +255 -258
  230. package/assets/rules/turn-entry.md +92 -87
  231. package/assets/rules/typescript-conventions.md +94 -88
  232. package/assets/samples/specs/_template/spec.md +47 -47
  233. package/assets/samples/tasks/_template/grill.md +20 -20
  234. package/assets/samples/tasks/_template/plan.md +32 -30
  235. package/assets/samples/tasks/_template/progress.md +16 -16
  236. package/assets/skills/agent-kit-extend.md +129 -113
  237. package/assets/skills/agent-kit.md +235 -211
  238. package/assets/skills/write-a-skill.md +76 -71
  239. package/assets/templates/findings.md +19 -19
  240. package/assets/templates/gate-map.sh +16 -14
  241. package/assets/templates/implementation.md +28 -27
  242. package/assets/templates/pattern.md +17 -17
  243. package/assets/templates/pitfalls.md +6 -6
  244. package/assets/templates/postmortem.md +24 -23
  245. package/assets/templates/project.sh +24 -24
  246. package/assets/templates/proposal.md +62 -60
  247. package/assets/templates/rule.md +38 -38
  248. package/assets/workflows/feature.js +46 -46
  249. package/assets/workflows/plan.js +54 -54
  250. package/lib/catalog.d.ts +2 -0
  251. package/lib/catalog.d.ts.map +1 -1
  252. package/lib/catalog.js +4 -3
  253. package/lib/catalog.js.map +1 -1
  254. package/lib/commands.d.ts.map +1 -1
  255. package/lib/commands.js +5 -2
  256. package/lib/commands.js.map +1 -1
  257. package/lib/companion.js +3 -2
  258. package/lib/companion.js.map +1 -1
  259. package/lib/enroll.d.ts +7 -1
  260. package/lib/enroll.d.ts.map +1 -1
  261. package/lib/enroll.js +12 -3
  262. package/lib/enroll.js.map +1 -1
  263. package/lib/plan.d.ts +11 -0
  264. package/lib/plan.d.ts.map +1 -1
  265. package/lib/plan.js +10 -1
  266. package/lib/plan.js.map +1 -1
  267. package/lib/ship.d.ts +0 -7
  268. package/lib/ship.d.ts.map +1 -1
  269. package/lib/ship.js +10 -2
  270. package/lib/ship.js.map +1 -1
  271. package/lib/shipment.d.ts.map +1 -1
  272. package/lib/shipment.js +6 -2
  273. package/lib/shipment.js.map +1 -1
  274. package/lib/sync.d.ts.map +1 -1
  275. package/lib/sync.js +45 -11
  276. package/lib/sync.js.map +1 -1
  277. package/package.json +1 -1
  278. package/rt-tools-agent-kit-0.26.0.tgz +0 -0
  279. package/rt-tools-agent-kit-0.24.0.tgz +0 -0
@@ -1,26 +1,28 @@
1
1
  #!/usr/bin/env bash
2
2
  # rt-hook: PreToolUse Edit|Write|MultiEdit|Bash|mcp__webstorm__create_new_file|mcp__webstorm__execute_terminal_command|mcp__webstorm__execute_tool
3
- # Требует: hooks/profile-check.sh, hooks/deny-tail.sh, hooks/write-targets.sh, hooks/guard-note.sh
4
- # Гард места правки: слой правил чинится там, где сломано, а не там, где виден.
3
+ # Requires: hooks/profile-check.sh, hooks/deny-tail.sh, hooks/write-targets.sh, hooks/guard-note.sh
4
+ # Guard of the place of the edit: the rules layer is fixed where it is broken, not where it is seen.
5
5
  #
6
- # Слой правил правит тот же исполнитель, которым слой правил управляет, и разницы между
7
- # «исполняю правило» и «правлю правило» в дереве не видно ничем: разложенная копия лежит рядом
8
- # с обычными файлами и правится так же. Правка доходит до диска и не доходит до места, где
9
- # промах чинится: в дереве она видна, в пакете её нет, а через месяц раскладка отказывает по
10
- # правленому файлу целиком — и цену платит тот, кто в этот день правил соседний ресурс.
6
+ # The rules layer is edited by the same executor the rules layer governs, and nothing in the tree
7
+ # shows the difference between "I follow a rule" and "I edit a rule": the laid-out copy lies next to
8
+ # ordinary files and is edited the same way. The edit reaches the disk and does not reach the place
9
+ # where the miss is fixed: in the tree it is visible, in the package it is absent, and a month later
10
+ # the layout refuses over the edited file as a whole — and the price is paid by whoever edits a
11
+ # neighbouring resource that day.
11
12
  #
12
- # Знал об этом только `sync --check`, и говорил он на следующей раскладке, то есть в чужой
13
- # ветке и чужим ходом. Гард говорит в минуту правки и называет адрес: источник пакета, если
14
- # дерево его держит, иначе — надстройку.
13
+ # Only `sync --check` knew about this, and it spoke at the next layout, that is, in someone else's
14
+ # branch and on someone else's turn. The guard speaks at the minute of the edit and names the
15
+ # address: the package source, if the tree holds it, otherwise the override.
15
16
  #
16
- # ЧТО СУДИТСЯ. Файл, который правят, несёт шапку раскладки: `rt-kit v<версия> · <ресурс> ·
17
- # <дайджест>`. Ресурс из неё и есть адрес: `<источники>/<ресурс>` в дереве пакета,
18
- # `.claude/rt-kit/overrides/<ресурс>` у потребителя.
17
+ # WHAT IS JUDGED. The file being edited carries the layout header: `rt-kit v<version> · <resource> ·
18
+ # <digest>`. The resource from it is the address: `<sources>/<resource>` in the package tree,
19
+ # `.claude/rt-kit/overrides/<resource>` at a consumer.
19
20
  #
20
- # ОТКАЗ В ПОЛЬЗУ РАБОТЫ: нет `jq`, битый ввод, чужой инструмент, файла нет, шапки в нём нет,
21
- # не git-репозиторий — правка РАЗРЕШАЕТСЯ. Сломанный гард не имеет права заклинить работу.
21
+ # FAIL-OPEN: no `jq`, broken input, a foreign tool, no file, no header in it, not a git repository —
22
+ # the edit is ALLOWED. A broken guard has no right to jam work.
22
23
 
23
- # Своё имя в наблюдениях: отбой пишет общий хвост отказа, а не сам гард.
24
+ # Its own name in the observations: the refusal is written by the shared deny tail, not by the
25
+ # guard itself.
24
26
  RT_GUARD_NAME=rule-source-guard
25
27
 
26
28
  . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utf8.sh" 2>/dev/null || true
@@ -49,13 +51,13 @@ deny() {
49
51
 
50
52
  reason="$1 $(rt_deny_tail "$2")"
51
53
  jq -n --arg r "$reason" '{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:$r}}' 2>/dev/null \
52
- || printf '{"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"deny","permissionDecisionReason":"Гард места правки."}}\n'
54
+ || printf '{"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"deny","permissionDecisionReason":"The guard of the place of the edit."}}\n'
53
55
  exit 0
54
56
  }
55
57
 
56
- # Цели записи разбирает общий помощник: тот же признак нужен гарду экзамена, и разойдясь, две
57
- # копии пропустили бы разные формы записи. Файла нет — остаётся молчаливое умолчание, чтобы гард
58
- # не сломался на неполной раскладке.
58
+ # The write targets are parsed by a shared helper: the exam guard needs the same sign, and once they
59
+ # diverged, two copies would let through different forms of writing. No file — a silent default
60
+ # remains, so that the guard does not break on an incomplete layout.
59
61
  # shellcheck disable=SC1090
60
62
  [ -f "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/write-targets.sh" ] \
61
63
  && . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/write-targets.sh" 2>/dev/null
@@ -70,14 +72,15 @@ case "$tool" in
70
72
  Bash | mcp__webstorm__execute_terminal_command | mcp__webstorm__execute_tool)
71
73
  cmd="$(rt_hook_cmd)"
72
74
  [ -z "$cmd" ] && exit 0
73
- # Здесь берётся не общий признак записи, а цель, названная в команде прямо:
74
- # перенаправление, `tee`, правка на месте, копирование поверх. Общий признак широк
75
- # намеренно — в нём и имя интерпретатора, — и запуск разложенной проверки читался бы
76
- # как правка её самой. Отбитие на чтении стоит дороже пропуска: гард, мешающий читать,
77
- # выключают в первый же день.
75
+ # What is taken here is not the general sign of writing, but the target named in the
76
+ # command outright: a redirection, `tee`, an in-place edit, a copy over the top. The
77
+ # general sign is broad on purpose — it holds the interpreter name too — and a run of a
78
+ # laid-out check would read as an edit of the check itself. A refusal on reading costs
79
+ # more than a miss: a guard that gets in the way of reading is switched off on the very
80
+ # first day.
78
81
  #
79
- # Снятие копии сюда не входит намеренно: снятый файл раскладка кладёт заново, и так
80
- # чинят копию, которую переписал форматтер.
82
+ # Removing a copy is deliberately not included here: the layout puts a removed file back,
83
+ # and that is how a copy the formatter rewrote gets fixed.
81
84
  candidates="$(printf '%s' "$cmd" | rt_write_targets)"
82
85
  ;;
83
86
  *) exit 0 ;;
@@ -86,8 +89,8 @@ esac
86
89
 
87
90
  root="${CLAUDE_PROJECT_DIR:-.}"
88
91
 
89
- # Каталог источников пакета в этом дереве. Есть он только у дерева, которое пакет и везёт; у
90
- # потребителя источника нет вовсе, и адрес правки у него один — надстройка.
92
+ # The directory of package sources in this tree. Only the tree that carries the package has one; a
93
+ # consumer has no source at all, and has a single address for an edit — the override.
91
94
  sources=""
92
95
  if rt_needs rt_kit_sources_dir rule-source-guard; then
93
96
  sources="$(rt_kit_sources_dir 2>/dev/null)"
@@ -101,30 +104,32 @@ while IFS= read -r candidate; do
101
104
  esac
102
105
  [ -f "$candidate" ] || continue
103
106
 
104
- # Шапка стоит в начале файла, но не первой строкой: у сценария её отодвигает `#!`, у
105
- # правила — заголовок с именем и родом ресурса. Десяти строк хватает обоим, а читать файл
106
- # целиком нельзя: гард стоит на каждой правке.
107
+ # The header stands at the beginning of the file, but not on the first line: in a script `#!`
108
+ # pushes it down, in a rule the title with the name and the kind of the resource does. Ten
109
+ # lines are enough for both, and the whole file must not be read: the guard stands on every
110
+ # edit.
107
111
  resource="$(head -12 "$candidate" 2>/dev/null | sed -nE 's/.*rt-kit v[^ ]+ · ([^ ]+) · [0-9a-f]+.*/\1/p' | head -1)"
108
112
  [ -z "$resource" ] && continue
109
113
 
110
- # Файл в конфликте пропускается наравне со снятым. Разрешение конфликта содержания копии не
111
- # меняет — раскладка кладёт её заново, — а отбитый здесь исполнитель остаётся с наполовину
112
- # слитой веткой и без законного хода: источник править нечего, надстройка конфликта не
113
- # снимает. Признаков два, и хватает любого: запись индекса о неслитом файле и маркеры
114
- # слияния в самом файле — второй нужен там, где слияние ведёт не git, а сторонний
115
- # инструмент, оставляющий маркеры без записи в индексе.
114
+ # A file in conflict is skipped on a par with a removed one. Resolving a conflict does not
115
+ # change the content of the copy — the layout puts it back — while an executor refused here is
116
+ # left with a half-merged branch and no lawful move: there is nothing to edit in the source,
117
+ # and an override does not lift the conflict. There are two signs, and either is enough: an
118
+ # index record about an unmerged file, and merge markers in the file itself — the second is
119
+ # needed where the merge is led not by git but by an outside tool that leaves markers without
120
+ # an index record.
116
121
  if [ -n "$(git -C "$root" ls-files -u -- "$candidate" 2>/dev/null)" ] \
117
122
  || grep -qE '^(<<<<<<< |>>>>>>> )' "$candidate" 2>/dev/null; then
118
123
  continue
119
124
  fi
120
125
 
121
126
  if [ -n "$sources" ] && [ -f "$root/$sources/$resource" ]; then
122
- deny "BLOCKED by rule-source-guard: «${candidate#"$root"/}» разложен пакетом, и правка на его месте теряется на следующей раскладке — а до тех пор раскладка отказывает по этому файлу целиком, и цену платит тот, кто в этот день правит соседний ресурс. Ресурс — «${resource}». Правь источник: ${sources}/${resource} — потом собери пакет и разложи." \
123
- "правка, верная только этому дереву, идёт в надстройку .claude/rt-kit/overrides/${resource} — она сливается по разделу «## » и раскладку переживает"
127
+ deny "BLOCKED by rule-source-guard: «${candidate#"$root"/}» is laid out by the package, and an edit in its place is lost on the next layout — and until then the layout refuses this file whole, and the price is paid by whoever edits a neighbouring resource that day. The resource is «${resource}». Edit the source: ${sources}/${resource} — then build the package and lay it out." \
128
+ "an edit true only to this tree goes to the override .claude/rt-kit/overrides/${resource} — it merges by the section «## » and outlives the layout"
124
129
  fi
125
130
 
126
- deny "BLOCKED by rule-source-guard: «${candidate#"$root"/}» разложен пакетом @rt-tools/agent-kit, и правка на его месте теряется на следующей раскладке. Ресурс — «${resource}». Правь надстройку: .claude/rt-kit/overrides/${resource} — она сливается по разделу «## » и раскладку переживает." \
127
- "то, что верно любому дереву, правится в самом пакете и приезжает сюда новой редакцией"
131
+ deny "BLOCKED by rule-source-guard: «${candidate#"$root"/}» is laid out by the package @rt-tools/agent-kit, and an edit in its place is lost on the next layout. The resource is «${resource}». Edit the override: .claude/rt-kit/overrides/${resource} — it merges by the section «## » and outlives the layout." \
132
+ "what is true of any tree is edited in the package itself and arrives here by a new edition"
128
133
  done <<EOF
129
134
  $candidates
130
135
  EOF
@@ -1,30 +1,30 @@
1
1
  #!/usr/bin/env bash
2
- # Слои гейта правил: требования, которые приходят ПОВЕРХ доменного.
2
+ # Layers of the rules gate: requirements that come ON TOP of the domain one.
3
3
  #
4
- # Доменное правило выбирается один раз по пути файла — у правки один предмет, и правило под него
5
- # одно. Слоёв поверх него полтора десятка: доступ к среде исполнения виден только в тексте
6
- # правки, наблюдаемость приходит вместе с доменом, а не вместо него, проза и ведение работы
7
- # судят тот же файл вторым признаком. Вместе они не помещаются в карту гейта, которую читают
8
- # целиком, — поэтому лежат здесь.
4
+ # The domain rule is chosen once by the file path — an edit has one subject, and there is one
5
+ # rule for it. There are a dozen and a half layers on top of it: access to the runtime is visible
6
+ # only in the text of the edit, observability comes together with the domain rather than instead
7
+ # of it, prose and work conduct judge the same file by a second sign. Together they do not fit
8
+ # into the gate map, which is read whole — so they live here.
9
9
  #
10
- # Подключается из `skill-gate.sh` в его же оболочке: читает `$input`, `$target` и `$req` и
11
- # дописывает имена правил в `$req`. Отдельным процессом слои возвращали бы то же самое через
12
- # диск.
10
+ # Sourced from `skill-gate.sh` in its own shell: it reads `$input`, `$target` and `$req` and
11
+ # appends rule names to `$req`. As a separate process the layers would return the same thing
12
+ # through the disk.
13
13
  #
14
- # ОТКАЗ В ПОЛЬЗУ РАБОТЫ: нечем разобрать вход — слой молчит. Разбор входа здесь побочная
15
- # работа, и её поломка не имеет права остановить правку.
14
+ # FAIL-OPEN: nothing to parse the input with — the layer is silent. Parsing the input is side
15
+ # work here, and its breakage has no right to stop the edit.
16
16
  #
17
- # Адреса дерева слои не знают: где у него бэкенд, витрина и сквозные тесты, говорит само дерево
18
- # — функцией `skill_layer_skip <правило> <цель>` в своей карте гейта. Нет её — слой действует
19
- # везде, где подошёл его признак.
17
+ # The layers do not know the tree's addresses: where its backend, showcase and end-to-end tests
18
+ # are is said by the tree itself — by the function `skill_layer_skip <rule> <target>` in its gate
19
+ # map. Without it a layer acts everywhere its sign matched.
20
20
 
21
- # Уже названное вторым разом не требуется: отказ, перечисляющий одно правило дважды, читается
22
- # как два разных требования.
21
+ # What is already named is not required a second time: a refusal listing one rule twice reads as
22
+ # two different requirements.
23
23
  . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utf8.sh" 2>/dev/null || true
24
24
 
25
- # Собранное дерево кодом не бывает: путь к артефакту приходит из команды, которая его запускает.
26
- # Карта гейта такой путь уже пропускает, и слои обязаны молчать вместе с ней — иначе выход из
27
- # карты снимает одно требование и оставляет полтора десятка других.
25
+ # A built tree is never code: the path to an artifact arrives from the command that runs it. The
26
+ # gate map already lets such a path through, and the layers must stay silent along with it —
27
+ # otherwise leaving the map lifts one requirement and leaves a dozen and a half others.
28
28
  case "$target" in
29
29
  */node_modules/* | */dist/* | */build/* | */.nx/* | */coverage/*) return 0 ;;
30
30
  esac
@@ -36,15 +36,16 @@ rt_layer_add() {
36
36
  req="${req:+$req }$1"
37
37
  }
38
38
 
39
- # Дерево вправе снять слой с места, где признак законен: прямое обращение к среде исполнения на
40
- # бэкенде, чтение окружения в обвязке, заведение файла в сквозных тестах.
39
+ # The tree may lift a layer from a place where the sign is lawful: a direct call to the runtime
40
+ # on the backend, reading the environment in the harness, creating a file in end-to-end tests.
41
41
  rt_layer_allowed() {
42
42
  command -v skill_layer_skip >/dev/null 2>&1 || return 0
43
43
  skill_layer_skip "$1" "$2" && return 1
44
44
  return 0
45
45
  }
46
46
 
47
- # Текст правки читается один раз на все слои: разбор входа стоит дороже самих признаков.
47
+ # The edit text is read once for all layers: parsing the input costs more than the signs
48
+ # themselves.
48
49
  rt_layer_payload=""
49
50
  if command -v jq >/dev/null 2>&1; then
50
51
  rt_layer_payload="$(printf '%s' "$input" \
@@ -52,15 +53,16 @@ if command -v jq >/dev/null 2>&1; then
52
53
  | map(select(. != null)) | join("\n")' 2>/dev/null)"
53
54
  fi
54
55
 
55
- # Спека проверяет поведение, а не заводит его: там нужен `testing`, и слои поведения её обходят.
56
+ # A spec checks behaviour rather than creating it: `testing` is needed there, and the behaviour
57
+ # layers skip it.
56
58
  rt_layer_is_spec=1
57
59
  case "$target" in *.spec.ts) rt_layer_is_spec=0 ;; esac
58
60
 
59
- # --- слой по тексту: обращение к среде исполнения ---------------------------------------------
61
+ # --- layer by text: a call to the runtime -----------------------------------------------------
60
62
  #
61
- # Путь говорит, ЧТО за файл, а обращение к глобальному объекту видно только в содержимом: гейт,
62
- # знающий один путь, пропускает его молча. Значение, полученное внедрением, признаком не
63
- # считается — это уже зависимость, а не прямое обращение.
63
+ # The path says WHAT file it is, while a call to the global object is visible only in the
64
+ # content: a gate that knows the path alone lets it through silently. A value obtained by
65
+ # injection does not count as a sign — that is already a dependency, not a direct call.
64
66
  if [ -n "$rt_layer_payload" ] && [ "$rt_layer_is_spec" = 1 ]; then
65
67
  case "$target" in
66
68
  */main.ts|*/main.server.ts|*/server.ts|*/index.html) ;;
@@ -73,11 +75,11 @@ if [ -n "$rt_layer_payload" ] && [ "$rt_layer_is_spec" = 1 ]; then
73
75
  esac
74
76
  fi
75
77
 
76
- # --- слой по тексту: наблюдаемость ------------------------------------------------------------
78
+ # --- layer by text: observability -------------------------------------------------------------
77
79
  #
78
- # Чтение переменной окружения и есть тот момент, когда заводится новая необязательная
79
- # возможность. Сводка старта перечисляет их руками, и забывшая дописать себя не попадёт ни в
80
- # один из трёх списков — на проде она выглядит не выключенной, а несуществующей.
80
+ # Reading an environment variable is exactly the moment a new optional capability is created.
81
+ # The startup digest lists them by hand, and one that forgot to add itself will not land in any
82
+ # of the three lists — on production it looks not switched off but non-existent.
81
83
  if [ -n "$rt_layer_payload" ] && [ "$rt_layer_is_spec" = 1 ]; then
82
84
  case "$target" in
83
85
  *.ts)
@@ -88,11 +90,11 @@ if [ -n "$rt_layer_payload" ] && [ "$rt_layer_is_spec" = 1 ]; then
88
90
  esac
89
91
  fi
90
92
 
91
- # --- слой по тексту: общий код ----------------------------------------------------------------
93
+ # --- layer by text: shared code ---------------------------------------------------------------
92
94
  #
93
- # Заводимое число-настройка и заводимое перечисление — тот момент, когда рядом с уже общим
94
- # появляется копия. Каждая копия сама по себе исправна, и ни линт, ни сборка второй не видят.
95
- # Спеки не в счёт: там значения местные, это фикстуры.
95
+ # A newly created numeric setting and a newly created enumeration are the moment a copy appears
96
+ # next to what is already shared. Each copy is sound on its own, and neither the linter nor the
97
+ # build sees the second one. Specs do not count: values there are local, they are fixtures.
96
98
  if [ -n "$rt_layer_payload" ] && [ "$rt_layer_is_spec" = 1 ]; then
97
99
  case "$target" in
98
100
  *.ts)
@@ -104,11 +106,11 @@ if [ -n "$rt_layer_payload" ] && [ "$rt_layer_is_spec" = 1 ]; then
104
106
  esac
105
107
  fi
106
108
 
107
- # --- слой по пути: классы Angular -------------------------------------------------------------
109
+ # --- layer by path: Angular classes -----------------------------------------------------------
108
110
  #
109
- # Компонент и стор — тоже классы: сигнальный API входов, обнаружение изменений и место подписки
110
- # живут в `angular-patterns`, а первым слоем эти файлы уходят в устройство компонента и в
111
- # соглашения языка, где ничего этого нет.
111
+ # A component and a store are classes too: the signal input API, change detection and where a
112
+ # subscription lives are in `angular-patterns`, while as the first layer these files go to the
113
+ # component structure and to the language conventions, where none of that is.
112
114
  if [ "$rt_layer_is_spec" = 1 ]; then
113
115
  case "$target" in
114
116
  *.component.ts|*.store.ts)
@@ -117,36 +119,36 @@ if [ "$rt_layer_is_spec" = 1 ]; then
117
119
  esac
118
120
  fi
119
121
 
120
- # --- слой по пути: проза ----------------------------------------------------------------------
122
+ # --- layer by path: prose ---------------------------------------------------------------------
121
123
  #
122
- # Формат спека держит `spec-driven`, а как формулировать — `doc-style`, и нужен он не только
123
- # спекам. Список известного у проверки — та же проза: его поле объясняет, что перечисленное
124
- # отказом не считается, а сверка текстов читает только `.md`.
124
+ # The spec format is held by `spec-driven`, and how to word things by `doc-style`, and it is
125
+ # needed not only by specs. A check's known list is the same prose: its field explains why what
126
+ # is listed does not count as a refusal, and the text audit reads only `.md`.
125
127
  #
126
- # Хозяйство самого агента слой обходит: правило на него — оно само, и карта гейта решает про
127
- # эти файлы целиком. Слой, наложенный поверх, требовал бы правило там, где карта его нарочно
128
- # не назвала.
128
+ # The agent's own housekeeping the layer skips: the rule for it is itself, and the gate map
129
+ # decides about these files whole. A layer laid on top would demand a rule where the map left it
130
+ # unnamed on purpose.
129
131
  case "$target" in
130
132
  */.claude/*) ;;
131
133
  *.md|*-allowlist.json) rt_layer_allowed doc-style "$target" && rt_layer_add doc-style ;;
132
134
  esac
133
135
 
134
- # --- слой по пути: ведение работы -------------------------------------------------------------
136
+ # --- layer by path: work conduct --------------------------------------------------------------
135
137
  #
136
- # Папка задачи, договорённость о продукте до кода и замысел эпика — первые файлы, которые
137
- # заводятся в работе. Требование ловит на них того, кто пошёл мимо порядка: «пришла новая
138
- # задача» инструментом не является, и поймать это больше нечем.
138
+ # The task folder, the product agreement before the code and the epic plan are the first files
139
+ # created in work. The requirement catches on them whoever went past the order: "a new task has
140
+ # arrived" is not a tool, and there is nothing else to catch it with.
139
141
  case "$target" in
140
142
  */docs/tasks/*|*/docs/specs/*/proposed/*|*/docs/plans/*)
141
143
  rt_layer_allowed task-flow "$target" && rt_layer_add task-flow
142
144
  ;;
143
145
  esac
144
146
 
145
- # --- слой по заведению файла ------------------------------------------------------------------
147
+ # --- layer by file creation -------------------------------------------------------------------
146
148
  #
147
- # Ничего не пишется с нуля, и спрашивается это там, где решение и принимается, — на заведении
148
- # нового файла: у правки существующего опора уже выбрана, а требовать правило на каждую строку
149
- # значит сделать его фоном.
149
+ # Nothing is written from scratch, and this is asked where the decision is made — at the
150
+ # creation of a new file: an edit of an existing one has its foundation already chosen, and
151
+ # demanding the rule on every line would turn it into background.
150
152
  case "$target" in
151
153
  */docs/*) ;;
152
154
  *.spec.ts|*.stories.ts) ;;
@@ -155,9 +157,9 @@ case "$target" in
155
157
  ;;
156
158
  esac
157
159
 
158
- # Куда встаёт заведённая проверка и какой формы у неё список известного — утверждения `testing`,
159
- # и нужны они ровно в момент заведения: у существующей проверки и место в гейте, и форма списка
160
- # уже выбраны.
160
+ # Where a newly created check goes and what shape its known list has are statements of
161
+ # `testing`, and they are needed exactly at the moment of creation: an existing check has both
162
+ # its place in the gate and the shape of its list already chosen.
161
163
  case "$target" in
162
164
  */check-*.mjs|*-allowlist.json)
163
165
  [ -f "$target" ] || { rt_layer_allowed testing "$target" && rt_layer_add testing; }
@@ -1,16 +1,15 @@
1
1
  #!/usr/bin/env bash
2
2
  # rt-hook: SessionStart compact|clear
3
- # Взвод гейта заново. SessionStart(compact|clear).
3
+ # Re-arming the gate. SessionStart(compact|clear).
4
4
  #
5
- # Гейт помнит загруженное правило по идентификатору сессии и дальше пропускает эту область
6
- # молча. Сжатие контекста и очистка выносят из контекста САМ ТЕКСТ правила, но идентификатор
7
- # сессии оставляют прежним — без этого хука гейт продолжал бы пропускать, пока агент работает
8
- # по пересказу вместо самого правила.
5
+ # The gate remembers a loaded rule by the session id and from then on lets that area through
6
+ # silently. Context compaction and clearing take the TEXT of the rule itself out of the context but
7
+ # leave the session id as it was — without this hook the gate would keep letting through while the
8
+ # agent works from a retelling instead of the rule itself.
9
9
  #
10
- # Снятие записи заставляет каждую область загрузить своё правило заново.
10
+ # Removing the record makes every area load its rule again.
11
11
  #
12
- # ОТКАЗ В ПОЛЬЗУ РАБОТЫ: любая ошибка пропускает. Хук удаляет временный файл и ничего не
13
- # отбивает.
12
+ # FAIL-OPEN: any error passes. The hook removes a temporary file and refuses nothing.
14
13
 
15
14
  . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utf8.sh" 2>/dev/null || true
16
15
  . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/hook-input.sh" 2>/dev/null || true
@@ -24,4 +23,12 @@ sid="$(printf '%s' "$input" | jq -r '.session_id // empty' 2>/dev/null)"
24
23
 
25
24
  rm -f "${TMPDIR:-/tmp}/claude-skill-gate/${sid}.loaded" 2>/dev/null
26
25
 
26
+ # The re-arming is told to the session in words.
27
+ #
28
+ # A silent re-arming reads as breakage: the compaction summary says the rules were already loaded,
29
+ # the gate answers that they were not — and the session spends a turn finding out which of the two
30
+ # is right. A turn was spent that way four times in one session. The line removes the contradiction:
31
+ # the rule text is no longer in the context, which is why it is asked for again.
32
+ jq -n '{hookSpecificOutput:{hookEventName:"SessionStart",additionalContext:"The rules gate is armed anew: the compaction carried the text of the rules themselves out of the session, and every area will ask for its rule once more. The former loading does not count — load the rule and work on."}}' 2>/dev/null
33
+
27
34
  exit 0