-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
91 lines (76 loc) · 2.49 KB
/
install.sh
File metadata and controls
91 lines (76 loc) · 2.49 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
#!/bin/bash
set -e
# Lark — Multi-agent workspace installer
# Usage: curl -fsSL https://raw.githubusercontent.com/GrayCodeAI/lark-cli/main/install.sh | bash
REPO="GrayCodeAI/lark-cli"
BINARY="lark"
INSTALL_DIR="${INSTALL_DIR:-/usr/local/bin}"
echo "🐦 Installing Lark..."
# Detect OS and architecture
OS="$(uname -s | tr '[:upper:]' '[:lower:]')"
ARCH="$(uname -m)"
case "$OS" in
linux) PLATFORM="linux" ;;
darwin) PLATFORM="darwin" ;;
*) echo "❌ Unsupported OS: $OS"; exit 1 ;;
esac
case "$ARCH" in
x86_64|amd64) ARCH="amd64" ;;
arm64|aarch64) ARCH="arm64" ;;
*) echo "❌ Unsupported architecture: $ARCH"; exit 1 ;;
esac
# Get latest release tag
TAG=$(curl -fsSL "https://api.github.com/repos/$REPO/releases/latest" 2>/dev/null | grep '"tag_name"' | sed -E 's/.*"([^"]+)".*/\1/' || echo "")
# Fallback to known tag if API fails (private repos)
if [ -z "$TAG" ]; then
TAG="v0.1.0"
fi
# Try downloading prebuilt binary
URL="https://github.com/$REPO/releases/download/$TAG/${BINARY}-${PLATFORM}-${ARCH}"
echo "📥 Downloading $TAG..."
if curl -fsSL "$URL" -o "$INSTALL_DIR/$BINARY" 2>/dev/null; then
chmod +x "$INSTALL_DIR/$BINARY"
else
echo "⚠️ Download failed, building from source..."
# Check prerequisites
if ! command -v go &>/dev/null; then
# Try common Go locations
if [ -x "$HOME/local/go/bin/go" ]; then
export PATH="$HOME/local/go/bin:$PATH"
elif [ -x "/usr/local/go/bin/go" ]; then
export PATH="/usr/local/go/bin:$PATH"
else
echo "❌ Go not found. Install from https://go.dev/dl/"
exit 1
fi
fi
TMPDIR=$(mktemp -d)
echo "📦 Cloning lark-cli..."
git clone --depth 1 https://github.com/GrayCodeAI/lark-cli.git "$TMPDIR/lark-cli"
cd "$TMPDIR/lark-cli"
echo "🔨 Building..."
go build -o "$BINARY" ./cmd/lark-cli/
echo "📥 Installing to $INSTALL_DIR..."
mkdir -p "$INSTALL_DIR"
mv "$BINARY" "$INSTALL_DIR/"
chmod +x "$INSTALL_DIR/$BINARY"
cd /
rm -rf "$TMPDIR"
fi
# Verify
if command -v "$BINARY" &>/dev/null; then
echo ""
echo "✅ Lark installed successfully!"
echo ""
echo "Quick start:"
echo " lark init # Initialize a project"
echo " lark connect claude # Connect an agent"
echo " lark send general 'Hello from Lark!'"
echo " lark status # Check connection"
echo ""
echo "Docs: https://github.com/GrayCodeAI/lark-cli"
else
echo ""
echo "⚠️ Installed to $INSTALL_DIR/$BINARY"
echo " Add to PATH: export PATH=\"$INSTALL_DIR:\$PATH\""
fi