-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path_test_richtext.cjs
More file actions
36 lines (29 loc) · 1.32 KB
/
Copy path_test_richtext.cjs
File metadata and controls
36 lines (29 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
const Database = require('better-sqlite3');
const path = require('path');
const dbPath = path.join(process.env.APPDATA, 'Cursor', 'User', 'globalStorage', 'state.vscdb');
const db = new Database(dbPath, { readonly: true });
// Get all composerData rows
const rows = db.prepare("SELECT key, value FROM cursorDiskKV WHERE key LIKE 'composerData:%'").all();
console.log('ComposerData rows:', rows.length);
// For each, check if it has bubbles with richText
for (const row of rows) {
const cid = row.key.slice('composerData:'.length);
const meta = JSON.parse(row.value);
const cs = meta.conversationState || '';
const name = meta.name || '';
// Get bubbles for this composer
const stmt = db.prepare("SELECT key, value FROM cursorDiskKV WHERE key LIKE ?");
const bubbles = stmt.all('bubbleId:' + cid + ':%');
let hasText = false;
let hasRichText = false;
let totalBubbles = 0;
for (const b of bubbles) {
const bd = JSON.parse(b.value);
totalBubbles++;
if (bd.text && bd.text.trim()) hasText = true;
if (bd.richText && bd.richText.trim()) hasRichText = true;
}
console.log(cid.slice(0,12), 'cs_len=' + cs.length, 'name=' + (name || '(none)').slice(0,30),
'bubbles=' + totalBubbles, 'hasText=' + hasText, 'hasRichText=' + hasRichText);
}
db.close();