summaryrefslogtreecommitdiff
path: root/extractcursor.rb
blob: 86ea0b213f9732cc60e33f9b1a6427bad1df7509 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
require 'sqlite3'

db_path = File.expand_path('~/.config/Cursor/User/globalStorage/state.vscdb') # Adjust if needed
table = 'cursorDiskKV'

db = SQLite3::Database.new(db_path)
columns = db.execute("PRAGMA table_info(#{table});").map { |col| col[1] }
rows = db.execute("SELECT * FROM #{table};")

File.open('cursor_chat_history.txt', 'w') do |file|
  file.puts columns.join("\t")
  rows.each { |row| file.puts row.join("\t") }
end

puts "Exported #{rows.size} rows from #{table} to cursor_chat_history.txt"