squeezr-ai 1.16.4 → 1.16.5
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 +74 -22
- package/package.json +1 -1
package/bin/squeezr.js
CHANGED
|
@@ -445,6 +445,16 @@ async function uninstall() {
|
|
|
445
445
|
}
|
|
446
446
|
} catch {}
|
|
447
447
|
}
|
|
448
|
+
// Also clean .profile
|
|
449
|
+
const profilePath = path.join(os.homedir(), '.profile')
|
|
450
|
+
try {
|
|
451
|
+
const content = fs.readFileSync(profilePath, 'utf-8')
|
|
452
|
+
if (content.includes('# squeezr env vars')) {
|
|
453
|
+
const cleaned = content.replace(/\n?# squeezr env vars[^\n]*(\nexport [^\n]*)*/g, '')
|
|
454
|
+
fs.writeFileSync(profilePath, cleaned)
|
|
455
|
+
console.log(` [ok] Cleaned ${profilePath}`)
|
|
456
|
+
}
|
|
457
|
+
} catch {}
|
|
448
458
|
}
|
|
449
459
|
|
|
450
460
|
// 3. Remove CA from certificate stores
|
|
@@ -673,6 +683,33 @@ function setupUnix() {
|
|
|
673
683
|
`fi`,
|
|
674
684
|
].join('\n')
|
|
675
685
|
const marker = '# squeezr env vars'
|
|
686
|
+
|
|
687
|
+
// Env-only block (no auto-heal) for .profile — loaded by login shells
|
|
688
|
+
// before .bashrc's "case $-" interactive guard
|
|
689
|
+
const envOnlyBlock = [
|
|
690
|
+
`# squeezr env vars`,
|
|
691
|
+
`export ANTHROPIC_BASE_URL=http://localhost:${port}`,
|
|
692
|
+
`export openai_base_url=http://localhost:${port}`,
|
|
693
|
+
`export GEMINI_API_BASE_URL=http://localhost:${port}`,
|
|
694
|
+
`export HTTPS_PROXY=http://localhost:${mitmPort}`,
|
|
695
|
+
`export SSL_CERT_FILE=${bundlePath}`,
|
|
696
|
+
].join('\n')
|
|
697
|
+
|
|
698
|
+
// Write env vars to ~/.profile (login shell — always loaded)
|
|
699
|
+
const profilePath = path.join(os.homedir(), '.profile')
|
|
700
|
+
try {
|
|
701
|
+
const profileContent = fs.existsSync(profilePath) ? fs.readFileSync(profilePath, 'utf-8') : ''
|
|
702
|
+
if (!profileContent.includes(marker)) {
|
|
703
|
+
fs.appendFileSync(profilePath, `\n${envOnlyBlock}\n`)
|
|
704
|
+
console.log(` [ok] Env vars added to ${profilePath}`)
|
|
705
|
+
} else {
|
|
706
|
+
const updated = profileContent.replace(/# squeezr env vars[\s\S]*?(?=\n(?!export )|\n*$)/, envOnlyBlock)
|
|
707
|
+
fs.writeFileSync(profilePath, updated)
|
|
708
|
+
console.log(` [ok] Env vars updated in ${profilePath}`)
|
|
709
|
+
}
|
|
710
|
+
} catch {}
|
|
711
|
+
|
|
712
|
+
// Write full block (env + auto-heal) to interactive shell profile
|
|
676
713
|
const profiles = [
|
|
677
714
|
path.join(os.homedir(), '.zshrc'),
|
|
678
715
|
path.join(os.homedir(), '.bashrc'),
|
|
@@ -684,17 +721,12 @@ function setupUnix() {
|
|
|
684
721
|
fs.appendFileSync(profile, `\n${shellBlock}\n`)
|
|
685
722
|
console.log(` [ok] Env vars + auto-heal added to ${profile}`)
|
|
686
723
|
} else {
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
fs.writeFileSync(profile, updatedContent)
|
|
694
|
-
console.log(` [ok] Shell profile updated with MITM proxy vars`)
|
|
695
|
-
} else {
|
|
696
|
-
console.log(` [skip] Env vars + auto-heal already in ${profile}`)
|
|
697
|
-
}
|
|
724
|
+
const updatedContent = existing.replace(
|
|
725
|
+
/# squeezr env vars[\s\S]*?fi\n?/,
|
|
726
|
+
shellBlock + '\n'
|
|
727
|
+
)
|
|
728
|
+
fs.writeFileSync(profile, updatedContent)
|
|
729
|
+
console.log(` [ok] Env vars + auto-heal updated in ${profile}`)
|
|
698
730
|
}
|
|
699
731
|
|
|
700
732
|
// 2a. macOS — launchd
|
|
@@ -805,6 +837,31 @@ function setupWSL() {
|
|
|
805
837
|
`fi`,
|
|
806
838
|
].join('\n')
|
|
807
839
|
const marker = '# squeezr env vars'
|
|
840
|
+
|
|
841
|
+
// Env-only block for .profile (loaded before .bashrc's interactive guard)
|
|
842
|
+
const envOnlyBlock = [
|
|
843
|
+
`# squeezr env vars`,
|
|
844
|
+
`export ANTHROPIC_BASE_URL=http://localhost:${port}`,
|
|
845
|
+
`export openai_base_url=http://localhost:${port}`,
|
|
846
|
+
`export GEMINI_API_BASE_URL=http://localhost:${port}`,
|
|
847
|
+
`export HTTPS_PROXY=http://localhost:${mitmPort}`,
|
|
848
|
+
`export SSL_CERT_FILE=${bundlePath}`,
|
|
849
|
+
].join('\n')
|
|
850
|
+
|
|
851
|
+
const profilePath = path.join(os.homedir(), '.profile')
|
|
852
|
+
try {
|
|
853
|
+
const profileContent = fs.existsSync(profilePath) ? fs.readFileSync(profilePath, 'utf-8') : ''
|
|
854
|
+
if (!profileContent.includes(marker)) {
|
|
855
|
+
fs.appendFileSync(profilePath, `\n${envOnlyBlock}\n`)
|
|
856
|
+
console.log(` [ok] Env vars added to ${profilePath}`)
|
|
857
|
+
} else {
|
|
858
|
+
const updated = profileContent.replace(/# squeezr env vars[\s\S]*?(?=\n(?!export )|\n*$)/, envOnlyBlock)
|
|
859
|
+
fs.writeFileSync(profilePath, updated)
|
|
860
|
+
console.log(` [ok] Env vars updated in ${profilePath}`)
|
|
861
|
+
}
|
|
862
|
+
} catch {}
|
|
863
|
+
|
|
864
|
+
// Full block (env + auto-heal) in interactive shell profile
|
|
808
865
|
const profiles = [
|
|
809
866
|
path.join(os.homedir(), '.zshrc'),
|
|
810
867
|
path.join(os.homedir(), '.bashrc'),
|
|
@@ -816,17 +873,12 @@ function setupWSL() {
|
|
|
816
873
|
fs.appendFileSync(profile, `\n${shellBlock}\n`)
|
|
817
874
|
console.log(` [ok] Env vars + auto-heal added to ${profile}`)
|
|
818
875
|
} else {
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
fs.writeFileSync(profile, updatedContent)
|
|
826
|
-
console.log(` [ok] Shell profile updated with MITM proxy vars`)
|
|
827
|
-
} else {
|
|
828
|
-
console.log(` [skip] Env vars already in ${profile}`)
|
|
829
|
-
}
|
|
876
|
+
const updatedContent = existing.replace(
|
|
877
|
+
/# squeezr env vars[\s\S]*?fi\n?/,
|
|
878
|
+
shellBlock + '\n'
|
|
879
|
+
)
|
|
880
|
+
fs.writeFileSync(profile, updatedContent)
|
|
881
|
+
console.log(` [ok] Env vars + auto-heal updated in ${profile}`)
|
|
830
882
|
}
|
|
831
883
|
|
|
832
884
|
// 2. Set Windows env vars via setx.exe (so Windows-launched CLIs see them)
|
package/package.json
CHANGED