replit-tools 1.1.7 → 1.1.9
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
CHANGED
|
@@ -235,6 +235,19 @@ claude_prompt() {
|
|
|
235
235
|
return 0
|
|
236
236
|
fi
|
|
237
237
|
|
|
238
|
+
# LOOP PREVENTION: Track if we've already prompted this terminal session
|
|
239
|
+
local prompt_marker="${REPLIT_TOOLS}/.prompt-shown-${TERMINAL_ID}"
|
|
240
|
+
|
|
241
|
+
# If we've already shown the prompt for this terminal, skip
|
|
242
|
+
if [ -f "$prompt_marker" ]; then
|
|
243
|
+
# Clear old markers (older than 12 hours)
|
|
244
|
+
find "${REPLIT_TOOLS}" -name ".prompt-shown-*" -mmin +720 -delete 2>/dev/null
|
|
245
|
+
return 0
|
|
246
|
+
fi
|
|
247
|
+
|
|
248
|
+
# Mark that we're showing the prompt (create marker BEFORE showing)
|
|
249
|
+
touch "$prompt_marker" 2>/dev/null
|
|
250
|
+
|
|
238
251
|
local running=$(count_claude_instances)
|
|
239
252
|
local last_session=$(get_terminal_last_session)
|
|
240
253
|
|
|
@@ -287,7 +300,7 @@ claude_prompt() {
|
|
|
287
300
|
# Get session IDs for selection
|
|
288
301
|
local session_ids=$(get_recent_sessions | grep "^ID|" | cut -d'|' -f2)
|
|
289
302
|
|
|
290
|
-
read -p " Enter number (or 'q' to cancel): " session_num
|
|
303
|
+
read -t 30 -p " Enter number (or 'q' to cancel): " session_num
|
|
291
304
|
|
|
292
305
|
if [ "$session_num" = "q" ] || [ -z "$session_num" ]; then
|
|
293
306
|
echo " Cancelled."
|
|
@@ -338,7 +351,13 @@ export TERMINAL_ID
|
|
|
338
351
|
# Press 's' to skip and just get a shell.
|
|
339
352
|
# Set CLAUDE_NO_PROMPT=true to disable entirely.
|
|
340
353
|
|
|
341
|
-
|
|
354
|
+
# Reset prompt marker and show menu
|
|
355
|
+
claude_menu() {
|
|
356
|
+
local prompt_marker="${REPLIT_TOOLS}/.prompt-shown-${TERMINAL_ID}"
|
|
357
|
+
rm -f "$prompt_marker" 2>/dev/null
|
|
358
|
+
claude_prompt
|
|
359
|
+
}
|
|
360
|
+
alias claude-menu='claude_menu'
|
|
342
361
|
|
|
343
362
|
if [ "${CLAUDE_NO_PROMPT}" != "true" ]; then
|
|
344
363
|
claude_prompt
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
# Run this script on every container restart via .config/bashrc or .replit
|
|
14
14
|
# =============================================================================
|
|
15
15
|
|
|
16
|
-
set -e
|
|
16
|
+
# NOTE: Do NOT use 'set -e' here - this script is sourced into bashrc
|
|
17
|
+
# and any error would exit the user's shell, causing restart loops
|
|
17
18
|
|
|
18
19
|
# Configuration - use .replit-tools structure
|
|
19
20
|
WORKSPACE="/home/runner/workspace"
|
|
@@ -243,12 +244,18 @@ fi
|
|
|
243
244
|
# Step 6: Auto-refresh OAuth token if needed (with loop prevention)
|
|
244
245
|
# =============================================================================
|
|
245
246
|
CREDENTIALS_FILE="${CLAUDE_PERSISTENT}/.credentials.json"
|
|
247
|
+
AUTH_FAILED_MARKER="${REPLIT_TOOLS}/.auth-refresh-failed"
|
|
246
248
|
|
|
247
|
-
#
|
|
248
|
-
if [ -
|
|
249
|
-
|
|
249
|
+
# Clear failed marker if it's more than 1 hour old (allow retry after cooldown)
|
|
250
|
+
if [ -f "${AUTH_FAILED_MARKER}" ]; then
|
|
251
|
+
marker_age=$(( $(date +%s) - $(stat -c %Y "${AUTH_FAILED_MARKER}" 2>/dev/null || echo "0") ))
|
|
252
|
+
if [ "${marker_age}" -gt 3600 ]; then
|
|
253
|
+
rm -f "${AUTH_FAILED_MARKER}" 2>/dev/null
|
|
254
|
+
fi
|
|
255
|
+
fi
|
|
250
256
|
|
|
251
|
-
|
|
257
|
+
# Skip auth refresh if we already failed recently (file-based lock prevents loops)
|
|
258
|
+
if [ ! -f "${AUTH_FAILED_MARKER}" ] && [ -f "${CREDENTIALS_FILE}" ] && [ -f "${AUTH_REFRESH_SCRIPT}" ]; then
|
|
252
259
|
# Source the auth refresh script to get the function
|
|
253
260
|
source "${AUTH_REFRESH_SCRIPT}"
|
|
254
261
|
|
|
@@ -291,12 +298,12 @@ if [ -z "${_REPLIT_TOOLS_AUTH_CHECKED}" ]; then
|
|
|
291
298
|
" 2>/dev/null)
|
|
292
299
|
log "✅ Claude authentication: refreshed (${NEW_REMAINING}h remaining)"
|
|
293
300
|
else
|
|
294
|
-
log "❌ Token refresh failed -
|
|
295
|
-
|
|
301
|
+
log "❌ Token refresh failed - run 'claude login' when ready"
|
|
302
|
+
touch "${AUTH_FAILED_MARKER}"
|
|
296
303
|
fi
|
|
297
304
|
else
|
|
298
|
-
log "❌ Token expired (no refresh token) -
|
|
299
|
-
|
|
305
|
+
log "❌ Token expired (no refresh token) - run 'claude login' when ready"
|
|
306
|
+
touch "${AUTH_FAILED_MARKER}"
|
|
300
307
|
fi
|
|
301
308
|
elif [ "${remaining}" -lt 2 ]; then
|
|
302
309
|
# Less than 2 hours - refresh proactively
|
|
@@ -321,14 +328,13 @@ if [ -z "${_REPLIT_TOOLS_AUTH_CHECKED}" ]; then
|
|
|
321
328
|
log "✅ Claude authentication: valid (${remaining}h remaining)"
|
|
322
329
|
fi
|
|
323
330
|
elif [ "${auth_type}" = "none" ] || [ "${auth_type}" = "error" ]; then
|
|
324
|
-
log "⚠️ No valid auth
|
|
325
|
-
export CLAUDE_SKIP_AUTH=1
|
|
331
|
+
log "⚠️ No valid auth - run 'claude login' when ready"
|
|
326
332
|
fi
|
|
327
333
|
fi
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
334
|
+
elif [ -f "${AUTH_FAILED_MARKER}" ]; then
|
|
335
|
+
log "⏭️ Skipping auth check (refresh failed recently, retry in 1h or run 'claude login')"
|
|
336
|
+
elif [ ! -f "${CREDENTIALS_FILE}" ]; then
|
|
337
|
+
log "⚠️ No credentials - run 'claude login' when ready"
|
|
332
338
|
fi
|
|
333
339
|
|
|
334
340
|
# =============================================================================
|