replit-tools 1.1.4 → 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/scripts/setup-claude-code.sh +66 -27
package/package.json
CHANGED
|
@@ -132,33 +132,71 @@ fi
|
|
|
132
132
|
# Step 4: Find latest Claude version and create binary symlink
|
|
133
133
|
# =============================================================================
|
|
134
134
|
|
|
135
|
-
#
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
135
|
+
# Check multiple locations for Claude binary (handles race conditions on container restart)
|
|
136
|
+
find_claude_binary() {
|
|
137
|
+
local found_binary=""
|
|
138
|
+
local found_version=""
|
|
139
|
+
|
|
140
|
+
# Priority 1: Our persistent versions directory
|
|
141
|
+
if [ -d "${CLAUDE_VERSIONS}" ]; then
|
|
142
|
+
local ver=$(ls -1 "${CLAUDE_VERSIONS}" 2>/dev/null | grep -v '^\.' | sort -V | tail -n1)
|
|
143
|
+
if [ -n "${ver}" ] && [ -f "${CLAUDE_VERSIONS}/${ver}" ]; then
|
|
144
|
+
found_binary="${CLAUDE_VERSIONS}/${ver}"
|
|
145
|
+
found_version="${ver}"
|
|
146
|
+
fi
|
|
147
|
+
fi
|
|
148
|
+
|
|
149
|
+
# Priority 2: Check if claude command already works (might be from previous install)
|
|
150
|
+
if [ -z "${found_binary}" ]; then
|
|
151
|
+
local existing_claude=$(command -v claude 2>/dev/null)
|
|
152
|
+
if [ -n "${existing_claude}" ] && [ -x "${existing_claude}" ]; then
|
|
153
|
+
# Follow symlinks to find actual binary
|
|
154
|
+
local real_path=$(readlink -f "${existing_claude}" 2>/dev/null)
|
|
155
|
+
if [ -f "${real_path}" ]; then
|
|
156
|
+
found_binary="${real_path}"
|
|
157
|
+
found_version=$(basename "${real_path}")
|
|
144
158
|
fi
|
|
145
159
|
fi
|
|
146
|
-
|
|
147
|
-
fi
|
|
160
|
+
fi
|
|
148
161
|
|
|
149
|
-
|
|
150
|
-
if [ -
|
|
151
|
-
|
|
152
|
-
|
|
162
|
+
# Priority 3: Default install location (not through our symlink)
|
|
163
|
+
if [ -z "${found_binary}" ]; then
|
|
164
|
+
local default_loc="${HOME}/.local/share/claude/versions"
|
|
165
|
+
# Check if this is a real directory, not our symlink
|
|
166
|
+
if [ -d "${default_loc}" ] && [ ! -L "${default_loc}" ]; then
|
|
167
|
+
local ver=$(ls -1 "${default_loc}" 2>/dev/null | grep -v '^\.' | sort -V | tail -n1)
|
|
168
|
+
if [ -n "${ver}" ] && [ -f "${default_loc}/${ver}" ]; then
|
|
169
|
+
found_binary="${default_loc}/${ver}"
|
|
170
|
+
found_version="${ver}"
|
|
171
|
+
fi
|
|
172
|
+
fi
|
|
173
|
+
fi
|
|
174
|
+
|
|
175
|
+
# Return results via global variables
|
|
176
|
+
FOUND_CLAUDE_BINARY="${found_binary}"
|
|
177
|
+
FOUND_CLAUDE_VERSION="${found_version}"
|
|
178
|
+
}
|
|
153
179
|
|
|
154
|
-
|
|
155
|
-
|
|
180
|
+
# Find any existing Claude installation
|
|
181
|
+
find_claude_binary
|
|
182
|
+
|
|
183
|
+
if [ -n "${FOUND_CLAUDE_BINARY}" ]; then
|
|
184
|
+
CLAUDE_BINARY="${FOUND_CLAUDE_BINARY}"
|
|
185
|
+
LATEST_VERSION="${FOUND_CLAUDE_VERSION}"
|
|
186
|
+
|
|
187
|
+
# Ensure binary is in our persistent directory
|
|
188
|
+
if [ ! -f "${CLAUDE_VERSIONS}/${LATEST_VERSION}" ]; then
|
|
189
|
+
cp -p "${CLAUDE_BINARY}" "${CLAUDE_VERSIONS}/${LATEST_VERSION}" 2>/dev/null || true
|
|
190
|
+
chmod 755 "${CLAUDE_VERSIONS}/${LATEST_VERSION}" 2>/dev/null || true
|
|
191
|
+
CLAUDE_BINARY="${CLAUDE_VERSIONS}/${LATEST_VERSION}"
|
|
192
|
+
log "✅ Claude ${LATEST_VERSION} synced to persistent storage"
|
|
193
|
+
fi
|
|
156
194
|
|
|
157
195
|
# Create or update the binary symlink
|
|
158
|
-
if [ ! -L "${LOCAL_BIN}/claude" ] || [ "$(readlink -f "${LOCAL_BIN}/claude")" != "${
|
|
196
|
+
if [ ! -L "${LOCAL_BIN}/claude" ] || [ "$(readlink -f "${LOCAL_BIN}/claude")" != "${CLAUDE_VERSIONS}/${LATEST_VERSION}" ]; then
|
|
159
197
|
rm -f "${LOCAL_BIN}/claude" 2>/dev/null || true
|
|
160
|
-
ln -sf "${
|
|
161
|
-
log "✅ Claude binary symlink: ~/.local/bin/claude -> ${
|
|
198
|
+
ln -sf "${CLAUDE_VERSIONS}/${LATEST_VERSION}" "${LOCAL_BIN}/claude"
|
|
199
|
+
log "✅ Claude binary symlink: ~/.local/bin/claude -> ${CLAUDE_VERSIONS}/${LATEST_VERSION}"
|
|
162
200
|
fi
|
|
163
201
|
else
|
|
164
202
|
# Claude not installed - install it
|
|
@@ -166,15 +204,16 @@ else
|
|
|
166
204
|
|
|
167
205
|
# Install Claude Code using the official installer
|
|
168
206
|
if curl -fsSL https://claude.ai/install.sh | bash 2>/dev/null; then
|
|
169
|
-
# After install,
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
207
|
+
# After install, find and sync the binary
|
|
208
|
+
find_claude_binary
|
|
209
|
+
if [ -n "${FOUND_CLAUDE_BINARY}" ]; then
|
|
210
|
+
LATEST_VERSION="${FOUND_CLAUDE_VERSION}"
|
|
211
|
+
if [ ! -f "${CLAUDE_VERSIONS}/${LATEST_VERSION}" ]; then
|
|
212
|
+
cp -p "${FOUND_CLAUDE_BINARY}" "${CLAUDE_VERSIONS}/${LATEST_VERSION}" 2>/dev/null || true
|
|
174
213
|
chmod 755 "${CLAUDE_VERSIONS}/${LATEST_VERSION}" 2>/dev/null || true
|
|
175
|
-
ln -sf "${CLAUDE_VERSIONS}/${LATEST_VERSION}" "${LOCAL_BIN}/claude"
|
|
176
|
-
log "✅ Claude Code ${LATEST_VERSION} installed"
|
|
177
214
|
fi
|
|
215
|
+
ln -sf "${CLAUDE_VERSIONS}/${LATEST_VERSION}" "${LOCAL_BIN}/claude"
|
|
216
|
+
log "✅ Claude Code ${LATEST_VERSION} installed"
|
|
178
217
|
fi
|
|
179
218
|
else
|
|
180
219
|
log "❌ Failed to install Claude Code"
|