@solongate/proxy 0.82.82 → 0.82.84

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.
@@ -1 +1,13 @@
1
+ export interface Check {
2
+ name: string;
3
+ ok: boolean | 'warn';
4
+ detail: string;
5
+ }
6
+ /**
7
+ * The health check itself, with no printing — so the same checks back both
8
+ * `solongate doctor` and the Settings panel in the dataroom. Ink owns the
9
+ * terminal while the TUI is up, so anything it calls must return data rather
10
+ * than write to the stream.
11
+ */
12
+ export declare function collectChecks(): Promise<Check[]>;
1
13
  export declare function run(argv: string[]): Promise<number>;
@@ -1184,9 +1184,7 @@ function localLogFile() {
1184
1184
  var LOCAL_LOG = localLogFile();
1185
1185
 
1186
1186
  // src/commands/doctor.ts
1187
- async function run6(argv) {
1188
- const { flags } = parse(argv);
1189
- const json = flagBool(flags, "json");
1187
+ async function collectChecks() {
1190
1188
  const checks = [];
1191
1189
  if (!isAuthenticated()) {
1192
1190
  checks.push({ name: "login", ok: false, detail: "not logged in - run `solongate`, add your account in the Accounts panel" });
@@ -1244,6 +1242,12 @@ async function run6(argv) {
1244
1242
  } else {
1245
1243
  checks.push({ name: "local logs", ok: "warn", detail: "off (logs go to cloud) - enable in dashboard \u2192 Settings" });
1246
1244
  }
1245
+ return checks;
1246
+ }
1247
+ async function run6(argv) {
1248
+ const { flags } = parse(argv);
1249
+ const json = flagBool(flags, "json");
1250
+ const checks = await collectChecks();
1247
1251
  if (json) return printJson(checks), checks.some((c2) => c2.ok === false) ? 1 : 0;
1248
1252
  err("");
1249
1253
  err(` ${bold("SolonGate doctor")}`);
@@ -65,6 +65,25 @@ export declare function runGlobalRestore(): void;
65
65
  * + cloud config) and re-registers the hooks in Claude Code and Antigravity, then
66
66
  * re-locks. Reuses the logged-in account, so no re-login. Human-only (gated).
67
67
  */
68
+ export interface RepairLine {
69
+ label: string;
70
+ ok: boolean;
71
+ detail: string;
72
+ }
73
+ export interface RepairReport {
74
+ ok: boolean;
75
+ message: string;
76
+ before: RepairLine[];
77
+ after: RepairLine[];
78
+ notes: string[];
79
+ }
80
+ /**
81
+ * The repair itself, with no printing — so the same restore backs both
82
+ * `solongate repair` and the Settings panel in the dataroom. Ink owns the
83
+ * terminal while the TUI is up, so anything it calls must return data instead
84
+ * of writing to the stream (see installGlobalQuiet).
85
+ */
86
+ export declare function repairQuiet(): RepairReport;
68
87
  export declare function runRepair(): Promise<number>;
69
88
  export declare function installGlobalQuiet(): {
70
89
  ok: boolean;
@@ -373,44 +373,57 @@ function runGlobalRestore() {
373
373
  }
374
374
  console.log(" Global SolonGate enforcement uninstalled. Restart Claude Code.");
375
375
  }
376
- async function runRepair() {
376
+ function repairQuiet() {
377
377
  const p = globalPaths();
378
- const out = (s) => void process.stderr.write(s + "\n");
379
378
  const has = (f) => existsSync(f);
380
379
  const guardFile = join(p.hooksDir, "guard.mjs");
380
+ const line = (label, ok, yes, no) => ({ label, ok, detail: ok ? yes : no });
381
+ const before = [
382
+ line("guard hook file", has(guardFile), "present", "MISSING"),
383
+ line("cloud credential", has(p.configPath), "present", "MISSING"),
384
+ line("Claude Code settings", isGuardInstalled(), "guard registered", "guard NOT registered"),
385
+ line("Antigravity hooks", has(p.antigravityHooksPath), "present", "MISSING"),
386
+ line("Codex hooks", isCodexGuardInstalled(), "guard registered", "guard NOT registered")
387
+ ];
388
+ const r = installGlobalQuiet();
389
+ if (!r.ok) return { ok: false, message: r.message, before, after: [], notes: [] };
390
+ const after = [
391
+ { label: "guard hook file", ok: true, detail: `present (v${installedGuardVersion() ?? "?"})` },
392
+ line("Claude Code settings", isGuardInstalled(), "guard registered", "NOT registered"),
393
+ line("Antigravity hooks", has(p.antigravityHooksPath), "present", "MISSING"),
394
+ line("Codex hooks", isCodexGuardInstalled(), "guard registered", "NOT registered")
395
+ ];
396
+ const notes = [];
397
+ const cx = codexHooksStatus();
398
+ if (cx.registered && !cx.trusted) {
399
+ notes.push("Codex only: run `/hooks` inside Codex once and trust the SolonGate hooks (Codex skips any hook it has not been told to trust).");
400
+ }
401
+ if (cx.disabled) {
402
+ notes.push("Codex only: hooks are turned OFF in ~/.codex/config.toml ([features] hooks = false) - the guard cannot run there until that line is removed.");
403
+ }
404
+ return { ok: true, message: "guard repaired. Open a new AI session for it to take effect.", before, after, notes };
405
+ }
406
+ async function runRepair() {
407
+ const out = (s) => void process.stderr.write(s + "\n");
408
+ const rep = repairQuiet();
381
409
  out("");
382
410
  out(" SolonGate repair");
383
411
  out("");
384
412
  out(" before:");
385
- out(` guard hook file ${has(guardFile) ? "present" : "MISSING"}`);
386
- out(` cloud credential ${has(p.configPath) ? "present" : "MISSING"}`);
387
- out(` Claude Code settings ${isGuardInstalled() ? "guard registered" : "guard NOT registered"}`);
388
- out(` Antigravity hooks ${has(p.antigravityHooksPath) ? "present" : "MISSING"}`);
389
- out(` Codex hooks ${isCodexGuardInstalled() ? "guard registered" : "guard NOT registered"}`);
413
+ for (const l of rep.before) out(` ${l.label.padEnd(20)} ${l.detail}`);
390
414
  out("");
391
- const r = installGlobalQuiet();
392
- if (!r.ok) {
393
- out(` \u2717 ${r.message}`);
415
+ if (!rep.ok) {
416
+ out(` \u2717 ${rep.message}`);
394
417
  return 1;
395
418
  }
396
419
  out(" restored:");
397
- out(` guard hook file present (v${installedGuardVersion() ?? "?"})`);
398
- out(` Claude Code settings ${isGuardInstalled() ? "guard registered" : "NOT registered"}`);
399
- out(` Antigravity hooks ${has(p.antigravityHooksPath) ? "present" : "MISSING"}`);
400
- out(` Codex hooks ${isCodexGuardInstalled() ? "guard registered" : "NOT registered"}`);
420
+ for (const l of rep.after) out(` ${l.label.padEnd(20)} ${l.detail}`);
401
421
  out("");
402
- const cx = codexHooksStatus();
403
- if (cx.registered && !cx.trusted) {
404
- out(" Codex only: run `/hooks` inside Codex once and trust the SolonGate hooks");
405
- out(" (Codex skips any hook it has not been told to trust).");
406
- out("");
407
- }
408
- if (cx.disabled) {
409
- out(" Codex only: hooks are turned OFF in ~/.codex/config.toml ([features] hooks = false)");
410
- out(" \u2014 the guard cannot run there until that line is removed.");
422
+ for (const n of rep.notes) {
423
+ out(` ${n}`);
411
424
  out("");
412
425
  }
413
- out(" \u2713 guard repaired. Open a new AI session for it to take effect.");
426
+ out(` \u2713 ${rep.message}`);
414
427
  out("");
415
428
  return 0;
416
429
  }
@@ -702,6 +715,7 @@ export {
702
715
  isGuardInstalled,
703
716
  lockProtected,
704
717
  removeClaudeShim,
718
+ repairQuiet,
705
719
  runGlobalInstall,
706
720
  runGlobalRestore,
707
721
  runRepair,