@threadbase-sh/scanner 0.22.0 → 0.23.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/dist/cli.js +20 -26
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +19 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +19 -25
- package/dist/index.js.map +1 -1
- package/dist/persistent/index-engine.d.ts.map +1 -1
- package/dist/persistent/metadata-reducer.d.ts.map +1 -1
- package/dist/persistent/repositories/conversations.repo.d.ts +2 -2
- package/dist/persistent/repositories/conversations.repo.d.ts.map +1 -1
- package/dist/providers/copilot.d.ts.map +1 -1
- package/dist/providers/parse.d.ts +1 -1
- package/dist/providers/parse.d.ts.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -5,7 +5,7 @@ import { Command } from "commander";
|
|
|
5
5
|
import pino2 from "pino";
|
|
6
6
|
|
|
7
7
|
// package.json
|
|
8
|
-
var version = "0.
|
|
8
|
+
var version = "0.23.0";
|
|
9
9
|
|
|
10
10
|
// src/logger.ts
|
|
11
11
|
import pino from "pino";
|
|
@@ -1057,6 +1057,7 @@ function finalizeMeta(state, filePath, account, tier) {
|
|
|
1057
1057
|
provider: CLAUDE_CODE_PROVIDER,
|
|
1058
1058
|
sessionId: state.sessionId || basename2(filePath, ".jsonl"),
|
|
1059
1059
|
sessionName: resolveSessionName(state.nameSlots).name ?? "",
|
|
1060
|
+
nameSlots: state.nameSlots,
|
|
1060
1061
|
projectPath,
|
|
1061
1062
|
projectName: getShortProjectName(projectPath),
|
|
1062
1063
|
account,
|
|
@@ -1785,6 +1786,7 @@ function reduceCodexEntry(acc, entry, tier) {
|
|
|
1785
1786
|
function finalizeCodexMeta(acc, filePath, account, tier) {
|
|
1786
1787
|
if (acc.messageCount === 0) return null;
|
|
1787
1788
|
const sessionId = acc.sessionId || basename5(filePath, ".jsonl");
|
|
1789
|
+
const nameSlots = { ...acc.nameSlots, ...codexNameSlotsFor(filePath, acc.sessionId) };
|
|
1788
1790
|
const projectPath = acc.cwd;
|
|
1789
1791
|
const kind = acc.lastAssistant === null && acc.toolNames.length > 0 ? "task" : "conversation";
|
|
1790
1792
|
return {
|
|
@@ -1794,7 +1796,8 @@ function finalizeCodexMeta(acc, filePath, account, tier) {
|
|
|
1794
1796
|
kind,
|
|
1795
1797
|
externalSessionId: acc.sessionId || void 0,
|
|
1796
1798
|
sessionId,
|
|
1797
|
-
sessionName: resolveSessionName(
|
|
1799
|
+
sessionName: resolveSessionName(nameSlots).name ?? "",
|
|
1800
|
+
nameSlots,
|
|
1798
1801
|
projectPath,
|
|
1799
1802
|
projectName: getShortProjectName3(projectPath),
|
|
1800
1803
|
account,
|
|
@@ -2080,6 +2083,7 @@ function reduceCopilotEntry(acc, entry, tier) {
|
|
|
2080
2083
|
function finalizeCopilotMeta(acc, filePath, account, tier) {
|
|
2081
2084
|
if (acc.messageCount === 0) return null;
|
|
2082
2085
|
const sessionId = acc.sessionId || sessionIdFromPath(filePath);
|
|
2086
|
+
const nameSlots = { ...acc.nameSlots, ...copilotNameSlotsFor(filePath) };
|
|
2083
2087
|
const kind = acc.lastAssistant === null && acc.toolNames.length > 0 ? "task" : "conversation";
|
|
2084
2088
|
return {
|
|
2085
2089
|
id: filePath,
|
|
@@ -2088,7 +2092,8 @@ function finalizeCopilotMeta(acc, filePath, account, tier) {
|
|
|
2088
2092
|
kind,
|
|
2089
2093
|
externalSessionId: sessionId,
|
|
2090
2094
|
sessionId,
|
|
2091
|
-
sessionName: resolveSessionName(
|
|
2095
|
+
sessionName: resolveSessionName(nameSlots).name ?? "",
|
|
2096
|
+
nameSlots,
|
|
2092
2097
|
projectPath: acc.cwd,
|
|
2093
2098
|
projectName: getShortProjectName4(acc.cwd),
|
|
2094
2099
|
account,
|
|
@@ -2490,6 +2495,7 @@ function reduceCursorEntry(acc, entry, tier) {
|
|
|
2490
2495
|
function finalizeCursorMeta(acc, filePath, account, tier) {
|
|
2491
2496
|
if (acc.messageCount === 0) return null;
|
|
2492
2497
|
const sessionId = basename7(filePath, ".jsonl");
|
|
2498
|
+
const nameSlots = { ...acc.nameSlots, ...cursorNameSlotsFor(filePath, sessionId) };
|
|
2493
2499
|
const isSubagent = SUBAGENT_PATH_RE2.test(filePath);
|
|
2494
2500
|
const parent = isSubagent ? parentFromSubagentPath(filePath) : null;
|
|
2495
2501
|
const { projectPath, projectName } = projectFromCursorPath(filePath);
|
|
@@ -2502,7 +2508,8 @@ function finalizeCursorMeta(acc, filePath, account, tier) {
|
|
|
2502
2508
|
kind,
|
|
2503
2509
|
externalSessionId: sessionId,
|
|
2504
2510
|
sessionId,
|
|
2505
|
-
sessionName: resolveSessionName(
|
|
2511
|
+
sessionName: resolveSessionName(nameSlots).name ?? "",
|
|
2512
|
+
nameSlots,
|
|
2506
2513
|
projectPath,
|
|
2507
2514
|
projectName,
|
|
2508
2515
|
account,
|
|
@@ -2653,7 +2660,7 @@ async function parseCursorConversation(filePath, account) {
|
|
|
2653
2660
|
// src/providers/parse.ts
|
|
2654
2661
|
import { createReadStream as createReadStream7 } from "fs";
|
|
2655
2662
|
import { createInterface as createInterface5 } from "readline";
|
|
2656
|
-
async function parseMetaWithProvider(provider, filePath, account, tier, onEntry
|
|
2663
|
+
async function parseMetaWithProvider(provider, filePath, account, tier, onEntry) {
|
|
2657
2664
|
const log = getLogger();
|
|
2658
2665
|
const acc = provider.createEmptyAccumulator();
|
|
2659
2666
|
const rl = createInterface5({
|
|
@@ -2680,7 +2687,6 @@ async function parseMetaWithProvider(provider, filePath, account, tier, onEntry,
|
|
|
2680
2687
|
log.warn({ filePath, provider: provider.name, err }, "provider parse: read failed");
|
|
2681
2688
|
return null;
|
|
2682
2689
|
}
|
|
2683
|
-
onAccumulator?.(acc);
|
|
2684
2690
|
return provider.finalize(acc, filePath, account, tier);
|
|
2685
2691
|
}
|
|
2686
2692
|
|
|
@@ -3530,6 +3536,7 @@ function rowToMeta(row) {
|
|
|
3530
3536
|
externalSessionId: row.external_session_id ?? void 0,
|
|
3531
3537
|
sessionId: row.session_id,
|
|
3532
3538
|
sessionName: row.session_name ?? "",
|
|
3539
|
+
nameSlots: row.name_slots ? JSON.parse(row.name_slots) : void 0,
|
|
3533
3540
|
projectPath: row.project_path ?? "",
|
|
3534
3541
|
projectName: row.project_name ?? "",
|
|
3535
3542
|
account: row.account,
|
|
@@ -3562,7 +3569,7 @@ var ConversationsRepo = class {
|
|
|
3562
3569
|
db;
|
|
3563
3570
|
// Upsert by file_id (1 file = 1 conversation). Keyed on the unique file_id so
|
|
3564
3571
|
// a re-index overwrites the prior summary in place.
|
|
3565
|
-
upsert(fileId, meta, pageMessageCount = meta.messageCount
|
|
3572
|
+
upsert(fileId, meta, pageMessageCount = meta.messageCount) {
|
|
3566
3573
|
this.db.prepare(
|
|
3567
3574
|
`INSERT INTO conversations (
|
|
3568
3575
|
file_id, source_path, provider, kind, external_session_id,
|
|
@@ -3661,7 +3668,7 @@ var ConversationsRepo = class {
|
|
|
3661
3668
|
is_imported_from_claude: meta.isImportedFromClaude ? 1 : 0,
|
|
3662
3669
|
is_imported_from_codex: meta.isImportedFromCodex ? 1 : 0,
|
|
3663
3670
|
is_imported_from_cursor: meta.isImportedFromCursor ? 1 : 0,
|
|
3664
|
-
name_slots: nameSlots ? JSON.stringify(nameSlots) : null
|
|
3671
|
+
name_slots: meta.nameSlots ? JSON.stringify(meta.nameSlots) : null
|
|
3665
3672
|
});
|
|
3666
3673
|
}
|
|
3667
3674
|
getBySourcePath(sourcePath) {
|
|
@@ -4125,7 +4132,7 @@ var PersistentEngine = class {
|
|
|
4125
4132
|
const base = resume ? this.fts.readDocument(fileId) ?? emptySearchDocument() : emptySearchDocument();
|
|
4126
4133
|
const searchDoc = appendSearchDelta(base, searchDelta);
|
|
4127
4134
|
const upsert = this.db.transaction(() => {
|
|
4128
|
-
this.conversations.upsert(fileId, meta, state.pageMessageCount
|
|
4135
|
+
this.conversations.upsert(fileId, meta, state.pageMessageCount);
|
|
4129
4136
|
if (!this.fts.isCurrent(fileId, meta, searchDoc)) {
|
|
4130
4137
|
this.fts.upsert(fileId, meta, searchDoc);
|
|
4131
4138
|
}
|
|
@@ -4172,19 +4179,9 @@ var PersistentEngine = class {
|
|
|
4172
4179
|
async indexFileWithProvider(provider, filePath, account, tier, stat6, resolveGitBranch) {
|
|
4173
4180
|
const log = getLogger();
|
|
4174
4181
|
let searchDoc = emptySearchDocument();
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
filePath,
|
|
4179
|
-
account,
|
|
4180
|
-
tier,
|
|
4181
|
-
(entry) => {
|
|
4182
|
-
searchDoc = appendSearchDelta(searchDoc, extractSearchDelta(entry));
|
|
4183
|
-
},
|
|
4184
|
-
(acc) => {
|
|
4185
|
-
transcriptSlots = acc.nameSlots ?? {};
|
|
4186
|
-
}
|
|
4187
|
-
);
|
|
4182
|
+
const meta = await parseMetaWithProvider(provider, filePath, account, tier, (entry) => {
|
|
4183
|
+
searchDoc = appendSearchDelta(searchDoc, extractSearchDelta(entry));
|
|
4184
|
+
});
|
|
4188
4185
|
if (!meta) {
|
|
4189
4186
|
this.markDeleted(filePath);
|
|
4190
4187
|
return null;
|
|
@@ -4196,10 +4193,7 @@ var PersistentEngine = class {
|
|
|
4196
4193
|
const fp = stat6.size > 0 ? fingerprint(filePath, stat6.size) : null;
|
|
4197
4194
|
const fileId = this.files.ensure(filePath, account);
|
|
4198
4195
|
const upsert = this.db.transaction(() => {
|
|
4199
|
-
this.conversations.upsert(fileId, meta, meta.messageCount
|
|
4200
|
-
...transcriptSlots,
|
|
4201
|
-
...sideSlots
|
|
4202
|
-
});
|
|
4196
|
+
this.conversations.upsert(fileId, meta, meta.messageCount);
|
|
4203
4197
|
if (!this.fts.isCurrent(fileId, meta, searchDoc)) {
|
|
4204
4198
|
this.fts.upsert(fileId, meta, searchDoc);
|
|
4205
4199
|
}
|