cursor-history 0.5.1 → 0.8.0
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.
- package/LICENSE +7 -0
- package/README.md +385 -2
- package/dist/cli/commands/backup.d.ts +9 -0
- package/dist/cli/commands/backup.d.ts.map +1 -0
- package/dist/cli/commands/backup.js +168 -0
- package/dist/cli/commands/backup.js.map +1 -0
- package/dist/cli/commands/export.d.ts.map +1 -1
- package/dist/cli/commands/export.js +39 -7
- package/dist/cli/commands/export.js.map +1 -1
- package/dist/cli/commands/list-backups.d.ts +9 -0
- package/dist/cli/commands/list-backups.d.ts.map +1 -0
- package/dist/cli/commands/list-backups.js +166 -0
- package/dist/cli/commands/list-backups.js.map +1 -0
- package/dist/cli/commands/list.d.ts.map +1 -1
- package/dist/cli/commands/list.js +44 -9
- package/dist/cli/commands/list.js.map +1 -1
- package/dist/cli/commands/migrate-session.d.ts +12 -0
- package/dist/cli/commands/migrate-session.d.ts.map +1 -0
- package/dist/cli/commands/migrate-session.js +125 -0
- package/dist/cli/commands/migrate-session.js.map +1 -0
- package/dist/cli/commands/migrate.d.ts +13 -0
- package/dist/cli/commands/migrate.d.ts.map +1 -0
- package/dist/cli/commands/migrate.js +122 -0
- package/dist/cli/commands/migrate.js.map +1 -0
- package/dist/cli/commands/restore.d.ts +9 -0
- package/dist/cli/commands/restore.d.ts.map +1 -0
- package/dist/cli/commands/restore.js +192 -0
- package/dist/cli/commands/restore.js.map +1 -0
- package/dist/cli/commands/search.d.ts.map +1 -1
- package/dist/cli/commands/search.js +31 -3
- package/dist/cli/commands/search.js.map +1 -1
- package/dist/cli/commands/show.d.ts.map +1 -1
- package/dist/cli/commands/show.js +32 -4
- package/dist/cli/commands/show.js.map +1 -1
- package/dist/cli/errors.d.ts +56 -0
- package/dist/cli/errors.d.ts.map +1 -0
- package/dist/cli/errors.js +90 -0
- package/dist/cli/errors.js.map +1 -0
- package/dist/cli/index.js +11 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/core/backup.d.ts +89 -0
- package/dist/core/backup.d.ts.map +1 -0
- package/dist/core/backup.js +709 -0
- package/dist/core/backup.js.map +1 -0
- package/dist/core/migrate.d.ts +40 -0
- package/dist/core/migrate.d.ts.map +1 -0
- package/dist/core/migrate.js +586 -0
- package/dist/core/migrate.js.map +1 -0
- package/dist/core/storage.d.ts +78 -6
- package/dist/core/storage.d.ts.map +1 -1
- package/dist/core/storage.js +327 -45
- package/dist/core/storage.js.map +1 -1
- package/dist/core/types.d.ts +280 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/lib/backup.d.ts +98 -0
- package/dist/lib/backup.d.ts.map +1 -0
- package/dist/lib/backup.js +108 -0
- package/dist/lib/backup.js.map +1 -0
- package/dist/lib/config.d.ts +33 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/config.js +81 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/errors.d.ts +257 -30
- package/dist/lib/errors.d.ts.map +1 -1
- package/dist/lib/errors.js +404 -54
- package/dist/lib/errors.js.map +1 -1
- package/dist/lib/index.d.ts +219 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/index.js +520 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/platform.d.ts +11 -0
- package/dist/lib/platform.d.ts.map +1 -1
- package/dist/lib/platform.js +32 -0
- package/dist/lib/platform.js.map +1 -1
- package/dist/lib/types.d.ts +374 -0
- package/dist/lib/types.d.ts.map +1 -0
- package/dist/lib/types.js +9 -0
- package/dist/lib/types.js.map +1 -0
- package/dist/lib/utils.d.ts +17 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +20 -0
- package/dist/lib/utils.js.map +1 -0
- package/package.json +32 -4
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public TypeScript type definitions for cursor-history library
|
|
3
|
+
*
|
|
4
|
+
* IMPORTANT: This is a library interface for direct import and use in TypeScript/JavaScript
|
|
5
|
+
* projects, NOT a network/REST API. Functions are imported directly:
|
|
6
|
+
* `import { Session, Message } from 'cursor-history'`
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Represents a complete chat conversation with metadata and messages.
|
|
10
|
+
*/
|
|
11
|
+
export interface Session {
|
|
12
|
+
/** Unique identifier (database row ID or composite key) */
|
|
13
|
+
id: string;
|
|
14
|
+
/** Absolute path to workspace directory */
|
|
15
|
+
workspace: string;
|
|
16
|
+
/** ISO 8601 timestamp of session creation */
|
|
17
|
+
timestamp: string;
|
|
18
|
+
/** Array of messages in chronological order */
|
|
19
|
+
messages: Message[];
|
|
20
|
+
/** Total number of messages in session */
|
|
21
|
+
messageCount: number;
|
|
22
|
+
/** Metadata about session origin (optional) */
|
|
23
|
+
metadata?: {
|
|
24
|
+
/** Cursor version that created this session */
|
|
25
|
+
cursorVersion?: string;
|
|
26
|
+
/** Last modified timestamp */
|
|
27
|
+
lastModified?: string;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Represents a single message within a session (user or assistant).
|
|
32
|
+
*/
|
|
33
|
+
export interface Message {
|
|
34
|
+
/** Message role: 'user' or 'assistant' */
|
|
35
|
+
role: 'user' | 'assistant';
|
|
36
|
+
/** Message content (text, code blocks, or structured data) */
|
|
37
|
+
content: string;
|
|
38
|
+
/** ISO 8601 timestamp when message was created */
|
|
39
|
+
timestamp: string;
|
|
40
|
+
/** Tool calls executed by assistant (optional, assistant-only) */
|
|
41
|
+
toolCalls?: ToolCall[];
|
|
42
|
+
/** AI reasoning/thinking text (optional, assistant-only) */
|
|
43
|
+
thinking?: string;
|
|
44
|
+
/** Metadata about message processing (optional) */
|
|
45
|
+
metadata?: {
|
|
46
|
+
/** Whether message data was partially corrupted */
|
|
47
|
+
corrupted?: boolean;
|
|
48
|
+
/** Original bubble type from database (for debugging) */
|
|
49
|
+
bubbleType?: number;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Represents a tool/function call executed by the assistant.
|
|
54
|
+
*/
|
|
55
|
+
export interface ToolCall {
|
|
56
|
+
/** Tool/function name (e.g., 'read_file', 'write', 'grep') */
|
|
57
|
+
name: string;
|
|
58
|
+
/** Tool execution status */
|
|
59
|
+
status: 'completed' | 'cancelled' | 'error';
|
|
60
|
+
/** Tool parameters as JSON object */
|
|
61
|
+
params?: Record<string, unknown>;
|
|
62
|
+
/** Tool execution result (optional, present if status === 'completed') */
|
|
63
|
+
result?: string;
|
|
64
|
+
/** Error message (optional, present if status === 'error') */
|
|
65
|
+
error?: string;
|
|
66
|
+
/** File paths involved in this tool call (optional) */
|
|
67
|
+
files?: string[];
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Represents a search match with context.
|
|
71
|
+
*/
|
|
72
|
+
export interface SearchResult {
|
|
73
|
+
/** Reference to the session containing this match */
|
|
74
|
+
session: Session;
|
|
75
|
+
/** Matched content snippet */
|
|
76
|
+
match: string;
|
|
77
|
+
/** Message index within session where match was found */
|
|
78
|
+
messageIndex: number;
|
|
79
|
+
/** Context lines before match (optional, based on config) */
|
|
80
|
+
contextBefore?: string[];
|
|
81
|
+
/** Context lines after match (optional, based on config) */
|
|
82
|
+
contextAfter?: string[];
|
|
83
|
+
/** Character offset of match within message content */
|
|
84
|
+
offset?: number;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Configuration options for library functions.
|
|
88
|
+
*/
|
|
89
|
+
export interface LibraryConfig {
|
|
90
|
+
/** Custom Cursor data path (optional, defaults to platform path) */
|
|
91
|
+
dataPath?: string;
|
|
92
|
+
/** Filter sessions by workspace path (optional) */
|
|
93
|
+
workspace?: string;
|
|
94
|
+
/** Pagination limit (optional, defaults to no limit) */
|
|
95
|
+
limit?: number;
|
|
96
|
+
/** Pagination offset (optional, defaults to 0) */
|
|
97
|
+
offset?: number;
|
|
98
|
+
/** Search context lines (optional, defaults to 0) */
|
|
99
|
+
context?: number;
|
|
100
|
+
/** Read from backup file instead of live data (optional) */
|
|
101
|
+
backupPath?: string;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Wrapper for paginated API responses.
|
|
105
|
+
*/
|
|
106
|
+
export interface PaginatedResult<T> {
|
|
107
|
+
/** Array of data items for current page */
|
|
108
|
+
data: T[];
|
|
109
|
+
/** Pagination metadata */
|
|
110
|
+
pagination: {
|
|
111
|
+
/** Total number of items across all pages */
|
|
112
|
+
total: number;
|
|
113
|
+
/** Maximum items per page (from config.limit) */
|
|
114
|
+
limit: number;
|
|
115
|
+
/** Offset of first item in current page (from config.offset) */
|
|
116
|
+
offset: number;
|
|
117
|
+
/** Whether more pages exist after this one */
|
|
118
|
+
hasMore: boolean;
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Migration mode: move removes from source, copy keeps source intact
|
|
123
|
+
*/
|
|
124
|
+
export type MigrationMode = 'move' | 'copy';
|
|
125
|
+
/**
|
|
126
|
+
* Configuration for session-level migration.
|
|
127
|
+
*/
|
|
128
|
+
export interface MigrateSessionConfig {
|
|
129
|
+
/**
|
|
130
|
+
* Session identifier(s) to migrate.
|
|
131
|
+
* Can be:
|
|
132
|
+
* - Single session ID (UUID): "abc123-def456"
|
|
133
|
+
* - Single index (1-based): "3" or 3
|
|
134
|
+
* - Multiple comma-separated: "1,3,5" or "abc123,def456"
|
|
135
|
+
* - Array of IDs/indices: ["1", "3"] or [1, 3]
|
|
136
|
+
*/
|
|
137
|
+
sessions: string | number | (string | number)[];
|
|
138
|
+
/** Destination workspace path (absolute or relative, resolved to absolute) */
|
|
139
|
+
destination: string;
|
|
140
|
+
/** Migration mode: 'move' (default) or 'copy' */
|
|
141
|
+
mode?: MigrationMode;
|
|
142
|
+
/** If true, preview without making changes */
|
|
143
|
+
dryRun?: boolean;
|
|
144
|
+
/** If true, proceed even if destination has existing history */
|
|
145
|
+
force?: boolean;
|
|
146
|
+
/** Custom Cursor data path (optional, uses default if not specified) */
|
|
147
|
+
dataPath?: string;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Configuration for workspace-level migration.
|
|
151
|
+
*/
|
|
152
|
+
export interface MigrateWorkspaceConfig {
|
|
153
|
+
/** Source workspace path to migrate from (exact match) */
|
|
154
|
+
source: string;
|
|
155
|
+
/** Destination workspace path to migrate to */
|
|
156
|
+
destination: string;
|
|
157
|
+
/** Migration mode: 'move' (default) or 'copy' */
|
|
158
|
+
mode?: MigrationMode;
|
|
159
|
+
/** If true, preview without making changes */
|
|
160
|
+
dryRun?: boolean;
|
|
161
|
+
/** If true, proceed even if destination has existing history */
|
|
162
|
+
force?: boolean;
|
|
163
|
+
/** Custom Cursor data path (optional, uses default if not specified) */
|
|
164
|
+
dataPath?: string;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Result of migrating a single session.
|
|
168
|
+
*/
|
|
169
|
+
export interface SessionMigrationResult {
|
|
170
|
+
/** Whether migration succeeded */
|
|
171
|
+
success: boolean;
|
|
172
|
+
/** Original session ID */
|
|
173
|
+
sessionId: string;
|
|
174
|
+
/** Source workspace path */
|
|
175
|
+
sourceWorkspace: string;
|
|
176
|
+
/** Destination workspace path */
|
|
177
|
+
destinationWorkspace: string;
|
|
178
|
+
/** Mode used for migration */
|
|
179
|
+
mode: MigrationMode;
|
|
180
|
+
/** For copy mode: the new session ID created */
|
|
181
|
+
newSessionId?: string;
|
|
182
|
+
/** Error message if success is false */
|
|
183
|
+
error?: string;
|
|
184
|
+
/** Whether this was a dry run */
|
|
185
|
+
dryRun: boolean;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Aggregate result of workspace migration.
|
|
189
|
+
*/
|
|
190
|
+
export interface WorkspaceMigrationResult {
|
|
191
|
+
/** True if all sessions migrated successfully */
|
|
192
|
+
success: boolean;
|
|
193
|
+
/** Normalized source path */
|
|
194
|
+
source: string;
|
|
195
|
+
/** Normalized destination path */
|
|
196
|
+
destination: string;
|
|
197
|
+
/** Mode used for migration */
|
|
198
|
+
mode: MigrationMode;
|
|
199
|
+
/** Total number of sessions attempted */
|
|
200
|
+
totalSessions: number;
|
|
201
|
+
/** Number of successful migrations */
|
|
202
|
+
successCount: number;
|
|
203
|
+
/** Number of failed migrations */
|
|
204
|
+
failureCount: number;
|
|
205
|
+
/** Per-session results */
|
|
206
|
+
results: SessionMigrationResult[];
|
|
207
|
+
/** Whether this was a dry run */
|
|
208
|
+
dryRun: boolean;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Metadata stored in the manifest.json file within the backup zip.
|
|
212
|
+
*/
|
|
213
|
+
export interface BackupManifest {
|
|
214
|
+
/** Manifest schema version for backward compatibility */
|
|
215
|
+
version: string;
|
|
216
|
+
/** ISO 8601 timestamp when backup was created */
|
|
217
|
+
createdAt: string;
|
|
218
|
+
/** Platform where backup was created */
|
|
219
|
+
sourcePlatform: 'darwin' | 'win32' | 'linux';
|
|
220
|
+
/** cursor-history version that created the backup */
|
|
221
|
+
cursorHistoryVersion: string;
|
|
222
|
+
/** List of files in the backup with metadata */
|
|
223
|
+
files: BackupFileEntry[];
|
|
224
|
+
/** Aggregate statistics for quick display */
|
|
225
|
+
stats: BackupStats;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* A single file entry in the backup manifest.
|
|
229
|
+
*/
|
|
230
|
+
export interface BackupFileEntry {
|
|
231
|
+
/** Path within zip (forward slashes, relative to zip root) */
|
|
232
|
+
path: string;
|
|
233
|
+
/** Original file size in bytes */
|
|
234
|
+
size: number;
|
|
235
|
+
/** SHA-256 checksum for integrity verification */
|
|
236
|
+
checksum: string;
|
|
237
|
+
/** File type for categorization */
|
|
238
|
+
type: 'global-db' | 'workspace-db' | 'workspace-json' | 'manifest';
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Aggregate statistics for a backup.
|
|
242
|
+
*/
|
|
243
|
+
export interface BackupStats {
|
|
244
|
+
/** Total uncompressed size of all files */
|
|
245
|
+
totalSize: number;
|
|
246
|
+
/** Number of chat sessions across all workspaces */
|
|
247
|
+
sessionCount: number;
|
|
248
|
+
/** Number of workspaces included */
|
|
249
|
+
workspaceCount: number;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Configuration for backup creation operation.
|
|
253
|
+
*/
|
|
254
|
+
export interface BackupConfig {
|
|
255
|
+
/** Source Cursor data path (default: platform-specific) */
|
|
256
|
+
sourcePath?: string;
|
|
257
|
+
/** Output file path (default: ~/cursor-history-backups/<timestamp>.zip) */
|
|
258
|
+
outputPath?: string;
|
|
259
|
+
/** Overwrite existing file without prompting */
|
|
260
|
+
force?: boolean;
|
|
261
|
+
/** Progress callback for UI updates */
|
|
262
|
+
onProgress?: (progress: BackupProgress) => void;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Progress information during backup operation.
|
|
266
|
+
*/
|
|
267
|
+
export interface BackupProgress {
|
|
268
|
+
/** Current operation phase */
|
|
269
|
+
phase: 'scanning' | 'backing-up' | 'compressing' | 'finalizing';
|
|
270
|
+
/** Current file being processed */
|
|
271
|
+
currentFile?: string;
|
|
272
|
+
/** Files completed / total files */
|
|
273
|
+
filesCompleted: number;
|
|
274
|
+
totalFiles: number;
|
|
275
|
+
/** Bytes completed / total bytes */
|
|
276
|
+
bytesCompleted: number;
|
|
277
|
+
totalBytes: number;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Result of a backup operation.
|
|
281
|
+
*/
|
|
282
|
+
export interface BackupResult {
|
|
283
|
+
/** Whether backup succeeded */
|
|
284
|
+
success: boolean;
|
|
285
|
+
/** Path to created backup file */
|
|
286
|
+
backupPath: string;
|
|
287
|
+
/** Generated manifest */
|
|
288
|
+
manifest: BackupManifest;
|
|
289
|
+
/** Duration in milliseconds */
|
|
290
|
+
durationMs: number;
|
|
291
|
+
/** Error message if failed */
|
|
292
|
+
error?: string;
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Configuration for restore operation.
|
|
296
|
+
*/
|
|
297
|
+
export interface RestoreConfig {
|
|
298
|
+
/** Path to backup zip file */
|
|
299
|
+
backupPath: string;
|
|
300
|
+
/** Target Cursor data path (default: platform-specific) */
|
|
301
|
+
targetPath?: string;
|
|
302
|
+
/** Overwrite existing data without prompting */
|
|
303
|
+
force?: boolean;
|
|
304
|
+
/** Progress callback for UI updates */
|
|
305
|
+
onProgress?: (progress: RestoreProgress) => void;
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Progress information during restore operation.
|
|
309
|
+
*/
|
|
310
|
+
export interface RestoreProgress {
|
|
311
|
+
/** Current operation phase */
|
|
312
|
+
phase: 'validating' | 'extracting' | 'finalizing';
|
|
313
|
+
/** Current file being processed */
|
|
314
|
+
currentFile?: string;
|
|
315
|
+
/** Files completed / total files */
|
|
316
|
+
filesCompleted: number;
|
|
317
|
+
totalFiles: number;
|
|
318
|
+
/** Integrity status */
|
|
319
|
+
integrityStatus: 'pending' | 'passed' | 'warnings' | 'failed';
|
|
320
|
+
/** Files with checksum warnings (if any) */
|
|
321
|
+
corruptedFiles?: string[];
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Result of a restore operation.
|
|
325
|
+
*/
|
|
326
|
+
export interface RestoreResult {
|
|
327
|
+
/** Whether restore succeeded */
|
|
328
|
+
success: boolean;
|
|
329
|
+
/** Path where data was restored */
|
|
330
|
+
targetPath: string;
|
|
331
|
+
/** Number of files restored */
|
|
332
|
+
filesRestored: number;
|
|
333
|
+
/** Files with integrity warnings (still restored) */
|
|
334
|
+
warnings: string[];
|
|
335
|
+
/** Duration in milliseconds */
|
|
336
|
+
durationMs: number;
|
|
337
|
+
/** Error message if failed */
|
|
338
|
+
error?: string;
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Result of backup integrity validation.
|
|
342
|
+
*/
|
|
343
|
+
export interface BackupValidation {
|
|
344
|
+
/** Overall validation status */
|
|
345
|
+
status: 'valid' | 'warnings' | 'invalid';
|
|
346
|
+
/** Manifest if parseable */
|
|
347
|
+
manifest?: BackupManifest;
|
|
348
|
+
/** Files that passed checksum verification */
|
|
349
|
+
validFiles: string[];
|
|
350
|
+
/** Files that failed checksum verification */
|
|
351
|
+
corruptedFiles: string[];
|
|
352
|
+
/** Files missing from manifest */
|
|
353
|
+
missingFiles: string[];
|
|
354
|
+
/** Detailed error messages */
|
|
355
|
+
errors: string[];
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Metadata about a backup file for listing purposes.
|
|
359
|
+
*/
|
|
360
|
+
export interface BackupInfo {
|
|
361
|
+
/** Full path to the backup file */
|
|
362
|
+
filePath: string;
|
|
363
|
+
/** Backup filename */
|
|
364
|
+
filename: string;
|
|
365
|
+
/** File size in bytes */
|
|
366
|
+
fileSize: number;
|
|
367
|
+
/** File modification time (from filesystem) */
|
|
368
|
+
modifiedAt: Date;
|
|
369
|
+
/** Parsed manifest (if valid backup) */
|
|
370
|
+
manifest?: BackupManifest;
|
|
371
|
+
/** Error if backup is invalid or corrupted */
|
|
372
|
+
error?: string;
|
|
373
|
+
}
|
|
374
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,2DAA2D;IAC3D,EAAE,EAAE,MAAM,CAAC;IAEX,2CAA2C;IAC3C,SAAS,EAAE,MAAM,CAAC;IAElB,6CAA6C;IAC7C,SAAS,EAAE,MAAM,CAAC;IAElB,+CAA+C;IAC/C,QAAQ,EAAE,OAAO,EAAE,CAAC;IAEpB,0CAA0C;IAC1C,YAAY,EAAE,MAAM,CAAC;IAErB,+CAA+C;IAC/C,QAAQ,CAAC,EAAE;QACT,+CAA+C;QAC/C,aAAa,CAAC,EAAE,MAAM,CAAC;QAEvB,8BAA8B;QAC9B,YAAY,C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MAAM,EAAE,CAAC;IAEnB,+BAA+B;IAC/B,UAAU,EAAE,MAAM,CAAC;IAEnB,8BAA8B;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,gCAAgC;IAChC,MAAM,EAAE,OAAO,GAAG,UAAU,GAAG,SAAS,CAAC;IAEzC,4BAA4B;IAC5B,QAAQ,CAAC,EAAE,cAAc,CAAC;IAE1B,8CAA8C;IAC9C,UAAU,EAAE,MAAM,EAAE,CAAC;IAErB,8CAA8C;IAC9C,cAAc,EAAE,MAAM,EAAE,CAAC;IAEzB,kCAAkC;IAClC,YAAY,EAAE,MAAM,EAAE,CAAC;IAEvB,8BAA8B;IAC9B,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,mCAAmC;IACnC,QAAQ,EAAE,MAAM,CAAC;IAEjB,sBAAsB;IACtB,QAAQ,EAAE,MAAM,CAAC;IAEjB,yBAAyB;IACzB,QAAQ,EAAE,MAAM,CAAC;IAEjB,+CAA+C;IAC/C,UAAU,EAAE,IAAI,CAAC;IAEjB,wCAAwC;IACxC,QAAQ,CAAC,EAAE,cAAc,CAAC;IAE1B,8CAA8C;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public TypeScript type definitions for cursor-history library
|
|
3
|
+
*
|
|
4
|
+
* IMPORTANT: This is a library interface for direct import and use in TypeScript/JavaScript
|
|
5
|
+
* projects, NOT a network/REST API. Functions are imported directly:
|
|
6
|
+
* `import { Session, Message } from 'cursor-history'`
|
|
7
|
+
*/
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility functions for library API
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Get the platform-specific default Cursor data path.
|
|
6
|
+
*
|
|
7
|
+
* @returns Absolute path to Cursor data directory
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* const defaultPath = getDefaultDataPath();
|
|
11
|
+
* console.log(defaultPath);
|
|
12
|
+
* // macOS: ~/Library/Application Support/Cursor/User/workspaceStorage
|
|
13
|
+
* // Linux: ~/.config/Cursor/User/workspaceStorage
|
|
14
|
+
* // Windows: %APPDATA%\Cursor\User\workspaceStorage
|
|
15
|
+
*/
|
|
16
|
+
export declare function getDefaultDataPath(): string;
|
|
17
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility functions for library API
|
|
3
|
+
*/
|
|
4
|
+
import { getCursorDataPath } from '../lib/platform.js';
|
|
5
|
+
/**
|
|
6
|
+
* Get the platform-specific default Cursor data path.
|
|
7
|
+
*
|
|
8
|
+
* @returns Absolute path to Cursor data directory
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* const defaultPath = getDefaultDataPath();
|
|
12
|
+
* console.log(defaultPath);
|
|
13
|
+
* // macOS: ~/Library/Application Support/Cursor/User/workspaceStorage
|
|
14
|
+
* // Linux: ~/.config/Cursor/User/workspaceStorage
|
|
15
|
+
* // Windows: %APPDATA%\Cursor\User\workspaceStorage
|
|
16
|
+
*/
|
|
17
|
+
export function getDefaultDataPath() {
|
|
18
|
+
return getCursorDataPath();
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,kBAAkB;IAChC,OAAO,iBAAiB,EAAE,CAAC;AAC7B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cursor-history",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "CLI tool to browse
|
|
3
|
+
"version": "0.8.0",
|
|
4
|
+
"description": "The ultimate CLI tool and library to browse, search, export, migrate, and backup your Cursor AI chat history",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "dist/
|
|
6
|
+
"main": "dist/lib/index.js",
|
|
7
|
+
"types": "dist/lib/index.d.ts",
|
|
7
8
|
"bin": {
|
|
8
9
|
"cursor-history": "dist/cli/index.js"
|
|
9
10
|
},
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"import": "./dist/lib/index.js",
|
|
14
|
+
"require": "./dist/lib/index.cjs",
|
|
15
|
+
"types": "./dist/lib/index.d.ts"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
10
18
|
"scripts": {
|
|
11
19
|
"build": "tsc",
|
|
12
20
|
"dev": "tsc --watch",
|
|
@@ -23,8 +31,26 @@
|
|
|
23
31
|
"cursor",
|
|
24
32
|
"chat",
|
|
25
33
|
"history",
|
|
34
|
+
"ai",
|
|
35
|
+
"assistant",
|
|
36
|
+
"conversation",
|
|
37
|
+
"export",
|
|
38
|
+
"backup",
|
|
39
|
+
"restore",
|
|
40
|
+
"migrate",
|
|
26
41
|
"cli",
|
|
27
|
-
"
|
|
42
|
+
"developer",
|
|
43
|
+
"tools",
|
|
44
|
+
"devtools",
|
|
45
|
+
"productivity",
|
|
46
|
+
"code",
|
|
47
|
+
"llm",
|
|
48
|
+
"vscode",
|
|
49
|
+
"sqlite",
|
|
50
|
+
"search",
|
|
51
|
+
"typescript",
|
|
52
|
+
"ide",
|
|
53
|
+
"editor"
|
|
28
54
|
],
|
|
29
55
|
"author": "",
|
|
30
56
|
"license": "MIT",
|
|
@@ -48,11 +74,13 @@
|
|
|
48
74
|
"node": ">=20.0.0"
|
|
49
75
|
},
|
|
50
76
|
"dependencies": {
|
|
77
|
+
"adm-zip": "^0.5.16",
|
|
51
78
|
"better-sqlite3": "^12.5.0",
|
|
52
79
|
"commander": "^14.0.2",
|
|
53
80
|
"picocolors": "^1.1.1"
|
|
54
81
|
},
|
|
55
82
|
"devDependencies": {
|
|
83
|
+
"@types/adm-zip": "^0.5.7",
|
|
56
84
|
"@types/better-sqlite3": "^7.6.13",
|
|
57
85
|
"@types/node": "^25.0.3",
|
|
58
86
|
"eslint": "^9.39.2",
|