-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·98 lines (76 loc) · 2.32 KB
/
install.sh
File metadata and controls
executable file
·98 lines (76 loc) · 2.32 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
#!/bin/bash
# Install script for @mcp-shark/cli
# Downloads and installs the CLI from GitHub releases
set -e
# Colors
GREEN='\033[0;32m'
BLUE='\033[0;34m'
YELLOW='\033[1;33m'
NC='\033[0m'
# Configuration
REPO="mcp-shark-org/cli"
VERSION="${VERSION:-latest}"
INSTALL_DIR="${INSTALL_DIR:-$HOME/.local/bin}"
BINARY_NAME="mcp-shark-cli"
echo -e "${BLUE}Installing @mcp-shark/cli...${NC}"
# Detect OS and architecture
OS="$(uname -s | tr '[:upper:]' '[:lower:]')"
ARCH="$(uname -m)"
# Map architecture
case "$ARCH" in
x86_64) ARCH="x64" ;;
arm64|aarch64) ARCH="arm64" ;;
*) echo "Unsupported architecture: $ARCH"; exit 1 ;;
esac
# Create install directory
mkdir -p "$INSTALL_DIR"
# Determine download URL
if [ "$VERSION" = "latest" ]; then
# Get latest release
LATEST_TAG=$(curl -s "https://api.github.com/repos/$REPO/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
VERSION="$LATEST_TAG"
fi
echo -e "${YELLOW}Installing version: $VERSION${NC}"
# Download from GitHub
GITHUB_URL="https://github.com/$REPO/archive/refs/tags/$VERSION.tar.gz"
# Create temporary directory
TMP_DIR=$(mktemp -d)
trap "rm -rf $TMP_DIR" EXIT
echo -e "${BLUE}Downloading from GitHub...${NC}"
curl -L "$GITHUB_URL" -o "$TMP_DIR/cli.tar.gz"
# Extract
echo -e "${BLUE}Extracting...${NC}"
cd "$TMP_DIR"
tar -xzf cli.tar.gz
CLI_DIR=$(find . -maxdepth 1 -type d -name "cli-*" | head -1)
if [ -z "$CLI_DIR" ]; then
echo "Error: Could not find CLI directory in archive"
exit 1
fi
# Install dependencies and create executable
cd "$CLI_DIR"
echo -e "${BLUE}Installing dependencies...${NC}"
npm install --production
# Create wrapper script
cat > "$INSTALL_DIR/$BINARY_NAME" << 'WRAPPER_EOF'
#!/bin/bash
# Wrapper script for @mcp-shark/cli
CLI_DIR="${MCP_SHARK_CLI_DIR:-$HOME/.local/lib/mcp-shark-cli}"
exec node "$CLI_DIR/cli.js" "$@"
WRAPPER_EOF
chmod +x "$INSTALL_DIR/$BINARY_NAME"
# Copy CLI to lib directory
LIB_DIR="$HOME/.local/lib/mcp-shark-cli"
mkdir -p "$LIB_DIR"
cp -r . "$LIB_DIR/"
# Set environment variable for wrapper
export MCP_SHARK_CLI_DIR="$LIB_DIR"
echo -e "${GREEN}✓ Installation complete!${NC}"
echo ""
echo "The CLI has been installed to: $INSTALL_DIR/$BINARY_NAME"
echo ""
echo "To use it, add to your PATH:"
echo " export PATH=\"\$PATH:$INSTALL_DIR\""
echo ""
echo "Or run directly:"
echo " $INSTALL_DIR/$BINARY_NAME --help"