squeezr-ai 1.16.8 → 1.16.10

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 +36 -15
  2. package/package.json +1 -1
package/bin/squeezr.js CHANGED
@@ -1044,27 +1044,48 @@ switch (command) {
1044
1044
  }
1045
1045
  }
1046
1046
 
1047
- // Write cache with the new version so neither parent nor child shows stale banner
1048
- try {
1049
- const newPkg = JSON.parse(fs.readFileSync(path.join(ROOT, 'package.json'), 'utf-8'))
1050
- const dir = path.dirname(UPDATE_CHECK_FILE)
1051
- if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true })
1052
- fs.writeFileSync(UPDATE_CHECK_FILE, JSON.stringify({ latest: newPkg.version, checkedAt: Date.now() }))
1053
- } catch {
1054
- try { fs.unlinkSync(UPDATE_CHECK_FILE) } catch {}
1055
- }
1047
+ // Clear update check cache
1048
+ try { fs.unlinkSync(UPDATE_CHECK_FILE) } catch {}
1056
1049
 
1057
- console.log('\nStarting Squeezr...')
1058
- // Resolve the updated binary from npm global path (process.argv[1] may still be the old version)
1059
- let newBin = process.argv[1]
1050
+ // Resolve the NEW package root from npm global modules
1051
+ let newRoot = ROOT
1060
1052
  try {
1061
- const resolved = execSync('which squeezr', { encoding: 'utf-8', stdio: ['pipe', 'pipe', 'pipe'] }).trim()
1062
- if (resolved) newBin = resolved
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
1063
1056
  } catch {}
1057
+
1058
+ // Read the new version and write cache so no stale banner appears
1064
1059
  try {
1065
- execSync(`node "${newBin}" start`, { stdio: 'inherit' })
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}`)
1066
1065
  } catch {}
1067
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 startPort = getPort()
1071
+ const startMitmPort = getMitmPort(startPort)
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:${startPort}`)
1086
+ console.log(` MITM proxy (Codex): http://localhost:${startMitmPort}`)
1087
+ console.log(` Logs: ${logFile}`)
1088
+
1068
1089
  if (isWSL()) {
1069
1090
  console.log('\n ⚠️ IMPORTANT: Close this terminal and open a new one so the')
1070
1091
  console.log(' environment variables take effect. Otherwise tools like')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "squeezr-ai",
3
- "version": "1.16.8",
3
+ "version": "1.16.10",
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",