@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,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,34 @@
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
+ # NOT a guard: it has no `rt-hook:` declaration and hooks into no agent event. The rules gate
5
+ # sources it: the layers over the domain rule are a dozen and a half, and together they do not fit
6
+ # into a map read whole.
9
7
  #
10
- # Подключается из `skill-gate.sh` в его же оболочке: читает `$input`, `$target` и `$req` и
11
- # дописывает имена правил в `$req`. Отдельным процессом слои возвращали бы то же самое через
12
- # диск.
8
+ # The domain rule is chosen once by the file path — an edit has one subject, and there is one
9
+ # rule for it. There are a dozen and a half layers on top of it: access to the runtime is visible
10
+ # only in the text of the edit, observability comes together with the domain rather than instead
11
+ # of it, prose and work conduct judge the same file by a second sign. Together they do not fit
12
+ # into the gate map, which is read whole — so they live here.
13
13
  #
14
- # ОТКАЗ В ПОЛЬЗУ РАБОТЫ: нечем разобрать вход — слой молчит. Разбор входа здесь побочная
15
- # работа, и её поломка не имеет права остановить правку.
14
+ # Sourced from `skill-gate.sh` in its own shell: it reads `$input`, `$target` and `$req` and
15
+ # appends rule names to `$req`. As a separate process the layers would return the same thing
16
+ # through the disk.
16
17
  #
17
- # Адреса дерева слои не знают: где у него бэкенд, витрина и сквозные тесты, говорит само дерево
18
- # — функцией `skill_layer_skip <правило> <цель>` в своей карте гейта. Нет её — слой действует
19
- # везде, где подошёл его признак.
18
+ # FAIL-OPEN: nothing to parse the input with — the layer is silent. Parsing the input is side
19
+ # work here, and its breakage has no right to stop the edit.
20
+ #
21
+ # The layers do not know the tree's addresses: where its backend, showcase and end-to-end tests
22
+ # are is said by the tree itself — by the function `skill_layer_skip <rule> <target>` in its gate
23
+ # map. Without it a layer acts everywhere its sign matched.
20
24
 
21
- # Уже названное вторым разом не требуется: отказ, перечисляющий одно правило дважды, читается
22
- # как два разных требования.
25
+ # What is already named is not required a second time: a refusal listing one rule twice reads as
26
+ # two different requirements.
23
27
  . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utf8.sh" 2>/dev/null || true
24
28
 
25
- # Собранное дерево кодом не бывает: путь к артефакту приходит из команды, которая его запускает.
26
- # Карта гейта такой путь уже пропускает, и слои обязаны молчать вместе с ней — иначе выход из
27
- # карты снимает одно требование и оставляет полтора десятка других.
29
+ # A built tree is never code: the path to an artifact arrives from the command that runs it. The
30
+ # gate map already lets such a path through, and the layers must stay silent along with it —
31
+ # otherwise leaving the map lifts one requirement and leaves a dozen and a half others.
28
32
  case "$target" in
29
33
  */node_modules/* | */dist/* | */build/* | */.nx/* | */coverage/*) return 0 ;;
30
34
  esac
@@ -36,15 +40,16 @@ rt_layer_add() {
36
40
  req="${req:+$req }$1"
37
41
  }
38
42
 
39
- # Дерево вправе снять слой с места, где признак законен: прямое обращение к среде исполнения на
40
- # бэкенде, чтение окружения в обвязке, заведение файла в сквозных тестах.
43
+ # The tree may lift a layer from a place where the sign is lawful: a direct call to the runtime
44
+ # on the backend, reading the environment in the harness, creating a file in end-to-end tests.
41
45
  rt_layer_allowed() {
42
46
  command -v skill_layer_skip >/dev/null 2>&1 || return 0
43
47
  skill_layer_skip "$1" "$2" && return 1
44
48
  return 0
45
49
  }
46
50
 
47
- # Текст правки читается один раз на все слои: разбор входа стоит дороже самих признаков.
51
+ # The edit text is read once for all layers: parsing the input costs more than the signs
52
+ # themselves.
48
53
  rt_layer_payload=""
49
54
  if command -v jq >/dev/null 2>&1; then
50
55
  rt_layer_payload="$(printf '%s' "$input" \
@@ -52,15 +57,16 @@ if command -v jq >/dev/null 2>&1; then
52
57
  | map(select(. != null)) | join("\n")' 2>/dev/null)"
53
58
  fi
54
59
 
55
- # Спека проверяет поведение, а не заводит его: там нужен `testing`, и слои поведения её обходят.
60
+ # A spec checks behaviour rather than creating it: `testing` is needed there, and the behaviour
61
+ # layers skip it.
56
62
  rt_layer_is_spec=1
57
63
  case "$target" in *.spec.ts) rt_layer_is_spec=0 ;; esac
58
64
 
59
- # --- слой по тексту: обращение к среде исполнения ---------------------------------------------
65
+ # --- layer by text: a call to the runtime -----------------------------------------------------
60
66
  #
61
- # Путь говорит, ЧТО за файл, а обращение к глобальному объекту видно только в содержимом: гейт,
62
- # знающий один путь, пропускает его молча. Значение, полученное внедрением, признаком не
63
- # считается — это уже зависимость, а не прямое обращение.
67
+ # The path says WHAT file it is, while a call to the global object is visible only in the
68
+ # content: a gate that knows the path alone lets it through silently. A value obtained by
69
+ # injection does not count as a sign — that is already a dependency, not a direct call.
64
70
  if [ -n "$rt_layer_payload" ] && [ "$rt_layer_is_spec" = 1 ]; then
65
71
  case "$target" in
66
72
  */main.ts|*/main.server.ts|*/server.ts|*/index.html) ;;
@@ -73,11 +79,11 @@ if [ -n "$rt_layer_payload" ] && [ "$rt_layer_is_spec" = 1 ]; then
73
79
  esac
74
80
  fi
75
81
 
76
- # --- слой по тексту: наблюдаемость ------------------------------------------------------------
82
+ # --- layer by text: observability -------------------------------------------------------------
77
83
  #
78
- # Чтение переменной окружения и есть тот момент, когда заводится новая необязательная
79
- # возможность. Сводка старта перечисляет их руками, и забывшая дописать себя не попадёт ни в
80
- # один из трёх списков — на проде она выглядит не выключенной, а несуществующей.
84
+ # Reading an environment variable is exactly the moment a new optional capability is created.
85
+ # The startup digest lists them by hand, and one that forgot to add itself will not land in any
86
+ # of the three lists — on production it looks not switched off but non-existent.
81
87
  if [ -n "$rt_layer_payload" ] && [ "$rt_layer_is_spec" = 1 ]; then
82
88
  case "$target" in
83
89
  *.ts)
@@ -88,11 +94,11 @@ if [ -n "$rt_layer_payload" ] && [ "$rt_layer_is_spec" = 1 ]; then
88
94
  esac
89
95
  fi
90
96
 
91
- # --- слой по тексту: общий код ----------------------------------------------------------------
97
+ # --- layer by text: shared code ---------------------------------------------------------------
92
98
  #
93
- # Заводимое число-настройка и заводимое перечисление — тот момент, когда рядом с уже общим
94
- # появляется копия. Каждая копия сама по себе исправна, и ни линт, ни сборка второй не видят.
95
- # Спеки не в счёт: там значения местные, это фикстуры.
99
+ # A newly created numeric setting and a newly created enumeration are the moment a copy appears
100
+ # next to what is already shared. Each copy is sound on its own, and neither the linter nor the
101
+ # build sees the second one. Specs do not count: values there are local, they are fixtures.
96
102
  if [ -n "$rt_layer_payload" ] && [ "$rt_layer_is_spec" = 1 ]; then
97
103
  case "$target" in
98
104
  *.ts)
@@ -104,11 +110,11 @@ if [ -n "$rt_layer_payload" ] && [ "$rt_layer_is_spec" = 1 ]; then
104
110
  esac
105
111
  fi
106
112
 
107
- # --- слой по пути: классы Angular -------------------------------------------------------------
113
+ # --- layer by path: Angular classes -----------------------------------------------------------
108
114
  #
109
- # Компонент и стор — тоже классы: сигнальный API входов, обнаружение изменений и место подписки
110
- # живут в `angular-patterns`, а первым слоем эти файлы уходят в устройство компонента и в
111
- # соглашения языка, где ничего этого нет.
115
+ # A component and a store are classes too: the signal input API, change detection and where a
116
+ # subscription lives are in `angular-patterns`, while as the first layer these files go to the
117
+ # component structure and to the language conventions, where none of that is.
112
118
  if [ "$rt_layer_is_spec" = 1 ]; then
113
119
  case "$target" in
114
120
  *.component.ts|*.store.ts)
@@ -117,36 +123,36 @@ if [ "$rt_layer_is_spec" = 1 ]; then
117
123
  esac
118
124
  fi
119
125
 
120
- # --- слой по пути: проза ----------------------------------------------------------------------
126
+ # --- layer by path: prose ---------------------------------------------------------------------
121
127
  #
122
- # Формат спека держит `spec-driven`, а как формулировать — `doc-style`, и нужен он не только
123
- # спекам. Список известного у проверки — та же проза: его поле объясняет, что перечисленное
124
- # отказом не считается, а сверка текстов читает только `.md`.
128
+ # The spec format is held by `spec-driven`, and how to word things by `doc-style`, and it is
129
+ # needed not only by specs. A check's known list is the same prose: its field explains why what
130
+ # is listed does not count as a refusal, and the text audit reads only `.md`.
125
131
  #
126
- # Хозяйство самого агента слой обходит: правило на него — оно само, и карта гейта решает про
127
- # эти файлы целиком. Слой, наложенный поверх, требовал бы правило там, где карта его нарочно
128
- # не назвала.
132
+ # The agent's own housekeeping the layer skips: the rule for it is itself, and the gate map
133
+ # decides about these files whole. A layer laid on top would demand a rule where the map left it
134
+ # unnamed on purpose.
129
135
  case "$target" in
130
136
  */.claude/*) ;;
131
137
  *.md|*-allowlist.json) rt_layer_allowed doc-style "$target" && rt_layer_add doc-style ;;
132
138
  esac
133
139
 
134
- # --- слой по пути: ведение работы -------------------------------------------------------------
140
+ # --- layer by path: work conduct --------------------------------------------------------------
135
141
  #
136
- # Папка задачи, договорённость о продукте до кода и замысел эпика — первые файлы, которые
137
- # заводятся в работе. Требование ловит на них того, кто пошёл мимо порядка: «пришла новая
138
- # задача» инструментом не является, и поймать это больше нечем.
142
+ # The task folder, the product agreement before the code and the epic plan are the first files
143
+ # created in work. The requirement catches on them whoever went past the order: "a new task has
144
+ # arrived" is not a tool, and there is nothing else to catch it with.
139
145
  case "$target" in
140
146
  */docs/tasks/*|*/docs/specs/*/proposed/*|*/docs/plans/*)
141
147
  rt_layer_allowed task-flow "$target" && rt_layer_add task-flow
142
148
  ;;
143
149
  esac
144
150
 
145
- # --- слой по заведению файла ------------------------------------------------------------------
151
+ # --- layer by file creation -------------------------------------------------------------------
146
152
  #
147
- # Ничего не пишется с нуля, и спрашивается это там, где решение и принимается, — на заведении
148
- # нового файла: у правки существующего опора уже выбрана, а требовать правило на каждую строку
149
- # значит сделать его фоном.
153
+ # Nothing is written from scratch, and this is asked where the decision is made — at the
154
+ # creation of a new file: an edit of an existing one has its foundation already chosen, and
155
+ # demanding the rule on every line would turn it into background.
150
156
  case "$target" in
151
157
  */docs/*) ;;
152
158
  *.spec.ts|*.stories.ts) ;;
@@ -155,9 +161,9 @@ case "$target" in
155
161
  ;;
156
162
  esac
157
163
 
158
- # Куда встаёт заведённая проверка и какой формы у неё список известного — утверждения `testing`,
159
- # и нужны они ровно в момент заведения: у существующей проверки и место в гейте, и форма списка
160
- # уже выбраны.
164
+ # Where a newly created check goes and what shape its known list has are statements of
165
+ # `testing`, and they are needed exactly at the moment of creation: an existing check has both
166
+ # its place in the gate and the shape of its list already chosen.
161
167
  case "$target" in
162
168
  */check-*.mjs|*-allowlist.json)
163
169
  [ -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