-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathinstall.sh
More file actions
134 lines (117 loc) · 3.67 KB
/
install.sh
File metadata and controls
134 lines (117 loc) · 3.67 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
#!/bin/bash
set -euo pipefail
DEVA_LAUNCHER="deva.sh"
LEGACY_WRAPPER="claude.sh"
YOLO_WRAPPER="claude-yolo"
INSTALL_BASE_URL="${DEVA_INSTALL_BASE_URL:-https://raw.githubusercontent.com/thevibeworks/deva/main}"
agent_files=(
"claude.sh"
"codex.sh"
"gemini.sh"
"shared_auth.sh"
)
image_ref() {
local repo="$1"
local tag="${2:-}"
local default_tag="$3"
local tail="${repo##*/}"
if [[ "$repo" == *@* ]]; then
printf '%s' "$repo"
return
fi
if [ -n "$tag" ]; then
printf '%s:%s' "$repo" "$tag"
return
fi
if [[ "$tail" == *:* ]]; then
printf '%s' "$repo"
return
fi
printf '%s:%s' "$repo" "$default_tag"
}
if [ -n "${DEVA_DOCKER_IMAGE+x}" ]; then
DOCKER_IMAGE="$(image_ref "$DEVA_DOCKER_IMAGE" "${DEVA_DOCKER_TAG:-}" "latest")"
else
DOCKER_IMAGE="$(image_ref "ghcr.io/thevibeworks/deva" "${DEVA_DOCKER_TAG:-}" "latest")"
fi
if [ -n "${DEVA_DOCKER_IMAGE_FALLBACK+x}" ]; then
if [ -n "$DEVA_DOCKER_IMAGE_FALLBACK" ]; then
DOCKER_IMAGE_FALLBACK="$(image_ref "$DEVA_DOCKER_IMAGE_FALLBACK" "${DEVA_DOCKER_IMAGE_FALLBACK_TAG:-${DEVA_DOCKER_TAG:-}}" "latest")"
else
DOCKER_IMAGE_FALLBACK=""
fi
else
DOCKER_IMAGE_FALLBACK="$(image_ref "thevibeworks/deva" "${DEVA_DOCKER_IMAGE_FALLBACK_TAG:-${DEVA_DOCKER_TAG:-}}" "latest")"
fi
echo "deva installer"
echo "=============="
echo ""
if [ -d "$HOME/.local/bin" ] && [[ ":$PATH:" == *":$HOME/.local/bin:"* ]]; then
INSTALL_DIR="$HOME/.local/bin"
elif [ -w "/usr/local/bin" ]; then
INSTALL_DIR="/usr/local/bin"
else
INSTALL_DIR="$HOME/.local/bin"
mkdir -p "$INSTALL_DIR"
if [[ ":$PATH:" != *":$INSTALL_DIR:"* ]]; then
echo "warning: $INSTALL_DIR is not in PATH"
echo "add this to your shell profile:"
echo " export PATH=\"\$HOME/.local/bin:\$PATH\""
echo ""
fi
fi
echo "Installing to: $INSTALL_DIR"
download() {
local path="$1"
local dest="$2"
curl -fsSL "$INSTALL_BASE_URL/$path" -o "$dest"
chmod +x "$dest"
}
echo "Downloading launchers..."
download "$LEGACY_WRAPPER" "$INSTALL_DIR/$LEGACY_WRAPPER"
download "$YOLO_WRAPPER" "$INSTALL_DIR/$YOLO_WRAPPER"
download "$DEVA_LAUNCHER" "$INSTALL_DIR/$DEVA_LAUNCHER"
echo "Downloading agent modules..."
mkdir -p "$INSTALL_DIR/agents"
for file in "${agent_files[@]}"; do
download "agents/$file" "$INSTALL_DIR/agents/$file"
done
echo ""
if docker image inspect "$DOCKER_IMAGE" >/dev/null 2>&1; then
echo "Using local Docker image: $DOCKER_IMAGE"
else
echo "Pulling Docker image..."
if ! docker pull "$DOCKER_IMAGE"; then
if [ -n "$DOCKER_IMAGE_FALLBACK" ] && [ "$DOCKER_IMAGE_FALLBACK" != "$DOCKER_IMAGE" ]; then
echo "Primary pull failed. Trying fallback image..."
docker pull "$DOCKER_IMAGE_FALLBACK"
echo ""
echo "warning: using fallback image $DOCKER_IMAGE_FALLBACK"
else
echo "error: failed to pull Docker image $DOCKER_IMAGE" >&2
exit 1
fi
fi
fi
echo ""
echo "Install complete."
echo ""
echo "Installed:"
echo " - $INSTALL_DIR/deva.sh"
echo " - $INSTALL_DIR/claude.sh"
echo " - $INSTALL_DIR/claude-yolo"
echo " - $INSTALL_DIR/agents/claude.sh"
echo " - $INSTALL_DIR/agents/codex.sh"
echo " - $INSTALL_DIR/agents/gemini.sh"
echo " - $INSTALL_DIR/agents/shared_auth.sh"
echo ""
echo "Quick start:"
echo " 1. Make sure Docker is running"
echo " 2. cd into a project"
echo " 3. Run one of:"
echo " deva.sh codex"
echo " deva.sh claude -- --help"
echo " deva.sh gemini -- --help"
echo " deva.sh shell"
echo ""
echo "warning: do not point deva at your real home directory with dangerous permissions enabled"