squeezr-ai 1.16.13 → 1.16.14
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 +45 -35
- package/package.json +1 -1
package/bin/squeezr.js
CHANGED
|
@@ -107,6 +107,47 @@ function printEnvRefreshHint(port, mitmPort) {
|
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
+
/**
|
|
111
|
+
* Install/update the PowerShell wrapper function in $PROFILE so that
|
|
112
|
+
* env vars are auto-refreshed after squeezr start/setup/update.
|
|
113
|
+
*/
|
|
114
|
+
function installPowerShellWrapper() {
|
|
115
|
+
if (process.platform !== 'win32') return
|
|
116
|
+
try {
|
|
117
|
+
const psProfilePath = execSync('powershell -NoProfile -Command "[Environment]::GetFolderPath(\'MyDocuments\') + \'\\WindowsPowerShell\\Microsoft.PowerShell_profile.ps1\'"', { encoding: 'utf-8', stdio: ['pipe', 'pipe', 'pipe'] }).trim()
|
|
118
|
+
const psProfileDir = path.dirname(psProfilePath)
|
|
119
|
+
if (!fs.existsSync(psProfileDir)) fs.mkdirSync(psProfileDir, { recursive: true })
|
|
120
|
+
const psMarker = '# squeezr wrapper'
|
|
121
|
+
const psFunction = `${psMarker}
|
|
122
|
+
function squeezr {
|
|
123
|
+
$bin = (Get-Command squeezr.cmd -ErrorAction SilentlyContinue).Source
|
|
124
|
+
if (-not $bin) { $bin = (Get-Command squeezr -ErrorAction SilentlyContinue).Source }
|
|
125
|
+
& node $bin @args
|
|
126
|
+
if ($args[0] -match '^(start|setup|update)$') {
|
|
127
|
+
@('ANTHROPIC_BASE_URL','GEMINI_API_BASE_URL','HTTPS_PROXY','NODE_EXTRA_CA_CERTS') | ForEach-Object {
|
|
128
|
+
$v = [Environment]::GetEnvironmentVariable($_, 'User')
|
|
129
|
+
if ($v) { [Environment]::SetEnvironmentVariable($_, $v, 'Process') }
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
if ($args[0] -eq 'stop') {
|
|
133
|
+
[Environment]::SetEnvironmentVariable('HTTPS_PROXY', $null, 'Process')
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
# end squeezr wrapper`
|
|
137
|
+
const existing = fs.existsSync(psProfilePath) ? fs.readFileSync(psProfilePath, 'utf-8') : ''
|
|
138
|
+
if (!existing.includes(psMarker)) {
|
|
139
|
+
fs.appendFileSync(psProfilePath, `\n${psFunction}\n`)
|
|
140
|
+
console.log(` [ok] PowerShell wrapper added to ${psProfilePath}`)
|
|
141
|
+
} else {
|
|
142
|
+
const updated = existing.replace(/# squeezr wrapper[\s\S]*?# end squeezr wrapper/, psFunction)
|
|
143
|
+
fs.writeFileSync(psProfilePath, updated)
|
|
144
|
+
console.log(` [ok] PowerShell wrapper updated in ${psProfilePath}`)
|
|
145
|
+
}
|
|
146
|
+
} catch {
|
|
147
|
+
console.log(` [skip] PowerShell profile wrapper could not be installed`)
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
110
151
|
const HELP = `
|
|
111
152
|
Squeezr v${pkg.version} — AI context compressor for Claude Code, Codex, Aider, Gemini CLI and Ollama
|
|
112
153
|
|
|
@@ -596,41 +637,8 @@ function setupWindows() {
|
|
|
596
637
|
}
|
|
597
638
|
}
|
|
598
639
|
|
|
599
|
-
// 1b. Install PowerShell wrapper
|
|
600
|
-
|
|
601
|
-
try {
|
|
602
|
-
const psProfilePath = execSync('powershell -NoProfile -Command "[Environment]::GetFolderPath(\'MyDocuments\') + \'\\WindowsPowerShell\\Microsoft.PowerShell_profile.ps1\'"', { encoding: 'utf-8', stdio: ['pipe', 'pipe', 'pipe'] }).trim()
|
|
603
|
-
const psProfileDir = path.dirname(psProfilePath)
|
|
604
|
-
if (!fs.existsSync(psProfileDir)) fs.mkdirSync(psProfileDir, { recursive: true })
|
|
605
|
-
const psMarker = '# squeezr wrapper'
|
|
606
|
-
const psFunction = `${psMarker}
|
|
607
|
-
function squeezr {
|
|
608
|
-
$bin = (Get-Command squeezr.cmd -ErrorAction SilentlyContinue).Source
|
|
609
|
-
if (-not $bin) { $bin = (Get-Command squeezr -ErrorAction SilentlyContinue).Source }
|
|
610
|
-
& node $bin @args
|
|
611
|
-
if ($args[0] -match '^(start|setup|update)$') {
|
|
612
|
-
@('ANTHROPIC_BASE_URL','GEMINI_API_BASE_URL','HTTPS_PROXY','NODE_EXTRA_CA_CERTS') | ForEach-Object {
|
|
613
|
-
$v = [Environment]::GetEnvironmentVariable($_, 'User')
|
|
614
|
-
if ($v) { [Environment]::SetEnvironmentVariable($_, $v, 'Process') }
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
if ($args[0] -eq 'stop') {
|
|
618
|
-
[Environment]::SetEnvironmentVariable('HTTPS_PROXY', $null, 'Process')
|
|
619
|
-
}
|
|
620
|
-
}
|
|
621
|
-
# end squeezr wrapper`
|
|
622
|
-
const existing = fs.existsSync(psProfilePath) ? fs.readFileSync(psProfilePath, 'utf-8') : ''
|
|
623
|
-
if (!existing.includes(psMarker)) {
|
|
624
|
-
fs.appendFileSync(psProfilePath, `\n${psFunction}\n`)
|
|
625
|
-
console.log(` [ok] PowerShell wrapper added to ${psProfilePath}`)
|
|
626
|
-
} else {
|
|
627
|
-
const updated = existing.replace(/# squeezr wrapper[\s\S]*?# end squeezr wrapper/, psFunction)
|
|
628
|
-
fs.writeFileSync(psProfilePath, updated)
|
|
629
|
-
console.log(` [ok] PowerShell wrapper updated in ${psProfilePath}`)
|
|
630
|
-
}
|
|
631
|
-
} catch (err) {
|
|
632
|
-
console.log(` [skip] PowerShell profile wrapper could not be installed`)
|
|
633
|
-
}
|
|
640
|
+
// 1b. Install PowerShell wrapper so env vars auto-refresh after start/setup/update
|
|
641
|
+
installPowerShellWrapper()
|
|
634
642
|
|
|
635
643
|
// 2. Auto-start: try NSSM (Windows service, survives crashes) → fallback to Task Scheduler
|
|
636
644
|
const logDir = path.join(os.homedir(), '.squeezr')
|
|
@@ -1178,6 +1186,8 @@ switch (command) {
|
|
|
1178
1186
|
if (fs.existsSync(setxExe)) execSync(`"${setxExe}" HTTPS_PROXY "http://localhost:${startMitmPort}"`, { stdio: 'pipe' })
|
|
1179
1187
|
} catch {}
|
|
1180
1188
|
}
|
|
1189
|
+
// Ensure PowerShell wrapper is installed (so env vars refresh automatically)
|
|
1190
|
+
installPowerShellWrapper()
|
|
1181
1191
|
printEnvRefreshHint(startPort, startMitmPort)
|
|
1182
1192
|
})()
|
|
1183
1193
|
break
|
package/package.json
CHANGED