conare 0.5.13 → 0.5.14

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.
Files changed (2) hide show
  1. package/dist/index.js +41 -20
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1825,20 +1825,27 @@ function showDetectedApps(targets) {
1825
1825
  `), "Detected apps");
1826
1826
  }
1827
1827
  function showCountingLocalChats() {
1828
- M2.step("Counting local chats...");
1828
+ countingSpinner = Y2();
1829
+ countingSpinner.start("Scanning local chats");
1829
1830
  }
1830
1831
  function showCountingToolChats(tool) {
1831
- M2.step(`Counting ${tool} chats...`);
1832
+ countingSpinner?.message(`Scanning ${tool} chats`);
1832
1833
  }
1833
1834
  function showCountingToolProgress(tool, checked, found, total) {
1834
- const checkedText = total ? `${checked.toLocaleString()}/${total.toLocaleString()} checked` : `${checked.toLocaleString()} checked`;
1835
- M2.message(`${tool}: ${checkedText}, ${found.toLocaleString()} importable`);
1835
+ const checkedText = total ? `${checked.toLocaleString()}/${total.toLocaleString()}` : checked.toLocaleString();
1836
+ countingSpinner?.message(`Scanning ${tool}: ${checkedText} files, ${found.toLocaleString()} importable`);
1836
1837
  }
1837
1838
  function showCountingToolDone(tool, count) {
1838
- M2.success(`${tool}: ~${count.toLocaleString()} chats`);
1839
+ toolTotals[tool] = count;
1840
+ countingSpinner?.message(`${tool}: ${count.toLocaleString()} chats`);
1839
1841
  }
1840
1842
  function showLocalChatsCounted() {
1841
- M2.success("Local chats counted");
1843
+ if (!countingSpinner)
1844
+ return;
1845
+ const entries = Object.entries(toolTotals).filter(([, n]) => n > 0);
1846
+ const summary = entries.length ? entries.map(([tool, n]) => `${tool} ${n.toLocaleString()}`).join(", ") : "no chats found";
1847
+ countingSpinner.stop(`Found ${summary}`);
1848
+ countingSpinner = null;
1842
1849
  }
1843
1850
  async function promptApiKey(options) {
1844
1851
  if (options.providedApiKey) {
@@ -1929,8 +1936,10 @@ async function confirmBackgroundSync() {
1929
1936
  }));
1930
1937
  return value === "yes";
1931
1938
  }
1939
+ var countingSpinner = null, toolTotals;
1932
1940
  var init_interactive = __esm(() => {
1933
1941
  init_dist2();
1942
+ toolTotals = {};
1934
1943
  });
1935
1944
 
1936
1945
  // src/index.ts
@@ -2062,7 +2071,7 @@ function getParentUuid(lines) {
2062
2071
  }
2063
2072
  return;
2064
2073
  }
2065
- function countImportableClaudeSessions(onProgress) {
2074
+ async function countImportableClaudeSessions(onProgress) {
2066
2075
  const projectsDir = join2(homedir2(), ".claude", "projects");
2067
2076
  let count = 0;
2068
2077
  let checked = 0;
@@ -2083,7 +2092,11 @@ function countImportableClaudeSessions(onProgress) {
2083
2092
  return { projPath, files: [] };
2084
2093
  }
2085
2094
  });
2086
- const report = () => onProgress?.({ checked, found: count, total });
2095
+ const yieldToEventLoop = () => new Promise((resolve) => setImmediate(resolve));
2096
+ const checkpoint = async () => {
2097
+ onProgress?.({ checked, found: count, total });
2098
+ await yieldToEventLoop();
2099
+ };
2087
2100
  for (const { projPath, files } of projectFiles) {
2088
2101
  for (const file of files) {
2089
2102
  checked++;
@@ -2094,7 +2107,7 @@ function countImportableClaudeSessions(onProgress) {
2094
2107
  const parentUuid = getParentUuid(lines);
2095
2108
  if (parentUuid != null) {
2096
2109
  if (checked % 100 === 0)
2097
- report();
2110
+ await checkpoint();
2098
2111
  continue;
2099
2112
  }
2100
2113
  const { turns } = parseSession(lines);
@@ -2102,14 +2115,14 @@ function countImportableClaudeSessions(onProgress) {
2102
2115
  count++;
2103
2116
  } catch {
2104
2117
  if (checked % 100 === 0)
2105
- report();
2118
+ await checkpoint();
2106
2119
  continue;
2107
2120
  }
2108
2121
  if (checked % 100 === 0)
2109
- report();
2122
+ await checkpoint();
2110
2123
  }
2111
2124
  }
2112
- report();
2125
+ onProgress?.({ checked, found: count, total });
2113
2126
  return count;
2114
2127
  }
2115
2128
  function ingestClaude() {
@@ -2302,13 +2315,19 @@ function walkCodexSessionFiles(dir, visit) {
2302
2315
  }
2303
2316
  } catch {}
2304
2317
  }
2305
- function countImportableCodexSessions(onProgress) {
2318
+ async function countImportableCodexSessions(onProgress) {
2306
2319
  const sessionsDir = join3(homedir3(), ".codex", "sessions");
2307
2320
  if (!existsSync3(sessionsDir))
2308
2321
  return 0;
2322
+ const files = [];
2323
+ walkCodexSessionFiles(sessionsDir, (filePath) => {
2324
+ files.push(filePath);
2325
+ });
2326
+ const total = files.length;
2309
2327
  let count = 0;
2310
2328
  let checked = 0;
2311
- walkCodexSessionFiles(sessionsDir, (filePath) => {
2329
+ const yieldToEventLoop = () => new Promise((resolve) => setImmediate(resolve));
2330
+ for (const filePath of files) {
2312
2331
  checked++;
2313
2332
  try {
2314
2333
  const lines = readFileSync3(filePath, "utf-8").split(`
@@ -2317,10 +2336,12 @@ function countImportableCodexSessions(onProgress) {
2317
2336
  if (rounds.length > 0)
2318
2337
  count++;
2319
2338
  } catch {}
2320
- if (checked % 100 === 0)
2321
- onProgress?.({ checked, found: count });
2322
- });
2323
- onProgress?.({ checked, found: count });
2339
+ if (checked % 100 === 0) {
2340
+ onProgress?.({ checked, found: count, total });
2341
+ await yieldToEventLoop();
2342
+ }
2343
+ }
2344
+ onProgress?.({ checked, found: count, total });
2324
2345
  return count;
2325
2346
  }
2326
2347
  function walkCodexSessions(dir, memories, sessionIds, stats) {
@@ -2797,7 +2818,7 @@ async function detect(options = {}) {
2797
2818
  const claudeDir = join5(home, ".claude", "projects");
2798
2819
  if (existsSync5(claudeDir)) {
2799
2820
  onProgress?.({ tool: "Claude Code", status: "start" });
2800
- const sessionCount = countImportableClaudeSessions((progress) => {
2821
+ const sessionCount = await countImportableClaudeSessions((progress) => {
2801
2822
  onProgress?.({ tool: "Claude Code", status: "progress", ...progress });
2802
2823
  });
2803
2824
  onProgress?.({ tool: "Claude Code", status: "done", count: sessionCount });
@@ -2810,7 +2831,7 @@ async function detect(options = {}) {
2810
2831
  const codexSessions = join5(home, ".codex", "sessions");
2811
2832
  if (existsSync5(codexConfig) || existsSync5(codexSessions)) {
2812
2833
  onProgress?.({ tool: "Codex", status: "start" });
2813
- const sessionCount = countImportableCodexSessions((progress) => {
2834
+ const sessionCount = await countImportableCodexSessions((progress) => {
2814
2835
  onProgress?.({ tool: "Codex", status: "progress", ...progress });
2815
2836
  });
2816
2837
  onProgress?.({ tool: "Codex", status: "done", count: sessionCount });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "conare",
3
- "version": "0.5.13",
3
+ "version": "0.5.14",
4
4
  "description": "Conare CLI for indexing AI chat history and configuring memory at conare.ai",
5
5
  "type": "module",
6
6
  "bin": {