@rt-tools/agent-kit 0.23.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 (288) hide show
  1. package/README.md +8 -2
  2. package/assets/agents/business-analyst.md +51 -50
  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-epics.github.mjs +75 -41
  15. package/assets/checks/board-folders.mjs +61 -0
  16. package/assets/checks/board-gh.github.mjs +35 -26
  17. package/assets/checks/board-long-work.github.mjs +24 -24
  18. package/assets/checks/board-paths.github.mjs +21 -16
  19. package/assets/checks/board-runs.github.mjs +45 -43
  20. package/assets/checks/board-titles.github.mjs +19 -17
  21. package/assets/checks/board.github.mjs +150 -128
  22. package/assets/checks/check-archive-age.mjs +23 -19
  23. package/assets/checks/check-board.github.mjs +179 -157
  24. package/assets/checks/check-descriptions.mjs +30 -29
  25. package/assets/checks/check-doc-paths.mjs +104 -82
  26. package/assets/checks/check-dupes.mjs +84 -80
  27. package/assets/checks/check-file-size.mjs +79 -70
  28. package/assets/checks/check-glossary.mjs +47 -37
  29. package/assets/checks/check-hook-scope.mjs +30 -27
  30. package/assets/checks/check-lib-layers.mjs +22 -21
  31. package/assets/checks/check-profile-drift.mjs +48 -43
  32. package/assets/checks/check-prose-style.mjs +125 -33
  33. package/assets/checks/check-push-gate.mjs +53 -50
  34. package/assets/checks/check-reuse.mjs +50 -40
  35. package/assets/checks/check-schema-drift.mjs +87 -83
  36. package/assets/checks/check-specs.mjs +155 -134
  37. package/assets/checks/check-state-next.mjs +66 -52
  38. package/assets/checks/check-states.mjs +32 -30
  39. package/assets/checks/check-styles.mjs +52 -51
  40. package/assets/checks/check-turn-map.mjs +54 -46
  41. package/assets/checks/lib-boundaries.mjs +32 -30
  42. package/assets/checks/lib-common.mjs +30 -29
  43. package/assets/checks/lib-domains.mjs +34 -34
  44. package/assets/checks/lib-manifests.mjs +17 -15
  45. package/assets/checks/lib-reexports.mjs +18 -18
  46. package/assets/checks/rt-kit-checks.config.mjs +174 -142
  47. package/assets/checks/signals.mjs +43 -39
  48. package/assets/checks/spec-anchors.mjs +114 -87
  49. package/assets/checks/spec-common.mjs +128 -84
  50. package/assets/checks/spec-contract.mjs +30 -30
  51. package/assets/checks/spec-proposed.mjs +27 -24
  52. package/assets/checks/spec-scenarios.mjs +51 -28
  53. package/assets/checks/task-new.github.mjs +85 -56
  54. package/assets/commands/feedback.md +65 -59
  55. package/assets/commands/next-session.md +64 -57
  56. package/assets/commands/skill-curator.md +83 -79
  57. package/assets/defaults/gate-map.sh +115 -91
  58. package/assets/defaults/project.sh +228 -178
  59. package/assets/defaults/shell.sh +85 -65
  60. package/assets/defaults/turn-map.md +45 -44
  61. package/assets/docs/GLOSSARY.md +142 -65
  62. package/assets/hooks/browser-device-id.sh +12 -12
  63. package/assets/hooks/browser-guard-device-id.sh +46 -14
  64. package/assets/hooks/browser-guard-no-asking.sh +5 -4
  65. package/assets/hooks/browser-guard-no-listing.sh +12 -11
  66. package/assets/hooks/browser-guard-no-other-drivers.sh +48 -42
  67. package/assets/hooks/browser-guard-require-select.sh +34 -23
  68. package/assets/hooks/claim-guard.sh +62 -56
  69. package/assets/hooks/commit-msg.sh +11 -10
  70. package/assets/hooks/conscience-guard.sh +91 -45
  71. package/assets/hooks/constitution-index.sh +16 -16
  72. package/assets/hooks/deny-tail.sh +28 -26
  73. package/assets/hooks/dev-server-guard.sh +46 -43
  74. package/assets/hooks/dispatch.sh +84 -39
  75. package/assets/hooks/docs-guard.sh +105 -86
  76. package/assets/hooks/exam-guard.sh +146 -84
  77. package/assets/hooks/git-guard-delivery-conflict.sh +38 -36
  78. package/assets/hooks/git-guard-delivery-draft.sh +85 -0
  79. package/assets/hooks/git-guard-delivery-folder.sh +50 -43
  80. package/assets/hooks/git-guard-delivery-signature.sh +88 -52
  81. package/assets/hooks/git-guard-delivery.sh +207 -253
  82. package/assets/hooks/git-guard-main.sh +65 -26
  83. package/assets/hooks/git-guard-push-tests.sh +133 -75
  84. package/assets/hooks/glossary-load.sh +23 -22
  85. package/assets/hooks/grill-gate-ask.sh +12 -11
  86. package/assets/hooks/grill-gate.sh +94 -87
  87. package/assets/hooks/guard-note.sh +20 -19
  88. package/assets/hooks/handoff-entry-guard.sh +26 -24
  89. package/assets/hooks/handoff-write.sh +74 -67
  90. package/assets/hooks/hook-input.sh +70 -50
  91. package/assets/hooks/lint-after-edit.sh +95 -61
  92. package/assets/hooks/observe.sh +28 -26
  93. package/assets/hooks/override-write-guard.sh +23 -21
  94. package/assets/hooks/postmortem-guard.sh +42 -39
  95. package/assets/hooks/profile-check.sh +22 -20
  96. package/assets/hooks/proposal-guard.sh +57 -49
  97. package/assets/hooks/prose-style-guard.sh +19 -17
  98. package/assets/hooks/qa-dataid-guard.sh +52 -49
  99. package/assets/hooks/rerun-guard.sh +31 -30
  100. package/assets/hooks/reuse-first-guard.sh +108 -87
  101. package/assets/hooks/roles.sh +14 -14
  102. package/assets/hooks/rule-article.sh +36 -34
  103. package/assets/hooks/rule-source-guard.sh +52 -36
  104. package/assets/hooks/skill-gate-layers.sh +59 -57
  105. package/assets/hooks/skill-gate-rearm.sh +15 -8
  106. package/assets/hooks/skill-gate.sh +89 -81
  107. package/assets/hooks/skill-loaded.sh +6 -6
  108. package/assets/hooks/sql-guard-parse.sh +68 -66
  109. package/assets/hooks/sql-guard-request.sh +48 -46
  110. package/assets/hooks/sql-guard-target.sh +57 -51
  111. package/assets/hooks/sql-guard-write.sh +84 -79
  112. package/assets/hooks/sql-guard.sh +52 -47
  113. package/assets/hooks/stand-login-guard.sh +104 -0
  114. package/assets/hooks/task-context-load.sh +60 -55
  115. package/assets/hooks/task-flow-context.sh +87 -69
  116. package/assets/hooks/task-flow-draft-guard.sh +55 -48
  117. package/assets/hooks/task-flow-guard.sh +67 -64
  118. package/assets/hooks/turn-entry-load.sh +39 -32
  119. package/assets/hooks/turn-exit-guard.sh +256 -204
  120. package/assets/hooks/turn-exit-patterns.sh +53 -0
  121. package/assets/hooks/utf8.sh +11 -11
  122. package/assets/hooks/waiting-turn-guard.sh +94 -94
  123. package/assets/hooks/window-fill-guard.sh +70 -62
  124. package/assets/hooks/work-start-guard.sh +52 -49
  125. package/assets/hooks/write-targets.sh +115 -30
  126. package/assets/laws/autonomous-work.md +29 -27
  127. package/assets/laws/code-structure.md +31 -30
  128. package/assets/laws/delivery.md +148 -137
  129. package/assets/laws/entity-editing.md +52 -50
  130. package/assets/laws/entity-models.md +14 -13
  131. package/assets/laws/frontend-application.md +39 -38
  132. package/assets/laws/lib-imports.md +27 -27
  133. package/assets/laws/lists.md +31 -29
  134. package/assets/laws/navigation.md +37 -37
  135. package/assets/laws/observability.md +41 -40
  136. package/assets/laws/project-documentation.md +106 -99
  137. package/assets/laws/reuse-first.md +31 -29
  138. package/assets/laws/shared-code.md +27 -27
  139. package/assets/laws/verifiability.md +131 -114
  140. package/assets/laws/work-conduct.md +250 -250
  141. package/assets/patterns/admin-lists-screen.md +72 -69
  142. package/assets/patterns/admin-nav-item.md +51 -46
  143. package/assets/patterns/angular-patterns-state.md +32 -31
  144. package/assets/patterns/api-layer-pair.md +33 -31
  145. package/assets/patterns/autonomous-work-run.md +50 -49
  146. package/assets/patterns/browser-verification-measure.md +143 -67
  147. package/assets/patterns/browser-verification-stand.md +181 -128
  148. package/assets/patterns/component-structure-new.md +51 -42
  149. package/assets/patterns/dependencies-upgrade.md +55 -39
  150. package/assets/patterns/doc-style-human.md +93 -0
  151. package/assets/patterns/doc-style-sweep.md +82 -79
  152. package/assets/patterns/doc-style-trace.md +87 -81
  153. package/assets/patterns/doc-style-write.md +130 -122
  154. package/assets/patterns/entity-aside.md +77 -63
  155. package/assets/patterns/entity-models-new.md +37 -37
  156. package/assets/patterns/entity-store.md +33 -33
  157. package/assets/patterns/git-workflow-commit.azure.md +94 -75
  158. package/assets/patterns/git-workflow-commit.github.md +153 -129
  159. package/assets/patterns/git-workflow-commit.gitlab.md +96 -78
  160. package/assets/patterns/git-workflow-docker.md +165 -147
  161. package/assets/patterns/git-workflow-freshness.md +45 -45
  162. package/assets/patterns/git-workflow-merge.md +99 -86
  163. package/assets/patterns/git-workflow-migration.md +54 -52
  164. package/assets/patterns/git-workflow-pr-ready.md +57 -56
  165. package/assets/patterns/git-workflow-pr.azure.md +126 -121
  166. package/assets/patterns/git-workflow-pr.github.md +179 -175
  167. package/assets/patterns/git-workflow-pr.gitlab.md +138 -131
  168. package/assets/patterns/git-workflow-restart.md +35 -31
  169. package/assets/patterns/git-workflow-secrets.md +80 -73
  170. package/assets/patterns/git-workflow-stack.md +131 -106
  171. package/assets/patterns/lib-layers-move.md +62 -53
  172. package/assets/patterns/lib-layers-new.md +59 -45
  173. package/assets/patterns/observability-record.md +72 -67
  174. package/assets/patterns/platform-access-di.md +31 -29
  175. package/assets/patterns/reuse-first-extend.md +66 -61
  176. package/assets/patterns/shared-code-new.md +39 -38
  177. package/assets/patterns/spec-driven-domain.md +161 -151
  178. package/assets/patterns/spec-driven-rule.md +179 -168
  179. package/assets/patterns/spec-driven-sweep.md +41 -39
  180. package/assets/patterns/status-report-table.github.md +37 -36
  181. package/assets/patterns/styling-bem-component.md +42 -42
  182. package/assets/patterns/styling-bem-layout.md +39 -34
  183. package/assets/patterns/styling-bem-sheet.md +59 -58
  184. package/assets/patterns/task-flow-archive.md +222 -215
  185. package/assets/patterns/task-flow-close.md +215 -203
  186. package/assets/patterns/task-flow-handoff.md +154 -145
  187. package/assets/patterns/task-flow-resume.md +138 -133
  188. package/assets/patterns/task-flow-start.md +204 -192
  189. package/assets/patterns/testing-e2e.md +103 -92
  190. package/assets/patterns/testing-unit.md +77 -70
  191. package/assets/patterns/ts-procedure.md +32 -29
  192. package/assets/patterns/turn-entry-map.md +50 -48
  193. package/assets/pitfalls/agent-kit.md +152 -141
  194. package/assets/pitfalls/doc-style.md +96 -91
  195. package/assets/pitfalls/git-workflow.azure.md +49 -46
  196. package/assets/pitfalls/git-workflow.github.md +264 -234
  197. package/assets/pitfalls/git-workflow.gitlab.md +49 -45
  198. package/assets/pitfalls/spec-driven.md +73 -71
  199. package/assets/pitfalls/styling-bem.md +46 -40
  200. package/assets/pitfalls/task-flow.md +262 -246
  201. package/assets/pitfalls/testing.md +99 -92
  202. package/assets/pitfalls/turn-conduct.md +96 -81
  203. package/assets/rules/angular-patterns.md +81 -80
  204. package/assets/rules/api-layer.md +77 -74
  205. package/assets/rules/autonomous-work.md +75 -74
  206. package/assets/rules/browser-verification.md +223 -188
  207. package/assets/rules/component-structure.md +72 -69
  208. package/assets/rules/dependencies.md +74 -67
  209. package/assets/rules/deploy-flow.azure.md +118 -108
  210. package/assets/rules/deploy-flow.github.md +145 -135
  211. package/assets/rules/deploy-flow.gitlab.md +120 -110
  212. package/assets/rules/doc-style.md +209 -148
  213. package/assets/rules/entity-conventions.needs-admin.md +81 -79
  214. package/assets/rules/entity-models.md +73 -70
  215. package/assets/rules/git-workflow.azure.md +224 -228
  216. package/assets/rules/git-workflow.github.md +250 -242
  217. package/assets/rules/git-workflow.gitlab.md +218 -217
  218. package/assets/rules/lib-layers.md +85 -86
  219. package/assets/rules/lists.md +101 -97
  220. package/assets/rules/navigation.md +78 -78
  221. package/assets/rules/observability.needs-app.md +165 -153
  222. package/assets/rules/platform-access.md +76 -75
  223. package/assets/rules/reuse-first.md +153 -137
  224. package/assets/rules/shared-code.md +82 -79
  225. package/assets/rules/spec-driven.md +272 -260
  226. package/assets/rules/status-report.md +55 -58
  227. package/assets/rules/styling-bem.md +83 -72
  228. package/assets/rules/task-flow.md +282 -270
  229. package/assets/rules/testing.md +224 -188
  230. package/assets/rules/turn-conduct.md +255 -258
  231. package/assets/rules/turn-entry.md +92 -87
  232. package/assets/rules/typescript-conventions.md +94 -88
  233. package/assets/samples/specs/_template/spec.md +47 -47
  234. package/assets/samples/tasks/_template/grill.md +20 -20
  235. package/assets/samples/tasks/_template/plan.md +32 -30
  236. package/assets/samples/tasks/_template/progress.md +16 -16
  237. package/assets/skills/agent-kit-extend.md +129 -113
  238. package/assets/skills/agent-kit.md +236 -222
  239. package/assets/skills/write-a-skill.md +76 -71
  240. package/assets/templates/findings.md +19 -19
  241. package/assets/templates/gate-map.sh +16 -14
  242. package/assets/templates/implementation.md +28 -27
  243. package/assets/templates/pattern.md +17 -17
  244. package/assets/templates/pitfalls.md +6 -6
  245. package/assets/templates/postmortem.md +24 -23
  246. package/assets/templates/project.sh +24 -24
  247. package/assets/templates/proposal.md +62 -60
  248. package/assets/templates/rule.md +38 -38
  249. package/assets/workflows/feature.js +46 -46
  250. package/assets/workflows/plan.js +54 -54
  251. package/lib/catalog.d.ts +2 -0
  252. package/lib/catalog.d.ts.map +1 -1
  253. package/lib/catalog.js +4 -3
  254. package/lib/catalog.js.map +1 -1
  255. package/lib/commands.d.ts.map +1 -1
  256. package/lib/commands.js +68 -4
  257. package/lib/commands.js.map +1 -1
  258. package/lib/companion.js +3 -2
  259. package/lib/companion.js.map +1 -1
  260. package/lib/enroll.d.ts +7 -1
  261. package/lib/enroll.d.ts.map +1 -1
  262. package/lib/enroll.js +13 -4
  263. package/lib/enroll.js.map +1 -1
  264. package/lib/observations.d.ts +10 -1
  265. package/lib/observations.d.ts.map +1 -1
  266. package/lib/observations.js +1 -0
  267. package/lib/observations.js.map +1 -1
  268. package/lib/override-marks.d.ts +24 -0
  269. package/lib/override-marks.d.ts.map +1 -0
  270. package/lib/override-marks.js +98 -0
  271. package/lib/override-marks.js.map +1 -0
  272. package/lib/plan.d.ts +11 -0
  273. package/lib/plan.d.ts.map +1 -1
  274. package/lib/plan.js +10 -1
  275. package/lib/plan.js.map +1 -1
  276. package/lib/ship.d.ts +0 -7
  277. package/lib/ship.d.ts.map +1 -1
  278. package/lib/ship.js +10 -2
  279. package/lib/ship.js.map +1 -1
  280. package/lib/shipment.d.ts.map +1 -1
  281. package/lib/shipment.js +7 -3
  282. package/lib/shipment.js.map +1 -1
  283. package/lib/sync.d.ts.map +1 -1
  284. package/lib/sync.js +45 -11
  285. package/lib/sync.js.map +1 -1
  286. package/package.json +1 -1
  287. package/rt-tools-agent-kit-0.26.0.tgz +0 -0
  288. package/rt-tools-agent-kit-0.23.0.tgz +0 -0
@@ -1,46 +1,50 @@
1
1
  #!/usr/bin/env bash
2
2
  # rt-hook: PreToolUse Bash|mcp__webstorm__execute_sql_query|mcp__webstorm__execute_terminal_command|mcp__webstorm__execute_tool
3
- # Требует: hooks/deny-tail.sh
4
- # Гард пишущих запросов к хранилищу. PreToolUse.
3
+ # Requires: hooks/deny-tail.sh
4
+ # Guard of writing queries to the storage. PreToolUse.
5
5
  #
6
- # Правка данных — единственное действие, которое нельзя откатить правкой кода. Удаление по
7
- # маске однажды уносит вместе с пробными записями настоящие: маска совпадает шире, чем ожидал
8
- # автор запроса, и узнаётся это уже по восстановлению из копии.
6
+ # An edit of data is the only action that cannot be undone by an edit of code. A delete by mask
7
+ # one day takes the real records away along with the trial ones: the mask matches wider than the
8
+ # query author expected, and this is learned only from the restore out of a copy.
9
9
  #
10
- # Отсюда правило: строки адресуются по первичному ключу. Перечисление идентификаторов
11
- # затрагивает ровно столько строк, сколько их перечислено, и промах виден до выполнения; отбор
12
- # по подстроке не виден никогда.
10
+ # Hence the rule: rows are addressed by primary key. A list of identifiers touches exactly as
11
+ # many rows as are listed, and a miss is visible before execution; a selection by substring is
12
+ # never visible.
13
13
  #
14
- # Три уровня:
15
- # отказ — снос, очистка, правка схемы, удаление и обновление без условия или с условием
16
- # не по идентификатору;
17
- # вопрос — остальная запись: адресная правка и вставка, решение за владельцем;
18
- # пропуск — чтение.
14
+ # Three levels:
15
+ # refusal — drop, truncate, schema edit, delete and update without a condition or with a
16
+ # condition not by identifier;
17
+ # question — the rest of writing: an addressed edit and an insert, the decision is the owner's;
18
+ # pass — reading.
19
19
  #
20
- # Каждый предмет разбора живёт своим помощником рядом: запрос из ввода — `sql-guard-request.sh`,
21
- # приведение команды к одному виду и нарезка на сегменты — `sql-guard-parse.sh`, адресат вместе
22
- # с правилами боевой базы — `sql-guard-target.sh`, признак записи, разрушительное, миграции и
23
- # адресация строк — `sql-guard-write.sh`. Здесь остаётся порядок: он зовёт их и решает.
20
+ # Each subject of the parsing lives in a helper of its own next door: the query out of the input
21
+ # — `sql-guard-request.sh`, bringing the command to one form and cutting it into segments —
22
+ # `sql-guard-parse.sh`, the target together with the rules of the production database —
23
+ # `sql-guard-target.sh`, the sign of writing, the destructive, migrations and row addressing —
24
+ # `sql-guard-write.sh`. What stays here is the order: it calls them and decides.
24
25
  #
25
- # Боевое хранилище отдельно: его адреса и подключения перечисляет профиль дерева —
26
- # RT_PROD_DSN — образец адреса боевой базы: порт туннеля, хост, домен;
27
- # RT_PROD_CONNECTIONS — идентификаторы боевых подключений среды разработки;
28
- # RT_LOCAL_CONNECTIONS — они же у локальных: опознанное локальное подключение сильнее любой
29
- # текстовой догадки;
30
- # RT_SCRATCH_PORT_RE — порты одноразовых баз, по которым вопрос не задаётся.
31
- # По боевому адресу любая запись отказывается без опт-аута: бой правится миграцией через
32
- # выкатку, а не запросом из редактора.
26
+ # The production storage is separate: its addresses and connections are listed by the tree
27
+ # profile —
28
+ # RT_PROD_DSN — the pattern of the production database address: tunnel port, host,
29
+ # domain;
30
+ # RT_PROD_CONNECTIONS — identifiers of the IDE's production connections;
31
+ # RT_LOCAL_CONNECTIONS — the same for local ones: a recognised local connection outweighs any
32
+ # textual guess;
33
+ # RT_SCRATCH_PORT_RE — ports of throwaway databases, for which no question is asked.
34
+ # At a production address any write is refused without an opt-out: production is edited by a
35
+ # migration through the rollout, not by a query from the editor.
33
36
  #
34
- # Опт-аут для остальных случаев: маркер `destructive-ok` в тексте запроса вместе с объяснением,
35
- # почему адресация по идентификатору не подходит, понижает отказ до вопроса. Последнее слово
36
- # остаётся за владельцем — гард лишь не пропускает такое молча.
37
+ # The opt-out for the remaining cases: the `destructive-ok` marker in the query text together
38
+ # with an explanation of why addressing by identifier does not fit lowers the refusal to a
39
+ # question. The last word stays with the owner — the guard only does not let it through silently.
37
40
  #
38
- # ОТКАЗ В ПОЛЬЗУ РАБОТЫ: нет разборщика, битый ввод, чужой инструмент — пропуск. Без `perl`
39
- # вырезать текст сообщений коммитов нечем, поэтому команды работы с историей в этом случае
40
- # пропускаются целиком — иначе слова «drop» и «update» в описании коммита читались бы как
41
- # запрос. Доставки запроса внутри такой команды не бывает, так что цена послабления нулевая.
41
+ # FAIL-OPEN: no parser, broken input, foreign tool — pass. Without `perl` there is nothing to cut
42
+ # commit message text out with, so in that case commands that work with history are passed
43
+ # entirely — otherwise the words "drop" and "update" in a commit description would read as a
44
+ # query. A query is never delivered inside such a command, so the concession costs nothing.
42
45
 
43
- # Своё имя в наблюдениях: отбой пишет общий хвост отказа, а не сам гард.
46
+ # Own name in the observations: the refusal is written by the shared refusal tail, not by the
47
+ # guard itself.
44
48
  RT_GUARD_NAME=sql-guard
45
49
 
46
50
  . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utf8.sh" 2>/dev/null || true
@@ -53,22 +57,22 @@ command -v jq >/dev/null 2>&1 || exit 0
53
57
 
54
58
  tool="$(rt_hook_tool)"
55
59
 
56
- # Рабочий каталог нужен одному правилу — разрешению адреса миграции: `DATABASE_URL`
57
- # обычно не назван в команде и лежит в `.env` рядом с проектом.
60
+ # The working directory is needed by one rule — resolving the migration address: `DATABASE_URL`
61
+ # is usually not named in the command and lies in `.env` next to the project.
58
62
  hook_cwd="$(printf '%s' "$input" | jq -r '.cwd // empty' 2>/dev/null)"
59
63
  [ -z "$hook_cwd" ] && hook_cwd="${CLAUDE_PROJECT_DIR:-.}"
60
64
 
61
- # Профиль дерева: сперва умолчание пакета, поверх него — надстройка проекта, если она есть.
62
- # Умолчание ищется и рядом с самим хуком: уезжают они вместе.
65
+ # The tree profile: first the package default, on top of it the project override, if there is
66
+ # one. The default is also looked for next to the hook itself: they travel together.
63
67
  rt_hooks_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
64
68
  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
65
69
  # shellcheck disable=SC1090
66
70
  [ -f "$profile" ] && . "$profile" 2>/dev/null
67
71
  done
68
72
 
69
- # Помощники лежат рядом с гардом и уезжают в дерево вместе с ним. Нет хотя бы одного —
70
- # разбирать команду нечем, и гард пропускает ход: отказ в пользу работы здесь тот же, что и
71
- # при отсутствии `jq`.
73
+ # The helpers lie next to the guard and travel into the tree with it. If even one is missing,
74
+ # there is nothing to parse the command with, and the guard passes the move: the fail-open here
75
+ # is the same as when `jq` is absent.
72
76
  for helper in sql-guard-request.sh sql-guard-parse.sh sql-guard-target.sh sql-guard-write.sh; do
73
77
  [ -f "$rt_hooks_dir/$helper" ] || exit 0
74
78
  # shellcheck disable=SC1090
@@ -77,8 +81,9 @@ done
77
81
 
78
82
  PROD_DSN="${RT_PROD_DSN:-}"
79
83
 
80
- # Общий хвост отказа: два законных хода и законная форма обхода, если она у отказа есть. Файл
81
- # может быть не разложен — тогда хвоста нет, а причина отказа остаётся прежней.
84
+ # The shared refusal tail: two lawful moves and the lawful form of bypass, when the refusal has
85
+ # one. The file may not be laid out — then there is no tail, and the reason for the refusal stays
86
+ # as it was.
82
87
  # shellcheck disable=SC1090
83
88
  [ -f "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/deny-tail.sh" ] \
84
89
  && . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/deny-tail.sh" 2>/dev/null
@@ -117,11 +122,11 @@ sql_check_destructive
117
122
  sql_check_migrations
118
123
  sql_check_addressing
119
124
 
120
- # --- остальная запись: решает пользователь ----------------------------------------------
121
- # Неизвестное подключение — не повод пропустить молча: адресат запроса не опознан, и им
122
- # может оказаться боевая база под другим идентификатором.
125
+ # --- the rest of writing: the user decides -------------------------------------------------
126
+ # An unknown connection is no reason to pass silently: the target of the query is not recognised,
127
+ # and it may turn out to be the production database under another identifier.
123
128
  if [ "$conn_known" = "" ] && [ -n "$conn" ]; then
124
- ask "Запись в базу через ПОДКЛЮЧЕНИЕ, НЕИЗВЕСТНОЕ ГАРДУ (id ${conn}). Гард знает локальное подключение и боевое; это — ни то, ни другое, поэтому убедись, что запрос уходит не на прод. Если подключение постоянное, впиши его id в PROD_CONNECTIONS или LOCAL_CONNECTIONS в .claude/hooks/sql-guard.sh."
129
+ ask "A write into the database through a CONNECTION UNKNOWN TO THE GUARD (id ${conn}). The guard knows the local connection and the production one; this is neither, so make sure the request does not go to production. If the connection is permanent, write its id into PROD_CONNECTIONS or LOCAL_CONNECTIONS in .claude/hooks/sql-guard.sh."
125
130
  fi
126
131
 
127
- ask "Запись в базу (${context}). Проверь, что затронуты только ожидаемые строки, и подтверди."
132
+ ask "A write into the database (${context}). Check that only the expected rows are touched, and confirm."
@@ -0,0 +1,104 @@
1
+ #!/usr/bin/env bash
2
+ # rt-hook: Stop
3
+ # Requires: hooks/deny-tail.sh
4
+ # Guard of signing in to the stand. The Stop event. It does not let a turn end in which the executor
5
+ # asks the owner to sign in to the stand or to type a password.
6
+ #
7
+ # Why. The stand, the sign-in and the accounts for checking are prepared by the agent. That demand
8
+ # rested only on the executor's memory and did not hold: in one session the request "sign in
9
+ # yourself" or "type the password" sounded four times in a row, each time with a new reason — the
10
+ # field does not take input, a foreign extension is installed in the browser, the profile switched
11
+ # off. The reason is real, so the request looks fitting; but the obstacle must be removed by the
12
+ # agent all the same.
13
+ #
14
+ # The guard stands at the end of the turn, not at a tool call: the request is written as the text of
15
+ # the reply, and until the turn ends it is not visible.
16
+ #
17
+ # The boundary. The guard checks a set of patterns: a verb of asking next to a word about a
18
+ # password, a sign-in or a form. A request in other words, or through a menu of options, the guard
19
+ # does not recognise. The set grows by an edit; its completeness is not guaranteed.
20
+ #
21
+ # What is allowed: asking to switch to the ordinary mode of work instead of the automatic one. The
22
+ # typing is done by the agent, only the mode is asked of the owner — the guard tells these requests
23
+ # apart.
24
+ #
25
+ # On an error the guard passes: on a failure, a missing turn record and a repeated call the turn is
26
+ # ALLOWED. A broken guard must not block the conversation.
27
+
28
+ # The guard's name for the observations: it is written by the shared deny tail.
29
+ RT_GUARD_NAME=stand-login-guard
30
+
31
+ . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utf8.sh" 2>/dev/null || true
32
+ . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/hook-input.sh" 2>/dev/null || true
33
+
34
+ rt_hook_read
35
+ input="$RT_HOOK_INPUT"
36
+ [ -z "$input" ] && exit 0
37
+
38
+ command -v jq >/dev/null 2>&1 || exit 0
39
+
40
+ # A repeated call on the same turn is not judged: the guard says its refusal once.
41
+ active="$(printf '%s' "$input" | jq -r '.stop_hook_active // false' 2>/dev/null)"
42
+ [ "$active" = "true" ] && exit 0
43
+
44
+ transcript="$(printf '%s' "$input" | jq -r '.transcript_path // empty' 2>/dev/null)"
45
+ [ -z "$transcript" ] && exit 0
46
+ [ -f "$transcript" ] || exit 0
47
+
48
+ # The patterns of the request. The first group is a request to type instead of the agent, the
49
+ # second a request to sign in oneself. A word about the mode of work is not in the set: asking for
50
+ # it is allowed.
51
+ asked_re='(введи|введите|набери|наберите|вбей|вбейте|заполни|заполните|подставь|вставь)[^.!?\n]{0,40}(пароль|учётн|учетн|логин|креды|форму входа)'
52
+ asked_re="$asked_re"'|(войди|войдите|залогинься|залогиньтесь|авторизуйся|авторизуйтесь)[^.!?\n]{0,40}(сам|сами|рукой|руками|за меня|вместо меня|пожалуйста)?'
53
+ asked_re="$asked_re"'|(нужно|надо|прошу)[^.!?\n]{0,20}(чтобы ты|чтобы вы)?[^.!?\n]{0,20}(ввёл|ввел|ввели|вошёл|вошел|вошли)[^.!?\n]{0,30}(пароль|вход|систему)'
54
+
55
+ # The turn is everything recorded after the owner's last real input. A tool answer arrives under the
56
+ # same role, so lines with `tool_result` do not count as input.
57
+ #
58
+ # The last 400 lines are read: the record grows all session long, and only the last turn is judged.
59
+ verdict="$(tail -n 400 "$transcript" 2>/dev/null | jq -s -r --arg re "$asked_re" '
60
+ def is_input:
61
+ .type == "user"
62
+ and ((.isCompactSummary // false) | not)
63
+ and (((.message.content // []) | if type == "array"
64
+ then ([.[] | select(.type == "tool_result")] | length)
65
+ else 0 end) == 0);
66
+
67
+ (map(is_input) | rindex(true)) as $i
68
+ | (if $i == null then . else .[$i + 1:] end) as $turn
69
+ | [$turn[] | select(.type == "assistant") | (.message.content // [])[] | select(.type == "text") | .text] as $texts
70
+ # Case is ignored by a flag, not by lowercasing: lowercasing works only for the Latin alphabet,
71
+ # and a request written with a capital letter would not match the pattern.
72
+ | if (($texts | join("\n")) | test($re; "i")) then "asked" else "pass" end
73
+ ' 2>/dev/null)"
74
+
75
+ [ "$verdict" = "asked" ] || exit 0
76
+
77
+ reason="BLOCKED by stand-login-guard: the executor asks the owner to sign in or to enter a password. The stand, the sign-in and the accounts for checking are prepared by the agent. An obstacle before the asking — a field that does not accept input, a foreign extension in the browser, a profile that dropped out — is removed by the agent.
78
+
79
+ How to remove the obstacle by yourself:
80
+
81
+ substitute the value by the form tool through a reference to the element
82
+ switch off the interfering extension in the browser profile
83
+ raise the stand on another address
84
+ sign in with a pair from the seed of the local database instead of a production account
85
+
86
+ What is asked of the owner is the mode of work, not input: the ordinary mode instead of the automatic one; the sign-in in it is done by the agent, and the automatic mode is returned by the same turn.
87
+
88
+ The guard checks one turn: the next session is not blocked."
89
+
90
+ # The shared deny tail: two lawful moves. The file may not be laid out — then there is no tail, and
91
+ # the reason for the refusal stays.
92
+ # shellcheck disable=SC1090
93
+ [ -f "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/deny-tail.sh" ] \
94
+ && . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/deny-tail.sh" 2>/dev/null
95
+ command -v rt_deny_tail >/dev/null 2>&1 || rt_deny_tail() { :; }
96
+ deny_tail_text="$(rt_deny_tail "")"
97
+ [ -n "$deny_tail_text" ] && reason="${reason}
98
+
99
+ ${deny_tail_text}"
100
+
101
+ jq -n --arg r "$reason" '{decision:"block",reason:$r}' 2>/dev/null \
102
+ || printf '{"decision":"block","reason":"stand-login-guard: the sign-in to the stand is done by the agent, not by the owner."}\n'
103
+
104
+ exit 0
@@ -1,18 +1,18 @@
1
1
  #!/usr/bin/env bash
2
2
  # rt-hook: SessionStart startup|resume|compact|clear
3
- # Требует: hooks/profile-check.sh
4
- # SessionStart: состояние незаконченной работы уезжает в контекст на каждом запуске сессии.
3
+ # Requires: hooks/profile-check.sh
4
+ # SessionStart: the state of unfinished work goes into the context at every start of a session.
5
5
  #
6
- # Памятью это не держится по той же причине, что и словарь: замысел читают перед правкой
7
- # файла, а разговор с владельцем начинается с вопроса — и заход отвечает, не зная, что работа
8
- # уже наполовину сделана. Здесь замысел и ход работы приходят до первой реплики, и владельцу
9
- # не приходится пересказывать то, что уже записано.
6
+ # It is not held by memory for the same reason as the glossary: the plan is read before a file is
7
+ # edited, and a conversation with the owner starts with a question — and the session answers without
8
+ # knowing that the work is already half done. Here the plan and the progress arrive before the first
9
+ # reply, and the owner does not have to retell what is already written down.
10
10
  #
11
- # Разбор просьбы (`grill.md`) отдаётся путём, а не текстом: он неизменен, объёмен и нужен
12
- # реже остальных.
11
+ # The grill (`grill.md`) is given as a path, not as text: it does not change, it is bulky and it is
12
+ # needed less often than the rest.
13
13
  #
14
- # FAIL-OPEN: нет `jq`, не git-репозиторий, нет папки задачи — выходим молча. Сессия важнее
15
- # контекста.
14
+ # FAIL-OPEN: no `jq`, not a git repository, no task folder — we exit silently. The session matters
15
+ # more than the context.
16
16
 
17
17
  . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utf8.sh" 2>/dev/null || true
18
18
 
@@ -24,15 +24,15 @@ git rev-parse --is-inside-work-tree >/dev/null 2>&1 || exit 0
24
24
  branch="$(git branch --show-current 2>/dev/null)"
25
25
  [ -z "$branch" ] && exit 0
26
26
 
27
- # Профиль дерева: сперва умолчание пакета, поверх него — надстройка проекта, если она есть.
27
+ # The tree profile: first the package default, and over it the project override, if there is one.
28
28
  rt_hooks_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
29
29
  for profile in "$rt_hooks_dir/../rt-kit/defaults/project.sh" "$rt_hooks_dir/../defaults/project.sh" "$ROOT/.claude/rt-kit/defaults/project.sh" "$ROOT/.claude/rt-kit/project.sh"; do
30
30
  # shellcheck disable=SC1090
31
31
  [ -f "$profile" ] && . "$profile" 2>/dev/null
32
32
  done
33
33
 
34
- # Слово о нехватке функции профиля: хук, вышедший молча, неотличим от работающего. Файл может
35
- # быть не разложен — тогда остаётся прежнее поведение, молчаливое.
34
+ # A word about a missing profile function: a hook that exited silently is indistinguishable from a
35
+ # working one. The file may not be laid out — then the former behaviour stays, the silent one.
36
36
  # shellcheck disable=SC1090
37
37
  [ -f "$rt_hooks_dir/profile-check.sh" ] && . "$rt_hooks_dir/profile-check.sh"
38
38
  command -v rt_needs >/dev/null 2>&1 || rt_needs() { command -v "$1" >/dev/null 2>&1; }
@@ -49,15 +49,18 @@ emit() {
49
49
  jq -Rs '{hookSpecificOutput:{hookEventName:"SessionStart",additionalContext:.}}' 2>/dev/null
50
50
  }
51
51
 
52
- # Ветка под задачу без папки — работа идёт мимо. Сессию не рвём: SessionStart, отбивающий
53
- # запуск, оставляет владельца без агента вовсе, а правку кода поймает `task-flow-guard`.
52
+ # A branch under a task without a folder — the work goes past the rule. We do not tear the session:
53
+ # a SessionStart that refuses the start leaves the owner without an agent at all, while a code edit
54
+ # will be caught by `task-flow-guard`.
54
55
  if [ ! -d "$DIR" ]; then
55
- # Папки нет по двум разным причинам, и говорить о них надо разное. Первая — работа шла мимо
56
- # правила. Вторая — папку разобрала сама ветка последним коммитом перед заявкой: это законный
57
- # исход, и указание собрать её заново уводит заход с хвоста работы обратно в её начало.
56
+ # The folder is missing for two different reasons, and different things have to be said about
57
+ # them. The first — the work went past the rule. The second — the folder was taken apart by the
58
+ # branch itself with the last commit before the PR: that is a lawful outcome, and an instruction
59
+ # to build it again takes the session from the tail of the work back to its beginning.
58
60
  #
59
- # Различает их история ветки: снос папки её же коммитом после общего предка с главной. Ход
60
- # работы к этой минуте уехал вместе с папкой, и состояние держат заявка и передача захода.
61
+ # The branch history tells them apart: the folder removed by a commit of the branch after the
62
+ # common ancestor with the main one. The progress by that minute has gone with the folder, and
63
+ # the state is held by the PR and the session handover.
61
64
  main_branch="${RT_MAIN_BRANCH:-main}"
62
65
  base="$(git merge-base "origin/${main_branch}" HEAD 2>/dev/null || git merge-base "$main_branch" HEAD 2>/dev/null)"
63
66
  dropped=''
@@ -65,46 +68,48 @@ if [ ! -d "$DIR" ]; then
65
68
 
66
69
  if [ -n "$dropped" ]; then
67
70
  {
68
- printf 'РАБОТА ЗАКРЫВАЕТСЯ — папка задачи разобрана этой веткой.\n\n'
69
- printf 'Ход работы удалён вместе с папкой: состояние держат заявка и передача захода.\n'
70
- printf 'Папка заново не собирается. Правка кода после разбора требует восстановить её\n'
71
- printf 'на время правки и повторить разбор тем же коммитом. Порядок — скил `task-flow`,\n'
72
- printf 'паттерны `task-flow-close` и `task-flow-archive`.\n'
71
+ printf 'WORK IS CLOSING — the task folder has been taken apart by this branch.\n\n'
72
+ printf 'The progress was removed with the folder: the state is held by the PR and the session handover.\n'
73
+ printf 'The folder is not rebuilt. A code edit after the folder was taken apart requires restoring it\n'
74
+ printf 'for the time of the edit and taking it apart again in the same commit. The order — skill `task-flow`,\n'
75
+ printf 'patterns `task-flow-close` and `task-flow-archive`.\n'
73
76
  } | emit
74
77
  exit 0
75
78
  fi
76
79
 
77
80
  if rt_needs rt_task_branch_ok task-context-load && rt_task_branch_ok "$branch"; then
78
81
  {
79
- printf 'РАБОТА БЕЗ ПАПКИ ЗАДАЧИ.\n\n'
80
- printf 'Ветка `%s` названа задачей, а `%s/` нет: ход работы записывать некуда,\n' "$branch" "$DIR"
81
- printf 'и следующий заход начнёт с расспросов владельца.\n\n'
82
- printf 'Собрать с образца:\n\n cp -r %s/_template %s\n\n' "$TASKS_DIR" "$DIR"
83
- # Папка бывает названа не именем ветки: этапы одной большой задачи идут отдельными
84
- # ветками при одной общей папке. Названная поимённо папка — единственное, по чему
85
- # заход её найдёт; иначе он читает отказ как «записей нет» и отвечает владельцу из
86
- # кода, минуя всё, что в этих записях решено.
82
+ printf 'WORK WITHOUT A TASK FOLDER.\n\n'
83
+ printf 'Branch `%s` is named after a task, and `%s/` is missing: there is nowhere to write the progress,\n' "$branch" "$DIR"
84
+ printf 'and the next session will start by questioning the owner.\n\n'
85
+ printf 'Build it from the template:\n\n cp -r %s/_template %s\n\n' "$TASKS_DIR" "$DIR"
86
+ # The folder happens to be named not by the branch name: the stages of one large task
87
+ # go as separate branches with one shared folder. A folder named by name is the only
88
+ # thing by which the session will find it; otherwise it reads the refusal as "there are
89
+ # no records" and answers the owner from the code, bypassing everything decided in those
90
+ # records.
87
91
  others="$(find "$TASKS_DIR" -mindepth 1 -maxdepth 1 -type d ! -name '_template' 2>/dev/null | sort)"
88
92
  if [ -n "$others" ]; then
89
- printf 'В каталоге задач при этом лежит:\n\n%s\n\n' "$others"
90
- printf 'Этапы одной задачи идут отдельными ветками при общей папке — прежде чем\n'
91
- printf 'считать, что записей нет, смотрят в названные.\n\n'
93
+ printf 'The tasks directory meanwhile holds:\n\n%s\n\n' "$others"
94
+ printf 'Stages of one task go as separate branches with a shared folder: before\n'
95
+ printf 'concluding that there are no records, look into the folders named above.\n\n'
92
96
  fi
93
- # О соседнем ресурсе — условно и по имени: пакет не знает, разложен ли он здесь,
94
- # а сказанное безусловно приходит в контекст каждой сессии и врёт про дерево тем
95
- # увереннее, что печатает это сам инструмент.
97
+ # About a neighbouring resource — conditionally and by name: the package does not know
98
+ # whether it is laid out here, and what is said unconditionally arrives in the context
99
+ # of every session and lies about the tree all the more confidently because the tool
100
+ # prints it itself.
96
101
  if [ -f "$rt_hooks_dir/task-flow-guard.sh" ]; then
97
- printf 'Правку кода приложения до этого отбивает гард `task-flow-guard`. Правило — скил `task-flow`.\n'
102
+ printf 'Until then, an application code edit is refused by guard `task-flow-guard`. The rule — skill `task-flow`.\n'
98
103
  else
99
- printf 'Правило — скил `task-flow`. Гарда `task-flow-guard` в дереве нет: правку кода до этого не отбивает ничто.\n'
104
+ printf 'The rule — skill `task-flow`. Guard `task-flow-guard` is not in this tree: nothing refuses a code edit until then.\n'
100
105
  fi
101
106
  } | emit
102
107
  fi
103
108
  exit 0
104
109
  fi
105
110
 
106
- # Порог объёма. Ход работы растёт с каждым заходом, и на десятом заходе целиком он стоит
107
- # дороже, чем даёт. Перевалив порог, отдаём «Где стоим» и последние записи.
111
+ # The size threshold. The progress grows with every session, and by the tenth session it costs more
112
+ # in full than it gives. Past the threshold we give "Where we stand" and the latest entries.
108
113
  LIMIT=40000
109
114
  size=0
110
115
  for file in "$PLAN" "$PROGRESS"; do
@@ -113,36 +118,36 @@ for file in "$PLAN" "$PROGRESS"; do
113
118
  done
114
119
 
115
120
  {
116
- printf 'СОСТОЯНИЕ РАБОТЫ — ветка `%s`, папка `%s/`.\n\n' "$branch" "$DIR"
117
- printf 'Это записано прошлыми заходами. Владельца о том, что здесь есть, не спрашивают.\n'
118
- printf 'Отметка о сделанном — только в `progress.md`; `plan.md` по ходу не правится.\n'
119
- printf 'Как ведётся работа — правило `task-flow`, возвращение к ней — паттерн `task-flow-resume`.\n\n'
121
+ printf 'WORK STATE — branch `%s`, folder `%s/`.\n\n' "$branch" "$DIR"
122
+ printf 'This was written by previous sessions. The owner is not asked about what is here.\n'
123
+ printf 'Done work is marked only in `progress.md`; `plan.md` is not edited along the way.\n'
124
+ printf 'How work is conducted — rule `task-flow`; returning to it — pattern `task-flow-resume`.\n\n'
120
125
 
121
126
  if [ -f "$GRILL" ]; then
122
- printf 'Разбор просьбы владельца — `%s`, читается по надобности.\n\n' "$GRILL"
127
+ printf 'The grill of the owner'"'"'s request — `%s`, read when needed.\n\n' "$GRILL"
123
128
  fi
124
129
 
125
130
  if [ -f "$PLAN" ]; then
126
- printf -- '--- ЗАМЫСЕЛ (`%s`) ---\n\n' "$PLAN"
131
+ printf -- '--- PLAN (`%s`) ---\n\n' "$PLAN"
127
132
  if [ "$size" -le "$LIMIT" ]; then
128
133
  cat "$PLAN"
129
134
  else
130
135
  sed -n '1,60p' "$PLAN"
131
- printf '\n<обрезано по объёму — читается целиком: %s>\n' "$PLAN"
136
+ printf '\n<cut for size — read in full: %s>\n' "$PLAN"
132
137
  fi
133
138
  printf '\n'
134
139
  fi
135
140
 
136
141
  if [ -f "$PROGRESS" ]; then
137
- printf -- '--- ХОД РАБОТЫ (`%s`) ---\n\n' "$PROGRESS"
142
+ printf -- '--- PROGRESS (`%s`) ---\n\n' "$PROGRESS"
138
143
  if [ "$size" -le "$LIMIT" ]; then
139
144
  cat "$PROGRESS"
140
145
  else
141
- # Раздел «Где стоим» перезаписывается каждым заходом и переживает любой объём.
142
- LC_ALL=C awk '/^## Где стоим/{f=1} f&&/^## /&&!/^## Где стоим/{exit} f' "$PROGRESS"
143
- printf '\n<обрезано по объёму. Последние записи:>\n\n'
146
+ # The "Where we stand" section is rewritten by every session and survives any size.
147
+ LC_ALL=C awk '/^## (Where we stand|Где стоим)/{f=1} f&&/^## /&&!/^## (Where we stand|Где стоим)/{exit} f' "$PROGRESS"
148
+ printf '\n<cut for size. The latest entries:>\n\n'
144
149
  tail -40 "$PROGRESS"
145
- printf '\n<читается целиком: %s>\n' "$PROGRESS"
150
+ printf '\n<read in full: %s>\n' "$PROGRESS"
146
151
  fi
147
152
  fi
148
153
  } | emit