aboutsummaryrefslogtreecommitdiff
path: root/scripts/install-ai.sh
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-06-10 01:14:46 -0500
committerCraig Jennings <c@cjennings.net>2026-06-10 01:14:46 -0500
commitcc72aa635f733da36010567c8718b1ede7622c52 (patch)
tree10d6d6bf0c86fd284349e1c7dac83cb6cbc07c70 /scripts/install-ai.sh
parentc401d6d3807a2ffb76a9ec4af8dc783b2c918bfd (diff)
downloadrulesets-cc72aa635f733da36010567c8718b1ede7622c52.tar.gz
rulesets-cc72aa635f733da36010567c8718b1ede7622c52.zip
feat(install-ai): gitignore the full personal-tooling set, add backfill sweep
A gitignore-mode project only ignored .ai/. CLAUDE.md was left untracked but not ignored, so an accidental git add or a codify run could still commit a personal CLAUDE.md, the private rule copies under .claude/, or an AGENTS.md. install-ai now ignores the whole set (.ai/, .claude/, CLAUDE.md, AGENTS.md) at bootstrap, line-idempotent so an existing .gitignore isn't duplicated. .claude/ goes in the set because it's rulesets-owned (copies of claude-rules/*.md plus the language bundle's rules, hooks, and settings), re-synced from rulesets every startup, so git isn't how it travels. Ignoring it also keeps those private rule copies out of the repo, which ignoring CLAUDE.md alone would miss. The gate is unchanged: track-mode projects (personal/doc repos, team repos sharing config) keep tracking the set. sweep-gitignore-tooling.sh backfills the set across existing gitignore-mode projects, idempotent and skipping track-mode by design. It warns when a now-ignored path is already tracked, since the ignore won't untrack it. protocols.org states the policy once.
Diffstat (limited to 'scripts/install-ai.sh')
-rwxr-xr-xscripts/install-ai.sh29
1 files changed, 21 insertions, 8 deletions
diff --git a/scripts/install-ai.sh b/scripts/install-ai.sh
index a5b38a8..7007eed 100755
--- a/scripts/install-ai.sh
+++ b/scripts/install-ai.sh
@@ -30,8 +30,11 @@ Bootstrap .ai/ in PROJECT_PATH from canonical content at $CANONICAL.
--track Track .ai/ in the project's git history (with .gitkeep
files inside otherwise-empty sessions/, references/,
retrospectives/).
- --gitignore Append .ai/ to the project's .gitignore so session
- records stay local.
+ --gitignore Gitignore the project's personal tooling (.ai/, .claude/,
+ CLAUDE.md, AGENTS.md) so it stays local. .claude/ is
+ rulesets-owned and re-synced each startup, so git isn't how
+ it travels; ignoring it also keeps private rule copies out
+ of the repo.
If neither flag is given, the script prompts interactively.
If PROJECT_PATH is omitted, fzf-picks from ~/code/* + ~/projects/*
@@ -147,14 +150,24 @@ case "$track_mode" in
touch "$project/.ai/retrospectives/.gitkeep"
;;
gitignore)
- if [ -f "$project/.gitignore" ] && grep -qFx '.ai/' "$project/.gitignore"; then
- : # already present
- else
+ # Personal-tooling files that stay out of git in gitignore mode. .ai/
+ # holds session records; .claude/ is rulesets-owned bundle content
+ # (re-synced each startup, and it carries private rule copies); CLAUDE.md
+ # and AGENTS.md are personal tooling, project-owned but never committed.
+ # Append only the lines not already present, so a project that already
+ # ignores some of them isn't duplicated.
+ gi="$project/.gitignore"
+ needed=()
+ for pat in '.ai/' '.claude/' 'CLAUDE.md' 'AGENTS.md'; do
+ if [ -f "$gi" ] && grep -qFx "$pat" "$gi"; then continue; fi
+ needed+=("$pat")
+ done
+ if [ "${#needed[@]}" -gt 0 ]; then
{
- [ -s "$project/.gitignore" ] && echo ""
+ [ -s "$gi" ] && echo ""
echo "# Claude Code per-project tooling"
- echo ".ai/"
- } >> "$project/.gitignore"
+ printf '%s\n' "${needed[@]}"
+ } >> "$gi"
fi
;;
esac