aboutsummaryrefslogtreecommitdiff
path: root/scripts/tests/install-lang.bats
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/tests/install-lang.bats
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/tests/install-lang.bats')
-rw-r--r--scripts/tests/install-lang.bats29
1 files changed, 29 insertions, 0 deletions
diff --git a/scripts/tests/install-lang.bats b/scripts/tests/install-lang.bats
index ecfbe01..f790fbf 100644
--- a/scripts/tests/install-lang.bats
+++ b/scripts/tests/install-lang.bats
@@ -79,6 +79,35 @@ teardown() {
grep -qxF "coverage/" "$PROJECT/.gitignore"
}
+@test "install-lang python: seeds the language-neutral default CLAUDE.md when the bundle ships none" {
+ run bash "$INSTALL_LANG" python "$PROJECT"
+
+ [ "$status" -eq 0 ]
+ [ -f "$PROJECT/CLAUDE.md" ]
+ # The default names no language, so it can't mislabel a python (or bash, or
+ # multi-bundle) project the way inheriting elisp's "Elisp project" header did.
+ ! grep -qi "Python project" "$PROJECT/CLAUDE.md"
+ ! grep -qi "Elisp project" "$PROJECT/CLAUDE.md"
+ grep -qF "names no language" "$PROJECT/CLAUDE.md"
+ [[ "$output" == *"language-neutral default"* ]]
+}
+
+@test "install-lang elisp: seeds the bundle's own CLAUDE.md, not the default" {
+ run bash "$INSTALL_LANG" elisp "$PROJECT"
+
+ [ "$status" -eq 0 ]
+ grep -qF "Elisp project." "$PROJECT/CLAUDE.md"
+ [[ "$output" == *"CLAUDE.md installed (elisp)"* ]]
+}
+
+@test "install-lang python: does not overwrite an existing CLAUDE.md without FORCE" {
+ echo "MY OWN CLAUDE" > "$PROJECT/CLAUDE.md"
+ run bash "$INSTALL_LANG" python "$PROJECT"
+
+ [ "$status" -eq 0 ]
+ grep -qxF "MY OWN CLAUDE" "$PROJECT/CLAUDE.md"
+}
+
@test "install-lang go: full bundle lands (rules, hook, settings, githook, CLAUDE.md, coverage)" {
run bash "$INSTALL_LANG" go "$PROJECT"