squeezr-ai 1.16.8 → 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.
- package/bin/squeezr.js +36 -15
- package/package.json +1 -1
package/bin/squeezr.js
CHANGED
|
@@ -1044,27 +1044,48 @@ switch (command) {
|
|
|
1044
1044
|
}
|
|
1045
1045
|
}
|
|
1046
1046
|
|
|
1047
|
-
//
|
|
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
|
-
|
|
1058
|
-
|
|
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
|
|
1062
|
-
|
|
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
|
-
|
|
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 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
|
+
|
|
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