replit-tools 1.1.3 → 1.1.4

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replit-tools",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "description": "DATA Tools - One command to set up Claude Code and Codex CLI on Replit with full persistence",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -43,8 +43,36 @@ log() {
43
43
  }
44
44
 
45
45
  # =============================================================================
46
- # Step 0: Show version and check for updates (only in interactive shells)
46
+ # Step 0: Show version, check for updates, and auto-update if available
47
47
  # =============================================================================
48
+ auto_update_scripts() {
49
+ local latest_ver="$1"
50
+ local tmp_dir=$(mktemp -d)
51
+
52
+ # Download and extract latest package
53
+ if npm pack "${PACKAGE_NAME}@${latest_ver}" --pack-destination="${tmp_dir}" >/dev/null 2>&1; then
54
+ local tarball="${tmp_dir}/${PACKAGE_NAME}-${latest_ver}.tgz"
55
+ if [ -f "${tarball}" ]; then
56
+ tar -xzf "${tarball}" -C "${tmp_dir}" 2>/dev/null
57
+
58
+ # Copy updated scripts
59
+ if [ -d "${tmp_dir}/package/scripts" ]; then
60
+ cp -f "${tmp_dir}/package/scripts/"*.sh "${SCRIPTS_DIR}/" 2>/dev/null
61
+ chmod 755 "${SCRIPTS_DIR}/"*.sh 2>/dev/null
62
+ fi
63
+
64
+ # Update version file
65
+ echo "${latest_ver}" > "${VERSION_FILE}"
66
+
67
+ rm -rf "${tmp_dir}"
68
+ return 0
69
+ fi
70
+ fi
71
+
72
+ rm -rf "${tmp_dir}" 2>/dev/null
73
+ return 1
74
+ }
75
+
48
76
  if [[ $- == *i* ]]; then
49
77
  CURRENT_VERSION=""
50
78
  if [ -f "${VERSION_FILE}" ]; then
@@ -56,8 +84,14 @@ if [[ $- == *i* ]]; then
56
84
  LATEST_VERSION=$(timeout 3 npm view "${PACKAGE_NAME}" version 2>/dev/null || echo "")
57
85
 
58
86
  if [ -n "${LATEST_VERSION}" ] && [ "${LATEST_VERSION}" != "${CURRENT_VERSION}" ]; then
59
- echo "📦 DATA Tools v${CURRENT_VERSION} (update available: v${LATEST_VERSION})"
60
- echo " Run: npx -y ${PACKAGE_NAME}@latest"
87
+ echo "📦 DATA Tools v${CURRENT_VERSION} v${LATEST_VERSION}"
88
+ echo " ⬆️ Auto-updating..."
89
+
90
+ if auto_update_scripts "${LATEST_VERSION}"; then
91
+ echo " ✅ Updated to v${LATEST_VERSION}"
92
+ else
93
+ echo " ⚠️ Auto-update failed, continuing with v${CURRENT_VERSION}"
94
+ fi
61
95
  else
62
96
  echo "📦 DATA Tools v${CURRENT_VERSION}"
63
97
  fi