@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,37 +1,44 @@
1
1
  #!/usr/bin/env bash
2
- # Цели записи, названные командой оболочки прямо: перенаправление, `tee`, правка на месте,
3
- # копирование поверх, а у интерпретатора — пути из его тела. Печатает по одной в строке.
2
+ # Write targets named by the shell command outright: redirection, `tee`, an in-place edit, a copy
3
+ # over the top, and for an interpreter — the paths from its body. Prints one per line.
4
4
  #
5
- # Строки `# rt-hook:` здесь нет намеренно: это помощник, а не хук. Он ничего не решает сам и
6
- # зовётся оттуда, где судят правку файла, — гардом места правки и гардом экзамена. Общий он
7
- # потому, что признак записи у обоих один и тот же: разойдясь, две копии пропустили бы разные
8
- # формы записи, и заметить это было бы нечем.
5
+ # NOT a guard: it has no `rt-hook:` declaration and hooks into no agent event. The guards that judge
6
+ # a shell command source it: the paths a command writes to are read one way by all of them.
9
7
  #
10
- # Общий признак записи здесь не берётся намеренно — он широк, в нём и имя интерпретатора, и
11
- # запуск разложенной проверки читался бы как правка её самой. Снятие копии сюда тоже не входит:
12
- # снятый файл раскладка кладёт заново, и так чинят копию, которую переписал форматтер.
8
+ # There is deliberately no `# rt-hook:` line here: this is a helper, not a hook. It decides nothing
9
+ # by itself and is called from where an edit of a file is judged — by the guard of the place of the
10
+ # edit and by the exam guard. It is shared because the sign of a write is one and the same for both:
11
+ # having diverged, two copies would let through different forms of a write, and there would be
12
+ # nothing to notice it by.
13
13
  #
14
- # Интерпретатор с кодом в доводе или в теле — особый случай, и без него у гардов была дыра
15
- # ровно в ту сторону, которой правят чаще всего. Путь записи стоит там внутри кода — в вызове
16
- # записи файла, — и ни одним из образцов выше не ловится: команда снаружи выглядит запуском
17
- # интерпретатора, а не записью. Разложенную копию так правили молча, и ловила это уже раскладка
18
- # — на сборке, когда правка написана целиком и переносить её приходится руками.
14
+ # The shared sign of a write is deliberately not taken here — it is wide, it holds the name of the
15
+ # interpreter too, and running a laid-out check would read as an edit of the check itself. Taking a
16
+ # copy is not included either: a copied file is put in place again by the layout, and that is how a
17
+ # copy overwritten by the formatter is fixed.
19
18
  #
20
- # Разбирать чужой язык нечем, и здесь не разбирают: из тела берётся всё путеподобное, а решает
21
- # по нему зовущий — гард места правки отбивает лишь то, что несёт шапку раскладки. Цена названа
22
- # прямо: чтение файла интерпретатором судится наравне с записью в него. Читают в оболочке
23
- # другим — `cat`, `grep`, `sed -n`, — а интерпретатор, которому назвали путь разложенной копии,
24
- # почти всегда её и правит.
19
+ # An interpreter with code in an argument or in a body is a special case, and without it the guards
20
+ # had a hole exactly in the direction in which edits are made most often. The write path stands
21
+ # there inside the code — in the call that writes the file — and is caught by none of the patterns
22
+ # above: from the outside the command looks like running an interpreter, not like a write. A
23
+ # laid-out copy was edited that way silently, and it was the layout that caught it — at the build,
24
+ # when the edit is written in full and has to be carried over by hand.
25
+ #
26
+ # There is nothing to parse someone else's language with, and it is not parsed here: everything
27
+ # path-like is taken from the body, and the caller decides by it — the guard of the place of the
28
+ # edit refuses only what carries the layout header. The price is named outright: reading a file by
29
+ # an interpreter is judged on a par with writing into it. In the shell one reads by other means —
30
+ # `cat`, `grep`, `sed -n` — while an interpreter given the path of a laid-out copy almost always
31
+ # edits it.
25
32
 
26
33
  rt_write_targets() {
27
34
  rt_wt_text="$(cat)"
28
35
 
29
- # Перенаправление в пустое устройство и в поток ошибок снимается до разбора — тем же приёмом,
30
- # каким его снимает признак записи оболочкой. Без этого заглушённый вывод внутри тела
31
- # интерпретатора читается признаком записи, и тело, которое ничего не пишет, снова отдаёт все
32
- # свои пути: команда с правкой одного файла и запуском проверки рядом запрещалась по пути
33
- # этой проверки. Настоящая запись рядом с заглушённым потоком остаётся видной: снимается
34
- # перенаправление, а не команда целиком.
36
+ # Redirection to the empty device and to the error stream is removed before parsing — by the
37
+ # same technique the shell write sign removes it. Without this a muted output inside the body of
38
+ # an interpreter reads as a sign of a write, and a body that writes nothing again gives away all
39
+ # its paths: a command with an edit of one file and a run of a check next to it was forbidden by
40
+ # the path of that check. A real write next to a muted stream stays visible: the redirection is
41
+ # removed, not the whole command.
35
42
  rt_wt_text="$(printf '%s' "$rt_wt_text" \
36
43
  | sed -E 's#(&|[0-9]*)>>?[[:space:]]*/dev/(null|stderr)##g; s#[0-9]*>&[0-9-]##g')"
37
44
 
@@ -46,11 +53,11 @@ rt_write_targets() {
46
53
  s/(^|.*[[:space:]])(cp|mv|install)[[:space:]]+([^[:space:]]+[[:space:]]+)+([^[:space:]|&;]+).*/\4/p
47
54
  '
48
55
 
49
- # Тело интерпретатора: код приходит доводом `-c`, доводом `-e` либо телом heredoc, и
50
- # путь записи стоит внутри него. Берётся именно тело, а не вся команда: составная
51
- # строка, в которой heredoc пишет один файл, а рядом запускается проверка, отдала бы
52
- # путь этой проверки как цель записи — и запуск разложенной проверки снова читался бы
53
- # правкой её самой.
56
+ # The body of the interpreter: the code comes as a `-c` argument, an `-e` argument or a
57
+ # heredoc body, and the write path stands inside it. It is exactly the body that is taken,
58
+ # not the whole command: a compound line in which a heredoc writes one file while a check is
59
+ # run next to it would give away the path of that check as a write target — and running a
60
+ # laid-out check would again read as an edit of the check itself.
54
61
  printf '%s\n' "$rt_wt_text" | awk '
55
62
  function emit(s, n, i, parts) {
56
63
  n = split(s, parts, /[^A-Za-z0-9_.@\/-]+/)
@@ -58,11 +65,43 @@ rt_write_targets() {
58
65
  if (parts[i] ~ /\// && parts[i] ~ /\.[A-Za-z0-9]+$/) { print parts[i] }
59
66
  }
60
67
  }
61
- # Пишет ли тело хоть что-нибудь. Тело, в котором нет ни одного вызова записи, своих
62
- # путей не отдаёт: команда, подключившая разложенный помощник и напечатавшая его
63
- # ответ, запрещалась как правка этого помощника — за один заход трижды подряд.
64
- # Внутри тела, которое пишет, пути по-прежнему берутся все: путь и вызов записи
65
- # стоят там разными строками, и связать их нечем.
68
+ # A path assigned to a variable. It stands on a line separate from the write call, and
69
+ # without this pair a write through a variable cannot be caught at all.
70
+ function note_var(s, name, path) {
71
+ if (match(s, /[A-Za-z_][A-Za-z0-9_]*[ \t]*=[ \t]*[\047\"][^\047\"]*\/[^\047\"]*[\047\"]/)) {
72
+ path = substr(s, RSTART, RLENGTH)
73
+ name = path
74
+ sub(/[ \t]*=.*$/, "", name)
75
+ sub(/^[^=]*=[ \t]*[\047\"]/, "", path)
76
+ sub(/[\047\"].*$/, "", path)
77
+ if (path ~ /\.[A-Za-z0-9]+$/) { varpath[name] = path }
78
+ }
79
+ }
80
+ # The write target is the first argument of the write call. It is the address the
81
+ # script opens; everything else on the same line is search patterns, substitutions and
82
+ # data.
83
+ function emit_calls(s, rest, arg, name) {
84
+ rest = s
85
+ while (match(rest, /(open|writeFileSync|writeFile|appendFileSync|appendFile|write_text|write_bytes|copyfile|copy2|rename|symlink|mkdir|makedirs)[ \t]*\(/)) {
86
+ rest = substr(rest, RSTART + RLENGTH)
87
+ arg = rest
88
+ sub(/[,)].*$/, "", arg)
89
+ gsub(/^[ \t]+|[ \t]+$/, "", arg)
90
+ if (arg ~ /^[\047\"]/) {
91
+ gsub(/^[\047\"]|[\047\"]$/, "", arg)
92
+ if (arg ~ /\// && arg ~ /\.[A-Za-z0-9]+$/) { print arg }
93
+ } else {
94
+ name = arg
95
+ gsub(/[^A-Za-z0-9_].*$/, "", name)
96
+ if (name in varpath) { print varpath[name] }
97
+ }
98
+ }
99
+ }
100
+ # Whether the body writes anything at all. A body with not a single write call does
101
+ # not give away its paths: a command that sourced a laid-out helper and printed its
102
+ # answer was forbidden as an edit of that helper — three times in a row in one session.
103
+ # Inside a body that does write, all paths are still taken: the path and the write call
104
+ # stand there on different lines, and there is nothing to tie them together with.
66
105
  function writes(s) {
67
106
  return s ~ /open[ \t]*\([^)]*[\047\"](w|a|r\+|w\+|a\+)[\047\"]/ \
68
107
  || s ~ /writeFileSync|writeFile|appendFile|write_text|write_bytes|\.write\(|\.save\(|savefig|to_csv|json\.dump|\.dump\(/ \
@@ -71,34 +110,50 @@ rt_write_targets() {
71
110
  || s ~ /(^|[|;&(]|[ \t])(tee|cp|mv|rm|touch|install|truncate)([ \t]|$)/
72
111
  }
73
112
  function trim(s) { sub(/^[ \t]+/, "", s); sub(/[ \t]+$/, "", s); return s }
74
- function flush_body() {
75
- if (wrote) { emit(body) }
76
- body = ""
113
+ # Paths are taken from the write lines, not from the whole body.
114
+ #
115
+ # Before, a body that writes anything at all gave away all its path-like words at once:
116
+ # an address named in the body as a search pattern or a comparison string read as a
117
+ # write target, and an edit of one file was forbidden by the name of another, which the
118
+ # script did not even open. Such a refusal was bypassed by changing the form of the
119
+ # command, not the action — that is, it lifted the requirement instead of holding it.
120
+ #
121
+ # A path assigned to a variable is not lost by this: the pair "assignment — write line"
122
+ # is parsed separately.
123
+ function flush_body( i) {
124
+ if (wrote) {
125
+ for (i = 1; i <= lines; i++) { note_var(line[i]) }
126
+ for (i = 1; i <= lines; i++) {
127
+ if (writes(line[i])) { emit(line[i]); emit_calls(line[i]) }
128
+ }
129
+ }
130
+ for (i = 1; i <= lines; i++) { delete line[i] }
131
+ delete varpath
132
+ lines = 0
77
133
  wrote = 0
78
134
  }
79
135
  tag != "" {
80
136
  if (trim($0) == tag) { flush_body(); tag = ""; next }
81
137
  if (keep) {
82
- body = body " " $0
138
+ line[++lines] = $0
83
139
  if (writes($0)) { wrote = 1 }
84
140
  }
85
141
  next
86
142
  }
87
143
  {
88
- # Код доводом: всё, что стоит за `-c` или `-e` у интерпретатора.
144
+ # Code as an argument: everything that stands after `-c` or `-e` of an interpreter.
89
145
  if ($0 ~ /(^|[|;&(]|[ \t])(python3?|node|ruby|perl|php|deno|bun)([ \t]|$)/ \
90
146
  && match($0, /[ \t]-[ce][ \t]/)) {
91
147
  rest = substr($0, RSTART + RLENGTH)
92
- if (writes(rest)) { emit(rest) }
148
+ if (writes(rest)) { note_var(rest); emit(rest); emit_calls(rest) }
93
149
  }
94
- # Тело heredoc: путь записи интерпретатора стоит именно там.
150
+ # The heredoc body: the write path of the interpreter stands exactly there.
95
151
  if (match($0, /<<-?[ \t]*[\047\"]?[A-Za-z_][A-Za-z0-9_]*/)) {
96
152
  t = substr($0, RSTART, RLENGTH)
97
153
  sub(/^<<-?[ \t]*[\047\"]?/, "", t)
98
154
  tag = t
99
155
  keep = ($0 ~ /(^|[|;&(]|[ \t])(python3?|node|ruby|perl|php|deno|bun)([ \t]|$)/)
100
- body = ""
101
- wrote = 0
156
+ flush_body()
102
157
  }
103
158
  }
104
159
  END { if (tag != "") { flush_body() } }'
@@ -1,30 +1,32 @@
1
- # Закон об автономном заходе
1
+ # Law on the autonomous session
2
2
 
3
- Заход, в котором владельца нет рядом. Он не отвечает на вопросы, не нажимает кнопок и не видит
4
- работы до утра: всё, что исполнитель сделал за ночь, читается им разом и уже случившимся.
3
+ A session with no owner nearby. They answer no questions, press no buttons and do not see the
4
+ work until morning: everything the executor did overnight, they read at once and as already
5
+ happened.
5
6
 
6
- ## Статьи
7
+ ## Articles
7
8
 
8
- - **Автономный заход объявляет владелец, и кончается он его словом либо названной границей.**
9
- Сам себя заход не продлевает: работа без конца — это работа, о которой владелец не просил.
10
- - **Развилка закрывается умолчанием, а не ожиданием.** Вопрос, который некому задать, не
11
- останавливает работу: исполнитель берёт умолчание, записывает его вместе с ценой ошибки и идёт
12
- дальше. Стоящий заход не отвечает ни на один вопрос и стоит ровно столько же, сколько
13
- отвеченный неверно.
14
- - **Задача, упирающаяся в слово владельца, откладывается целиком.** Наполовину сделанная
15
- выглядит сделанной: следующий заход читает её как закрытую и не возвращается к ней.
16
- - **Действие, которое видно снаружи, в автономном заходе не делается.** Отправка чужой стороне,
17
- публикация, слияние, письмо: их последствия отменяет человек, а его нет. Отмена стоит дороже
18
- ожидания.
19
- - **Работа, которую нечем подтвердить, не берётся.** Признак готовности автономного захода —
20
- команда с известным выводом, а не взгляд исполнителя: подтвердить его некому.
21
- - **Каждый шаг кончается следом на диске.** Заход обрывается без предупреждения — по окну, по
22
- отказу, по сети, — и всё, что не записано, исчезает вместе с ним.
23
- - **Работы идут чередой, а не веером из одного основания.** Каждая следующая ветвится от
24
- предыдущей: расхождение тогда всплывает у того, у кого обе правки под рукой, а не у владельца,
25
- у которого нет ни одной.
26
- - **Заход кончается списком, а не итогом.** Владелец читает ночь целиком: по каждой работе видно,
27
- что сделано, где лежит, чем подтверждено и чего она ждёт. Итог «сделано много» не говорит ни о
28
- чём из четырёх.
29
- - **Отказ стража автономный заход не кончает.** Он называет пропущенный шаг, и шаг делается;
30
- заход, вставший на отказе до утра, теряет ночь целиком.
9
+ - **The owner declares an autonomous session, and it ends by their word or at a named boundary.**
10
+ A session does not extend itself: work without an end is work the owner did not ask for.
11
+ - **A fork is closed by a default, not by waiting.** A question with nobody to ask does not stop
12
+ the work: the executor takes a default, writes it down together with the cost of being wrong,
13
+ and moves on. A standing session answers no question and costs exactly as much as one answered
14
+ wrong.
15
+ - **A task that runs into the owner's word is postponed whole.** A half-done one looks done: the
16
+ next session reads it as closed and does not come back to it.
17
+ - **An action visible from outside is not done in an autonomous session.** Sending to another
18
+ party, publishing, merging, mail: their consequences are undone by a person, and there is none.
19
+ Undoing costs more than waiting.
20
+ - **Work that cannot be confirmed by anything is not taken.** The readiness sign of an autonomous
21
+ session is a command with a known output, not the executor's glance: there is nobody to confirm
22
+ it.
23
+ - **Every step ends with a trace on disk.** A session breaks off without warning — on the window,
24
+ on a refusal, on the network — and everything not written vanishes with it.
25
+ - **Pieces of work go in a chain, not in a fan from one base.** Each next one branches from the
26
+ previous: a divergence then surfaces for whoever has both edits at hand, not for the owner,
27
+ who has neither.
28
+ - **A session ends with a list, not a summary.** The owner reads the night whole: for every piece
29
+ of work it shows what was done, where it lies, what confirms it and what it waits for. A
30
+ summary "a lot was done" says nothing about any of the four.
31
+ - **A guard's refusal does not end an autonomous session.** It names the skipped step, and the
32
+ step is done; a session that stopped on a refusal until morning loses the night whole.
@@ -1,35 +1,36 @@
1
- # Закон об устройстве кода
1
+ # Law on code structure
2
2
 
3
- Что должно быть верно про сам код независимо от того, что он делает. Закон нужен потому, что
4
- код читают чаще, чем пишут: имя, по которому не видно рода объявления, и тип, объявленный
5
- подходящим вместо проверенного, стоят читателю отдельного похода в соседний файл.
3
+ What must be true about the code itself regardless of what it does. The law is needed because
4
+ code is read more often than written: a name that does not show the kind of the declaration, and
5
+ a type declared as fitting instead of checked, cost the reader a separate trip to a neighbouring
6
+ file.
6
7
 
7
- ## Статьи
8
+ ## Articles
8
9
 
9
- - **Имя объявления говорит, какого оно рода.** Без этого род объявления выясняется переходом
10
- к нему, и на каждом чтении заново.
11
- - **Имя файла, обещающее род объявления, это объявление в нём находит.** Списки, деревья
12
- каталогов и сообщения об ошибках показывают имя вместо содержимого, и обещание, которого
13
- файл не держит, обходится дороже отсутствующего.
14
- - **Источник значения, за которым следят, виден по его имени.** Иначе подписка на него
15
- выглядит как обычное чтение, и её забывают снять.
16
- - **Тип берётся из того пакета, где объявлен.** Своя копия чужого типа расходится с
17
- оригиналом молча, а компилируется из них только одна.
18
- - **Значение не объявляется подходящим в обход проверки типа.** Приведение через промежуточное
19
- «неизвестно» отключает сверку намеренно и принимает что угодно; там, где иначе нельзя,
20
- причина названа рядом.
21
- - **Отметка об устаревании — повод убрать, а не повод оставить.** Устаревшее объявление,
22
- которое молча продолжает работать, переживает того, кто его пометил.
23
- - **Файл читается целиком.** Длина, при которой его читают по частям, объявлена одним числом на
24
- все роды файлов, и накопленное до объявления перечислено поимённо: перечень отмечает долг, а
25
- не выдаёт разрешение.
10
+ - **The name of a declaration says what kind it is.** Without that, the kind of a declaration is
11
+ found out by going to it, and anew at every reading.
12
+ - **A file name that promises a kind of declaration finds that declaration inside.** Listings,
13
+ directory trees and error messages show the name instead of the content, and a promise the file
14
+ does not keep costs more than no promise at all.
15
+ - **The source of a watched value is visible from its name.** Otherwise a subscription to it
16
+ looks like an ordinary read, and people forget to remove it.
17
+ - **A type is taken from the package where it is declared.** A copy of someone else's type drifts
18
+ from the original silently, and only one of them gets compiled.
19
+ - **A value is not declared as fitting around the type check.** A cast through an intermediate
20
+ "unknown" switches the check off on purpose and accepts anything; where there is no other way,
21
+ the reason is named next to it.
22
+ - **A deprecation mark is a reason to remove, not a reason to keep.** A deprecated declaration
23
+ that silently keeps working outlives whoever marked it.
24
+ - **A file is read whole.** The length at which it is read in parts is declared as one number for
25
+ all kinds of files, and what accumulated before the declaration is listed one by one: the list
26
+ marks a debt, it does not grant permission.
26
27
 
27
- ## Открытые вопросы
28
+ ## Open questions
28
29
 
29
- - **Q-CS-3 — имя файла без обещания рода не судится ничем.** Проверка спрашивает файл, чьё имя
30
- род называет; имя из одних слов о содержимом не говорит вовсе, и назвать род обязанным можно
31
- только решением о продукте.
32
- - **Q-CS-4 — одноступенчатое приведение остаётся непроверенным.** Запрещено обходить сверку
33
- через промежуточное «неизвестно», а обычное приведение принято: часть его обязательна, и
34
- запрет отбивал бы её вместе с остальным. Решение изменит, появится ли требование к причине у
35
- каждого оставшегося.
30
+ - **Q-CS-3 — a file name without a promise of kind is judged by nothing.** The check asks a file
31
+ whose name names a kind; a name made of words about content alone says nothing, and a kind can
32
+ be made mandatory only by a product decision.
33
+ - **Q-CS-4 — a one-step cast stays unchecked.** Going around the check through an intermediate
34
+ "unknown" is banned, and an ordinary cast is accepted: part of it is mandatory, and the ban
35
+ would reject it along with the rest. The decision will change whether every remaining one
36
+ needs a reason.