replit-tools 1.2.43 → 1.2.44
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 +47 -1
package/package.json
CHANGED
|
@@ -192,7 +192,7 @@ if command -v node &>/dev/null; then
|
|
|
192
192
|
|
|
193
193
|
// Load config with defaults
|
|
194
194
|
const configPath = process.env.REPLIT_TOOLS_DIR + "/config.json";
|
|
195
|
-
const defaults = { recentWindowHours: 48, persistenceDays: 365250, mirror: { enabled: true } };
|
|
195
|
+
const defaults = { recentWindowHours: 48, persistenceDays: 365250, autoUpdateHours: 24, mirror: { enabled: true } };
|
|
196
196
|
let config = defaults;
|
|
197
197
|
try {
|
|
198
198
|
if (fs.existsSync(configPath)) {
|
|
@@ -465,6 +465,52 @@ run_claude_detection() {
|
|
|
465
465
|
|
|
466
466
|
run_claude_detection
|
|
467
467
|
|
|
468
|
+
# =============================================================================
|
|
469
|
+
# Step 4.6: Proactively pull latest Claude + Codex (background, cached daily)
|
|
470
|
+
# =============================================================================
|
|
471
|
+
# Runs `claude install latest` + `codex update` so both tools actually fetch new
|
|
472
|
+
# releases. claude installs into ~/.local/share/claude/versions which is symlinked
|
|
473
|
+
# into our store, so detect_and_promote_claude then relinks to the new version.
|
|
474
|
+
# Cached via .last-tool-update marker; config.autoUpdateHours controls cadence
|
|
475
|
+
# (default 24; set 0 to check every launch, set very high to effectively disable).
|
|
476
|
+
AUTO_UPDATE_MARKER="${REPLIT_TOOLS}/.last-tool-update"
|
|
477
|
+
AUTO_UPDATE_HOURS=24
|
|
478
|
+
if [ -f "${REPLIT_TOOLS}/config.json" ] && command -v node &>/dev/null; then
|
|
479
|
+
AUTO_UPDATE_HOURS=$(node -e "try{const c=require('${REPLIT_TOOLS}/config.json');console.log(c.autoUpdateHours!=null?c.autoUpdateHours:24)}catch(e){console.log(24)}" 2>/dev/null)
|
|
480
|
+
fi
|
|
481
|
+
|
|
482
|
+
claude_codex_should_update=1
|
|
483
|
+
if [ "${CLAUDE_FORCE_REFRESH}" = "1" ]; then
|
|
484
|
+
claude_codex_should_update=1
|
|
485
|
+
elif [ "${AUTO_UPDATE_HOURS}" = "0" ]; then
|
|
486
|
+
claude_codex_should_update=1
|
|
487
|
+
elif [ -f "${AUTO_UPDATE_MARKER}" ]; then
|
|
488
|
+
_upd_age=$(( $(date +%s) - $(stat -c %Y "${AUTO_UPDATE_MARKER}" 2>/dev/null || echo 0) ))
|
|
489
|
+
[ "${_upd_age}" -lt $(( AUTO_UPDATE_HOURS * 3600 )) ] && claude_codex_should_update=0
|
|
490
|
+
fi
|
|
491
|
+
|
|
492
|
+
if [ "${claude_codex_should_update}" = "1" ] && { [[ $- == *i* ]] || [ "${CLAUDE_FORCE_REFRESH}" = "1" ]; }; then
|
|
493
|
+
touch "${AUTO_UPDATE_MARKER}" 2>/dev/null
|
|
494
|
+
mkdir -p "${LOGS_DIR}" 2>/dev/null
|
|
495
|
+
(
|
|
496
|
+
echo "=== $(date) auto-update ==="
|
|
497
|
+
if command -v claude &>/dev/null; then
|
|
498
|
+
echo "--- claude install latest ---"
|
|
499
|
+
claude install latest </dev/null 2>&1
|
|
500
|
+
fi
|
|
501
|
+
if command -v codex &>/dev/null; then
|
|
502
|
+
echo "--- codex update ---"
|
|
503
|
+
codex update </dev/null 2>&1
|
|
504
|
+
fi
|
|
505
|
+
# Promote any newly installed Claude into our managed symlink + GC
|
|
506
|
+
detect_and_promote_claude
|
|
507
|
+
gc_claude_versions
|
|
508
|
+
claude_detect_fingerprint > "${CLAUDE_DETECT_CACHE}" 2>/dev/null
|
|
509
|
+
echo "=== done $(date) ==="
|
|
510
|
+
) >> "${LOGS_DIR}/auto-update.log" 2>&1 &
|
|
511
|
+
log "🔄 Updating Claude + Codex in background (log: .replit-tools/.logs/auto-update.log)"
|
|
512
|
+
fi
|
|
513
|
+
|
|
468
514
|
# =============================================================================
|
|
469
515
|
# Step 5: Ensure PATH includes ~/.local/bin
|
|
470
516
|
# =============================================================================
|