@threadbase-sh/scanner 0.17.6 → 0.18.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/README.md +34 -22
- package/dist/cache.d.ts +12 -0
- package/dist/cache.d.ts.map +1 -0
- package/dist/canonical-path.d.ts +2 -0
- package/dist/canonical-path.d.ts.map +1 -0
- package/dist/cli.js +598 -64
- package/dist/cli.js.map +1 -1
- package/dist/discovery.d.ts +9 -0
- package/dist/discovery.d.ts.map +1 -0
- package/dist/filters.d.ts +12 -0
- package/dist/filters.d.ts.map +1 -0
- package/dist/git.d.ts +2 -0
- package/dist/git.d.ts.map +1 -0
- package/dist/index.cjs +633 -89
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +27 -461
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +609 -75
- package/dist/index.js.map +1 -1
- package/dist/indexer.d.ts +21 -0
- package/dist/indexer.d.ts.map +1 -0
- package/dist/logger.d.ts +6 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/parser.d.ts +18 -0
- package/dist/parser.d.ts.map +1 -0
- package/dist/persistent/conversation-reducer.d.ts +15 -0
- package/dist/persistent/conversation-reducer.d.ts.map +1 -0
- package/dist/persistent/conversation-stream.d.ts +14 -0
- package/dist/persistent/conversation-stream.d.ts.map +1 -0
- package/dist/persistent/cursor.d.ts +12 -0
- package/dist/persistent/cursor.d.ts.map +1 -0
- package/dist/persistent/db.d.ts +4 -0
- package/dist/persistent/db.d.ts.map +1 -0
- package/dist/persistent/dir-watermark.d.ts +11 -0
- package/dist/persistent/dir-watermark.d.ts.map +1 -0
- package/dist/persistent/index-engine.d.ts +49 -0
- package/dist/persistent/index-engine.d.ts.map +1 -0
- package/dist/persistent/jsonl-tail-reader.d.ts +11 -0
- package/dist/persistent/jsonl-tail-reader.d.ts.map +1 -0
- package/dist/persistent/metadata-reducer.d.ts +32 -0
- package/dist/persistent/metadata-reducer.d.ts.map +1 -0
- package/dist/persistent/migrations.d.ts +3 -0
- package/dist/persistent/migrations.d.ts.map +1 -0
- package/dist/persistent/paged-reader.d.ts +14 -0
- package/dist/persistent/paged-reader.d.ts.map +1 -0
- package/dist/persistent/repositories/checkpoints.repo.d.ts +19 -0
- package/dist/persistent/repositories/checkpoints.repo.d.ts.map +1 -0
- package/dist/persistent/repositories/conversation-files.repo.d.ts +40 -0
- package/dist/persistent/repositories/conversation-files.repo.d.ts.map +1 -0
- package/dist/persistent/repositories/conversations.repo.d.ts +55 -0
- package/dist/persistent/repositories/conversations.repo.d.ts.map +1 -0
- package/dist/persistent/repositories/fts.repo.d.ts +28 -0
- package/dist/persistent/repositories/fts.repo.d.ts.map +1 -0
- package/dist/persistent/repositories/scanned-dirs.repo.d.ts +16 -0
- package/dist/persistent/repositories/scanned-dirs.repo.d.ts.map +1 -0
- package/dist/persistent/schema.d.ts +3 -0
- package/dist/persistent/schema.d.ts.map +1 -0
- package/dist/persistent/sidecar.d.ts +29 -0
- package/dist/persistent/sidecar.d.ts.map +1 -0
- package/dist/profiles.d.ts +7 -0
- package/dist/profiles.d.ts.map +1 -0
- package/dist/providers/codex-cli.d.ts +40 -0
- package/dist/providers/codex-cli.d.ts.map +1 -0
- package/dist/providers/cursor.d.ts +38 -0
- package/dist/providers/cursor.d.ts.map +1 -0
- package/dist/providers/parse.d.ts +4 -0
- package/dist/providers/parse.d.ts.map +1 -0
- package/dist/providers/provider.d.ts +23 -0
- package/dist/providers/provider.d.ts.map +1 -0
- package/dist/providers/threadbase.d.ts +12 -0
- package/dist/providers/threadbase.d.ts.map +1 -0
- package/dist/scanner.d.ts +77 -0
- package/dist/scanner.d.ts.map +1 -0
- package/dist/search-document.d.ts +20 -0
- package/dist/search-document.d.ts.map +1 -0
- package/dist/search-matches.d.ts +13 -0
- package/dist/search-matches.d.ts.map +1 -0
- package/dist/tags.d.ts +2 -0
- package/dist/tags.d.ts.map +1 -0
- package/dist/tiers.d.ts +4 -0
- package/dist/tiers.d.ts.map +1 -0
- package/dist/types.d.ts +212 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/watcher/file-watcher.d.ts +21 -0
- package/dist/watcher/file-watcher.d.ts.map +1 -0
- package/dist/watcher/index-queue.d.ts +18 -0
- package/dist/watcher/index-queue.d.ts.map +1 -0
- package/package.json +3 -3
- package/dist/index.d.cts +0 -461
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ Combines the best parts of four independent scanner implementations (VS Code, El
|
|
|
20
20
|
- **Filtering** — by project, account, time range, conversation type (conversations/subagents/teammates)
|
|
21
21
|
- **5 sort modes** — recent, oldest, messages-desc, messages-asc, alphabetical
|
|
22
22
|
- **Pagination** — limit/offset on all operations
|
|
23
|
-
- **Multi-provider** — index Threadbase/Claude history
|
|
23
|
+
- **Multi-provider** — index Threadbase/Claude history, local OpenAI Codex CLI sessions, and Cursor agent-transcripts through one normalized pipeline (Codex and Cursor are opt-in)
|
|
24
24
|
- **Multi-profile** — scan multiple Claude config directories
|
|
25
25
|
- **LRU caching** — metadata and conversation caches for fast repeated access
|
|
26
26
|
- **Git branch detection** — reads `.git/HEAD` with parent directory walking
|
|
@@ -113,37 +113,46 @@ scanner.close()
|
|
|
113
113
|
|
|
114
114
|
### Scanning Codex CLI history (providers)
|
|
115
115
|
|
|
116
|
-
The scanner can index local **OpenAI Codex CLI** rollout sessions
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
default).
|
|
116
|
+
The scanner can index local **OpenAI Codex CLI** rollout sessions and **Cursor**
|
|
117
|
+
agent-transcripts (`~/.cursor/projects/<slug>/agent-transcripts/`) alongside the
|
|
118
|
+
default Threadbase/Claude history, normalizing all of them into the same
|
|
119
|
+
`ConversationMeta` model. Extra providers are **opt-in**: pass `providers` and
|
|
120
|
+
the matching `*Roots` (no home directory is scanned by default). Cursor Composer
|
|
121
|
+
(`state.vscdb`) is a different store and is not indexed.
|
|
121
122
|
|
|
122
123
|
```typescript
|
|
124
|
+
import { homedir } from 'node:os'
|
|
125
|
+
import { join } from 'node:path'
|
|
126
|
+
|
|
123
127
|
const scanner = new ConversationScanner()
|
|
124
128
|
|
|
125
129
|
const result = await scanner.scan({
|
|
126
|
-
providers: ['claude-code', 'codex-cli'],
|
|
127
|
-
codexRoots: ['
|
|
130
|
+
providers: ['claude-code', 'codex-cli', 'cursor'],
|
|
131
|
+
codexRoots: [join(homedir(), '.codex/sessions')],
|
|
132
|
+
cursorRoots: [join(homedir(), '.cursor/projects')],
|
|
128
133
|
})
|
|
129
134
|
|
|
130
135
|
// Each meta carries its source provider
|
|
131
136
|
for (const c of result.conversations) {
|
|
132
|
-
console.log(c.provider) // 'claude-code' | 'codex-cli'
|
|
137
|
+
console.log(c.provider) // 'claude-code' | 'codex-cli' | 'cursor'
|
|
133
138
|
}
|
|
134
139
|
|
|
135
|
-
// Search across
|
|
136
|
-
const
|
|
140
|
+
// Search across all, or filter to one provider
|
|
141
|
+
const cursorHits = await scanner.search('refactor', { provider: 'cursor' })
|
|
137
142
|
```
|
|
138
143
|
|
|
139
|
-
`codexRoots` entries must be absolute paths — expand `~` before
|
|
140
|
-
(e.g. ``join(homedir(), '.
|
|
141
|
-
(`'conversation'` | `'task'`) and `externalSessionId`
|
|
142
|
-
|
|
144
|
+
`codexRoots` / `cursorRoots` entries must be absolute paths — expand `~` before
|
|
145
|
+
passing them (e.g. ``join(homedir(), '.cursor/projects')``). Codex and Cursor
|
|
146
|
+
metas also set `kind` (`'conversation'` | `'task'`) and `externalSessionId`
|
|
147
|
+
when available.
|
|
143
148
|
|
|
144
|
-
Codex rows are indexed into the same SQLite database as Claude
|
|
145
|
-
`sessionId` is the rollout's `session_meta` id
|
|
146
|
-
the `rollout-<ts>-<uuid>.jsonl`
|
|
149
|
+
Codex and Cursor rows are indexed into the same SQLite database as Claude
|
|
150
|
+
history. A Codex `sessionId` is the rollout's `session_meta` id (the uuid at
|
|
151
|
+
the end of `rollout-<ts>-<uuid>.jsonl`). A Cursor `sessionId` is the transcript
|
|
152
|
+
filename stem (`<runId>.jsonl`). The wire name is **`cursor`**. The live PTY
|
|
153
|
+
name `cursor-cli` is still accepted as an alias. Not `cursor-agent`. Cursor copies of another provider
|
|
154
|
+
set `isImportedFromClaude` or `isImportedFromCodex`; `isImportedFromCursor` is
|
|
155
|
+
reserved for Claude/Codex providers.
|
|
147
156
|
|
|
148
157
|
#### Resolving an id to its transcript file
|
|
149
158
|
|
|
@@ -154,7 +163,7 @@ process:
|
|
|
154
163
|
```typescript
|
|
155
164
|
const scanner = new ConversationScanner() // opens the existing index.db
|
|
156
165
|
const [meta] = scanner.getConversationsBySessionId(uuid) // newest first; [] if unknown
|
|
157
|
-
meta?.filePath // absolute path to the .jsonl,
|
|
166
|
+
meta?.filePath // absolute path to the .jsonl (Claude, Codex, and Cursor)
|
|
158
167
|
const page = await scanner.getConversationPage(uuid, { limit: 50 })
|
|
159
168
|
```
|
|
160
169
|
|
|
@@ -340,9 +349,12 @@ Every scanned conversation produces a `ConversationMeta` with the full superset
|
|
|
340
349
|
| `isTeammate` | boolean | VS Code |
|
|
341
350
|
| `teamName` | string \| null | VS Code |
|
|
342
351
|
| `toolNames` | string[] | CLI |
|
|
343
|
-
| `provider` | `'claude-code' \| 'codex-cli'` | Provider that produced the meta |
|
|
344
|
-
| `kind` | `'conversation' \| 'task'` | Codex (optional) |
|
|
345
|
-
| `externalSessionId` | string |
|
|
352
|
+
| `provider` | `'claude-code' \| 'codex-cli' \| 'cursor'` | Provider that produced the meta |
|
|
353
|
+
| `kind` | `'conversation' \| 'task'` | Codex / Cursor (optional) |
|
|
354
|
+
| `externalSessionId` | string | Provider-native session id (optional) |
|
|
355
|
+
| `isImportedFromClaude` | boolean | Cursor copy of a Claude session (optional; omit when false) |
|
|
356
|
+
| `isImportedFromCodex` | boolean | Cursor copy of a Codex session (optional; omit when false) |
|
|
357
|
+
| `isImportedFromCursor` | boolean | Reserved for Claude/Codex copies of Cursor (optional; omit when false) |
|
|
346
358
|
|
|
347
359
|
## Development
|
|
348
360
|
|
package/dist/cache.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare class LRUCache<K, V> {
|
|
2
|
+
private map;
|
|
3
|
+
private readonly capacity;
|
|
4
|
+
constructor(capacity: number);
|
|
5
|
+
get(key: K): V | undefined;
|
|
6
|
+
set(key: K, value: V): void;
|
|
7
|
+
has(key: K): boolean;
|
|
8
|
+
delete(key: K): boolean;
|
|
9
|
+
clear(): void;
|
|
10
|
+
get size(): number;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../src/cache.ts"],"names":[],"mappings":"AAAA,qBAAa,QAAQ,CAAC,CAAC,EAAE,CAAC;IACxB,OAAO,CAAC,GAAG,CAAmB;IAC9B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAElC,YAAY,QAAQ,EAAE,MAAM,EAE3B;IAED,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS,CAOzB;IAED,GAAG,CAAC,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAO1B;IAED,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,OAAO,CAEnB;IAED,MAAM,CAAC,GAAG,EAAE,CAAC,GAAG,OAAO,CAEtB;IAED,KAAK,IAAI,IAAI,CAEZ;IAED,IAAI,IAAI,IAAI,MAAM,CAEjB;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canonical-path.d.ts","sourceRoot":"","sources":["../src/canonical-path.ts"],"names":[],"mappings":"AAwBA,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAE/C"}
|