@threadbase-sh/scanner 0.9.2 → 0.9.3

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 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.9.2";
8
+ var version = "0.9.3";
9
9
 
10
10
  // src/logger.ts
11
11
  import pino from "pino";
@@ -1704,6 +1704,19 @@ var ConversationFilesRepo = class {
1704
1704
  const rows = this.db.prepare("SELECT absolute_path FROM conversation_files WHERE status != 'deleted'").all();
1705
1705
  return rows.map((r) => r.absolute_path);
1706
1706
  }
1707
+ // Active file paths belonging to any of the given accounts. Backs the
1708
+ // deletion-reconcile so a scan that covered only some accounts can't mark
1709
+ // another account's files deleted (they live in the same shared index.db but
1710
+ // a different profile owns them). Returns [] for an empty account list.
1711
+ activePathsByAccounts(accounts) {
1712
+ if (accounts.length === 0) return [];
1713
+ const placeholders = accounts.map(() => "?").join(", ");
1714
+ const rows = this.db.prepare(
1715
+ `SELECT absolute_path FROM conversation_files
1716
+ WHERE status != 'deleted' AND account IN (${placeholders})`
1717
+ ).all(...accounts);
1718
+ return rows.map((r) => r.absolute_path);
1719
+ }
1707
1720
  // Active files whose immediate parent is exactly parentDir (no nested
1708
1721
  // subdirectories). Backs the dir-mtime gate's reuse path: a project dir with
1709
1722
  // an unchanged mtime and no nested files can skip the glob entirely.
@@ -2109,8 +2122,15 @@ var PersistentEngine = class {
2109
2122
  scanned += batch.length;
2110
2123
  options.onProgress?.(scanned, discovered.length);
2111
2124
  }
2125
+ const coveredAccounts = /* @__PURE__ */ new Set();
2126
+ if (enabled.includes(CLAUDE_CODE_PROVIDER)) {
2127
+ for (const p of activeProfiles) coveredAccounts.add(p.id);
2128
+ }
2129
+ if (enabled.includes(CODEX_CLI_PROVIDER) && (options.codexRoots?.length ?? 0) > 0) {
2130
+ coveredAccounts.add("codex");
2131
+ }
2112
2132
  const seen = new Set(discovered.map((d) => d.filePath));
2113
- for (const path of this.files.allActivePaths()) {
2133
+ for (const path of this.files.activePathsByAccounts([...coveredAccounts])) {
2114
2134
  if (!seen.has(path)) this.markDeleted(path);
2115
2135
  }
2116
2136
  log.info({ scanned, indexed: this.conversations.count() }, "persistent: indexAll complete");