claude-discover 1.10.6 → 1.10.7

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/out/main/main.js CHANGED
@@ -1696,13 +1696,13 @@ class ClaudeSettings {
1696
1696
  }
1697
1697
  }
1698
1698
  }
1699
- // Days Claude Code keeps transcripts before auto-deleting them; undefined when unset (its default is 30).
1700
- get cleanupPeriodDays() {
1701
- return this.cfg.cleanupPeriodDays;
1699
+ // Any top-level setting; undefined when unset, and setting undefined removes the key.
1700
+ get(key) {
1701
+ return this.cfg[key];
1702
1702
  }
1703
- set cleanupPeriodDays(days) {
1704
- if (days === void 0) delete this.cfg.cleanupPeriodDays;
1705
- else this.cfg.cleanupPeriodDays = days;
1703
+ set(key, value) {
1704
+ if (value === void 0) delete this.cfg[key];
1705
+ else this.cfg[key] = value;
1706
1706
  }
1707
1707
  // Claude Code's status line config: { type: 'command', command }; undefined when unset.
1708
1708
  get statusLine() {
@@ -1884,7 +1884,8 @@ class ProxySwitch {
1884
1884
  } catch {
1885
1885
  throw new Error("Cannot reach api.anthropic.com — not enabling capture. Check your network and try again.");
1886
1886
  }
1887
- await this.#exit();
1887
+ if (!await this.#exit())
1888
+ throw new Error(`The running proxy on ${PROXY_URL} did not exit — try again.`);
1888
1889
  await this.#service.install();
1889
1890
  if (!await this.#settle(true)) {
1890
1891
  await this.#service.uninstall().catch(() => {
@@ -1904,17 +1905,17 @@ class ProxySwitch {
1904
1905
  settings.save();
1905
1906
  await new Promise((r) => setTimeout(r, SETTINGS_RELOAD_GRACE_MS));
1906
1907
  }
1907
- await this.#exit();
1908
+ const exited = await this.#exit();
1908
1909
  await this.#service.uninstall();
1910
+ if (!exited) throw new Error(`The proxy on ${PROXY_URL} did not exit and still holds the port.`);
1909
1911
  }
1910
- // Ask a running instance to exit via its control route and wait for the port to free up
1912
+ // Ask a running instance to exit via its control route; true once the port is free
1911
1913
  async #exit() {
1912
1914
  try {
1913
1915
  await fetch(`${PROXY_URL}${EXIT_ROUTE}`, { method: "POST", signal: AbortSignal.timeout(1e3) });
1914
1916
  } catch {
1915
- return;
1916
1917
  }
1917
- await this.#settle(false);
1918
+ return this.#settle(false);
1918
1919
  }
1919
1920
  async #running() {
1920
1921
  try {
@@ -1960,28 +1961,37 @@ class StatuslineSwitch {
1960
1961
  }
1961
1962
  }
1962
1963
  }
1963
- const DEFAULT_DAYS = 30;
1964
- const RETAIN_DAYS = 365;
1965
- class RetentionSwitch {
1964
+ const SETTINGS = [
1965
+ { key: "cleanupPeriodDays", value: 365, fallback: 30, isOn: (days) => days >= 365, oneWay: true },
1966
+ // this app can only browse transcripts Claude Code hasn't swept yet; lowering it would let the next sweep delete them for good
1967
+ { key: "showThinkingSummaries", value: true, fallback: false }
1968
+ // otherwise transcripts hold only empty thinking blocks
1969
+ ];
1970
+ const isOn = (s, settings) => {
1971
+ const value = settings.get(s.key) ?? s.fallback;
1972
+ return s.isOn ? s.isOn(value) : value === s.value;
1973
+ };
1974
+ class ClaudeSettingsSwitch {
1966
1975
  status() {
1967
- const days = new ClaudeSettings().cleanupPeriodDays ?? DEFAULT_DAYS;
1968
- return { days, raised: days >= RETAIN_DAYS };
1976
+ const settings = new ClaudeSettings();
1977
+ return { applied: SETTINGS.filter((s) => isOn(s, settings)).length, total: SETTINGS.length };
1969
1978
  }
1970
- // Raise retention to RETAIN_DAYS; an already-higher value is left as is.
1979
+ // A value that already counts as on (e.g. a longer retention) is left as is
1971
1980
  activate() {
1972
1981
  const settings = new ClaudeSettings();
1973
- if ((settings.cleanupPeriodDays ?? DEFAULT_DAYS) < RETAIN_DAYS) {
1974
- settings.cleanupPeriodDays = RETAIN_DAYS;
1975
- settings.save();
1982
+ const off = SETTINGS.filter((s) => !isOn(s, settings));
1983
+ for (const s of off) {
1984
+ settings.set(s.key, s.value);
1976
1985
  }
1986
+ if (off.length) settings.save();
1977
1987
  }
1978
- // Remove the setting — back to Claude Code's default.
1979
1988
  deactivate() {
1980
1989
  const settings = new ClaudeSettings();
1981
- if (settings.cleanupPeriodDays !== void 0) {
1982
- settings.cleanupPeriodDays = void 0;
1983
- settings.save();
1990
+ const set = SETTINGS.filter((s) => !s.oneWay && settings.get(s.key) !== void 0);
1991
+ for (const s of set) {
1992
+ settings.set(s.key, void 0);
1984
1993
  }
1994
+ if (set.length) settings.save();
1985
1995
  }
1986
1996
  }
1987
1997
  class ClaudeDirSwitch {
@@ -2018,7 +2028,7 @@ class Switchers {
2018
2028
  this.#switches = {
2019
2029
  proxy: new ProxySwitch(),
2020
2030
  statusline: new StatuslineSwitch(),
2021
- retention: new RetentionSwitch(),
2031
+ settings: new ClaudeSettingsSwitch(),
2022
2032
  claudedir: new ClaudeDirSwitch({ restart })
2023
2033
  };
2024
2034
  }
@@ -2231,12 +2241,7 @@ class Application {
2231
2241
  ipcMain.handle("deeplink:take-pending", () => deepLink?.takePending() ?? null);
2232
2242
  ipcMain.on("find:close", () => win.findBar?.hide());
2233
2243
  ipcMain.on("claude-settings:get", (e) => e.returnValue = { claudeDir: CLAUDE_DIR });
2234
- app.on("activate", () => {
2235
- if (BrowserWindow.getAllWindows().length === 0) win.create();
2236
- });
2237
- app.on("window-all-closed", () => {
2238
- if (process.platform !== "darwin") app.quit();
2239
- });
2244
+ app.on("window-all-closed", () => app.quit());
2240
2245
  app.on("will-quit", async (e) => {
2241
2246
  e.preventDefault();
2242
2247
  await switchers.deactivateOnQuit();