squeezr-ai 1.16.11 → 1.16.12

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 +25 -15
  2. package/package.json +1 -1
package/bin/squeezr.js CHANGED
@@ -89,6 +89,24 @@ function getPort() {
89
89
  return process.env.SQUEEZR_PORT || getPortFromToml() || 8080
90
90
  }
91
91
 
92
+ /**
93
+ * Print a PowerShell/bash one-liner to refresh env vars in the current session.
94
+ * Copies it to the clipboard on Windows so the user can just Ctrl+V, Enter.
95
+ */
96
+ function printEnvRefreshHint(port, mitmPort) {
97
+ const bundlePath = path.join(os.homedir(), '.squeezr', 'mitm-ca', 'bundle.crt')
98
+ if (process.platform === 'win32') {
99
+ const cmd = `$env:ANTHROPIC_BASE_URL="http://localhost:${port}"; $env:GEMINI_API_BASE_URL="http://localhost:${port}"; $env:HTTPS_PROXY="http://localhost:${mitmPort}"`
100
+ try { execSync(`powershell -NoProfile -Command "Set-Clipboard '${cmd.replace(/'/g, "''")}';"`, { stdio: 'pipe' }) } catch {}
101
+ console.log(`\n Run this to activate in the current terminal (already copied to clipboard):\n`)
102
+ console.log(` ${cmd}\n`)
103
+ } else if (isWSL()) {
104
+ const cmd = `export ANTHROPIC_BASE_URL=http://localhost:${port} GEMINI_API_BASE_URL=http://localhost:${port} HTTPS_PROXY=http://localhost:${mitmPort} SSL_CERT_FILE=${bundlePath}`
105
+ console.log(`\n Run this to activate in the current terminal:\n`)
106
+ console.log(` ${cmd}\n`)
107
+ }
108
+ }
109
+
92
110
  const HELP = `
93
111
  Squeezr v${pkg.version} — AI context compressor for Claude Code, Codex, Aider, Gemini CLI and Ollama
94
112
 
@@ -187,6 +205,7 @@ async function startDaemon() {
187
205
  if (fs.existsSync(setxExe)) execSync(`"${setxExe}" HTTPS_PROXY "http://localhost:${mitmPort}"`, { stdio: 'pipe' })
188
206
  } catch {}
189
207
  }
208
+ printEnvRefreshHint(port, mitmPort)
190
209
  }
191
210
 
192
211
  function showLogs() {
@@ -677,12 +696,10 @@ Done!
677
696
  MITM proxy on http://localhost:${mitmPort} (Codex TLS interception)
678
697
  All CLIs (Claude Code, Codex, Aider, Gemini, Ollama) are configured.
679
698
 
680
- Restart your terminal once for the env vars to take effect.
681
- After that, everything is automatic — Squeezr starts silently on every login.
682
-
683
699
  squeezr status — check it's running
684
700
  squeezr gain — see token savings
685
701
  `)
702
+ printEnvRefreshHint(port, mitmPort)
686
703
  }
687
704
  }
688
705
 
@@ -999,26 +1016,21 @@ WantedBy=default.target
999
1016
  console.log(` [ok] Squeezr started in background (pid ${child.pid})`)
1000
1017
  console.log(` [ok] Logs → ${logFile}`)
1001
1018
 
1002
- // 5. Apply env vars to current process so calling `source` is not needed
1003
- // This won't affect the parent shell, but at least prints guidance.
1019
+ const setupPort = getPort()
1020
+ const setupMitmPort = getMitmPort(setupPort)
1004
1021
  console.log(`
1005
1022
  Done!
1006
1023
 
1007
- Squeezr is running on http://localhost:8080
1024
+ Squeezr is running on http://localhost:${setupPort}
1008
1025
  All CLIs (Claude Code, Codex, Aider, Gemini, Ollama) are configured.
1009
1026
 
1010
1027
  Windows env vars are set (effective in new terminals immediately).
1011
1028
  WSL env vars added to ${profile}.
1012
1029
 
1013
- To activate in THIS terminal: source ${profile}
1014
-
1015
- ⚠️ IMPORTANT: Close this terminal and open a new one so the
1016
- environment variables take effect. Otherwise tools like
1017
- Claude Code may fail with 502 errors.
1018
-
1019
1030
  squeezr status — check it's running
1020
1031
  squeezr gain — see token savings
1021
1032
  `)
1033
+ printEnvRefreshHint(setupPort, setupMitmPort)
1022
1034
  }
1023
1035
 
1024
1036
  // ── CLI router ────────────────────────────────────────────────────────────────
@@ -1114,10 +1126,8 @@ switch (command) {
1114
1126
  const setxExe = '/mnt/c/Windows/System32/setx.exe'
1115
1127
  if (fs.existsSync(setxExe)) execSync(`"${setxExe}" HTTPS_PROXY "http://localhost:${startMitmPort}"`, { stdio: 'pipe' })
1116
1128
  } catch {}
1117
- console.log('\n ⚠️ IMPORTANT: Close this terminal and open a new one so the')
1118
- console.log(' environment variables take effect. Otherwise tools like')
1119
- console.log(' Claude Code may fail with 502 errors.\n')
1120
1129
  }
1130
+ printEnvRefreshHint(startPort, startMitmPort)
1121
1131
  })()
1122
1132
  break
1123
1133
  case 'stop':
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "squeezr-ai",
3
- "version": "1.16.11",
3
+ "version": "1.16.12",
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",