@solongate/proxy 0.82.45 → 0.82.46

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.
@@ -24,6 +24,13 @@ export declare function runGlobalRestore(): void;
24
24
  * The auto-shield shell shim is left to `solongate` login (it can print), so this
25
25
  * touches only the guard/audit/stop hooks — the primary protection.
26
26
  */
27
+ /**
28
+ * `solongate repair` — restore the guard after tampering/deletion. Reports what
29
+ * was missing, then rewrites every protection file (guard/audit/stop/shield hooks
30
+ * + cloud config) and re-registers the hooks in Claude Code and Antigravity, then
31
+ * re-locks. Reuses the logged-in account, so no re-login. Human-only (gated).
32
+ */
33
+ export declare function runRepair(): Promise<number>;
27
34
  export declare function installGlobalQuiet(): {
28
35
  ok: boolean;
29
36
  message: string;
@@ -193,6 +193,34 @@ function runGlobalRestore() {
193
193
  }
194
194
  console.log(" Global SolonGate enforcement uninstalled. Restart Claude Code.");
195
195
  }
196
+ async function runRepair() {
197
+ const p = globalPaths();
198
+ const out = (s) => void process.stderr.write(s + "\n");
199
+ const has = (f) => existsSync(f);
200
+ const guardFile = join(p.hooksDir, "guard.mjs");
201
+ out("");
202
+ out(" SolonGate repair");
203
+ out("");
204
+ out(" before:");
205
+ out(` guard hook file ${has(guardFile) ? "present" : "MISSING"}`);
206
+ out(` cloud credential ${has(p.configPath) ? "present" : "MISSING"}`);
207
+ out(` Claude Code settings ${isGuardInstalled() ? "guard registered" : "guard NOT registered"}`);
208
+ out(` Antigravity hooks ${has(p.antigravityHooksPath) ? "present" : "MISSING"}`);
209
+ out("");
210
+ const r = installGlobalQuiet();
211
+ if (!r.ok) {
212
+ out(` \u2717 ${r.message}`);
213
+ return 1;
214
+ }
215
+ out(" restored:");
216
+ out(` guard hook file present (v${installedGuardVersion() ?? "?"})`);
217
+ out(` Claude Code settings ${isGuardInstalled() ? "guard registered" : "NOT registered"}`);
218
+ out(` Antigravity hooks ${has(p.antigravityHooksPath) ? "present" : "MISSING"}`);
219
+ out("");
220
+ out(" \u2713 guard repaired. Open a new AI session for it to take effect.");
221
+ out("");
222
+ return 0;
223
+ }
196
224
  function installGlobalQuiet() {
197
225
  try {
198
226
  const p = globalPaths();
@@ -246,7 +274,7 @@ function installGlobalQuiet() {
246
274
  installAntigravityGuard(p, join(p.hooksDir, "guard.mjs").replace(/\\/g, "/"));
247
275
  } catch {
248
276
  }
249
- if (process.env["SOLONGATE_OS_LOCK"] === "1") lockProtected();
277
+ if (process.env["SOLONGATE_OS_LOCK"] !== "0") lockProtected();
250
278
  return { ok: true, message: "guard installed (open a new session)" };
251
279
  } catch (e) {
252
280
  return { ok: false, message: e instanceof Error ? e.message : String(e) };
@@ -436,7 +464,7 @@ async function runGlobalInstall(opts = {}) {
436
464
  console.log(` Registered Antigravity CLI guard \u2192 ${p.antigravityHooksPath}`);
437
465
  } catch {
438
466
  }
439
- if (process.env["SOLONGATE_OS_LOCK"] === "1") {
467
+ if (process.env["SOLONGATE_OS_LOCK"] !== "0") {
440
468
  lockProtected();
441
469
  console.log(" Locked protection files (OS-level read-only/immutable).");
442
470
  }
@@ -457,6 +485,7 @@ export {
457
485
  removeClaudeShim,
458
486
  runGlobalInstall,
459
487
  runGlobalRestore,
488
+ runRepair,
460
489
  uninstallGlobalQuiet,
461
490
  unlockProtected
462
491
  };
package/dist/index.js CHANGED
@@ -6202,6 +6202,7 @@ __export(global_install_exports, {
6202
6202
  removeClaudeShim: () => removeClaudeShim,
6203
6203
  runGlobalInstall: () => runGlobalInstall,
6204
6204
  runGlobalRestore: () => runGlobalRestore,
6205
+ runRepair: () => runRepair,
6205
6206
  uninstallGlobalQuiet: () => uninstallGlobalQuiet,
6206
6207
  unlockProtected: () => unlockProtected
6207
6208
  });
@@ -6396,6 +6397,34 @@ function runGlobalRestore() {
6396
6397
  }
6397
6398
  console.log(" Global SolonGate enforcement uninstalled. Restart Claude Code.");
6398
6399
  }
6400
+ async function runRepair() {
6401
+ const p = globalPaths();
6402
+ const out2 = (s) => void process.stderr.write(s + "\n");
6403
+ const has = (f) => existsSync3(f);
6404
+ const guardFile = join4(p.hooksDir, "guard.mjs");
6405
+ out2("");
6406
+ out2(" SolonGate repair");
6407
+ out2("");
6408
+ out2(" before:");
6409
+ out2(` guard hook file ${has(guardFile) ? "present" : "MISSING"}`);
6410
+ out2(` cloud credential ${has(p.configPath) ? "present" : "MISSING"}`);
6411
+ out2(` Claude Code settings ${isGuardInstalled() ? "guard registered" : "guard NOT registered"}`);
6412
+ out2(` Antigravity hooks ${has(p.antigravityHooksPath) ? "present" : "MISSING"}`);
6413
+ out2("");
6414
+ const r = installGlobalQuiet();
6415
+ if (!r.ok) {
6416
+ out2(` \u2717 ${r.message}`);
6417
+ return 1;
6418
+ }
6419
+ out2(" restored:");
6420
+ out2(` guard hook file present (v${installedGuardVersion() ?? "?"})`);
6421
+ out2(` Claude Code settings ${isGuardInstalled() ? "guard registered" : "NOT registered"}`);
6422
+ out2(` Antigravity hooks ${has(p.antigravityHooksPath) ? "present" : "MISSING"}`);
6423
+ out2("");
6424
+ out2(" \u2713 guard repaired. Open a new AI session for it to take effect.");
6425
+ out2("");
6426
+ return 0;
6427
+ }
6399
6428
  function installGlobalQuiet() {
6400
6429
  try {
6401
6430
  const p = globalPaths();
@@ -6449,7 +6478,7 @@ function installGlobalQuiet() {
6449
6478
  installAntigravityGuard(p, join4(p.hooksDir, "guard.mjs").replace(/\\/g, "/"));
6450
6479
  } catch {
6451
6480
  }
6452
- if (process.env["SOLONGATE_OS_LOCK"] === "1") lockProtected();
6481
+ if (process.env["SOLONGATE_OS_LOCK"] !== "0") lockProtected();
6453
6482
  return { ok: true, message: "guard installed (open a new session)" };
6454
6483
  } catch (e) {
6455
6484
  return { ok: false, message: e instanceof Error ? e.message : String(e) };
@@ -6637,7 +6666,7 @@ async function runGlobalInstall(opts = {}) {
6637
6666
  console.log(` Registered Antigravity CLI guard \u2192 ${p.antigravityHooksPath}`);
6638
6667
  } catch {
6639
6668
  }
6640
- if (process.env["SOLONGATE_OS_LOCK"] === "1") {
6669
+ if (process.env["SOLONGATE_OS_LOCK"] !== "0") {
6641
6670
  lockProtected();
6642
6671
  console.log(" Locked protection files (OS-level read-only/immutable).");
6643
6672
  }
@@ -16058,7 +16087,7 @@ ${msg.content.text}`;
16058
16087
 
16059
16088
  // src/index.ts
16060
16089
  init_cli_utils();
16061
- var CLI_SUBCOMMANDS = /* @__PURE__ */ new Set(["update", "logs-server", "local-logs", "policy", "ratelimit", "dlp", "stats", "audit", "sessions", "session", "doctor", "watch", "alerts", "webhooks", "dataroom"]);
16090
+ var CLI_SUBCOMMANDS = /* @__PURE__ */ new Set(["update", "repair", "logs-server", "local-logs", "policy", "ratelimit", "dlp", "stats", "audit", "sessions", "session", "doctor", "watch", "alerts", "webhooks", "dataroom"]);
16062
16091
  var CLI_INFO_ARGS = /* @__PURE__ */ new Set(["login", "help", "--help", "-h", "--version", "-v", "version"]);
16063
16092
  var IS_HUMAN_CLI = process.argv.length <= 2 || CLI_SUBCOMMANDS.has(process.argv[2] ?? "") || CLI_INFO_ARGS.has(process.argv[2] ?? "");
16064
16093
  if (!IS_HUMAN_CLI) {
@@ -16120,6 +16149,7 @@ function printHelp() {
16120
16149
  head("Setup & status");
16121
16150
  cmd("solongate", "open the dataroom UI (login, policies, audit, settings)");
16122
16151
  cmd("update", "update SolonGate to the newest version and refresh the guard");
16152
+ cmd("repair", "restore the guard + hook + settings files if they were deleted or disarmed");
16123
16153
  cmd("doctor", "health check: login, policy, guard, local logs");
16124
16154
  cmd("doctor --json", "the same health check as machine-readable JSON");
16125
16155
  cmd("logs-server start", "start the local audit-log service for the dashboard (background)");
@@ -16262,6 +16292,10 @@ async function main() {
16262
16292
  const { runUpdateCommand: runUpdateCommand2 } = await Promise.resolve().then(() => (init_self_update(), self_update_exports));
16263
16293
  process.exit(await runUpdateCommand2());
16264
16294
  }
16295
+ if (subcommand === "repair") {
16296
+ const { runRepair: runRepair2 } = await Promise.resolve().then(() => (init_global_install(), global_install_exports));
16297
+ process.exit(await runRepair2());
16298
+ }
16265
16299
  if (subcommand === "logs-server" || subcommand === "local-logs") {
16266
16300
  const { runLogsServer: runLogsServer2 } = await Promise.resolve().then(() => (init_logs_server(), logs_server_exports));
16267
16301
  await runLogsServer2();
package/dist/tui/index.js CHANGED
@@ -217,7 +217,7 @@ function installGlobalQuiet() {
217
217
  installAntigravityGuard(p, join6(p.hooksDir, "guard.mjs").replace(/\\/g, "/"));
218
218
  } catch {
219
219
  }
220
- if (process.env["SOLONGATE_OS_LOCK"] === "1") lockProtected();
220
+ if (process.env["SOLONGATE_OS_LOCK"] !== "0") lockProtected();
221
221
  return { ok: true, message: "guard installed (open a new session)" };
222
222
  } catch (e) {
223
223
  return { ok: false, message: e instanceof Error ? e.message : String(e) };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solongate/proxy",
3
- "version": "0.82.45",
3
+ "version": "0.82.46",
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": {