70 lines
2.6 KiB
Bash
70 lines
2.6 KiB
Bash
#!/usr/bin/env bash
|
|
# Setup Claude Code - Reverdin Consulting
|
|
# Usage : curl -fsSL https://git.reverdin.eu/marc/claude-rc-config/raw/branch/main/setup.sh | bash
|
|
|
|
set -e
|
|
|
|
REPO_BASE="https://git.reverdin.eu/marc/claude-rc-config/raw/branch/main"
|
|
CLAUDE_DIR="$HOME/.claude"
|
|
SKILLS_DIR="$CLAUDE_DIR/skills"
|
|
|
|
echo "=== Claude Code - Setup Reverdin Consulting ==="
|
|
|
|
# 1. Verifier / installer Claude Code
|
|
if ! command -v claude &>/dev/null; then
|
|
echo ">>> Installation de Claude Code..."
|
|
if command -v npm &>/dev/null; then
|
|
npm install -g @anthropic-ai/claude-code
|
|
elif command -v brew &>/dev/null; then
|
|
brew install anthropic/tap/claude-code 2>/dev/null || npm install -g @anthropic-ai/claude-code
|
|
else
|
|
echo "ERREUR : npm ou brew requis. Installer Node.js depuis https://nodejs.org"
|
|
exit 1
|
|
fi
|
|
else
|
|
echo ">>> Claude Code deja installe : $(claude --version 2>/dev/null || echo ok)"
|
|
fi
|
|
|
|
# 2. Creer les repertoires
|
|
mkdir -p "$SKILLS_DIR/rc-brief" "$SKILLS_DIR/rc-writer" "$SKILLS_DIR/research-query" "$SKILLS_DIR/think"
|
|
|
|
# 3. Telecharger les fichiers
|
|
echo ">>> Telechargement de la configuration RC..."
|
|
|
|
curl -fsSL "$REPO_BASE/config/settings.json" -o "$CLAUDE_DIR/settings.json.rc"
|
|
curl -fsSL "$REPO_BASE/config/CLAUDE.md" -o "$CLAUDE_DIR/CLAUDE.md"
|
|
curl -fsSL "$REPO_BASE/skills/rc-brief/SKILL.md" -o "$SKILLS_DIR/rc-brief/SKILL.md"
|
|
curl -fsSL "$REPO_BASE/skills/rc-writer/SKILL.md" -o "$SKILLS_DIR/rc-writer/SKILL.md"
|
|
curl -fsSL "$REPO_BASE/skills/research-query/SKILL.md" -o "$SKILLS_DIR/research-query/SKILL.md"
|
|
curl -fsSL "$REPO_BASE/skills/think/SKILL.md" -o "$SKILLS_DIR/think/SKILL.md"
|
|
|
|
# 4. Fusionner settings.json
|
|
if [ -f "$CLAUDE_DIR/settings.json" ]; then
|
|
echo ">>> settings.json existant - fusion..."
|
|
python3 - << 'PYMERGE'
|
|
import json, os
|
|
home = os.path.expanduser("~")
|
|
rc = json.load(open(f"{home}/.claude/settings.json.rc"))
|
|
existing = json.load(open(f"{home}/.claude/settings.json"))
|
|
for key in ["allow", "deny"]:
|
|
ep = existing.get("permissions", {}).get(key, [])
|
|
rp = rc.get("permissions", {}).get(key, [])
|
|
existing.setdefault("permissions", {})[key] = list(dict.fromkeys(ep + rp))
|
|
with open(f"{home}/.claude/settings.json", "w") as f:
|
|
json.dump(existing, f, indent=2, ensure_ascii=False)
|
|
print("Fusion OK")
|
|
PYMERGE
|
|
else
|
|
cp "$CLAUDE_DIR/settings.json.rc" "$CLAUDE_DIR/settings.json"
|
|
echo ">>> settings.json cree"
|
|
fi
|
|
rm -f "$CLAUDE_DIR/settings.json.rc"
|
|
|
|
echo ""
|
|
echo "=== Installation terminee ==="
|
|
echo ""
|
|
echo "ETAPE MANUELLE :"
|
|
echo " Claude Desktop > Settings > Integrations"
|
|
echo " Connecter Microsoft 365 avec votre compte @reverdin.eu"
|
|
echo ""
|
|
echo "Skills : /rc-brief /rc-writer /research-query /think"
|