-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·104 lines (91 loc) · 3.27 KB
/
install.sh
File metadata and controls
executable file
·104 lines (91 loc) · 3.27 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/bin/bash
# Installation script for Try Claude Code Plugin
set -e
PLUGIN_NAME="try-integration"
PLUGIN_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
CLAUDE_DIR="${HOME}/.claude"
HOOKS_DIR="${CLAUDE_DIR}/hooks/${PLUGIN_NAME}"
SKILLS_DIR="${CLAUDE_DIR}/skills"
SETTINGS_FILE="${CLAUDE_DIR}/settings.json"
echo "============================================"
echo " Try Claude Code Plugin Installer"
echo "============================================"
echo ""
# Check if try is installed
if ! command -v try &> /dev/null; then
echo "Error: 'try' command not found."
echo ""
echo "Please install try first:"
echo " mkdir -p ~/.local/bin"
echo " curl -o ~/.local/bin/try https://raw.githubusercontent.com/binpash/try/main/try"
echo " chmod +x ~/.local/bin/try"
echo ""
echo "Or follow the installation instructions at:"
echo " https://github.com/binpash/try#installing"
exit 1
fi
echo "✓ Found try version: $(try -v)"
echo ""
# Create necessary directories
echo "Creating directories..."
mkdir -p "${HOOKS_DIR}"
mkdir -p "${SKILLS_DIR}/try-commit"
mkdir -p "${SKILLS_DIR}/try-status"
mkdir -p "${CLAUDE_DIR}/session-state"
mkdir -p "${CLAUDE_DIR}/try-sessions"
# Copy hooks
echo "Installing hooks..."
cp "${PLUGIN_DIR}/hooks/session-start.sh" "${HOOKS_DIR}/"
cp "${PLUGIN_DIR}/hooks/session-end.sh" "${HOOKS_DIR}/"
chmod +x "${HOOKS_DIR}"/*.sh
# Copy skills
echo "Installing skills..."
cp -r "${PLUGIN_DIR}/skills/try-commit/"* "${SKILLS_DIR}/try-commit/"
cp -r "${PLUGIN_DIR}/skills/try-status/"* "${SKILLS_DIR}/try-status/"
chmod +x "${SKILLS_DIR}/try-commit"/*.sh
chmod +x "${SKILLS_DIR}/try-status"/*.sh
# Configure settings
echo "Configuring settings..."
# Read template and replace {{PLUGIN_PATH}} with actual path
SETTINGS_CONTENT=$(cat "${PLUGIN_DIR}/settings.template.json" | sed "s|{{PLUGIN_PATH}}|${HOOKS_DIR}|g")
if [ -f "${SETTINGS_FILE}" ]; then
echo ""
echo "Warning: ${SETTINGS_FILE} already exists."
echo ""
echo "Please manually merge the following configuration into your settings.json:"
echo ""
echo "${SETTINGS_CONTENT}"
echo ""
echo "Or backup your current settings and let this script overwrite it."
read -p "Overwrite ${SETTINGS_FILE}? [y/N]: " OVERWRITE
if [ "$OVERWRITE" = "y" ] || [ "$OVERWRITE" = "Y" ]; then
echo "${SETTINGS_CONTENT}" > "${SETTINGS_FILE}"
echo "✓ Settings updated"
else
echo "Settings not modified. Manual configuration required."
fi
else
echo "${SETTINGS_CONTENT}" > "${SETTINGS_FILE}"
echo "✓ Settings created"
fi
echo ""
echo "============================================"
echo " Installation Complete!"
echo "============================================"
echo ""
echo "The Try integration plugin has been installed."
echo ""
echo "Installed components:"
echo " - Hooks: ${HOOKS_DIR}"
echo " - Skills: ${SKILLS_DIR}/try-{commit,status}"
echo " - Settings: ${SETTINGS_FILE}"
echo ""
echo "In your next Claude Code session:"
echo " - All state-modifying Bash commands will be sandboxed"
echo " - Use /try-status to check pending changes"
echo " - Use /try-commit to commit changes mid-session"
echo " - At session end, you'll be prompted to commit or discard"
echo ""
echo "For more information, see:"
echo " ${PLUGIN_DIR}/README.md"
echo ""