aboutsummaryrefslogtreecommitdiff
path: root/scripts/sync-language-bundle.sh
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-06-03 13:30:35 -0500
committerCraig Jennings <c@cjennings.net>2026-06-03 13:30:35 -0500
commit36e57f15e2cc191172016c50d45b5bf5d71933e5 (patch)
tree609d8df5c28713ee7fadf2e3ba2bfb8feb14d800 /scripts/sync-language-bundle.sh
parent586c8f69b2f1e0498be7f8abecfd348aae12e5dd (diff)
downloadrulesets-36e57f15e2cc191172016c50d45b5bf5d71933e5.tar.gz
rulesets-36e57f15e2cc191172016c50d45b5bf5d71933e5.zip
fix(language-bundle): don't re-drop the coverage fragment once adopted
The startup bundle sync re-dropped from-rulesets-coverage-makefile.txt into a project's inbox on every run, even after the project had adopted the targets. inbox_drop only treated the fragment as adopted if coverage-makefile.txt still sat at the project root or waited in the inbox. But install-lang tells users the opposite: copy the targets into your Makefile, then delete the fragment. So a project that followed the documented path got the drop re-suggested forever (deleted three sessions running in one case). I guarded the drop so a project Makefile that already defines the distinctive coverage-summary target counts as adopted. The check lives at the call site, keeping inbox_drop generic. Added two bats cases: targets-in-Makefile suppresses the drop, an unrelated Makefile still gets it.
Diffstat (limited to 'scripts/sync-language-bundle.sh')
-rwxr-xr-xscripts/sync-language-bundle.sh9
1 files changed, 8 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