@amsterdamdatalabs/adl-agent-control-linux-x64 0.1.37 → 0.1.47

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 (249) hide show
  1. package/bin/adl +2 -2
  2. package/bin/reconcile +10 -13
  3. package/bin/setup +15 -15
  4. package/package.json +1 -1
  5. package/packages/agent-hooks/package.json +1 -1
  6. package/packages/agent-hooks/src/main.ts +23 -2
  7. package/packages/agent-hooks/src/rules/impl/adl-mcp-cli.ts +12 -8
  8. package/packages/agent-hooks/src/rules/impl/adl-run-required.ts +11 -5
  9. package/packages/agent-hooks/src/rules/impl/adl-workitem-role.ts +18 -5
  10. package/packages/agent-hooks/src/rules/impl/agent-tamper-protection.ts +30 -26
  11. package/packages/agent-hooks/src/rules/impl/git-branch.ts +1 -1
  12. package/packages/agent-hooks/src/rules/impl/git-target.ts +5 -0
  13. package/packages/agent-hooks/src/rules/impl/mcp-tool.ts +3 -1
  14. package/packages/agent-hooks/src/rules/impl/tool-frontend.ts +230 -11
  15. package/packages/agent-hooks/src/rules/shell/git-identity.ts +1 -1
  16. package/packages/agent-hooks/src/rules/shell/invocation.ts +14 -2
  17. package/packages/agent-hooks/src/rules/shell/protected-carriers.ts +10 -11
  18. package/packages/agent-settings/assets/TARUN-GLOBAL-AGENTS-INSTRUCTIONS.md +2 -2
  19. package/packages/agent-settings/package.json +1 -1
  20. package/packages/agent-settings/src/deploy/agents-deploy.ts +19 -1
  21. package/packages/agent-settings/src/deploy/index.ts +1 -0
  22. package/packages/agent-skills/assets/agent-search-tool-audit/SKILL.md +4 -6
  23. package/packages/agent-skills/assets/finalize-feature/SKILL.md +3 -3
  24. package/packages/agent-skills/assets/implement-feature/SKILL.md +17 -20
  25. package/packages/agent-skills/assets/implement-feature/references/briefs.md +3 -3
  26. package/packages/agent-skills/assets/implement-item/SKILL.md +3 -3
  27. package/packages/agent-skills/assets/mechanics/SKILL.md +1 -1
  28. package/packages/agent-skills/assets/plan-feature/SKILL.md +10 -10
  29. package/packages/agent-skills/assets/prepare-promotion/SKILL.md +3 -4
  30. package/packages/agent-skills/assets/report-bug/SKILL.md +2 -2
  31. package/packages/agent-skills/assets/review-change/SKILL.md +3 -3
  32. package/packages/agent-skills/assets/review-plan/SKILL.md +4 -4
  33. package/packages/agent-skills/assets/triage-workitems/SKILL.md +4 -4
  34. package/packages/agent-skills/assets/validate-design/SKILL.md +6 -12
  35. package/packages/agent-skills/assets/verify-item/SKILL.md +5 -5
  36. package/packages/agent-skills/assets/wayfinder/SKILL.md +1 -1
  37. package/packages/agent-skills/assets/workitems-process/SKILL.md +19 -21
  38. package/packages/agent-skills/assets/workitems-process/references/ado-and-git.md +36 -3
  39. package/packages/agent-skills/assets/workitems-process/references/evidence.md +4 -4
  40. package/packages/agent-skills/assets/write-feature/SKILL.md +15 -18
  41. package/packages/agent-skills/dist/deploy.d.ts +45 -0
  42. package/packages/agent-skills/dist/deploy.d.ts.map +1 -1
  43. package/packages/agent-skills/dist/deploy.js +167 -3
  44. package/packages/agent-skills/dist/deploy.js.map +1 -1
  45. package/packages/agent-skills/dist/index.d.ts +1 -1
  46. package/packages/agent-skills/dist/index.d.ts.map +1 -1
  47. package/packages/agent-skills/dist/index.js +1 -1
  48. package/packages/agent-skills/dist/index.js.map +1 -1
  49. package/packages/agent-skills/package.json +1 -1
  50. package/packages/agent-skills/src/deploy.ts +241 -3
  51. package/packages/agent-skills/src/index.ts +10 -1
  52. package/packages/azdo/README.md +13 -4
  53. package/packages/azdo/bunfig.toml +6 -0
  54. package/packages/azdo/package.json +1 -1
  55. package/packages/azdo/src/azdo-attachments.ts +2 -1
  56. package/packages/azdo/src/azdo-pr.ts +182 -6
  57. package/packages/azdo/src/azdo-wit.ts +290 -41
  58. package/packages/azdo/src/cli.ts +79 -12
  59. package/packages/azdo/src/lib/client.ts +88 -16
  60. package/packages/azdo/src/mcp-server.ts +75 -10
  61. package/packages/azdo/src/tool-dispatch.ts +61 -26
  62. package/packages/fleet/src/install-adl-package.ts +4 -3
  63. package/packages/repo-controls/assets/promote.ts +1 -0
  64. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-profile-untyped/docs/research/no-type.md +1 -1
  65. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-profile-untyped/docs/research/typed-experiment.md +1 -1
  66. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-profile-untyped/docs/research/typed-research.md +1 -1
  67. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-research/docs/research/extra-key.md +1 -1
  68. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-research/docs/research/extra-keys.md +1 -1
  69. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-research/docs/research/missing-created.md +1 -1
  70. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-research/docs/research/missing-description.md +1 -1
  71. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-research/docs/research/missing-last-update.md +1 -1
  72. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-research/docs/research/missing-status.md +1 -1
  73. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-research/docs/research/missing-title.md +1 -1
  74. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-research/docs/research/optional-keys.md +1 -1
  75. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-research/docs/research/research-ok.md +1 -1
  76. package/packages/repo-controls/package.json +1 -1
  77. package/packages/repo-controls/src/config.ts +21 -2
  78. package/packages/repo-controls/src/doctor.ts +9 -14
  79. package/packages/repo-controls/src/findings-ratchet.ts +12 -0
  80. package/packages/repo-controls/src/hook.ts +61 -4
  81. package/bin/lean-ctx-observe-strip +0 -434
  82. package/bin/lib/lean-ctx-observe-hooks.sh +0 -634
  83. package/bin/update-azure-agent-pool +0 -29
  84. package/packages/agent-hooks/src/hooks/lean-ctx/handler.ts +0 -22
  85. package/packages/agent-hooks/src/hooks/lean-ctx/index.ts +0 -173
  86. package/packages/agent-hooks/src/hooks/lean-ctx/mapping.ts +0 -121
  87. package/packages/agent-hooks/src/hooks/lean-ctx/scope-rewrite.ts +0 -207
  88. package/packages/agent-hooks/src/lean-ctx/env.ts +0 -123
  89. package/packages/agent-hooks/src/lean-ctx/mcp.ts +0 -142
  90. package/packages/agent-hooks/src/rules/impl/adl-build-run-denied.ts +0 -51
  91. package/packages/agent-hooks/src/rules/impl/adl-session-required.ts +0 -403
  92. package/packages/agent-hooks/src/rules/impl/tool-lean-ctx-global.ts +0 -594
  93. package/packages/agent-settings/assets/GLOBAL-AGENTS.md +0 -112
  94. package/packages/agent-settings/assets/lean-ctx/config.toml +0 -42
  95. package/packages/agent-settings/assets/lean-ctx/gitignore +0 -10
  96. package/packages/agent-settings/assets/lean-ctx/layout.toml +0 -7
  97. package/packages/agent-settings/src/deploy/lean-ctx-deploy.ts +0 -230
  98. package/packages/agent-settings/src/deploy/lean-ctx-merge.ts +0 -580
  99. package/packages/agent-skills/assets/adl-mechanics/SKILL.md +0 -38
  100. package/packages/agent-skills/assets/codebase-design/SKILL.md +0 -98
  101. package/packages/agent-skills/assets/codebase-design/references/DEEPENING.md +0 -37
  102. package/packages/agent-skills/assets/codebase-design/references/DESIGN-IT-TWICE.md +0 -44
  103. package/packages/agent-skills/assets/codebase-design/references/TESTABILITY.md +0 -29
  104. package/packages/agent-skills/assets/debug-issue/SKILL.md +0 -41
  105. package/packages/agent-skills/assets/domain-modeling/SKILL.md +0 -86
  106. package/packages/agent-skills/assets/domain-modeling/references/ADR-FORMAT.md +0 -47
  107. package/packages/agent-skills/assets/domain-modeling/references/CONTEXT-FORMAT.md +0 -60
  108. package/packages/agent-skills/assets/implement/SKILL.md +0 -28
  109. package/packages/agent-skills/assets/review-changes/SKILL.md +0 -45
  110. package/packages/agent-skills/assets/tdd/SKILL.md +0 -49
  111. package/packages/agent-skills/assets/tdd/references/mocking.md +0 -59
  112. package/packages/agent-skills/assets/tdd/references/tests.md +0 -77
  113. package/packages/agent-skills/assets/testing/SKILL.md +0 -54
  114. package/packages/agent-skills/assets/testing/references/e2e.md +0 -37
  115. package/packages/agent-skills/assets/testing/references/integration.md +0 -37
  116. package/packages/agent-skills/assets/testing/references/unit.md +0 -32
  117. package/packages/agent-skills/assets/to-feature/SKILL.md +0 -91
  118. package/packages/agent-skills/assets/to-feature/references/FEATURE-SPEC-TEMPLATE.md +0 -88
  119. package/packages/agent-skills/assets/to-workitems/SKILL.md +0 -90
  120. package/packages/agent-skills/assets/to-workitems/references/AZURE-DEVOPS-HIERARCHY.md +0 -121
  121. package/packages/agent-skills/assets/to-workitems/references/TICKET-TEMPLATES.md +0 -70
  122. package/packages/azdo/src/workflow-rules-matrix.csv +0 -85
  123. package/packages/fleet/src/launch-agents.ts +0 -649
  124. package/packages/repo-controls/assets/GLOBAL-INVARIANTS.md +0 -21
  125. package/packages/repo-controls/assets/enable-integration-auto-complete.mjs +0 -79
  126. package/packages/repo-controls/assets/scaffold/docs/notes.md +0 -20
  127. package/packages/repo-controls/assets/scaffold/plans/GAPS-AND-FINDINGS.md +0 -12
  128. package/packages/repo-controls/azure-pipelines.yml +0 -274
  129. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/closed_set/fixtures/docs/notes.md +0 -1
  130. 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
  131. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-ledger-clean/docs/notes.md +0 -17
  132. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-ledger-no-lines/docs/notes.md +0 -13
  133. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/semantics/fixtures/semantics-violations/docs/architecture/product/stable-delivery.md +0 -10
  134. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/semantics/fixtures/semantics-violations/docs/architecture/product/stable-recommendation.md +0 -12
  135. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/semantics/fixtures/semantics-violations/docs/architecture/product/target-narration.md +0 -10
  136. 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
  137. 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
  138. 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
  139. 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
  140. 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
  141. 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
  142. 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
  143. 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
  144. 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
  145. 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
  146. 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
  147. 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
  148. 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
  149. 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
  150. 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
  151. 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
  152. 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
  153. 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
  154. 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
  155. 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
  156. 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
  157. 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
  158. 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
  159. 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
  160. 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
  161. 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
  162. 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
  163. 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
  164. 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
  165. 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
  166. 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
  167. 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
  168. 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
  169. 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
  170. 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
  171. 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
  172. 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
  173. 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
  174. 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
  175. 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
  176. 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
  177. 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
  178. 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
  179. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/placement/fixtures/placement-allowed/frontend/mobile/assets/images/icon.png +0 -1
  180. 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
  181. 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
  182. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/placement/fixtures/placement-allowed/frontend/public/pwa/icon-192.png +0 -1
  183. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/placement/fixtures/placement-allowed/frontend/resources/product.png +0 -1
  184. 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
  185. 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
  186. 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
  187. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/profile_data/__init__.py +0 -11
  188. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/profile_data/check.py +0 -62
  189. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/profile_data/fixtures/migration-filenames/backend/crates/demo/NotAMigration.sql +0 -1
  190. 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
  191. 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
  192. 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
  193. 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
  194. 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
  195. 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
  196. 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
  197. 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
  198. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/profile_data/test_check.py +0 -116
  199. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/references/fixtures/link-targets-broken/docs/architecture/product/links.md +0 -20
  200. 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
  201. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/references/fixtures/link-targets-clean/docs/architecture/product/links.md +0 -20
  202. 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
  203. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/root_closed_set/fixtures/.changeset/declared.txt +0 -1
  204. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/root_markdown_allowlist/fixtures/root-markdown-clean/INDEPENDENT-VERIFICATION.md +0 -3
  205. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/attribute-without-conversion/.gitattributes +0 -1
  206. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/attribute-without-conversion/large file.bin +0 -3
  207. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/clean/.gitattributes +0 -1
  208. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/clean/large file.bin +0 -3
  209. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/clean/small.txt +0 -1
  210. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/missing-filter/large file.bin +0 -0
  211. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/unmatched-extension/.gitattributes +0 -1
  212. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/unmatched-extension/payload.dat +0 -0
  213. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/pipeline/__init__.py +0 -1
  214. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/pipeline/phase_disjoint/__init__.py +0 -12
  215. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/pipeline/phase_disjoint/check.py +0 -129
  216. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/pipeline/phase_disjoint/fixtures/disjoint/gate-registry.yaml +0 -13
  217. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/pipeline/phase_disjoint/fixtures/empty/gate-registry.yaml +0 -7
  218. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/pipeline/phase_disjoint/fixtures/overlapping/gate-registry.yaml +0 -13
  219. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/pipeline/phase_disjoint/test_check.py +0 -109
  220. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/__init__.py +0 -1
  221. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/changeset_plan/__init__.py +0 -11
  222. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/changeset_plan/check.py +0 -149
  223. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/changeset_plan/fixtures/clean/docs/readme.md +0 -4
  224. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/changeset_plan/fixtures/relevant/VERSION +0 -1
  225. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/changeset_plan/test_check.py +0 -151
  226. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/version_release/__init__.py +0 -11
  227. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/version_release/check.py +0 -202
  228. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/version_release/fixtures/aligned/.workflows/changesets/package.json +0 -5
  229. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/version_release/fixtures/aligned/.workflows/package.json +0 -5
  230. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/version_release/fixtures/aligned/CHANGELOG.md +0 -5
  231. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/version_release/fixtures/aligned/VERSION +0 -1
  232. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/version_release/fixtures/mismatched/.workflows/changesets/package.json +0 -5
  233. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/version_release/fixtures/mismatched/.workflows/package.json +0 -5
  234. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/version_release/fixtures/mismatched/CHANGELOG.md +0 -5
  235. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/version_release/fixtures/mismatched/VERSION +0 -1
  236. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/version_release/test_check.py +0 -162
  237. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/banned_commands/check.py +0 -103
  238. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/lockfile_integrity/fixtures/clean/backend/Cargo.lock +0 -7
  239. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/lockfile_integrity/fixtures/clean/backend/Cargo.toml +0 -4
  240. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/lockfile_integrity/fixtures/clean/backend/rust-toolchain.toml +0 -3
  241. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/lockfile_integrity/fixtures/clean/backend/src/main.rs +0 -1
  242. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/lockfile_integrity/fixtures/clean/frontend/bun.lock +0 -1
  243. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/lockfile_integrity/fixtures/empty-bun-lock/backend/Cargo.lock +0 -7
  244. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/lockfile_integrity/fixtures/empty-bun-lock/backend/Cargo.toml +0 -4
  245. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/lockfile_integrity/fixtures/empty-bun-lock/backend/rust-toolchain.toml +0 -3
  246. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/lockfile_integrity/fixtures/empty-bun-lock/backend/src/main.rs +0 -1
  247. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/lockfile_integrity/fixtures/empty-bun-lock/frontend/bun.lock +0 -0
  248. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/policy/grants-registry.yaml +0 -112
  249. package/packages/repo-controls/workflows/scripts/release/verify-npm-artifact.ts +0 -119
@@ -1,434 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
-
4
- export PATH="/usr/local/bin:/opt/homebrew/bin:/home/linuxbrew/.linuxbrew/bin:/usr/bin:/bin:/usr/sbin:/sbin"
5
-
6
- # lean-ctx-observe-strip -- the per-device half of STATUS.md 12p item 13.
7
- # Final scope (2026-09-29, Tarun, relayed through the orchestrator; see
8
- # bin/lib/lean-ctx-observe-hooks.sh's header for the full decision trail):
9
- # lean-ctx hooks are "moved to repo level" and must be REMOVED FROM GLOBAL --
10
- # the per-repo carrier (`adl hook lean-ctx pre-tool-use|post-tool-use`,
11
- # written by `adl hooks deploy`) already provides rewrite/redirect/
12
- # read-dedup with the repo's own config, and `observe` has no per-repo
13
- # carrier at all and is dropped outright. Six carriers, all written by
14
- # `lean-ctx setup`, are covered ("fix all the lean-ctx issues" -- Tarun,
15
- # 2026-09-29 -- widened this from an initial two-of-five scope):
16
- # 1. Raw, unwrapped `lean-ctx hook <subcommand>` entries -- observe,
17
- # rewrite, redirect, read-dedup, any other -- in the two JSON
18
- # hook-map files that can carry one: $HOME/.claude/settings.json and
19
- # $HOME/.codex/hooks.json.
20
- # 2. The universal shell hook marker block (`# >>> lean-ctx shell hook
21
- # >>>` ... `# <<< lean-ctx shell hook <<<`).
22
- # 3. `~/.zshrc`'s own differently-shaped shell hook block (an em dash,
23
- # not `>>>`/`<<<`): `# lean-ctx shell hook — begin` ... `... — end`,
24
- # sourcing a separate `~/.config/lean-ctx/shell-hook.zsh`.
25
- # 4. The agent-launcher aliases block: `# >>> lean-ctx agent aliases
26
- # >>>` ... `# <<< lean-ctx agent aliases <<<`.
27
- # Shapes 2-4 are all matched in the per-user shell rc/env files they can
28
- # appear in: $HOME/.bashenv, .zshenv, .bashrc, .zshrc, .bash_profile,
29
- # .zprofile, .profile -- see bin/lib/lean-ctx-observe-hooks.sh's header
30
- # for exactly which marker text each shape matches, its trailing-
31
- # whitespace tolerance, and its malformed-nesting/near-miss detection.
32
- # 5. Global lean-ctx SKILL.md directories (frontmatter `name: lean-ctx`)
33
- # at $HOME/.claude/skills/lean-ctx, .codex/skills/lean-ctx,
34
- # .cursor/skills/lean-ctx, .config/opencode/skills/lean-ctx,
35
- # .agents/skills/lean-ctx.
36
- # 6. Global lean-ctx hook SCRIPTS: every entry named `lean-ctx-*` directly
37
- # under $HOME/.claude/hooks (lean-ctx-rewrite.sh, lean-ctx-redirect.sh,
38
- # their -native counterparts, and any .bak copies). Added 2026-09-30
39
- # because of lean-ctx's own startup refresh gate (proven from v3.10.5
40
- # source, rust/src/hooks/mod.rs): refresh_installed_hooks() re-writes
41
- # the global Claude hooks whenever hooks_installed_for("claude", home)
42
- # is true, i.e. <claude_dir>/hooks/lean-ctx-rewrite.sh EXISTS or
43
- # <claude_dir>/settings.json contains the substring `lean-ctx`.
44
- # Stripping settings.json (shape 1) alone leaves the scripts behind and
45
- # the gate armed, so the carrier rewrites the global hooks on its next
46
- # start. Only names starting with `lean-ctx-` are touched; every other
47
- # file there (enact-*, code-simplifier.mjs, lib/, symlinks to other
48
- # repos) is left alone. Scope is $HOME/.claude only -- CLAUDE_CONFIG_DIR
49
- # is deliberately not consulted (the tool takes --home explicitly).
50
- # `adl hook lean-ctx ...` (the per-repo carrier) and Orca's own hooks are
51
- # never touched -- see bin/lib/lean-ctx-observe-hooks.sh's own header for
52
- # exactly why the match can never catch either, and for the full "which
53
- # files can carry this, and why the others can't" accounting. `~/.config/
54
- # lean-ctx/` itself (which shape 3 sources) is deliberately left alone --
55
- # Tarun uses the global CLI directly from his own terminal -- flagged in
56
- # that same header, not stripped. Run by bin/reconcile on every
57
- # reconciliation (plan AND apply, exactly like bin/kimi-hooks /
58
- # bin/opencode-hooks) so a hand-edited or Orca-reinstalled per-user config
59
- # never lets any of the six carriers creep back in unnoticed.
60
- #
61
- # Usage: lean-ctx-observe-strip --home ABSOLUTE_PATH --mode plan|apply
62
- #
63
- # plan: READ-ONLY. Prints what apply would do; never writes, never backs
64
- # up. A second run (plan or apply) against an already-clean home is
65
- # a no-op.
66
- # apply: For each target that still carries its carrier, backs it up
67
- # first (same "<path>.pre-<label>-<UTC compact timestamp>" shape
68
- # every other backup in this codebase uses -- bin/reconcile's own
69
- # strip_backup_suffix recovers the original path from it, except
70
- # for a skill directory's backup, which sits OUTSIDE the scanned
71
- # skills/ tree and is reported via its own explicit two-path
72
- # note; see strip_skill_dir_one below and final review finding
73
- # 1), then rewrites/moves it via the shared
74
- # bin/lib/lean-ctx-observe-hooks.sh helpers. A JSON file that
75
- # fails to parse, a shell file with a malformed marker (unclosed,
76
- # nested, orphaned, or a near-miss mention of the marker phrase
77
- # that doesn't exactly match a known marker line), is a loud
78
- # failure (non-zero exit, nothing written) -- never a silent skip
79
- # or a partial edit. A target with nothing to strip, or that does
80
- # not exist, is reported and left alone. A skill directory is
81
- # moved (never deleted) only when its SKILL.md frontmatter says
82
- # `name: lean-ctx`; any other content there is left alone and
83
- # reported. The `lean-ctx-*` hook scripts under ~/.claude/hooks are
84
- # moved (never deleted) into a sibling
85
- # `hooks.pre-lean-ctx-observe-strip-<UTC ts>/` directory OUTSIDE
86
- # the scanned hooks/ directory, exactly like a skill directory's
87
- # backup, and reported one line per file. Refuses outright (before touching anything) when run
88
- # as literal root (EUID 0) against a --home it does not own --
89
- # bin/reconcile's apply path never does this itself; see
90
- # lean_ctx_observe_strip_guard_euid in the shared lib.
91
-
92
- script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
93
-
94
- command -v jq >/dev/null 2>&1 || {
95
- echo "lean-ctx-observe-strip requires jq" >&2
96
- exit 1
97
- }
98
-
99
- # shellcheck source=lib/lean-ctx-observe-hooks.sh
100
- source "$script_dir/lib/lean-ctx-observe-hooks.sh"
101
-
102
- usage() {
103
- echo "usage: lean-ctx-observe-strip --home ABSOLUTE_PATH --mode plan|apply" >&2
104
- exit 2
105
- }
106
-
107
- home=""
108
- mode=""
109
- while [[ "$#" -gt 0 ]]; do
110
- case "$1" in
111
- --home) home="${2:-}"; shift 2 ;;
112
- --mode) mode="${2:-}"; shift 2 ;;
113
- *) usage ;;
114
- esac
115
- done
116
- [[ -n "$home" ]] || usage
117
- [[ "$mode" == plan || "$mode" == apply ]] || usage
118
-
119
- # Final review finding 5: refuse before touching anything if this is a
120
- # literal-root (EUID 0) invocation against a --home it does not own -- see
121
- # lean_ctx_observe_strip_guard_euid's own header for exactly why this can
122
- # never fire on bin/reconcile's real apply path (macOS: already dropped to
123
- # the administrator; Linux: administrator IS root, home IS /root).
124
- lean_ctx_observe_strip_guard_euid "$EUID" "$home" || exit 1
125
-
126
- # backup_file_safely <path> <backup> -- creates <backup> (a brand-new path)
127
- # holding a copy of <path>'s content and mode, WITHOUT ever following a
128
- # pre-existing file or symlink that happens to already sit at <backup>
129
- # (final review finding 5: a predictable, timestamp-based backup path
130
- # could be pre-planted by an attacker with write access to the same
131
- # directory; a plain `cp -p "$path" "$backup"` FOLLOWS an existing
132
- # symlink there and overwrites whatever it points at). `set -C`
133
- # (noclobber) reserves the name atomically first -- verified live, not
134
- # assumed: refuses to open `>` through both a valid and a dangling
135
- # pre-existing symlink at that exact path, on this machine's real bash,
136
- # leaving the symlink's target completely untouched either way -- and only
137
- # once that empty placeholder is confirmed OURS does `cp -p` fill it in.
138
- backup_file_safely() {
139
- local path="$1" backup="$2"
140
- if ! ( set -C; : > "$backup" ) 2>/dev/null; then
141
- return 1
142
- fi
143
- cp -p "$path" "$backup"
144
- }
145
-
146
- # The two per-user JSON hook-map files that can carry a raw
147
- # `lean-ctx hook <subcommand>` entry -- see bin/lib/lean-ctx-observe-hooks.sh's
148
- # header for the read-only accounting of every other per-user agent config
149
- # file this machine has, and why each of those is NOT a target.
150
- targets=(
151
- "$home/.claude/settings.json"
152
- "$home/.codex/hooks.json"
153
- )
154
-
155
- # The per-user shell rc/env files `lean-ctx setup` can write any of the
156
- # three shell-hook marker shapes into (confirmed live: .zshenv and
157
- # .bashenv both carry shape 2 after a real `lean-ctx setup` run, .zshrc
158
- # carries shapes 3 and 4; the others are included because the same
159
- # installer step targets the whole rc/env family).
160
- shell_hook_targets=(
161
- "$home/.bashenv"
162
- "$home/.zshenv"
163
- "$home/.bashrc"
164
- "$home/.zshrc"
165
- "$home/.bash_profile"
166
- "$home/.zprofile"
167
- "$home/.profile"
168
- )
169
-
170
- # The global lean-ctx SKILL.md directories `lean-ctx setup` can write, one
171
- # per agent surface it detects (confirmed live for Claude/Codex/OpenCode;
172
- # Cursor and .agents included for the same reason as above -- the
173
- # installer targets the whole surface family, not just the ones detected
174
- # on any one machine).
175
- skill_dir_targets=(
176
- "$home/.claude/skills/lean-ctx"
177
- "$home/.codex/skills/lean-ctx"
178
- "$home/.cursor/skills/lean-ctx"
179
- "$home/.config/opencode/skills/lean-ctx"
180
- "$home/.agents/skills/lean-ctx"
181
- )
182
-
183
- strip_one() {
184
- local path="$1"
185
- if [[ ! -f "$path" ]]; then
186
- echo "lean-ctx-observe-strip: $path: not present -- nothing to strip"
187
- return 0
188
- fi
189
- local events
190
- if ! events="$(lean_ctx_observe_hook_events "$path")"; then
191
- echo "lean-ctx-observe-strip: $path: FAILED to parse as JSON -- not modified" >&2
192
- return 1
193
- fi
194
- if [[ -z "$events" ]]; then
195
- echo "lean-ctx-observe-strip: $path: no raw lean-ctx hook entries found"
196
- return 0
197
- fi
198
- echo "lean-ctx-observe-strip: $path: found raw lean-ctx hook entries under: $events"
199
- if [[ "$mode" != apply ]]; then
200
- echo "lean-ctx-observe-strip: would strip raw lean-ctx hook entries from $path (events: $events)"
201
- return 0
202
- fi
203
- local backup
204
- backup="${path}.pre-lean-ctx-observe-strip-$(date -u +%Y%m%dT%H%M%SZ)"
205
- if ! backup_file_safely "$path" "$backup"; then
206
- echo "lean-ctx-observe-strip: backup of $path to $backup did not complete -- $path was NOT modified" >&2
207
- return 1
208
- fi
209
- echo "lean-ctx-observe-strip: backed up previous config to $backup"
210
- local staged
211
- staged="$(mktemp "$(dirname "$path")/.$(basename "$path").filtered.XXXXXX" 2>/dev/null)" || {
212
- echo "lean-ctx-observe-strip: $path: FAILED to allocate staging file -- not modified (backup: $backup)" >&2
213
- return 1
214
- }
215
- if ! lean_ctx_observe_hook_filtered "$path" "$staged"; then
216
- echo "lean-ctx-observe-strip: $path: FAILED to compute filtered content -- not modified (backup: $backup)" >&2
217
- rm -f "$staged"
218
- return 1
219
- fi
220
- if ! lean_ctx_observe_hook_write "$path" "$staged"; then
221
- echo "lean-ctx-observe-strip: $path: FAILED to write -- not modified (backup: $backup)" >&2
222
- rm -f "$staged"
223
- return 1
224
- fi
225
- rm -f "$staged"
226
- echo "lean-ctx-observe-strip: stripped raw lean-ctx hook entries from $path (backup: $backup)"
227
- return 0
228
- }
229
-
230
- # strip_shell_hook_one <path> -- covers all THREE shell-hook marker shapes
231
- # bin/lib/lean-ctx-observe-hooks.sh's header documents, via ONE single-pass
232
- # call to lean_ctx_shell_rc_scan_and_filter: one backup, one write, never
233
- # one per shape, even for a file (a real `~/.zshrc`) carrying more than
234
- # one. Malformed input in ANY shape (unclosed, nested, orphaned, or a
235
- # near-miss marker-phrase mention) aborts before any write, with the
236
- # backup only ever created once something is confirmed found.
237
- strip_shell_hook_one() {
238
- local path="$1"
239
- if [[ ! -f "$path" ]]; then
240
- echo "lean-ctx-observe-strip: $path: not present -- nothing to strip"
241
- return 0
242
- fi
243
-
244
- local staged report
245
- staged="$(mktemp "$(dirname "$path")/.$(basename "$path").filtered.XXXXXX" 2>/dev/null)" || {
246
- echo "lean-ctx-observe-strip: $path: FAILED to allocate staging file -- not modified" >&2
247
- return 1
248
- }
249
- report="$(mktemp "$(dirname "$path")/.$(basename "$path").report.XXXXXX" 2>/dev/null)" || {
250
- echo "lean-ctx-observe-strip: $path: FAILED to allocate report file -- not modified" >&2
251
- rm -f "$staged"
252
- return 1
253
- }
254
-
255
- if ! lean_ctx_shell_rc_scan_and_filter "$path" "$staged" "$report"; then
256
- echo "lean-ctx-observe-strip: $path: FAILED -- see the malformed-marker message above -- not modified" >&2
257
- rm -f "$staged" "$report"
258
- return 1
259
- fi
260
-
261
- local found1=absent found2=absent found3=absent line
262
- while IFS= read -r line; do
263
- case "$line" in
264
- 1:*) found1="${line#1:}" ;;
265
- 2:*) found2="${line#2:}" ;;
266
- 3:*) found3="${line#3:}" ;;
267
- esac
268
- done < "$report"
269
- rm -f "$report"
270
-
271
- [[ "$found1" == present ]] && echo "lean-ctx-observe-strip: $path: found lean-ctx shell hook marker block" \
272
- || echo "lean-ctx-observe-strip: $path: no lean-ctx shell hook marker found"
273
- [[ "$found2" == present ]] && echo "lean-ctx-observe-strip: $path: found lean-ctx shell hook marker block (zshrc begin/end form)" \
274
- || echo "lean-ctx-observe-strip: $path: no lean-ctx shell hook marker (zshrc begin/end form) found"
275
- [[ "$found3" == present ]] && echo "lean-ctx-observe-strip: $path: found lean-ctx agent aliases marker block" \
276
- || echo "lean-ctx-observe-strip: $path: no lean-ctx agent aliases marker found"
277
-
278
- if [[ "$found1" != present && "$found2" != present && "$found3" != present ]]; then
279
- rm -f "$staged"
280
- return 0
281
- fi
282
-
283
- if [[ "$mode" != apply ]]; then
284
- [[ "$found1" == present ]] && echo "lean-ctx-observe-strip: would strip lean-ctx shell hook marker block from $path"
285
- [[ "$found2" == present ]] && echo "lean-ctx-observe-strip: would strip lean-ctx shell hook marker block (zshrc begin/end form) from $path"
286
- [[ "$found3" == present ]] && echo "lean-ctx-observe-strip: would strip lean-ctx agent aliases marker block from $path"
287
- rm -f "$staged"
288
- return 0
289
- fi
290
-
291
- local backup
292
- backup="${path}.pre-lean-ctx-observe-strip-$(date -u +%Y%m%dT%H%M%SZ)"
293
- if ! backup_file_safely "$path" "$backup"; then
294
- echo "lean-ctx-observe-strip: backup of $path to $backup did not complete -- $path was NOT modified" >&2
295
- rm -f "$staged"
296
- return 1
297
- fi
298
- echo "lean-ctx-observe-strip: backed up previous config to $backup"
299
-
300
- if ! lean_ctx_observe_hook_write "$path" "$staged"; then
301
- echo "lean-ctx-observe-strip: $path: FAILED to write -- not modified (backup: $backup)" >&2
302
- rm -f "$staged"
303
- return 1
304
- fi
305
- rm -f "$staged"
306
-
307
- [[ "$found1" == present ]] && echo "lean-ctx-observe-strip: stripped lean-ctx shell hook marker block from $path (backup: $backup)"
308
- [[ "$found2" == present ]] && echo "lean-ctx-observe-strip: stripped lean-ctx shell hook marker block (zshrc begin/end form) from $path (backup: $backup)"
309
- [[ "$found3" == present ]] && echo "lean-ctx-observe-strip: stripped lean-ctx agent aliases marker block from $path (backup: $backup)"
310
- return 0
311
- }
312
-
313
- # strip_skill_dir_one <dir> -- final review finding 1 (HIGH): the backup
314
- # location is a SIBLING of the scanned `skills/` directory
315
- # (`<surface>/skills.pre-lean-ctx-observe-strip-<ts>/<leaf>`), never a path
316
- # INSIDE it. The previous shape (`skills/<leaf>.pre-...-<ts>`) left the
317
- # moved directory's own SKILL.md -- frontmatter `name: lean-ctx` and all --
318
- # still sitting directly under `skills/`, where any surface that globs
319
- # `skills/*/SKILL.md` by frontmatter name would load it right back up as a
320
- # live skill; the whole point of "moved, never deleted" was to make it
321
- # INERT, not just renamed. Reported via its own explicit two-path "backed
322
- # up previous skill directory <original> to <backup>" note (distinct from
323
- # the single-path "backed up previous config to <path>" the JSON/shell-hook
324
- # carriers use) because the new backup path no longer ends in
325
- # `.pre-<label>-<timestamp>` -- bin/reconcile's suffix-stripping
326
- # strip_backup_suffix can't recover the original from it, so the original
327
- # is stated directly instead; see bin/reconcile's
328
- # collect_lean_ctx_observe_strip_backups.
329
- strip_skill_dir_one() {
330
- local dir="$1"
331
- if [[ ! -e "$dir" ]]; then
332
- echo "lean-ctx-observe-strip: $dir: not present -- nothing to strip"
333
- return 0
334
- fi
335
- local skill_md="$dir/SKILL.md"
336
- if [[ ! -f "$skill_md" ]]; then
337
- echo "lean-ctx-observe-strip: $dir: present but has no SKILL.md -- left alone"
338
- return 0
339
- fi
340
- local name
341
- name="$(lean_ctx_skill_frontmatter_name "$skill_md")"
342
- if [[ "$name" != "$LEAN_CTX_SKILL_FRONTMATTER_NAME" ]]; then
343
- echo "lean-ctx-observe-strip: $dir: SKILL.md frontmatter name is '${name:-<none>}', not lean-ctx -- left alone"
344
- return 0
345
- fi
346
- echo "lean-ctx-observe-strip: $dir: found lean-ctx skill directory (SKILL.md name: lean-ctx)"
347
- if [[ "$mode" != apply ]]; then
348
- echo "lean-ctx-observe-strip: would move $dir to a timestamped backup location outside the scanned skills/ directory"
349
- return 0
350
- fi
351
- local skills_dir leaf backup_root backup
352
- skills_dir="$(dirname "$dir")"
353
- leaf="$(basename "$dir")"
354
- backup_root="${skills_dir}.pre-lean-ctx-observe-strip-$(date -u +%Y%m%dT%H%M%SZ)"
355
- backup="$backup_root/$leaf"
356
- if ! mkdir "$backup_root" 2>/dev/null; then
357
- echo "lean-ctx-observe-strip: $dir: FAILED to create backup location $backup_root -- not modified" >&2
358
- return 1
359
- fi
360
- if ! mv "$dir" "$backup"; then
361
- echo "lean-ctx-observe-strip: $dir: FAILED to move to $backup -- not modified" >&2
362
- return 1
363
- fi
364
- echo "lean-ctx-observe-strip: backed up previous skill directory $dir to $backup"
365
- echo "lean-ctx-observe-strip: moved lean-ctx skill directory $dir to $backup"
366
- return 0
367
- }
368
-
369
- # strip_hook_scripts_one <hooks-dir> -- shape 6 (see the header): moves every
370
- # entry named `lean-ctx-*` directly under <hooks-dir> into a sibling
371
- # `<hooks-dir>.pre-lean-ctx-observe-strip-<UTC ts>/` directory (OUTSIDE the
372
- # scanned hooks/ directory, same reasoning as strip_skill_dir_one), so
373
- # lean-ctx's refresh gate (`hooks/lean-ctx-rewrite.sh` exists) is disarmed.
374
- # Matches by name prefix only, never by content; a symlink named
375
- # `lean-ctx-*` is moved as the link itself (mv never follows it). Nothing
376
- # else in <hooks-dir> is read or touched. Each file is reported as
377
- # "backed up previous hook script <original> to <backup>" (two explicit
378
- # paths, like the skill-directory note -- the backup path does not end in
379
- # `.pre-<label>-<timestamp>`, so bin/reconcile cannot recover the original
380
- # by suffix-stripping).
381
- strip_hook_scripts_one() {
382
- local hooks_dir="$1" entry
383
- local found=()
384
- if [[ -d "$hooks_dir" ]]; then
385
- for entry in "$hooks_dir"/lean-ctx-*; do
386
- if [[ -e "$entry" || -L "$entry" ]]; then
387
- found+=("$entry")
388
- fi
389
- done
390
- fi
391
- if [[ "${#found[@]}" -eq 0 ]]; then
392
- echo "lean-ctx-observe-strip: $hooks_dir/lean-ctx-*: not present -- nothing to strip"
393
- return 0
394
- fi
395
- for entry in "${found[@]}"; do
396
- echo "lean-ctx-observe-strip: $entry: found lean-ctx hook script"
397
- if [[ "$mode" != apply ]]; then
398
- echo "lean-ctx-observe-strip: would move $entry to a timestamped backup location outside $hooks_dir"
399
- fi
400
- done
401
- [[ "$mode" == apply ]] || return 0
402
-
403
- local backup_root
404
- backup_root="${hooks_dir}.pre-lean-ctx-observe-strip-$(date -u +%Y%m%dT%H%M%SZ)"
405
- if ! mkdir "$backup_root" 2>/dev/null; then
406
- echo "lean-ctx-observe-strip: $hooks_dir: FAILED to create backup location $backup_root -- not modified" >&2
407
- return 1
408
- fi
409
- local backup rc=0
410
- for entry in "${found[@]}"; do
411
- backup="$backup_root/$(basename "$entry")"
412
- if ! mv "$entry" "$backup"; then
413
- echo "lean-ctx-observe-strip: $entry: FAILED to move to $backup -- not modified" >&2
414
- rc=1
415
- continue
416
- fi
417
- echo "lean-ctx-observe-strip: backed up previous hook script $entry to $backup"
418
- echo "lean-ctx-observe-strip: moved lean-ctx hook script $entry to $backup"
419
- done
420
- return "$rc"
421
- }
422
-
423
- status=0
424
- for target in "${targets[@]}"; do
425
- strip_one "$target" || status=1
426
- done
427
- for target in "${shell_hook_targets[@]}"; do
428
- strip_shell_hook_one "$target" || status=1
429
- done
430
- for target in "${skill_dir_targets[@]}"; do
431
- strip_skill_dir_one "$target" || status=1
432
- done
433
- strip_hook_scripts_one "$home/.claude/hooks" || status=1
434
- exit "$status"