squeezr-ai 1.16.7 → 1.16.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.
Files changed (2) hide show
  1. package/bin/squeezr.js +38 -6
  2. package/package.json +1 -1
package/bin/squeezr.js CHANGED
@@ -1044,16 +1044,48 @@ switch (command) {
1044
1044
  }
1045
1045
  }
1046
1046
 
1047
- // Clear update check cache so it doesn't show stale banner
1047
+ // Clear update check cache
1048
1048
  try { fs.unlinkSync(UPDATE_CHECK_FILE) } catch {}
1049
1049
 
1050
- console.log('\nStarting Squeezr...')
1051
- // Re-exec the new binary so we run the updated code
1052
- const squeezrBin = process.argv[1]
1050
+ // Resolve the NEW package root from npm global modules
1051
+ let newRoot = ROOT
1053
1052
  try {
1054
- execSync(`node "${squeezrBin}" start`, { stdio: 'inherit' })
1053
+ const npmRoot = execSync('npm root -g', { encoding: 'utf-8', stdio: ['pipe', 'pipe', 'pipe'] }).trim()
1054
+ const candidate = path.join(npmRoot, 'squeezr-ai')
1055
+ if (fs.existsSync(path.join(candidate, 'package.json'))) newRoot = candidate
1055
1056
  } catch {}
1056
1057
 
1058
+ // Read the new version and write cache so no stale banner appears
1059
+ try {
1060
+ const newPkg = JSON.parse(fs.readFileSync(path.join(newRoot, 'package.json'), 'utf-8'))
1061
+ const dir = path.dirname(UPDATE_CHECK_FILE)
1062
+ if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true })
1063
+ fs.writeFileSync(UPDATE_CHECK_FILE, JSON.stringify({ latest: newPkg.version, checkedAt: Date.now() }))
1064
+ console.log(`\nUpdated to v${newPkg.version}`)
1065
+ } catch {}
1066
+
1067
+ // Start the daemon directly from the new dist/index.js (no re-exec of old binary)
1068
+ console.log('Starting Squeezr...')
1069
+ const newDistIndex = path.join(newRoot, 'dist', 'index.js')
1070
+ const uPort = getPort()
1071
+ const uMitmPort2 = getMitmPort(uPort)
1072
+ const logDir = path.join(os.homedir(), '.squeezr')
1073
+ const logFile = path.join(logDir, 'squeezr.log')
1074
+ fs.mkdirSync(logDir, { recursive: true })
1075
+ const logFd = fs.openSync(logFile, 'a')
1076
+ const child = spawn(process.execPath, [newDistIndex], {
1077
+ detached: true,
1078
+ stdio: ['ignore', logFd, logFd],
1079
+ cwd: newRoot,
1080
+ env: { ...process.env, SQUEEZR_DAEMON: '1' },
1081
+ })
1082
+ child.unref()
1083
+ fs.closeSync(logFd)
1084
+ console.log(`Squeezr started (pid ${child.pid})`)
1085
+ console.log(` HTTP proxy (Claude/Aider/Gemini): http://localhost:${uPort}`)
1086
+ console.log(` MITM proxy (Codex): http://localhost:${uMitmPort2}`)
1087
+ console.log(` Logs: ${logFile}`)
1088
+
1057
1089
  if (isWSL()) {
1058
1090
  console.log('\n ⚠️ IMPORTANT: Close this terminal and open a new one so the')
1059
1091
  console.log(' environment variables take effect. Otherwise tools like')
@@ -1109,4 +1141,4 @@ switch (command) {
1109
1141
  process.exit(1)
1110
1142
  }
1111
1143
 
1112
- await showUpdateBanner()
1144
+ if (command !== 'update') await showUpdateBanner()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "squeezr-ai",
3
- "version": "1.16.7",
3
+ "version": "1.16.9",
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",