@threadbase-sh/scanner 0.13.0 → 0.14.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 +2 -2
- package/dist/cli.js +32 -2
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +31 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +31 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Unified Claude Code conversation history scanner.
|
|
4
4
|
|
|
5
5
|
[](./LICENSE)
|
|
6
|
-
[](https://nodejs.org)
|
|
7
7
|
|
|
8
8
|
Combines the best parts of four independent scanner implementations (VS Code, Electron, IntelliJ, CLI) into a single TypeScript package.
|
|
9
9
|
|
|
@@ -31,7 +31,7 @@ Combines the best parts of four independent scanner implementations (VS Code, El
|
|
|
31
31
|
npm install @threadbase-sh/scanner
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
-
**Requires Node.js
|
|
34
|
+
**Requires Node.js 22 or later.** The package uses `better-sqlite3` (a native module) for its persistent index. Prebuilt binaries ship inside the package for common platforms, so a normal `npm install` needs no compiler and no install script. If the binary is somehow unavailable, `openDatabase()` says so explicitly and points at `npm rebuild better-sqlite3` — or you can skip SQLite entirely with `persistent: false`.
|
|
35
35
|
|
|
36
36
|
### Persistent vs. in-memory
|
|
37
37
|
|
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.14.0";
|
|
9
9
|
|
|
10
10
|
// src/logger.ts
|
|
11
11
|
import pino from "pino";
|
|
@@ -1872,7 +1872,13 @@ function openDatabase(dbPath) {
|
|
|
1872
1872
|
if (dbPath !== ":memory:") {
|
|
1873
1873
|
mkdirSync(dirname3(dbPath), { recursive: true });
|
|
1874
1874
|
}
|
|
1875
|
-
|
|
1875
|
+
let db;
|
|
1876
|
+
try {
|
|
1877
|
+
db = new Database(dbPath);
|
|
1878
|
+
} catch (err) {
|
|
1879
|
+
if (isNativeBindingFailure(err)) throw nativeBindingError(err, dbPath);
|
|
1880
|
+
throw err;
|
|
1881
|
+
}
|
|
1876
1882
|
db.pragma("journal_mode = WAL");
|
|
1877
1883
|
db.pragma("synchronous = NORMAL");
|
|
1878
1884
|
db.pragma("temp_store = MEMORY");
|
|
@@ -1882,6 +1888,30 @@ function openDatabase(dbPath) {
|
|
|
1882
1888
|
getLogger().debug({ dbPath }, "db: opened");
|
|
1883
1889
|
return db;
|
|
1884
1890
|
}
|
|
1891
|
+
function isNativeBindingFailure(err) {
|
|
1892
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
1893
|
+
return /could not locate the bindings file|NODE_MODULE_VERSION|was compiled against|\.node['"\s]/i.test(
|
|
1894
|
+
message
|
|
1895
|
+
);
|
|
1896
|
+
}
|
|
1897
|
+
function nativeBindingError(err, dbPath) {
|
|
1898
|
+
const detail = err instanceof Error ? err.message : String(err);
|
|
1899
|
+
return new Error(
|
|
1900
|
+
[
|
|
1901
|
+
`Could not load better-sqlite3's native binary, so the persistent index at ${dbPath} cannot be opened.`,
|
|
1902
|
+
"This usually means the binary was never built or downloaded \u2014 not that your Node version is wrong.",
|
|
1903
|
+
"",
|
|
1904
|
+
"Try, in order:",
|
|
1905
|
+
" 1. npm rebuild better-sqlite3",
|
|
1906
|
+
" 2. rm -rf node_modules && npm install",
|
|
1907
|
+
" (npm 12 blocks package install scripts by default; approve better-sqlite3 if asked)",
|
|
1908
|
+
" 3. Run without SQLite entirely: new ConversationScanner({ persistent: false })",
|
|
1909
|
+
" or pass --no-persist on the CLI. Search falls back to the in-memory index.",
|
|
1910
|
+
"",
|
|
1911
|
+
`Original error: ${detail}`
|
|
1912
|
+
].join("\n")
|
|
1913
|
+
);
|
|
1914
|
+
}
|
|
1885
1915
|
|
|
1886
1916
|
// src/persistent/dir-watermark.ts
|
|
1887
1917
|
import { readdir, stat as stat3 } from "fs/promises";
|