From 8120f1937f24efe0e4197d020dc8b28808dd361e Mon Sep 17 00:00:00 2001 From: AgentSeal Date: Wed, 15 Apr 2026 04:31:06 -0700 Subject: [PATCH] chore: add debug query script --- debug-query.cjs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 debug-query.cjs diff --git a/debug-query.cjs b/debug-query.cjs new file mode 100644 index 00000000..c702b430 --- /dev/null +++ b/debug-query.cjs @@ -0,0 +1,26 @@ +const Database = require('better-sqlite3') +const path = require('path') +const os = require('os') + +const dbPath = path.join(os.homedir(), 'Library', 'Application Support', 'Cursor', 'User', 'globalStorage', 'state.vscdb') +const db = new Database(dbPath, { readonly: true }) + +const floor = new Date(Date.now() - 120 * 24 * 60 * 60 * 1000).toISOString() +console.log('Time floor:', floor) + +const rows = db.prepare(` + SELECT + json_extract(value, '$.tokenCount.inputTokens') as it, + json_extract(value, '$.tokenCount.outputTokens') as ot, + json_extract(value, '$.createdAt') as ts + FROM cursorDiskKV + WHERE key LIKE 'bubbleId:%' + AND json_extract(value, '$.tokenCount.inputTokens') > 0 + AND json_extract(value, '$.createdAt') > ? + ORDER BY json_extract(value, '$.createdAt') DESC + LIMIT 5 +`).all(floor) + +console.log('Rows found:', rows.length) +console.log('Sample:', rows) +db.close()