@amsterdamdatalabs/adl-agent-control-darwin-arm64 0.1.48 → 0.1.54

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 (186) hide show
  1. package/bin/adl +1 -1
  2. package/bin/lean-ctx-observe-strip +434 -0
  3. package/bin/lib/lean-ctx-observe-hooks.sh +634 -0
  4. package/bin/reconcile +45 -0
  5. package/bin/repo-search-mcp +4 -0
  6. package/bin/update-azure-agent-pool +29 -0
  7. package/package.json +3 -2
  8. package/packages/agent-hooks/src/hooks/lean-ctx/handler.ts +22 -0
  9. package/packages/agent-hooks/src/hooks/lean-ctx/index.ts +173 -0
  10. package/packages/agent-hooks/src/hooks/lean-ctx/mapping.ts +121 -0
  11. package/packages/agent-hooks/src/hooks/lean-ctx/scope-rewrite.ts +207 -0
  12. package/packages/agent-hooks/src/lean-ctx/env.ts +123 -0
  13. package/packages/agent-hooks/src/lean-ctx/mcp.ts +142 -0
  14. package/packages/agent-hooks/src/rules/impl/adl-build-run-denied.ts +51 -0
  15. package/packages/agent-hooks/src/rules/impl/adl-git-push-policy.ts +25 -1
  16. package/packages/agent-hooks/src/rules/impl/adl-session-required.ts +403 -0
  17. package/packages/agent-hooks/src/rules/impl/adl-worktree.ts +51 -0
  18. package/packages/agent-hooks/src/rules/impl/git-target.ts +13 -0
  19. package/packages/agent-hooks/src/rules/impl/tool-lean-ctx-global.ts +594 -0
  20. package/packages/agent-hooks/src/rules/registry.ts +4 -0
  21. package/packages/agent-hooks/src/rules/shell/invocation.ts +38 -0
  22. package/packages/agent-settings/assets/GLOBAL-AGENTS.md +112 -0
  23. package/packages/agent-settings/assets/lean-ctx/config.toml +42 -0
  24. package/packages/agent-settings/assets/lean-ctx/gitignore +10 -0
  25. package/packages/agent-settings/assets/lean-ctx/layout.toml +7 -0
  26. package/packages/agent-settings/assets/mcp.json +3 -0
  27. package/packages/agent-settings/src/deploy/lean-ctx-deploy.ts +230 -0
  28. package/packages/agent-settings/src/deploy/lean-ctx-merge.ts +580 -0
  29. package/packages/agent-settings/src/deploy/mcp-source.ts +6 -5
  30. package/packages/agent-skills/assets/adl-mechanics/SKILL.md +38 -0
  31. package/packages/agent-skills/assets/codebase-design/SKILL.md +98 -0
  32. package/packages/agent-skills/assets/codebase-design/references/DEEPENING.md +37 -0
  33. package/packages/agent-skills/assets/codebase-design/references/DESIGN-IT-TWICE.md +44 -0
  34. package/packages/agent-skills/assets/codebase-design/references/TESTABILITY.md +29 -0
  35. package/packages/agent-skills/assets/debug-issue/SKILL.md +41 -0
  36. package/packages/agent-skills/assets/domain-modeling/SKILL.md +86 -0
  37. package/packages/agent-skills/assets/domain-modeling/references/ADR-FORMAT.md +47 -0
  38. package/packages/agent-skills/assets/domain-modeling/references/CONTEXT-FORMAT.md +60 -0
  39. package/packages/agent-skills/assets/implement/SKILL.md +28 -0
  40. package/packages/agent-skills/assets/review-changes/SKILL.md +45 -0
  41. package/packages/agent-skills/assets/tdd/SKILL.md +49 -0
  42. package/packages/agent-skills/assets/tdd/references/mocking.md +59 -0
  43. package/packages/agent-skills/assets/tdd/references/tests.md +77 -0
  44. package/packages/agent-skills/assets/testing/SKILL.md +54 -0
  45. package/packages/agent-skills/assets/testing/references/e2e.md +37 -0
  46. package/packages/agent-skills/assets/testing/references/integration.md +37 -0
  47. package/packages/agent-skills/assets/testing/references/unit.md +32 -0
  48. package/packages/agent-skills/assets/to-feature/SKILL.md +91 -0
  49. package/packages/agent-skills/assets/to-feature/references/FEATURE-SPEC-TEMPLATE.md +88 -0
  50. package/packages/agent-skills/assets/to-workitems/SKILL.md +90 -0
  51. package/packages/agent-skills/assets/to-workitems/references/AZURE-DEVOPS-HIERARCHY.md +121 -0
  52. package/packages/agent-skills/assets/to-workitems/references/TICKET-TEMPLATES.md +70 -0
  53. package/packages/azdo/src/workflow-rules-matrix.csv +85 -0
  54. package/packages/fleet/manifest.json +2 -0
  55. package/packages/fleet/src/install-adl-package.ts +30 -23
  56. package/packages/fleet/src/launch-agents.ts +649 -0
  57. package/packages/repo-controls/README.md +11 -7
  58. package/packages/repo-controls/assets/GLOBAL-INVARIANTS.md +21 -0
  59. package/packages/repo-controls/assets/enable-integration-auto-complete.mjs +79 -0
  60. package/packages/repo-controls/assets/scaffold/docs/notes.md +20 -0
  61. package/packages/repo-controls/assets/scaffold/plans/GAPS-AND-FINDINGS.md +12 -0
  62. package/packages/repo-controls/azure-pipelines.yml +274 -0
  63. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/closed_set/fixtures/docs/notes.md +1 -0
  64. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/english_only/fixtures/excluded/frontend/mobile/src/i18n/locales/zh-CN/strings.ts +1 -0
  65. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-ledger-clean/docs/notes.md +17 -0
  66. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-ledger-no-lines/docs/notes.md +13 -0
  67. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/semantics/fixtures/semantics-violations/docs/architecture/product/stable-delivery.md +10 -0
  68. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/semantics/fixtures/semantics-violations/docs/architecture/product/stable-recommendation.md +12 -0
  69. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/semantics/fixtures/semantics-violations/docs/architecture/product/target-narration.md +10 -0
  70. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-clean/frontend/packages/desktop/src/renderer/solo/item.ts +1 -0
  71. 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
  72. 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
  73. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-excluded/frontend/packages/desktop/src/renderer/fresh/fresh.ts +1 -0
  74. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-excluded/frontend/packages/desktop/src/renderer/many/sub1/only.ts +1 -0
  75. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-excluded/frontend/packages/desktop/src/renderer/many/sub10/only.ts +1 -0
  76. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-excluded/frontend/packages/desktop/src/renderer/many/sub11/only.ts +1 -0
  77. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-excluded/frontend/packages/desktop/src/renderer/many/sub2/only.ts +1 -0
  78. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-excluded/frontend/packages/desktop/src/renderer/many/sub3/only.ts +1 -0
  79. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-excluded/frontend/packages/desktop/src/renderer/many/sub4/only.ts +1 -0
  80. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-excluded/frontend/packages/desktop/src/renderer/many/sub5/only.ts +1 -0
  81. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-excluded/frontend/packages/desktop/src/renderer/many/sub6/only.ts +1 -0
  82. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-excluded/frontend/packages/desktop/src/renderer/many/sub7/only.ts +1 -0
  83. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-excluded/frontend/packages/desktop/src/renderer/many/sub8/only.ts +1 -0
  84. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-excluded/frontend/packages/desktop/src/renderer/many/sub9/only.ts +1 -0
  85. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-excluded/frontend/packages/desktop/src/renderer/services/i18n/locales/de/common.json +1 -0
  86. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-excluded/frontend/packages/desktop/src/renderer/solo/item.ts +1 -0
  87. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-excluded/frontend/packages/desktop/src/vendored-crate/Cargo.toml +2 -0
  88. 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
  89. 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
  90. 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
  91. 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
  92. 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
  93. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-unbaselined/frontend/packages/desktop/src/renderer/fresh/fresh.ts +1 -0
  94. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-unbaselined/frontend/packages/desktop/src/renderer/many/sub1/only.ts +1 -0
  95. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-unbaselined/frontend/packages/desktop/src/renderer/many/sub10/only.ts +1 -0
  96. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-unbaselined/frontend/packages/desktop/src/renderer/many/sub11/only.ts +1 -0
  97. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-unbaselined/frontend/packages/desktop/src/renderer/many/sub2/only.ts +1 -0
  98. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-unbaselined/frontend/packages/desktop/src/renderer/many/sub3/only.ts +1 -0
  99. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-unbaselined/frontend/packages/desktop/src/renderer/many/sub4/only.ts +1 -0
  100. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-unbaselined/frontend/packages/desktop/src/renderer/many/sub5/only.ts +1 -0
  101. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-unbaselined/frontend/packages/desktop/src/renderer/many/sub6/only.ts +1 -0
  102. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-unbaselined/frontend/packages/desktop/src/renderer/many/sub7/only.ts +1 -0
  103. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-unbaselined/frontend/packages/desktop/src/renderer/many/sub8/only.ts +1 -0
  104. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-unbaselined/frontend/packages/desktop/src/renderer/many/sub9/only.ts +1 -0
  105. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-unbaselined/frontend/packages/desktop/src/renderer/solo/item.ts +1 -0
  106. 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
  107. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/open_work_cap/fixtures/open-work-cap-clean/plans/GAPS-AND-FINDINGS.md +5 -0
  108. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/open_work_cap/fixtures/open-work-cap-clean/plans/features/az601-clean/spec.md +10 -0
  109. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/placement/fixtures/placement-allowed/agent/crates/enact-providers/src/snapshots/README.md +1 -0
  110. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/placement/fixtures/placement-allowed/backend/crates/enact-app/assets/builtin-assistants/avatars/assistant.jpg +1 -0
  111. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/placement/fixtures/placement-allowed/backend/crates/enact-assets/assets/logos/tools/coding/tool.png +1 -0
  112. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/placement/fixtures/placement-allowed/backend/crates/enact-session/src/backend/codex_init_prompt.md +1 -0
  113. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/placement/fixtures/placement-allowed/frontend/mobile/assets/images/icon.png +1 -0
  114. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/placement/fixtures/placement-allowed/frontend/packages/desktop/src/renderer/assets/logos/brand/app.png +1 -0
  115. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/placement/fixtures/placement-allowed/frontend/packages/desktop/src/renderer/assets/themes/default-theme.png +1 -0
  116. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/placement/fixtures/placement-allowed/frontend/public/pwa/icon-192.png +1 -0
  117. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/placement/fixtures/placement-allowed/frontend/resources/product.png +1 -0
  118. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/placement/fixtures/placement-stray/backend/crates/enact-session/src/backend/README.md +1 -0
  119. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/plans_layout/fixtures/plans-layout-clean/plans/features/az347-test-coverage/spec.md +12 -0
  120. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/plans_layout/fixtures/plans-layout-violation/plans/features/az347-test-coverage/spec.md +12 -0
  121. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/profile_data/__init__.py +11 -0
  122. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/profile_data/check.py +62 -0
  123. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/profile_data/fixtures/migration-filenames/backend/crates/demo/NotAMigration.sql +1 -0
  124. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/profile_data/fixtures/migration-filenames/backend/crates/demo/migrations/0001_long_prefix.sql +1 -0
  125. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/profile_data/fixtures/migration-filenames/backend/crates/demo/migrations/001_init.sql +1 -0
  126. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/profile_data/fixtures/migration-filenames/backend/crates/demo/migrations/002_add_index.sql +1 -0
  127. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/profile_data/fixtures/migration-filenames/backend/crates/demo/migrations/003-dashed-slug.sql +1 -0
  128. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/profile_data/fixtures/migration-filenames/backend/crates/demo/migrations/004_MixedCase.sql +1 -0
  129. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/profile_data/fixtures/migration-filenames/backend/crates/demo/migrations/005_trailing space.sql +1 -0
  130. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/profile_data/fixtures/migration-filenames/backend/crates/demo/migrations/01_short_prefix.sql +1 -0
  131. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/profile_data/fixtures/migration-filenames/backend/crates/demo/migrations/not-a-migration.sql +1 -0
  132. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/profile_data/test_check.py +116 -0
  133. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/references/fixtures/link-targets-broken/docs/architecture/product/links.md +20 -0
  134. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/references/fixtures/link-targets-broken/docs/architecture/product/route-target.md +8 -0
  135. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/references/fixtures/link-targets-clean/docs/architecture/product/links.md +20 -0
  136. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/references/fixtures/link-targets-clean/docs/architecture/product/route-target.md +8 -0
  137. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/root_closed_set/fixtures/.changeset/declared.txt +1 -0
  138. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/root_markdown_allowlist/fixtures/root-markdown-clean/INDEPENDENT-VERIFICATION.md +3 -0
  139. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/attribute-without-conversion/.gitattributes +1 -0
  140. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/attribute-without-conversion/large file.bin +3 -0
  141. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/clean/.gitattributes +1 -0
  142. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/clean/large file.bin +3 -0
  143. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/clean/small.txt +1 -0
  144. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/missing-filter/large file.bin +0 -0
  145. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/unmatched-extension/.gitattributes +1 -0
  146. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/unmatched-extension/payload.dat +0 -0
  147. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/pipeline/__init__.py +1 -0
  148. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/pipeline/phase_disjoint/__init__.py +12 -0
  149. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/pipeline/phase_disjoint/check.py +129 -0
  150. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/pipeline/phase_disjoint/fixtures/disjoint/gate-registry.yaml +13 -0
  151. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/pipeline/phase_disjoint/fixtures/empty/gate-registry.yaml +7 -0
  152. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/pipeline/phase_disjoint/fixtures/overlapping/gate-registry.yaml +13 -0
  153. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/pipeline/phase_disjoint/test_check.py +109 -0
  154. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/__init__.py +1 -0
  155. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/changeset_plan/__init__.py +11 -0
  156. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/changeset_plan/check.py +149 -0
  157. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/changeset_plan/fixtures/clean/docs/readme.md +4 -0
  158. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/changeset_plan/fixtures/relevant/VERSION +1 -0
  159. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/changeset_plan/test_check.py +151 -0
  160. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/version_release/__init__.py +11 -0
  161. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/version_release/check.py +202 -0
  162. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/version_release/fixtures/aligned/.workflows/changesets/package.json +5 -0
  163. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/version_release/fixtures/aligned/.workflows/package.json +5 -0
  164. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/version_release/fixtures/aligned/CHANGELOG.md +5 -0
  165. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/version_release/fixtures/aligned/VERSION +1 -0
  166. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/version_release/fixtures/mismatched/.workflows/changesets/package.json +5 -0
  167. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/version_release/fixtures/mismatched/.workflows/package.json +5 -0
  168. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/version_release/fixtures/mismatched/CHANGELOG.md +5 -0
  169. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/version_release/fixtures/mismatched/VERSION +1 -0
  170. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/version_release/test_check.py +162 -0
  171. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/banned_commands/check.py +103 -0
  172. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/lockfile_integrity/fixtures/clean/backend/Cargo.lock +7 -0
  173. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/lockfile_integrity/fixtures/clean/backend/Cargo.toml +4 -0
  174. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/lockfile_integrity/fixtures/clean/backend/rust-toolchain.toml +3 -0
  175. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/lockfile_integrity/fixtures/clean/backend/src/main.rs +1 -0
  176. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/lockfile_integrity/fixtures/clean/frontend/bun.lock +1 -0
  177. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/lockfile_integrity/fixtures/empty-bun-lock/backend/Cargo.lock +7 -0
  178. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/lockfile_integrity/fixtures/empty-bun-lock/backend/Cargo.toml +4 -0
  179. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/lockfile_integrity/fixtures/empty-bun-lock/backend/rust-toolchain.toml +3 -0
  180. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/lockfile_integrity/fixtures/empty-bun-lock/backend/src/main.rs +1 -0
  181. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/lockfile_integrity/fixtures/empty-bun-lock/frontend/bun.lock +0 -0
  182. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/policy/grants-registry.yaml +112 -0
  183. package/packages/repo-controls/scripts/hooks/pre-push +76 -8
  184. package/packages/repo-controls/src/findings-ratchet.ts +9 -1
  185. package/packages/repo-controls/src/hook.ts +73 -21
  186. package/packages/repo-controls/workflows/scripts/release/verify-npm-artifact.ts +119 -0
@@ -0,0 +1,123 @@
1
+ /**
2
+ * Shared `LEAN_CTX_*` environment for every subprocess this package spawns
3
+ * into the global `lean-ctx` binary (installed fleet-wide on `PATH` by
4
+ * global-tools — see `../hooks/briefing/index.ts`'s header for why the
5
+ * binary itself is never repo-local here).
6
+ *
7
+ * `lean-ctx` reads four env vars to root its own config/data/state/cache
8
+ * per-invocation (confirmed directly against the real v3.9.20 binary via
9
+ * `strings` and `lean-ctx doctor --json`, this session, 2026-09-14 — they do
10
+ * not appear in `lean-ctx --help`'s documented list, which only advertises
11
+ * the unrelated `LEAN_CTX_DISABLED`/`LEAN_CTX_RAW`/... shell-hook toggles):
12
+ *
13
+ * - `LEAN_CTX_CONFIG_DIR` — directly the app's own config dir (i.e. already
14
+ * including the trailing `lean-ctx` segment, mirroring
15
+ * `XDG_CONFIG_HOME/lean-ctx`'s resolved value, not `XDG_CONFIG_HOME`
16
+ * itself) — `lean-ctx doctor --json` reports `config.toml exists` at
17
+ * exactly `<this>/config.toml`.
18
+ * - `LEAN_CTX_DATA_DIR`, `LEAN_CTX_STATE_DIR`, `LEAN_CTX_CACHE_DIR` — same
19
+ * shape, for lean-ctx's data/state/cache.
20
+ *
21
+ * Verified end-to-end this session: pointing these four vars at
22
+ * `enact-m5`'s real `.agents/lean-ctx/{config/lean-ctx,data,state,cache}`
23
+ * (which carries a real `config.toml`) makes `lean-ctx doctor --json` report
24
+ * "Shell allowlist 249 command(s) enforced"; the same binary with these vars
25
+ * pointed at an empty scratch directory (no config.toml at all) reports 223 —
26
+ * proof the binary actually reads these vars to resolve its per-repo config,
27
+ * not just a coincidence of directory layout.
28
+ *
29
+ * HARDCUT (work item A.3): this replaces the plain `XDG_CONFIG_HOME`/
30
+ * `XDG_DATA_HOME`/`XDG_STATE_HOME`/`XDG_CACHE_HOME` vars `../hooks/briefing/index.ts`
31
+ * used to set for the same purpose — those are a generic Unix convention
32
+ * lean-ctx does not actually key its own dir resolution on (its shell-hook
33
+ * script derives ITS OWN unrelated `_LEAN_CTX_STATE_DIR` from
34
+ * `XDG_STATE_HOME`, but the compiled binary invoked here never consults it).
35
+ * Every call site that used to build its own `XDG_*` env now imports this
36
+ * one helper instead, so config/data/state/cache resolution for lean-ctx
37
+ * lives in exactly one place.
38
+ */
39
+
40
+ import { existsSync, readFileSync } from 'node:fs'
41
+ import { join } from 'node:path'
42
+
43
+ import { decodeConfig } from '../gating/config.ts'
44
+ import { MARKER } from '../gating/root.ts'
45
+
46
+ /**
47
+ * Repo-relative root every lean-ctx call's config/data/state/cache lives
48
+ * under, when `adl-config.toml`'s `[hooks] lean_ctx_dir` does not say
49
+ * otherwise.
50
+ */
51
+ export const DEFAULT_LEAN_CTX_DIR = '.agents/lean-ctx'
52
+
53
+ /**
54
+ * Resolve `[hooks] lean_ctx_dir` for `root`.
55
+ *
56
+ * Mirrors `../hooks/user-prompt-submit/handler.ts`'s `resolveSkillsDir`: an
57
+ * explicit key wins; a missing `adl-config.toml` falls back to the default
58
+ * (handlers are callable directly from tests, without the gating `main.ts`
59
+ * normally performs); a file that exists but fails to decode throws, so a
60
+ * typo'd key is a loud error rather than a silent revert to the default.
61
+ */
62
+ export function resolveLeanCtxDir(root: string): string {
63
+ const configPath = join(root, MARKER)
64
+ if (!existsSync(configPath)) return DEFAULT_LEAN_CTX_DIR
65
+
66
+ const decoded = decodeConfig(readFileSync(configPath, 'utf8'))
67
+ if (!decoded.ok) {
68
+ throw new Error(`invalid ${configPath} at ${decoded.issue.pointer}: ${decoded.issue.message}`)
69
+ }
70
+
71
+ return decoded.value.hooks.leanCtxDir ?? DEFAULT_LEAN_CTX_DIR
72
+ }
73
+
74
+ /**
75
+ * Set on EVERY `lean-ctx` child this package spawns, managed repo or not.
76
+ *
77
+ * lean-ctx 3.10.5's MCP `initialize` handler runs a startup maintenance
78
+ * block that calls `refresh_installed_hooks()`, re-writing raw
79
+ * `lean-ctx hook …` entries into the GLOBAL `~/.claude/settings.json`
80
+ * (upstream `rust/src/server/server_handler.rs` ~L180-209, issue #1879).
81
+ * `[setup] auto_inject_*` does not gate it; the only switch in that release
82
+ * is `LEAN_CTX_HEADLESS` (any value), checked first in that block. Measured
83
+ * 2026-09-30 on a real $HOME: unset → nine global hook entries re-appeared
84
+ * seconds after start; set → none, and the same 12 MCP tools are served.
85
+ * Those global hooks are what put lean-ctx's global shell allowlist in front
86
+ * of agents in unrelated, unmanaged folders — lean-ctx stays repo-local only.
87
+ */
88
+ export const LEAN_CTX_HEADLESS_ENV: Readonly<Record<'LEAN_CTX_HEADLESS', string>> = { LEAN_CTX_HEADLESS: '1' }
89
+
90
+ /**
91
+ * Build the env for a `lean-ctx` subprocess rooted at repository `root`,
92
+ * merged over `base` (normally `inv.env`/`process.env`) so every other
93
+ * ambient var — `PATH` included — still reaches the child.
94
+ */
95
+ export function leanCtxEnv(
96
+ root: string,
97
+ base: Readonly<Record<string, string | undefined>>,
98
+ leanCtxDir: string = DEFAULT_LEAN_CTX_DIR,
99
+ ): Record<string, string | undefined> {
100
+ return {
101
+ ...base,
102
+ LEAN_CTX_CONFIG_DIR: join(root, leanCtxDir, 'config/lean-ctx'),
103
+ LEAN_CTX_DATA_DIR: join(root, leanCtxDir, 'data'),
104
+ LEAN_CTX_STATE_DIR: join(root, leanCtxDir, 'state'),
105
+ LEAN_CTX_CACHE_DIR: join(root, leanCtxDir, 'cache'),
106
+ ...LEAN_CTX_HEADLESS_ENV,
107
+ }
108
+ }
109
+
110
+ /**
111
+ * `leanCtxEnv` with the dir root read from `root`'s own `adl-config.toml`.
112
+ *
113
+ * Every production call site uses THIS rather than the pure form above, so
114
+ * the process that DECIDES and the process that ENFORCES derive their scope
115
+ * from one configured value — the single source of truth this module exists
116
+ * for, and the invariant G1 turned on.
117
+ */
118
+ export function leanCtxEnvFor(
119
+ root: string,
120
+ base: Readonly<Record<string, string | undefined>>,
121
+ ): Record<string, string | undefined> {
122
+ return leanCtxEnv(root, base, resolveLeanCtxDir(root))
123
+ }
@@ -0,0 +1,142 @@
1
+ /**
2
+ * `adl hook lean-ctx mcp` (work item A.1): a true stdio-passthrough spawn
3
+ * of the global `lean-ctx mcp` server.
4
+ *
5
+ * This is fundamentally NOT a `HookHandler`: every other kind reads one JSON
6
+ * payload off stdin, decides something, and writes one JSON/text result —
7
+ * `main.ts`'s `run()` buffers stdin into a string and buffers a handler's
8
+ * whole stdout/stderr into a `HookResult` for exactly that shape. `lean-ctx
9
+ * mcp` is a long-running MCP server that speaks JSON-RPC continuously over
10
+ * stdin/stdout for the lifetime of the process; buffering either stream
11
+ * would break the protocol (and blocking on "read all of stdin first" would
12
+ * simply hang forever, since an MCP client never closes stdin). So `main.ts`
13
+ * dispatches `lean-ctx mcp` here directly, before it ever reads stdin as a
14
+ * JSON payload or checks `--host` — see `main.ts`'s own dispatch for exactly
15
+ * where this branches off.
16
+ *
17
+ * Two responsibilities:
18
+ *
19
+ * 1. `resolveLeanCtxMcpEnv` — walk from `cwd` to the git root and check for
20
+ * `adl-config.toml` (`../gating/root.ts`'s `MARKER`), exactly
21
+ * like every other kind's gating BUT with a different outcome on
22
+ * failure: an unmanaged repo (no git root, or a git root with no
23
+ * marker) still starts the MCP server — just with `lean-ctx`'s own
24
+ * built-in defaults (no `LEAN_CTX_*` vars set at all) instead of this
25
+ * repo's `.agents/lean-ctx/...` — plus a one-line stderr note. Every
26
+ * other kind's gating treats "unmanaged" as "exit 0, do nothing"; that
27
+ * is wrong here because an editor's MCP client expects the server it
28
+ * just spawned to actually start, not silently exit.
29
+ * 2. `runLeanCtxMcp` — the real spawn: `stdin`/`stdout`/`stderr` all set to
30
+ * `'inherit'` (Bun.spawn's true fd-passthrough, not a piped-and-copied
31
+ * stream — no buffering, no JS-side copy loop that could stall or
32
+ * reorder JSON-RPC frames), `SIGINT`/`SIGTERM` forwarded from this
33
+ * process to the child so the MCP client's own shutdown signal reaches
34
+ * `lean-ctx` instead of being swallowed by `adl hook`, and the child's
35
+ * own exit code propagated back out as `main.ts`'s process exit code.
36
+ */
37
+
38
+ import { join } from 'node:path'
39
+ import { findGitRoot, MARKER, realRootIO, type RootIO } from '../gating/root.ts'
40
+ import { LEAN_CTX_HEADLESS_ENV, leanCtxEnvFor } from './env.ts'
41
+
42
+ export interface LeanCtxMcpEnvResult {
43
+ readonly env: Readonly<Record<string, string | undefined>>
44
+ /** Non-null only for an unmanaged repo — see this module's header. */
45
+ readonly note: string | null
46
+ }
47
+
48
+ /**
49
+ * Resolve the env `lean-ctx mcp` should run with, from `cwd` alone (there is
50
+ * no JSON payload for this subcommand — see this module's header). Injected
51
+ * `io` defaults to the real filesystem; tests supply a fake one, matching
52
+ * `../gating/root.ts`'s own `RootIO` pattern.
53
+ */
54
+ export function resolveLeanCtxMcpEnv(
55
+ cwd: string,
56
+ baseEnv: Readonly<Record<string, string | undefined>>,
57
+ io: RootIO = realRootIO,
58
+ ): LeanCtxMcpEnvResult {
59
+ const { root } = findGitRoot(io, cwd)
60
+ const managed = root !== null && io.isFile(join(root, MARKER))
61
+
62
+ if (!managed || root === null) {
63
+ return {
64
+ env: { ...baseEnv },
65
+ note: `adl hook: lean-ctx mcp: no managed repo found from ${cwd} (missing ${MARKER}); starting lean-ctx with its own defaults\n`,
66
+ }
67
+ }
68
+
69
+ return { env: leanCtxEnvFor(root, baseEnv), note: null }
70
+ }
71
+
72
+ /** The minimal shape of `Bun.spawn`'s return value this module needs — narrowed so a test can inject a fake. */
73
+ export interface SpawnedProcess {
74
+ readonly exited: Promise<number>
75
+ kill(signal?: number | NodeJS.Signals): void
76
+ }
77
+
78
+ export type SpawnMcp = (
79
+ cmd: readonly string[],
80
+ opts: { readonly cwd: string; readonly env: Record<string, string | undefined> },
81
+ ) => SpawnedProcess
82
+
83
+ const defaultSpawn: SpawnMcp = (cmd, opts) =>
84
+ Bun.spawn(cmd as string[], {
85
+ cwd: opts.cwd,
86
+ env: opts.env as Record<string, string>,
87
+ stdin: 'inherit',
88
+ stdout: 'inherit',
89
+ stderr: 'inherit',
90
+ }) as unknown as SpawnedProcess
91
+
92
+ /**
93
+ * Spawn `lean-ctx mcp` with fully inherited stdio, forward `SIGINT`/`SIGTERM`
94
+ * to it, and resolve with its exit code (never throws for a normal child
95
+ * exit — `main.ts` passes this straight to `process.exit`).
96
+ */
97
+ export async function runLeanCtxMcp(
98
+ cwd: string,
99
+ baseEnv: Readonly<Record<string, string | undefined>>,
100
+ deps: {
101
+ readonly spawn?: SpawnMcp
102
+ readonly writeStderr?: (text: string) => void
103
+ readonly signalTarget?: NodeJS.Process
104
+ readonly io?: RootIO
105
+ } = {},
106
+ ): Promise<number> {
107
+ const spawn = deps.spawn ?? defaultSpawn
108
+ const writeStderr = deps.writeStderr ?? ((text: string) => process.stderr.write(text))
109
+ const signalTarget = deps.signalTarget ?? process
110
+
111
+ const { env, note } = resolveLeanCtxMcpEnv(cwd, baseEnv, deps.io ?? realRootIO)
112
+ if (note) writeStderr(note)
113
+
114
+ // Headless in an unmanaged folder too: see LEAN_CTX_HEADLESS_ENV — without
115
+ // it this very start re-writes lean-ctx's hooks into the global settings.
116
+ const child = spawn(['lean-ctx', 'mcp'], { cwd, env: { ...env, ...LEAN_CTX_HEADLESS_ENV } })
117
+
118
+ const onSigint = () => {
119
+ try {
120
+ child.kill('SIGINT')
121
+ } catch {
122
+ // already dead
123
+ }
124
+ }
125
+ const onSigterm = () => {
126
+ try {
127
+ child.kill('SIGTERM')
128
+ } catch {
129
+ // already dead
130
+ }
131
+ }
132
+ signalTarget.on('SIGINT', onSigint)
133
+ signalTarget.on('SIGTERM', onSigterm)
134
+
135
+ try {
136
+ const code = await child.exited
137
+ return code
138
+ } finally {
139
+ signalTarget.off('SIGINT', onSigint)
140
+ signalTarget.off('SIGTERM', onSigterm)
141
+ }
142
+ }
@@ -0,0 +1,51 @@
1
+ /**
2
+ * `adl.build-run-denied` — docs/operations/agent-permissions.md row 12 (build run):
3
+ * denied for EVERY identity, unconditionally — "pipelines run on their own
4
+ * triggers". Unlike the other role rules in this package, this one does not
5
+ * branch on `ADL_AGENT_ID_AGENT` at all: the matrix's own hook-action column
6
+ * shows ❌ for both `agent-tarun`/`agent-vivek` and `agent-reviewer`, so there
7
+ * is no identity this tool is allowed for. With no identity at all,
8
+ * `adl.run-required-for-writes` (registered ahead of this rule) reports
9
+ * first with its own, more specific "no session" message; this rule is what
10
+ * fires once an identity IS present, which is the case that rule leaves
11
+ * alone.
12
+ */
13
+
14
+ import type { Invocation } from '../shell/invocation.ts'
15
+ import type { Finding, MessageContext, RuleSpec } from '../spec.ts'
16
+ import { noParams } from '../spec.ts'
17
+ import { detailString } from './messages.ts'
18
+ import { mcpToolName } from './mcp-tool.ts'
19
+ import { toolCallFor } from './adl-mcp-cli.ts'
20
+
21
+ const RULE_ID = 'adl.build-run-denied'
22
+
23
+ export const adlBuildRunDenied: RuleSpec = {
24
+ id: RULE_ID,
25
+ category: 'tool-call',
26
+ severity: 'deny',
27
+ enabledByDefault: true,
28
+ summary: 'Deny build_run for every identity (docs/operations/agent-permissions.md row 12) — the MCP tool AND its adl mcp cli equivalent.',
29
+ params: noParams,
30
+ match(inv: Invocation): Finding | null {
31
+ // Also catch `adl mcp cli build-run` — same tool, same deny.
32
+ const call = toolCallFor(inv)
33
+ if (call === null) return null
34
+ if (mcpToolName(call.tool) !== 'build_run') return null
35
+ return { ruleId: RULE_ID, severity: 'deny', detail: { tool: call.tool } }
36
+ },
37
+ message(finding: Finding, ctx: MessageContext) {
38
+ const tool = detailString(finding, 'tool')
39
+ const user = 'pipelines run on their own triggers'
40
+ return {
41
+ user,
42
+ agent:
43
+ `DENIED ${tool}: ${user}. No agent identity may queue a build — use build_list_or_get to inspect an ` +
44
+ `already-running or already-queued build instead. Blocked: ${ctx.snippet}`,
45
+ }
46
+ },
47
+ corpus: {
48
+ deny: [],
49
+ allow: ['ls -la', 'git status'],
50
+ },
51
+ }
@@ -60,6 +60,7 @@ import { BRANCH_PREFIXES } from '../../../../azdo/src/lib/commit-types.ts'
60
60
  import type { Finding, MessageContext, RuleContext, RuleSpec } from '../spec.ts'
61
61
  import { noParams } from '../spec.ts'
62
62
  import { AGENT_REVIEWER, resolveFromEnvOrFile } from './adl-identity.ts'
63
+ import { resolveGitTarget } from './git-target.ts'
63
64
  import { effectiveIdentityForCommand, scanGitInvocationPieces } from '../shell/git-identity.ts'
64
65
  import { classifyGitPushDestination, hasFlagOrCluster, isHelpOnlyInvocation } from './git-helpers.ts'
65
66
  import { defaultGitMessage, detailString } from './messages.ts'
@@ -178,6 +179,29 @@ function pushTargetsOnlyFeatureBranches(rest: readonly Token[]): boolean {
178
179
  return branches.every((branch) => isFeatureBranchName(branch) && !PROTECTED_BRANCHES.has(branch))
179
180
  }
180
181
 
182
+ /**
183
+ * Does this push target a feature branch, either named explicitly in argv or
184
+ * as a bare `HEAD` refspec resolved through the live repo? HEAD is not
185
+ * statically a branch name, so pushDestinationBranches yields the literal
186
+ * `HEAD` and argv alone cannot grade the push: resolve it against the same
187
+ * hook root plus any cd/`-C`/`--git-dir` the shared target resolver credits
188
+ * from this command line, and grade the checked-out branch by the same
189
+ * prefix/protected lists as an explicit name. `false` whenever the target
190
+ * repo or its branch cannot be resolved — the caller stays fail closed.
191
+ */
192
+ function pushTargetsFeatureBranch(rest: readonly Token[], inv: Invocation & { kind: 'git' }, ctx: RuleContext<Record<string, never>>): boolean {
193
+ if (pushTargetsOnlyFeatureBranches(rest)) return true
194
+ const branches = pushDestinationBranches(rest)
195
+ // Only a push whose EVERY destination is the bare HEAD refspec may fall
196
+ // back to the live repo: a mixed refspec (`HEAD main`) still names a
197
+ // protected branch in argv and stays fail closed.
198
+ if (branches.length === 0 || !branches.every((branch) => branch === 'HEAD')) return false
199
+ const target = resolveGitTarget(inv, ctx.command)
200
+ if (target === null) return false
201
+ const branch = ctx.index.currentBranch(target)
202
+ return branch !== null && isFeatureBranchName(branch) && !PROTECTED_BRANCHES.has(branch)
203
+ }
204
+
181
205
  type PushViolation = 'force' | 'bypass-policy' | 'protected-branch' | 'reviewer-cannot-push'
182
206
 
183
207
  export const adlGitPushBranchPolicy: RuleSpec = {
@@ -211,7 +235,7 @@ export const adlGitPushBranchPolicy: RuleSpec = {
211
235
  violation = 'force'
212
236
  } else if (pushBypassesPolicy(inv.rest)) {
213
237
  violation = 'bypass-policy'
214
- } else if (pushTargetsOnlyFeatureBranches(inv.rest)) {
238
+ } else if (pushTargetsFeatureBranch(inv.rest, inv, ctx)) {
215
239
  if (agent === AGENT_REVIEWER) violation = 'reviewer-cannot-push'
216
240
  else return null
217
241
  } else {