aboutsummaryrefslogtreecommitdiff
path: root/scripts/sync-language-bundle.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/sync-language-bundle.sh')
-rwxr-xr-xscripts/sync-language-bundle.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/scripts/sync-language-bundle.sh b/scripts/sync-language-bundle.sh
index b2db8cb..25af11b 100755
--- a/scripts/sync-language-bundle.sh
+++ b/scripts/sync-language-bundle.sh
@@ -84,6 +84,22 @@ surface() {
MANUAL=$((MANUAL + 1))
}
+# inbox_drop SRC BASENAME — offer a project-owned file via the .ai/ inbox.
+# Only acts when the project uses the .ai/ inbox convention (so a bundle target
+# without .ai/ is never given an empty one). No-op once the project has already
+# adopted the file at its root or has a copy waiting in the inbox.
+inbox_drop() {
+ local src="$1" base="$2" inbox="$PROJECT/.ai/inbox"
+ [ -f "$src" ] || return 0
+ [ -d "$inbox" ] || return 0
+ [ -f "$PROJECT/$base" ] && return 0 # already adopted at project root
+ ls "$inbox"/*"$base" >/dev/null 2>&1 && return 0 # already waiting in inbox
+ cp "$src" "$inbox/from-rulesets-$base"
+ ensure_header
+ OUT+=" inbox .ai/inbox/from-rulesets-$base (project-owned — adopt deliberately)"$'\n'
+ FIXED=$((FIXED + 1))
+}
+
# process_bundle KIND SRC_DIR — reconcile one bundle (KIND is language|team).
# A team overlay owns only its own rule files; a language bundle also owns the
# shared generic rules, its hooks/githooks, and surfaces settings.json.
@@ -131,6 +147,12 @@ process_bundle() {
fix "$f" "$PROJECT/.claude/$rel" exec
done < <(find "$src/claude/hooks" -type f)
fi
+ if [ -d "$src/claude/scripts" ]; then
+ while IFS= read -r f; do
+ rel="${f#"$src"/claude/}"
+ fix "$f" "$PROJECT/.claude/$rel"
+ done < <(find "$src/claude/scripts" -type f)
+ fi
if [ -d "$src/githooks" ]; then
while IFS= read -r f; do
rel="${f#"$src"/githooks/}"
@@ -138,6 +160,10 @@ process_bundle() {
done < <(find "$src/githooks" -type f)
fi
surface "$src/claude/settings.json" "$PROJECT/.claude/settings.json"
+ # 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"
fi
if [ "$MANUAL" -gt "$manual_before" ]; then