diff options
| author | Craig Jennings <c@cjennings.net> | 2026-07-25 15:35:14 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-07-25 15:35:14 -0500 |
| commit | f2609d9f9ad33486bef43211d753ba53e1e24181 (patch) | |
| tree | 561f0514866570d47c446816daa131ce13064639 /Makefile | |
| parent | 3203bd803b6a05d10781634e7e18742879c1046a (diff) | |
| download | rulesets-f2609d9f9ad33486bef43211d753ba53e1e24181.tar.gz rulesets-f2609d9f9ad33486bef43211d753ba53e1e24181.zip | |
Centralize repository-state checks, bind teardown to a certified clean HEAD, and allow inbox-only refreshes. Guard installed symlinks from cross-project writes and add regression coverage.
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -6,6 +6,7 @@ RULES_DIR := $(HOME)/.claude/rules HOOKS_DIR := $(HOME)/.claude/hooks CLAUDE_DIR := $(HOME)/.claude CODEX_DIR := $(HOME)/.codex +CODEX_HOOKS := $(CURDIR)/.codex/hooks.json LOCAL_BIN := $(HOME)/.local/bin AI_LAUNCHER := $(CURDIR)/claude-templates/bin/ai SKILLS := $(patsubst %/SKILL.md,%,$(wildcard */SKILL.md)) @@ -231,6 +232,19 @@ install: ## Symlink skills, rules, config, hooks, and bin scripts into place ln -s "$(CURDIR)/claude-templates/AGENTS.md" "$(CODEX_DIR)/AGENTS.md"; \ echo " link AGENTS.md → $(CODEX_DIR)/AGENTS.md"; \ fi + @if [ -L "$(CODEX_DIR)/hooks.json" ]; then \ + target=$$(readlink "$(CODEX_DIR)/hooks.json"); \ + if [ "$$target" = "$(CODEX_HOOKS)" ]; then \ + echo " skip hooks.json (already linked)"; \ + else \ + echo " WARN hooks.json links elsewhere ($$target) — skipping"; \ + fi; \ + elif [ -e "$(CODEX_DIR)/hooks.json" ]; then \ + echo " WARN hooks.json exists and is not a symlink — skipping"; \ + else \ + ln -s "$(CODEX_HOOKS)" "$(CODEX_DIR)/hooks.json"; \ + echo " link hooks.json → $(CODEX_DIR)/hooks.json"; \ + fi @echo "" @echo "Hooks (default):" @for hook in $(DEFAULT_HOOKS); do \ @@ -317,6 +331,13 @@ uninstall: ## Remove global symlinks from ~/.claude/ else \ echo " skip commands (not a symlink)"; \ fi + @if [ -L "$(CODEX_DIR)/hooks.json" ] \ + && [ "$$(readlink "$(CODEX_DIR)/hooks.json")" = "$(CODEX_HOOKS)" ]; then \ + rm "$(CODEX_DIR)/hooks.json"; \ + echo " rm codex hooks.json"; \ + else \ + echo " skip codex hooks.json (not our symlink)"; \ + fi @echo "" @echo "ai launcher:" @if [ -L "$(LOCAL_BIN)/ai" ]; then \ |
