-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·64 lines (53 loc) · 1.67 KB
/
install.sh
File metadata and controls
executable file
·64 lines (53 loc) · 1.67 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
#!/bin/bash
# install.sh - Unified installer and patcher for Claude Code
set -e
echo "🛠️ Starting Installation and Patching..."
# 1. Check for Bun
if ! command -v bun &> /dev/null; then
echo "⚠️ Bun is not installed. Please install it first: https://bun.sh"
exit 1
fi
# 2. Get the upstream source directory (Patching Step)
# You can pass the path as an argument or enter it when prompted
if [ -z "$1" ]; then
read -p "📂 Enter the path to the upstream 'src' directory: " SRC_PATH
else
SRC_PATH="$1"
fi
# Expand tilde if present
SRC_PATH="${SRC_PATH/#\~/$HOME}"
# Validate the source path
if [ ! -d "$SRC_PATH" ]; then
echo "❌ Error: Upstream directory '$SRC_PATH' not found."
exit 1
fi
echo "🔄 Step 1: Copying source and applying patches..."
# Ensure we are working with a clean src directory
rm -rf ./src
cp -rv "$SRC_PATH" ./src
if [ -d "patch" ]; then
# Apply local overrides from the patch folder to the current directory
cp -rv patch/* .
echo "✅ Patches applied successfully."
else
echo "⚠️ No 'patch/' folder found. Skipping apply step."
fi
# 3. Install dependencies
echo "📦 Step 2: Installing npm dependencies..."
bun install
# 4. Create initial stubs
echo "🧙 Step 3: Running local module stubber..."
if [ -d "patch" ]; then
# Run from the patch directory if present
echo "Running stubber from 'patch' directory..."
cd patch && npm run stub && cd ..
elif [ -f "package.json" ]; then
# Or run from the current root if it's already the patched app
npm run stub
fi
echo "✅ Installation complete!"
echo ""
echo "📱 To get started:"
echo "Run 'bun run dev' to launch the locally patched Claude Code CLI."
echo ""
echo "🚀 Happy coding!"