@cratis/pi 8.0.2 → 8.2.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 (490) hide show
  1. package/package/corpus/harnesses/copilot/instructions/ai-distribution.instructions.md +9 -102
  2. package/package/corpus/harnesses/copilot/instructions/authoring-skills.instructions.md +3 -5
  3. package/package/corpus/harnesses/copilot/instructions/browser.instructions.md +8 -49
  4. package/package/corpus/harnesses/copilot/instructions/code-health.instructions.md +1 -1
  5. package/package/corpus/harnesses/copilot/instructions/code-quality.csharp.instructions.md +3 -84
  6. package/package/corpus/harnesses/copilot/instructions/code-quality.instructions.md +6 -51
  7. package/package/corpus/harnesses/copilot/instructions/code-quality.typescript.instructions.md +4 -81
  8. package/package/corpus/harnesses/copilot/instructions/codescene.instructions.md +5 -54
  9. package/package/corpus/harnesses/copilot/instructions/components.instructions.md +1 -1
  10. package/package/corpus/harnesses/copilot/instructions/cratis-folder-is-configuration.instructions.md +5 -22
  11. package/package/corpus/harnesses/copilot/instructions/csharp.instructions.md +7 -315
  12. package/package/corpus/harnesses/copilot/instructions/dialogs.instructions.md +1 -1
  13. package/package/corpus/harnesses/copilot/instructions/discoverability.instructions.md +3 -25
  14. package/package/corpus/harnesses/copilot/instructions/documentation-structure-and-formatting.instructions.md +5 -151
  15. package/package/corpus/harnesses/copilot/instructions/documentation.instructions.md +5 -104
  16. package/package/corpus/harnesses/copilot/instructions/editing-cratis-docs.instructions.md +5 -63
  17. package/package/corpus/harnesses/copilot/instructions/efcore.instructions.md +8 -55
  18. package/package/corpus/harnesses/copilot/instructions/efcore.specs.instructions.md +3 -33
  19. package/package/corpus/harnesses/copilot/instructions/elixir.instructions.md +6 -79
  20. package/package/corpus/harnesses/copilot/instructions/exit-codes-and-wrappers.instructions.md +4 -27
  21. package/package/corpus/harnesses/copilot/instructions/framework-dotnet.instructions.md +4 -6
  22. package/package/corpus/harnesses/copilot/instructions/framework.instructions.md +0 -2
  23. package/package/corpus/harnesses/copilot/instructions/frontend-quality.instructions.md +0 -1
  24. package/package/corpus/harnesses/copilot/instructions/frontend-testing.instructions.md +1 -1
  25. package/package/corpus/harnesses/copilot/instructions/github-actions.instructions.md +7 -138
  26. package/package/corpus/harnesses/copilot/instructions/glossary.instructions.md +19 -19
  27. package/package/corpus/harnesses/copilot/instructions/go-engineering.instructions.md +1 -4
  28. package/package/corpus/harnesses/copilot/instructions/go.instructions.md +2 -7
  29. package/package/corpus/harnesses/copilot/instructions/guards-and-fuses.instructions.md +5 -6
  30. package/package/corpus/harnesses/copilot/instructions/java.instructions.md +7 -129
  31. package/package/corpus/harnesses/copilot/instructions/kotlin.instructions.md +8 -165
  32. package/package/corpus/harnesses/copilot/instructions/local-work-artifacts.instructions.md +4 -1
  33. package/package/corpus/harnesses/copilot/instructions/orleans.instructions.md +5 -98
  34. package/package/corpus/harnesses/copilot/instructions/profiles.instructions.md +9 -63
  35. package/package/corpus/harnesses/copilot/instructions/scripting.instructions.md +1 -1
  36. package/package/corpus/harnesses/copilot/instructions/specs.csharp.instructions.md +8 -148
  37. package/package/corpus/harnesses/copilot/instructions/specs.elixir.instructions.md +4 -37
  38. package/package/corpus/harnesses/copilot/instructions/specs.typescript.instructions.md +3 -1
  39. package/package/corpus/harnesses/copilot/instructions/storybook.instructions.md +7 -70
  40. package/package/corpus/harnesses/copilot/instructions/typescript.instructions.md +8 -98
  41. package/package/corpus/harnesses/copilot/instructions/writing-correct-examples.instructions.md +3 -47
  42. package/package/corpus/harnesses/copilot/instructions/writing-cratis-docs.instructions.md +3 -65
  43. package/package/corpus/hooks/README.md +16 -8
  44. package/package/corpus/hooks/scripts/cratis-cleanup-worktrees.sh +109 -6
  45. package/package/corpus/hooks/scripts/cratis-guard-shell-writes.sh +1 -1
  46. package/package/corpus/hooks/scripts/quality-gates.json +3 -5
  47. package/package/corpus/rules/ai-distribution.md +9 -102
  48. package/package/corpus/rules/authoring-skills.md +3 -5
  49. package/package/corpus/rules/browser.md +8 -49
  50. package/package/corpus/rules/code-health-policy.txt +4 -24
  51. package/package/corpus/rules/code-health.md +1 -1
  52. package/package/corpus/rules/code-quality.csharp.md +3 -84
  53. package/package/corpus/rules/code-quality.md +6 -51
  54. package/package/corpus/rules/code-quality.typescript.md +4 -81
  55. package/package/corpus/rules/codescene.md +5 -54
  56. package/package/corpus/rules/components.md +1 -1
  57. package/package/corpus/rules/cratis-folder-is-configuration.md +5 -22
  58. package/package/corpus/rules/csharp.md +7 -315
  59. package/package/corpus/rules/dialogs.md +1 -1
  60. package/package/corpus/rules/discoverability.md +3 -25
  61. package/package/corpus/rules/documentation-structure-and-formatting.md +5 -151
  62. package/package/corpus/rules/documentation.md +5 -104
  63. package/package/corpus/rules/editing-cratis-docs.md +5 -63
  64. package/package/corpus/rules/efcore.md +8 -55
  65. package/package/corpus/rules/efcore.specs.md +3 -33
  66. package/package/corpus/rules/elixir.md +6 -79
  67. package/package/corpus/rules/exit-codes-and-wrappers.md +4 -27
  68. package/package/corpus/rules/framework-dotnet.md +4 -6
  69. package/package/corpus/rules/framework.md +0 -2
  70. package/package/corpus/rules/frontend-quality.md +0 -1
  71. package/package/corpus/rules/frontend-testing.md +1 -1
  72. package/package/corpus/rules/general.md +2 -2
  73. package/package/corpus/rules/github-actions.md +7 -138
  74. package/package/corpus/rules/glossary.md +19 -19
  75. package/package/corpus/rules/go-engineering.md +1 -4
  76. package/package/corpus/rules/go.md +2 -7
  77. package/package/corpus/rules/guards-and-fuses.md +5 -6
  78. package/package/corpus/rules/java.md +7 -129
  79. package/package/corpus/rules/kotlin.md +8 -165
  80. package/package/corpus/rules/local-work-artifacts.md +4 -1
  81. package/package/corpus/rules/orleans.md +5 -98
  82. package/package/corpus/rules/profiles.md +9 -63
  83. package/package/corpus/rules/scripting.md +1 -1
  84. package/package/corpus/rules/specs.csharp.md +8 -148
  85. package/package/corpus/rules/specs.elixir.md +4 -37
  86. package/package/corpus/rules/specs.typescript.md +3 -1
  87. package/package/corpus/rules/storybook.md +7 -70
  88. package/package/corpus/rules/typescript.md +8 -98
  89. package/package/corpus/rules/writing-correct-examples.md +3 -47
  90. package/package/corpus/rules/writing-cratis-docs.md +3 -65
  91. package/package/corpus/skills/cratis-application-growth/SKILL.md +7 -54
  92. package/package/corpus/skills/cratis-application-growth/references/move-and-untangle.md +49 -0
  93. package/package/corpus/skills/cratis-application-growth/references/rename-window.md +12 -14
  94. package/package/corpus/skills/cratis-application-growth/references/stages.md +2 -2
  95. package/package/corpus/skills/cratis-arc-authorize-request/SKILL.md +2 -2
  96. package/package/corpus/skills/cratis-arc-authorize-request/references/csharp.md +3 -3
  97. package/package/corpus/skills/cratis-arc-authorize-request/references/kotlin.md +2 -2
  98. package/package/corpus/skills/cratis-arc-code-analysis-typescript/SKILL.md +10 -43
  99. package/package/corpus/skills/cratis-arc-code-analysis-typescript/references/rule-fixes.md +40 -0
  100. package/package/corpus/skills/cratis-arc-connect-storage/SKILL.md +1 -1
  101. package/package/corpus/skills/cratis-arc-connect-storage/references/csharp.md +1 -1
  102. package/package/corpus/skills/cratis-arc-declare-command/references/csharp.md +4 -4
  103. package/package/corpus/skills/cratis-arc-declare-command/references/go.md +1 -1
  104. package/package/corpus/skills/cratis-arc-declare-command/references/kotlin.md +6 -7
  105. package/package/corpus/skills/cratis-arc-declare-operation/SKILL.md +2 -8
  106. package/package/corpus/skills/cratis-arc-declare-operation/references/csharp.md +1 -1
  107. package/package/corpus/skills/cratis-arc-diagnose-live-query/SKILL.md +1 -1
  108. package/package/corpus/skills/cratis-arc-diagnose-live-query/references/csharp.md +1 -1
  109. package/package/corpus/skills/cratis-arc-expose-mcp-operation/SKILL.md +6 -12
  110. package/package/corpus/skills/cratis-arc-expose-mcp-operation/references/custom-exposure-and-audit.md +4 -0
  111. package/package/corpus/skills/cratis-arc-expose-query/SKILL.md +2 -2
  112. package/package/corpus/skills/cratis-arc-expose-query/references/csharp.md +11 -4
  113. package/package/corpus/skills/cratis-arc-expose-query/references/typescript.md +1 -1
  114. package/package/corpus/skills/cratis-arc-generate-proxies/SKILL.md +2 -2
  115. package/package/corpus/skills/cratis-arc-generate-proxies/references/csharp.md +1 -1
  116. package/package/corpus/skills/cratis-arc-generate-proxies/references/go.md +19 -2
  117. package/package/corpus/skills/cratis-arc-generate-proxies/references/typescript.md +1 -1
  118. package/package/corpus/skills/cratis-arc-host-application/SKILL.md +1 -1
  119. package/package/corpus/skills/cratis-arc-host-application/references/csharp.md +1 -2
  120. package/package/corpus/skills/cratis-arc-host-application/references/elixir.md +2 -2
  121. package/package/corpus/skills/cratis-arc-host-application/references/go.md +5 -1
  122. package/package/corpus/skills/cratis-arc-host-application/references/java.md +1 -1
  123. package/package/corpus/skills/cratis-arc-host-application/references/kotlin.md +1 -1
  124. package/package/corpus/skills/cratis-arc-host-application/references/typescript.md +1 -1
  125. package/package/corpus/skills/cratis-arc-identity-and-tenancy-kotlin/SKILL.md +4 -7
  126. package/package/corpus/skills/cratis-arc-invoke-command/SKILL.md +1 -1
  127. package/package/corpus/skills/cratis-arc-invoke-command/references/csharp.md +4 -4
  128. package/package/corpus/skills/cratis-arc-invoke-command/references/typescript.md +1 -1
  129. package/package/corpus/skills/cratis-arc-isolate-tenant/SKILL.md +2 -2
  130. package/package/corpus/skills/cratis-arc-isolate-tenant/references/csharp.md +2 -2
  131. package/package/corpus/skills/cratis-arc-isolate-tenant/references/elixir.md +1 -1
  132. package/package/corpus/skills/cratis-arc-isolate-tenant/references/java.md +1 -1
  133. package/package/corpus/skills/cratis-arc-isolate-tenant/references/kotlin.md +1 -1
  134. package/package/corpus/skills/cratis-arc-isolate-tenant/references/typescript.md +4 -2
  135. package/package/corpus/skills/cratis-arc-migrate-relational-schema/SKILL.md +6 -6
  136. package/package/corpus/skills/cratis-arc-page-query/SKILL.md +3 -3
  137. package/package/corpus/skills/cratis-arc-page-query/references/csharp.md +10 -6
  138. package/package/corpus/skills/cratis-arc-page-query/references/elixir.md +2 -2
  139. package/package/corpus/skills/cratis-arc-page-query/references/java.md +1 -1
  140. package/package/corpus/skills/cratis-arc-page-query/references/kotlin.md +1 -1
  141. package/package/corpus/skills/cratis-arc-react-bind-slice/SKILL.md +2 -2
  142. package/package/corpus/skills/cratis-arc-react-bind-slice/references/csharp.md +1 -1
  143. package/package/corpus/skills/cratis-arc-react-bind-slice/references/kotlin.md +1 -1
  144. package/package/corpus/skills/cratis-arc-react-separate-view-model/SKILL.md +7 -3
  145. package/package/corpus/skills/cratis-arc-react-separate-view-model/references/react-routing-and-messaging.md +1 -1
  146. package/package/corpus/skills/cratis-arc-select-backend-sdk/SKILL.md +2 -2
  147. package/package/corpus/skills/cratis-arc-select-backend-sdk/references/elixir.md +2 -4
  148. package/package/corpus/skills/cratis-arc-select-backend-sdk/references/go.md +2 -2
  149. package/package/corpus/skills/cratis-arc-select-backend-sdk/references/java.md +1 -1
  150. package/package/corpus/skills/cratis-arc-select-backend-sdk/references/kotlin.md +2 -2
  151. package/package/corpus/skills/cratis-arc-select-backend-sdk/references/typescript.md +1 -3
  152. package/package/corpus/skills/cratis-arc-spring-data-kotlin/SKILL.md +13 -51
  153. package/package/corpus/skills/cratis-arc-spring-data-kotlin/references/read-model-naming.md +9 -1
  154. package/package/corpus/skills/cratis-arc-spring-data-kotlin/references/storage-boundaries.md +40 -0
  155. package/package/corpus/skills/cratis-arc-storage-typescript/SKILL.md +19 -64
  156. package/package/corpus/skills/cratis-arc-storage-typescript/references/drizzle.md +62 -0
  157. package/package/corpus/skills/cratis-arc-tenancy-typescript/SKILL.md +24 -55
  158. package/package/corpus/skills/cratis-arc-tenancy-typescript/references/tenant-selection.md +49 -0
  159. package/package/corpus/skills/cratis-arc-testing-kotlin/SKILL.md +13 -31
  160. package/package/corpus/skills/cratis-arc-testing-kotlin/references/jvm-scenario-variants.md +25 -0
  161. package/package/corpus/skills/cratis-arc-testing-typescript/SKILL.md +24 -62
  162. package/package/corpus/skills/cratis-arc-testing-typescript/references/hosts-and-runners.md +51 -0
  163. package/package/corpus/skills/cratis-arc-validate-command/SKILL.md +4 -4
  164. package/package/corpus/skills/cratis-arc-validate-command/references/csharp.md +10 -12
  165. package/package/corpus/skills/cratis-arc-validate-command/references/elixir.md +16 -3
  166. package/package/corpus/skills/cratis-arc-validate-command/references/go.md +19 -2
  167. package/package/corpus/skills/cratis-arc-validate-command/references/java.md +20 -7
  168. package/package/corpus/skills/cratis-arc-validate-command/references/kotlin.md +22 -2
  169. package/package/corpus/skills/cratis-arc-validate-command/references/python.md +8 -2
  170. package/package/corpus/skills/cratis-arc-validate-command/references/typescript.md +22 -2
  171. package/package/corpus/skills/cratis-arc-validation-kotlin/SKILL.md +22 -248
  172. package/package/corpus/skills/cratis-arc-validation-kotlin/references/feature-filters.md +55 -0
  173. package/package/corpus/skills/cratis-arc-validation-kotlin/references/model-validation.md +72 -0
  174. package/package/corpus/skills/cratis-arc-validation-kotlin/references/server-validators.md +86 -0
  175. package/package/corpus/skills/cratis-arc-validation-typescript/SKILL.md +27 -275
  176. package/package/corpus/skills/cratis-arc-validation-typescript/references/models-and-queries.md +63 -0
  177. package/package/corpus/skills/cratis-arc-validation-typescript/references/rules-and-checks.md +46 -0
  178. package/package/corpus/skills/cratis-arc-validation-typescript/references/server-decisions.md +114 -0
  179. package/package/corpus/skills/cratis-chronicle-cli-operations/SKILL.md +15 -255
  180. package/package/corpus/skills/cratis-chronicle-cli-operations/references/command-effects.md +13 -6
  181. package/package/corpus/skills/cratis-chronicle-cli-operations/references/inspection.md +75 -0
  182. package/package/corpus/skills/cratis-chronicle-cli-operations/references/project-tooling.md +78 -13
  183. package/package/corpus/skills/cratis-chronicle-cli-operations/references/recovery-and-comparison.md +16 -14
  184. package/package/corpus/skills/cratis-chronicle-connect-application/SKILL.md +1 -1
  185. package/package/corpus/skills/cratis-chronicle-connect-application/references/csharp.md +10 -6
  186. package/package/corpus/skills/cratis-chronicle-connect-application/references/elixir.md +1 -1
  187. package/package/corpus/skills/cratis-chronicle-constrain-append/SKILL.md +2 -2
  188. package/package/corpus/skills/cratis-chronicle-constrain-append/references/csharp.md +8 -8
  189. package/package/corpus/skills/cratis-chronicle-deploy-kernel/SKILL.md +10 -8
  190. package/package/corpus/skills/cratis-chronicle-deploy-kernel/references/storage.md +8 -4
  191. package/package/corpus/skills/cratis-chronicle-evolve-event/SKILL.md +4 -4
  192. package/package/corpus/skills/cratis-chronicle-evolve-event/references/csharp.md +2 -2
  193. package/package/corpus/skills/cratis-chronicle-evolve-event/references/deployed-readers.md +21 -8
  194. package/package/corpus/skills/cratis-chronicle-evolve-event/references/elixir.md +1 -1
  195. package/package/corpus/skills/cratis-chronicle-inspect-observer/SKILL.md +1 -1
  196. package/package/corpus/skills/cratis-chronicle-inspect-observer/references/csharp.md +5 -7
  197. package/package/corpus/skills/cratis-chronicle-inspect-observer/references/elixir.md +3 -3
  198. package/package/corpus/skills/cratis-chronicle-mcp-inspection/SKILL.md +10 -80
  199. package/package/corpus/skills/cratis-chronicle-mcp-inspection/references/blocked-tools.md +2 -2
  200. package/package/corpus/skills/cratis-chronicle-mcp-inspection/references/deployment.md +9 -24
  201. package/package/corpus/skills/cratis-chronicle-mcp-inspection/references/observational-tools.md +10 -0
  202. package/package/corpus/skills/cratis-chronicle-project-view/SKILL.md +2 -2
  203. package/package/corpus/skills/cratis-chronicle-project-view/references/csharp.md +7 -6
  204. package/package/corpus/skills/cratis-chronicle-project-view/references/elixir.md +2 -2
  205. package/package/corpus/skills/cratis-chronicle-project-view/references/go.md +6 -0
  206. package/package/corpus/skills/cratis-chronicle-project-view/references/java.md +6 -0
  207. package/package/corpus/skills/cratis-chronicle-project-view/references/kotlin.md +6 -0
  208. package/package/corpus/skills/cratis-chronicle-project-view/references/typescript.md +11 -5
  209. package/package/corpus/skills/cratis-chronicle-protect-decision/SKILL.md +2 -2
  210. package/package/corpus/skills/cratis-chronicle-protect-decision/references/csharp.md +4 -4
  211. package/package/corpus/skills/cratis-chronicle-protect-decision/references/elixir.md +2 -2
  212. package/package/corpus/skills/cratis-chronicle-protect-decision/references/go.md +3 -1
  213. package/package/corpus/skills/cratis-chronicle-protect-personal-data/SKILL.md +1 -1
  214. package/package/corpus/skills/cratis-chronicle-protect-personal-data/references/csharp.md +1 -1
  215. package/package/corpus/skills/cratis-chronicle-publish-contract/SKILL.md +1 -1
  216. package/package/corpus/skills/cratis-chronicle-publish-contract/references/csharp.md +51 -40
  217. package/package/corpus/skills/cratis-chronicle-publish-contract/references/elixir.md +1 -1
  218. package/package/corpus/skills/cratis-chronicle-react-to-fact/SKILL.md +1 -1
  219. package/package/corpus/skills/cratis-chronicle-react-to-fact/references/{occurrences.md → csharp-occurrences.md} +2 -2
  220. package/package/corpus/skills/cratis-chronicle-react-to-fact/references/csharp.md +5 -6
  221. package/package/corpus/skills/cratis-chronicle-react-to-fact/references/go.md +1 -1
  222. package/package/corpus/skills/cratis-chronicle-react-to-fact/references/java.md +1 -1
  223. package/package/corpus/skills/cratis-chronicle-react-to-fact/references/kotlin.md +1 -1
  224. package/package/corpus/skills/cratis-chronicle-record-event/SKILL.md +1 -1
  225. package/package/corpus/skills/cratis-chronicle-record-event/references/csharp.md +21 -19
  226. package/package/corpus/skills/cratis-chronicle-record-event/references/elixir.md +3 -3
  227. package/package/corpus/skills/cratis-chronicle-record-event/references/go.md +1 -1
  228. package/package/corpus/skills/cratis-chronicle-record-event/references/java.md +3 -4
  229. package/package/corpus/skills/cratis-chronicle-record-event/references/kotlin.md +3 -4
  230. package/package/corpus/skills/cratis-chronicle-record-event/references/typescript.md +2 -2
  231. package/package/corpus/skills/cratis-chronicle-reduce-state/SKILL.md +1 -1
  232. package/package/corpus/skills/cratis-chronicle-reduce-state/references/csharp.md +7 -2
  233. package/package/corpus/skills/cratis-chronicle-reduce-state/references/typescript.md +1 -1
  234. package/package/corpus/skills/cratis-chronicle-select-client/SKILL.md +4 -4
  235. package/package/corpus/skills/cratis-chronicle-select-client/references/csharp.md +3 -3
  236. package/package/corpus/skills/cratis-chronicle-select-client/references/elixir.md +2 -6
  237. package/package/corpus/skills/cratis-chronicle-select-client/references/go.md +2 -2
  238. package/package/corpus/skills/cratis-chronicle-select-client/references/java.md +1 -1
  239. package/package/corpus/skills/cratis-chronicle-select-client/references/kotlin.md +1 -5
  240. package/package/corpus/skills/cratis-chronicle-select-client/references/python.md +3 -3
  241. package/package/corpus/skills/cratis-chronicle-select-client/references/typescript.md +2 -2
  242. package/package/corpus/skills/cratis-chronicle-web-workbench/SKILL.md +12 -201
  243. package/package/corpus/skills/cratis-chronicle-web-workbench/references/hosting.md +67 -0
  244. package/package/corpus/skills/cratis-chronicle-web-workbench/references/operations.md +88 -0
  245. package/package/corpus/skills/cratis-ci-pipeline-performance/SKILL.md +8 -4
  246. package/package/corpus/skills/cratis-ci-pipeline-performance/references/build-once-and-shard.md +13 -11
  247. package/package/corpus/skills/cratis-ci-pipeline-performance/references/caching.md +2 -2
  248. package/package/corpus/skills/cratis-ci-pipeline-performance/references/flaky-and-hung-jobs.md +6 -4
  249. package/package/corpus/skills/cratis-ci-pipeline-performance/references/required-checks-and-path-filters.md +20 -61
  250. package/package/corpus/skills/cratis-ci-pipeline-performance/references/security-and-pinning.md +1 -1
  251. package/package/corpus/skills/cratis-cli-terminal-workbench/SKILL.md +15 -26
  252. package/package/corpus/skills/cratis-code-review/SKILL.md +7 -6
  253. package/package/corpus/skills/cratis-commits-and-pull-requests/SKILL.md +1 -1
  254. package/package/corpus/skills/cratis-commits-and-pull-requests/references/pr-description.md +1 -1
  255. package/package/corpus/skills/cratis-components-accessibility/SKILL.md +14 -206
  256. package/package/corpus/skills/cratis-components-accessibility/references/control-labels.md +29 -0
  257. package/package/corpus/skills/cratis-components-accessibility/references/focus-and-announcements.md +8 -0
  258. package/package/corpus/skills/cratis-components-build-canvas/SKILL.md +7 -7
  259. package/package/corpus/skills/cratis-components-build-canvas/references/pixi-items.md +1 -1
  260. package/package/corpus/skills/cratis-components-choose-control/SKILL.md +7 -8
  261. package/package/corpus/skills/cratis-components-choose-control/references/collections.md +2 -2
  262. package/package/corpus/skills/cratis-components-choose-control/references/inputs.md +1 -1
  263. package/package/corpus/skills/cratis-components-compose-toolbar/SKILL.md +22 -27
  264. package/package/corpus/skills/cratis-components-compose-toolbar/references/contributed-tools.md +5 -0
  265. package/package/corpus/skills/cratis-components-coordinate-feedback/SKILL.md +19 -25
  266. package/package/corpus/skills/cratis-components-display-list/SKILL.md +26 -19
  267. package/package/corpus/skills/cratis-components-display-list/references/server-query.md +3 -3
  268. package/package/corpus/skills/cratis-components-edit-schema-data/SKILL.md +15 -12
  269. package/package/corpus/skills/cratis-components-edit-schema-data/references/controlled-editor.md +3 -3
  270. package/package/corpus/skills/cratis-components-explore-data/SKILL.md +7 -7
  271. package/package/corpus/skills/cratis-components-host-chat/SKILL.md +7 -7
  272. package/package/corpus/skills/cratis-components-submit-form/SKILL.md +9 -15
  273. package/package/corpus/skills/cratis-components-submit-form/references/confirmation.md +5 -5
  274. package/package/corpus/skills/cratis-components-submit-form/references/wizard.md +3 -3
  275. package/package/corpus/skills/cratis-components-theme-application/SKILL.md +7 -51
  276. package/package/corpus/skills/cratis-components-theme-application/references/palette.md +49 -0
  277. package/package/corpus/skills/cratis-components-theme-application/references/renderer-adapters.md +4 -2
  278. package/package/corpus/skills/cratis-content-length/SKILL.md +34 -46
  279. package/package/corpus/skills/cratis-content-length/references/length-evidence.md +26 -127
  280. package/package/corpus/skills/cratis-developer-marketing/SKILL.md +15 -27
  281. package/package/corpus/skills/cratis-developer-marketing/references/measurement.md +3 -19
  282. package/package/corpus/skills/cratis-developer-marketing/references/playbook-evidence.md +29 -224
  283. package/package/corpus/skills/cratis-discoverability/SKILL.md +11 -4
  284. package/package/corpus/skills/cratis-discoverability/references/package-metadata.md +2 -2
  285. package/package/corpus/skills/cratis-documentation-writing/SKILL.md +4 -3
  286. package/package/corpus/skills/cratis-engineering-ci-gates/SKILL.md +13 -129
  287. package/package/corpus/skills/cratis-engineering-ci-gates/references/gate-operation.md +132 -0
  288. package/package/corpus/skills/cratis-engineering-consolidation-guard/SKILL.md +11 -100
  289. package/package/corpus/skills/cratis-engineering-consolidation-guard/references/ci-required-check.md +55 -40
  290. package/package/corpus/skills/cratis-engineering-consolidation-guard/references/source-verification.md +68 -0
  291. package/package/corpus/skills/cratis-engineering-consolidation-guard/references/verification-details.md +38 -0
  292. package/package/corpus/skills/cratis-engineering-csharp-conventions/SKILL.md +14 -65
  293. package/package/corpus/skills/cratis-engineering-csharp-conventions/references/exceptions-logging-and-di.md +40 -174
  294. package/package/corpus/skills/cratis-engineering-decision-record/SKILL.md +8 -52
  295. package/package/corpus/skills/cratis-engineering-decision-record/references/decision-pitfalls.md +29 -0
  296. package/package/corpus/skills/cratis-engineering-decision-record/references/decision-scope.md +20 -0
  297. package/package/corpus/skills/cratis-engineering-decision-record/references/record-format.md +3 -4
  298. package/package/corpus/skills/cratis-engineering-docs-authoring/SKILL.md +7 -12
  299. package/package/corpus/skills/cratis-engineering-docs-authoring/references/site-format.md +5 -4
  300. package/package/corpus/skills/cratis-engineering-effect-boundaries/SKILL.md +6 -40
  301. package/package/corpus/skills/cratis-engineering-effect-boundaries/references/failure-archetypes.md +18 -151
  302. package/package/corpus/skills/cratis-engineering-inherited-work/SKILL.md +5 -21
  303. package/package/corpus/skills/cratis-engineering-inherited-work/references/continue-inherited-work.md +19 -0
  304. package/package/corpus/skills/cratis-engineering-issue-design-note/SKILL.md +3 -66
  305. package/package/corpus/skills/cratis-engineering-issue-design-note/references/design-note-format.md +68 -0
  306. package/package/corpus/skills/cratis-engineering-issue-hygiene/SKILL.md +2 -84
  307. package/package/corpus/skills/cratis-engineering-issue-hygiene/references/issue-disposition.md +87 -0
  308. package/package/corpus/skills/cratis-engineering-local-cross-repo-verification/SKILL.md +15 -263
  309. package/package/corpus/skills/cratis-engineering-local-cross-repo-verification/references/dependency-map.md +3 -3
  310. package/package/corpus/skills/cratis-engineering-local-cross-repo-verification/references/docker-images.md +28 -6
  311. package/package/corpus/skills/cratis-engineering-local-cross-repo-verification/references/dotnet-nuget.md +18 -14
  312. package/package/corpus/skills/cratis-engineering-local-cross-repo-verification/references/helper-runbook.md +231 -0
  313. package/package/corpus/skills/cratis-engineering-local-cross-repo-verification/references/other-environments.md +2 -3
  314. package/package/corpus/skills/cratis-engineering-local-cross-repo-verification/references/worked-examples.md +62 -77
  315. package/package/corpus/skills/cratis-engineering-post-mortem/SKILL.md +6 -39
  316. package/package/corpus/skills/cratis-engineering-post-mortem/references/proportionate-follow-up.md +36 -0
  317. package/package/corpus/skills/cratis-engineering-regression-cluster/SKILL.md +4 -4
  318. package/package/corpus/skills/cratis-engineering-release-trains/SKILL.md +8 -134
  319. package/package/corpus/skills/cratis-engineering-release-trains/references/candidate-assembly.md +139 -0
  320. package/package/corpus/skills/cratis-engineering-review-rounds/SKILL.md +3 -100
  321. package/package/corpus/skills/cratis-engineering-review-rounds/references/round-handoffs.md +109 -0
  322. package/package/corpus/skills/cratis-environments-and-secrets/SKILL.md +1 -5
  323. package/package/corpus/skills/cratis-environments-and-secrets/references/environment-file.md +1 -3
  324. package/package/corpus/skills/cratis-event-model-diagram/SKILL.md +11 -116
  325. package/package/corpus/skills/cratis-event-model-diagram/references/frame-patterns.md +93 -0
  326. package/package/corpus/skills/cratis-fundamentals-concept-go/SKILL.md +4 -15
  327. package/package/corpus/skills/cratis-fundamentals-name-value/SKILL.md +8 -8
  328. package/package/corpus/skills/cratis-fundamentals-name-value/references/csharp.md +4 -4
  329. package/package/corpus/skills/cratis-fundamentals-name-value/references/elixir.md +1 -1
  330. package/package/corpus/skills/cratis-fundamentals-name-value/references/go.md +1 -1
  331. package/package/corpus/skills/cratis-fundamentals-name-value/references/java.md +5 -5
  332. package/package/corpus/skills/cratis-fundamentals-name-value/references/kotlin.md +15 -2
  333. package/package/corpus/skills/cratis-fundamentals-name-value/references/python.md +1 -1
  334. package/package/corpus/skills/cratis-fundamentals-name-value/references/typescript.md +1 -1
  335. package/package/corpus/skills/cratis-fundamentals-telemetry/SKILL.md +10 -27
  336. package/package/corpus/skills/cratis-fundamentals-telemetry/references/otlp-export.md +16 -0
  337. package/package/corpus/skills/cratis-fundamentals-type-discovery/SKILL.md +26 -188
  338. package/package/corpus/skills/cratis-fundamentals-type-discovery/references/diagnostics.md +14 -0
  339. package/package/corpus/skills/cratis-governed-release-methodology/SKILL.md +7 -5
  340. package/package/corpus/skills/cratis-lens-browser-extension/SKILL.md +23 -157
  341. package/package/corpus/skills/cratis-lens-browser-extension/references/troubleshooting.md +139 -0
  342. package/package/corpus/skills/cratis-llm-friendly-documentation/SKILL.md +7 -5
  343. package/package/corpus/skills/cratis-modeling-design-event-model/SKILL.md +2 -4
  344. package/package/corpus/skills/cratis-modeling-design-event-model/references/model-first.md +7 -0
  345. package/package/corpus/skills/cratis-modeling-discover-timeline/SKILL.md +2 -2
  346. package/package/corpus/skills/cratis-modeling-discover-timeline/references/group-and-document-intake.md +1 -1
  347. package/package/corpus/skills/cratis-modeling-review-event-model/SKILL.md +2 -2
  348. package/package/corpus/skills/cratis-modeling-review-event-model/references/implementation-findings.md +2 -2
  349. package/package/corpus/skills/cratis-modeling-trace-existing-behavior/SKILL.md +5 -23
  350. package/package/corpus/skills/cratis-modeling-trace-existing-behavior/references/compare-evidence.md +20 -0
  351. package/package/corpus/skills/cratis-modeling-trace-existing-behavior/references/recovery-inputs.md +3 -3
  352. package/package/corpus/skills/cratis-multi-service-local-orchestration/SKILL.md +8 -63
  353. package/package/corpus/skills/cratis-multi-service-local-orchestration/references/aspire.md +52 -0
  354. package/package/corpus/skills/cratis-observability/SKILL.md +1 -1
  355. package/package/corpus/skills/cratis-observability/references/arc-and-chronicle-signals.md +9 -23
  356. package/package/corpus/skills/cratis-observability/references/chronicle-kernel-export.md +3 -14
  357. package/package/corpus/skills/cratis-observability/references/csharp.md +4 -6
  358. package/package/corpus/skills/cratis-observability/references/elixir.md +1 -1
  359. package/package/corpus/skills/cratis-observability/references/troubleshooting.md +4 -5
  360. package/package/corpus/skills/cratis-onboarding-runtime/SKILL.md +1 -4
  361. package/package/corpus/skills/cratis-onboarding-runtime/references/default-offering.md +0 -3
  362. package/package/corpus/skills/cratis-onboarding-runtime/references/sign-up-review.md +0 -4
  363. package/package/corpus/skills/cratis-orchestration-lanes/SKILL.md +7 -49
  364. package/package/corpus/skills/cratis-orchestration-lanes/references/escalation.md +22 -0
  365. package/package/corpus/skills/cratis-orchestration-lanes/references/inbox-and-handover.md +4 -4
  366. package/package/corpus/skills/cratis-orchestration-lanes/references/placeholders.md +1 -1
  367. package/package/corpus/skills/cratis-orchestration-lanes/references/roles.md +12 -0
  368. package/package/corpus/skills/cratis-orchestration-lanes/references/roll-call.md +12 -0
  369. package/package/corpus/skills/cratis-orchestration-lanes/references/worktrees.md +11 -0
  370. package/package/corpus/skills/cratis-orchestration-merge-gates/SKILL.md +14 -13
  371. package/package/corpus/skills/cratis-orchestration-merge-gates/references/merge-queue.md +51 -26
  372. package/package/corpus/skills/cratis-orchestration-merge-gates/references/unattended-guards.md +8 -14
  373. package/package/corpus/skills/cratis-orleans-jobs/SKILL.md +9 -65
  374. package/package/corpus/skills/cratis-orleans-jobs/references/activation-callbacks.md +5 -0
  375. package/package/corpus/skills/cratis-orleans-jobs/references/lifecycle-and-placement.md +11 -7
  376. package/package/corpus/skills/cratis-orleans-jobs/references/state-machines.md +1 -1
  377. package/package/corpus/skills/cratis-orleans-jobs/references/step-planning.md +27 -0
  378. package/package/corpus/skills/cratis-orleans-jobs/references/storage-and-options.md +35 -0
  379. package/package/corpus/skills/cratis-performance-review/SKILL.md +6 -76
  380. package/package/corpus/skills/cratis-performance-review/references/review-checklist.md +79 -0
  381. package/package/corpus/skills/cratis-platform-configure-environment/SKILL.md +19 -16
  382. package/package/corpus/skills/cratis-platform-contribute-change/SKILL.md +2 -2
  383. package/package/corpus/skills/cratis-platform-deliver-slice/SKILL.md +5 -5
  384. package/package/corpus/skills/cratis-platform-deliver-slice/references/coordinate-slices.md +1 -1
  385. package/package/corpus/skills/cratis-platform-diagnose-slice/SKILL.md +2 -3
  386. package/package/corpus/skills/cratis-platform-prepare-release-pr/SKILL.md +2 -2
  387. package/package/corpus/skills/cratis-platform-start-application/SKILL.md +10 -8
  388. package/package/corpus/skills/cratis-platform-start-application/references/csharp.md +6 -6
  389. package/package/corpus/skills/cratis-platform-start-application/references/java.md +4 -4
  390. package/package/corpus/skills/cratis-platform-start-application/references/kotlin.md +4 -4
  391. package/package/corpus/skills/cratis-platform-verify-service-handoff/SKILL.md +3 -3
  392. package/package/corpus/skills/cratis-release-notes/SKILL.md +9 -133
  393. package/package/corpus/skills/cratis-release-notes/references/channel-guidance.md +59 -0
  394. package/package/corpus/skills/cratis-release-notes/references/publish-repair.md +64 -0
  395. package/package/corpus/skills/cratis-rtk/SKILL.md +12 -18
  396. package/package/corpus/skills/cratis-screenplay-accept-model/SKILL.md +3 -3
  397. package/package/corpus/skills/cratis-screenplay-accept-model/references/capability-consumption.md +1 -1
  398. package/package/corpus/skills/cratis-screenplay-accept-model/references/coverage-obligations.md +1 -1
  399. package/package/corpus/skills/cratis-screenplay-authentication-and-onboarding/SKILL.md +25 -59
  400. package/package/corpus/skills/cratis-screenplay-authentication-and-onboarding/references/onboarding-directives.md +11 -10
  401. package/package/corpus/skills/cratis-screenplay-author-extension/SKILL.md +9 -6
  402. package/package/corpus/skills/cratis-screenplay-author-extension/references/consume.md +3 -3
  403. package/package/corpus/skills/cratis-screenplay-author-extension/references/stage-candidate.md +8 -0
  404. package/package/corpus/skills/cratis-screenplay-availability/SKILL.md +20 -167
  405. package/package/corpus/skills/cratis-screenplay-availability/references/complete-example.md +23 -47
  406. package/package/corpus/skills/cratis-screenplay-availability/references/review-checks.md +9 -10
  407. package/package/corpus/skills/cratis-screenplay-availability/references/runtime-ownership.md +26 -23
  408. package/package/corpus/skills/cratis-screenplay-declare-slice/SKILL.md +6 -14
  409. package/package/corpus/skills/cratis-screenplay-declare-slice/references/projection-replay.md +2 -2
  410. package/package/corpus/skills/cratis-screenplay-declare-slice/references/read-identity.md +1 -1
  411. package/package/corpus/skills/cratis-screenplay-edit-workspace/SKILL.md +7 -9
  412. package/package/corpus/skills/cratis-screenplay-edit-workspace/references/model-notes.md +1 -1
  413. package/package/corpus/skills/cratis-screenplay-handoff-slice/SKILL.md +10 -14
  414. package/package/corpus/skills/cratis-screenplay-model-automation/SKILL.md +1 -1
  415. package/package/corpus/skills/cratis-screenplay-model-automation/references/reaction-boundaries.md +1 -1
  416. package/package/corpus/skills/cratis-screenplay-model-interaction/SKILL.md +6 -31
  417. package/package/corpus/skills/cratis-screenplay-model-interaction/references/shell-and-data.md +22 -0
  418. package/package/corpus/skills/cratis-screenplay-model-translation/SKILL.md +5 -5
  419. package/package/corpus/skills/cratis-screenplay-onboard-workspace/SKILL.md +5 -5
  420. package/package/corpus/skills/cratis-screenplay-onboard-workspace/references/version-migration.md +4 -4
  421. package/package/corpus/skills/cratis-screenplay-recover-intent/SKILL.md +2 -2
  422. package/package/corpus/skills/cratis-screenplay-recover-intent/references/csharp.md +2 -2
  423. package/package/corpus/skills/cratis-screenplay-recover-intent/references/ground-truth-benchmark.md +1 -1
  424. package/package/corpus/skills/cratis-screenplay-specify-outcome/SKILL.md +4 -75
  425. package/package/corpus/skills/cratis-screenplay-specify-outcome/references/host-body-execution.md +0 -2
  426. package/package/corpus/skills/cratis-screenplay-specify-outcome/references/observable-result.md +85 -1
  427. package/package/corpus/skills/cratis-screenplay-specify-outcome/references/query-rejections.md +1 -1
  428. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/SKILL.md +15 -133
  429. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/boundaries.md +5 -5
  430. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/chronicle-boundaries.md +4 -12
  431. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/consistency-and-concurrency.md +28 -57
  432. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/evolution-example.md +4 -5
  433. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/evolution.md +13 -20
  434. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/multi-service-models.md +1 -1
  435. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/neighbouring-skills.md +1 -1
  436. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/read-model-keys.md +3 -5
  437. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/stream-id-rules.md +2 -0
  438. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/stream-patterns.md +5 -5
  439. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/streams-example.md +82 -71
  440. package/package/corpus/skills/cratis-security-review/SKILL.md +4 -73
  441. package/package/corpus/skills/cratis-security-review/references/arc-boundaries.md +24 -13
  442. package/package/corpus/skills/cratis-security-review/references/review-checklist.md +74 -0
  443. package/package/corpus/skills/cratis-session-handoff/SKILL.md +7 -32
  444. package/package/corpus/skills/cratis-session-handoff/references/handoff-template.md +2 -2
  445. package/package/corpus/skills/cratis-session-handoff/references/session-hygiene.md +20 -0
  446. package/package/corpus/skills/cratis-showrunner-herald/SKILL.md +9 -17
  447. package/package/corpus/skills/cratis-showrunner-herald/references/options.md +2 -2
  448. package/package/corpus/skills/cratis-showrunner-herald/references/templates-and-images.md +16 -10
  449. package/package/corpus/skills/cratis-social-feed-post/SKILL.md +9 -162
  450. package/package/corpus/skills/cratis-social-feed-post/references/asset-and-formatting.md +37 -0
  451. package/package/corpus/skills/cratis-social-feed-post/references/editorial-checks.md +40 -0
  452. package/package/corpus/skills/cratis-social-feed-post/references/engagement-evidence.md +39 -150
  453. package/package/corpus/skills/cratis-social-feed-post/references/linkedin-media.md +24 -0
  454. package/package/corpus/skills/cratis-social-feed-post/references/other-channels.md +23 -0
  455. package/package/corpus/skills/cratis-specifications-exercise-backend/SKILL.md +5 -5
  456. package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-command-results.md +2 -2
  457. package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-query-scenario.md +13 -5
  458. package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp.md +7 -4
  459. package/package/corpus/skills/cratis-specifications-exercise-backend/references/elixir.md +1 -1
  460. package/package/corpus/skills/cratis-specifications-exercise-backend/references/go.md +20 -4
  461. package/package/corpus/skills/cratis-specifications-exercise-backend/references/typescript.md +1 -1
  462. package/package/corpus/skills/cratis-specifications-isolate-behavior/SKILL.md +2 -2
  463. package/package/corpus/skills/cratis-specifications-observe-ui/SKILL.md +5 -5
  464. package/package/corpus/skills/cratis-specifications-test-application-ui/SKILL.md +2 -2
  465. package/package/corpus/skills/cratis-specifications-test-application-ui/references/typescript-command-results.md +2 -2
  466. package/package/corpus/skills/cratis-specifications-test-typescript-behavior/SKILL.md +2 -2
  467. package/package/corpus/skills/cratis-stage-render-slice/SKILL.md +10 -9
  468. package/package/corpus/skills/cratis-stage-run-sandbox/SKILL.md +3 -3
  469. package/package/corpus/skills/cratis-stage-run-sandbox/references/semantic-spec-runner.md +7 -6
  470. package/package/corpus/skills/cratis-studio-mcp-safety-guidance/SKILL.md +4 -6
  471. package/package/corpus/skills/cratis-technical-examples/SKILL.md +10 -106
  472. package/package/corpus/skills/cratis-technical-examples/references/csharp-package-checks.md +1 -1
  473. package/package/corpus/skills/cratis-technical-examples/references/source-and-format.md +42 -0
  474. package/package/corpus/skills/cratis-technical-examples/references/typescript-package-checks.md +2 -2
  475. package/package/corpus/skills/cratis-technical-examples/references/verification-scope.md +37 -0
  476. package/package/corpus/skills/cratis-ux-review/SKILL.md +8 -40
  477. package/package/corpus/skills/cratis-ux-review/references/capture-contract.md +24 -0
  478. package/package/corpus/skills/cratis-ux-review/references/checklist.md +1 -1
  479. package/package/corpus/skills/cratis-ux-review/references/report-template.md +2 -1
  480. package/package/corpus/skills/cratis-writing-voice-and-cadence/SKILL.md +19 -132
  481. package/package/corpus/skills/cratis-writing-voice-and-cadence/references/ai-tells.md +24 -97
  482. package/package/corpus/skills/cratis-writing-voice-and-cadence/references/author-and-batch.md +23 -0
  483. package/package/corpus/skills/cratis-writing-voice-and-cadence/references/documentation-evidence.md +25 -0
  484. package/package/corpus/skills/cratis-writing-voice-and-cadence/references/interpretation.md +17 -0
  485. package/package/corpus/skills/cratis-writing-voice-and-cadence/references/stock-constructions.md +23 -0
  486. package/package/corpus/skills/cratis-writing-voice-and-cadence/references/voice-guidance.md +8 -29
  487. package/package.json +1 -1
  488. /package/package/corpus/skills/cratis-chronicle-protect-decision/references/{standalone.md → csharp-standalone.md} +0 -0
  489. /package/package/corpus/skills/cratis-engineering-post-mortem/references/{examples/silent-backup-failure.md → silent-backup-failure.md} +0 -0
  490. /package/package/corpus/skills/cratis-engineering-post-mortem/references/{examples/unintended-release-regression.md → unintended-release-regression.md} +0 -0
@@ -6,101 +6,11 @@ paths:
6
6
  ---
7
7
  <!-- cratis-ai: generated Copilot instructions. Do not edit; rules/ is the source. -->
8
8
 
9
-
10
- # TypeScript Conventions
11
-
12
- ## Use enums rather than string literal unions
13
-
14
- ```ts
15
- // ✅ Correct — refactorable, discoverable, exhaustive
16
- export enum SliceType {
17
- StateChange = 'stateChange',
18
- StateView = 'stateView',
19
- Automation = 'automation',
20
- Translator = 'translator',
21
- }
22
-
23
- // ❌ Wrong — no refactoring support, invisible to tooling
24
- export type SliceType = 'stateChange' | 'stateView' | 'automation' | 'translator';
25
- ```
26
-
27
- - Use enum members everywhere — `switch` cases, comparisons, defaults.
28
- - Do **not** import enums as `type`; they are values.
29
- - Export enums from `index.ts` without the `type` keyword.
30
-
31
- ## One Type or Enum per File
32
-
33
- - Every interface, type alias, and enum lives in **its own file**, named after the type (e.g. `SliceType.ts`).
34
- - **Never create** `types.ts`, `models.ts`, `interfaces.ts` grab-bag files — they become dumping grounds that grow without limit.
35
- - Exception: component props interfaces (`*Props`) may live alongside their component `.tsx` file since they are tightly coupled to that component.
36
- - Aggregate exports through the folder's `index.ts`.
37
-
38
- ## Type Safety
39
-
40
- `any` disables the compiler — the one tool that catches bugs for free. Every `any` is a hole in the safety net. Use `unknown` and narrow with type guards instead.
41
-
42
- - Never use `any` — use `unknown`, `Record<string, unknown>`, or proper generic constraints.
43
- - Prefer `value as unknown as TargetType` over `value as any`.
44
- - Use `unknown` as default generic parameter instead of `any`.
45
- - React synthetic events (`React.MouseEvent<Element, MouseEvent>`) and DOM events (`MouseEvent`) are different types — don't mix them.
46
- - **`int64`/`uint64` Chronicle fields generate as `bigint`** in the TypeScript proxies (not `number`, which silently truncated past `Number.MAX_SAFE_INTEGER`). Sequence numbers, large counters, and 64-bit ids surface as `bigint` — use `bigint` arithmetic, never `Number()`.
47
-
48
- ## User-facing strings (localization)
49
-
50
- How user-visible text is handled is **product policy, not a Cratis framework rule**: locales belong in a downstream application's own rules. Cratis itself has no mandatory i18n layer or `Strings` alias.
51
-
52
- - If the app has a localization convention (e.g. a translation object behind a `strings`/`Strings` import, or any i18n library), follow it consistently and keep raw string literals to constant, non-user-facing values (CSS class names, `key` props, internal identifiers).
53
- - If the app ships literal text, literal labels in JSX are fine.
54
-
55
- Either way, the Cratis-generic rule is only that strings are handled consistently within the app — not a specific file layout or import alias.
56
-
57
- ## Arc proxies
58
-
59
- Generated command and query proxies, their hooks, paging and forms are covered by **cratis-arc-react-bind-slice** and **cratis-arc-generate-proxies** where those skills are installed. Never edit a generated proxy by hand: change the backend type and regenerate.
60
-
61
- ## Language — American English Only
62
-
63
- All identifiers, comments, JSDoc, and string literals must use **American English** spelling (initialize, serialize, behavior, color, organization, center, modeling, dialog, license, judgment, gray).
64
-
65
- ## Variables and Naming
66
-
67
- - Prefer `const` over `let` over `var` when declaring variables.
68
- - Never use shortened or abbreviated names for variables, parameters, or properties.
69
- - Use full descriptive names: `deltaX` not `dx`, `index` not `idx`, `event` not `e`, `previous` not `prev`, `direction` not `dir`, `position` not `pos`, `contextMenu` not `ctx`/`ctxMenu`.
70
- - The only acceptable short names are well-established domain terms (e.g. `id`, `url`, `min`, `max`).
71
-
72
- ## Imports and Compilation
73
-
74
- - Never leave unused import statements in the code.
75
- - Always ensure that the code compiles without warnings — use `yarn compile` to verify (successful runs produce no output).
76
- - Review each file for lint compliance before finalizing.
77
- - Never use placeholder or temporary types — use proper types from the start.
78
- - **Never modify any file inside `node_modules/` or any build cache (e.g. `.vite/deps/`).** These are managed by the package manager and will be overwritten on the next install. If something appears broken in a library, look harder at the application code — especially when other usages of the same library work fine. Fixes belong in application code or upstream in the library's own repo.
79
-
80
- ## Folder Structure
81
-
82
- - **Never give a `.tsx` the same basename as a `.ts` in the same folder.** The Arc proxy generator emits `<Slice>.ts` beside the slice's C#; a component named `<Slice>.tsx` next to it is **silently dropped from the program**: for one basename TypeScript keeps only the `.ts`, so the component's type errors are never reported and `tsc -b` stays green while the file is broken (reproduced on TypeScript 6.0.3 and 7.0.2 with `include: ["src/**/*"]`). At Arc v22.75.0 use `<CratisProxiesUseProxyFileSuffix>true</CratisProxiesUseProxyFileSuffix>` to emit `<Slice>.proxy.ts` with matching barrels; that is the clean generator fix. Otherwise name the component for what it renders (`Listing.tsx`, `RegisterAuthor.tsx`), never for the slice, and consider a repository spec that fails on any `.tsx` with a sibling `.ts` of the same name.
83
- - Do not prefix a file, component, type, or symbol with the name of its containing folder or the concept it belongs to. Instead, use folder structure to provide that context.
84
- - Favor functional folder structure over technical folder structure.
85
- - Group files by the feature or concept they belong to, not by their technical role.
86
- - Avoid folders like `components/`, `hooks/`, `utils/`, `types/` at the feature level.
87
-
88
- ## Advanced Type Safety
89
-
90
- **Storybook:**
91
- - Use `React.ComponentType<Record<string, never>>` for components with no props.
92
- - Always use `as unknown as` when converting component imports to avoid type mismatch errors.
93
- - Properly type story args — never use `any`.
94
-
95
- **External libraries with strict generic constraints:**
96
- - Import necessary types (e.g. `Command` from `@cratis/arc/commands`) rather than asserting to `any`.
97
- - Use type assertions through `unknown`: `props.command as unknown as Constructor<Command<...>>`.
98
- - Extract tuple results explicitly rather than destructuring when type assertions are needed.
99
- - Use proper library types when available; use specific property types (e.g. `{ canvas?: HTMLCanvasElement }`) over `any`.
100
-
101
- **Dynamic and generic types:**
102
- - Add type guards for unknown function parameters: `if (typeof accessor !== 'function') return ''`.
103
- - Type parameters with fallbacks: `function<T = unknown>(accessor: ((obj: T) => unknown) | unknown)`.
104
- - Cast arrays from `unknown` explicitly: `((obj as Record<string, unknown>).items || []) as string[]`.
105
- - Use `String(value)` for string conversions in generic contexts.
106
- - Use explicit Date parameter types: `new Date(value as string | number | Date)`.
9
+ # TypeScript conventions
10
+
11
+ - Group files by feature. Give named types and enums their own files and export the public surface through `index.ts` where the package uses barrels. Keep component props beside their component. Avoid grab-bag files and redundant folder-name prefixes.
12
+ - Use enums for owned sets of named domain values, not for external string contracts or scripts restricted to erasable TypeScript. Import and export enums as values.
13
+ - Prefer `const`, descriptive names and American English. Follow the application's localization convention; Cratis does not require one.
14
+ - Use `unknown` and narrow it, or use a real generic constraint. Do not hide a type mismatch with `any` or a double assertion. Keep React events distinct from DOM events. Preserve precision when a generated type uses `bigint`.
15
+ - Don't give `.ts` and `.tsx` files in the same folder the same basename: TypeScript may exclude the `.tsx` file. Name the component for what it renders. If generated Arc proxies need distinct names, set the generator's `CratisProxiesUseProxyFileSuffix` MSBuild property to `true`.
16
+ - Use the repository's type-check and lint commands. Never edit generated proxies, `node_modules/` or build caches; change the source or fix the owning package. For proxy generation and binding, use **cratis-arc-generate-proxies** and **cratis-arc-react-bind-slice**.
@@ -6,52 +6,8 @@ paths:
6
6
  ---
7
7
  <!-- cratis-ai: generated Copilot instructions. Do not edit; rules/ is the source. -->
8
8
 
9
- # Writing Correct Code Examples (Technical Docs)
9
+ # Writing correct examples
10
10
 
11
- Documentation code examples are **copied verbatim** by evaluators. A snippet that uses an API that doesn't exist is worse than no snippet — it breaks on first paste and loses trust. An audit of these docs found **~12 fabricated-API bugs** that had passed review and shipped. The discipline below is how you avoid adding the thirteenth.
11
+ Use **cratis-technical-examples**. Verify every framework API, receiver, argument, default and import against released source for that client, not a sibling checkout's working tree or another client. Teach the current convention first. Keep tag, path and line evidence in the review report, not the example or skill.
12
12
 
13
- ## The rule: verify every framework API against real source — before you write it
14
-
15
- For each framework type, attribute, method, prop, hook, or import in an example, confirm it exists and has that exact shape in **source**, not in another doc page (the docs themselves had the bugs):
16
-
17
- - **C# / backend** — grep real usage in a reference application (e.g. Cratis **Studio**) and the product `Source/` trees of the Cratis repos checked out alongside this one (`Arc/Source`, `Chronicle/Source`). For extension methods, find the `public static … (this <Type> …)` signature and note **which type it extends**.
18
- - **React / Components** — the authoritative prop names are in the compiled type defs of the installed package (`node_modules/@cratis/components/dist/esm/**/*.d.ts`) or the `Components` source `dist`. Real usage: a reference app's `*.tsx`.
19
- - **Invented *domain* names are fine** (event/concept/command names like `AuthorRegistered`, `BookId`). Only **framework APIs** must be real. Never invent a framework interface, attribute, prop, method, or import path.
20
- - **Read the source at the version the reader runs, never at a checkout's `HEAD`.** A sibling clone's working tree is whatever someone last checked out; the package the reader installed is a tag. Read with `git show <tag>:<path>` and `git grep <pattern> <tag> -- <path>` — both work without touching the checkout, so a dirty or shared worktree is never a reason to skip the check. Name the repository and the tag in the claim ("`Arc v22.16.0`, `ParameterDependencyResolver.cs:44-62`") so the next reader can re-run it. Where the corpus states a version in a skill's *Verified product sources* table, that tag is the one to read; when a consumer's pin is newer, re-read at theirs. A release note is a reason to look, not evidence that a behavior changed or that a workaround can be retired — retire a workaround only after the original reproduction passes at the new tag.
21
-
22
- ## Choose a maintained source for the example
23
-
24
- For a long example or threaded tutorial, derive displayed snippets from a
25
- compiling, tested sample or spec when tooling supports extraction; otherwise
26
- compare each block to that source and check both together. For a short,
27
- illustrative excerpt, write purpose-built code but verify its framework APIs
28
- against the product source at the supported version. Do not forbid copying
29
- from a runnable sample: copying *without a check that prevents drift* is the
30
- problem. Multi-client pages use their client-owned snippet sources and checks;
31
- never hand-translate an unsupported SDK. See the **cratis-technical-examples**
32
- skill for the workflow.
33
-
34
- ## Complete and correct
35
-
36
- - No pseudo-code, no `// ...` elisions that leave the reader guessing, no props/members that don't exist.
37
- - A standalone snippet should compile with its stated prerequisites. Label an excerpt as an excerpt and supply or link the domain types it assumes.
38
- - Show the run command and an observable result for a substantial sample; a passing site build does not prove behavior.
39
-
40
- ## Historical API pitfalls to recheck
41
-
42
- These reminders are not versioned API evidence and must not be copied as an
43
- unchecked contract. Before using one in a new example, resolve the reader's
44
- package version and verify the exact receiver, signature and source path at
45
- that tag. Recheck affected examples on product version changes; remove a
46
- workaround only after its reproduction passes. The source check above, not
47
- this list, establishes which shape the target version supports.
48
-
49
- - Commands/queries are **model-bound**: a `[Command]` record with `Handle()` **on the record**, and `[ReadModel]` records with **static** query methods. The marker/handler interfaces `ICommand`, `ICommandHandler<T>`, `IQuery<T>`, `IQueryHandler<T,R>` **do not exist** — never use them.
50
- - Bootstrap: `ArcApplication.CreateBuilder(args)` (not `ArcApplicationBuilder.CreateBuilder`). `builder.AddCratisArc()` on the builder (`WebApplicationBuilder`/`IHostBuilder`); `app.UseCratisArc()` on the built app and it takes **no args** (the listen URL comes from `ArcOptions.Hosting.ApplicationUrl`).
51
- - Read the current user inside `Handle()` by injecting **`IHttpContextAccessor`** and reading `HttpContext?.User` (`ClaimsPrincipal`). There is no `CommandContext.User` and no `IUserAccessor` Arc type. In-`Handle` guards return **`Result<TEvent, ValidationResult>`** (success type first, error type second) + `ValidationResult.Error(...)` — there is no `CommandResult.Forbidden`/`Unauthorized` to return.
52
- - Components: `DataPage` uses the **compound** `DataPage.Columns` / `DataPage.MenuItems`; the detail prop is **`detailsComponent`** (lowercase) — `detailsTitle`/`initialSizes` are **not** props. Import `DataTableForObservableQuery` from `@cratis/components/DataTables` (the root barrel only re-exports namespaces); `DataPage`/`MenuItem` from `@cratis/components/DataPage`. Required props like `emptyMessage`/`title` must be present.
53
- - Chronicle model-bound projections use property attributes **`[SetFrom<T>]`** / **`[SetValue<T>]`** (and `[FromEvent<T>]` AutoMap) — **not** `static On(event)` methods (that shape does not exist). Retrieve a read model with `eventStore.ReadModels.GetInstanceById<T>(id)`. Assertion signatures depend on the extension receiver: the out-of-process `IChronicleSetupFixture` extension is `ShouldHaveAppendedEvent<TEvent>(sequenceNumber, eventSourceId, validator)`, while Arc's in-process `CommandScenario<TCommand>` extensions use `<TCommand, TEvent>` with the event-source id and optional predicate. Verify the receiver type and its exact extension signature before copying either shape.
54
-
55
- ## Auditing at scale
56
-
57
- Re-run a snippet-correctness audit periodically — it keeps finding bugs (the list above came from three rounds). Delegate the cross-checking to subagents that compare each snippet to source and report only confirmed discrepancies; **verify each finding against source yourself before fixing**. Consider adopting an automated example tester (**Doc Detective**, **Squidler** — from awesome-docs) that actually runs the snippets, so correctness is enforced by CI rather than by hand. The principle, from jvns's "write good examples by starting with real code": derive examples from working source, don't compose them from memory.
13
+ Derive substantial examples from a maintained runnable sample or spec. Label excerpts and supply or link the prerequisites; do not omit code the reader needs. Build and exercise the example and show an observable result. A site build proves rendering, not example behavior.
@@ -6,70 +6,8 @@ paths:
6
6
  ---
7
7
  <!-- cratis-ai: generated Copilot instructions. Do not edit; rules/ is the source. -->
8
8
 
9
- # Writing Cratis Documentation
9
+ # Writing Cratis documentation
10
10
 
11
- Read and use **cratis-documentation-writing** to establish the reader's goal and
12
- page purpose, then **cratis-engineering-docs-authoring** to draft from product
13
- evidence. Before writing explanations beside examples, work through
14
- that skill's explaining-code reference.
15
- It shows how a concrete registration or directive can carry the explanation
16
- without making the page read like a review form. Read a current, well-reviewed
17
- tutorial in the product or a closely related product before writing, without
18
- assuming its vocabulary fits this product.
11
+ Use **cratis-documentation-writing** to define the reader's goal and **cratis-engineering-docs-authoring** for evidence, drafting and explaining code. Use **cratis-technical-examples** for runnable examples. Lead with the current convention, explain invisible wiring against the backend the reader built, and show an observable result before introducing another concept. Keep limitations beside the action they affect. Preserve the site's snippet and language-tab workflow. When both sides matter, show the backend contract and generated frontend shape in producer-to-consumer order.
19
12
 
20
- Write as a developer explaining the code to another developer. Start with the
21
- reader's problem, show the relevant example, and explain the part they cannot
22
- see: why this type matters, what the call changes, or where responsibility
23
- passes to another component. Let each paragraph develop that point. Use steps
24
- for a procedure and a table for a comparison; neither replaces a connected
25
- explanation. A reference entry can state its contract directly.
26
-
27
- The example should also teach the intended idiom. Explain a tempting alternative
28
- when it exposes a real trap, and put a limitation beside the action it affects.
29
- Do not add a stock warning or a closing list of everything the product does not
30
- do. A concrete recommendation with a source-backed reason is useful perspective;
31
- an invented customer story or personal experience is not. Make the first example
32
- the convention path: do not hand-register what the framework already discovers.
33
- Explain that invisible wiring against the backend the reader actually built,
34
- then show an observable result before introducing another concept.
35
-
36
- Use **cratis-technical-examples** to verify code, configuration, commands and
37
- results against the applicable product source. It is fine to explain the effect
38
- of code that is absent, such as convention-based wiring, but establish that
39
- effect first. Do not infer a second client's API or behavior from the first.
40
- Read the multi-client section of **Explaining code** before choosing shared
41
- prose, tabs or separate guides. Preserve the owning repository's snippet and
42
- language-tab workflow rather than inventing another one. Show both the backend
43
- contract and generated frontend shape when both matter, keeping required
44
- producer/consumer actions sequential.
45
-
46
- Choose presentation to support the reader, not decorate the page. The exact
47
- Markdown/MDX boundary, aside semantics, component contracts and rendering checks
48
- live in [Documentation Structure and Formatting](./documentation-structure-and-formatting.instructions.md).
49
- Use the owning site's supported components and inspect the emitted Markdown;
50
- a raw source mirror is not proof that essential labels or warnings survive.
51
-
52
- Link the guided explanation to exact reference and connect neighboring products
53
- at their workflow seams instead of retelling their setup. A coming-from-X bridge
54
- can put the reader's existing code beside the Cratis equivalent and explain
55
- what changes. Keep that comparison fair and version-accurate, or label it
56
- illustrative; say when the existing approach remains the better fit. It does
57
- not impose universal navigation buckets.
58
-
59
- Follow the [documentation rule](./documentation.instructions.md) for naming, claims and version
60
- constraints. The reader needs the minimum or compatibility boundary that changes
61
- what they can run, not the author's source-checking diary. Keep verification
62
- provenance in the private change summary. A rendered page, compiling example,
63
- observed result and successful reader journey are different evidence.
64
-
65
- Before returning a draft, read its explanation as prose: does it make the code
66
- easier to understand, or merely name responsibilities and limitations? Use
67
- **cratis-writing-voice-and-cadence** for an authorized revision, preserving
68
- technical claims and approval boundaries. For a materially changed journey,
69
- follow the reader-review procedure owned by **cratis-documentation-writing**;
70
- report when independent review is unavailable. Do not edit generated copies,
71
- change navigation, or publish as part of writing. Run the owning documentation
72
- gate and, when available, the Documentation site's full check for attributable
73
- lint and rendered-link errors. For a visual page, use the owning preview workflow
74
- and inspect light and dark screenshots. Source ownership and the edit/sync/verify
75
- loop live in [Editing Cratis Documentation](./editing-cratis-docs.instructions.md).
13
+ Follow [Documentation](./documentation.instructions.md) for naming and claims, [Structure and Formatting](./documentation-structure-and-formatting.instructions.md) for supported site components, and [Editing Cratis Documentation](./editing-cratis-docs.instructions.md) for source ownership and gates. Do not edit generated copies or change navigation or publish as part of writing. Verify rendered links and critical content; use the owning preview and inspect light and dark output for visual changes. Report when the reader review or a gate is unavailable.
@@ -94,7 +94,7 @@ program (conservative: `$1 > 5` is refused); a word-leading `*` or `?` glob is a
94
94
  option can still change what those print, never what they write; and exactly
95
95
  `node .cratis/ai/hooks/scripts/cratis-check-pr.mjs` (options `--body-file`, `--label`, `--add-label`,
96
96
  `--remove-label`, `--pr`, `--base`, `--repo` with a plain value, and `--strict`) and
97
- `bash .cratis/ai/hooks/scripts/cratis-cleanup-worktrees.sh` (`--dry-run`, `--quiet`, `--no-fetch`) may
97
+ `bash .cratis/ai/hooks/scripts/cratis-cleanup-worktrees.sh` (`--dry-run`, `--quiet`, `--no-fetch`, `--reclaim`, `--no-reclaim`) may
98
98
  run: the path must match as one literal word (no `./`, `..`, absolute, variable or glob spelling), nothing
99
99
  is admitted after a `cd`, and writes to those files stay refused. The working directory decides which
100
100
  copy runs. A write-target word with expansion syntax (`$`, backtick, `~`, parentheses or braces) is judged by every
@@ -347,6 +347,17 @@ first. Non-empty `.ai-work/` directories, even when tracked, are additionally ke
347
347
  no GitHub call, abort, or failed-attempt marker.
348
348
  - **Pin a long-lived worktree.** Use `git worktree lock <path>` to keep it out of cleanup; release the
349
349
  pin with `git worktree unlock <path>` when ready.
350
+ - **Reclaiming build output.** A worktree's weight is its build output (`bin/` and `obj/` per .NET project, `node_modules`,
351
+ `dist`), not its source, and that output used to pin worktrees forever as "has ignored/untracked files". Now (1) a
352
+ delivered worktree has its regenerable output deleted so it can be removed, and (2) with `--reclaim` (the default for
353
+ manual runs and `SessionStart`; the per-command `PostToolUse` hook skips it) the same output is deleted from every other
354
+ linked worktree that is **idle** (no file or git metadata changed for `CRATIS_RECLAIM_IDLE_MINUTES`, default 60),
355
+ unlocked, and not held by a live process, even when its work is undelivered. Only directories that are git-ignored, fully
356
+ untracked, not symlinks and named `bin`, `obj`, `node_modules`, `dist`, `build`, `out`, `coverage`, `TestResults`,
357
+ `target`, `_build`, `.vite`, `.next`, `.nuxt`, `.turbo`, `.nx`, `.angular`, `.parcel-cache`, `.gradle`, `.venv` or
358
+ `__pycache__` are deleted. Source, commits, branches, work records, `.env` and any other ignored file stay; the next
359
+ build recreates the output. `--dry-run` reports the megabytes reclaimable; `--no-reclaim` or
360
+ `CRATIS_HOOKS_SKIP_RECLAIM=1` disables it; a hook run stops starting new worktrees after about 45 seconds.
350
361
  - **Self-test.** `--self-test` plants delivered, dirty, unmerged, brand-new, work-record and locked cases
351
362
  (including detached locks), checks manual opt-in and hook protection, and fails if any is handled wrongly.
352
363
  - **Opt out.** `CRATIS_HOOKS_SKIP_CLEANUP=1`.
@@ -929,19 +940,16 @@ all solution projects, executing each test project independently rather than sil
929
940
  dependents. Non-test projects are explicitly skipped; a solution with none reports no verified
930
941
  specifications. A timeout is never a pass. Reports are local under `.ai-work/spec-runs/`.
931
942
 
932
- **`CratisProxiesSkip` is the proxy generator's off switch.** From Arc 22.185.1 the generator's
933
- target runs only when `CratisProxiesOutputPath` is non-empty and `CratisProxiesSkip` is not
934
- `true`, so `-p:CratisProxiesSkip=true` skips it even when the output path is set. Before 22.185.1
935
- an empty `-p:CratisProxiesOutputPath=` is the off switch, and older Arc ignores `CratisProxiesSkip`
936
- silently (MSBuild accepts unknown `-p:` names), so the shipped gates pass both. Proxies are
943
+ **`CratisProxiesSkip` is the proxy generator's off switch.** The generator's target runs only
944
+ when `CratisProxiesOutputPath` is non-empty and `CratisProxiesSkip` is not `true`, so
945
+ `-p:CratisProxiesSkip=true` skips it even when the output path is set. Proxies are
937
946
  generated and committed by the client, never in CI, so CI builds always skip generation.
938
947
 
939
948
  The Debug/Release split applies to the shipped client-side local gates only: Release clears the
940
949
  path, and the committing client's Debug gate does not, because the Debug build is
941
950
  the canonical trigger for regenerating the TypeScript proxies the frontend phase depends on, and
942
951
  the client commits the result. A consuming repository's CI never copies the Debug proxy step; it
943
- passes `-p:CratisProxiesSkip=true -p:CratisProxiesOutputPath=` (Skip needs Arc 22.185.1 or
944
- later) in every configuration.
952
+ passes `-p:CratisProxiesSkip=true` in every configuration.
945
953
 
946
954
  ## Unattended runs
947
955
 
@@ -20,8 +20,20 @@
20
20
  # Missing, failed, unparseable or ambiguous checks keep the worktree (including shared-inode names).
21
21
  # `git worktree remove` is never given --force.
22
22
  #
23
+ # Disk is reclaimed in two ways, because a worktree's weight is its build output, not its source:
24
+ # * A delivered worktree whose only ignored files are regenerable build output (bin, obj,
25
+ # node_modules, dist, ...) has that output deleted first, so it can then be removed. Without this
26
+ # step every worktree that was ever built was kept forever as "has ignored/untracked files".
27
+ # * With --reclaim (the default for manual runs and SessionStart) the same regenerable output is
28
+ # deleted from every OTHER linked worktree that is idle, unlocked and not held by a live process,
29
+ # including worktrees whose work is not delivered. Source, commits, branches, stashes, work
30
+ # records and every non-regenerable ignored file stay; the next build recreates the output.
31
+ # Idle = nothing touched in CRATIS_RECLAIM_IDLE_MINUTES (default 60). Only ignored, untracked
32
+ # directories with a well-known build-output name are ever deleted. Opt out: --no-reclaim or
33
+ # CRATIS_HOOKS_SKIP_RECLAIM=1.
34
+ #
23
35
  # Usage:
24
- # cratis-cleanup-worktrees.sh [--dry-run] [--quiet] [--no-fetch] [--include-work-records=<path>]...
36
+ # cratis-cleanup-worktrees.sh [--dry-run] [--quiet] [--no-fetch] [--no-reclaim] [--include-work-records=<path>]...
25
37
  # run in the repository (any worktree)
26
38
  # --include-work-records=<path> bypass record preservation for this
27
39
  # exact worktree only; repeatable, manual
@@ -37,10 +49,10 @@
37
49
  # shellcheck disable=SC2016 # the self-test checks are single-quoted on purpose: they are eval-ed later
38
50
  set -uo pipefail
39
51
 
40
- DRY=0; QUIET=0; FETCH=1; HOOK=0; SELFTEST=0; WORK_RECORD_PATHS=()
52
+ DRY=0; QUIET=0; FETCH=1; HOOK=0; SELFTEST=0; RECLAIM=''; WORK_RECORD_PATHS=()
41
53
  for a in "$@"; do
42
54
  case "$a" in
43
- --dry-run) DRY=1 ;; --quiet) QUIET=1 ;; --no-fetch) FETCH=0 ;;
55
+ --dry-run) DRY=1 ;; --quiet) QUIET=1 ;; --no-fetch) FETCH=0 ;; --reclaim) RECLAIM=1 ;; --no-reclaim) RECLAIM=0 ;;
44
56
  --hook) HOOK=1; QUIET=1 ;; --self-test) SELFTEST=1 ;;
45
57
  --include-work-records|--include-work-records=)
46
58
  echo "cratis-cleanup-worktrees: --include-work-records requires an explicit worktree path (--include-work-records=<path>)" >&2; exit 2 ;;
@@ -71,6 +83,14 @@ if [ "$HOOK" = 1 ]; then
71
83
  if [ -n "$cwd" ] && [ -d "$cwd" ]; then cd "$cwd" || exit 0; fi
72
84
  fi
73
85
  [ "${CRATIS_HOOKS_SKIP_CLEANUP:-}" = 1 ] && [ "$SELFTEST" = 0 ] && exit 0
86
+ # Reclaiming build output from idle worktrees costs a process scan per candidate: manual runs and
87
+ # SessionStart do it, the per-command PostToolUse hook does not.
88
+ if [ -z "$RECLAIM" ]; then
89
+ if [ "$HOOK" = 1 ] && [ "$EVENT" != "SessionStart" ]; then RECLAIM=0; else RECLAIM=1; fi
90
+ fi
91
+ [ "${CRATIS_HOOKS_SKIP_RECLAIM:-}" = 1 ] && RECLAIM=0
92
+ IDLE_MINUTES=${CRATIS_RECLAIM_IDLE_MINUTES:-60}
93
+ [[ "$IDLE_MINUTES" =~ ^[0-9]+$ ]] || IDLE_MINUTES=60
74
94
 
75
95
  # ── Self-test ─────────────────────────────────────────────────────────────────
76
96
  if [ "$SELFTEST" = 1 ]; then
@@ -88,8 +108,9 @@ if [ "$SELFTEST" = 1 ]; then
88
108
  mk delivered; (cd "$t/wt-delivered" && echo d > d && git add d && git commit -qm d)
89
109
  mk dirty; (cd "$t/wt-dirty" && echo x > x && git add x && git commit -qm x)
90
110
  mk unmerged; (cd "$t/wt-unmerged" && echo u > u && git add u && git commit -qm u)
111
+ (cd "$t/wt-unmerged" && mkdir obj && echo k > obj/keep && git add -f obj/keep && git commit -qm keep)
91
112
  mk fresh # brand new, no commits: must survive
92
- for b in records empty-records locked locked-detached tracked-records scoped-records ignored live-holder; do
113
+ for b in built records empty-records locked locked-detached tracked-records scoped-records ignored live-holder; do
93
114
  mk "$b"; (cd "$t/wt-$b" && echo "$b" > "$b" && git add "$b" && git commit -qm "$b")
94
115
  case "$b" in
95
116
  tracked-records|scoped-records)
@@ -99,7 +120,10 @@ if [ "$SELFTEST" = 1 ]; then
99
120
  git merge -q --no-ff "$b" -m "merge $b"
100
121
  done
101
122
  mkdir "$t/wt-records/.ai-work" "$t/wt-empty-records/.ai-work"
102
- printf '.ai-work/\nignored-output\n' >> "$t/repo/.git/info/exclude"
123
+ printf '.ai-work/\nignored-output\nbin/\nobj/\nnode_modules/\n' >> "$t/repo/.git/info/exclude"
124
+ mkdir -p "$t/wt-built/bin/Debug" "$t/wt-unmerged/bin" "$t/wt-unmerged/node_modules/pkg" "$t/wt-unmerged/obj" "$t/wt-live-holder/bin" "$t/repo/bin"
125
+ echo b > "$t/wt-built/bin/Debug/a.dll"; echo o > "$t/wt-unmerged/bin/o.dll"; echo n > "$t/wt-unmerged/node_modules/pkg/i.js"
126
+ echo j > "$t/wt-unmerged/obj/junk"; echo h > "$t/wt-live-holder/bin/h.dll"; echo m > "$t/repo/bin/m.dll"
103
127
  echo handoff > "$t/wt-records/.ai-work/.handoff"
104
128
  echo build > "$t/wt-ignored/ignored-output"
105
129
  (cd "$t/wt-live-holder" && exec sleep 120) & holder=$!
@@ -133,8 +157,24 @@ if [ "$SELFTEST" = 1 ]; then
133
157
  chk "locked detached reported" 'grep -Fq "worktree $t/wt-locked-detached (detached): locked" <<<"$out"'
134
158
  chk "live holder kept" '[ -d "$t/wt-live-holder" ]'
135
159
  chk "live holder reason reported" 'grep -F "worktree $t/wt-live-holder (live-holder):" <<<"$out" | grep -E ": (live holder|live process)" >/dev/null'
160
+ chk "built delivered worktree removed" '[ ! -d "$t/wt-built" ]'
161
+ chk "built delivered branch removed" '! git rev-parse -q --verify refs/heads/built >/dev/null'
162
+ chk "fresh worktree output kept" '[ -f "$t/wt-unmerged/bin/o.dll" ] && [ -f "$t/wt-unmerged/node_modules/pkg/i.js" ]'
136
163
  chk "ignored file kept" '[ -f "$t/wt-ignored/ignored-output" ]'
137
164
  chk "ignored file reason" 'grep -Fq "has ignored/untracked files; archive or remove them first" <<<"$out"'
165
+ out=$(CRATIS_RECLAIM_IDLE_MINUTES=0 "$self" --no-fetch --dry-run 2>&1) || { echo "FAIL: reclaim dry-run exit $?"; echo "$out"; exit 1; }
166
+ chk "reclaim dry-run reports" 'grep -Fq "would reclaim" <<<"$out"'
167
+ chk "reclaim dry-run deletes none" '[ -f "$t/wt-unmerged/bin/o.dll" ]'
168
+ out=$(CRATIS_RECLAIM_IDLE_MINUTES=0 "$self" --no-fetch --no-reclaim 2>&1) || { echo "FAIL: no-reclaim exit $?"; echo "$out"; exit 1; }
169
+ chk "no-reclaim deletes none" '[ -f "$t/wt-unmerged/bin/o.dll" ]'
170
+ out=$(CRATIS_RECLAIM_IDLE_MINUTES=0 "$self" --no-fetch 2>&1) || { echo "FAIL: reclaim exit $?"; echo "$out"; exit 1; }
171
+ chk "idle build output reclaimed" '[ ! -d "$t/wt-unmerged/bin" ] && [ ! -d "$t/wt-unmerged/node_modules" ]'
172
+ chk "reclaim keeps source" '[ -f "$t/wt-unmerged/u" ] && [ -d "$t/wt-unmerged" ]'
173
+ chk "reclaim keeps tracked output" '[ -f "$t/wt-unmerged/obj/keep" ]'
174
+ chk "reclaim keeps main output" '[ -f "$t/repo/bin/m.dll" ]'
175
+ chk "reclaim skips live holder" '[ -f "$t/wt-live-holder/bin/h.dll" ]'
176
+ chk "reclaim keeps other ignored" '[ -f "$t/wt-ignored/ignored-output" ]'
177
+ chk "reclaim is reported" 'grep -Fq "reclaimed $t/wt-unmerged" <<<"$out"'
138
178
  out=$("$self" --no-fetch --dry-run 2>&1) || { echo "FAIL: dry-run exit $?"; echo "$out"; exit 1; }
139
179
  chk "dry-run reports live holder" 'grep -F "kept worktree $t/wt-live-holder (live-holder):" <<<"$out" | grep -E ": (live holder|live process)" >/dev/null'
140
180
  out=$(printf '%s' '{"hook_event_name":"SessionStart"}' | "$self" --no-fetch "--include-work-records=$t/wt-tracked-records" --hook 2>&1) || { echo "FAIL: hook exit $?"; echo "$out"; exit 1; }
@@ -450,6 +490,45 @@ worktree_clean() {
450
490
  if [ -n "$status" ]; then note_kept "worktree $wt ($name): delivered but has uncommitted changes"; return 1; fi
451
491
  return 0
452
492
  }
493
+ # ── Reclaim regenerable build output ──────────────────────────────────────────
494
+ # Only directories that are git-ignored, untracked in full, not symlinks and named like build output.
495
+ RECLAIM_NAMES='^(bin|obj|node_modules|dist|build|out|coverage|TestResults|_build|target|\.vite|\.next|\.nuxt|\.turbo|\.nx|\.angular|\.parcel-cache|\.gradle|\.venv|__pycache__)$'
496
+ RECLAIM_HELD=0; RECLAIMED=(); RECLAIMED_KB=0; RECLAIMED_PATHS=$'\n'
497
+ RECLAIM_DEADLINE=$(( $(date +%s) + $([ "$HOOK" = 1 ] && echo 45 || echo 900) ))
498
+ # Idle: no git metadata and no file outside node_modules changed within the window. Build output counts
499
+ # as activity, so a worktree someone just built or tested in is left alone.
500
+ worktree_idle() {
501
+ local w="$1" gd
502
+ [ "$IDLE_MINUTES" -gt 0 ] || return 0
503
+ gd=$(git -C "$w" rev-parse --absolute-git-dir 2>/dev/null) || return 1
504
+ [ -z "$(find "$gd/HEAD" "$gd/index" "$gd/logs/HEAD" -mmin "-$IDLE_MINUTES" -print -quit 2>/dev/null)" ] || return 1
505
+ [ -z "$(find "$w" -name node_modules -prune -o -type f -mmin "-$IDLE_MINUTES" -print -quit 2>/dev/null)" ]
506
+ }
507
+ reclaim_worktree() {
508
+ local w="$1" label="$2" force="${3:-0}" p kb total=0 names='' dirs=() abs
509
+ [ "$RECLAIM" = 1 ] && [ -d "$w" ] || return 0
510
+ case "$RECLAIMED_PATHS" in *$'\n'"$w"$'\n'*) return 0 ;; esac
511
+ [ "$(date +%s)" -lt "$RECLAIM_DEADLINE" ] || return 0
512
+ [ "$force" = 1 ] || worktree_idle "$w" || return 0
513
+ while IFS= read -r -d '' p; do
514
+ p=${p%/}
515
+ [[ -n "$p" && "${p##*/}" =~ $RECLAIM_NAMES ]] || continue
516
+ abs="$w/$p"
517
+ [ -d "$abs" ] && [ ! -L "$abs" ] || continue
518
+ [ -z "$(git -C "$w" ls-files -- "$p" 2>/dev/null | head -n 1)" ] || continue
519
+ dirs+=("$p")
520
+ done < <(git -C "$w" ls-files -z --others --ignored --exclude-standard --directory 2>/dev/null)
521
+ [ "${#dirs[@]}" -gt 0 ] || return 0
522
+ if ! check_holders "$w"; then RECLAIM_HELD=1; return 0; fi
523
+ for p in "${dirs[@]}"; do
524
+ kb=$(du -sk "$w/$p" 2>/dev/null | awk '{print $1}'); total=$((total + ${kb:-0}))
525
+ case "$names " in *" ${p##*/} "*) ;; *) names="$names ${p##*/}" ;; esac
526
+ done
527
+ RECLAIMED_PATHS="$RECLAIMED_PATHS$w"$'\n'
528
+ if [ "$DRY" = 1 ]; then RECLAIMED+=("$w ($label): would reclaim $((total / 1024)) MB (${#dirs[@]} dirs:$names)"); RECLAIMED_KB=$((RECLAIMED_KB + total)); return 0; fi
529
+ for p in "${dirs[@]}"; do rm -rf -- "${w:?}/$p" 2>/dev/null; done
530
+ RECLAIMED_KB=$((RECLAIMED_KB + total)); RECLAIMED+=("$w ($label): $((total / 1024)) MB build output (${#dirs[@]} dirs:$names)")
531
+ }
453
532
  execute_worktree() {
454
533
  local name="${br:-detached}" ev="$1" current
455
534
  current=$(git -C "$wt" rev-parse HEAD 2>/dev/null) || return 0
@@ -461,6 +540,8 @@ execute_worktree() {
461
540
  fi
462
541
  if [ -n "$records" ]; then note_kept "worktree $wt ($name): has work records (.ai-work/)"; return 0; fi
463
542
  fi
543
+ RECLAIM_HELD=0; reclaim_worktree "$wt" "$name" 1
544
+ if [ "$RECLAIM_HELD" = 1 ]; then note_kept "worktree $wt ($name): $HOLDER_REASON"; return 0; fi
464
545
  worktree_clean || return 0
465
546
  local kb; kb=$(du -sk "$wt" 2>/dev/null | awk '{print $1}')
466
547
  if ! check_holders "$wt"; then note_kept "worktree $wt ($name): $HOLDER_REASON"; return 0; fi
@@ -524,12 +605,33 @@ for ((i=0; i<${#PLAN_KIND[@]}; i++)); do
524
605
  else note_kept "branch $br: git refused to delete it"; fi
525
606
  done
526
607
 
608
+ # ── Reclaim build output from the worktrees that stay ─────────────────────────
609
+ reclaim_entry() {
610
+ [ -n "$rwt" ] || return 0
611
+ if [ "$rfirst" = 1 ]; then rfirst=0; return 0; fi
612
+ [ "$rlocked" = 0 ] || return 0
613
+ case "$here/" in "$rwt"/*) return 0 ;; esac
614
+ reclaim_worktree "$rwt" "$rbr" 0
615
+ }
616
+ if [ "$RECLAIM" = 1 ]; then
617
+ rwt=''; rbr=''; rlocked=0; rfirst=1
618
+ while IFS= read -r line; do
619
+ case "$line" in
620
+ "worktree "*) reclaim_entry; rwt=${line#worktree }; rbr=''; rlocked=0 ;;
621
+ "branch "*) rbr=${line#branch refs/heads/} ;;
622
+ "locked"*) rlocked=1 ;;
623
+ esac
624
+ done < <(git worktree list --porcelain; echo)
625
+ reclaim_entry
626
+ fi
627
+
527
628
  # ── Report ────────────────────────────────────────────────────────────────────
528
629
  summary="cratis-cleanup-worktrees: ${#REMOVED[@]} removed, ${#KEPT[@]} kept"
529
630
  [ "$FREED_KB" -gt 0 ] && summary="$summary, $((FREED_KB / 1024)) MB freed"
631
+ [ "${#RECLAIMED[@]}" -gt 0 ] && summary="$summary, $((RECLAIMED_KB / 1024)) MB build output $([ "$DRY" = 1 ] && echo reclaimable || echo reclaimed) from ${#RECLAIMED[@]} worktrees"
530
632
  [ "${LOG_NOFETCH:-0}" = 1 ] && summary="$summary (fetch failed: compared against the last fetched $default)"
531
633
  if [ "$HOOK" = 1 ]; then
532
- [ "${#REMOVED[@]}" -gt 0 ] || { [ "$EVENT" = "SessionStart" ] && [ "${#KEPT[@]}" -gt 0 ]; } || exit 0
634
+ [ "${#REMOVED[@]}" -gt 0 ] || [ "${#RECLAIMED[@]}" -gt 0 ] || { [ "$EVENT" = "SessionStart" ] && [ "${#KEPT[@]}" -gt 0 ]; } || exit 0
533
635
  msg="$summary."
534
636
  [ "${#KEPT[@]}" -gt 0 ] && msg="$msg Kept (not delivered or not safe to remove): $(printf '%s; ' "${KEPT[@]}")"
535
637
  command -v jq >/dev/null 2>&1 && jq -nc --arg m "$msg" --arg e "$EVENT" '{systemMessage:$m,hookSpecificOutput:{hookEventName:$e,additionalContext:$m}}' || printf '%s\n' "$msg" >&2
@@ -538,6 +640,7 @@ fi
538
640
  if [ "$QUIET" = 0 ]; then
539
641
  echo "$summary"
540
642
  for r in "${REMOVED[@]+"${REMOVED[@]}"}"; do echo " removed $r"; done
643
+ for r in "${RECLAIMED[@]+"${RECLAIMED[@]}"}"; do echo " reclaimed $r"; done
541
644
  for k in "${KEPT[@]+"${KEPT[@]}"}"; do echo " kept $k"; done
542
645
  fi
543
646
  exit 0
@@ -517,7 +517,7 @@ function managed_script( i) {
517
517
  return 1
518
518
  }
519
519
  if (W[1] == "bash" && W[2] == ".cratis/ai/hooks/scripts/cratis-cleanup-worktrees.sh") {
520
- for (i = 3; i <= argc; i++) if (W[i] !~ /^--(dry-run|quiet|no-fetch)$/) return 0
520
+ for (i = 3; i <= argc; i++) if (W[i] !~ /^--(dry-run|quiet|no-fetch|reclaim|no-reclaim)$/) return 0
521
521
  return 1
522
522
  }
523
523
  return 0
@@ -67,14 +67,12 @@
67
67
  " { \"gates\": [ { \"id\": \"frontend-lint\", \"workingDirectory\": \"Source/App\" } ] }",
68
68
  "",
69
69
  "Note the Release build passes -p:CratisProxiesSkip=true so the proxy",
70
- "generator does not re-run and touch already-correct generated files. From Arc 22.185.1 that",
71
- "is the off switch: the target skips when CratisProxiesSkip is true even if the output path is",
72
- "set. Older Arc ignores it silently, so the command also clears CratisProxiesOutputPath, which",
73
- "older Arc honors (the target requires it to be non-empty).",
70
+ "generator does not re-run and touch already-correct generated files: the target skips when",
71
+ "CratisProxiesSkip is true even if the output path is set.",
74
72
  "The Debug/Release split is for these client-side local hooks only: the committing client's",
75
73
  "Debug gate omits the override because the Debug build is the canonical proxy-regeneration",
76
74
  "trigger, and the client commits the result. CI never copies that Debug proxy step: it passes",
77
- "-p:CratisProxiesSkip=true -p:CratisProxiesOutputPath= (Skip needs Arc 22.185.1 or later) in every configuration."
75
+ "-p:CratisProxiesSkip=true in every configuration."
78
76
  ],
79
77
  "enabled": true,
80
78
  "failFast": true,