squeezr-ai 1.16.3 → 1.16.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/README.md CHANGED
@@ -172,6 +172,7 @@ Squeezr uses cheap/free models for AI compression (the deterministic layer is pu
172
172
  ```bash
173
173
  squeezr setup # configure env vars, auto-start, CA trust
174
174
  squeezr start # start the proxy (auto-restarts if version mismatch after update)
175
+ squeezr update # kill old processes, install latest from npm, restart
175
176
  squeezr stop # stop the proxy
176
177
  squeezr status # check if proxy is running
177
178
  squeezr logs # show last 50 log lines
package/bin/squeezr.js CHANGED
@@ -59,7 +59,7 @@ async function showUpdateBanner() {
59
59
  console.log('')
60
60
  console.log(` ╭─────────────────────────────────────────────────────────╮`)
61
61
  console.log(` │ Update available: v${pkg.version} → v${latest}${' '.repeat(Math.max(0, 30 - pkg.version.length - latest.length))}│`)
62
- console.log(` │ Run: npm install -g squeezr-ai │`)
62
+ console.log(` │ Run: squeezr update │`)
63
63
  console.log(` ╰─────────────────────────────────────────────────────────╯`)
64
64
  }
65
65
  } catch {}
@@ -104,6 +104,7 @@ Usage:
104
104
  squeezr status Check if proxy is running
105
105
  squeezr config Print config file path and current settings
106
106
  squeezr ports Change HTTP and MITM proxy ports
107
+ squeezr update Kill old processes, install latest from npm, restart
107
108
  squeezr uninstall Remove Squeezr completely (env vars, CA, auto-start, logs)
108
109
  squeezr version Print version
109
110
  squeezr help Show this help
@@ -949,6 +950,44 @@ switch (command) {
949
950
  else setupUnix()
950
951
  break
951
952
 
953
+ case 'update':
954
+ await (async () => {
955
+ console.log('Stopping Squeezr...')
956
+ stopProxy()
957
+ // Also kill anything on the ports by brute force
958
+ const uPort = getPort()
959
+ const uMitmPort = getMitmPort(uPort)
960
+ if (process.platform === 'win32') {
961
+ try { execSync(`for /f "tokens=5" %a in ('netstat -ano ^| findstr ":${uPort} " ^| findstr LISTENING') do taskkill /F /PID %a`, { stdio: 'pipe', shell: 'cmd.exe' }) } catch {}
962
+ try { execSync(`for /f "tokens=5" %a in ('netstat -ano ^| findstr ":${uMitmPort} " ^| findstr LISTENING') do taskkill /F /PID %a`, { stdio: 'pipe', shell: 'cmd.exe' }) } catch {}
963
+ } else {
964
+ try { execSync(`kill -9 $(lsof -ti:${uPort}) 2>/dev/null`, { stdio: 'pipe' }) } catch {}
965
+ try { execSync(`kill -9 $(lsof -ti:${uMitmPort}) 2>/dev/null`, { stdio: 'pipe' }) } catch {}
966
+ }
967
+ await new Promise(r => setTimeout(r, 1000))
968
+
969
+ console.log('Installing latest version...')
970
+ try {
971
+ const npmCmd = process.platform === 'win32' ? 'npm' : 'HTTPS_PROXY= npm'
972
+ execSync(`${npmCmd} install -g squeezr-ai@latest`, { stdio: 'inherit' })
973
+ } catch (e) {
974
+ // On Unix, might need sudo
975
+ try {
976
+ execSync('sudo HTTPS_PROXY= npm install -g squeezr-ai@latest', { stdio: 'inherit' })
977
+ } catch {
978
+ console.error('npm install failed. Try manually: npm install -g squeezr-ai')
979
+ process.exit(1)
980
+ }
981
+ }
982
+
983
+ console.log('\nStarting Squeezr...')
984
+ // Re-exec the new binary so we run the updated code
985
+ const squeezrBin = process.argv[1]
986
+ try {
987
+ execSync(`node "${squeezrBin}" start`, { stdio: 'inherit' })
988
+ } catch {}
989
+ })()
990
+ break
952
991
  case 'stop':
953
992
  stopProxy()
954
993
  break
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "squeezr-ai",
3
- "version": "1.16.3",
3
+ "version": "1.16.4",
4
4
  "description": "AI proxy that compresses Claude Code, Codex, Aider, Gemini CLI and Ollama context windows to save thousands of tokens per session",
5
5
  "keywords": [
6
6
  "claude",
@@ -50,6 +50,7 @@
50
50
  "devDependencies": {
51
51
  "@types/node": "^22.14.0",
52
52
  "@types/node-forge": "^1.3.14",
53
+ "@vitest/coverage-v8": "^4.1.2",
53
54
  "tsx": "^4.19.3",
54
55
  "typescript": "^5.8.3",
55
56
  "vitest": "^3.1.1"