conare 0.0.7 → 0.0.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.
Files changed (2) hide show
  1. package/dist/index.js +34 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -171,7 +171,39 @@ function countJsonlFiles(dir) {
171
171
  }
172
172
  function countCursorSessions(dbPath) {
173
173
  try {
174
- const result = spawnSync("sqlite3", [dbPath, "SELECT COUNT(*) FROM cursorDiskKV WHERE key LIKE 'composerData:%';"], { encoding: "utf-8" });
174
+ const result = spawnSync("sqlite3", [
175
+ dbPath,
176
+ `
177
+ WITH composer_rows AS (
178
+ SELECT substr(key, 14) AS composer_id, value AS composer_json
179
+ FROM cursorDiskKV
180
+ WHERE key LIKE 'composerData:%'
181
+ ),
182
+ headers AS (
183
+ SELECT
184
+ composer_id,
185
+ json_extract(j.value, '$.bubbleId') AS bubble_id,
186
+ json_extract(j.value, '$.type') AS type
187
+ FROM composer_rows, json_each(json_extract(composer_json, '$.fullConversationHeadersOnly')) AS j
188
+ ),
189
+ messages AS (
190
+ SELECT h.composer_id, h.type
191
+ FROM headers h
192
+ JOIN cursorDiskKV kv
193
+ ON kv.key = 'bubbleId:' || h.composer_id || ':' || h.bubble_id
194
+ WHERE h.type IN (1, 2)
195
+ AND length(COALESCE(json_extract(kv.value, '$.text'), '')) >= 50
196
+ )
197
+ SELECT count(*)
198
+ FROM (
199
+ SELECT composer_id
200
+ FROM messages
201
+ GROUP BY composer_id
202
+ HAVING SUM(CASE WHEN type = 1 THEN 1 ELSE 0 END) > 0
203
+ AND SUM(CASE WHEN type = 2 THEN 1 ELSE 0 END) > 0
204
+ );
205
+ `.trim()
206
+ ], { encoding: "utf-8" });
175
207
  if (result.status !== 0)
176
208
  return 0;
177
209
  const count = Number.parseInt(result.stdout.trim(), 10);
@@ -1721,7 +1753,7 @@ var J = `${import_picocolors2.default.gray(o)} `;
1721
1753
  function formatDetectedCount(count) {
1722
1754
  if (count === undefined)
1723
1755
  return "available";
1724
- return `${count.toLocaleString()} found`;
1756
+ return `${count.toLocaleString()} chats`;
1725
1757
  }
1726
1758
  function ensureValue(value) {
1727
1759
  if (pD(value)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "conare",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "description": "Conare CLI for ingesting AI chat history and configuring memory at conare.ai",
5
5
  "type": "module",
6
6
  "bin": {