-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·60 lines (52 loc) · 1.69 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·60 lines (52 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/env bash
# buddy-log installer
#
# Copies scripts and hooks into ~/.claude/ and configures the
# UserPromptSubmit hook for automatic companion message injection.
set -euo pipefail
REPO_DIR="$(cd "$(dirname "$0")" && pwd)"
echo "Installing buddy-log..."
# Copy scripts
mkdir -p "${HOME}/.claude/scripts"
cp "${REPO_DIR}/scripts/buddy-extract.py" "${HOME}/.claude/scripts/"
cp "${REPO_DIR}/scripts/buddy-log.sh" "${HOME}/.claude/scripts/"
cp "${REPO_DIR}/scripts/claude-log.sh" "${HOME}/.claude/scripts/"
chmod +x "${HOME}/.claude/scripts/buddy-extract.py" \
"${HOME}/.claude/scripts/buddy-log.sh" \
"${HOME}/.claude/scripts/claude-log.sh"
# Copy hooks
mkdir -p "${HOME}/.claude/hooks"
cp "${REPO_DIR}/hooks/buddy-contribute.sh" "${HOME}/.claude/hooks/"
chmod +x "${HOME}/.claude/hooks/buddy-contribute.sh"
echo "Scripts installed to ~/.claude/scripts/"
echo "Hook installed to ~/.claude/hooks/"
echo ""
# Check if hook is already configured
if grep -q 'buddy-contribute' "${HOME}/.claude/settings.json" 2>/dev/null; then
echo "Hook already configured in settings.json"
else
echo "To enable auto-injection, add this to ~/.claude/settings.json:"
echo ""
cat <<'HOOK'
"hooks": {
"UserPromptSubmit": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "$HOME/.claude/hooks/buddy-contribute.sh"
}
]
}
]
}
HOOK
echo ""
fi
echo "Add these aliases to your shell rc file:"
echo ""
echo " alias claude-log='~/.claude/scripts/claude-log.sh'"
echo " alias buddy-log='~/.claude/scripts/buddy-log.sh'"
echo ""
echo "Done! Run 'claude-log' to start a session with companion logging."