-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·151 lines (128 loc) · 4.87 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·151 lines (128 loc) · 4.87 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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#!/usr/bin/env bash
set -euo pipefail
# Explorium CLI + Claude Code Skill Installer
# Usage: curl -fsSL https://raw.githubusercontent.com/haroExplorium/explorium-cli/main/install.sh | bash
REPO="haroExplorium/explorium-cli"
BIN_DIR="$HOME/.local/bin"
SKILL_DIR="$HOME/.claude/skills/explorium-cli"
BINARY_NAME="explorium"
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
info() { printf "${BLUE}==>${NC} %s\n" "$1"; }
ok() { printf "${GREEN}==>${NC} %s\n" "$1"; }
warn() { printf "${YELLOW}==>${NC} %s\n" "$1"; }
error() { printf "${RED}Error:${NC} %s\n" "$1" >&2; exit 1; }
# -------------------------------------------------------------------
# 1. Detect platform and architecture
# -------------------------------------------------------------------
OS="$(uname -s)"
ARCH="$(uname -m)"
case "$OS" in
Darwin)
case "$ARCH" in
arm64) ASSET_NAME="explorium-darwin-arm64" ;;
x86_64) error "macOS x86_64 is not supported. Apple Silicon (arm64) required." ;;
*) error "Unsupported macOS architecture: $ARCH" ;;
esac
;;
Linux)
case "$ARCH" in
x86_64|amd64) ASSET_NAME="explorium-linux-amd64" ;;
aarch64|arm64) ASSET_NAME="explorium-linux-arm64" ;;
*) error "Unsupported Linux architecture: $ARCH" ;;
esac
;;
*)
error "Unsupported OS: $OS. Only macOS and Linux are supported."
;;
esac
info "Detected ${OS} ${ARCH} — downloading ${ASSET_NAME}"
# -------------------------------------------------------------------
# 2. Check dependencies
# -------------------------------------------------------------------
if ! command -v curl &>/dev/null; then
error "curl is required but not found. Please install it and retry."
fi
# -------------------------------------------------------------------
# 3. Create directories
# -------------------------------------------------------------------
info "Creating directories..."
mkdir -p "$BIN_DIR"
mkdir -p "$SKILL_DIR"
# -------------------------------------------------------------------
# 4. Download CLI binary from GitHub releases (latest)
# -------------------------------------------------------------------
info "Downloading Explorium CLI binary..."
RELEASE_URL="https://github.com/${REPO}/releases/latest/download/${ASSET_NAME}"
if ! curl -fSL --progress-bar "$RELEASE_URL" -o "${BIN_DIR}/${BINARY_NAME}"; then
error "Failed to download CLI binary from ${RELEASE_URL}
Make sure the release exists at: https://github.com/${REPO}/releases/latest"
fi
chmod +x "${BIN_DIR}/${BINARY_NAME}"
ok "CLI binary installed to ${BIN_DIR}/${BINARY_NAME}"
# -------------------------------------------------------------------
# 5. Download SKILL.md from repo
# -------------------------------------------------------------------
info "Downloading Claude Code skill..."
SKILL_URL="https://raw.githubusercontent.com/${REPO}/main/skills/SKILL.md"
if ! curl -fsSL "$SKILL_URL" -o "${SKILL_DIR}/SKILL.md"; then
warn "Failed to download SKILL.md from ${SKILL_URL}"
warn "Skill installation skipped — CLI will still work without it."
else
ok "Skill installed to ${SKILL_DIR}/SKILL.md"
fi
# -------------------------------------------------------------------
# 6. Add ~/.local/bin to PATH if needed
# -------------------------------------------------------------------
SHELL_NAME="$(basename "${SHELL:-/bin/bash}")"
PROFILE=""
case "$SHELL_NAME" in
zsh) PROFILE="$HOME/.zshrc" ;;
bash) PROFILE="$HOME/.bashrc" ;;
*) PROFILE="$HOME/.profile" ;;
esac
if [[ ":$PATH:" != *":$BIN_DIR:"* ]]; then
info "Adding ${BIN_DIR} to PATH in ${PROFILE}..."
{
echo ""
echo "# Explorium CLI"
echo "export PATH=\"\$HOME/.local/bin:\$PATH\""
} >> "$PROFILE"
ok "PATH updated in ${PROFILE}"
NEED_SOURCE=true
else
ok "${BIN_DIR} is already in PATH"
NEED_SOURCE=false
fi
# -------------------------------------------------------------------
# 7. Verify installation
# -------------------------------------------------------------------
info "Verifying installation..."
export PATH="$BIN_DIR:$PATH"
if "${BIN_DIR}/${BINARY_NAME}" --help &>/dev/null; then
ok "Explorium CLI is working"
else
warn "Binary downloaded but verification failed. You may need to restart your terminal."
fi
# -------------------------------------------------------------------
# 8. Print next steps
# -------------------------------------------------------------------
echo ""
printf "${GREEN}Installation complete!${NC}\n"
echo ""
echo "Next steps:"
echo ""
echo " 1. Configure your API key:"
echo " explorium config init --api-key <YOUR_API_KEY>"
echo ""
if [[ "$NEED_SOURCE" == true ]]; then
echo " 2. Restart your terminal or run:"
echo " source ${PROFILE}"
echo ""
fi
echo "Documentation: https://github.com/${REPO}#readme"
echo ""