diff options
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/sync-language-bundle.sh | 9 | ||||
| -rw-r--r-- | scripts/tests/sync-language-bundle.bats | 24 |
2 files changed, 32 insertions, 1 deletions
diff --git a/scripts/sync-language-bundle.sh b/scripts/sync-language-bundle.sh index 25af11b..45f8259 100755 --- a/scripts/sync-language-bundle.sh +++ b/scripts/sync-language-bundle.sh @@ -163,7 +163,14 @@ process_bundle() { # The Makefile fragment is project-owned: never auto-fix it, never edit the # project Makefile. If the project uses the .ai/ inbox convention and hasn't # already adopted the fragment, drop a copy there for deliberate adoption. - inbox_drop "$src/coverage-makefile.txt" "coverage-makefile.txt" + # The documented adoption path (install-lang: "copy its targets into your + # Makefile") leaves no fragment at root, so a project Makefile that already + # defines the distinctive coverage-summary target counts as adopted — + # otherwise the drop gets re-suggested every run after a deliberate + # copy-and-delete. + if ! grep -qE '^coverage-summary:' "$PROJECT/Makefile" 2>/dev/null; then + inbox_drop "$src/coverage-makefile.txt" "coverage-makefile.txt" + fi fi if [ "$MANUAL" -gt "$manual_before" ]; then diff --git a/scripts/tests/sync-language-bundle.bats b/scripts/tests/sync-language-bundle.bats index 5e3b912..1871444 100644 --- a/scripts/tests/sync-language-bundle.bats +++ b/scripts/tests/sync-language-bundle.bats @@ -182,6 +182,30 @@ install_team_overlay() { [[ "$output" != *"inbox"* ]] } +@test "sync: targets copied into the project Makefile count as adopted, no re-drop" { + # The documented adoption path (install-lang: "copy its targets into your + # Makefile") leaves no fragment at root and no inbox copy. A project that did + # this and deleted the fragment must not get the drop re-suggested every run. + install_bundle elisp "$PROJ" + mkdir -p "$PROJ/.ai/inbox" + printf 'coverage:\n\t@true\ncoverage-summary:\n\t@true\n' > "$PROJ/Makefile" + run bash "$SCRIPT" "$PROJ" + [ "$status" -eq 0 ] + [ ! -f "$PROJ/.ai/inbox/from-rulesets-coverage-makefile.txt" ] + [[ "$output" != *"inbox"* ]] +} + +@test "sync: a project Makefile without the coverage-summary target still gets the drop" { + # Guard against over-broad detection: an unrelated Makefile must not suppress + # a genuinely-unadopted fragment. + install_bundle elisp "$PROJ" + mkdir -p "$PROJ/.ai/inbox" + printf 'build:\n\t@true\ntest:\n\t@true\n' > "$PROJ/Makefile" + run bash "$SCRIPT" "$PROJ" + [ "$status" -eq 0 ] + [ -f "$PROJ/.ai/inbox/from-rulesets-coverage-makefile.txt" ] +} + # --- Surface-only: settings.json --- @test "sync: drifted settings.json is surfaced, NOT modified, exit 3" { |
