diff --git a/scripts/check-agent-docs-drift.sh b/scripts/check-agent-docs-drift.sh index ff46c8f8..41047663 100755 --- a/scripts/check-agent-docs-drift.sh +++ b/scripts/check-agent-docs-drift.sh @@ -11,11 +11,17 @@ # What is checked per repo: # 1. Legacy files MUST NOT exist (they used to duplicate AGENTS.md): # .cursorrules, .windsurfrules, .clinerules, CLAUDE.md -# 2. AGENTS.md MUST contain the canonical-behavior-pointer marker. -# 3. .github/copilot-instructions.md MUST contain the AUTO-GENERATED marker +# 2. Per-tool subdirectory AGENTS.md duplicates MUST NOT exist (an earlier +# "centralize agent docs" refactor introduced redirect pointers in +# .claude/, .cline/, .cursor/, .devin/ that duplicate the canonical +# repo-root AGENTS.md). Listed files: +# .claude/AGENTS.md, .cline/AGENTS.md, .cursor/AGENTS.md, +# .devin/AGENTS.md, .devin/CONTEXT.md +# 3. AGENTS.md MUST contain the canonical-behavior-pointer marker. +# 4. .github/copilot-instructions.md MUST contain the AUTO-GENERATED marker # AND a reference to the canonical guidelines file. -# 4. .aider.conf.yml MUST exist and reference AGENTS.md. -# 5. .editorconfig MUST exist with the canonical first line "root = true". +# 5. .aider.conf.yml MUST exist and reference AGENTS.md. +# 6. .editorconfig MUST exist with the canonical first line "root = true". # # Repair: bash scripts/update-agent-docs.sh @@ -33,6 +39,15 @@ if [[ ! -f "$REPOS_TXT" ]]; then fi LEGACY_FILES=(.cursorrules .windsurfrules .clinerules CLAUDE.md) +# Per-tool subdirectory duplicates (introduced by an earlier "centralize +# agent docs" refactor and superseded by single-source-of-truth). +LEGACY_SUBDIR_FILES=( + .claude/AGENTS.md + .cline/AGENTS.md + .cursor/AGENTS.md + .devin/AGENTS.md + .devin/CONTEXT.md +) AGENTS_POINTER_MARKER="" COPILOT_GENERATED_MARKER="" COPILOT_CANONICAL_REF="agent-behavior-guidelines.md" @@ -62,19 +77,26 @@ for repo in "${REPOS[@]}"; do issues=() - # 1 — Legacy files must be gone. + # 1 — Legacy root files must be gone. for f in "${LEGACY_FILES[@]}"; do if [[ -e "${repo_dir}/${f}" ]]; then issues+=("legacy file still present: $f") fi done - # 2 — AGENTS.md must have the canonical pointer block. + # 2 — Legacy per-tool subdirectory duplicates must be gone. + for f in "${LEGACY_SUBDIR_FILES[@]}"; do + if [[ -e "${repo_dir}/${f}" ]]; then + issues+=("legacy per-tool duplicate still present: $f") + fi + done + + # 3 — AGENTS.md must have the canonical pointer block. if ! grep -qF "$AGENTS_POINTER_MARKER" "${repo_dir}/AGENTS.md"; then issues+=("AGENTS.md missing canonical-behavior-pointer block") fi - # 3 — Copilot file: must exist, must be AUTO-GENERATED, must reference canonical. + # 4 — Copilot file: must exist, must be AUTO-GENERATED, must reference canonical. copilot="${repo_dir}/.github/copilot-instructions.md" if [[ ! -f "$copilot" ]]; then issues+=(".github/copilot-instructions.md missing") @@ -87,7 +109,7 @@ for repo in "${REPOS[@]}"; do fi fi - # 4 — Aider config: must exist and reference AGENTS.md. + # 5 — Aider config: must exist and reference AGENTS.md. aider="${repo_dir}/.aider.conf.yml" if [[ ! -f "$aider" ]]; then issues+=(".aider.conf.yml missing") @@ -95,7 +117,7 @@ for repo in "${REPOS[@]}"; do issues+=(".aider.conf.yml does not reference AGENTS.md") fi - # 5 — Editorconfig: must exist with canonical first line. + # 6 — Editorconfig: must exist with canonical first line. editorconfig="${repo_dir}/.editorconfig" if [[ ! -f "$editorconfig" ]]; then issues+=(".editorconfig missing")