diff options
| author | Craig Jennings <c@cjennings.net> | 2026-05-06 06:09:02 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-05-06 06:09:02 -0500 |
| commit | ce66de633129abc94df03ab5da91ba2ca2e93330 (patch) | |
| tree | 0bdfe9f5c91a591738f88a3ae2c928f6fe783565 /Makefile | |
| parent | 7f1717bc2e1a9b3ac9dc3926ffd46f37532ae2a9 (diff) | |
| download | rulesets-ce66de633129abc94df03ab5da91ba2ca2e93330.tar.gz rulesets-ce66de633129abc94df03ab5da91ba2ca2e93330.zip | |
feat(claude): add claude config and wire it into make install
I moved Claude Code's user-level config into this repo so it travels with rulesets across machines instead of being machine-specific. The three pieces are settings.json, .mcp.json, and commands/refactor.md.
I extended make install, uninstall, and list to handle the new .claude/ directory. The wildcard for CLAUDE_CONFIG matches both `*.json` and `.*.json` because make's glob skips dotfiles by default. Without the dot variant, .mcp.json wouldn't get picked up.
I also added settings.local.json to .gitignore. That file is per-machine by convention and shouldn't ever land in the shared repo.
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 71 |
1 files changed, 64 insertions, 7 deletions
@@ -1,13 +1,15 @@ .DEFAULT_GOAL := help SHELL := /bin/bash -SKILLS_DIR := $(HOME)/.claude/skills -RULES_DIR := $(HOME)/.claude/rules -HOOKS_DIR := $(HOME)/.claude/hooks -SKILLS := $(patsubst %/SKILL.md,%,$(wildcard */SKILL.md)) -RULES := $(wildcard claude-rules/*.md) -HOOKS := $(wildcard hooks/*.sh hooks/*.py) -LANGUAGES := $(notdir $(wildcard languages/*)) +SKILLS_DIR := $(HOME)/.claude/skills +RULES_DIR := $(HOME)/.claude/rules +HOOKS_DIR := $(HOME)/.claude/hooks +CLAUDE_DIR := $(HOME)/.claude +SKILLS := $(patsubst %/SKILL.md,%,$(wildcard */SKILL.md)) +RULES := $(wildcard claude-rules/*.md) +HOOKS := $(wildcard hooks/*.sh hooks/*.py) +CLAUDE_CONFIG := $(wildcard .claude/*.json) $(wildcard .claude/.*.json) +LANGUAGES := $(notdir $(wildcard languages/*)) # Pick target project — use PROJECT= or interactive fzf over local .git dirs. # Defined inline in each recipe (not via $(shell)) so fzf only runs when needed. @@ -131,6 +133,29 @@ install: ## Symlink skills and rules into ~/.claude/ echo " link claude-rules → $(SKILLS_DIR)/claude-rules"; \ fi @echo "" + @echo "Claude config:" + @for f in $(CLAUDE_CONFIG); do \ + name=$$(basename $$f); \ + if [ -L "$(CLAUDE_DIR)/$$name" ]; then \ + echo " skip $$name (already linked)"; \ + elif [ -e "$(CLAUDE_DIR)/$$name" ]; then \ + echo " WARN $$name exists and is not a symlink — skipping"; \ + else \ + ln -s "$(CURDIR)/$$f" "$(CLAUDE_DIR)/$$name"; \ + echo " link $$name → $(CLAUDE_DIR)/$$name"; \ + fi \ + done + @if [ -d ".claude/commands" ]; then \ + if [ -L "$(CLAUDE_DIR)/commands" ]; then \ + echo " skip commands (already linked)"; \ + elif [ -e "$(CLAUDE_DIR)/commands" ]; then \ + echo " WARN commands exists and is not a symlink — skipping"; \ + else \ + ln -s "$(CURDIR)/.claude/commands" "$(CLAUDE_DIR)/commands"; \ + echo " link commands → $(CLAUDE_DIR)/commands"; \ + fi \ + fi + @echo "" @echo "done" uninstall: ## Remove global symlinks from ~/.claude/ @@ -163,6 +188,23 @@ uninstall: ## Remove global symlinks from ~/.claude/ echo " skip claude-rules (not a symlink)"; \ fi @echo "" + @echo "Claude config:" + @for f in $(CLAUDE_CONFIG); do \ + name=$$(basename $$f); \ + if [ -L "$(CLAUDE_DIR)/$$name" ]; then \ + rm "$(CLAUDE_DIR)/$$name"; \ + echo " rm $$name"; \ + else \ + echo " skip $$name (not a symlink)"; \ + fi \ + done + @if [ -L "$(CLAUDE_DIR)/commands" ]; then \ + rm "$(CLAUDE_DIR)/commands"; \ + echo " rm commands"; \ + else \ + echo " skip commands (not a symlink)"; \ + fi + @echo "" @echo "done" list: ## Show global install status @@ -194,6 +236,21 @@ list: ## Show global install status echo " - $$name"; \ fi \ done + @echo "" + @echo "Claude config:" + @for f in $(CLAUDE_CONFIG); do \ + name=$$(basename $$f); \ + if [ -L "$(CLAUDE_DIR)/$$name" ]; then \ + echo " ✓ $$name (installed)"; \ + else \ + echo " - $$name"; \ + fi \ + done + @if [ -L "$(CLAUDE_DIR)/commands" ]; then \ + echo " ✓ commands (installed)"; \ + else \ + echo " - commands"; \ + fi install-hooks: ## Symlink global hooks into ~/.claude/hooks/ + print settings.json snippet @mkdir -p $(HOOKS_DIR) |
