@amsterdamdatalabs/adl-agent-control-linux-x64 0.1.12 → 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 (405) hide show
  1. package/bin/adl +2 -2
  2. package/bin/git +16 -17
  3. package/bin/git-ado +25 -24
  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/fleet-host.sh +8 -5
  9. package/bin/reconcile +482 -232
  10. package/bin/reconcile-host +30 -20
  11. package/bin/setup +20 -17
  12. package/bin/shell-path-policy +15 -5
  13. package/bin/sync-and-reconcile +62 -64
  14. package/bin/validate-manifest +33 -9
  15. package/package.json +2 -10
  16. package/packages/agent-hooks/README.md +14 -9
  17. package/packages/agent-hooks/assets/hooks.json +0 -20
  18. package/packages/agent-hooks/src/cli/args.ts +1 -1
  19. package/packages/agent-hooks/src/cli/doctor.ts +6 -58
  20. package/packages/agent-hooks/src/deploy/deploy.ts +12 -41
  21. package/packages/agent-hooks/src/deploy/doctor.ts +8 -11
  22. package/packages/agent-hooks/src/deploy/index.ts +14 -14
  23. package/packages/agent-hooks/src/deploy/json-merge.ts +7 -8
  24. package/packages/agent-hooks/src/deploy/legacy-lock.ts +2 -2
  25. package/packages/agent-hooks/src/deploy/list.ts +1 -1
  26. package/packages/agent-hooks/src/deploy/lock.ts +31 -12
  27. package/packages/agent-hooks/src/deploy/profile.ts +3 -4
  28. package/packages/agent-hooks/src/deploy/source.ts +1 -1
  29. package/packages/agent-hooks/src/gating/config.ts +10 -24
  30. package/packages/agent-hooks/src/gating/root.ts +3 -3
  31. package/packages/agent-hooks/src/hooks/briefing/handler.ts +2 -2
  32. package/packages/agent-hooks/src/hooks/briefing/index.ts +27 -287
  33. package/packages/agent-hooks/src/hooks/contract.ts +17 -17
  34. package/packages/agent-hooks/src/hooks/crg/background.ts +27 -0
  35. package/packages/agent-hooks/src/hooks/crg/index.ts +7 -6
  36. package/packages/agent-hooks/src/hooks/log.ts +8 -10
  37. package/packages/agent-hooks/src/hooks/user-prompt-submit/match.ts +1 -1
  38. package/packages/agent-hooks/src/hooks/user-prompt-submit/tokenizer.ts +1 -1
  39. package/packages/agent-hooks/src/hooks/user-prompt-submit/vector.ts +6 -5
  40. package/packages/agent-hooks/src/hosts/registry.ts +1 -1
  41. package/packages/agent-hooks/src/log/adl-dir.ts +44 -0
  42. package/packages/agent-hooks/src/log/writer.ts +16 -2
  43. package/packages/agent-hooks/src/main.ts +7 -41
  44. package/packages/agent-hooks/src/pre-tool-use/handler.ts +71 -82
  45. package/packages/agent-hooks/src/rules/engine.ts +13 -17
  46. package/packages/agent-hooks/src/rules/impl/adl-build-run-denied.ts +3 -3
  47. package/packages/agent-hooks/src/rules/impl/adl-git-credential-bypass.ts +12 -14
  48. package/packages/agent-hooks/src/rules/impl/adl-git-identity.ts +28 -28
  49. package/packages/agent-hooks/src/rules/impl/adl-git-push-policy.ts +8 -9
  50. package/packages/agent-hooks/src/rules/impl/adl-human-azdo-bypass.ts +56 -59
  51. package/packages/agent-hooks/src/rules/impl/adl-identity.ts +16 -23
  52. package/packages/agent-hooks/src/rules/impl/adl-mcp-cli.ts +19 -16
  53. package/packages/agent-hooks/src/rules/impl/adl-pr-complete-pending.ts +2 -2
  54. package/packages/agent-hooks/src/rules/impl/adl-pr-review-role.ts +9 -12
  55. package/packages/agent-hooks/src/rules/impl/adl-pr-role.ts +5 -7
  56. package/packages/agent-hooks/src/rules/impl/adl-run-required.ts +411 -0
  57. package/packages/agent-hooks/src/rules/impl/adl-token-minting-role.ts +4 -5
  58. package/packages/agent-hooks/src/rules/impl/adl-workitem-role.ts +6 -7
  59. package/packages/agent-hooks/src/rules/impl/agent-tamper-protection.ts +77 -70
  60. package/packages/agent-hooks/src/rules/impl/deny-allowlist.ts +159 -0
  61. package/packages/agent-hooks/src/rules/impl/git-helpers.ts +21 -23
  62. package/packages/agent-hooks/src/rules/impl/git-worktree.ts +14 -28
  63. package/packages/agent-hooks/src/rules/impl/mcp-tool.ts +3 -3
  64. package/packages/agent-hooks/src/rules/impl/messages.ts +1 -1
  65. package/packages/agent-hooks/src/rules/impl/pr-completion.ts +1 -1
  66. package/packages/agent-hooks/src/rules/impl/tool-azure-devops.ts +35 -46
  67. package/packages/agent-hooks/src/rules/impl/tool-find.ts +34 -7
  68. package/packages/agent-hooks/src/rules/impl/tool-grep.ts +34 -12
  69. package/packages/agent-hooks/src/rules/impl/tool-native-search.ts +52 -9
  70. package/packages/agent-hooks/src/rules/ports.ts +5 -7
  71. package/packages/agent-hooks/src/rules/registry.ts +4 -6
  72. package/packages/agent-hooks/src/rules/shell/git-identity.ts +86 -101
  73. package/packages/agent-hooks/src/rules/shell/git-internals.ts +1 -1
  74. package/packages/agent-hooks/src/rules/shell/invocation.ts +24 -118
  75. package/packages/agent-hooks/src/rules/shell/piped-script.ts +1 -1
  76. package/packages/agent-hooks/src/rules/shell/prefixes.ts +1 -1
  77. package/packages/agent-hooks/src/rules/shell/protected-carrier-writes.ts +11 -10
  78. package/packages/agent-hooks/src/rules/shell/protected-carriers.ts +26 -26
  79. package/packages/agent-hooks/src/rules/shell/substitution.ts +1 -1
  80. package/packages/agent-hooks/src/rules/shell/xargs.ts +2 -2
  81. package/packages/agent-hooks/src/rules/spec.ts +2 -2
  82. package/packages/agent-settings/README.md +287 -0
  83. package/packages/agent-settings/assets/GLOBAL-AGENTS.md +14 -16
  84. package/packages/agent-settings/assets/agents/architect.toml +2 -0
  85. package/packages/agent-settings/assets/agents/code-reviewer.toml +2 -0
  86. package/packages/agent-settings/assets/agents/executor.toml +2 -0
  87. package/packages/agent-settings/assets/agents/explore.toml +2 -0
  88. package/packages/agent-settings/assets/agents/planner.toml +2 -0
  89. package/packages/agent-settings/assets/mcp.json +0 -4
  90. package/packages/agent-settings/deploy-profile.json +139 -0
  91. package/packages/agent-settings/deploy-profile.schema.json +147 -0
  92. package/packages/agent-settings/managed/README.md +29 -30
  93. package/packages/agent-settings/managed/codex-requirements.toml +9 -9
  94. package/packages/agent-settings/package.json +20 -0
  95. package/packages/agent-settings/src/deploy/agent-render.ts +2 -2
  96. package/packages/agent-settings/src/deploy/agent-toml.ts +1 -1
  97. package/packages/agent-settings/src/deploy/agents-deploy.ts +17 -3
  98. package/packages/agent-settings/src/deploy/doctor.ts +3 -83
  99. package/packages/agent-settings/src/deploy/index.ts +6 -33
  100. package/packages/agent-settings/src/deploy/legacy-lock.ts +6 -6
  101. package/packages/agent-settings/src/deploy/list.ts +5 -19
  102. package/packages/agent-settings/src/deploy/lock.ts +8 -18
  103. package/packages/agent-settings/src/deploy/mcp-deploy.ts +10 -5
  104. package/packages/agent-settings/src/deploy/mcp-merge.ts +22 -3
  105. package/packages/agent-settings/src/deploy/mcp-source.ts +1 -1
  106. package/packages/agent-settings/src/deploy/profile.ts +11 -35
  107. package/packages/agent-settings/src/deploy/retire-lean-ctx.ts +184 -0
  108. package/packages/agent-settings/src/deploy/settings.ts +17 -22
  109. package/packages/agent-settings/src/global-surface-sweep.ts +0 -2
  110. package/packages/agent-settings/src/kimi-hooks.ts +339 -192
  111. package/packages/agent-settings/src/opencode-hooks.ts +1 -1
  112. package/packages/agent-settings/tsconfig.json +23 -0
  113. package/packages/agent-skills/assets/agent-search-tool-audit/SKILL.md +120 -0
  114. package/packages/agent-skills/assets/agent-search-tool-audit/scripts/audit.sh +276 -0
  115. package/packages/agent-skills/assets/debug-issue/SKILL.md +8 -7
  116. package/packages/agent-skills/assets/explore-codebase/SKILL.md +13 -13
  117. package/packages/agent-skills/assets/refactor-safely/SKILL.md +12 -11
  118. package/packages/agent-skills/assets/review-changes/SKILL.md +7 -7
  119. package/packages/agent-skills/assets/testing/references/e2e.md +37 -0
  120. package/packages/agent-skills/assets/testing/references/integration.md +37 -0
  121. package/packages/agent-skills/assets/testing/references/unit.md +32 -0
  122. package/packages/agent-skills/dist/deploy.d.ts +2 -0
  123. package/packages/agent-skills/dist/deploy.d.ts.map +1 -1
  124. package/packages/agent-skills/dist/deploy.js +27 -1
  125. package/packages/agent-skills/dist/deploy.js.map +1 -1
  126. package/packages/agent-skills/dist/doctor.d.ts +0 -2
  127. package/packages/agent-skills/dist/doctor.d.ts.map +1 -1
  128. package/packages/agent-skills/dist/doctor.js +1 -1
  129. package/packages/agent-skills/dist/doctor.js.map +1 -1
  130. package/packages/agent-skills/dist/fs-utils.d.ts +0 -1
  131. package/packages/agent-skills/dist/fs-utils.d.ts.map +1 -1
  132. package/packages/agent-skills/dist/fs-utils.js +1 -1
  133. package/packages/agent-skills/dist/fs-utils.js.map +1 -1
  134. package/packages/agent-skills/src/deploy.ts +29 -1
  135. package/packages/agent-skills/src/doctor.ts +1 -1
  136. package/packages/agent-skills/src/fs-utils.ts +1 -1
  137. package/packages/azdo/README.md +10 -9
  138. package/packages/azdo/package.json +1 -3
  139. package/packages/azdo/src/azdo-pl.ts +2 -54
  140. package/packages/azdo/src/azdo-pr-review.ts +4 -4
  141. package/packages/azdo/src/azdo-repo-doctor.ts +101 -52
  142. package/packages/azdo/src/azdo-wit.ts +41 -2
  143. package/packages/azdo/src/lib/agent-identity.ts +12 -14
  144. package/packages/azdo/src/lib/agent-token.ts +2 -2
  145. package/packages/azdo/src/lib/client.ts +0 -5
  146. package/packages/azdo/src/lib/graph-identity.ts +4 -4
  147. package/packages/azdo/src/workflow-rules-matrix.csv +85 -0
  148. package/packages/azdo/src/workflow-rules.ts +128 -0
  149. package/packages/fleet/manifest.json +35 -11
  150. package/packages/fleet/manifest.schema.json +62 -10
  151. package/packages/fleet/src/default-agent-file.ts +3 -3
  152. package/packages/fleet/src/install-adl-package.ts +73 -15
  153. package/packages/fleet/src/install-embedding-model.ts +13 -13
  154. package/packages/fleet/src/managed-settings.ts +7 -7
  155. package/packages/fleet/src/repo-maintain.ts +91 -55
  156. package/packages/fleet/src/scratch-reap.ts +5 -5
  157. package/packages/fleet/src/vscode-settings.ts +5 -5
  158. package/packages/repo-controls/README.md +141 -43
  159. package/packages/repo-controls/assets/promote.ts +4 -4
  160. package/packages/repo-controls/assets/reconcile-guard.sh +10 -46
  161. package/packages/repo-controls/assets/version-bump.sh +31 -84
  162. package/packages/repo-controls/bunfig.toml +6 -7
  163. package/packages/repo-controls/package/adl-compliance/AGENTS.md +5 -6
  164. package/packages/repo-controls/package/adl-compliance/conftest.py +3 -1
  165. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/__init__.py +4 -16
  166. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/adr_lifecycle/test_check.py +9 -2
  167. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/closed_set/fixtures/docs/notes.md +1 -0
  168. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/closed_set/test_check.py +11 -0
  169. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/__init__.py +7 -0
  170. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/check.py +266 -0
  171. 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
  172. 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
  173. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-assets/docs/guide/.hidden.md +1 -0
  174. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-assets/docs/guide/a.md +1 -0
  175. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-assets/docs/guide/b.md +1 -0
  176. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-assets/docs/guide/data.csv +1 -0
  177. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-assets/docs/guide/diagram.png +1 -0
  178. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-assets/docs/guide/mock.png +1 -0
  179. 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
  180. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-assets/docs.md +1 -0
  181. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-assets/grants.yaml +4 -0
  182. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-assets/plans/deep/p1.md +1 -0
  183. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-assets/plans/deep/p2.md +1 -0
  184. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-assets/plans/deep/p3.md +1 -0
  185. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-assets/plans/deep/p4.md +1 -0
  186. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-assets/plans/deep/p5.md +1 -0
  187. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-clean/docs/architecture/build.md +1 -0
  188. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-clean/docs/architecture/overview.md +1 -0
  189. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-clean/docs/guide/install.md +1 -0
  190. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-clean/docs/guide/start.md +1 -0
  191. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-clean/grants.yaml +4 -0
  192. 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
  193. 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
  194. 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
  195. 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
  196. 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
  197. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-decisions/docs/guide/a.md +1 -0
  198. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-decisions/docs/guide/b.md +1 -0
  199. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-decisions/docs/guide/c.md +1 -0
  200. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-decisions/grants.yaml +4 -0
  201. 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
  202. 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
  203. 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
  204. 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
  205. 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
  206. 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
  207. 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
  208. 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
  209. 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
  210. 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
  211. 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
  212. 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
  213. 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
  214. 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
  215. 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
  216. 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
  217. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-default-cap/grants.yaml +4 -0
  218. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-exempt/docs/guide/a.md +1 -0
  219. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-exempt/docs/guide/b.md +1 -0
  220. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-exempt/docs/guide/c.md +1 -0
  221. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-exempt/grants.yaml +4 -0
  222. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-grew/docs/guide/a.md +1 -0
  223. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-grew/docs/guide/b.md +1 -0
  224. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-grew/docs/guide/c.md +1 -0
  225. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-grew/grants.yaml +4 -0
  226. 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
  227. 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
  228. 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
  229. 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
  230. 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
  231. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-no-section/grants.yaml +4 -0
  232. 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
  233. 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
  234. 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
  235. 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
  236. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-over-cap/grants.yaml +4 -0
  237. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-stale/docs/held/a.md +1 -0
  238. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-stale/docs/held/b.md +1 -0
  239. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-stale/docs/held/c.md +1 -0
  240. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-stale/docs/held/d.md +1 -0
  241. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-stale/docs/shrunk/a.md +1 -0
  242. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-stale/docs/shrunk/b.md +1 -0
  243. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-stale/grants.yaml +6 -0
  244. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-unusable/docs/guide/a.md +1 -0
  245. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-unusable/docs/guide/b.md +1 -0
  246. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-unusable/docs/guide/c.md +1 -0
  247. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/fixtures/docs-size-unusable/grants.yaml +3 -0
  248. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/directory_size/test_check.py +345 -0
  249. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/english_only/check.py +18 -5
  250. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/english_only/test_check.py +35 -0
  251. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/filename/__init__.py +7 -0
  252. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/filename/check.py +91 -0
  253. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/filename/fixtures/docs/AGENTS.md +3 -0
  254. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/filename/fixtures/docs/CLAUDE.md +3 -0
  255. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/filename/fixtures/docs/architecture/-leading-hyphen.md +3 -0
  256. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/filename/fixtures/docs/architecture/AGENTS.md +3 -0
  257. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/filename/fixtures/docs/architecture/double--hyphen.md +3 -0
  258. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/filename/fixtures/docs/architecture/getting started.md +3 -0
  259. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/filename/fixtures/docs/architecture/nested/page-here.md +3 -0
  260. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/filename/fixtures/docs/architecture/trailing-hyphen-.md +3 -0
  261. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/filename/fixtures/docs/architecture/ui-contract.md +4 -0
  262. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/filename/fixtures/docs/architecture/user_profile.md +3 -0
  263. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/filename/fixtures/docs/assets/UI-CONTRACT.png +2 -0
  264. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/filename/fixtures/docs/assets/diagram.png +1 -0
  265. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/filename/fixtures/docs/index.md +4 -0
  266. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/filename/fixtures/docs/notes.md +3 -0
  267. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/filename/fixtures/docs/reference.html +1 -0
  268. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/filename/fixtures/docs/research/2026-10-experiment.md +3 -0
  269. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/filename/fixtures/docs/research/UI-CONTRACT.md +6 -0
  270. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/filename/fixtures/docs.md +5 -0
  271. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/filename/test_check.py +194 -0
  272. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/indexes/check.py +14 -2
  273. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/indexes/docs-knowledge-indexes.yaml +5 -5
  274. 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
  275. 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
  276. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/indexes/test_check.py +58 -6
  277. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/ledger/test_check.py +0 -1
  278. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/check.py +64 -17
  279. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/docs-okf-profiles.yaml +60 -9
  280. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-ledger-clean/docs/notes.md +17 -0
  281. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-ledger-no-lines/docs/notes.md +13 -0
  282. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-profile-clean/docs/architecture/demo.md +0 -1
  283. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-profile-clean/docs-okf-profiles.yaml +0 -1
  284. 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
  285. 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
  286. 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
  287. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-profile-untyped/docs-okf-profiles.yaml +5 -0
  288. 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
  289. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-profile-violation/docs-okf-profiles.yaml +0 -1
  290. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-research/docs/research/experiment-ok.md +15 -0
  291. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-research/docs/research/extra-key.md +15 -0
  292. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-research/docs/research/extra-keys.md +16 -0
  293. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-research/docs/research/missing-created.md +11 -0
  294. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-research/docs/research/missing-description.md +11 -0
  295. 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
  296. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-research/docs/research/missing-sources.md +10 -0
  297. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-research/docs/research/missing-status.md +11 -0
  298. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-research/docs/research/missing-title.md +11 -0
  299. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-research/docs/research/optional-keys.md +16 -0
  300. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-research/docs/research/research-ok.md +14 -0
  301. 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
  302. 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
  303. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-research-neighbours/docs/operations/runbook.md +26 -0
  304. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/test_check.py +228 -2
  305. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/register.py +5 -0
  306. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/semantics/test_check.py +11 -2
  307. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/__init__.py +5 -3
  308. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/check.py +160 -44
  309. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-clean/grants.yaml +0 -2
  310. 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
  311. 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
  312. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-empty-register/grants.yaml +3 -0
  313. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-excluded/grants.yaml +0 -2
  314. 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
  315. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-missing-tree/grants.yaml +5 -0
  316. 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
  317. 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
  318. 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
  319. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-no-ceilings/grants.yaml +4 -0
  320. 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
  321. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-stale-entry/grants.yaml +5 -0
  322. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-unbaselined/grants.yaml +0 -2
  323. 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
  324. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-unusable-register/grants.yaml +3 -0
  325. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/register.py +127 -0
  326. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/test_check.py +265 -29
  327. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/markdown_trees/check.py +75 -2
  328. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/markdown_trees/test_check.py +194 -0
  329. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/open_work_cap/check.py +56 -10
  330. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/open_work_cap/test_check.py +256 -0
  331. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/placement/check.py +40 -12
  332. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/placement/test_check.py +108 -0
  333. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/plans_layout/test_check.py +1 -1
  334. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/references/check.py +2 -3
  335. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/root_closed_set/check.py +23 -6
  336. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/root_closed_set/test_check.py +76 -0
  337. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/root_markdown_allowlist/check.py +58 -17
  338. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/root_markdown_allowlist/test_check.py +161 -0
  339. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/scripts_size_depth/check.py +35 -3
  340. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/scripts_size_depth/test_check.py +108 -1
  341. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/check.py +281 -61
  342. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/malformed/absolute-path.yaml +3 -0
  343. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/malformed/backslash-path.yaml +3 -0
  344. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/malformed/baseline-is-a-list.yaml +2 -0
  345. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/malformed/boolean-size.yaml +3 -0
  346. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/malformed/dot-segment.yaml +3 -0
  347. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/malformed/duplicate-path.yaml +4 -0
  348. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/malformed/empty-file.yaml +0 -0
  349. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/malformed/empty-segment.yaml +3 -0
  350. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/malformed/float-size.yaml +3 -0
  351. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/malformed/negative-size.yaml +3 -0
  352. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/malformed/no-over-limit-baseline.yaml +1 -0
  353. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/malformed/no-schema-version.yaml +1 -0
  354. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/malformed/non-string-path.yaml +3 -0
  355. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/malformed/not-yaml.yaml +2 -0
  356. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/malformed/null-size.yaml +3 -0
  357. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/malformed/parent-segment.yaml +3 -0
  358. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/malformed/string-size.yaml +3 -0
  359. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/malformed/top-level-is-a-list.yaml +2 -0
  360. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/malformed/trailing-slash.yaml +3 -0
  361. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/malformed/unknown-key.yaml +3 -0
  362. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/malformed/wrong-schema-version.yaml +2 -0
  363. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/malformed/zero-size.yaml +3 -0
  364. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/valid.yaml +4 -0
  365. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/test_check.py +758 -45
  366. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/ignored_paths/check.py +4 -3
  367. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/ignored_paths/test_check.py +2 -2
  368. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/lockfile_integrity/cargo_lock.py +490 -0
  369. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/lockfile_integrity/check.py +368 -55
  370. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/lockfile_integrity/test_check.py +4 -2
  371. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/lockfile_integrity/test_declared_paths.py +523 -0
  372. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/lockfile_integrity/test_stale_lock.py +1179 -0
  373. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/cli.py +122 -3
  374. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/core/check.py +33 -1
  375. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/core/constants.py +0 -11
  376. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/core/context.py +16 -1
  377. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/policy/config.py +1 -2
  378. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/policy/docs_shape.py +12 -1
  379. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/policy/gate-registry.alt.yaml +133 -147
  380. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/policy/gate-registry.yaml +133 -147
  381. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/policy/registry.py +1 -1
  382. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/policy/root_shape.py +52 -10
  383. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/runner.py +23 -4
  384. package/packages/repo-controls/package.json +2 -9
  385. package/packages/repo-controls/scripts/hooks/post-merge +13 -0
  386. package/packages/repo-controls/scripts/hooks/pre-push +3 -3
  387. package/packages/repo-controls/src/azdo-push.ts +64 -36
  388. package/packages/repo-controls/src/azure-devops-governance.ts +7 -9
  389. package/packages/repo-controls/src/azure-devops-remote.ts +1 -1
  390. package/packages/repo-controls/src/cli.ts +29 -8
  391. package/packages/repo-controls/src/compliance-config.ts +410 -2
  392. package/packages/repo-controls/src/config.ts +133 -60
  393. package/packages/repo-controls/src/constants.ts +13 -27
  394. package/packages/repo-controls/src/coverage-ratchet.ts +4 -4
  395. package/packages/repo-controls/src/doctor.ts +46 -19
  396. package/packages/repo-controls/src/gitignore-block.ts +5 -29
  397. package/packages/repo-controls/src/hook-log.ts +1 -2
  398. package/packages/repo-controls/src/hook.ts +201 -45
  399. package/packages/repo-controls/src/install.ts +14 -8
  400. package/packages/repo-controls/src/integrity.ts +3 -3
  401. package/packages/repo-controls/src/lfs.ts +111 -0
  402. package/packages/repo-controls/src/promote.ts +8 -8
  403. package/packages/repo-controls/src/runtime.ts +9 -1
  404. package/packages/repo-controls/src/workflows-drift.ts +4 -5
  405. package/packages/repo-controls/src/worktree-guard.ts +3 -3
@@ -5,17 +5,21 @@ set -euo pipefail
5
5
  # the 12-hourly job does (the job's program is `adl reconcile`, which runs this),
6
6
  # also run on demand:
7
7
  #
8
- # 1. tools: this package's bin/sync-and-reconcile with
9
- # `--source npm --device NAME --owner OWNER` (npm update, then tools
10
- # reconcile). The owner is the device's `administrator` in this package's
8
+ # 1. tools: this package's bin/sync-and-reconcile (run through bash, never
9
+ # executed directly: bun leaves every shipped file but the `bin` targets
10
+ # without an exec bit) with `--source npm --device NAME --owner OWNER`
11
+ # (package update with bun, then tools reconcile). `--source npm` names
12
+ # the registry the package comes from, not the installer. The owner is the
13
+ # device's `administrator` in this package's
11
14
  # manifest (bin/lib/fleet-host.sh, the lookup bin/setup shares). --mode is
12
15
  # forwarded only when given, so the default is apply.
13
16
  # 2. repositories: `adl maintain --location <repo_location> --expect-user
14
17
  # OWNER`, the package's own bin/adl, run AS THE ADMINISTRATOR -- never as
15
18
  # root. sudo resets PATH to its secure_path, which has neither Homebrew nor
16
19
  # /usr/local/bin, so PATH is always handed over explicitly with `env PATH=`
17
- # (every sudo -u call that ends up running adl, git or bun must). --mode
18
- # plan becomes --dry-run.
20
+ # (every sudo -u call that ends up running adl, git or bun must); the
21
+ # owner's bun bin directory (~/.bun/bin) is on it, after /usr/local/bin.
22
+ # --mode plan becomes --dry-run.
19
23
  #
20
24
  # Both steps always run (a failed tools step does not hide a repository problem,
21
25
  # and vice versa); the exit code is the first failure's, and each failure is
@@ -55,8 +59,11 @@ source "$script_dir/lib/fleet-host.sh"
55
59
  fleet_host_resolve "adl reconcile" "$package_dir/packages/fleet/manifest.json" "$host" || exit $?
56
60
  owner="$fleet_host_owner"
57
61
  repo_location="$fleet_host_repo_location"
62
+ branch_max_age_days="$fleet_host_branch_max_age_days"
58
63
 
59
- [[ -x "$script_dir/sync-and-reconcile" ]] || { echo "ERROR adl reconcile: package scheduler script is missing: $script_dir/sync-and-reconcile" >&2; exit 1; }
64
+ # shellcheck source=lib/adl-package.sh
65
+ source "$script_dir/lib/adl-package.sh"
66
+ [[ -f "$script_dir/sync-and-reconcile" ]] || { echo "ERROR adl reconcile: package scheduler script is missing: $script_dir/sync-and-reconcile" >&2; exit 1; }
60
67
 
61
68
  # One lock around both steps: an on-demand run overlapping the timer must not
62
69
  # run a second repository pass after its tools step lost sync's own lock.
@@ -65,17 +72,14 @@ if [[ -n "${ADL_SETUP_TEST_ROOT:-}" ]]; then
65
72
  else
66
73
  lock_dir=/var/run/adl-reconcile.lock
67
74
  fi
68
- if ! mkdir "$lock_dir" 2>/dev/null; then
69
- echo "ERROR adl reconcile: another reconcile is running (lock: $lock_dir)" >&2
70
- exit 1
71
- fi
72
- trap 'rmdir -- "$lock_dir"' EXIT
75
+ adl_lock_acquire "$lock_dir" "adl reconcile: another reconcile is running" || exit 1
76
+ trap 'rm -rf -- "$lock_dir"' EXIT
73
77
 
74
78
  # 1. tools
75
79
  sync_args=(--source npm --device "$host" --owner "$owner")
76
80
  if [[ -n "$mode" ]]; then sync_args+=(--mode "$mode"); fi
77
81
  tools_rc=0
78
- "$script_dir/sync-and-reconcile" "${sync_args[@]}" || tools_rc=$?
82
+ bash "$script_dir/sync-and-reconcile" "${sync_args[@]}" || tools_rc=$?
79
83
  if [[ "$tools_rc" -ne 0 ]]; then
80
84
  echo "ERROR global-tools: tools reconcile failed (exit $tools_rc)" >&2
81
85
  fi
@@ -90,17 +94,23 @@ else
90
94
  echo "ERROR global-tools: package adl is missing or not executable: $adl_bin" >&2
91
95
  repos_rc=1
92
96
  else
93
- if [[ "$fleet_host_platform" == mac ]]; then
94
- brew_bin_dir=/opt/homebrew/bin
95
- else
96
- brew_bin_dir=/home/linuxbrew/.linuxbrew/bin
97
+ case "$fleet_host_platform" in
98
+ mac) repo_os=Darwin ;;
99
+ *) repo_os=Linux ;;
100
+ esac
101
+ if ! owner_home="$(adl_owner_home "$owner")"; then
102
+ echo "ERROR global-tools: cannot resolve the home directory of $owner" >&2
103
+ exit 1
97
104
  fi
105
+ owner_path="$(adl_owner_path "$repo_os" "$owner_home")"
98
106
  maintain_args=(maintain --location "$repo_location" --expect-user "$owner")
107
+ # config.repo_maintain.branch_max_age_days in this package's manifest, never an environment variable.
108
+ if [[ -n "$branch_max_age_days" ]]; then maintain_args+=(--branch-max-age-days "$branch_max_age_days"); fi
99
109
  if [[ "$mode" == plan ]]; then maintain_args+=(--dry-run); fi
100
- # /usr/local/bin first: git must resolve to the managed controller, which
101
- # routes Azure DevOps traffic through the agent identity; Homebrew's git
102
- # would bypass it.
103
- sudo -u "$owner" -H env PATH="/usr/local/bin:$brew_bin_dir:/usr/bin:/bin" "$adl_bin" "${maintain_args[@]}" || repos_rc=$?
110
+ # /usr/local/bin first (see adl_owner_path): git must resolve to the managed
111
+ # controller, which routes Azure DevOps traffic through the agent identity;
112
+ # Homebrew's git would bypass it.
113
+ sudo -u "$owner" -H env PATH="$owner_path" "$adl_bin" "${maintain_args[@]}" || repos_rc=$?
104
114
  if [[ "$repos_rc" -ne 0 ]]; then
105
115
  echo "ERROR global-tools: repository maintenance failed (exit $repos_rc)" >&2
106
116
  fi
package/bin/setup CHANGED
@@ -2,10 +2,12 @@
2
2
  set -euo pipefail
3
3
 
4
4
  # `sudo adl setup --host NAME` -- the whole onboarding of a host after
5
- # `npm install -g @amsterdamdatalabs/adl-agent-control`:
5
+ # `bun install -g @amsterdamdatalabs/adl-agent-control` (run as the device's
6
+ # administrator):
6
7
  #
7
- # 1. check this is THE package the job manages (the one in the owner's global
8
- # npm root), and that its bin/adl is there
8
+ # 1. check this is THE package the job manages (the one in the owner's bun
9
+ # global directory), that its bin/adl is there, and that the `adl` the
10
+ # owner gets on PATH is this package and not a different one that shadows it
9
11
  # 2. run the first reconcile: `<this package>/bin/adl reconcile --host NAME`
10
12
  # 3. only if that succeeded, arm the job that re-runs the same command every
11
13
  # 12 hours
@@ -18,8 +20,10 @@ set -euo pipefail
18
20
  #
19
21
  # Everything comes from this package: it locates itself from its own path and
20
22
  # reads packages/fleet/manifest.json beside it (no git checkout, no source
21
- # flag -- npm is the only source). The account the job runs npm as is the
22
- # device's `administrator` in that manifest; there is no owner flag.
23
+ # flag -- the published package is the only source). The account the job runs
24
+ # bun as is the device's `administrator` in that manifest; there is no owner
25
+ # flag. The package's scripts are run through bash, never executed directly:
26
+ # bun leaves every shipped file but the `bin` targets without an exec bit.
23
27
  #
24
28
  # ADL_SETUP_TEST_ROOT is the one test switch (packages/fleet/tests/setup.test.ts):
25
29
  # unset in every real run. When set it relocates the system paths under that
@@ -53,33 +57,32 @@ fleet_host_resolve "adl setup" "$package_dir/packages/fleet/manifest.json" "$hos
53
57
  owner="$fleet_host_owner"
54
58
  minute="$fleet_host_minute"
55
59
 
56
- # The job keeps THE package installed in the owner's global npm root up to date
57
- # and reconciles from it. This must be that package, or the host would be armed
58
- # to manage a different copy than the one the operator just ran. Ask npm the same
59
- # way the job does (the functions are the job's own, from the sibling
60
+ # The job keeps THE package installed in the owner's bun global directory up to
61
+ # date and reconciles from it. This must be that package, or the host would be
62
+ # armed to manage a different copy than the one the operator just ran. Ask for
63
+ # the location the way the job does (bin/lib/adl-package.sh, shared with
60
64
  # sync-and-reconcile), and compare real paths.
61
- [[ -f "$script_dir/sync-and-reconcile" ]] || { echo "ERROR adl setup: package scheduler script is missing: $script_dir/sync-and-reconcile" >&2; exit 1; }
62
- # shellcheck source=sync-and-reconcile
63
- SYNC_AND_RECONCILE_SOURCE_ONLY=1 source "$script_dir/sync-and-reconcile"
65
+ # shellcheck source=lib/adl-package.sh
66
+ source "$script_dir/lib/adl-package.sh"
64
67
  os_name="$(uname -s)"
65
- npm_root="$(npm_global_root "$owner" "$os_name")" || {
66
- echo "ERROR adl setup: cannot resolve the global npm root as $owner" >&2
68
+ owner_home="$(adl_owner_home "$owner")" || {
69
+ echo "ERROR adl setup: cannot resolve the home directory of $owner" >&2
67
70
  exit 1
68
71
  }
69
- managed_dir="$(npm_platform_package_dir "$npm_root" "$os_name" "$(uname -m)")" || exit 1
72
+ managed_dir="$(adl_platform_package_dir "$(adl_global_node_modules "$owner_home")" "$os_name" "$(uname -m)")" || exit 1
70
73
  managed_real="$(cd -P -- "$managed_dir" 2>/dev/null && pwd -P)" || managed_real=""
71
74
  if [[ -z "$managed_real" || "$package_dir_real" != "$managed_real" ]]; then
72
75
  {
73
76
  echo "ERROR adl setup: this package ($package_dir_real) is not the package the scheduled job manages ($managed_dir)."
74
77
  echo "ERROR adl setup: install it where the job looks, as $owner, then run setup again:"
75
- echo "ERROR adl setup: Linux: npm install -g --prefix /usr/local @amsterdamdatalabs/adl-agent-control"
76
- echo "ERROR adl setup: macOS: npm install -g @amsterdamdatalabs/adl-agent-control"
78
+ echo "ERROR adl setup: bun install -g @amsterdamdatalabs/adl-agent-control"
77
79
  } >&2
78
80
  exit 1
79
81
  fi
80
82
 
81
83
  adl_bin="$package_dir_real/bin/adl"
82
84
  [[ -x "$adl_bin" ]] || { echo "ERROR adl setup: the package adl is missing or not executable: $package_dir/bin/adl" >&2; exit 1; }
85
+ adl_check_adl_not_shadowed "$owner" "$os_name" "$owner_home" "$package_dir_real" "adl setup" || exit 1
83
86
 
84
87
  if [[ -n "${ADL_SETUP_TEST_ROOT:-}" ]]; then
85
88
  system_root="${ADL_SETUP_TEST_ROOT%/}"
@@ -1,9 +1,15 @@
1
1
  #!/usr/bin/env bash
2
2
  # Managed by adl global-tools.
3
3
  # Keep /usr/local/bin first in interactive shells so manifest-owned front
4
- # controllers win over Homebrew and system executables on every host.
4
+ # controllers win over Homebrew and system executables on every host. The
5
+ # administrator's bun bin directory comes right after it (Tarun, 2026-10-01):
6
+ # hosts install the adl package with `bun install -g`, which links `adl` into
7
+ # $HOME/.bun/bin, and humans and agents must be able to run it (root on Linux:
8
+ # /root/.bun/bin). It stays behind /usr/local/bin so the managed git wins.
5
9
  set -euo pipefail
6
10
 
11
+ managed_path_line='export PATH="/usr/local/bin:$HOME/.bun/bin${PATH:+:$PATH}"'
12
+
7
13
  usage() {
8
14
  echo 'usage: shell-path-policy --home ABSOLUTE_PATH --platform mac|linux --mode plan|apply [--owner USER]' >&2
9
15
  exit 2
@@ -35,10 +41,14 @@ upsert_block() {
35
41
  mkdir -p -- "$(dirname -- "$file")"
36
42
  temp="$file.adl-new"
37
43
  if [[ -e "$file" ]]; then
44
+ # Trailing blank lines are dropped with the block: the append below puts one
45
+ # blank line back in front of it, so a re-run is byte-identical, not one line longer.
38
46
  awk -v begin="$begin" -v end="$end" '
39
47
  $0 == begin { inside = 1; next }
40
48
  $0 == end { inside = 0; next }
41
- !inside { print }
49
+ inside { next }
50
+ /^$/ { blanks++; next }
51
+ { while (blanks > 0) { print ""; blanks-- } print }
42
52
  ' "$file" >"$temp"
43
53
  else
44
54
  : >"$temp"
@@ -50,14 +60,14 @@ upsert_block() {
50
60
 
51
61
  if [[ "$platform" == mac ]]; then
52
62
  upsert_block "$home/.zshenv" '# BEGIN ADL GLOBAL PATH' '# END ADL GLOBAL PATH' \
53
- 'export PATH="/usr/local/bin${PATH:+:$PATH}"'
63
+ "$managed_path_line"
54
64
  exit 0
55
65
  fi
56
66
 
57
67
  upsert_block "$home/.bashenv" '# BEGIN ADL GLOBAL PATH ENV' '# END ADL GLOBAL PATH ENV' \
58
- 'export PATH="/usr/local/bin${PATH:+:$PATH}"'
68
+ "$managed_path_line"
59
69
  upsert_block "$home/.zshenv" '# BEGIN ADL GLOBAL PATH ENV' '# END ADL GLOBAL PATH ENV' \
60
- 'export PATH="/usr/local/bin${PATH:+:$PATH}"'
70
+ "$managed_path_line"
61
71
  for shell_file in "$home/.bashrc" "$home/.bash_profile" "$home/.profile"; do
62
72
  upsert_block "$shell_file" '# BEGIN ADL GLOBAL PATH SOURCE' '# END ADL GLOBAL PATH SOURCE' \
63
73
  'if [[ -r "$HOME/.bashenv" ]]; then . "$HOME/.bashenv"; fi'
@@ -7,8 +7,14 @@ else
7
7
  export PATH="/usr/local/bin:/opt/homebrew/bin:/home/linuxbrew/.linuxbrew/bin:/usr/bin:/bin:/usr/sbin:/sbin"
8
8
  fi
9
9
 
10
- # Scheduled sync downloads the ADL platform package and executes its own
11
- # reconcile command. Checkout mode is an explicit developer-only bypass.
10
+ # Scheduled sync installs the published ADL package with bun (as the device's
11
+ # administrator) and runs that package's own reconcile. Checkout mode is an
12
+ # explicit developer-only bypass. Package layout and owner lookups are in
13
+ # lib/adl-package.sh, shared with bin/setup and bin/reconcile.
14
+ _sync_and_reconcile_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
15
+ # shellcheck source=lib/adl-package.sh
16
+ source "$_sync_and_reconcile_dir/lib/adl-package.sh"
17
+
12
18
  sync_and_reconcile_platform() {
13
19
  case "$(uname -s)" in
14
20
  Darwin) printf '%s\n' mac ;;
@@ -39,7 +45,7 @@ parse_sync_source() {
39
45
  esac
40
46
  }
41
47
 
42
- npm_package_spec() {
48
+ adl_package_spec() {
43
49
  local policy="$1" version="${2:-}"
44
50
  case "$policy" in
45
51
  latest-stable) printf '%s@latest\n' '@amsterdamdatalabs/adl-agent-control' ;;
@@ -54,40 +60,6 @@ npm_package_spec() {
54
60
  esac
55
61
  }
56
62
 
57
- npm_platform_package_dir() {
58
- local npm_root="$1" os="$2" arch="$3" platform
59
- case "$os:$arch" in
60
- Darwin:arm64) platform=darwin-arm64 ;;
61
- Linux:x86_64) platform=linux-x64 ;;
62
- *) echo "ERROR unsupported platform for npm package: $os $arch" >&2; return 1 ;;
63
- esac
64
- # A global install nests optionalDependencies under the wrapper; npm never
65
- # hoists them to the global root.
66
- printf '%s/@amsterdamdatalabs/adl-agent-control/node_modules/@amsterdamdatalabs/adl-agent-control-%s\n' "${npm_root%/}" "$platform"
67
- }
68
-
69
- # Sets the `npm_env` array the owner's npm runs under: the same PATH and, on
70
- # Linux, the same /usr/local prefix for every npm call this job makes. bin/setup
71
- # sources this file and uses npm_global_root below, so it asks npm the very
72
- # same question the scheduled job does.
73
- resolve_npm_env() {
74
- local os="$1" npm_path
75
- case "$os" in
76
- Darwin) npm_path=/opt/homebrew/bin:/usr/bin:/bin ;;
77
- Linux) npm_path=/home/linuxbrew/.linuxbrew/bin:/usr/bin:/bin ;;
78
- *) echo "ERROR unsupported operating system for npm package: $os" >&2; return 1 ;;
79
- esac
80
- npm_env=(PATH="$npm_path")
81
- if [[ "$os" == Linux ]]; then npm_env=(npm_config_prefix=/usr/local PATH="$npm_path"); fi
82
- }
83
-
84
- # Prints OWNER's global npm root (`npm root -g` as that user, under npm_env).
85
- npm_global_root() {
86
- local owner="$1" os="$2"
87
- resolve_npm_env "$os" || return 1
88
- sudo -u "$owner" -H env "${npm_env[@]}" npm root -g
89
- }
90
-
91
63
  prepare_adl_npm_migration() {
92
64
  local applied_manifest="$1" device="$2" platform="$3" legacy_adl="$4" hash_file="$5"
93
65
  local previous_manager previous_executable
@@ -101,7 +73,7 @@ prepare_adl_npm_migration() {
101
73
  }
102
74
  rm -f -- "$legacy_adl"
103
75
  rm -f -- "$hash_file"
104
- echo "global-tools: removed prior Bun adl binary before npm install: $legacy_adl"
76
+ echo "global-tools: removed prior Bun adl binary before the package install: $legacy_adl"
105
77
  }
106
78
 
107
79
  if [[ "${SYNC_AND_RECONCILE_SOURCE_ONLY:-0}" == 1 ]]; then
@@ -149,11 +121,8 @@ if [[ -n "${SYNC_AND_RECONCILE_TEST_ROOT:-}" ]]; then
149
121
  else
150
122
  lock_dir=/var/run/adl-sync.lock
151
123
  fi
152
- if ! mkdir "$lock_dir" 2>/dev/null; then
153
- echo "ERROR global-tools: another reconciliation is running (lock: $lock_dir)" >&2
154
- exit 1
155
- fi
156
- trap 'rmdir "$lock_dir" 2>/dev/null || true' EXIT
124
+ adl_lock_acquire "$lock_dir" "global-tools: another reconciliation is running" || exit 1
125
+ trap 'rm -rf -- "$lock_dir"' EXIT
157
126
 
158
127
  host_platform="$(sync_and_reconcile_platform)"
159
128
  require_linux_automation_root "$host_platform" "$owner" || exit 1
@@ -162,44 +131,45 @@ if [[ "$sync_source" == checkout ]]; then
162
131
  [[ -e "$repo/.git" ]] || { echo "ERROR developer checkout missing: $repo" >&2; exit 1; }
163
132
  manifest="$repo/packages/fleet/manifest.json"
164
133
  [[ -f "$manifest" ]] || { echo "ERROR developer checkout manifest missing: $manifest" >&2; exit 1; }
165
- [[ -x "$repo/bin/reconcile" ]] || { echo "ERROR developer checkout reconcile is missing: $repo/bin/reconcile" >&2; exit 1; }
134
+ [[ -f "$repo/bin/reconcile" ]] || { echo "ERROR developer checkout reconcile is missing: $repo/bin/reconcile" >&2; exit 1; }
166
135
  echo "global-tools: source=checkout (developer mode)"
167
136
  reconcile_dir="$repo/bin"
168
137
  else
169
138
  os="$(uname -s)"
170
139
  arch="$(uname -m)"
171
- resolve_npm_env "$os" || exit 1
172
- npm_root="$(npm_global_root "$owner" "$os")" || {
173
- echo "ERROR cannot resolve the global npm root as $owner" >&2
140
+ owner_home="$(adl_owner_home "$owner")" || {
141
+ echo "ERROR cannot resolve the home directory of $owner" >&2
174
142
  exit 1
175
143
  }
176
- [[ "$npm_root" == /*/lib/node_modules ]] || {
177
- echo "ERROR global npm root has an unsupported path: $npm_root" >&2
178
- exit 1
179
- }
180
- npm_prefix="${npm_root%/lib/node_modules}"
181
- platform_dir="$(npm_platform_package_dir "$npm_root" "$os" "$arch")" || exit 1
144
+ global_node_modules="$(adl_global_node_modules "$owner_home")"
145
+ platform_dir="$(adl_platform_package_dir "$global_node_modules" "$os" "$arch")" || exit 1
182
146
  installed_manifest="$platform_dir/packages/fleet/manifest.json"
183
147
  package_spec=""
148
+ update_policy=""
149
+ installed_version=""
184
150
  if [[ -f "$installed_manifest" ]]; then
151
+ [[ -f "$platform_dir/package.json" ]] && installed_version="$(jq -er '.version | select(type == "string")' "$platform_dir/package.json")" || {
152
+ echo "ERROR installed adl package has no readable version: $platform_dir/package.json" >&2
153
+ exit 1
154
+ }
185
155
  update_policy="$(jq -er '.config.update_policy | select(type == "string")' "$installed_manifest")" || {
186
156
  echo "ERROR installed adl package manifest has no config.update_policy: $installed_manifest" >&2
187
157
  exit 1
188
158
  }
189
159
  case "$update_policy" in
190
- latest-stable) package_spec="$(npm_package_spec latest-stable)" ;;
160
+ latest-stable) package_spec="$(adl_package_spec latest-stable)" ;;
191
161
  pinned)
192
162
  pinned_version="$(jq -er --arg platform "$host_platform" '.[$platform].common.tools.adl.version | select(type == "string")' "$installed_manifest")" || {
193
163
  echo "ERROR installed adl package manifest requires a version for pinned update_policy: $installed_manifest" >&2
194
164
  exit 1
195
165
  }
196
- package_spec="$(npm_package_spec pinned "$pinned_version")" || exit 1
166
+ package_spec="$(adl_package_spec pinned "$pinned_version")" || exit 1
197
167
  ;;
198
- *) package_spec="$(npm_package_spec "$update_policy")" || exit 1 ;;
168
+ *) package_spec="$(adl_package_spec "$update_policy")" || exit 1 ;;
199
169
  esac
200
170
  else
201
- package_spec="$(npm_package_spec latest-stable)"
202
- echo "global-tools: bootstrapping adl package from npm latest tag"
171
+ package_spec="$(adl_package_spec latest-stable)"
172
+ echo "global-tools: bootstrapping adl package from the registry latest tag"
203
173
  fi
204
174
 
205
175
  if [[ -n "${SYNC_AND_RECONCILE_TEST_ROOT:-}" ]]; then
@@ -214,15 +184,43 @@ else
214
184
  fi
215
185
  prepare_adl_npm_migration "$applied_manifest" "$device" "$host_platform" "$legacy_adl" "$legacy_hash"
216
186
 
217
- sudo -u "$owner" -H env "${npm_env[@]}" npm install --global --prefix "$npm_prefix" --no-audit --no-fund "$package_spec"
218
- [[ -d "$platform_dir" ]] || { echo "ERROR npm install did not create the platform package: $platform_dir" >&2; exit 1; }
187
+ # NEVER DOWNGRADE (Tarun, 2026-10-01): under latest-stable the installed package is
188
+ # compared with the registry's `latest` first. Newer installed (a local pre-release
189
+ # build) and equal are kept; only an older one is updated. A lookup that fails stops
190
+ # the run loudly. A first install has nothing to compare, and a pinned policy installs
191
+ # exactly its pin.
192
+ skip_install=0
193
+ if [[ -n "$installed_version" && "$update_policy" == latest-stable ]]; then
194
+ registry_latest="$(adl_registry_latest "$owner" "$os" "$owner_home")" || {
195
+ echo "ERROR cannot read the registry latest of $adl_wrapper_package; not updating and not reconciling (run again when the registry is reachable)" >&2
196
+ exit 1
197
+ }
198
+ version_order="$(adl_semver_compare "$installed_version" "$registry_latest")" || exit 1
199
+ case "$version_order" in
200
+ 1)
201
+ echo "global-tools: installed $installed_version is newer than registry latest $registry_latest; keeping it"
202
+ skip_install=1
203
+ ;;
204
+ 0)
205
+ echo "global-tools: installed $installed_version is already the registry latest; no update needed"
206
+ skip_install=1
207
+ ;;
208
+ *) echo "global-tools: updating adl package $installed_version -> $registry_latest" ;;
209
+ esac
210
+ fi
211
+ if [[ "$skip_install" -eq 0 ]]; then
212
+ adl_bun_add_global "$owner" "$os" "$owner_home" "$package_spec"
213
+ fi
214
+ [[ -d "$platform_dir" ]] || { echo "ERROR bun add did not create the platform package: $platform_dir" >&2; exit 1; }
219
215
  installed_manifest="$platform_dir/packages/fleet/manifest.json"
220
216
  [[ -f "$installed_manifest" ]] || { echo "ERROR installed adl package manifest missing: $installed_manifest" >&2; exit 1; }
221
- [[ -x "$platform_dir/bin/reconcile" ]] || { echo "ERROR installed adl package reconcile is missing: $platform_dir/bin/reconcile" >&2; exit 1; }
222
- [[ -x "$platform_dir/bin/validate-manifest" ]] || { echo "ERROR installed adl package manifest validator is missing: $platform_dir/bin/validate-manifest" >&2; exit 1; }
223
- "$platform_dir/bin/validate-manifest" "$installed_manifest"
217
+ # bun leaves every shipped file but the `bin` targets 0644, so the package's
218
+ # scripts are checked with -f and run through bash, never executed directly.
219
+ [[ -f "$platform_dir/bin/reconcile" ]] || { echo "ERROR installed adl package reconcile is missing: $platform_dir/bin/reconcile" >&2; exit 1; }
220
+ [[ -f "$platform_dir/bin/validate-manifest" ]] || { echo "ERROR installed adl package manifest validator is missing: $platform_dir/bin/validate-manifest" >&2; exit 1; }
221
+ bash "$platform_dir/bin/validate-manifest" "$installed_manifest"
224
222
  reconcile_dir="$platform_dir/bin"
225
223
  fi
226
224
 
227
- PATH="$reconcile_dir:$PATH" "$reconcile_dir/reconcile" \
225
+ PATH="$reconcile_dir:$PATH" bash "$reconcile_dir/reconcile" \
228
226
  --device "$device" --source "$sync_source" --mode "$mode"
@@ -11,6 +11,12 @@ manifest="${1:-}"
11
11
 
12
12
  if ! jq -e '
13
13
  def relpath: type == "string" and length > 0 and (startswith("/") | not) and (split("/") | index("..") | not);
14
+ # git_global_config (bin/git-defaults): key -> string, or key -> non-empty ordered array of strings.
15
+ # {git-credential-manager} is the only placeholder a value may carry (gh/GitHub is not managed by adl).
16
+ def gitcfg_value: type == "string" and ([match("\\{[^}]*\\}"; "g").string] | all(. == "{git-credential-manager}"));
17
+ def gitcfg: type == "object" and
18
+ (to_entries | all((.key | test("^[A-Za-z][A-Za-z0-9-]*\\..+")) and
19
+ (.value | gitcfg_value or (type == "array" and length > 0 and all(gitcfg_value)))));
14
20
  keys == ["config", "linux", "mac"] and
15
21
  .config.schema == 1 and
16
22
  (.config.repository | type == "string" and test("^https://dev\\.azure\\.com/[A-Za-z0-9._-]+/[A-Za-z0-9._-]+/_git/[A-Za-z0-9._-]+$")) and
@@ -26,15 +32,21 @@ if ! jq -e '
26
32
  .config.surface_policy == {"enabled": true} and
27
33
  .config.global_agents == {"enabled": true} and
28
34
  .config.vscode_settings == {"enabled": true} and
35
+ (.config.repo_maintain | type == "object") and
36
+ (.config.repo_maintain | keys == ["branch_max_age_days"]) and
37
+ (.config.repo_maintain.branch_max_age_days | type == "number" and . >= 1 and floor == .) and
29
38
  (.config.scratch_reap | type == "object") and
30
39
  (.config.scratch_reap | keys == ["enabled", "idle_days", "reap_days", "remove_worktrees"]) and
31
40
  .config.scratch_reap.enabled == true and
32
41
  (.config.scratch_reap.idle_days | type == "number" and . >= 0 and floor == .) and
33
42
  (.config.scratch_reap.reap_days | type == "number" and . >= 1 and floor == .) and
34
43
  (.config.scratch_reap.remove_worktrees | type == "boolean") and
44
+ (.config.brew_upgrade_exclude | type == "array" and
45
+ (. | unique | length) == length and
46
+ all(type == "string" and test("^[A-Za-z0-9][A-Za-z0-9@._+/-]*$"))) and
35
47
  (.config.protected_tools | type == "array") and
36
- (.config.git_global_config | type == "object" and
37
- (to_entries | all((.key | test("^[A-Za-z][A-Za-z0-9-]*\\..+")) and (.value | type) == "string"))) and
48
+ (.config.git_global_config | gitcfg) and
49
+ ([.mac.common, .linux.common] | all((.git_global_config // {}) | gitcfg)) and
38
50
  (.mac.common.tools | type == "object") and
39
51
  (.mac.devices | type == "object") and
40
52
  (.linux.common.tools | type == "object") and
@@ -43,7 +55,9 @@ if ! jq -e '
43
55
  all(.minimum_free_gib >= 1) and
44
56
  all((.home | type) == "string" and (.home | startswith("/"))) and
45
57
  all((.default_agent | type) == "string" and (.default_agent | test("^agent-[a-z0-9-]+$"))) and
46
- all((keys - ["administrator", "default_agent", "home", "minimum_free_gib", "schedule_minute", "scratch_repos", "brew_upgrade_all", "surface_clis", "repo_location", "tools"] | length) == 0) and
58
+ all((.git_user | type == "object" and (keys | sort) == ["email", "name"] and
59
+ all(.[]; type == "string" and length > 0))) and
60
+ all((keys - ["administrator", "default_agent", "git_user", "home", "minimum_free_gib", "schedule_minute", "scratch_repos", "brew_upgrade_all", "surface_clis", "repo_location", "tools"] | length) == 0) and
47
61
  all((.scratch_repos // []) | type == "array" and (. | unique | length) == length and
48
62
  all(type == "string" and startswith("/") and . != "/" and
49
63
  (endswith("/") | not) and (contains("..") | not) and (test("\\s") | not))) and
@@ -65,13 +79,23 @@ if ! jq -e '
65
79
  ($surfaces | map(.name) | length == (unique | length)) and
66
80
  ($surfaces | all(
67
81
  (.name | type == "string" and length > 0) and
68
- (.manager | type == "string" and (. == "native" or . == "npm" or . == "brew" or . == "unknown")) and
82
+ (.manager | type == "string" and (. == "native" or . == "npm" or . == "brew" or . == "bun" or . == "unknown")) and
69
83
  ((.report_only // false) | type == "boolean") and
70
- (if (.report_only // false) == true then
71
- (.executable | type == "string" and startswith("/"))
84
+ # manager bun (2026-10-01): installed and updated as `bun add -g <package>@latest`, so it
85
+ # names a bare registry package (no version spec: versions are never pinned) and a command,
86
+ # and carries no update_args (the manager fixes the argv) and no report_only.
87
+ (if .manager == "bun" then
88
+ ((.package | type == "string") and (.package | test("^(@[a-z0-9][a-z0-9._-]*/)?[a-z0-9][a-z0-9._-]*$"))) and
89
+ ((.command | type == "string") and (.command | length > 0) and (.command | contains("/") | not)) and
90
+ (has("update_args") | not) and (has("version") | not) and ((.report_only // false) == false)
72
91
  else
73
- (.command | type == "string" and length > 0 and (contains("/") | not)) and
74
- (.update_args | type == "array" and length > 0 and all(type == "string" and length > 0))
92
+ (has("package") | not) and
93
+ (if (.report_only // false) == true then
94
+ (.executable | type == "string" and startswith("/"))
95
+ else
96
+ (.command | type == "string" and length > 0 and (contains("/") | not)) and
97
+ (.update_args | type == "array" and length > 0 and all(type == "string" and length > 0))
98
+ end)
75
99
  end) and
76
100
  (.manager != "brew" or
77
101
  ((.report_only // false) == false and .command == "brew" and
@@ -153,7 +177,7 @@ if ! jq -e '
153
177
  all(type == "string" and test("^(@[a-z0-9][a-z0-9._-]*/)?[a-z0-9][a-z0-9._-]*$")))
154
178
  else true end)) and
155
179
  # launch_agents are gone (2026-09-30): a stale declaration must fail loud.
156
- ([.mac.common, .linux.common] | all(keys - ["os_upgrade", "tools"] | length == 0))
180
+ ([.mac.common, .linux.common] | all(keys - ["os_upgrade", "git_global_config", "tools"] | length == 0))
157
181
  ' "$manifest" >/dev/null; then
158
182
  echo "global-tools manifest: INVALID ($manifest does not satisfy bin/validate-manifest's schema)" >&2
159
183
  exit 1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amsterdamdatalabs/adl-agent-control-linux-x64",
3
- "version": "0.1.12",
3
+ "version": "0.1.26",
4
4
  "description": "adl CLI binary for linux/x64 (agent identity + Azure DevOps front door — see docs/architecture/cli-design.md)",
5
5
  "license": "UNLICENSED",
6
6
  "os": [
@@ -14,11 +14,7 @@
14
14
  "packages/fleet/manifest.json",
15
15
  "packages/fleet/manifest.schema.json",
16
16
  "packages/fleet/src",
17
- "packages/agent-settings/surface-policy.json",
18
- "packages/agent-settings/protected.json",
19
- "packages/agent-settings/src",
20
- "packages/agent-settings/assets",
21
- "packages/agent-settings/managed",
17
+ "packages/agent-settings",
22
18
  "packages/agent-skills",
23
19
  "packages/repo-controls",
24
20
  "packages/agent-hooks",
@@ -29,13 +25,9 @@
29
25
  },
30
26
  "dependencies": {
31
27
  "@iarna/toml": "^2.2.5",
32
- "@tailwindcss/node": "4.2.1",
33
28
  "ajv": "^8.17.1",
34
29
  "ajv-formats": "^3.0.1",
35
- "istanbul-lib-coverage": "3.2.2",
36
30
  "minisearch": "7.2.0",
37
- "svelte": "5.38.10",
38
- "tailwindcss": "4.1.11",
39
31
  "typescript": "5.9.3",
40
32
  "yaml": "^2.9.0"
41
33
  }
@@ -213,14 +213,16 @@ directory containing a `.git` entry) and checking for
213
213
 
214
214
  ### File format
215
215
 
216
- Six top-level keys are recognized: `version`, `[hooks]`, `[rules]`, `[repo]`,
217
- `[controls]`, and `[skills]`. `[controls]` and `[skills]` are reserved root
218
- tables owned by other tools (`enact-repo-controls` and `adl-extensions`,
219
- respectively) that share this same file; `adl hook` accepts and ignores
220
- them without ever reading their contents. Every other top-level key — and
221
- every unrecognized key inside `[hooks]` or `[repo]` — is a decode error
222
- (fails loud, non-zero exit, reason on stderr), never silently ignored; see
223
- "Unknown keys fail loud" below.
216
+ The recognized root keys include `version`, `[hooks]`, `[rules]`, `[repo]`,
217
+ `[agent]`, `[controls]`, `[skills]`, `[extensions]`, and `[azdo]`. `[controls]`
218
+ and `[skills]` belong to other tools sharing this file; `[azdo]` is reserved
219
+ for shared Azure DevOps configuration. `adl hook` accepts these tables without
220
+ reading their contents, so optional tables such as `[azdo.scope]` can be present
221
+ while its hook configuration remains independent. `[extensions]` is also a
222
+ shared table, but `adl hook` reads its sub-table names to locate extension
223
+ skills. Every other top-level key — and every unrecognized key inside `[hooks]`
224
+ or `[repo]` — is a decode error (fails loud, non-zero exit, reason on stderr),
225
+ never silently ignored; see "Unknown keys fail loud" below.
224
226
 
225
227
  ```toml
226
228
  version = 1 # optional; accepted for the marker file's
@@ -353,7 +355,10 @@ fixed in the process (see `src/lib/spawn-with-timeout.ts`,
353
355
  `XDG_CONFIG_HOME` / `XDG_DATA_HOME` / `XDG_STATE_HOME` / `XDG_CACHE_HOME`
354
356
  environment (rooted at `<repo root>/.agents/lean-ctx/`) that wrapper used
355
357
  to set, so `lean-ctx`'s state stays per-repository even though the
356
- binary itself is shared.
358
+ binary itself is shared. In a linked git worktree the four stores root at
359
+ the main checkout (resolved from the worktree's own `.git` file), so
360
+ worktree sessions share the accumulated knowledge instead of starting
361
+ cold.
357
362
 
358
363
  ## Integration pass (three independently-migrated slices + foundation)
359
364
 
@@ -21,16 +21,6 @@
21
21
  "timeout": 10
22
22
  }
23
23
  ]
24
- },
25
- {
26
- "hooks": [
27
- {
28
- "type": "command",
29
- "command": "adl hook lean-ctx pre-tool-use",
30
- "statusMessage": "adl-repo: lean-ctx pre-tool-use",
31
- "timeout": 10
32
- }
33
- ]
34
24
  }
35
25
  ],
36
26
  "UserPromptSubmit": [
@@ -69,16 +59,6 @@
69
59
  "timeout": 5
70
60
  }
71
61
  ]
72
- },
73
- {
74
- "hooks": [
75
- {
76
- "type": "command",
77
- "command": "adl hook lean-ctx post-tool-use",
78
- "statusMessage": "adl-repo: lean-ctx post-tool-use",
79
- "timeout": 10
80
- }
81
- ]
82
62
  }
83
63
  ],
84
64
  "SessionEnd": [
@@ -70,7 +70,7 @@ function isDirectory(path: string): boolean {
70
70
  }
71
71
 
72
72
  /** The built-in config an unmanaged repo is described with — the decode of an empty file, i.e. the schema defaults. */
73
- export function defaultConfig(): AdlRepoConfig {
73
+ function defaultConfig(): AdlRepoConfig {
74
74
  return (decodeConfig('') as { readonly value: AdlRepoConfig }).value
75
75
  }
76
76