feat(hooks): track writing contracts + linters in repo
comms-lint.py and comment-lint.py lived only in ~/.claude, which is not a git repo. Contract prose lived in ~/.claude/CLAUDE.md. Neither survived a machine rebuild. Prose moves to claude-md/ fragments, imported via @name.md. Linters move to hooks/. link.sh and home.nix distribute both. settings.json wiring stays manual — it holds machine-local MCP/statusline config this repo must not own. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VaGR6ERGCfzWTtuv2rebGe
This commit is contained in:
+18
-2
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# Symlink centralized skills/commands into each agent's config dir.
|
||||
# Symlink centralized skills/commands/hooks/context into each agent's config dir.
|
||||
# For non-Nix machines (NixOS boxes use nix/home.nix instead).
|
||||
# Idempotent. Backs up any pre-existing real dir once to <name>.bak.
|
||||
set -euo pipefail
|
||||
@@ -11,6 +11,11 @@ REPO="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
CLAUDE_SKILLS="$HOME/.claude/skills"
|
||||
CODEX_SKILLS="$HOME/.agents/skills"
|
||||
CLAUDE_CMDS="$HOME/.claude/commands" # commands are Claude-only; Codex ignores
|
||||
CLAUDE_HOOKS="$HOME/.claude/hooks" # hooks are Claude-only
|
||||
CLAUDE_HOME="$HOME/.claude" # CLAUDE.md fragments, pulled in via @name.md
|
||||
|
||||
# Per-FILE links, never a whole-dir link: ~/.claude/hooks and ~/.claude itself hold
|
||||
# machine-local files this repo does not own, and a dir symlink would hide them.
|
||||
|
||||
# backups go OUTSIDE the skill dirs — a *.bak left inside gets discovered as a
|
||||
# duplicate skill by both Claude Code and Codex.
|
||||
@@ -27,7 +32,7 @@ link() { # link <src> <dst>
|
||||
echo "linked $dst -> $src"
|
||||
}
|
||||
|
||||
mkdir -p "$CLAUDE_SKILLS" "$CODEX_SKILLS" "$CLAUDE_CMDS"
|
||||
mkdir -p "$CLAUDE_SKILLS" "$CODEX_SKILLS" "$CLAUDE_CMDS" "$CLAUDE_HOOKS"
|
||||
|
||||
for d in "$REPO"/skills/*/; do
|
||||
name="$(basename "$d")"
|
||||
@@ -40,4 +45,15 @@ for f in "$REPO"/commands/*.md; do
|
||||
link "$f" "$CLAUDE_CMDS/$(basename "$f")"
|
||||
done
|
||||
|
||||
for f in "$REPO"/hooks/*.py "$REPO"/hooks/*.sh; do
|
||||
[ -e "$f" ] || continue
|
||||
link "$f" "$CLAUDE_HOOKS/$(basename "$f")"
|
||||
done
|
||||
|
||||
for f in "$REPO"/claude-md/*.md; do
|
||||
[ -e "$f" ] || continue
|
||||
link "$f" "$CLAUDE_HOME/$(basename "$f")"
|
||||
done
|
||||
|
||||
echo "done."
|
||||
echo "hooks still need wiring in ~/.claude/settings.json — see hooks/README.md"
|
||||
|
||||
Reference in New Issue
Block a user