@threadbase-sh/scanner 0.14.5 → 0.14.6

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.14.5";
8
+ var version = "0.14.6";
9
9
 
10
10
  // src/logger.ts
11
11
  import pino from "pino";
@@ -3029,8 +3029,18 @@ var IndexQueue = class {
3029
3029
  // src/scanner.ts
3030
3030
  var BATCH_SIZE2 = 12;
3031
3031
  var DEFAULT_CONFIG_PATH = "~/.config/threadbase-scanner";
3032
+ function isTestProcess() {
3033
+ return Boolean(process.env.VITEST) || Boolean(process.env.JEST_WORKER_ID) || process.env.NODE_ENV === "test";
3034
+ }
3032
3035
  function defaultDbPath() {
3033
- return process.env.TB_SCANNER_DB ?? join5(homedir2(), ".config", "threadbase-scanner", "index.db");
3036
+ const override = process.env.TB_SCANNER_DB;
3037
+ if (override) return override;
3038
+ if (isTestProcess()) {
3039
+ throw new Error(
3040
+ "TB_SCANNER_DB must be set under a test runner. Refusing to open the default index at ~/.config/threadbase-scanner/index.db, because test fixtures written there are indistinguishable from real conversations and corrupt every measurement of the index. Point it at a temp directory in your test setup, or pass persistent.dbPath explicitly."
3041
+ );
3042
+ }
3043
+ return join5(homedir2(), ".config", "threadbase-scanner", "index.db");
3034
3044
  }
3035
3045
  function capForMemory(doc, max) {
3036
3046
  const combined = combineSearchContent(doc);