-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·76 lines (63 loc) · 2.82 KB
/
install.sh
File metadata and controls
executable file
·76 lines (63 loc) · 2.82 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
#!/usr/bin/env bash
# orcode installer — sets up OpenRouter for Claude Code
# Usage: curl -fsSL https://raw.githubusercontent.com/mokarimi19/orcode/main/install.sh | bash
set -euo pipefail
REPO="mokarimi19/orcode"
INSTALL_DIR="${ORCODE_INSTALL_DIR:-$HOME/.local/bin}"
SCRIPT_URL="https://raw.githubusercontent.com/$REPO/main/bin/orcode"
echo "orcode installer"
echo "================"
echo ""
# ── Check dependencies ────────────────────────────────────────────────
check_dep() {
if ! command -v "$1" &>/dev/null; then
echo "ERROR: $1 is required but not installed."
echo " $2"
exit 1
fi
}
check_dep claude "Install Claude Code: https://docs.anthropic.com/en/docs/claude-code"
check_dep curl "Install curl via your package manager"
check_dep jq "Install jq: brew install jq / apt install jq"
echo "[✓] Dependencies: claude, curl, jq"
# ── Optional: fzf for interactive model selection ─────────────────────
if command -v fzf &>/dev/null; then
echo "[✓] Optional: fzf (interactive model selector available)"
else
echo "[ ] Optional: fzf not found (install for --or-select-model)"
fi
# ── Download ──────────────────────────────────────────────────────────
mkdir -p "$INSTALL_DIR"
echo ""
echo "Downloading orcode to $INSTALL_DIR/orcode ..."
curl -fsSL "$SCRIPT_URL" -o "$INSTALL_DIR/orcode"
chmod +x "$INSTALL_DIR/orcode"
echo "[✓] Installed orcode to $INSTALL_DIR/orcode"
# ── Check PATH ────────────────────────────────────────────────────────
if [[ ":$PATH:" != *":$INSTALL_DIR:"* ]]; then
echo ""
echo "WARNING: $INSTALL_DIR is not in your PATH."
echo ""
echo "Add it by running:"
echo ""
SHELL_NAME=$(basename "$SHELL")
case "$SHELL_NAME" in
zsh) echo " echo 'export PATH=\"$INSTALL_DIR:\$PATH\"' >> ~/.zshrc && source ~/.zshrc" ;;
bash) echo " echo 'export PATH=\"$INSTALL_DIR:\$PATH\"' >> ~/.bashrc && source ~/.bashrc" ;;
fish) echo " fish_add_path $INSTALL_DIR" ;;
*) echo " export PATH=\"$INSTALL_DIR:\$PATH\"" ;;
esac
fi
# ── API key reminder ─────────────────────────────────────────────────
echo ""
if [[ -n "${OPENROUTER_API_KEY:-}" ]]; then
echo "[✓] OPENROUTER_API_KEY is set"
else
echo "Next: set your OpenRouter API key:"
echo ""
echo " export OPENROUTER_API_KEY=\"sk-or-...\""
echo ""
echo " Get one at https://openrouter.ai/keys"
fi
echo ""
echo "Done! Run 'orcode' to start."