aboutsummaryrefslogtreecommitdiff
path: root/scripts/install-lang.sh
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-06-23 21:00:11 -0400
committerCraig Jennings <c@cjennings.net>2026-06-23 21:00:11 -0400
commit71db71b9d47ffbeaf1d1c859fa3e3bebb7b2ea29 (patch)
tree3fc7536bc7612bfa095fe137de9497e36c7bca12 /scripts/install-lang.sh
parent603abc4cb3129be8bd23c89aa69f4f5522d1e5a3 (diff)
downloadrulesets-71db71b9d47ffbeaf1d1c859fa3e3bebb7b2ea29.tar.gz
rulesets-71db71b9d47ffbeaf1d1c859fa3e3bebb7b2ea29.zip
feat(install-lang): seed a neutral CLAUDE.md when a bundle ships none
install-lang only seeded CLAUDE.md if the chosen bundle shipped one. elisp and go do, python and typescript don't. A project installing a template-less bundle got no CLAUDE.md, and a multi-bundle install inherited whichever bundle shipped one. A bash project that installed elisp and python ended up headed "Elisp project," worse than no header. I added a language-neutral default (languages/default-CLAUDE.md) that names no language, so single-language, multi-bundle, and wrong-bundle installs all get an accurate "fill this in" header instead of a false one. Per-bundle templates still win where present. The seed-on-first-install, no-overwrite logic is unchanged. I hardened the Makefile LANGUAGES glob to directories only so the new template file doesn't show up as a selectable language. lint covers the default. The install-lang tests cover the fallback, the bundle-wins branch, and no-overwrite. A bash bundle is still the real gap for shell-heavy projects, filed as a backlog task.
Diffstat (limited to 'scripts/install-lang.sh')
-rwxr-xr-xscripts/install-lang.sh19
1 files changed, 16 insertions, 3 deletions
diff --git a/scripts/install-lang.sh b/scripts/install-lang.sh
index 0fc9ea8..2f38fcd 100755
--- a/scripts/install-lang.sh
+++ b/scripts/install-lang.sh
@@ -66,13 +66,26 @@ if [ -d "$SRC/githooks" ]; then
fi
fi
-# 3. CLAUDE.md — seed on first install, don't overwrite unless FORCE=1
+# 3. CLAUDE.md — seed on first install, don't overwrite unless FORCE=1.
+# Prefer the bundle's own template; fall back to the language-neutral
+# default so a bundle that ships none still seeds an accurate, non-
+# mislabeling header instead of nothing. The default names no language,
+# so multi-bundle and wrong-bundle installs don't inherit a false header.
+CLAUDE_SRC=""
+CLAUDE_KIND=""
if [ -f "$SRC/CLAUDE.md" ]; then
+ CLAUDE_SRC="$SRC/CLAUDE.md"
+ CLAUDE_KIND="$LANG"
+elif [ -f "$REPO_ROOT/languages/default-CLAUDE.md" ]; then
+ CLAUDE_SRC="$REPO_ROOT/languages/default-CLAUDE.md"
+ CLAUDE_KIND="language-neutral default"
+fi
+if [ -n "$CLAUDE_SRC" ]; then
if [ -f "$PROJECT/CLAUDE.md" ] && [ "$FORCE" != "1" ]; then
echo " [skip] CLAUDE.md already exists (use FORCE=1 to overwrite)"
else
- cp "$SRC/CLAUDE.md" "$PROJECT/CLAUDE.md"
- echo " [ok] CLAUDE.md installed"
+ cp "$CLAUDE_SRC" "$PROJECT/CLAUDE.md"
+ echo " [ok] CLAUDE.md installed ($CLAUDE_KIND)"
fi
fi