@amsterdamdatalabs/adl-agent-control-linux-x64 0.1.10 → 0.1.26

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 (413) hide show
  1. package/bin/adl +2 -2
  2. package/bin/git +17 -18
  3. package/bin/git-ado +27 -26
  4. package/bin/git-defaults +173 -0
  5. package/bin/health-check +8 -1
  6. package/bin/kimi-hooks +1 -1
  7. package/bin/lib/adl-package.sh +257 -0
  8. package/bin/lib/bun-compile-build.sh +1 -1
  9. package/bin/lib/fleet-host.sh +62 -0
  10. package/bin/lib/lean-ctx-observe-hooks.sh +9 -9
  11. package/bin/reconcile +693 -470
  12. package/bin/reconcile-host +121 -0
  13. package/bin/setup +219 -0
  14. package/bin/shell-path-policy +15 -5
  15. package/bin/sync-and-reconcile +79 -68
  16. package/bin/validate-manifest +46 -51
  17. package/package.json +2 -12
  18. package/packages/agent-hooks/README.md +14 -9
  19. package/packages/agent-hooks/assets/hooks.json +0 -20
  20. package/packages/agent-hooks/package.json +1 -2
  21. package/packages/agent-hooks/src/cli/args.ts +1 -1
  22. package/packages/agent-hooks/src/cli/doctor.ts +6 -58
  23. package/packages/agent-hooks/src/deploy/deploy.ts +12 -41
  24. package/packages/agent-hooks/src/deploy/doctor.ts +8 -11
  25. package/packages/agent-hooks/src/deploy/index.ts +14 -14
  26. package/packages/agent-hooks/src/deploy/json-merge.ts +7 -8
  27. package/packages/agent-hooks/src/deploy/legacy-lock.ts +2 -2
  28. package/packages/agent-hooks/src/deploy/list.ts +1 -1
  29. package/packages/agent-hooks/src/deploy/lock.ts +31 -12
  30. package/packages/agent-hooks/src/deploy/profile.ts +3 -4
  31. package/packages/agent-hooks/src/deploy/source.ts +1 -1
  32. package/packages/agent-hooks/src/gating/config.ts +10 -24
  33. package/packages/agent-hooks/src/gating/root.ts +3 -3
  34. package/packages/agent-hooks/src/hooks/briefing/handler.ts +2 -2
  35. package/packages/agent-hooks/src/hooks/briefing/index.ts +27 -287
  36. package/packages/agent-hooks/src/hooks/contract.ts +17 -17
  37. package/packages/agent-hooks/src/hooks/crg/background.ts +27 -0
  38. package/packages/agent-hooks/src/hooks/crg/index.ts +7 -6
  39. package/packages/agent-hooks/src/hooks/log.ts +8 -10
  40. package/packages/agent-hooks/src/hooks/user-prompt-submit/match.ts +1 -1
  41. package/packages/agent-hooks/src/hooks/user-prompt-submit/tokenizer.ts +1 -1
  42. package/packages/agent-hooks/src/hooks/user-prompt-submit/vector.ts +6 -5
  43. package/packages/agent-hooks/src/hosts/registry.ts +1 -1
  44. package/packages/agent-hooks/src/log/adl-dir.ts +44 -0
  45. package/packages/agent-hooks/src/log/writer.ts +16 -2
  46. package/packages/agent-hooks/src/main.ts +7 -41
  47. package/packages/agent-hooks/src/pre-tool-use/handler.ts +71 -82
  48. package/packages/agent-hooks/src/rules/engine.ts +13 -17
  49. package/packages/agent-hooks/src/rules/impl/adl-build-run-denied.ts +3 -3
  50. package/packages/agent-hooks/src/rules/impl/adl-git-credential-bypass.ts +12 -14
  51. package/packages/agent-hooks/src/rules/impl/adl-git-identity.ts +28 -28
  52. package/packages/agent-hooks/src/rules/impl/adl-git-push-policy.ts +8 -9
  53. package/packages/agent-hooks/src/rules/impl/adl-human-azdo-bypass.ts +56 -59
  54. package/packages/agent-hooks/src/rules/impl/adl-identity.ts +16 -23
  55. package/packages/agent-hooks/src/rules/impl/adl-mcp-cli.ts +19 -16
  56. package/packages/agent-hooks/src/rules/impl/adl-pr-complete-pending.ts +2 -2
  57. package/packages/agent-hooks/src/rules/impl/adl-pr-review-role.ts +9 -12
  58. package/packages/agent-hooks/src/rules/impl/adl-pr-role.ts +5 -7
  59. package/packages/agent-hooks/src/rules/impl/adl-run-required.ts +411 -0
  60. package/packages/agent-hooks/src/rules/impl/adl-token-minting-role.ts +4 -5
  61. package/packages/agent-hooks/src/rules/impl/adl-workitem-role.ts +6 -7
  62. package/packages/agent-hooks/src/rules/impl/agent-tamper-protection.ts +77 -70
  63. package/packages/agent-hooks/src/rules/impl/deny-allowlist.ts +159 -0
  64. package/packages/agent-hooks/src/rules/impl/fs-trash.ts +2 -2
  65. package/packages/agent-hooks/src/rules/impl/git-helpers.ts +21 -23
  66. package/packages/agent-hooks/src/rules/impl/git-worktree.ts +14 -28
  67. package/packages/agent-hooks/src/rules/impl/mcp-tool.ts +3 -3
  68. package/packages/agent-hooks/src/rules/impl/messages.ts +1 -1
  69. package/packages/agent-hooks/src/rules/impl/pr-completion.ts +1 -1
  70. package/packages/agent-hooks/src/rules/impl/tool-azure-devops.ts +35 -46
  71. package/packages/agent-hooks/src/rules/impl/tool-find.ts +34 -7
  72. package/packages/agent-hooks/src/rules/impl/tool-grep.ts +34 -12
  73. package/packages/agent-hooks/src/rules/impl/tool-native-search.ts +52 -9
  74. package/packages/agent-hooks/src/rules/ports.ts +5 -7
  75. package/packages/agent-hooks/src/rules/registry.ts +4 -6
  76. package/packages/agent-hooks/src/rules/shell/git-identity.ts +86 -101
  77. package/packages/agent-hooks/src/rules/shell/git-internals.ts +1 -1
  78. package/packages/agent-hooks/src/rules/shell/invocation.ts +24 -118
  79. package/packages/agent-hooks/src/rules/shell/piped-script.ts +1 -1
  80. package/packages/agent-hooks/src/rules/shell/prefixes.ts +1 -1
  81. package/packages/agent-hooks/src/rules/shell/protected-carrier-writes.ts +11 -10
  82. package/packages/agent-hooks/src/rules/shell/protected-carriers.ts +26 -26
  83. package/packages/agent-hooks/src/rules/shell/substitution.ts +1 -1
  84. package/packages/agent-hooks/src/rules/shell/xargs.ts +2 -2
  85. package/packages/agent-hooks/src/rules/spec.ts +2 -2
  86. package/packages/agent-settings/README.md +287 -0
  87. package/packages/agent-settings/assets/GLOBAL-AGENTS.md +18 -18
  88. package/packages/agent-settings/assets/agents/architect.toml +2 -0
  89. package/packages/agent-settings/assets/agents/code-reviewer.toml +2 -0
  90. package/packages/agent-settings/assets/agents/executor.toml +2 -0
  91. package/packages/agent-settings/assets/agents/explore.toml +2 -0
  92. package/packages/agent-settings/assets/agents/planner.toml +2 -0
  93. package/packages/agent-settings/assets/mcp.json +0 -4
  94. package/packages/agent-settings/deploy-profile.json +139 -0
  95. package/packages/agent-settings/deploy-profile.schema.json +147 -0
  96. package/packages/agent-settings/managed/README.md +29 -30
  97. package/packages/agent-settings/managed/codex-requirements.toml +9 -9
  98. package/packages/agent-settings/package.json +20 -0
  99. package/packages/agent-settings/src/deploy/agent-render.ts +2 -2
  100. package/packages/agent-settings/src/deploy/agent-toml.ts +1 -1
  101. package/packages/agent-settings/src/deploy/agents-deploy.ts +17 -3
  102. package/packages/agent-settings/src/deploy/doctor.ts +3 -83
  103. package/packages/agent-settings/src/deploy/index.ts +6 -33
  104. package/packages/agent-settings/src/deploy/legacy-lock.ts +6 -6
  105. package/packages/agent-settings/src/deploy/list.ts +5 -19
  106. package/packages/agent-settings/src/deploy/lock.ts +8 -18
  107. package/packages/agent-settings/src/deploy/mcp-deploy.ts +10 -5
  108. package/packages/agent-settings/src/deploy/mcp-merge.ts +22 -3
  109. package/packages/agent-settings/src/deploy/mcp-source.ts +1 -1
  110. package/packages/agent-settings/src/deploy/profile.ts +11 -35
  111. package/packages/agent-settings/src/deploy/retire-lean-ctx.ts +184 -0
  112. package/packages/agent-settings/src/deploy/settings.ts +17 -22
  113. package/packages/agent-settings/src/global-surface-sweep.ts +5 -17
  114. package/packages/agent-settings/src/kimi-hooks.ts +339 -192
  115. package/packages/agent-settings/src/opencode-hooks.ts +1 -1
  116. package/packages/agent-settings/tsconfig.json +23 -0
  117. package/packages/agent-skills/assets/agent-search-tool-audit/SKILL.md +120 -0
  118. package/packages/agent-skills/assets/agent-search-tool-audit/scripts/audit.sh +276 -0
  119. package/packages/agent-skills/assets/debug-issue/SKILL.md +8 -7
  120. package/packages/agent-skills/assets/explore-codebase/SKILL.md +13 -13
  121. package/packages/agent-skills/assets/refactor-safely/SKILL.md +12 -11
  122. package/packages/agent-skills/assets/review-changes/SKILL.md +7 -7
  123. package/packages/agent-skills/assets/testing/references/e2e.md +37 -0
  124. package/packages/agent-skills/assets/testing/references/integration.md +37 -0
  125. package/packages/agent-skills/assets/testing/references/unit.md +32 -0
  126. package/packages/agent-skills/dist/deploy.d.ts +2 -0
  127. package/packages/agent-skills/dist/deploy.d.ts.map +1 -1
  128. package/packages/agent-skills/dist/deploy.js +27 -1
  129. package/packages/agent-skills/dist/deploy.js.map +1 -1
  130. package/packages/agent-skills/dist/doctor.d.ts +0 -2
  131. package/packages/agent-skills/dist/doctor.d.ts.map +1 -1
  132. package/packages/agent-skills/dist/doctor.js +1 -1
  133. package/packages/agent-skills/dist/doctor.js.map +1 -1
  134. package/packages/agent-skills/dist/fs-utils.d.ts +0 -1
  135. package/packages/agent-skills/dist/fs-utils.d.ts.map +1 -1
  136. package/packages/agent-skills/dist/fs-utils.js +1 -1
  137. package/packages/agent-skills/dist/fs-utils.js.map +1 -1
  138. package/packages/agent-skills/package.json +1 -1
  139. package/packages/agent-skills/src/deploy.ts +29 -1
  140. package/packages/agent-skills/src/doctor.ts +1 -1
  141. package/packages/agent-skills/src/fs-utils.ts +1 -1
  142. package/packages/azdo/README.md +10 -9
  143. package/packages/azdo/package.json +2 -5
  144. package/packages/azdo/src/azdo-pl.ts +2 -54
  145. package/packages/azdo/src/azdo-pr-review.ts +4 -4
  146. package/packages/azdo/src/azdo-repo-doctor.ts +101 -52
  147. package/packages/azdo/src/azdo-wit.ts +41 -2
  148. package/packages/azdo/src/lib/agent-identity.ts +12 -14
  149. package/packages/azdo/src/lib/agent-token.ts +2 -2
  150. package/packages/azdo/src/lib/client.ts +0 -5
  151. package/packages/azdo/src/lib/graph-identity.ts +4 -4
  152. package/packages/azdo/src/workflow-rules-matrix.csv +85 -0
  153. package/packages/azdo/src/workflow-rules.ts +128 -0
  154. package/packages/fleet/manifest.json +38 -33
  155. package/packages/fleet/manifest.schema.json +67 -65
  156. package/packages/fleet/src/default-agent-file.ts +3 -3
  157. package/packages/fleet/src/install-adl-package.ts +73 -15
  158. package/packages/fleet/src/install-embedding-model.ts +14 -14
  159. package/packages/fleet/src/managed-settings.ts +7 -7
  160. package/packages/fleet/src/repo-maintain.ts +439 -0
  161. package/packages/fleet/src/scratch-reap.ts +6 -6
  162. package/packages/fleet/src/vscode-settings.ts +5 -5
  163. package/packages/repo-controls/README.md +141 -43
  164. package/packages/repo-controls/assets/promote.ts +4 -4
  165. package/packages/repo-controls/assets/reconcile-guard.sh +10 -46
  166. package/packages/repo-controls/assets/version-bump.sh +31 -84
  167. package/packages/repo-controls/bunfig.toml +6 -7
  168. package/packages/repo-controls/package/adl-compliance/AGENTS.md +5 -6
  169. package/packages/repo-controls/package/adl-compliance/conftest.py +3 -1
  170. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/__init__.py +4 -16
  171. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/adr_lifecycle/test_check.py +9 -2
  172. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/closed_set/fixtures/docs/notes.md +1 -0
  173. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/closed_set/test_check.py +11 -0
  174. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/__init__.py +7 -0
  175. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/check.py +266 -0
  176. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-assets/docs/guide/.drafts/c.md +1 -0
  177. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-assets/docs/guide/.drafts/d.md +1 -0
  178. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-assets/docs/guide/.hidden.md +1 -0
  179. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-assets/docs/guide/a.md +1 -0
  180. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-assets/docs/guide/b.md +1 -0
  181. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-assets/docs/guide/data.csv +1 -0
  182. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-assets/docs/guide/diagram.png +1 -0
  183. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-assets/docs/guide/mock.png +1 -0
  184. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-assets/docs/guide/sub/nested.md +1 -0
  185. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-assets/docs.md +1 -0
  186. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-assets/grants.yaml +4 -0
  187. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-assets/plans/deep/p1.md +1 -0
  188. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-assets/plans/deep/p2.md +1 -0
  189. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-assets/plans/deep/p3.md +1 -0
  190. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-assets/plans/deep/p4.md +1 -0
  191. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-assets/plans/deep/p5.md +1 -0
  192. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-clean/docs/architecture/build.md +1 -0
  193. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-clean/docs/architecture/overview.md +1 -0
  194. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-clean/docs/guide/install.md +1 -0
  195. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-clean/docs/guide/start.md +1 -0
  196. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-clean/grants.yaml +4 -0
  197. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-decisions/docs/decisions/adr-001-tenancy.md +1 -0
  198. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-decisions/docs/decisions/adr-002-carrier.md +1 -0
  199. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-decisions/docs/decisions/adr-003-cli.md +1 -0
  200. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-decisions/docs/decisions/archive/adr-000-old.md +1 -0
  201. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-decisions/docs/decisions/archive/adr-000-older.md +1 -0
  202. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-decisions/docs/guide/a.md +1 -0
  203. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-decisions/docs/guide/b.md +1 -0
  204. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-decisions/docs/guide/c.md +1 -0
  205. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-decisions/grants.yaml +4 -0
  206. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-default-cap/docs/guide/page-01.md +1 -0
  207. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-default-cap/docs/guide/page-02.md +1 -0
  208. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-default-cap/docs/guide/page-03.md +1 -0
  209. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-default-cap/docs/guide/page-04.md +1 -0
  210. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-default-cap/docs/guide/page-05.md +1 -0
  211. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-default-cap/docs/guide/page-06.md +1 -0
  212. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-default-cap/docs/guide/page-07.md +1 -0
  213. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-default-cap/docs/guide/page-08.md +1 -0
  214. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-default-cap/docs/guide/page-09.md +1 -0
  215. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-default-cap/docs/guide/page-10.md +1 -0
  216. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-default-cap/docs/guide/page-11.md +1 -0
  217. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-default-cap/docs/guide/page-12.md +1 -0
  218. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-default-cap/docs/guide/page-13.md +1 -0
  219. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-default-cap/docs/guide/page-14.md +1 -0
  220. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-default-cap/docs/guide/page-15.md +1 -0
  221. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-default-cap/docs/guide/page-16.md +1 -0
  222. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-default-cap/grants.yaml +4 -0
  223. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-exempt/docs/guide/a.md +1 -0
  224. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-exempt/docs/guide/b.md +1 -0
  225. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-exempt/docs/guide/c.md +1 -0
  226. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-exempt/grants.yaml +4 -0
  227. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-grew/docs/guide/a.md +1 -0
  228. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-grew/docs/guide/b.md +1 -0
  229. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-grew/docs/guide/c.md +1 -0
  230. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-grew/grants.yaml +4 -0
  231. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-no-section/docs/guide/a.md +1 -0
  232. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-no-section/docs/guide/b.md +1 -0
  233. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-no-section/docs/guide/c.md +1 -0
  234. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-no-section/docs/guide/d.md +1 -0
  235. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-no-section/docs/guide/e.md +1 -0
  236. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-no-section/grants.yaml +4 -0
  237. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-over-cap/docs/guide/a.md +1 -0
  238. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-over-cap/docs/guide/b.md +1 -0
  239. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-over-cap/docs/guide/c.md +1 -0
  240. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-over-cap/docs/short/only.md +1 -0
  241. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-over-cap/grants.yaml +4 -0
  242. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-stale/docs/held/a.md +1 -0
  243. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-stale/docs/held/b.md +1 -0
  244. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-stale/docs/held/c.md +1 -0
  245. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-stale/docs/held/d.md +1 -0
  246. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-stale/docs/shrunk/a.md +1 -0
  247. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-stale/docs/shrunk/b.md +1 -0
  248. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-stale/grants.yaml +6 -0
  249. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-unusable/docs/guide/a.md +1 -0
  250. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-unusable/docs/guide/b.md +1 -0
  251. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-unusable/docs/guide/c.md +1 -0
  252. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-unusable/grants.yaml +3 -0
  253. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/test_check.py +345 -0
  254. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/english_only/check.py +18 -5
  255. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/english_only/test_check.py +35 -0
  256. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/filename/__init__.py +7 -0
  257. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/filename/check.py +91 -0
  258. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/filename/fixtures/docs/AGENTS.md +3 -0
  259. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/filename/fixtures/docs/CLAUDE.md +3 -0
  260. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/filename/fixtures/docs/architecture/-leading-hyphen.md +3 -0
  261. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/filename/fixtures/docs/architecture/AGENTS.md +3 -0
  262. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/filename/fixtures/docs/architecture/double--hyphen.md +3 -0
  263. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/filename/fixtures/docs/architecture/getting started.md +3 -0
  264. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/filename/fixtures/docs/architecture/nested/page-here.md +3 -0
  265. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/filename/fixtures/docs/architecture/trailing-hyphen-.md +3 -0
  266. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/filename/fixtures/docs/architecture/ui-contract.md +4 -0
  267. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/filename/fixtures/docs/architecture/user_profile.md +3 -0
  268. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/filename/fixtures/docs/assets/UI-CONTRACT.png +2 -0
  269. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/filename/fixtures/docs/assets/diagram.png +1 -0
  270. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/filename/fixtures/docs/index.md +4 -0
  271. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/filename/fixtures/docs/notes.md +3 -0
  272. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/filename/fixtures/docs/reference.html +1 -0
  273. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/filename/fixtures/docs/research/2026-10-experiment.md +3 -0
  274. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/filename/fixtures/docs/research/UI-CONTRACT.md +6 -0
  275. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/filename/fixtures/docs.md +5 -0
  276. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/filename/test_check.py +194 -0
  277. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/indexes/check.py +14 -2
  278. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/indexes/docs-knowledge-indexes.yaml +5 -5
  279. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/indexes/fixtures/knowledge-indexes-shipped-register-legacy/docs/compliance/index.md +10 -0
  280. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/indexes/fixtures/knowledge-indexes-shipped-register-type/docs/compliance/index.md +10 -0
  281. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/indexes/test_check.py +58 -6
  282. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/ledger/test_check.py +0 -1
  283. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/check.py +64 -17
  284. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/docs-okf-profiles.yaml +60 -9
  285. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-ledger-clean/docs/notes.md +17 -0
  286. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-ledger-no-lines/docs/notes.md +13 -0
  287. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-profile-clean/docs/architecture/demo.md +0 -1
  288. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-profile-clean/docs-okf-profiles.yaml +0 -1
  289. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-profile-untyped/docs/research/no-type.md +9 -0
  290. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-profile-untyped/docs/research/typed-experiment.md +10 -0
  291. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-profile-untyped/docs/research/typed-research.md +10 -0
  292. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-profile-untyped/docs-okf-profiles.yaml +5 -0
  293. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-profile-violation/docs/architecture/bad-status.md +0 -1
  294. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-profile-violation/docs-okf-profiles.yaml +0 -1
  295. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-research/docs/research/experiment-ok.md +15 -0
  296. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-research/docs/research/extra-key.md +15 -0
  297. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-research/docs/research/extra-keys.md +16 -0
  298. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-research/docs/research/missing-created.md +11 -0
  299. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-research/docs/research/missing-description.md +11 -0
  300. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-research/docs/research/missing-last-update.md +11 -0
  301. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-research/docs/research/missing-sources.md +10 -0
  302. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-research/docs/research/missing-status.md +11 -0
  303. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-research/docs/research/missing-title.md +11 -0
  304. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-research/docs/research/optional-keys.md +16 -0
  305. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-research/docs/research/research-ok.md +14 -0
  306. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-research-neighbours/docs/architecture/created-date.md +21 -0
  307. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-research-neighbours/docs/architecture/research-shaped.md +19 -0
  308. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-research-neighbours/docs/operations/runbook.md +26 -0
  309. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/test_check.py +228 -2
  310. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/register.py +5 -0
  311. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/semantics/test_check.py +11 -2
  312. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/__init__.py +5 -3
  313. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/check.py +160 -44
  314. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-clean/grants.yaml +0 -2
  315. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-empty-register/frontend/packages/desktop/src/a.ts +1 -0
  316. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-empty-register/frontend/packages/desktop/src/b.ts +1 -0
  317. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-empty-register/grants.yaml +3 -0
  318. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-excluded/grants.yaml +0 -2
  319. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-missing-tree/frontend/packages/desktop/src/renderer/solo/item.ts +1 -0
  320. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-missing-tree/grants.yaml +5 -0
  321. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-no-ceilings/frontend/packages/desktop/src/a.ts +1 -0
  322. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-no-ceilings/frontend/packages/desktop/src/b.ts +1 -0
  323. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-no-ceilings/frontend/packages/desktop/src/c.ts +1 -0
  324. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-no-ceilings/grants.yaml +4 -0
  325. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-stale-entry/frontend/packages/desktop/src/renderer/solo/item.ts +1 -0
  326. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-stale-entry/grants.yaml +5 -0
  327. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-unbaselined/grants.yaml +0 -2
  328. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-unusable-register/frontend/packages/desktop/src/renderer/solo/item.ts +1 -0
  329. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-unusable-register/grants.yaml +3 -0
  330. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/register.py +127 -0
  331. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/test_check.py +265 -29
  332. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/markdown_trees/check.py +75 -2
  333. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/markdown_trees/test_check.py +194 -0
  334. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/open_work_cap/check.py +56 -10
  335. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/open_work_cap/test_check.py +256 -0
  336. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/placement/check.py +40 -12
  337. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/placement/test_check.py +108 -0
  338. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/plans_layout/test_check.py +1 -1
  339. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/references/check.py +2 -3
  340. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/root_closed_set/check.py +23 -6
  341. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/root_closed_set/test_check.py +76 -0
  342. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/root_markdown_allowlist/check.py +58 -17
  343. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/root_markdown_allowlist/test_check.py +161 -0
  344. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/scripts_size_depth/check.py +35 -3
  345. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/scripts_size_depth/test_check.py +108 -1
  346. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/check.py +281 -61
  347. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/malformed/absolute-path.yaml +3 -0
  348. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/malformed/backslash-path.yaml +3 -0
  349. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/malformed/baseline-is-a-list.yaml +2 -0
  350. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/malformed/boolean-size.yaml +3 -0
  351. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/malformed/dot-segment.yaml +3 -0
  352. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/malformed/duplicate-path.yaml +4 -0
  353. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/malformed/empty-file.yaml +0 -0
  354. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/malformed/empty-segment.yaml +3 -0
  355. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/malformed/float-size.yaml +3 -0
  356. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/malformed/negative-size.yaml +3 -0
  357. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/malformed/no-over-limit-baseline.yaml +1 -0
  358. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/malformed/no-schema-version.yaml +1 -0
  359. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/malformed/non-string-path.yaml +3 -0
  360. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/malformed/not-yaml.yaml +2 -0
  361. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/malformed/null-size.yaml +3 -0
  362. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/malformed/parent-segment.yaml +3 -0
  363. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/malformed/string-size.yaml +3 -0
  364. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/malformed/top-level-is-a-list.yaml +2 -0
  365. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/malformed/trailing-slash.yaml +3 -0
  366. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/malformed/unknown-key.yaml +3 -0
  367. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/malformed/wrong-schema-version.yaml +2 -0
  368. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/malformed/zero-size.yaml +3 -0
  369. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/valid.yaml +4 -0
  370. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/test_check.py +758 -45
  371. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/ignored_paths/check.py +4 -3
  372. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/ignored_paths/test_check.py +2 -2
  373. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/lockfile_integrity/cargo_lock.py +490 -0
  374. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/lockfile_integrity/check.py +368 -55
  375. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/lockfile_integrity/test_check.py +4 -2
  376. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/lockfile_integrity/test_declared_paths.py +523 -0
  377. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/lockfile_integrity/test_stale_lock.py +1179 -0
  378. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/cli.py +122 -3
  379. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/core/check.py +33 -1
  380. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/core/constants.py +0 -11
  381. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/core/context.py +16 -1
  382. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/policy/config.py +1 -2
  383. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/policy/docs_shape.py +12 -1
  384. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/policy/gate-registry.alt.yaml +133 -147
  385. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/policy/gate-registry.yaml +133 -147
  386. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/policy/registry.py +1 -1
  387. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/policy/root_shape.py +52 -10
  388. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/runner.py +23 -4
  389. package/packages/repo-controls/package.json +2 -10
  390. package/packages/repo-controls/scripts/hooks/post-merge +13 -0
  391. package/packages/repo-controls/scripts/hooks/pre-push +3 -3
  392. package/packages/repo-controls/src/azdo-push.ts +64 -36
  393. package/packages/repo-controls/src/azure-devops-governance.ts +7 -9
  394. package/packages/repo-controls/src/azure-devops-remote.ts +1 -1
  395. package/packages/repo-controls/src/cli.ts +29 -8
  396. package/packages/repo-controls/src/compliance-config.ts +410 -2
  397. package/packages/repo-controls/src/config.ts +133 -60
  398. package/packages/repo-controls/src/constants.ts +13 -27
  399. package/packages/repo-controls/src/coverage-ratchet.ts +4 -4
  400. package/packages/repo-controls/src/doctor.ts +46 -19
  401. package/packages/repo-controls/src/gitignore-block.ts +5 -29
  402. package/packages/repo-controls/src/hook-log.ts +1 -2
  403. package/packages/repo-controls/src/hook.ts +201 -45
  404. package/packages/repo-controls/src/install.ts +14 -8
  405. package/packages/repo-controls/src/integrity.ts +3 -3
  406. package/packages/repo-controls/src/lfs.ts +111 -0
  407. package/packages/repo-controls/src/promote.ts +8 -8
  408. package/packages/repo-controls/src/runtime.ts +9 -1
  409. package/packages/repo-controls/src/workflows-drift.ts +4 -5
  410. package/packages/repo-controls/src/worktree-guard.ts +3 -3
  411. package/packages/fleet/jobs/git-maintain/src/main.ts +0 -848
  412. package/packages/fleet/systemd/adl-azure-agent-update.service +0 -13
  413. package/packages/fleet/systemd/adl-azure-agent-update.timer +0 -10
@@ -3,13 +3,12 @@
3
3
  *
4
4
  * `controls hook <kind> --host=X` is invoked by agent hosts (Claude Code,
5
5
  * Codex, Cursor, OpenCode, Kimi) with a JSON payload on stdin. Every kind
6
- * (`pre-tool-use`, `user-prompt-submit`, `briefing`, `crg`, `lean-ctx`
7
- * pre-tool-use/post-tool-use) is dispatched from `src/main.ts` through one
6
+ * (`pre-tool-use`, `user-prompt-submit`, `briefing`, `crg`) is dispatched
7
+ * from `src/main.ts` through one
8
8
  * `HookHandler` shape, so a handler never sees `process`, argv, or stdin
9
9
  * directly — only the `HookInvocation` it is called with, and it returns a
10
10
  * `HookResult` for `main.ts` to write to stdout/stderr and turn into a
11
- * process exit code. `lean-ctx mcp` is the one exception: it is not a
12
- * `HookHandler` at all — see `src/lean-ctx/mcp.ts`'s header.
11
+ * process exit code.
13
12
  *
14
13
  * This file is intentionally the *only* place that shape is defined: other
15
14
  * agents implementing `src/hooks/user-prompt-submit/`, `src/hooks/briefing/`,
@@ -31,26 +30,27 @@ export interface ActivityNote {
31
30
  /** `PASS`, `DENY <rule>`, `ERROR <what>`, `TIMEOUT <what>`, or `SKIP <why>`. */
32
31
  readonly reason: string
33
32
  readonly message?: string
34
- /** What the hook invoked downstream, e.g. `lean-ctx hook redirect`, `skills: tdd, research`. */
33
+ /** What the hook invoked downstream, e.g. `skills: tdd, research`. */
35
34
  readonly downstream?: string
36
35
  /** Set only for a blocked pre-tool-use decision: the rule id written to the deny log. */
37
36
  readonly denyRuleId?: string
38
37
  /**
39
38
  * Set only when an identity decision was actually made for this
40
- * invocation (a rewrite, or a deny/pass decided by one of the four
41
- * identity rules — `adl.session-required-for-writes`, `adl.git-identity`,
42
- * `adl.token-minting-role`, `tool.azure-devops`): where the effective
43
- * agent identity came from, per the one-agent-identity standard's own
44
- * resolution order (STATUS.md 12p, "The
45
- * standard") — `inline` (a valid `ADL_AGENT_ID_AGENT=` on the command
46
- * itself), `env` (the session environment), `default-file` (the machine
47
- * default-agent file), or `none` (nothing resolved at all). See
48
- * `../pre-tool-use/handler.ts`'s `identitySourceFor`.
39
+ * invocation (a rewrite, or a deny/pass decided by one of the identity
40
+ * rules — `adl.run-required-for-writes`, `adl.git-identity`,
41
+ * `adl.token-minting-role`, `tool.azure-devops`, … — or by a role gate on
42
+ * an Azure DevOps MCP call): where the effective agent identity came from,
43
+ * per the one-agent-identity resolution order — `inline` (a valid
44
+ * `ADL_AGENT_ID_AGENT=` on the command itself), `env` (the session
45
+ * environment), `default-file` (the machine default-agent file), or
46
+ * `none` (nothing resolved at all). An allowed Azure DevOps MCP call logs
47
+ * it too, reads included (Tarun, 2026-09-29). See
48
+ * `../pre-tool-use/handler.ts`'s `effectiveIdentityFor` and
49
+ * `fallbackIdentity`.
49
50
  */
50
51
  readonly identitySource?: 'inline' | 'env' | 'default-file' | 'none'
51
52
  /**
52
- * M8 (STATUS.md 12p): the EFFECTIVE agent
53
- * identity this decision actually used — set together with
53
+ * The EFFECTIVE agent identity this decision actually used — set together with
54
54
  * `identitySource`, whenever that is set to anything but `'none'`. Read
55
55
  * by `./log.ts` for the `agent` column INSTEAD OF the session's raw
56
56
  * `ADL_AGENT_ID_AGENT` env var — the two differ exactly when a command
@@ -63,7 +63,7 @@ export interface ActivityNote {
63
63
  }
64
64
 
65
65
  export interface HookInvocation {
66
- readonly kind: 'pre-tool-use' | 'user-prompt-submit' | 'briefing' | 'crg' | 'lean-ctx'
66
+ readonly kind: 'pre-tool-use' | 'user-prompt-submit' | 'briefing' | 'crg'
67
67
  readonly host: HostId
68
68
  readonly event?: string
69
69
  readonly subcommand?: string
@@ -29,11 +29,25 @@
29
29
  * pending marker exists clears it and runs once more. On its way out it
30
30
  * releases the lock, then re-checks the marker once and re-acquires the
31
31
  * lock (noclobber) if a hook queued in the meantime, closing the last gap.
32
+ *
33
+ * Self-heal: if `code-review-graph update --skip-flows` exits non-zero,
34
+ * the runner runs `code-review-graph build --skip-flows` once and logs a
35
+ * `SELF-HEAL:` marker to stderr (captured by the spawn into
36
+ * `crg-update.log`). The original error is already in the log because
37
+ * the spawn captures the update's own stderr; the marker is appended
38
+ * after, so the failure is never silently swallowed. The build runs at
39
+ * most once per runner invocation (a per-runner shell variable), so a
40
+ * runner that re-iterates because the pending marker was set does not
41
+ * re-trigger the build on the second iteration. If the build itself
42
+ * fails, the runner exits and the next edit tries again — persistent
43
+ * failures stay visible in the log instead of being hidden.
32
44
  */
33
45
 
34
46
  import { closeSync, mkdirSync, openSync, readFileSync, rmSync, statSync, writeFileSync } from 'node:fs'
35
47
  import { join } from 'node:path'
36
48
 
49
+ import { ensureAdlGitignore } from '../../log/adl-dir.ts'
50
+
37
51
  export const LOCK_REL = '.adl/crg-update.lock'
38
52
  export const PENDING_REL = '.adl/crg-update.pending'
39
53
  export const UPDATE_LOG_REL = '.adl/logs/crg-update.log'
@@ -43,9 +57,21 @@ export const MAX_LOCK_AGE_MS = 30 * 60 * 1000
43
57
 
44
58
  export const RUNNER_SCRIPT = [
45
59
  'lock="$1"; pending="$2"; shift 2',
60
+ 'build_attempted=',
46
61
  'while :; do',
47
62
  ' rm -f "$pending"',
48
63
  ' "$@"',
64
+ ' rc=$?',
65
+ ' if [ "$rc" -ne 0 ] && [ -z "$build_attempted" ]; then',
66
+ ' echo "SELF-HEAL: $* exited $rc; running code-review-graph build --skip-flows" >&2',
67
+ ' if code-review-graph build --skip-flows; then',
68
+ ' echo "SELF-HEAL: build ok; next update will validate" >&2',
69
+ ' else',
70
+ ' build_rc=$?',
71
+ ' echo "SELF-HEAL: build failed (exit $build_rc); self-heal aborted" >&2',
72
+ ' fi',
73
+ ' build_attempted=1',
74
+ ' fi',
49
75
  ' if [ -e "$pending" ]; then continue; fi',
50
76
  ' rm -f "$lock"',
51
77
  ' if [ -e "$pending" ] && (set -C; echo $$ > "$lock") 2>/dev/null; then continue; fi',
@@ -160,6 +186,7 @@ function acquireAndStart(deps: BackgroundDeps, root: string, env: SpawnSpec['env
160
186
 
161
187
  export function requestUpdate(deps: BackgroundDeps, root: string, env: SpawnSpec['env']): UpdateRequest {
162
188
  mkdirSync(join(root, '.adl', 'logs'), { recursive: true, mode: 0o700 })
189
+ ensureAdlGitignore(join(root, '.adl'))
163
190
  const lockPath = join(root, LOCK_REL)
164
191
  const pendingPath = join(root, PENDING_REL)
165
192
 
@@ -47,7 +47,7 @@
47
47
 
48
48
  import type { HookHandler, HookInvocation, HookResult } from '../contract.ts'
49
49
  import { spawnWithTimeout } from '../../lib/spawn-with-timeout.ts'
50
- import { defaultBackgroundDeps, requestUpdate, type BackgroundDeps } from './background.ts'
50
+ import { requestUpdate, type BackgroundDeps } from './background.ts'
51
51
  import { toDecideInput } from '../../pre-tool-use/handler.ts'
52
52
  import { invocations } from '../../rules/shell/invocation.ts'
53
53
 
@@ -155,7 +155,8 @@ function isGitCommitInvocation(payload: Record<string, unknown>): boolean {
155
155
  }
156
156
 
157
157
  /**
158
- * `pre-commit.sh`: silent `detect-changes --brief`, stdout `{"passed":true}`,
158
+ * `pre-commit.sh`: silent `detect-changes --brief`, with Codex receiving its
159
+ * native allow envelope rather than the legacy `{"passed":true}` payload,
159
160
  * always exit 0 — but ONLY when the invoking payload's shell command is
160
161
  * actually a `git commit` (see this file's header, work item B). Anything
161
162
  * else — no shell command at all (a non-Bash tool call), or a shell command
@@ -168,7 +169,10 @@ async function preCommit(run: Runner, inv: HookInvocation): Promise<HookResult>
168
169
  return { stdout: '', stderr: '', exitCode: 0 }
169
170
  }
170
171
  const result = await runCrg(run, inv, ['detect-changes', '--brief'])
171
- return { stdout: '{"passed":true}\n', stderr: missingBinaryNote('pre-commit', result), exitCode: 0 }
172
+ const stdout = inv.host === 'codex'
173
+ ? `${JSON.stringify({ hookSpecificOutput: { hookEventName: 'PreToolUse', permissionDecision: 'allow' } })}\n`
174
+ : '{"passed":true}\n'
175
+ return { stdout, stderr: missingBinaryNote('pre-commit', result), exitCode: 0 }
172
176
  }
173
177
 
174
178
  /**
@@ -235,6 +239,3 @@ export const bunRunner: Runner = async (cmd, args, opts) => {
235
239
  return { status: null, stdout: '', stderr: message }
236
240
  }
237
241
  }
238
-
239
- export const handleCrg: HookHandler = createCrgHandler({ run: bunRunner, background: defaultBackgroundDeps })
240
- export default handleCrg
@@ -40,8 +40,7 @@
40
40
  * `result` is never left empty just because a row has nothing to say.
41
41
  * - `rule` is set only for a blocked pre-tool-use decision
42
42
  * (`ActivityNote.denyRuleId`), same trigger as the old deny log.
43
- * - `agent` is `ActivityNote.identityAgent` (M8,
44
- * STATUS.md 12p) — the EFFECTIVE identity the
43
+ * - `agent` is `ActivityNote.identityAgent` — the EFFECTIVE identity the
45
44
  * decision actually used, set by `../pre-tool-use/handler.ts`'s
46
45
  * `effectiveIdentityFor` — when an identity decision was made; a valid
47
46
  * inline `ADL_AGENT_ID_AGENT=` override on the command differs from the
@@ -50,12 +49,12 @@
50
49
  * `ADL_AGENT_ID_AGENT` (`../rules/impl/adl-identity.ts`'s env var) for
51
50
  * any row with no identity decision at all. `human` has no source at
52
51
  * this layer and is left absent.
53
- * - `identity_source` (W2 build item 5, 2026-09-28) comes straight off
52
+ * - `identity_source` comes straight off
54
53
  * `ActivityNote.identitySource` (`./contract.ts`), set by
55
54
  * `../pre-tool-use/handler.ts`'s `decideAndRespond` only when an
56
55
  * identity decision was actually made for this invocation — absent
57
- * otherwise, never defaulted to `'none'` for an unrelated row. M8 widens
58
- * when this is set to also cover the "override's PASS" row: an
56
+ * otherwise, never defaulted to `'none'` for an unrelated row. It is set
57
+ * for the "override's PASS" row too: an
59
58
  * identity-bearing command whose only identity-bearing pieces already
60
59
  * carry a valid inline override needs no rewrite (`rewriteGitNetworkCommands`'s
61
60
  * `unchanged` outcome), but it still made a real identity decision.
@@ -79,9 +78,9 @@ import type { ActivityNote, HookHandler, HookInvocation, HookResult } from './co
79
78
 
80
79
  export const HOOKS_LOG_REL = '.adl/logs/hooks.log'
81
80
  export const HOOKS_DENY_LOG_REL = '.adl/logs/hooks-deny.log'
82
- export const MAX_LOGGED_COMMAND_LENGTH = 2000
81
+ const MAX_LOGGED_COMMAND_LENGTH = 2000
83
82
 
84
- export function truncateCommand(value: string): string {
83
+ function truncateCommand(value: string): string {
85
84
  return value.length > MAX_LOGGED_COMMAND_LENGTH ? `${value.slice(0, MAX_LOGGED_COMMAND_LENGTH)}...<truncated>` : value
86
85
  }
87
86
 
@@ -108,7 +107,7 @@ const stringAt = (record: Readonly<Record<string, unknown>>, key: string): strin
108
107
  * `{"command": "...", "cwd": "...", "sandbox": false}` (no `tool_input` at
109
108
  * all). No Cursor-specific field renaming was needed here.
110
109
  */
111
- export function toolSummary(payload: Readonly<Record<string, unknown>>): string {
110
+ function toolSummary(payload: Readonly<Record<string, unknown>>): string {
112
111
  const rawInput = payload.tool_input
113
112
  const input = typeof rawInput === 'object' && rawInput !== null && !Array.isArray(rawInput) ? (rawInput as Record<string, unknown>) : {}
114
113
  for (const key of ['command', 'cmd', 'script']) {
@@ -172,8 +171,7 @@ export async function runLogged(inv: HookInvocation, handler: HookHandler, now:
172
171
  const duration = Math.round(performance.now() - started)
173
172
  const sessionId = sessionOf(inv.payload)
174
173
  const runId = runIdOf(inv.env)
175
- // M8 (STATUS.md 12p): the EFFECTIVE identity
176
- // this decision used — set on `outcome` whenever an identity decision
174
+ // The EFFECTIVE identity this decision used — set on `outcome` whenever an identity decision
177
175
  // was actually made (`../pre-tool-use/handler.ts`'s `effectiveIdentityFor`)
178
176
  // — wins over the session's raw `ADL_AGENT_ID_AGENT` env var: they
179
177
  // differ exactly when the command carries a valid inline override
@@ -51,7 +51,7 @@ function processTerm(term: string): string | null {
51
51
  * so it is rebuilt per invocation rather than persisted — that keeps the hook
52
52
  * stateless and makes an edited SKILL.md take effect immediately.
53
53
  */
54
- export function buildIndex(skills: readonly Skill[]): MiniSearch {
54
+ function buildIndex(skills: readonly Skill[]): MiniSearch {
55
55
  const index = new MiniSearch({
56
56
  fields: ['name', 'keywords', 'description'],
57
57
  storeFields: ['label', 'description'],
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Minimal Unigram tokenizer over the pruned tokenizer.json of the
3
- * adl-embedding artifact. Pure TS — no dependency on a native tokenizer
3
+ * enact-embedding artifact. Pure TS — no dependency on a native tokenizer
4
4
  * package.
5
5
  *
6
6
  * Ported unchanged from enact-repo-controls-m5's
@@ -10,10 +10,11 @@
10
10
  * the artifact from a repo-local `.cache/enact-embedding/model/` directory
11
11
  * built by that repo's own installer. This hook instead treats the model as a
12
12
  * GLOBAL, machine-wide asset shared by every repository —
13
- * `resolveGlobalArtifactDir` resolves `${XDG_CACHE_HOME:-$HOME/.cache}/adl-embedding/model/`
14
- * (renamed from `enact-embedding`, matching `packages/fleet/src/install-embedding-model.ts`,
15
- * the installer that actually writes this directory) from the invocation's
16
- * own `env`, never `process.env` and never repo-relative.
13
+ * `resolveGlobalArtifactDir` resolves `${XDG_CACHE_HOME:-$HOME/.cache}/enact-embedding/model/`
14
+ * (matching `packages/fleet/src/install-embedding-model.ts`, the installer that
15
+ * actually writes this directory; the earlier `adl-embedding` name is a hard
16
+ * cut, never read as a fallback) from the invocation's own `env`, never
17
+ * `process.env` and never repo-relative.
17
18
  *
18
19
  * `loadVectorHalf`'s `LoadVectorResult.reason` (on `ok: false`) already
19
20
  * carries a specific, human-readable cause (directory missing, which files
@@ -37,7 +38,7 @@ const ARTIFACT_FILES = ['model.bin', 'tokenizer.json', 'tokenizer_config.json',
37
38
  export function resolveGlobalArtifactDir(env: Readonly<Record<string, string | undefined>>): string {
38
39
  const xdgCacheHome = env.XDG_CACHE_HOME
39
40
  const base = xdgCacheHome && xdgCacheHome.trim() !== '' ? xdgCacheHome : join(requireHome(env), '.cache')
40
- return join(base, 'adl-embedding', 'model')
41
+ return join(base, 'enact-embedding', 'model')
41
42
  }
42
43
 
43
44
  function requireHome(env: Readonly<Record<string, string | undefined>>): string {
@@ -15,7 +15,7 @@ import { cursorSpec } from './impl/cursor.ts'
15
15
  import { opencodeSpec } from './impl/opencode.ts'
16
16
  import { kimiSpec } from './impl/kimi.ts'
17
17
 
18
- export const HOST_SPECS: Readonly<Record<HostId, HostSpec>> = {
18
+ const HOST_SPECS: Readonly<Record<HostId, HostSpec>> = {
19
19
  claude: claudeSpec,
20
20
  codex: codexSpec,
21
21
  cursor: cursorSpec,
@@ -0,0 +1,44 @@
1
+ /**
2
+ * The one place that makes a repository's `.adl/` folder self-ignoring.
3
+ *
4
+ * Every adl component that creates `<repo>/.adl/` (the `.adl/logs/` writer,
5
+ * `adl run`'s transcript, the crg background update, the git-hook log seam)
6
+ * calls `ensureAdlGitignore` right after it creates the directory. The file it
7
+ * writes, `.adl/.gitignore` containing exactly `*\n`, ignores the folder's whole
8
+ * content INCLUDING itself, so `.adl/` never shows in `git status` -- in any git
9
+ * repository, adl-controlled or not, without ever editing the repo's own
10
+ * `.gitignore` (the `/.adl/` block `adl repo controls install` writes covers
11
+ * controlled repos only). Logs carry commands and output, so they must not be
12
+ * committable by accident.
13
+ *
14
+ * `apps/cli` and `packages/repo-controls` import this module by relative path
15
+ * (as they already do `./writer.ts`), so there is exactly one copy.
16
+ */
17
+ import { writeFileSync } from "node:fs";
18
+ import { basename, dirname, join } from "node:path";
19
+
20
+ const ADL_DIR_NAME = ".adl";
21
+
22
+ /** Exactly this content, nothing else: ignore every entry, this file included. */
23
+ const ADL_GITIGNORE_CONTENT = "*\n";
24
+
25
+ /**
26
+ * Finds the nearest `.adl` directory at or above `path` and, if it has no
27
+ * `.gitignore` yet, writes one containing `*\n`. An existing `.gitignore` is
28
+ * never overwritten or read. A `path` with no `.adl` segment (the
29
+ * `~/.local/state/adl/logs` fallback, a test tmp dir) is a no-op. The `.adl`
30
+ * directory must already exist; a missing one throws, like any other write.
31
+ */
32
+ export function ensureAdlGitignore(path: string): void {
33
+ if (basename(path) !== ADL_DIR_NAME) {
34
+ const parent = dirname(path);
35
+ if (parent !== path) ensureAdlGitignore(parent);
36
+ return;
37
+ }
38
+ try {
39
+ // "wx": create only if absent -- an existing file is left untouched.
40
+ writeFileSync(join(path, ".gitignore"), ADL_GITIGNORE_CONTENT, { flag: "wx" });
41
+ } catch (error) {
42
+ if ((error as NodeJS.ErrnoException).code !== "EEXIST") throw error;
43
+ }
44
+ }
@@ -2,7 +2,7 @@
2
2
  * The `.adl/logs/` logger (docs/architecture/cli-design.md §5a, item 9). `agent-hooks`
3
3
  * "holds logs" (§12): this module lives here and writes `hooks.log` /
4
4
  * `hooks-deny.log` (`../hooks/log.ts`); `apps/cli/src/log.ts` re-exports it
5
- * unchanged so `adl run`'s `tool-calls.log` writer keeps working. The module
5
+ * unchanged so `adl run`'s `agents/tool-calls.log` writer keeps working. The module
6
6
  * is generic across all five documented files so a caller never has to
7
7
  * reinvent the format.
8
8
  *
@@ -28,7 +28,8 @@ import {
28
28
  writeFileSync,
29
29
  } from "node:fs";
30
30
  import { homedir } from "node:os";
31
- import { dirname, join } from "node:path";
31
+ import { basename, dirname, join } from "node:path";
32
+ import { ensureAdlGitignore } from "./adl-dir.ts";
32
33
 
33
34
  export type LogFileName = "hooks" | "hooks-deny" | "tool-rewrites" | "tool-calls" | "repo-controls";
34
35
 
@@ -128,9 +129,22 @@ function tightenMode(path: string, target: number): void {
128
129
  function ensureDirSecure(dir: string): void {
129
130
  const parent = dirname(dir);
130
131
  mkdirSync(parent, { recursive: true });
132
+ // A nested log stream such as `.adl/logs/agents/` must not leave the
133
+ // repository's `.adl/` ancestor at the default mkdir mode (0755).
134
+ // Root-level streams already tightened it as `parent`; locate it rather
135
+ // than changing unrelated ancestors of the state-directory fallback.
136
+ let ancestor = parent;
137
+ while (ancestor !== dirname(ancestor)) {
138
+ if (basename(ancestor) === ".adl") {
139
+ tightenMode(ancestor, 0o700);
140
+ break;
141
+ }
142
+ ancestor = dirname(ancestor);
143
+ }
131
144
  tightenMode(parent, 0o700);
132
145
  mkdirSync(dir, { recursive: true });
133
146
  tightenMode(dir, 0o700);
147
+ ensureAdlGitignore(dir);
134
148
  }
135
149
 
136
150
  function ensureFileSecure(filePath: string): void {
@@ -7,11 +7,9 @@
7
7
  *
8
8
  * adl hook <kind> [subcommand] --host=<claude|codex|cursor|kimi|opencode>
9
9
  *
10
- * kinds: pre-tool-use, user-prompt-submit, briefing, crg <subcommand>,
11
- * lean-ctx <subcommand>
10
+ * kinds: pre-tool-use, user-prompt-submit, briefing, crg <subcommand>
12
11
  * crg subcommands: after-file-edit, pre-commit, session-stop
13
- * lean-ctx subcommands: mcp, pre-tool-use, post-tool-use
14
- * payload: JSON on stdin (NOT for `lean-ctx mcp` — see below)
12
+ * payload: JSON on stdin
15
13
  * --version prints the package version and exits 0
16
14
  *
17
15
  * Operator commands (src/cli/; no --host, no stdin):
@@ -30,14 +28,6 @@
30
28
  * loud (non-zero exit, reason on stderr) — never silently ignored.
31
29
  * - `[hooks] enabled = false`: silent no-op, same as unmanaged.
32
30
  *
33
- * `lean-ctx mcp` is the one exception to this whole flow (work item A.1): it
34
- * takes no JSON payload, needs no `--host`, and never no-ops for an
35
- * unmanaged repo (an MCP client that just spawned it expects a running
36
- * server, not a silent exit) — see `src/lean-ctx/mcp.ts`'s header. It is
37
- * dispatched before `--host` resolution, before stdin is read at all, and
38
- * bypasses `HookHandler`/`HookResult` entirely (real stdio passthrough
39
- * cannot be buffered into a string).
40
- *
41
31
  * Every other hook kind is dispatched through the shared `HookHandler` shape
42
32
  * in `src/hooks/contract.ts` so a handler never touches `process`, argv, or
43
33
  * stdin directly.
@@ -49,7 +39,7 @@
49
39
  * the shared fail-closed signal `pre-tool-use`'s own decisions already use
50
40
  * (`FAIL_CLOSED_EXIT_CODE`, `src/rules/engine.ts`) for Kimi/OpenCode denials.
51
41
  * Every other kind is advisory or best-effort (`user-prompt-submit`,
52
- * `briefing`, `crg`, `lean-ctx` pre/post/mcp) and none of them has a "block"
42
+ * `briefing`, `crg`) and none of them has a "block"
53
43
  * concept at all — worse, on Claude Code and Codex, exit code 2 from
54
44
  * `UserPromptSubmit` specifically blocks the prompt AND ERASES IT (documented
55
45
  * Claude Code hook behaviour: a `UserPromptSubmit` hook exiting 2 shows
@@ -88,13 +78,11 @@ import { handlePreToolUse } from './pre-tool-use/handler.ts'
88
78
  import { handleUserPromptSubmit } from './hooks/user-prompt-submit/handler.ts'
89
79
  import { handleBriefing } from './hooks/briefing/handler.ts'
90
80
  import { handleCrg } from './hooks/crg/handler.ts'
91
- import { handleLeanCtx } from './hooks/lean-ctx/handler.ts'
92
- import { runLeanCtxMcp } from './lean-ctx/mcp.ts'
93
81
  import { runRules } from './cli/rules.ts'
94
82
  import { runDoctor } from './cli/doctor.ts'
95
83
  import { runLogged } from './hooks/log.ts'
96
84
 
97
- const HOOK_KINDS = ['pre-tool-use', 'user-prompt-submit', 'briefing', 'crg', 'lean-ctx'] as const
85
+ const HOOK_KINDS = ['pre-tool-use', 'user-prompt-submit', 'briefing', 'crg'] as const
98
86
  type HookKind = (typeof HOOK_KINDS)[number]
99
87
 
100
88
  function isHookKind(value: string | undefined): value is HookKind {
@@ -102,14 +90,12 @@ function isHookKind(value: string | undefined): value is HookKind {
102
90
  }
103
91
 
104
92
  const CRG_SUBCOMMANDS = ['after-file-edit', 'pre-commit', 'session-stop'] as const
105
- const LEAN_CTX_SUBCOMMANDS = ['mcp', 'pre-tool-use', 'post-tool-use'] as const
106
93
 
107
94
  const HANDLERS: Readonly<Record<HookKind, HookHandler>> = {
108
95
  'pre-tool-use': handlePreToolUse,
109
96
  'user-prompt-submit': handleUserPromptSubmit,
110
97
  briefing: handleBriefing,
111
98
  crg: handleCrg,
112
- 'lean-ctx': handleLeanCtx,
113
99
  }
114
100
 
115
101
  /** Exit code `pre-tool-use` alone uses to fail closed on an undecidable payload — see this file's header (work item D). */
@@ -167,24 +153,6 @@ export async function run(argv: readonly string[]): Promise<number> {
167
153
  }
168
154
  subcommand = candidate
169
155
  }
170
- if (kind === 'lean-ctx') {
171
- const candidate = argv[1]
172
- if (candidate === undefined || !(LEAN_CTX_SUBCOMMANDS as readonly string[]).includes(candidate)) {
173
- process.stderr.write(
174
- `adl hook: lean-ctx requires a subcommand (one of ${LEAN_CTX_SUBCOMMANDS.join(', ')})\n`,
175
- )
176
- return 1
177
- }
178
- subcommand = candidate
179
- }
180
-
181
- // `lean-ctx mcp` bypasses everything below: no --host, no stdin-as-JSON,
182
- // no HookHandler dispatch, and unmanaged is NOT a no-op — see
183
- // `./lean-ctx/mcp.ts`'s header and this file's own header (work item A.1).
184
- if (kind === 'lean-ctx' && subcommand === 'mcp') {
185
- return runLeanCtxMcp(process.cwd(), process.env)
186
- }
187
-
188
156
  // az385: host resolution failure fails CLOSED (FAIL_CLOSED_EXIT_CODE, 2)
189
157
  // only for pre-tool-use — the one kind whose job is "block a dangerous
190
158
  // action," matching the invalid-JSON-on-stdin split a few lines below and
@@ -217,11 +185,9 @@ export async function run(argv: readonly string[]): Promise<number> {
217
185
  // `adl-config.toml` where `adl hooks deploy` has run — nowhere else. No
218
186
  // git root, or no `adl-config.toml` above `cwd`: a strict no-op (this
219
187
  // file's own header) — no rule evaluation, no identity check, no
220
- // `hooks.log` write. This REVERSES the earlier "global identity baseline"
221
- // (W2 build item 3 / STATUS.md 12p): that baseline
222
- // ran the four (later seven, R2) identity rules even in an unmanaged
223
- // repo; Tarun decided the repos where `adl-config.toml` does not exist
224
- // have no business running hooks at all.
188
+ // `hooks.log` write. There is no global identity baseline: a repo where
189
+ // `adl-config.toml` does not exist has no business running hooks at all.
190
+ // The same no-op applies when `[hooks] enabled = false` (below).
225
191
  const managed = resolveManagedRepo(realRootIO, cwd)
226
192
  if (!managed.managed || managed.root === null || managed.configPath === null) {
227
193
  return writeResult(silentNoop())