replit-tools 1.1.4 → 1.1.6
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 +78 -28
package/package.json
CHANGED
|
@@ -73,7 +73,8 @@ auto_update_scripts() {
|
|
|
73
73
|
return 1
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
if
|
|
76
|
+
# Skip update check if we just re-sourced after an update
|
|
77
|
+
if [[ $- == *i* ]] && [ -z "${_REPLIT_TOOLS_UPDATED}" ]; then
|
|
77
78
|
CURRENT_VERSION=""
|
|
78
79
|
if [ -f "${VERSION_FILE}" ]; then
|
|
79
80
|
CURRENT_VERSION=$(cat "${VERSION_FILE}" 2>/dev/null)
|
|
@@ -89,6 +90,11 @@ if [[ $- == *i* ]]; then
|
|
|
89
90
|
|
|
90
91
|
if auto_update_scripts "${LATEST_VERSION}"; then
|
|
91
92
|
echo " ✅ Updated to v${LATEST_VERSION}"
|
|
93
|
+
# Re-source the updated script so new code runs
|
|
94
|
+
export _REPLIT_TOOLS_UPDATED=1
|
|
95
|
+
source "${SCRIPTS_DIR}/setup-claude-code.sh"
|
|
96
|
+
unset _REPLIT_TOOLS_UPDATED
|
|
97
|
+
return 0 2>/dev/null || exit 0
|
|
92
98
|
else
|
|
93
99
|
echo " ⚠️ Auto-update failed, continuing with v${CURRENT_VERSION}"
|
|
94
100
|
fi
|
|
@@ -96,6 +102,11 @@ if [[ $- == *i* ]]; then
|
|
|
96
102
|
echo "📦 DATA Tools v${CURRENT_VERSION}"
|
|
97
103
|
fi
|
|
98
104
|
fi
|
|
105
|
+
elif [[ $- == *i* ]] && [ -n "${_REPLIT_TOOLS_UPDATED}" ]; then
|
|
106
|
+
# Show version after re-source
|
|
107
|
+
if [ -f "${VERSION_FILE}" ]; then
|
|
108
|
+
echo "📦 DATA Tools v$(cat "${VERSION_FILE}" 2>/dev/null)"
|
|
109
|
+
fi
|
|
99
110
|
fi
|
|
100
111
|
|
|
101
112
|
# =============================================================================
|
|
@@ -132,33 +143,71 @@ fi
|
|
|
132
143
|
# Step 4: Find latest Claude version and create binary symlink
|
|
133
144
|
# =============================================================================
|
|
134
145
|
|
|
135
|
-
#
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
146
|
+
# Check multiple locations for Claude binary (handles race conditions on container restart)
|
|
147
|
+
find_claude_binary() {
|
|
148
|
+
local found_binary=""
|
|
149
|
+
local found_version=""
|
|
150
|
+
|
|
151
|
+
# Priority 1: Our persistent versions directory
|
|
152
|
+
if [ -d "${CLAUDE_VERSIONS}" ]; then
|
|
153
|
+
local ver=$(ls -1 "${CLAUDE_VERSIONS}" 2>/dev/null | grep -v '^\.' | sort -V | tail -n1)
|
|
154
|
+
if [ -n "${ver}" ] && [ -f "${CLAUDE_VERSIONS}/${ver}" ]; then
|
|
155
|
+
found_binary="${CLAUDE_VERSIONS}/${ver}"
|
|
156
|
+
found_version="${ver}"
|
|
157
|
+
fi
|
|
158
|
+
fi
|
|
159
|
+
|
|
160
|
+
# Priority 2: Check if claude command already works (might be from previous install)
|
|
161
|
+
if [ -z "${found_binary}" ]; then
|
|
162
|
+
local existing_claude=$(command -v claude 2>/dev/null)
|
|
163
|
+
if [ -n "${existing_claude}" ] && [ -x "${existing_claude}" ]; then
|
|
164
|
+
# Follow symlinks to find actual binary
|
|
165
|
+
local real_path=$(readlink -f "${existing_claude}" 2>/dev/null)
|
|
166
|
+
if [ -f "${real_path}" ]; then
|
|
167
|
+
found_binary="${real_path}"
|
|
168
|
+
found_version=$(basename "${real_path}")
|
|
144
169
|
fi
|
|
145
170
|
fi
|
|
146
|
-
|
|
147
|
-
fi
|
|
171
|
+
fi
|
|
148
172
|
|
|
149
|
-
|
|
150
|
-
if [ -
|
|
151
|
-
|
|
152
|
-
|
|
173
|
+
# Priority 3: Default install location (not through our symlink)
|
|
174
|
+
if [ -z "${found_binary}" ]; then
|
|
175
|
+
local default_loc="${HOME}/.local/share/claude/versions"
|
|
176
|
+
# Check if this is a real directory, not our symlink
|
|
177
|
+
if [ -d "${default_loc}" ] && [ ! -L "${default_loc}" ]; then
|
|
178
|
+
local ver=$(ls -1 "${default_loc}" 2>/dev/null | grep -v '^\.' | sort -V | tail -n1)
|
|
179
|
+
if [ -n "${ver}" ] && [ -f "${default_loc}/${ver}" ]; then
|
|
180
|
+
found_binary="${default_loc}/${ver}"
|
|
181
|
+
found_version="${ver}"
|
|
182
|
+
fi
|
|
183
|
+
fi
|
|
184
|
+
fi
|
|
185
|
+
|
|
186
|
+
# Return results via global variables
|
|
187
|
+
FOUND_CLAUDE_BINARY="${found_binary}"
|
|
188
|
+
FOUND_CLAUDE_VERSION="${found_version}"
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
# Find any existing Claude installation
|
|
192
|
+
find_claude_binary
|
|
153
193
|
|
|
154
|
-
if [ -n "${
|
|
155
|
-
CLAUDE_BINARY="${
|
|
194
|
+
if [ -n "${FOUND_CLAUDE_BINARY}" ]; then
|
|
195
|
+
CLAUDE_BINARY="${FOUND_CLAUDE_BINARY}"
|
|
196
|
+
LATEST_VERSION="${FOUND_CLAUDE_VERSION}"
|
|
197
|
+
|
|
198
|
+
# Ensure binary is in our persistent directory
|
|
199
|
+
if [ ! -f "${CLAUDE_VERSIONS}/${LATEST_VERSION}" ]; then
|
|
200
|
+
cp -p "${CLAUDE_BINARY}" "${CLAUDE_VERSIONS}/${LATEST_VERSION}" 2>/dev/null || true
|
|
201
|
+
chmod 755 "${CLAUDE_VERSIONS}/${LATEST_VERSION}" 2>/dev/null || true
|
|
202
|
+
CLAUDE_BINARY="${CLAUDE_VERSIONS}/${LATEST_VERSION}"
|
|
203
|
+
log "✅ Claude ${LATEST_VERSION} synced to persistent storage"
|
|
204
|
+
fi
|
|
156
205
|
|
|
157
206
|
# Create or update the binary symlink
|
|
158
|
-
if [ ! -L "${LOCAL_BIN}/claude" ] || [ "$(readlink -f "${LOCAL_BIN}/claude")" != "${
|
|
207
|
+
if [ ! -L "${LOCAL_BIN}/claude" ] || [ "$(readlink -f "${LOCAL_BIN}/claude")" != "${CLAUDE_VERSIONS}/${LATEST_VERSION}" ]; then
|
|
159
208
|
rm -f "${LOCAL_BIN}/claude" 2>/dev/null || true
|
|
160
|
-
ln -sf "${
|
|
161
|
-
log "✅ Claude binary symlink: ~/.local/bin/claude -> ${
|
|
209
|
+
ln -sf "${CLAUDE_VERSIONS}/${LATEST_VERSION}" "${LOCAL_BIN}/claude"
|
|
210
|
+
log "✅ Claude binary symlink: ~/.local/bin/claude -> ${CLAUDE_VERSIONS}/${LATEST_VERSION}"
|
|
162
211
|
fi
|
|
163
212
|
else
|
|
164
213
|
# Claude not installed - install it
|
|
@@ -166,15 +215,16 @@ else
|
|
|
166
215
|
|
|
167
216
|
# Install Claude Code using the official installer
|
|
168
217
|
if curl -fsSL https://claude.ai/install.sh | bash 2>/dev/null; then
|
|
169
|
-
# After install,
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
218
|
+
# After install, find and sync the binary
|
|
219
|
+
find_claude_binary
|
|
220
|
+
if [ -n "${FOUND_CLAUDE_BINARY}" ]; then
|
|
221
|
+
LATEST_VERSION="${FOUND_CLAUDE_VERSION}"
|
|
222
|
+
if [ ! -f "${CLAUDE_VERSIONS}/${LATEST_VERSION}" ]; then
|
|
223
|
+
cp -p "${FOUND_CLAUDE_BINARY}" "${CLAUDE_VERSIONS}/${LATEST_VERSION}" 2>/dev/null || true
|
|
174
224
|
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
225
|
fi
|
|
226
|
+
ln -sf "${CLAUDE_VERSIONS}/${LATEST_VERSION}" "${LOCAL_BIN}/claude"
|
|
227
|
+
log "✅ Claude Code ${LATEST_VERSION} installed"
|
|
178
228
|
fi
|
|
179
229
|
else
|
|
180
230
|
log "❌ Failed to install Claude Code"
|