@rt-tools/agent-kit 0.37.1 → 0.38.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 (357) hide show
  1. package/README.md +5 -5
  2. package/assets/checks/action-of.mjs +154 -0
  3. package/assets/checks/board-runs.github.mjs +40 -5
  4. package/assets/checks/check-board.github.mjs +38 -7
  5. package/assets/checks/check-state-next.mjs +22 -10
  6. package/assets/checks/check-turn-map.mjs +26 -6
  7. package/assets/checks/check-work-steps.mjs +4 -173
  8. package/assets/checks/decide.mjs +285 -0
  9. package/assets/checks/decision-table.json +21365 -0
  10. package/assets/checks/decision-table.mjs +495 -0
  11. package/assets/checks/epic-window.mjs +98 -0
  12. package/assets/checks/flow-condition.mjs +64 -0
  13. package/assets/checks/flow-data.mjs +136 -0
  14. package/assets/checks/flow-forecast.mjs +330 -0
  15. package/assets/checks/flow-guard-run.mjs +90 -0
  16. package/assets/checks/flow-guard.mjs +294 -0
  17. package/assets/checks/flow-model.mjs +271 -0
  18. package/assets/checks/flow-override.mjs +130 -0
  19. package/assets/checks/flow-plan.mjs +206 -0
  20. package/assets/checks/flow-scaffold.mjs +224 -0
  21. package/assets/checks/flow-step.mjs +365 -0
  22. package/assets/checks/flow-sync.mjs +296 -0
  23. package/assets/checks/flow-syntax.mjs +292 -0
  24. package/assets/checks/flow-verdict.mjs +112 -0
  25. package/assets/checks/merge-read.mjs +239 -0
  26. package/assets/checks/owner-nudges.mjs +389 -0
  27. package/assets/checks/push-inputs.mjs +59 -16
  28. package/assets/checks/record-count.mjs +410 -0
  29. package/assets/checks/record-recount.mjs +187 -0
  30. package/assets/checks/record-turn.mjs +155 -0
  31. package/assets/checks/task-flow-script.mjs +292 -0
  32. package/assets/checks/tree-assignment.mjs +26 -7
  33. package/assets/checks/work-result.mjs +281 -0
  34. package/assets/checks/work-steps-lib.mjs +205 -0
  35. package/assets/commands/night.md +6 -6
  36. package/assets/defaults/gate-map.sh +39 -12
  37. package/assets/defaults/merges.sh +48 -0
  38. package/assets/defaults/project.sh +6 -5
  39. package/assets/defaults/turn-map.md +21 -22
  40. package/assets/docs/GLOSSARY.md +5 -1
  41. package/assets/hooks/ask-judge.md +65 -0
  42. package/assets/hooks/browser-guard-device-id.sh +11 -9
  43. package/assets/hooks/browser-guard-no-asking.sh +12 -6
  44. package/assets/hooks/browser-guard-no-listing.sh +13 -7
  45. package/assets/hooks/browser-guard-no-other-drivers.sh +25 -17
  46. package/assets/hooks/browser-guard-require-select.sh +15 -15
  47. package/assets/hooks/commit-msg.sh +13 -3
  48. package/assets/hooks/conscience-guard.sh +9 -25
  49. package/assets/hooks/decide.sh +141 -0
  50. package/assets/hooks/deny-tail.sh +16 -11
  51. package/assets/hooks/dev-server-guard.sh +27 -20
  52. package/assets/hooks/dispatch.sh +47 -4
  53. package/assets/hooks/docs-guard.sh +31 -200
  54. package/assets/hooks/end-conversation-guard.sh +12 -21
  55. package/assets/hooks/epic-stop-guard.sh +54 -152
  56. package/assets/hooks/exam-guard.sh +32 -65
  57. package/assets/hooks/facts-docs.sh +221 -0
  58. package/assets/hooks/facts-flow.sh +173 -0
  59. package/assets/hooks/facts.sh +308 -0
  60. package/assets/hooks/flow-step-guard.sh +93 -0
  61. package/assets/hooks/git-guard-delivery-body.sh +4 -4
  62. package/assets/hooks/git-guard-delivery-conflict.sh +16 -10
  63. package/assets/hooks/git-guard-delivery-draft.sh +3 -3
  64. package/assets/hooks/git-guard-delivery-epic.sh +18 -9
  65. package/assets/hooks/git-guard-delivery-folder.sh +32 -7
  66. package/assets/hooks/git-guard-delivery-merge.sh +2 -2
  67. package/assets/hooks/git-guard-delivery-merged.sh +12 -1
  68. package/assets/hooks/git-guard-delivery-pipeline.sh +1 -1
  69. package/assets/hooks/git-guard-delivery-rerun.sh +32 -0
  70. package/assets/hooks/git-guard-delivery-signature.sh +82 -45
  71. package/assets/hooks/git-guard-delivery-task.sh +47 -0
  72. package/assets/hooks/git-guard-delivery.sh +112 -101
  73. package/assets/hooks/git-guard-discard.sh +8 -18
  74. package/assets/hooks/git-guard-main.sh +13 -19
  75. package/assets/hooks/git-guard-no-verify.sh +56 -16
  76. package/assets/hooks/git-guard-push-ahead.sh +15 -4
  77. package/assets/hooks/git-guard-push-marks.sh +53 -1
  78. package/assets/hooks/git-guard-push-tests.sh +30 -51
  79. package/assets/hooks/git-guard-tree-assignment.sh +7 -4
  80. package/assets/hooks/guard-note.sh +8 -6
  81. package/assets/hooks/handoff-entry-guard.sh +19 -38
  82. package/assets/hooks/handoff-write.sh +3 -1
  83. package/assets/hooks/hook-input.sh +0 -41
  84. package/assets/hooks/metric-marks.sh +19 -7
  85. package/assets/hooks/observe.sh +1 -1
  86. package/assets/hooks/override-write-guard.sh +27 -9
  87. package/assets/hooks/pre-push.sh +14 -10
  88. package/assets/hooks/prose-style-guard.sh +6 -19
  89. package/assets/hooks/pull-merges.sh +76 -0
  90. package/assets/hooks/push-set.sh +11 -4
  91. package/assets/hooks/qa-dataid-guard.sh +7 -17
  92. package/assets/hooks/record-turn.sh +52 -0
  93. package/assets/hooks/rerun-guard.sh +11 -16
  94. package/assets/hooks/reuse-first-guard.sh +7 -21
  95. package/assets/hooks/role-calls.sh +25 -3
  96. package/assets/hooks/rule-source-guard.sh +54 -21
  97. package/assets/hooks/skill-gate-rearm.sh +18 -5
  98. package/assets/hooks/skill-gate.sh +156 -20
  99. package/assets/hooks/skill-loaded.sh +18 -3
  100. package/assets/hooks/sql-guard-target.sh +2 -2
  101. package/assets/hooks/sql-guard-write.sh +12 -12
  102. package/assets/hooks/sql-guard.sh +58 -16
  103. package/assets/hooks/task-context-load.sh +3 -1
  104. package/assets/hooks/task-flow-context.sh +5 -18
  105. package/assets/hooks/task-flow-draft-guard.sh +25 -74
  106. package/assets/hooks/task-flow-guard.sh +28 -130
  107. package/assets/hooks/tree-assignment-guard.sh +25 -14
  108. package/assets/hooks/turn-entry-load.sh +3 -1
  109. package/assets/hooks/turn-exit-guard.sh +92 -452
  110. package/assets/hooks/turn-exit-role.sh +3 -1
  111. package/assets/hooks/turn-judge.md +103 -0
  112. package/assets/hooks/window-fill-guard.sh +22 -41
  113. package/assets/patterns/git-workflow-commit.azure.md +9 -155
  114. package/assets/patterns/git-workflow-commit.github.md +11 -269
  115. package/assets/patterns/git-workflow-commit.gitlab.md +9 -161
  116. package/assets/patterns/git-workflow-docker.md +8 -231
  117. package/assets/patterns/git-workflow-freshness.md +8 -56
  118. package/assets/patterns/git-workflow-merge.md +6 -176
  119. package/assets/patterns/git-workflow-migration.md +5 -75
  120. package/assets/patterns/git-workflow-pr-body.github.md +6 -159
  121. package/assets/patterns/git-workflow-pr-ready.md +9 -70
  122. package/assets/patterns/git-workflow-pr.azure.md +13 -285
  123. package/assets/patterns/git-workflow-pr.github.md +13 -251
  124. package/assets/patterns/git-workflow-pr.gitlab.md +13 -286
  125. package/assets/patterns/git-workflow-restart.md +5 -42
  126. package/assets/patterns/git-workflow-secrets.md +10 -76
  127. package/assets/patterns/git-workflow-stack.md +7 -207
  128. package/assets/patterns/status-report-table.github.md +1 -1
  129. package/assets/patterns/task-flow-archive.md +12 -233
  130. package/assets/patterns/task-flow-close.md +16 -292
  131. package/assets/patterns/task-flow-cycle.md +13 -39
  132. package/assets/patterns/task-flow-graph.needs-graph.md +8 -62
  133. package/assets/patterns/task-flow-handoff.md +13 -161
  134. package/assets/patterns/task-flow-resume.md +18 -218
  135. package/assets/patterns/task-flow-start.md +9 -247
  136. package/assets/patterns/turn-entry-map.md +2 -2
  137. package/assets/pitfalls/agent-kit-extend.md +200 -0
  138. package/assets/pitfalls/agent-kit.2.md +323 -0
  139. package/assets/pitfalls/angular-patterns.md +98 -0
  140. package/assets/pitfalls/browser-verification.md +265 -0
  141. package/assets/pitfalls/component-structure.md +98 -0
  142. package/assets/pitfalls/dependencies.md +92 -0
  143. package/assets/pitfalls/deploy-flow.azure.md +171 -0
  144. package/assets/pitfalls/deploy-flow.github.md +211 -0
  145. package/assets/pitfalls/deploy-flow.gitlab.md +173 -0
  146. package/assets/pitfalls/doc-style.2.md +286 -0
  147. package/assets/pitfalls/entity-conventions.needs-admin.md +96 -0
  148. package/assets/pitfalls/entity-models.md +89 -0
  149. package/assets/pitfalls/git-workflow-commit.azure.md +190 -0
  150. package/assets/pitfalls/git-workflow-commit.github.md +307 -0
  151. package/assets/pitfalls/git-workflow-commit.gitlab.md +196 -0
  152. package/assets/pitfalls/git-workflow-docker.md +275 -0
  153. package/assets/pitfalls/git-workflow-freshness.md +88 -0
  154. package/assets/pitfalls/git-workflow-hosting.azure.md +31 -0
  155. package/assets/pitfalls/git-workflow-hosting.github.md +32 -0
  156. package/assets/pitfalls/git-workflow-hosting.gitlab.md +31 -0
  157. package/assets/pitfalls/git-workflow-merge.md +220 -0
  158. package/assets/pitfalls/git-workflow-migration.md +103 -0
  159. package/assets/pitfalls/git-workflow-pr-body.github.md +185 -0
  160. package/assets/pitfalls/git-workflow-pr-ready.md +104 -0
  161. package/assets/pitfalls/git-workflow-pr.2.azure.md +172 -0
  162. package/assets/pitfalls/git-workflow-pr.2.github.md +184 -0
  163. package/assets/pitfalls/git-workflow-pr.2.gitlab.md +180 -0
  164. package/assets/pitfalls/git-workflow-pr.azure.md +159 -0
  165. package/assets/pitfalls/git-workflow-pr.github.md +107 -0
  166. package/assets/pitfalls/git-workflow-pr.gitlab.md +151 -0
  167. package/assets/pitfalls/git-workflow-push.azure.md +30 -0
  168. package/assets/pitfalls/git-workflow-push.github.md +30 -0
  169. package/assets/pitfalls/git-workflow-push.gitlab.md +30 -0
  170. package/assets/pitfalls/git-workflow-queue.azure.md +30 -0
  171. package/assets/pitfalls/git-workflow-queue.github.md +30 -0
  172. package/assets/pitfalls/git-workflow-queue.gitlab.md +30 -0
  173. package/assets/pitfalls/git-workflow-restart.md +72 -0
  174. package/assets/pitfalls/git-workflow-secrets.md +114 -0
  175. package/assets/pitfalls/git-workflow-stack.md +254 -0
  176. package/assets/pitfalls/git-workflow.2.azure.md +291 -0
  177. package/assets/pitfalls/git-workflow.2.github.md +294 -0
  178. package/assets/pitfalls/git-workflow.2.gitlab.md +278 -0
  179. package/assets/pitfalls/lib-layers.md +114 -0
  180. package/assets/pitfalls/lists.md +117 -0
  181. package/assets/pitfalls/navigation.md +94 -0
  182. package/assets/pitfalls/reuse-first.md +201 -0
  183. package/assets/pitfalls/spec-driven.2.md +318 -0
  184. package/assets/pitfalls/styling-bem.2.md +125 -0
  185. package/assets/pitfalls/task-flow-archive.md +264 -0
  186. package/assets/pitfalls/task-flow-close.2.md +165 -0
  187. package/assets/pitfalls/task-flow-close.md +167 -0
  188. package/assets/pitfalls/task-flow-cycle.md +73 -0
  189. package/assets/pitfalls/task-flow-graph.needs-graph.md +98 -0
  190. package/assets/pitfalls/task-flow-handoff.md +200 -0
  191. package/assets/pitfalls/task-flow-handover.md +30 -0
  192. package/assets/pitfalls/task-flow-owner.md +29 -0
  193. package/assets/pitfalls/task-flow-plan.md +29 -0
  194. package/assets/pitfalls/task-flow-resume.md +257 -0
  195. package/assets/pitfalls/task-flow-start.md +287 -0
  196. package/assets/pitfalls/task-flow.2.md +303 -0
  197. package/assets/pitfalls/task-flow.md +4 -4
  198. package/assets/pitfalls/testing.2.md +279 -0
  199. package/assets/pitfalls/turn-conduct.md +16 -17
  200. package/assets/pitfalls/typescript-conventions.md +161 -0
  201. package/assets/pitfalls/write-a-skill.md +128 -0
  202. package/assets/rules/angular-patterns.md +21 -86
  203. package/assets/rules/autonomous-work.md +2 -2
  204. package/assets/rules/browser-verification.md +28 -256
  205. package/assets/rules/component-structure.md +25 -87
  206. package/assets/rules/dependencies.md +20 -78
  207. package/assets/rules/deploy-flow.azure.md +26 -156
  208. package/assets/rules/deploy-flow.github.md +34 -200
  209. package/assets/rules/deploy-flow.gitlab.md +27 -159
  210. package/assets/rules/doc-style.md +32 -286
  211. package/assets/rules/entity-conventions.needs-admin.md +26 -82
  212. package/assets/rules/entity-models.md +14 -63
  213. package/assets/rules/git-workflow-hosting.azure.md +26 -0
  214. package/assets/rules/git-workflow-hosting.github.md +38 -0
  215. package/assets/rules/git-workflow-hosting.gitlab.md +27 -0
  216. package/assets/rules/git-workflow-push.azure.md +28 -0
  217. package/assets/rules/git-workflow-push.github.md +28 -0
  218. package/assets/rules/git-workflow-push.gitlab.md +28 -0
  219. package/assets/rules/git-workflow-queue.azure.md +23 -0
  220. package/assets/rules/git-workflow-queue.github.md +30 -0
  221. package/assets/rules/git-workflow-queue.gitlab.md +23 -0
  222. package/assets/rules/git-workflow.azure.md +21 -282
  223. package/assets/rules/git-workflow.github.md +24 -284
  224. package/assets/rules/git-workflow.gitlab.md +21 -269
  225. package/assets/rules/lib-layers.md +30 -103
  226. package/assets/rules/lists.md +21 -105
  227. package/assets/rules/navigation.md +10 -69
  228. package/assets/rules/reuse-first.md +20 -195
  229. package/assets/rules/spec-driven.md +35 -308
  230. package/assets/rules/styling-bem.md +20 -117
  231. package/assets/rules/task-flow-handover.md +24 -0
  232. package/assets/rules/task-flow-owner.md +34 -0
  233. package/assets/rules/task-flow-plan.md +38 -0
  234. package/assets/rules/task-flow.md +22 -300
  235. package/assets/rules/testing.md +32 -273
  236. package/assets/rules/turn-conduct.md +100 -104
  237. package/assets/rules/turn-entry.md +2 -2
  238. package/assets/rules/typescript-conventions.md +41 -147
  239. package/assets/samples/tasks/_template/plan.md +30 -6
  240. package/assets/samples/tasks/_template/progress.md +0 -1
  241. package/assets/skills/agent-kit-extend.md +25 -168
  242. package/assets/skills/agent-kit.md +27 -299
  243. package/assets/skills/write-a-skill.md +20 -106
  244. package/assets/task-flow/flow.js +188 -0
  245. package/assets/task-flow/flow.md +102 -0
  246. package/assets/task-flow/measure/agreement.mjs +24 -0
  247. package/assets/task-flow/measure/copy.mjs +22 -0
  248. package/assets/task-flow/measure/epic-of.mjs +50 -0
  249. package/assets/task-flow/measure/epic-text.mjs +35 -0
  250. package/assets/task-flow/measure/epic.mjs +114 -0
  251. package/assets/task-flow/measure/folder.mjs +16 -0
  252. package/assets/task-flow/measure/footprint.mjs +28 -0
  253. package/assets/task-flow/measure/grill.mjs +21 -0
  254. package/assets/task-flow/measure/host.mjs +8 -0
  255. package/assets/task-flow/measure/owner.mjs +20 -0
  256. package/assets/task-flow/measure/plan.mjs +27 -0
  257. package/assets/task-flow/measure/pr.mjs +20 -0
  258. package/assets/task-flow/measure/progress.mjs +50 -0
  259. package/assets/task-flow/measure/session.mjs +175 -0
  260. package/assets/task-flow/measure/task.mjs +23 -0
  261. package/assets/task-flow/measure/text.mjs +77 -0
  262. package/assets/task-flow/source/git.mjs +86 -0
  263. package/assets/task-flow/source/host.mjs +172 -0
  264. package/assets/task-flow/source/marks.mjs +56 -0
  265. package/assets/task-flow/source/owner.mjs +74 -0
  266. package/assets/task-flow/source/records.mjs +116 -0
  267. package/assets/task-flow/source/session.mjs +232 -0
  268. package/assets/task-flow/source/steps.mjs +28 -0
  269. package/assets/task-flow/source/tree.mjs +42 -0
  270. package/bin/agent-kit.d.ts.map +1 -1
  271. package/bin/agent-kit.js +30 -0
  272. package/bin/agent-kit.js.map +1 -1
  273. package/lib/agent-checks.d.ts +55 -0
  274. package/lib/agent-checks.d.ts.map +1 -0
  275. package/lib/agent-checks.js +209 -0
  276. package/lib/agent-checks.js.map +1 -0
  277. package/lib/assets.d.ts.map +1 -1
  278. package/lib/assets.js +7 -2
  279. package/lib/assets.js.map +1 -1
  280. package/lib/cargo.d.ts +29 -0
  281. package/lib/cargo.d.ts.map +1 -1
  282. package/lib/cargo.js +27 -1
  283. package/lib/cargo.js.map +1 -1
  284. package/lib/cascade.d.ts.map +1 -1
  285. package/lib/cascade.js +3 -1
  286. package/lib/cascade.js.map +1 -1
  287. package/lib/commands.d.ts.map +1 -1
  288. package/lib/commands.js +78 -2
  289. package/lib/commands.js.map +1 -1
  290. package/lib/config.d.ts +18 -0
  291. package/lib/config.d.ts.map +1 -1
  292. package/lib/config.js +18 -1
  293. package/lib/config.js.map +1 -1
  294. package/lib/epic-window-send.d.ts +74 -0
  295. package/lib/epic-window-send.d.ts.map +1 -0
  296. package/lib/epic-window-send.js +166 -0
  297. package/lib/epic-window-send.js.map +1 -0
  298. package/lib/hooks-map.d.ts +4 -0
  299. package/lib/hooks-map.d.ts.map +1 -1
  300. package/lib/hooks-map.js +2 -2
  301. package/lib/hooks-map.js.map +1 -1
  302. package/lib/integrity.d.ts +3 -0
  303. package/lib/integrity.d.ts.map +1 -1
  304. package/lib/integrity.js +7 -0
  305. package/lib/integrity.js.map +1 -1
  306. package/lib/metric-lines.d.ts +2 -1
  307. package/lib/metric-lines.d.ts.map +1 -1
  308. package/lib/metric-lines.js +49 -1
  309. package/lib/metric-lines.js.map +1 -1
  310. package/lib/metric-send-mark.d.ts +6 -3
  311. package/lib/metric-send-mark.d.ts.map +1 -1
  312. package/lib/metric-send-mark.js +15 -5
  313. package/lib/metric-send-mark.js.map +1 -1
  314. package/lib/metric-send.d.ts +6 -2
  315. package/lib/metric-send.d.ts.map +1 -1
  316. package/lib/metric-send.js +47 -13
  317. package/lib/metric-send.js.map +1 -1
  318. package/lib/metrics.d.ts +17 -0
  319. package/lib/metrics.d.ts.map +1 -1
  320. package/lib/metrics.js +26 -15
  321. package/lib/metrics.js.map +1 -1
  322. package/lib/observations.js +3 -3
  323. package/lib/observations.js.map +1 -1
  324. package/lib/outcomes.d.ts +5 -2
  325. package/lib/outcomes.d.ts.map +1 -1
  326. package/lib/outcomes.js +5 -4
  327. package/lib/outcomes.js.map +1 -1
  328. package/lib/push-gate.d.ts +13 -0
  329. package/lib/push-gate.d.ts.map +1 -1
  330. package/lib/push-gate.js +11 -7
  331. package/lib/push-gate.js.map +1 -1
  332. package/lib/push-set-usefulness.d.ts +78 -0
  333. package/lib/push-set-usefulness.d.ts.map +1 -0
  334. package/lib/push-set-usefulness.js +225 -0
  335. package/lib/push-set-usefulness.js.map +1 -0
  336. package/lib/sync.d.ts +10 -0
  337. package/lib/sync.d.ts.map +1 -1
  338. package/lib/sync.js +14 -1
  339. package/lib/sync.js.map +1 -1
  340. package/lib/work-result.d.ts +43 -0
  341. package/lib/work-result.d.ts.map +1 -0
  342. package/lib/work-result.js +39 -0
  343. package/lib/work-result.js.map +1 -0
  344. package/package.json +1 -1
  345. package/assets/hooks/claim-guard.sh +0 -212
  346. package/assets/hooks/grill-gate-ask.sh +0 -26
  347. package/assets/hooks/grill-gate-bypass.sh +0 -61
  348. package/assets/hooks/grill-gate-options.sh +0 -50
  349. package/assets/hooks/grill-gate.sh +0 -482
  350. package/assets/hooks/postmortem-guard.sh +0 -124
  351. package/assets/hooks/proposal-guard.sh +0 -154
  352. package/assets/hooks/stand-login-guard.sh +0 -107
  353. package/assets/hooks/turn-exit-epic.sh +0 -173
  354. package/assets/hooks/turn-exit-patterns.sh +0 -123
  355. package/assets/hooks/turn-exit-verdict.sh +0 -149
  356. package/assets/hooks/waiting-turn-guard.sh +0 -320
  357. package/assets/hooks/work-start-guard.sh +0 -175
@@ -19,32 +19,45 @@ demand, not with the rule.
19
19
  | In the law | Here |
20
20
  | --- | --- |
21
21
  | turn | one pass of the agent: from the owner's message to the reply |
22
- | a turn exit | one of the ways to end a turn listed below; what confirms each — the turn map |
23
- | the guard of turn exits | a guard at the turn's end: reads the declared work state and what the turn did in the tree |
22
+ | a turn exit | the end of the scenario or the owner's stop word; the other release cases of the task flow description |
23
+ | the guard of turn exits | a guard at the turn's end: asks the engine to measure the branch by the task flow description |
24
+ | the agent hook of the turn's end | a model at the turn's end: reads the owner's last message, the reply and the calls of the turn |
24
25
  | a statement about the state of the tree | a word in the reply to the owner backed by a command of the same turn and its output |
25
26
  | the session handover | a section of the progress retelling it for a new session; a file outside the tree where there is no task folder |
26
27
  | the compaction threshold and the stop threshold | two window-fill numbers the tree sets itself; the first stands below the second |
27
28
 
28
29
  ## Turn exits
29
30
 
30
- A turn ends in four ways: a question to the owner the rules do not answer **and no task of the epic plan
31
- to take without the answer**; a guard's refusal; a
32
- filled window where there is no compaction; work handed in, with the next begun. What confirms
33
- each, the turn map lists where the tree laid it out. While an epic has an unfinished task, the
34
- fourth does not end a turn: the next task is worked on in it. The end of the epic is the fifth.
31
+ A turn ends when the scenario is over or when the owner's last word is a stop word. The owner put it
32
+ so: «Только твоё «стоп»». The exit guard measures the branch by the task flow description and holds
33
+ every other turn with the one move that comes next, unless a release case below is met.
34
+
35
+ <!-- flow:turn-end -->
36
+ The engine lets a turn end before the scenario does when a case is met, asked in this order:
37
+
38
+ - **1** · the end of the scenario — `any(measure.epic.finished, all(measure.copy.outsideEpic, measure.pr.handed))`
39
+ - **2** · a stop word of the owner — `measure.owner.saidStop`
40
+ - **3** · a background task of the session runs — `all(measure.session.waiting, not(measure.pr.handed))`
41
+ - **4** · no write to the tree, or a branch outside the scenario — `any(measure.copy.outOfScenario, all(not(measure.session.wrote), not(measure.owner.nudged)))`
42
+ - **5** · a role session — `measure.session.role`
43
+ - **6** · the host did not answer twice — `measure.host.silent`
44
+ - **8** · the menu did not reach the owner — `measure.session.menuLost`
45
+ <!-- /flow:turn-end -->
46
+
47
+ A question to the owner, a guard's refusal, a handover and handed-in work do not end a turn. A
48
+ question waits for its answer inside the turn, a refusal is answered by the next call, and handed-in
49
+ work is followed by the next task. A step that another guard refuses twice
50
+ goes to the owner as one menu with the options of the description: «отложить RT-N», «стоп».
35
51
 
36
52
  The queue is asked by a command in the same turn: "there are no tasks" is a statement about the
37
- tree, and the executor's memory does not confirm it. A turn where the owner's answer holds one
38
- piece of work while an independent one lies next to it ends with the work taken, and the question
39
- goes in a line beside it.
53
+ tree, and the executor's memory does not confirm it.
40
54
 
41
- Everything else is the turn going on, not its end. A milestone does not end a turn: not a commit,
42
- not a read agreement, not the boundary "read — now editing", not a green check.
43
- A transition from state to state — least of all: the next mandatory action is done in the same
44
- turn, and a state boundary looks like a finished piece better than any milestone.
55
+ Everything else is the turn going on. A milestone does not end a turn: not a commit, not a read
56
+ agreement, not the boundary "read — now editing", not a green check.
57
+ A transition from state to state — least of all: the next mandatory action is done in the same turn.
45
58
 
46
- Four ways to end a turn look like work and are not: a summary of someone else's step, a menu under
47
- an assigned order, a declaration of intent, and a command named but not run.
59
+ Four stops look like work and are not: a summary of someone else's step, a menu under an assigned
60
+ order, a declaration of intent, and a command named but not run.
48
61
 
49
62
  A turn ending while an epic runs shows the owner their position by the epic's table: otherwise they cannot see the queue's state.
50
63
 
@@ -59,24 +72,19 @@ One turn: what it ends with, what is checked before its end and what the owner i
59
72
 
60
73
  ```mermaid
61
74
  flowchart TD
62
- A[The turn is going] --> B{What happened}
63
- B -->|A question to the owner, and no queue task free of its answer| C[Laws and rules read in the same turn]
64
- B -->|The epic ended| L[Its task table shown, orders awaited]
65
- L --> I
66
- B -->|A guard refused an edit| D[The refusal named to the owner, no bypass sought]
67
- B -->|The window is filled| E{The tree declared compaction}
68
- B -->|Work handed in by a PR| F[An action done on the next task, not spoken]
69
- B -->|None of these| G[The turn goes on: a milestone never ends it]
70
- E -->|Yes| G
71
- E -->|No| H[Progress written up, handover written]
72
- C --> I{The reply speaks of the tree}
73
- D --> I
74
- F --> I
75
- H --> I
75
+ A[The turn is going] --> B{The engine measures the branch}
76
+ B -->|The scenario is over| L[The epic table shown]
77
+ B -->|The owner's last word is a stop word| I
78
+ B -->|Another release case of the description| I
79
+ B -->|None| D{The next move}
80
+ D -->|The executor's step| G[Done in the same turn: a question, a refusal, a handover never end it]
81
+ D -->|Another guard refuses it twice| M[One menu: «отложить RT-N», «стоп»]
82
+ M --> A
83
+ G --> A
84
+ L --> I{The reply speaks of the tree}
76
85
  I -->|Yes| J[Every word carries a command of the same turn and its output]
77
86
  I -->|No| K[The turn is over]
78
87
  J --> K
79
- G --> A
80
88
  ```
81
89
 
82
90
  ## How the law applies here
@@ -106,8 +114,7 @@ flowchart TD
106
114
  - **No order at all is a lawful state, and it is said, not filled.** A queue card is not an order.
107
115
  The turn names that there is no order and asks for one.
108
116
  - **A standing order is written into the progress in the owner's words.** Read once, «merge every
109
- PR» is lost at the first refusal; a decision along the way carries it. Not the waiting line:
110
- the exit guard reads any quote there as a word about a stop.
117
+ PR» is lost at the first refusal; a decision along the way carries it, quoted.
111
118
  - **Done work is shown on the running application built from it.** Host pages show delivery, not
112
119
  «what did you do».
113
120
  - **A declaration of intent.** "Taking the next task" is not taking it: the phrase lives to the end
@@ -138,15 +145,11 @@ flowchart TD
138
145
  - **A stop is named in a message of its own.** Not in a line at the end of a report: there it drowns
139
146
  — the owner reads a report as an account of the done. Three things are named: what stands, what it
140
147
  waits for and what the owner can decide.
141
- - **Turn exits are watched by a guard, not by the executor's memory.** It reads the declared work state and what
142
- the turn did on it: a file edit or a tree-changing command. A turn with neither returns to the
143
- executor with the next step from the progress.
144
- - **A removed task folder lifts the state requirement and does not end the turn.** The progress
145
- leaves with the folder, taken apart before the PR opens; a removed folder means the middle of
146
- handing in, not its end. From there the turn is judged by the second sign.
147
- - **Work without a branch and without a task folder is judged by the same guard by the second
148
- sign.** It has no state, and the first sign has nowhere to come from — but a turn with no edit of
149
- the tree does not end here either.
148
+ - **Turn exits are watched by a guard, not by the executor's memory.** It asks the engine, and the
149
+ engine measures the state of the branch: nothing is declared. What the reply says — a promise, a
150
+ report instead of the next step — the agent hook on the same event judges by meaning.
151
+ - **A removed task folder lifts the state requirement.** The progress leaves with the folder, taken
152
+ apart before the PR opens; a removed folder means the middle of handing in, not its end.
150
153
  - **A taken task is not yet begun work, and the turn does not end on it.** Creating the branch,
151
154
  moving the column and naming the number are preparation: the mandatory action of `задача-взята` is
152
155
  not done by a single line. An epic branch, named by the header of its plan, carries no folder by
@@ -157,71 +160,61 @@ flowchart TD
157
160
  - **A reply to the owner is not an action and does not stand last in a turn.** The order inside a
158
161
  turn is one: work, the first step of the next, then text; what was done is said after the next
159
162
  action, not instead of it.
160
- - **The last action of a turn is only ever work.** One sign for every kind of stop: a file edit or a
161
- changing command — last among what the turn did. The guard's tiers — exploration, waiting, handing
162
- in without starting the next — only derive a readable refusal from it.
163
+ - **The last action of a turn is only ever work.** A file edit or a changing command stands last
164
+ among what the turn did. The exit guard does not read the last call: a turn whose scenario is not
165
+ over is held whatever stood last, unless a release case is met.
163
166
  - **Waiting for someone else's step is never the last action of a turn.** While they are waited for,
164
167
  the work stays where it stood. The last action is judged: waiting mid-turn is lawful, and so is a
165
- launch in the background mid-turn. Standing last, it is an announcement of intent: what does not depend on it is done while it runs.
168
+ launch in the background mid-turn. Standing last, it ends the turn only as a wait the record shows: a background task of the session with no end, younger than twenty minutes, once per task and not after the work is handed over. What does not depend on it is done first.
166
169
  - **The handover is written even where the branch has no name.** All of it lies in the tree and is
167
170
  reachable on a detached head; one file needs a name, and a short snapshot of the head gives it.
168
171
  Otherwise compaction comes without a handover, and the next session starts from a blank.
169
- - **A next step written into the progress is begun by the same turn.** The guard reads the order
170
- of actions: after the last edit of the progress it wants work other than the commit and the push
171
- of it. A full report and a moved stage number do not replace the step.
172
- - **A plan stage is declared closed only after its check command has passed.** The "Verified by"
173
- (`Чем проверяется`) line carries the command in backticks and what in its output means "matches".
174
- The guard reads the previous stage number from the branch history and holds a turn where the
175
- number grew and the command did not run.
176
- - **The end of an epic is a stop, and it is the one lawful waiting for a word.** The turn shows
177
- the epic's tasks in the table of rule `status-report`, not the handover's, and says that the
178
- session waits for orders. On the main branch the epic is not read.
172
+ - **A next step written into the progress is begun by the same turn.** The held turn names the
173
+ current step and the command that measures it. A full report and a moved stage number do not
174
+ replace the step.
175
+ - **A plan stage is declared closed only after its check command has passed.** Every step of the
176
+ plan carries a check line: a command in backticks and the expected output. The engine runs it and
177
+ writes the mark of the step; a step marked done without its mark is refused.
178
+ - **The end of an epic is the end of the scenario, and the turn ends there.** The turn shows the
179
+ epic's tasks in the table of rule `status-report`, not the handover's; new work is taken by the
180
+ owner's word, given in the permission window the guard opens on the call that takes it — not
181
+ guessed from the conversation. On the main branch the epic is not read.
179
182
  <!-- rt-when: ответ владельцу о состоянии работы -->
180
183
 
181
184
  - **A step of the plan that is not done forbids a stop, and a report about the done is not an
182
- exception.** The tier about the epic judges the whole and says nothing about a turn inside one
183
- task. The count is read from the progress; lawful exits stay as they were.
185
+ exception.** The engine counts the steps by their marks, and a running stage holds the turn
186
+ whatever the report says.
184
187
  - **The word about a stop the guard reads from the owner, not from the executor.** Otherwise the
185
188
  stop is declared by whoever finds it convenient, and the ban holds until the first inconvenience.
186
- - **Until the epic is closed a turn ends only by a question, a refusal, the window or the owner's
187
- word.** A turn that ended with
188
- work is a stop all the same, and so is a second pass over the same turn: the exit guard returns
189
- both with the next step named.
190
- - **The owner's standing word about a stop is quoted in the progress, in « », in the line «Waiting
191
- for the owner».** The guard reads their word, not a retelling: a line without a quote releases
192
- nothing, and a quote holds until the owner cancels it. A word said in this turn releases by itself.
189
+ - **Until the scenario is over a turn ends only by the owner's stop word or by a release case.** A question, a refusal, a
190
+ handover and a second pass are the turn going on: the exit guard returns each with the next move
191
+ named. The other release cases of the description are not the executor's to choose.
192
+ - **The owner's word about a stop is read from the record of the session, not from the progress.**
193
+ A stop written on disk by the executor is a retelling. The guard reads the owner's last message,
194
+ typed or the free text of a menu answer, and a stop word holds only while that message is the last.
193
195
  - **The session is ended by the owner and by nobody else.** The tool that closes the conversation is
194
196
  refused by a guard always, with no lawful form of bypass: an assignment stands until the owner
195
197
  cancels it, and a session that must close is closed by them.
196
- - **A refusal of a guard ends the turn only as its last action, and only a refusal of work.** A
197
- refusal answered by the next call is the middle of the turn. A refused stop — the closing tool —
198
- is no exit: the refused call was itself the stop, and the exit guard leaves it out.
199
- - **The phrase "waiting for your word" is a stop declared by the executor, and the guard refuses it
200
- by name.** Without the owner's word about a stop in the turn and without a question put to them by
201
- the tool, waiting for their word is a report, not work; the instruction holds until they cancel
202
- it.
203
- - **A statement about the tree's state is watched by the statement guard, not by the executor's
198
+ - **A refusal of a guard never ends the turn.** It is answered by the next call: the condition met,
199
+ another step taken, or the owner's menu put to them. A refused stop — the
200
+ closing tool — is no exit either.
201
+ - **The phrase "waiting for your word" is a stop declared by the executor.** Without the owner's stop
202
+ word, waiting for their word is a report, not work. A decision that is theirs goes to them as a
203
+ menu, and the turn waits for the answer inside itself. The agent hook judges it by meaning.
204
+ - **A statement about the tree's state is watched by the agent hook, not by the executor's
204
205
  memory.** Everything the reply says about the tree carries a command and its output; said without
205
- one, it is no statement — not "checked", not "cleared", not "done". The guard reads the turn's
206
- text to the owner and looks for a command of the same turn; each word has its own kind of
207
- command.
208
- - **The statement guard waits for the reply text rather than judging the record as it found it.**
209
- The text lands in the turn record no earlier than the host calls the hook. Not having waited, the
210
- guard returns the turn: an empty record means not "nothing to say" but "nothing to read".
211
- - **The guard catches a statement word, not a wrong conclusion.** About a sample judged by one file
212
- there is nothing to judge by: no word and no command to compare with. This is the guard's known boundary; the articles below hold it, not the guard.
213
- - **A turn about someone else's step is watched by the waiting guard, not by the executor's
214
- memory.** It refuses a turn's end where someone else's step was spoken of and nothing was done on
215
- the next task — no task created, no branch, no folder, no column moved. Someone else's step it
216
- knows by two signs: a PR opened or a red run read in the turn.
206
+ one, it is no statement — not "checked", not "cleared", not "done". The hook reads the reply and
207
+ the results of the turn's calls.
208
+ - **A wrong conclusion from a right command is not judged.** About a sample judged by one file there
209
+ is nothing to compare with. This is the hook's known boundary; the articles below hold it.
210
+ - **A turn that handed work in does not end before the next task is begun.** Someone else's step —
211
+ the run, the review, the merge — goes without the executor. Handed-in work is a measured state, and
212
+ its exit is the next task of the epic taken.
217
213
  - **A turn that handed work in carries it to a lifted draft.** A draft's merge button is locked by
218
214
  the host, and in the PR list ready cannot be told from unfinished. The next task is taken on top
219
- of that, not instead. The waiting guard demands a command of the same turn about the state of the
220
- handed-in work.
221
- - **The waiting guard's refusal is lifted by both actions at once.** The taken next task carries the
222
- open-PR sign away, and the demand to ask the handed-in work's state never sounds after it.
215
+ of that, not instead.
223
216
  - **Work left in the working tree does not end the turn.** A branch ahead of the remote ref with no
224
- open PR is done work nobody sees; the guard reads this without the network.
217
+ open PR is done work nobody sees, and the scenario goes on until the PR.
225
218
  - **"Waiting for the run" is a statement about someone else's step, not a work state.** A run may be
226
219
  green in an hour, or may never have started — and the second does not fix itself. The word demands
227
220
  a command of the same turn that shows the run; said bare, the owner reads it as "the work is still
@@ -231,8 +224,7 @@ flowchart TD
231
224
  repeated idly or not at all — the work does not move.
232
225
  - **A run nobody started by hand is watched the same as a rerun, and the opened PR starts it.** The
233
226
  pipeline wakes by itself: the turn holds no starting command, and one read of the state closes
234
- nothing. Read as going, the run goes under a wait in the same turn — the waiting guard watches
235
- the pair "the request opened here, its run read as going".
227
+ nothing. Read as going, the run goes under a wait in the same turn.
236
228
  - **A green run is carried to a lifted draft by the one who handed the work over, a red one is
237
229
  fixed in the same branch.** The owner sees a locked button and reads it as work still going. The
238
230
  wait runs in the background, next to the next work.
@@ -249,10 +241,9 @@ flowchart TD
249
241
  For a call with a reading twin, the kind is chosen by the action, not the command's name.
250
242
  - **A turn in which a question was put to the owner does not end until laws and rules were read in
251
243
  that same turn.** Reading is any of three roads: loading a rule, reading a file of laws or rules,
252
- a search over them. With edits in the turn, only the rule the gate demands counts, and the
253
- refusal names it. The guard refuses on the question tool before the menu leaves, and at
254
- the turn's end for a question in prose. What was found lands in the grill section "What the
255
- rules already say".
244
+ a search over them. What was found lands in the grill section "What the rules already say". The
245
+ agent hook of the question tool holds a question a rule or a spec answers plainly; whether the
246
+ reading was done in the same turn no check counts.
256
247
  - **The owner's answer is sought in their own messages before the rules.** The law says a question
257
248
  with a written answer is not put to the owner, and the most reachable record lies in the
258
249
  conversation: the owner's first message and their answers to past rounds.
@@ -273,9 +264,8 @@ flowchart TD
273
264
  - **The sign of irreversibility is taken from the list, not derived by argument.** The list was
274
265
  drawn up by someone who already weighed reversibility, and an argument cancels it silently. Actions outside the list the executor does not gate.
275
266
  - **A turn in which the executor admitted a miss does not end until the incident record exists.**
276
- The incident guard refuses at the turn's end. The records directory is named by the rule's companion, the file name is the date and
277
- the miss, the form — the layout template. The admission is caught by a set of samples: a miss
278
- admitted in words outside the set the guard lets through.
267
+ The agent hook refuses at the turn's end. The records directory is named by the rule's companion,
268
+ the file name is the date and the miss, the form — the layout template.
279
269
  - **A session begun from a handover enters the work by the same rule as any other.** The handover
280
270
  was written by a past session, no check reads it, and it describes yesterday: everything in it is
281
271
  checked against the tree. The entry order is four steps in the resume pattern; a guard watches it,
@@ -306,12 +296,18 @@ flowchart TD
306
296
 
307
297
  ## What of the law is not here
308
298
 
309
- Nothing checks the completeness of what is said to the owner: the statement guard catches a
310
- statement word and looks for a command of the same turn; a wrong conclusion from a right command it
311
- cannot judge — there is nothing to compare with.
299
+ Nothing checks the completeness of what is said to the owner: the agent hook judges whether a result
300
+ of the turn shows a statement; a wrong conclusion from a right command it cannot judge — there is
301
+ nothing to compare with.
302
+
303
+ What a turn said is judged by a model, and a model can let a case pass. The hook is told to let a
304
+ doubtful turn end: a false refusal costs the owner a repeated answer, a missed one is visible in the
305
+ reply. A broken or timed-out hook lets every turn end, and that shows only as the absence of its
306
+ mark in the transcripts.
312
307
 
313
- An admission of a miss is caught by samples, not by understanding: words outside the set the
314
- incident guard lets through. That is its known boundary, not a promise.
308
+ The exit guard measures, it does not judge meaning. An engine that fails, runs past its limit or
309
+ cannot be called releases the turn and writes the failure to the journal; the next turn begins with
310
+ that line.
315
311
 
316
312
  ## Patterns
317
313
 
@@ -19,7 +19,7 @@ into the session.
19
19
  | --- | --- |
20
20
  | session entry | what the startup hook puts into the context before the first reply |
21
21
  | what the past session handed over | the "Session handover" section in the progress of this branch; for work without a task folder — a file named after the branch in the handovers directory. The hook writes it before context compaction |
22
- | the order of conducting work | the turn map — the states with their mandatory actions and the four turn exits |
22
+ | the order of conducting work | the turn map — the states with their mandatory actions and the two ends of a turn |
23
23
  | a launch | first launch, resume, context compaction, clear |
24
24
 
25
25
  ## Where it lives
@@ -41,7 +41,7 @@ flowchart TD
41
41
  B2 -->|No| D[Nothing is said about a handover]
42
42
  C --> E{The turn map resource is laid out}
43
43
  D --> E
44
- E -->|Yes| F[The map goes next: states, actions, four exits]
44
+ E -->|Yes| F[The map goes next: states, actions, two ends of a turn]
45
45
  E -->|No| G[Nothing is said about a map]
46
46
  F --> H[The hook exits with zero: the launch is refused on no outcome]
47
47
  G --> H
@@ -7,160 +7,54 @@ description: Rule under the code-structure law. Load when editing any .ts except
7
7
 
8
8
  # Code structure — how it works here
9
9
 
10
- Rule under the law `docs/constitution/code-structure.md`. The law says what must be true about
11
- declarations; here — how that is written in this tree.
12
-
13
- ## What it is called here
14
-
15
- | In the law | Here |
16
- | ----------------------------- | -------------------------------------------------------------------- |
17
- | the kind sign in the name | a prefix: `I` on an interface, `E` on an enum, `T` on a type |
18
- | a watched source | the `$` suffix on an observable and `Source` on a subject |
19
- | a private field | `#field`, not `private field` |
20
- | a backend procedure | a class with the `@ConnectProcedure()` decorator, one per procedure |
21
-
22
- ## Where it lives
23
-
24
- In this tree — the table in `implementation.md` next to it. Paths live there, not here: the rule
25
- travels between repositories, the layout does not, and a path named in the rule lies in the
26
- first tree that keeps its code differently.
27
-
28
- ## Flow
29
-
30
- The flow of declaring a symbol: what sets the name, where the type comes from and what is done
31
- with a removed declaration.
32
-
33
- ```mermaid
34
- flowchart TD
35
- A[A symbol is declared] --> B[The kind shows in the name prefix, and the file suffix promises what lies inside]
36
- B --> C{The type is already declared somewhere}
37
- C -->|Yes| D[Taken from the package where it is declared: an own copy diverges from the original silently]
38
- C -->|No| E[Declared here]
39
- D --> F{The value arrives in the wrong shape}
40
- E --> F
41
- F -->|Yes| G[The cast goes by the named way; a two-step one is forbidden]
42
- F -->|No| H{The declaration is removed}
43
- G --> H
44
- H -->|Yes| I[The deprecation mark is set together with a walk over all consumers]
45
- H -->|No| J[The file stays within the length limit, complexity is asked from the plugin, not recalled]
46
- I --> J
47
- ```
10
+ Rule under the law `docs/constitution/code-structure.md`. Cold part: `pitfalls.md` — the whole text,
11
+ every section and article with its reasons.
48
12
 
49
13
  ## How the law applies here
50
14
 
51
- - **The kind of a declaration shows in the name prefix, and three linter rules hold that.** The
52
- interface, the type and the enum each have their own; all three are raised for all `.ts`.
53
- <!-- rt-when: *.ts -->
54
-
55
- - **A watched source is named by a suffix.** The subject and the observable raised from it differ
56
- at the place of use, not by jumping to the declaration.
57
- <!-- rt-when: *.ts -->
58
-
59
- - **The file name suffix finds the promised declaration inside.** The list of suffixes is closed:
60
- a word not in it does not count as a suffix, and the rule does not judge such a file.
61
- <!-- rt-when: *.ts -->
62
-
63
- - **A file is no longer than 500 lines, and all lines count — blank ones and comments too.** A
64
- file that does not fit on one screen whole is read in parts, and an edit in it is made without
65
- seeing the rest. For `.ts` a linter rule holds this; harness files — scenarios and scripts — do
66
- not reach it and are judged by a separate check of the tree. What had accumulated by the day of
67
- enabling is listed by name, and a line leaves that list together with the split of its file.
68
- <!-- rt-when: *.ts -->
69
-
70
- - **A value from a closed set arrives as an enum `E<Name>`, not as a string or a number at the
71
- place of use.** The key of a translatable field, a tab name, a cover slot, a record kind — all
72
- these are sets: the form, the store, the markup and the draft comparison name them, and a value
73
- written in place is neither found across the tree nor edited in one go. The enum lives in the
74
- `util` layer of the domain that owns the set, and what is shared by several applications — in
75
- the shared lib. A single address, a separator and a signature sign do not become an enum: they
76
- have no closed set, and they are declared as a file constant with a telling name.
77
- <!-- rt-when: *.ts -->
78
-
79
- - **A set that must be complete is declared as a full record over the key type, not a partial
80
- one.** A partial declaration makes a missing key lawful, and the shortage shows on the screen
81
- rather than at the build. The set that must answer for every key of another one is declared by
82
- that key type whole, and an unfilled key stops compiling. The type is silent about the value —
83
- an empty string and a copy of the key pass it — so the completeness of values is held by a test
84
- that walks the whole set, written by the same change as the declaration.
85
- <!-- rt-when: *.ts -->
15
+ - **The kind of a declaration shows in the name prefix, and three linter rules hold that.**
16
+ <!-- rt-when: *.ts -->
17
+ - **A watched source is named by a suffix.**
18
+ <!-- rt-when: *.ts -->
19
+ - **A file name suffix promises a declaration of that kind inside.**
20
+ <!-- rt-when: *.ts -->
21
+ - **A file is no longer than 500 lines, and all lines count — blank ones and comments too.**
22
+ <!-- rt-when: *.ts -->
23
+ - **A value from a closed set arrives as an enum `E<Name>`, not as a string or a number at the place
24
+ of use.**
25
+ <!-- rt-when: *.ts -->
26
+ - **A set that must be complete is declared as a full record over the key type, not a partial one.**
27
+ <!-- rt-when: *.ts -->
28
+ - **A type is taken from the package where it is declared.**
29
+ <!-- rt-when: *.ts -->
30
+ - **A value declared by one side of an exchange is not recomputed by the other side but taken from
31
+ the first.**
32
+ <!-- rt-when: *.ts -->
33
+ - **The two-step cast `as unknown as` is forbidden by a linter rule.**
34
+ <!-- rt-when: *.ts -->
35
+ - **A deprecation mark is set together with a walk over the consumers.**
36
+ <!-- rt-when: *.ts -->
86
37
 
87
- - **A type is taken from the package where it is declared.** An own copy of a foreign type
88
- diverges from the original silently, and only one of them compiles.
89
- <!-- rt-when: *.ts -->
90
-
91
- - **A value declared by one side of an exchange is not recomputed by the other side but taken
92
- from the first.** Two computations of one value diverge silently: the tree trait was computed by
93
- both the send and the mark — each with its own copy — the copies diverged, and the mark never
94
- once found a single record of its own. Both sides answered as usual all the while, and the miss
95
- was found only from a third side: by reading what actually landed.
96
- <!-- rt-when: *.ts -->
97
-
98
- - **The two-step cast `as unknown as` is forbidden by a linter rule.** Instead — an honest type,
99
- narrowing by a check or reading the field by shape (`Reflect.get`); a place where nothing else
100
- works is marked with a spot disable and the reason on the same line.
101
- <!-- rt-when: *.ts -->
102
-
103
- - **A deprecation mark is set together with a walk over the consumers.** All rules of
104
- `eslint-plugin-sonarjs` are raised to refusal at once, and a mark on a type paints every place
105
- that still calls it: one `@deprecated` per file gave seventeen findings in foreign domains.
106
- <!-- rt-when: *.ts -->
107
-
108
- ## What of the law is not here
109
-
110
- A one-step cast stays unchecked — that is `Q-CS-4` in the law: of seventy-six casts eight are
111
- mandatory, and a blanket ban would refuse them.
38
+ ## Pitfalls
112
39
 
113
- Tests are taken out from under the ban entirely: a hand-written database double is an accepted
114
- technique here, and the ban would have to be bypassed in each of the thirty-five.
40
+ - **Function complexity limits are asked from the plugin, not recalled.**
41
+ - **A decision is moved into a pure function of the util layer before the handler is written.**
42
+ - **A file an edit pushed past the 500-line limit is split, not squeezed.**
115
43
 
116
- The file-name rule judges a promise, not its absence: `menu.items.ts` and `sign-in.ts` do not
117
- fall under it at all — that is `Q-CS-3` in the law. Of the two mapper forms accepted here — a
118
- class on the front end and pure functions on the backend — the rule accepts both: it judges the
119
- name, not the structure, and that there are two forms remains the question `Q-S-1` in the
120
- shared-code law.
44
+ ## Names and techniques
121
45
 
122
- On `libs/api/**` and `apps/api/**` the rule applies whole, but the signal API and `inject` do
123
- not belong there: that is NestJS with constructor DI.
46
+ - Prefix `I` on an interface, `E` on an enum, `T` on a type.
47
+ - Suffix `$` on an observable, `Source` on a subject.
48
+ - A private field is `#field`, not `private field`; `protected` where `viewChild` needs it.
49
+ - An enum lives in the owner domain's `util`; a value with no closed set is a file constant.
50
+ - Completeness of values is held by a test over the whole set, in the same change.
51
+ - Use an honest type, narrowing or `Reflect.get`; else a spot disable with its reason.
52
+ - On `libs/api`, `apps/api` no signals or `inject`: NestJS constructor DI.
53
+ - No `as Type` in a mapper; use `this.typeCast`.
54
+ - Remove an unused parameter; do not hide it behind an underscore.
55
+ - Do not annotate a Prisma aggregate with a type of your own.
56
+ - Enable a linter rule of your own together with fixing all it catches.
124
57
 
125
58
  ## Patterns
126
59
 
127
- - `ts-procedure` — create a Connect procedure on the backend: class, decorator, right,
128
- registration.
129
-
130
- ## Pitfalls
131
-
132
- - **Function complexity limits are asked from the plugin, not recalled.** Where the tree raised
133
- the `sonarjs` rules at once, to refusal, the branching and nesting numbers come as plugin
134
- defaults and are not written by a line of their own in the config: they change with its
135
- version while looking like a tree agreement. Over one task they were asked three times, each
136
- time anew, and twice named from memory — both times wrong.
137
-
138
- ```bash
139
- node -e 'const s = require("eslint-plugin-sonarjs");
140
- for (const n of ["cyclomatic-complexity", "cognitive-complexity", "nested-control-flow"])
141
- console.log(n, JSON.stringify(s.rules[n].meta.defaultOptions));'
142
- ```
143
-
144
- - **A decision is moved into a pure function of the util layer before the handler is written.** A
145
- choice over a closed set becomes a table keyed by the enumeration, and a chain of field checks
146
- becomes a list of checks. The handler calls them and keeps its branchings for its own flow: the
147
- complexity linter refused one file twice because both lay right in the handler and spent its limit.
148
- - **A file an edit pushed past the 500-line limit is split, not squeezed.** Joining comments or
149
- dropping blank lines lowers the count and leaves the file just as long to read, and the next
150
- edit hits the limit again. What the file does on its own moves out next to it: a mapping, a set of
151
- derived values.
152
-
153
- - A cast through `as Type` in a mapper is forbidden but watched by nothing: it accepts any value
154
- and compiles. Instead — `this.typeCast`.
155
- - An unused parameter is removed, not renamed: an underscore before the name hides the finding,
156
- but the parameter stays in the signature.
157
- - A Prisma aggregate is not annotated with its own type: its generated type is wider than the
158
- query result, and the annotation lies.
159
- - A linter rule of one's own is enabled together with converting everyone it catches: enabled on
160
- top of what has accumulated, it gives a red run on files the edit did not touch.
161
- - `#field` is visible only inside the class and is not accepted by `viewChild` — there the field
162
- is declared `protected`.
163
- - The linter does not count a logical assignment as a read of a private field: where `??=` is the
164
- only access to the field, the unused-private-members rule answers "is defined but never used".
165
- The field is live, and the message says the opposite, and whoever read the refusal goes to
166
- remove the declaration. The replacement — an explicit early return and an assignment after it.
60
+ - `ts-procedure` — a Connect procedure on the backend.
@@ -27,12 +27,18 @@ along the way.
27
27
  By this same table, at closing, one looks at which of the specs, rules and patterns went stale:
28
28
  what is named here is read twice — before the work and after it.>
29
29
 
30
- | What | Where |
31
- | ----- | -------------------------------- |
32
- | Specs | <domains the work touches> |
33
- | Laws | <laws along its footprint> |
34
- | Rules | <rules and their companions> |
35
- | Code | <libs and applications> |
30
+ | What | Where |
31
+ | ---------------- | -------------------------------- |
32
+ | Specs (правится) | <domains the work touches> |
33
+ | Laws | <laws along its footprint> |
34
+ | Rules | <rules and their companions> |
35
+ | Code (правится) | <libs and applications> |
36
+
37
+ A row the work edits carries the mark «(правится)» after its name; a row read only for context
38
+ carries none. Where the engine of the task flow is laid out, it measures the end of the stages by
39
+ the marked rows: after the commit of the plan the branch changes at least one file under every
40
+ path of every marked row. A plan with no marked row is judged only by its agreement directory under
41
+ `proposed/`.
36
42
 
37
43
  ## What counts as done
38
44
 
@@ -44,7 +50,9 @@ what is named here is read twice — before the work and after it.>
44
50
 
45
51
  - **Steps:**
46
52
  1. <what is done first>
53
+ Check: `<command>` → <expected>
47
54
  2. <what is done after it>
55
+ Check: `<command>` → <expected>
48
56
  - **Readiness sign:** <what must become true>
49
57
  - **Verified by:** `<command>` — <what in its output means "it matched">
50
58
 
@@ -52,6 +60,22 @@ The steps are the smallest unit of the work, and they are written here in full:
52
60
  mirrors this list with its marks, and a check matches the two by number and by name. A step is
53
61
  named by what is done, not by what is thought over — a line nobody can call done is not a step.
54
62
 
63
+ Under every step stands its check: the command in backticks, an arrow and the expected result in
64
+ one of the forms below. The parsing takes the word «Check:» and its Russian form alike, and the
65
+ check line is not part of the step name. Where the engine of the task flow is laid out, it runs the
66
+ command as the commit of the plan wrote it and marks the step only when the result matches.
67
+
68
+ <!-- flow:expect -->
69
+ | Form | Expected text | It matches when |
70
+ | --- | --- | --- |
71
+ | `exit` | `^exit (\d+)$` | the command exits with the code of the first group; the output is not compared |
72
+ | `line` | `` ^`(.*)`$ `` | the code is 0 and the last non-empty line of the output equals the first group |
73
+ | `regex` | `^/(.*)/$` | the code is 0 and the last non-empty line matches the first group |
74
+ | `number` | `^(=\|>=\|<=) ?(-?\d+)$` | the code is 0, the last non-empty line is an integer, and its comparison by the first group with the second holds |
75
+ <!-- /flow:expect -->
76
+
77
+ A command of the work itself — a commit, a push, a PR, a task or a layout — is never a check.
78
+
55
79
  The command is written in backticks: the turn exit guard reads it and does not let out a turn in
56
80
  which the stage is declared closed and the command was not run. An acceptance written in prose
57
81
  cannot be confirmed by anything. The command is run right here, while the plan is written, not at
@@ -9,7 +9,6 @@ Rewritten by every session, not appended to.
9
9
  - **Done:** <briefly>
10
10
  - **Next step:** <what is done first in the new session>
11
11
  - **Uncommitted:** <what lies in the tree outside the index>
12
- - **Waiting for the owner:** <what exactly, or "no"; the owner's standing word about a stop is quoted in « »>
13
12
  - **PR:** <number and state, or "not open yet">
14
13
 
15
14
  ## Steps