Repository navigation
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·132 lines (115 loc) · 3.23 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·132 lines (115 loc) · 3.23 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#!/bin/bash
set -e
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Repository info
REPO="lukemuz/CodeGraph"
BINARY_NAME="codegraph"
# Detect OS and architecture
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)
# Map architecture names
case $ARCH in
x86_64) TARGET_ARCH="x86_64" ;;
arm64|aarch64) TARGET_ARCH="aarch64" ;;
*)
echo -e "${RED}Error: Unsupported architecture $ARCH${NC}"
exit 1
;;
esac
# Map OS names and set target
case $OS in
linux)
TARGET="${TARGET_ARCH}-unknown-linux-musl"
ARCHIVE_EXT="tar.gz"
;;
darwin)
if [ "$TARGET_ARCH" = "aarch64" ]; then
TARGET="aarch64-apple-darwin"
else
TARGET="x86_64-apple-darwin"
fi
ARCHIVE_EXT="tar.gz"
;;
mingw*|cygwin*|msys*)
TARGET="x86_64-pc-windows-msvc"
ARCHIVE_EXT="zip"
BINARY_NAME="codegraph.exe"
;;
*)
echo -e "${RED}Error: Unsupported OS $OS${NC}"
exit 1
;;
esac
echo -e "${YELLOW}Detected platform: $TARGET${NC}"
# Get the latest release URL
echo -e "${YELLOW}Fetching latest release...${NC}"
RELEASE_URL=$(curl -s "https://api.github.com/repos/$REPO/releases/latest" | \
grep "browser_download_url.*$TARGET\.$ARCHIVE_EXT" | \
cut -d '"' -f 4)
if [ -z "$RELEASE_URL" ]; then
echo -e "${RED}Error: No release found for platform $TARGET${NC}"
echo -e "${YELLOW}Available releases:${NC}"
curl -s "https://api.github.com/repos/$REPO/releases/latest" | \
grep "browser_download_url" | \
cut -d '"' -f 4 | \
sed 's/.*\// - /'
exit 1
fi
# Create temporary directory
TEMP_DIR=$(mktemp -d)
cd "$TEMP_DIR"
echo -e "${YELLOW}Downloading $RELEASE_URL...${NC}"
curl -L -o "archive.$ARCHIVE_EXT" "$RELEASE_URL"
# Extract archive
echo -e "${YELLOW}Extracting archive...${NC}"
if [ "$ARCHIVE_EXT" = "tar.gz" ]; then
tar -xzf "archive.$ARCHIVE_EXT"
elif [ "$ARCHIVE_EXT" = "zip" ]; then
unzip "archive.$ARCHIVE_EXT"
fi
# Find the binary
BINARY_PATH=$(find . -name "$BINARY_NAME" -type f | head -1)
if [ -z "$BINARY_PATH" ]; then
echo -e "${RED}Error: Binary not found in archive${NC}"
exit 1
fi
# Install binary
INSTALL_DIR="$HOME/.local/bin"
mkdir -p "$INSTALL_DIR"
echo -e "${YELLOW}Installing to $INSTALL_DIR/$BINARY_NAME...${NC}"
cp "$BINARY_PATH" "$INSTALL_DIR/$BINARY_NAME"
chmod +x "$INSTALL_DIR/$BINARY_NAME"
# Cleanup
cd /
rm -rf "$TEMP_DIR"
echo -e "${GREEN}✅ CodeGraph installed successfully!${NC}"
echo
echo -e "${YELLOW}Quick Setup (Recommended):${NC}"
echo "Add CodeGraph to your MCP client with ONE of these methods:"
echo
echo -e "${GREEN}Option 1: Claude Code Desktop${NC}"
echo "Run this command:"
echo " claude mcp add codegraph $INSTALL_DIR/$BINARY_NAME mcp"
echo
echo -e "${GREEN}Option 2: Cursor${NC}"
echo "Add to ~/.cursor/mcp.json:"
echo '{'
echo ' "mcpServers": {'
echo ' "codegraph": {'
echo ' "command": "'$INSTALL_DIR/$BINARY_NAME'",'
echo ' "args": ["mcp"],'
echo ' "env": {'
echo ' "CODEGRAPH_PROJECT": "/path/to/your/project"'
echo ' }'
echo ' }'
echo ' }'
echo '}'
echo
echo -e "${YELLOW}Note:${NC} CodeGraph will automatically index your project on first use!"
echo "No manual setup required - just point it at your project directory."
echo
echo -e "${GREEN}Happy coding! 🚀${NC}"