@amsterdamdatalabs/adl-agent-control-linux-x64 0.1.46 → 0.1.48

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 (174) hide show
  1. package/bin/adl +1 -1
  2. package/bin/reconcile +7 -2
  3. package/package.json +1 -1
  4. package/packages/agent-hooks/src/rules/impl/git-branch.ts +1 -1
  5. package/packages/agent-skills/assets/write-feature/SKILL.md +13 -15
  6. package/bin/lean-ctx-observe-strip +0 -434
  7. package/bin/lib/lean-ctx-observe-hooks.sh +0 -634
  8. package/bin/update-azure-agent-pool +0 -29
  9. package/packages/agent-hooks/src/hooks/lean-ctx/handler.ts +0 -22
  10. package/packages/agent-hooks/src/hooks/lean-ctx/index.ts +0 -173
  11. package/packages/agent-hooks/src/hooks/lean-ctx/mapping.ts +0 -121
  12. package/packages/agent-hooks/src/hooks/lean-ctx/scope-rewrite.ts +0 -207
  13. package/packages/agent-hooks/src/lean-ctx/env.ts +0 -123
  14. package/packages/agent-hooks/src/lean-ctx/mcp.ts +0 -142
  15. package/packages/agent-hooks/src/rules/impl/adl-build-run-denied.ts +0 -51
  16. package/packages/agent-hooks/src/rules/impl/adl-session-required.ts +0 -403
  17. package/packages/agent-hooks/src/rules/impl/tool-lean-ctx-global.ts +0 -594
  18. package/packages/agent-settings/assets/GLOBAL-AGENTS.md +0 -112
  19. package/packages/agent-settings/assets/lean-ctx/config.toml +0 -42
  20. package/packages/agent-settings/assets/lean-ctx/gitignore +0 -10
  21. package/packages/agent-settings/assets/lean-ctx/layout.toml +0 -7
  22. package/packages/agent-settings/src/deploy/lean-ctx-deploy.ts +0 -230
  23. package/packages/agent-settings/src/deploy/lean-ctx-merge.ts +0 -580
  24. package/packages/agent-skills/assets/adl-mechanics/SKILL.md +0 -38
  25. package/packages/agent-skills/assets/codebase-design/SKILL.md +0 -98
  26. package/packages/agent-skills/assets/codebase-design/references/DEEPENING.md +0 -37
  27. package/packages/agent-skills/assets/codebase-design/references/DESIGN-IT-TWICE.md +0 -44
  28. package/packages/agent-skills/assets/codebase-design/references/TESTABILITY.md +0 -29
  29. package/packages/agent-skills/assets/debug-issue/SKILL.md +0 -41
  30. package/packages/agent-skills/assets/domain-modeling/SKILL.md +0 -86
  31. package/packages/agent-skills/assets/domain-modeling/references/ADR-FORMAT.md +0 -47
  32. package/packages/agent-skills/assets/domain-modeling/references/CONTEXT-FORMAT.md +0 -60
  33. package/packages/agent-skills/assets/implement/SKILL.md +0 -28
  34. package/packages/agent-skills/assets/review-changes/SKILL.md +0 -45
  35. package/packages/agent-skills/assets/tdd/SKILL.md +0 -49
  36. package/packages/agent-skills/assets/tdd/references/mocking.md +0 -59
  37. package/packages/agent-skills/assets/tdd/references/tests.md +0 -77
  38. package/packages/agent-skills/assets/testing/SKILL.md +0 -54
  39. package/packages/agent-skills/assets/testing/references/e2e.md +0 -37
  40. package/packages/agent-skills/assets/testing/references/integration.md +0 -37
  41. package/packages/agent-skills/assets/testing/references/unit.md +0 -32
  42. package/packages/agent-skills/assets/to-feature/SKILL.md +0 -91
  43. package/packages/agent-skills/assets/to-feature/references/FEATURE-SPEC-TEMPLATE.md +0 -88
  44. package/packages/agent-skills/assets/to-workitems/SKILL.md +0 -90
  45. package/packages/agent-skills/assets/to-workitems/references/AZURE-DEVOPS-HIERARCHY.md +0 -121
  46. package/packages/agent-skills/assets/to-workitems/references/TICKET-TEMPLATES.md +0 -70
  47. package/packages/azdo/src/workflow-rules-matrix.csv +0 -85
  48. package/packages/fleet/src/launch-agents.ts +0 -649
  49. package/packages/repo-controls/assets/GLOBAL-INVARIANTS.md +0 -21
  50. package/packages/repo-controls/assets/enable-integration-auto-complete.mjs +0 -79
  51. package/packages/repo-controls/assets/scaffold/docs/notes.md +0 -20
  52. package/packages/repo-controls/assets/scaffold/plans/GAPS-AND-FINDINGS.md +0 -12
  53. package/packages/repo-controls/azure-pipelines.yml +0 -274
  54. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/closed_set/fixtures/docs/notes.md +0 -1
  55. 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 +0 -1
  56. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-ledger-clean/docs/notes.md +0 -17
  57. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-ledger-no-lines/docs/notes.md +0 -13
  58. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/semantics/fixtures/semantics-violations/docs/architecture/product/stable-delivery.md +0 -10
  59. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/semantics/fixtures/semantics-violations/docs/architecture/product/stable-recommendation.md +0 -12
  60. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/semantics/fixtures/semantics-violations/docs/architecture/product/target-narration.md +0 -10
  61. 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 +0 -1
  62. 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 +0 -1
  63. 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 +0 -1
  64. 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 +0 -1
  65. 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 +0 -1
  66. 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 +0 -1
  67. 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 +0 -1
  68. 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 +0 -1
  69. 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 +0 -1
  70. 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 +0 -1
  71. 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 +0 -1
  72. 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 +0 -1
  73. 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 +0 -1
  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/sub8/only.ts +0 -1
  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/sub9/only.ts +0 -1
  76. 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 +0 -1
  77. 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 +0 -1
  78. 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 +0 -2
  79. 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 +0 -1
  80. 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 +0 -1
  81. 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 +0 -1
  82. 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 +0 -1
  83. 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 +0 -1
  84. 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 +0 -1
  85. 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 +0 -1
  86. 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 +0 -1
  87. 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 +0 -1
  88. 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 +0 -1
  89. 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 +0 -1
  90. 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 +0 -1
  91. 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 +0 -1
  92. 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 +0 -1
  93. 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 +0 -1
  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/sub8/only.ts +0 -1
  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/sub9/only.ts +0 -1
  96. 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 +0 -1
  97. 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 +0 -1
  98. 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 +0 -5
  99. 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 +0 -10
  100. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/placement/fixtures/placement-allowed/agent/crates/enact-providers/src/snapshots/README.md +0 -1
  101. 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 +0 -1
  102. 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 +0 -1
  103. 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 +0 -1
  104. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/placement/fixtures/placement-allowed/frontend/mobile/assets/images/icon.png +0 -1
  105. 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 +0 -1
  106. 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 +0 -1
  107. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/placement/fixtures/placement-allowed/frontend/public/pwa/icon-192.png +0 -1
  108. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/placement/fixtures/placement-allowed/frontend/resources/product.png +0 -1
  109. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/placement/fixtures/placement-stray/backend/crates/enact-session/src/backend/README.md +0 -1
  110. 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 +0 -12
  111. 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 +0 -12
  112. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/profile_data/__init__.py +0 -11
  113. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/profile_data/check.py +0 -62
  114. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/profile_data/fixtures/migration-filenames/backend/crates/demo/NotAMigration.sql +0 -1
  115. 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 +0 -1
  116. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/profile_data/fixtures/migration-filenames/backend/crates/demo/migrations/001_init.sql +0 -1
  117. 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 +0 -1
  118. 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 +0 -1
  119. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/profile_data/fixtures/migration-filenames/backend/crates/demo/migrations/004_MixedCase.sql +0 -1
  120. 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 +0 -1
  121. 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 +0 -1
  122. 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 +0 -1
  123. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/profile_data/test_check.py +0 -116
  124. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/references/fixtures/link-targets-broken/docs/architecture/product/links.md +0 -20
  125. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/references/fixtures/link-targets-broken/docs/architecture/product/route-target.md +0 -8
  126. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/references/fixtures/link-targets-clean/docs/architecture/product/links.md +0 -20
  127. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/references/fixtures/link-targets-clean/docs/architecture/product/route-target.md +0 -8
  128. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/root_closed_set/fixtures/.changeset/declared.txt +0 -1
  129. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/root_markdown_allowlist/fixtures/root-markdown-clean/INDEPENDENT-VERIFICATION.md +0 -3
  130. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/attribute-without-conversion/.gitattributes +0 -1
  131. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/attribute-without-conversion/large file.bin +0 -3
  132. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/clean/.gitattributes +0 -1
  133. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/clean/large file.bin +0 -3
  134. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/clean/small.txt +0 -1
  135. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/missing-filter/large file.bin +0 -0
  136. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/unmatched-extension/.gitattributes +0 -1
  137. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/unmatched-extension/payload.dat +0 -0
  138. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/pipeline/__init__.py +0 -1
  139. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/pipeline/phase_disjoint/__init__.py +0 -12
  140. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/pipeline/phase_disjoint/check.py +0 -129
  141. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/pipeline/phase_disjoint/fixtures/disjoint/gate-registry.yaml +0 -13
  142. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/pipeline/phase_disjoint/fixtures/empty/gate-registry.yaml +0 -7
  143. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/pipeline/phase_disjoint/fixtures/overlapping/gate-registry.yaml +0 -13
  144. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/pipeline/phase_disjoint/test_check.py +0 -109
  145. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/__init__.py +0 -1
  146. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/changeset_plan/__init__.py +0 -11
  147. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/changeset_plan/check.py +0 -149
  148. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/changeset_plan/fixtures/clean/docs/readme.md +0 -4
  149. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/changeset_plan/fixtures/relevant/VERSION +0 -1
  150. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/changeset_plan/test_check.py +0 -151
  151. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/version_release/__init__.py +0 -11
  152. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/version_release/check.py +0 -202
  153. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/version_release/fixtures/aligned/.workflows/changesets/package.json +0 -5
  154. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/version_release/fixtures/aligned/.workflows/package.json +0 -5
  155. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/version_release/fixtures/aligned/CHANGELOG.md +0 -5
  156. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/version_release/fixtures/aligned/VERSION +0 -1
  157. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/version_release/fixtures/mismatched/.workflows/changesets/package.json +0 -5
  158. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/version_release/fixtures/mismatched/.workflows/package.json +0 -5
  159. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/version_release/fixtures/mismatched/CHANGELOG.md +0 -5
  160. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/version_release/fixtures/mismatched/VERSION +0 -1
  161. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/version_release/test_check.py +0 -162
  162. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/banned_commands/check.py +0 -103
  163. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/lockfile_integrity/fixtures/clean/backend/Cargo.lock +0 -7
  164. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/lockfile_integrity/fixtures/clean/backend/Cargo.toml +0 -4
  165. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/lockfile_integrity/fixtures/clean/backend/rust-toolchain.toml +0 -3
  166. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/lockfile_integrity/fixtures/clean/backend/src/main.rs +0 -1
  167. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/lockfile_integrity/fixtures/clean/frontend/bun.lock +0 -1
  168. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/lockfile_integrity/fixtures/empty-bun-lock/backend/Cargo.lock +0 -7
  169. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/lockfile_integrity/fixtures/empty-bun-lock/backend/Cargo.toml +0 -4
  170. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/lockfile_integrity/fixtures/empty-bun-lock/backend/rust-toolchain.toml +0 -3
  171. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/lockfile_integrity/fixtures/empty-bun-lock/backend/src/main.rs +0 -1
  172. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/lockfile_integrity/fixtures/empty-bun-lock/frontend/bun.lock +0 -0
  173. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/policy/grants-registry.yaml +0 -112
  174. package/packages/repo-controls/workflows/scripts/release/verify-npm-artifact.ts +0 -119
@@ -1,112 +0,0 @@
1
- # Global agent rules — Tarun
2
-
3
- Applies to every agent surface on every machine. Repo-specific rules live in that
4
- repo's own `AGENTS.md`.
5
-
6
- ## Communication
7
- - Address me as **Tarun**.
8
- - Short, scannable **bullet points** — not long prose. Lead with the answer; keep reasoning tight.
9
- - **Every reply has three parts, in this order:**
10
- - a **TL;DR** of a few lines; information stays brief, and detail is given only when asked;
11
- - an explicit **Recommendation**: what you would do and why, in one line;
12
- - **one ask**: the single question or decision you need next.
13
- - **Keep a numbered list of open points** and show it when it changes. I answer them one at a time, so never bundle several questions into one reply.
14
- - If a task is ambiguous, ask exactly one clarifying question.
15
-
16
- ## Truthfulness (non-negotiable)
17
- - **No fake-green tests.** A test changes only when the intended behaviour changes, never to make unintended behaviour pass. Red is honest.
18
- - **No silent fallback or degrade** — if the real path fails, fail loud and stop.
19
- - **No silent drops** — no `|| true`, no swallowed errors, no skipped gates.
20
- - **No fakes** — no stubs, placeholders or TODOs passed off as done.
21
- - Unverified claims never enter durable artifacts.
22
-
23
- ## Verification before claiming done
24
- - Evidence over assertions: run the command, show real output.
25
- - **Make the check falsifiable.** "Did you grep the source?" has an answer; "did you verify?" does not.
26
- - **Negative claims need source-level proof.** A tool listing or search result shows what was returned, not what exists. Grep the implementation, or write "I didn't find X via `<method>`".
27
- - **Ask the authoritative source, not the one in front of you.** A tool listing describes a session's registry; a worktree describes one branch. Neither describes the repository. Before reporting what a repo contains, ask `origin` — `git show origin/main:<path>` — and before reporting a shipped tool's behaviour, ask the installed binary, not its checkout.
28
- - **Name the ref, because "authoritative" is not one place.** Where a change is in flight, `origin/main` and `origin/integration` answer differently and BOTH are right about themselves. Two agents once disagreed for hours over a field name — `last_modified` on main, `last_update` on integration, same file, same line. Neither had misread. State which ref you asked, and when a rule depends on unlanded work, say so rather than reporting one ref as the truth.
29
- - **Deployed is not running.** `/usr/local/bin` holding the new binary does not mean the process serving you loaded it — a long-lived MCP server or daemon keeps the code it started with. A symbol scan of the FILE cannot see this; it passes while the old code still answers. When a fix is installed and the behaviour has not changed, restart the process before debugging the fix.
30
- - **Search the package, then narrow.** A grep scoped to `src/` cannot find what lives in `scripts/`, and returns the same confident silence either way. Run the wide search first, and pair every negative claim with a positive control in the same run — a term you KNOW is present. Zero hits for both means the scope was wrong, not that the thing is absent.
31
- - **Re-run before reporting.** Cite the run you are reporting, not one you remember.
32
- - Never claim "checked everything" without checking every case. State only measured facts.
33
- - A requirement you are about to not satisfy is a **stop**, not a design decision.
34
-
35
- ## Scope discipline
36
- - Work in your own cwd. Touch only the repos and paths explicitly in scope.
37
- - Out-of-scope work becomes a **new work item** — never silent scope creep.
38
- - **At most 3 checkouts per repository, including the main folder.** `git worktree add` is denied for agents with the exact `adl worktree add` command to run instead, which refuses at the same cap and explains why; `EnterWorktree` and subagent `isolation: "worktree"` are allowed below the cap and denied at it. Reconcile old worktrees first (merge, then `git worktree remove <path>`) — `git worktree list`/`remove`/`prune`/`repair` stay allowed for that. Prefer working in the one checkout; parallel subagents share it, each with its own write scope. Only the orchestrator commits.
39
-
40
- ## Plans and work items
41
- - **A plan is a Feature. A backlog item is a PBI or a Bug.** One file each, and the board is the only place their state lives.
42
- - Layout: `plans/features/az<feature id>-<slug>/spec.md`, with one item per row under that folder's `items/az<id>-<slug>.md`.
43
- - **The id is the identity** — allocate the work item on the board first, then name the file `az<id>-<slug>`. **No file exists before its id does**, and there is no placeholder: an item that is not yet allocated lives as a row in the plan's `## Items` table, not as a file waiting to be renamed. A rename is a second chance to disagree with the board.
44
- - **Nothing moves between directories.** A plan lives at one path for its whole life; a folder name that also claims to record progress is a second place to update and the one that goes stale.
45
- - **One link direction**: an item names its `feature:`. The Feature never lists its items except as the `## Items` table in its own `spec.md`.
46
- - `epic:` and `feature:` are **authored, never tool-created** — a typo must fail loudly instead of spawning a duplicate.
47
- - The spec text **is** the work item's fields. If the two differ, the board is lying.
48
- - A gap found along the way goes in `plans/GAPS-AND-FINDINGS.md`, becomes an item with `item_type: bug`, and parents under the **same Feature** that surfaced it.
49
- - Tracked types stop at Product Backlog Item: `Feature`, `Product Backlog Item`, `Bug`. A Bug is treated exactly as a PBI. `Epic` is a valid parent but is never created by tooling; `Task` is not used.
50
- - **The hierarchy is Epic > Feature > PBI/Bug, and the server enforces every level.** A PBI or Bug parents to a Feature; a Feature parents to an Epic. `workitem_create_or_update` refuses a wrong-typed parent by name — `Feature must be parented to a Epic; work item 368 is a Product Backlog Item` — on create and on update alike. `epic:` in a spec is a cross-check on the Feature's own parent, never a link target.
51
- - **An Epic is a valid parent but cannot be read back**, because `Epic` is not a tracked type. The refusal names the type it found, which is how you confirm one: `work item 376 is a Epic, which this server does not track`. That refusal is not proof of an Epic on its own — a `Task` and an id you cannot see produce the same words.
52
- - **A work item has exactly one parent**, so ordering is never expressed by parenting. Blocking edges are `Dependency-Reverse` links, authored from an item's `## Predecessors`. Supplying `parentId` on an update MOVES the item; the old link is removed, not kept alongside.
53
- - Which Epic a Feature belongs under is a **human decision**. The server checks the parent's TYPE, never that it is the right Epic.
54
-
55
- ## Agent identity
56
- - Every Azure DevOps access (git, PRs, work items, builds, reads included) runs as an agent identity — never as you,
57
- the human. Default is the machine's default agent, set silently by fleet reconcile; it is always overridable.
58
- - **Override:** prefix a command with `ADL_AGENT_ID_AGENT=<agent-tarun|agent-vivek|agent-reviewer>`. An MCP tool
59
- call can't carry an inline prefix, so it uses the session env or the machine default agent; the fallback CLI
60
- (`adl mcp cli <command>`) takes the inline prefix like any command.
61
- - Never read vault files. Never pass a token.
62
- - **Never set `ADL_HUMAN_AZDO`.** It is Tarun's own human-terminal marker for `bin/git-ado`'s and `adl id whoami`'s
63
- fail-closed human pass-through (stdin TTY AND `ADL_HUMAN_AZDO=1`, exactly) — an agent carrying it would let a child
64
- process forge that pass-through.
65
-
66
- ## Commits and the PR lifecycle
67
- - **Use ordinary `git` for every Git operation.** The managed `/usr/local/bin/git` front controller delegates local and non-Azure DevOps work to the system Git executable, and routes HTTPS Azure DevOps network commands through `adl-agent-id exec --agent "$ADL_AGENT_ID_AGENT"` automatically. `git-ado` handles the credential boundary internally. Linux keeps its single administrator/root credential model; the controller does not introduce a second account or secret location.
68
- - **Start a sub-agent session on a surface (intra-surface sub-agents) with `adl run <surface> --headless "<prompt>"` ONLY when the operator explicitly asks for it** — an agent must never start one autonomously. Azure DevOps operations (PRs, work items, builds) go through the `adl` MCP server (`adl mcp serve`) with tools like `pr_list_or_get`, `pr_create_or_update`, `pr_review`, `build_list_or_get`, `build_run`, `workitem_list_or_get`, `workitem_create_or_update`. If the MCP server is not working, fall back to the CLI: `adl mcp cli <command>`. Never read vault files; never pass a token.
69
- - **Repository controls run via `adl repo controls`.** Git hooks in controlled repositories run pre-commit (local checks) and pre-push (Azure DevOps governance). Each repository is reconciled on its own with its `.agents/`, `.claude/`, `.codex/`, `.cursor/`, `.kimi-code/`, `.opencode/` projections.
70
- - **The release flow (`integration` auto-complete; the `branch → PR → integration → main` promotion; the integration PR merging itself once green) applies to repositories whose root contains an `adl-config.toml`.** Other repositories follow the release flow declared in their own `AGENTS.md`. The human approval gate, where it exists, is the promotion from `integration` to `main`; everything before that is auto-complete once CI is green.
71
- - Keep each commit **independently green** and on one cohesive topic. Never use `git stash`. When "one topic" and "independently green" conflict, green wins — and say so.
72
- - Subjects are `<type>(<scope>): <lowercase subject>`. Types: `feat|fix|docs|refactor|perf|chore`. Branch prefixes are exactly these types (`<type>/<kebab>`), not configurable per repository. No `!` marker. `release:` is reserved for the promotion PR the pipeline raises — never write one by hand. **In repositories whose root contains an `adl-config.toml`, the pipeline opens `integration → main` once CI is green on `integration` — no agent opens it; the subject follows the commit grammar above.**
73
- - A PR body needs non-empty `## Summary`, `## Why` and `## Changes`. The title follows the commit grammar above.
74
-
75
- ## Tests
76
- - For features, bugfixes and non-trivial refactors: **tests first**, confirmed failing for the right reason; then minimal code to pass; then a separate review pass.
77
- - Every change ships a **new** test.
78
- - When a change deliberately alters behaviour, rework the existing tests that assert the old behaviour, in the same change. Name each reworked test and the decision that changed it.
79
- - **Never fake green.** Don't loosen, skip or delete an assertion, or set an expectation to whatever the code returns, to hide a failure you didn't intend.
80
- - Skip for pure config, docs and trivial one-liners.
81
-
82
- ## Delegation & parallelism
83
- - Delegate hands-on execution to **executor** subagents; I orchestrate and verify.
84
- - Split independent work into **concurrent agents** launched together — never sequential when it can fan out.
85
- - Match the model tier to the task: strongest for architecture and deep analysis, fastest for quick lookups.
86
- - Author and reviewer are **distinct passes in separate contexts**. Never self-approve.
87
-
88
- ## Fixing things
89
- - Fix at the **source** — the primitive, token or shared layer — so it propagates everywhere. Not a narrow downstream patch.
90
- - **Speed over caution.** Favour fast models and parallel execution.
91
- - Consult official docs **before** coding against an unfamiliar SDK, framework or API.
92
-
93
- ## Context tooling
94
- - **Match the tool to the question. `rg` is not the answer to all of them.**
95
- - Orient in unfamiliar code → **`crg`** (the code graph): `crg architecture`, `crg communities`.
96
- - Symbols and semantic code queries → `crg search "<text>"`. `rg` finds the text; `crg` finds the edges.
97
- - Callers, callees, blast radius → `crg query callers_of|callees_of|tests_for|importers_of <target>`, `crg impact`.
98
- - Unreferenced code → `crg dead-code`.
99
- - A code *shape* rather than a string → **`ast-grep`**.
100
- - Prose in `docs/`, `plans/` → **`search <text>`** — hybrid semantic + keyword, so it surfaces the document whose filename never mentions the subject.
101
- - Literal text or regex → **`rg`**. Never `grep`; never `find | grep`, which filters file NAMES and silently misses the file whose contents match.
102
- - Files by name or tree → the host's native Glob / file-listing tools.
103
-
104
- ## Agent surface commands
105
- Only on explicit operator request: `adl run` is for running a sub-agent headless, nothing else. It is not an identity
106
- route and not a fallback for anything.
107
- - **Headless:** `adl run claude --headless "<prompt>"`, `adl run codex --headless "<prompt>"`, `adl run opencode --headless "<prompt>"`, `adl run kimi --headless "<prompt>"`, `adl run cursor --headless "<prompt>"`
108
- - **Identity override:** add `--as <agent>` to any surface command above
109
- - **Model:** add `--model <model>` to any headless command above, e.g. `adl run codex --model <model> --headless "<prompt>"` — adl passes each surface's own flag (claude/cursor `--model`, codex/opencode/kimi `-m`); a surface without a model flag refuses it (exit 2). `--model` cannot be combined with `adl run -- <cmd>` (usage error).
110
- - **Tasks ledger:** when you start and when you finish a task, append one line to `docs/notes.md` in the repository you work in (create the file if it is missing, with YAML frontmatter and a `## Lines` section) — format `YYYY-MM-DD HH:MM <surface> <note>`, the whole line ≤100 characters. Append-only, newest at the bottom, never rewrite earlier lines. One ledger per repository, for every agent.
111
- ## Temporary files
112
- - All scratch and throwaway work goes in **`.scratchpad/`** at the repo root — never `/tmp` or `/private/tmp`. Create it if missing. Real deliverables go to their proper home.
@@ -1,42 +0,0 @@
1
- # >>> adl managed (do not edit within this block) >>>
2
- minimal_overhead = true
3
- structure_first = true
4
- journal_enabled = true
5
- auto_capture = true
6
- update_check_disabled = true
7
- # <<< adl managed <<<
8
- shell_allowlist_extra = [
9
- "pi",
10
- "install",
11
- "script",
12
- "expect",
13
- "bash",
14
- "claude",
15
- "codex",
16
- "just",
17
- "crg",
18
- "search",
19
- "atlas",
20
- "rustfmt",
21
- "cursor-agent",
22
- "kimi",
23
- "opencode",
24
- "pi-acp",
25
- "adl",
26
- "adl-repo-controls",
27
- "orca",
28
- "agent",
29
- "az",
30
- "trash",
31
- "launchctl",
32
- "ssh",
33
- "base64",
34
- "wasmtime",
35
- "orca-ide",
36
- "time",
37
- "ast-grep",
38
- "bun",
39
- "npm",
40
- "apply_patch",
41
- "enact-docs-search"
42
- ]
@@ -1,10 +0,0 @@
1
- # >>> adl managed (do not edit within this block) >>>
2
- /lean-ctx/data/
3
- /lean-ctx/cache/
4
- /lean-ctx/state/
5
- /lean-ctx/bin/
6
- /hooks/hooks.log
7
- /hooks/hooks-activity.log
8
- /lean-ctx/config/lean-ctx/workspace-trust.toml
9
- *.bak
10
- # <<< adl managed <<<
@@ -1,7 +0,0 @@
1
- # >>> adl managed (do not edit within this block) >>>
2
- # lean-ctx layout pin (GL #623) — managed by lean-ctx, do not edit.
3
- # Marks this install as committed to the XDG four-dir layout so a stray
4
- # ~/.lean-ctx never re-collapses config/data/state/cache. Remove via
5
- # `lean-ctx doctor` only if you intentionally revert to a single-dir layout.
6
- mode = "xdg"
7
- # <<< adl managed <<<
@@ -1,230 +0,0 @@
1
- /**
2
- * Writes the repo-local lean-ctx config files (config.toml, layout.toml)
3
- * and .agents/.gitignore from assets/lean-ctx/, per profile.leanCtx. A
4
- * fresh write (nothing at the target yet) is still a verbatim byte copy —
5
- * no per-surface rendering — reproducing the asset exactly (the asset
6
- * itself is a complete BEGIN/END-marked managed block; see
7
- * lean-ctx-merge.ts).
8
- *
9
- * Merge contract (Tarun, 2026-09-29, merge contract; mechanism corrected
10
- * by an independent review the same day — supersedes the original "L3,
11
- * Tarun 2026-09-28" whole-file-verbatim rule, and this comment's own
12
- * earlier per-key/array-entry description, both below): adl owns a single
13
- * marked managed block per file and it SELF-HEALS as a whole the moment
14
- * its content drifts from the asset. Everything OUTSIDE the markers is the
15
- * user's, preserved byte-for-byte, never parsed or rewritten — see
16
- * `lean-ctx-merge.ts`'s own header for exactly why (a full-file TOML parse
17
- * both rejected valid user TOML and silently discarded a user's entire
18
- * file on any parse failure; pure marker-text splicing cannot do either).
19
- * `doctorLeanCtx` (doctor.ts) shares the same `resolveLeanCtxWrite`
20
- * analysis, so "is this drift" is answered in exactly one place.
21
- *
22
- * A markerless file the lock already records as adl-written is a one-time
23
- * MIGRATION target (wrapped in markers if its known prior content is still
24
- * found verbatim; a CONFLICT, left untouched, otherwise) — never silently
25
- * discarded. Malformed markers, and a key declared both inside the managed
26
- * block and outside it, are conflicts too.
27
- *
28
- * Same ownership rule as mcp/agents (lock.ts): a pre-existing file at a
29
- * target path the lock does not record is a conflict, left untouched and
30
- * reported; a target dropped from profile.leanCtx.files is removed only if
31
- * the lock shows this deploy wrote it.
32
- *
33
- * Fails loud: a missing assets dir/target repo, a profile with no leanCtx
34
- * section, or a missing source asset file all throw. There is no
35
- * partial-success return value. A resolveLeanCtxWrite CONFLICT is reported
36
- * in the ordinary `conflicts` array (like any other), not a throw — the
37
- * caller (apps/cli's `adl install`) is the one that turns a non-empty
38
- * conflicts list into a loud, non-zero-exit failure.
39
- */
40
- import { existsSync, mkdirSync, readFileSync, statSync, unlinkSync, writeFileSync } from "node:fs";
41
- import { dirname, join } from "node:path";
42
- import { legacyFileTakeover, legacyTakeoverForGitignore, type LegacyLockDoc, readLegacyLock, stripLegacyOwnership } from "./legacy-lock.js";
43
- import { resolveConfigTomlWrite, resolveGitignoreWrite, resolveLeanCtxWrite } from "./lean-ctx-merge.js";
44
- import { leanCtxOwned, readLock, writeLock } from "./lock.js";
45
- import { type DeployProfile, loadProfile } from "./profile.js";
46
-
47
- export interface DeployLeanCtxOptions {
48
- readonly assetsDir: string; // packages/agent-settings/assets/lean-ctx
49
- readonly targetRepo: string;
50
- readonly profile?: DeployProfile;
51
- /** Computes the exact same written/unchanged/removed/conflicts result without writing anything (target files, lock, or legacy lock) — independent review, 2026-09-29, finding 6. */
52
- readonly dryRun?: boolean;
53
- }
54
-
55
- export interface LeanCtxConflict {
56
- readonly target: string;
57
- readonly reason: string;
58
- }
59
-
60
- /** One adl-owned scalar restored to adl's own value this run (2026-09-30, Tarun's merge-contract correction: "adl-owned entries SELF-HEAL" — named explicitly, the same way a healed hook is named, never silent). */
61
- export interface RestoredLeanCtxScalar {
62
- readonly target: string;
63
- readonly key: string;
64
- readonly value: unknown;
65
- readonly previous: unknown;
66
- }
67
-
68
- export interface DeployLeanCtxResult {
69
- readonly written: readonly string[];
70
- readonly unchanged: readonly string[];
71
- readonly removed: readonly string[];
72
- readonly conflicts: readonly LeanCtxConflict[];
73
- readonly lockPath: string;
74
- readonly restored: readonly RestoredLeanCtxScalar[];
75
- }
76
-
77
- export function deployLeanCtx(options: DeployLeanCtxOptions): DeployLeanCtxResult {
78
- const { assetsDir, targetRepo } = options;
79
- const dryRun = options.dryRun === true;
80
-
81
- if (!existsSync(assetsDir) || !statSync(assetsDir).isDirectory()) {
82
- throw new Error(`agent-settings lean-ctx assets directory not found: ${assetsDir}`);
83
- }
84
- if (!existsSync(targetRepo) || !statSync(targetRepo).isDirectory()) {
85
- throw new Error(`deploy target is not a directory: ${targetRepo}`);
86
- }
87
-
88
- const profile = options.profile ?? loadProfile();
89
- if (profile.leanCtx === undefined) {
90
- throw new Error("deploy profile has no leanCtx section");
91
- }
92
-
93
- const lock = readLock(targetRepo);
94
- const legacyLockPath = profile.legacyLock !== undefined ? join(targetRepo, profile.legacyLock) : undefined;
95
- const legacyDoc: LegacyLockDoc | undefined = legacyLockPath !== undefined ? readLegacyLock(legacyLockPath) : undefined;
96
- const written: string[] = [];
97
- const unchanged: string[] = [];
98
- const removed: string[] = [];
99
- const conflicts: LeanCtxConflict[] = [];
100
- const restored: RestoredLeanCtxScalar[] = [];
101
- const newLeanCtxEntries: Record<string, boolean> = {};
102
- const kept: string[] = [];
103
- const legacyFileRemovals: string[] = [];
104
- const legacyGitignoreRemovals: string[] = [];
105
- let anyLegacyTakeover = false;
106
-
107
- for (const file of profile.leanCtx.files) {
108
- const assetAbs = join(assetsDir, file.asset);
109
- if (!existsSync(assetAbs)) {
110
- throw new Error(`agent-settings lean-ctx asset not found: ${assetAbs}`);
111
- }
112
- const content = readFileSync(assetAbs, "utf8");
113
- const targetAbs = join(targetRepo, file.target);
114
- const exists = existsSync(targetAbs);
115
- let managedByUs = leanCtxOwned(lock, file.target);
116
- // Set only when THIS run's legacy hash check (below) is what makes
117
- // managedByUs true — that check already verified the file's exact
118
- // bytes against the OLD engine's own lock, so unlike leanCtxOwned
119
- // (our own lock's unverified "we wrote this at some point" record),
120
- // there is no risk of undetected foreign/user content mixed in, and
121
- // the file can be overwritten wholesale — the same as a fresh write,
122
- // never through resolveLeanCtxWrite's cautious migration path (which
123
- // exists precisely for the case this check has already ruled out).
124
- let legacyVerifiedClean = false;
125
-
126
- if (exists && !managedByUs) {
127
- const currentContent = readFileSync(targetAbs, "utf8");
128
- // Whole-file record (config.toml/layout.toml) first; the legacy engine
129
- // recorded .agents/.gitignore differently (created/lines/appended, no
130
- // sha256), so fall back to that comparison for whichever target it is.
131
- if (legacyFileTakeover(currentContent, legacyDoc, file.target)) {
132
- managedByUs = true;
133
- legacyVerifiedClean = true;
134
- legacyFileRemovals.push(file.target);
135
- anyLegacyTakeover = true;
136
- } else if (legacyTakeoverForGitignore(currentContent, legacyDoc, file.target)) {
137
- managedByUs = true;
138
- legacyVerifiedClean = true;
139
- legacyGitignoreRemovals.push(file.target);
140
- anyLegacyTakeover = true;
141
- }
142
- }
143
-
144
- // Independent review, 2026-09-30, finding 6: this guard used to apply
145
- // uniformly, so a user-authored .agents/.gitignore with no markers at
146
- // all (never written by us — managedByUs false) hit a hard conflict
147
- // right here, before resolveGitignoreWrite ever got a chance to run
148
- // its own append-not-conflict migration. .gitignore is deliberately
149
- // exempted: append is always safe there (a stray, harmless duplicate
150
- // ignore line at worst), unlike config.toml/layout.toml where
151
- // guessing at a foreign file's structure is not.
152
- if (exists && !managedByUs && file.asset !== "gitignore") {
153
- conflicts.push({ target: file.target, reason: "a user-owned file already exists at this path; deploy left it untouched" });
154
- continue;
155
- }
156
-
157
- if (!exists || legacyVerifiedClean) {
158
- if (!dryRun) {
159
- mkdirSync(dirname(targetAbs), { recursive: true });
160
- writeFileSync(targetAbs, content);
161
- }
162
- written.push(file.target);
163
- newLeanCtxEntries[file.target] = true;
164
- kept.push(file.target);
165
- continue;
166
- }
167
-
168
- const currentContent = readFileSync(targetAbs, "utf8");
169
- if (currentContent === content) {
170
- unchanged.push(file.target);
171
- newLeanCtxEntries[file.target] = true;
172
- kept.push(file.target);
173
- continue;
174
- }
175
-
176
- const outcome =
177
- file.asset === "config.toml"
178
- ? resolveConfigTomlWrite(content, currentContent, managedByUs)
179
- : file.asset === "gitignore"
180
- ? resolveGitignoreWrite(content, currentContent, managedByUs)
181
- : resolveLeanCtxWrite(content, currentContent, managedByUs);
182
- if (outcome.action === "conflict") {
183
- // Still tracked as ours going forward (a fixed-up file can migrate
184
- // or self-heal on a later run) but never written to now.
185
- conflicts.push({ target: file.target, reason: outcome.reason });
186
- newLeanCtxEntries[file.target] = true;
187
- kept.push(file.target);
188
- continue;
189
- }
190
- if (outcome.action === "unchanged") {
191
- unchanged.push(file.target);
192
- } else {
193
- if (!dryRun) writeFileSync(targetAbs, outcome.text);
194
- written.push(file.target);
195
- for (const scalar of outcome.restoredScalars ?? []) {
196
- restored.push({ target: file.target, key: scalar.key, value: scalar.value, previous: scalar.previous });
197
- }
198
- }
199
- newLeanCtxEntries[file.target] = true;
200
- kept.push(file.target);
201
- }
202
-
203
- for (const target of Object.keys(lock.leanCtx)) {
204
- if (kept.includes(target)) continue;
205
- const targetAbs = join(targetRepo, target);
206
- if (!dryRun && existsSync(targetAbs)) unlinkSync(targetAbs);
207
- removed.push(target);
208
- }
209
-
210
- if (!dryRun) writeLock(targetRepo, { schema: 1, mcp: lock.mcp, agents: lock.agents, leanCtx: newLeanCtxEntries });
211
-
212
- // Once anything was actually taken over, this package's own footprint in
213
- // the legacy lock (these exact `files` entries and/or the `.agents/.gitignore`
214
- // `gitignore` entry) is stale: ownership has fully moved to
215
- // .agents/agent-settings.lock.json just written above. A legacy lock
216
- // present but untouched by any takeover (no hash matched, or this repo
217
- // never had one) is left exactly as found.
218
- if (!dryRun && anyLegacyTakeover && legacyDoc !== undefined && legacyLockPath !== undefined) {
219
- stripLegacyOwnership(legacyDoc, legacyLockPath, { files: legacyFileRemovals, gitignore: legacyGitignoreRemovals });
220
- }
221
-
222
- return {
223
- written: written.sort(),
224
- unchanged: unchanged.sort(),
225
- removed: removed.sort(),
226
- conflicts: conflicts.sort((a, b) => a.target.localeCompare(b.target)),
227
- lockPath: join(targetRepo, ".agents/agent-settings.lock.json"),
228
- restored,
229
- };
230
- }