@solongate/proxy 0.81.6 → 0.81.8

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.
@@ -184,19 +184,13 @@ ${SHIM_END}` : `${SHIM_BEGIN}
184
184
  claude() { "${node}" "${shield}" -- "${real}" "$@"; }
185
185
  ${SHIM_END}`;
186
186
  const targets = shimTargets();
187
- if (targets.length === 0) {
188
- console.log(" (No shell profile found for auto-shield; run `claude` via `solongate shield -- claude` manually.)");
189
- return;
190
- }
187
+ if (targets.length === 0) return;
191
188
  for (const file of targets) {
192
189
  try {
193
190
  writeShimBlock(file, block);
194
- console.log(` Auto-shield on: \`claude\` now masks secrets (${file})`);
195
- } catch (e) {
196
- console.log(` (Could not enable auto-shield in ${file}: ${e.message})`);
191
+ } catch {
197
192
  }
198
193
  }
199
- console.log(" Open a NEW terminal for it to take effect.");
200
194
  }
201
195
  function removeClaudeShim() {
202
196
  for (const file of shimTargets()) {
@@ -232,7 +226,7 @@ async function runGlobalInstall(opts = {}) {
232
226
  writeFileSync(join(p.hooksDir, "stop.mjs"), readHook("stop.mjs"));
233
227
  writeFileSync(join(p.hooksDir, "shield.mjs"), readHook("shield.mjs"));
234
228
  console.log(` Installed hooks \u2192 ${p.hooksDir}`);
235
- removeClaudeShim();
229
+ installClaudeShim(join(p.hooksDir, "shield.mjs"));
236
230
  writeFileSync(p.configPath, JSON.stringify({ apiKey, apiUrl }, null, 2) + "\n");
237
231
  console.log(` Wrote ${p.configPath}`);
238
232
  let existing = {};
package/dist/index.js CHANGED
@@ -10528,19 +10528,13 @@ ${SHIM_END}` : `${SHIM_BEGIN}
10528
10528
  claude() { "${node}" "${shield}" -- "${real}" "$@"; }
10529
10529
  ${SHIM_END}`;
10530
10530
  const targets = shimTargets();
10531
- if (targets.length === 0) {
10532
- console.log(" (No shell profile found for auto-shield; run `claude` via `solongate shield -- claude` manually.)");
10533
- return;
10534
- }
10531
+ if (targets.length === 0) return;
10535
10532
  for (const file of targets) {
10536
10533
  try {
10537
10534
  writeShimBlock(file, block2);
10538
- console.log(` Auto-shield on: \`claude\` now masks secrets (${file})`);
10539
- } catch (e) {
10540
- console.log(` (Could not enable auto-shield in ${file}: ${e.message})`);
10535
+ } catch {
10541
10536
  }
10542
10537
  }
10543
- console.log(" Open a NEW terminal for it to take effect.");
10544
10538
  }
10545
10539
  function removeClaudeShim() {
10546
10540
  for (const file of shimTargets()) {
@@ -10576,7 +10570,7 @@ async function runGlobalInstall(opts = {}) {
10576
10570
  writeFileSync4(join9(p.hooksDir, "stop.mjs"), readHook("stop.mjs"));
10577
10571
  writeFileSync4(join9(p.hooksDir, "shield.mjs"), readHook("shield.mjs"));
10578
10572
  console.log(` Installed hooks \u2192 ${p.hooksDir}`);
10579
- removeClaudeShim();
10573
+ installClaudeShim(join9(p.hooksDir, "shield.mjs"));
10580
10574
  writeFileSync4(p.configPath, JSON.stringify({ apiKey, apiUrl }, null, 2) + "\n");
10581
10575
  console.log(` Wrote ${p.configPath}`);
10582
10576
  let existing = {};
package/dist/login.js CHANGED
@@ -141,6 +141,19 @@ var SHIM_END = "# <<< SolonGate shield <<<";
141
141
  function escapeRe(s) {
142
142
  return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
143
143
  }
144
+ function resolveRealClaude() {
145
+ try {
146
+ const finder = process.platform === "win32" ? "where" : "which";
147
+ const out = execFileSync(finder, ["claude"], { encoding: "utf-8" }).split(/\r?\n/).map((s) => s.trim()).filter(Boolean);
148
+ if (process.platform === "win32") {
149
+ const low = (s) => s.toLowerCase();
150
+ return out.find((l) => low(l).endsWith(".cmd")) || out.find((l) => low(l).endsWith(".exe")) || out.find((l) => low(l).endsWith(".bat")) || out[0] || null;
151
+ }
152
+ return out[0] || null;
153
+ } catch {
154
+ return null;
155
+ }
156
+ }
144
157
  function shimTargets() {
145
158
  if (process.platform === "win32") {
146
159
  try {
@@ -163,10 +176,25 @@ function writeShimBlock(file, block) {
163
176
  mkdirSync(dirname(file), { recursive: true });
164
177
  writeFileSync(file, content);
165
178
  }
166
- function removeClaudeShim() {
167
- for (const file of shimTargets()) {
179
+ function installClaudeShim(shieldPath) {
180
+ const real = resolveRealClaude();
181
+ if (!real) {
182
+ console.log(" (Claude Code not found on PATH \u2014 skipped auto-shield. Install it, then re-run `login`.)");
183
+ return;
184
+ }
185
+ const node = process.execPath.replace(/\\/g, "/");
186
+ const shield = shieldPath.replace(/\\/g, "/");
187
+ const win = process.platform === "win32";
188
+ const block = win ? `${SHIM_BEGIN}
189
+ function claude { & "${node}" "${shield}" -- "${real}" @args }
190
+ ${SHIM_END}` : `${SHIM_BEGIN}
191
+ claude() { "${node}" "${shield}" -- "${real}" "$@"; }
192
+ ${SHIM_END}`;
193
+ const targets = shimTargets();
194
+ if (targets.length === 0) return;
195
+ for (const file of targets) {
168
196
  try {
169
- writeShimBlock(file, null);
197
+ writeShimBlock(file, block);
170
198
  } catch {
171
199
  }
172
200
  }
@@ -197,7 +225,7 @@ async function runGlobalInstall(opts = {}) {
197
225
  writeFileSync(join(p.hooksDir, "stop.mjs"), readHook("stop.mjs"));
198
226
  writeFileSync(join(p.hooksDir, "shield.mjs"), readHook("shield.mjs"));
199
227
  console.log(` Installed hooks \u2192 ${p.hooksDir}`);
200
- removeClaudeShim();
228
+ installClaudeShim(join(p.hooksDir, "shield.mjs"));
201
229
  writeFileSync(p.configPath, JSON.stringify({ apiKey, apiUrl }, null, 2) + "\n");
202
230
  console.log(` Wrote ${p.configPath}`);
203
231
  let existing = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solongate/proxy",
3
- "version": "0.81.6",
3
+ "version": "0.81.8",
4
4
  "description": "AI tool security proxy: protect any AI tool server with customizable policies, path/command constraints, rate limiting, and audit logging. No code changes required.",
5
5
  "type": "module",
6
6
  "bin": {