@pcircle/memesh 4.2.2 → 4.2.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.
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema": "memesh.skills-manifest/v1",
|
|
3
|
-
"generated_at": "2026-05-12T10:
|
|
3
|
+
"generated_at": "2026-05-12T10:49:49.582Z",
|
|
4
4
|
"entries": [
|
|
5
5
|
{
|
|
6
6
|
"path": ".claude-plugin/plugin.json",
|
|
7
|
-
"sha256": "
|
|
7
|
+
"sha256": "ef28cf1f30a545f5d1fbb3d6459b97814f5187c601db5f62ff5be346a6d3ea58",
|
|
8
8
|
"bytes": 441
|
|
9
9
|
},
|
|
10
10
|
{
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
21
|
"path": "scripts/hooks/_shared.js",
|
|
22
|
-
"sha256": "
|
|
23
|
-
"bytes":
|
|
22
|
+
"sha256": "230c2e5005eaefcb6b7689124265fc71da1417382a95f19e2435a42ec195c058",
|
|
23
|
+
"bytes": 28624
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
26
|
"path": "scripts/hooks/post-commit.js",
|
package/package.json
CHANGED
package/scripts/hooks/_shared.js
CHANGED
|
@@ -311,20 +311,57 @@ CREATE VIRTUAL TABLE IF NOT EXISTS entities_fts USING fts5(
|
|
|
311
311
|
* @returns {{ db: any, dbPath: string }}
|
|
312
312
|
*/
|
|
313
313
|
// Cached lookup for the better-sqlite3 native module. Plugin-marketplace
|
|
314
|
-
// installs ship the tarball without node_modules
|
|
315
|
-
//
|
|
316
|
-
// null in
|
|
317
|
-
// with a working dev/npm-global registration still produce
|
|
314
|
+
// installs ship the tarball without node_modules OR with a node_modules
|
|
315
|
+
// tree that lacks the compiled .node binding. tryRequireBetterSqlite()
|
|
316
|
+
// returns null in either scenario and lets each caller silent-skip —
|
|
317
|
+
// callers paired with a working dev/npm-global registration still produce
|
|
318
|
+
// output. The require() call alone is NOT sufficient: better-sqlite3's
|
|
319
|
+
// `lib/index.js` defers the bindings() call until the first
|
|
320
|
+
// `new Database()`, so a successful require() can still hand back a
|
|
321
|
+
// constructor that throws "Could not locate the bindings file" on use.
|
|
322
|
+
// We probe with an in-memory DB to force the binding load up-front.
|
|
323
|
+
function _inTestEnv() {
|
|
324
|
+
return process.env.VITEST === 'true' || process.env.NODE_ENV === 'test';
|
|
325
|
+
}
|
|
326
|
+
|
|
318
327
|
let _cachedDatabaseCtor;
|
|
319
328
|
export function tryRequireBetterSqlite() {
|
|
320
329
|
// Test-only seam: force the "native module unavailable" branch so
|
|
321
330
|
// tests can exercise the silent-skip path that plugin-marketplace
|
|
322
|
-
// cache installs hit.
|
|
323
|
-
|
|
331
|
+
// cache installs hit. Gated to test environments so an accidental
|
|
332
|
+
// shell export cannot disable memesh on a real user's machine.
|
|
333
|
+
if (_inTestEnv() && process.env.MEMESH_TEST_FORCE_MISSING_NATIVE === '1') return null;
|
|
324
334
|
if (_cachedDatabaseCtor !== undefined) return _cachedDatabaseCtor;
|
|
325
335
|
try {
|
|
326
|
-
|
|
327
|
-
|
|
336
|
+
const Database = require('better-sqlite3');
|
|
337
|
+
// Second test-only seam: simulate the exact plugin-marketplace cache
|
|
338
|
+
// failure mode where require() succeeds (JS wrapper present) but the
|
|
339
|
+
// native .node is missing, so the first construction throws. Same
|
|
340
|
+
// test-env gate as the seam above.
|
|
341
|
+
if (_inTestEnv() && process.env.MEMESH_TEST_FORCE_BINDING_LOAD_FAIL === '1') {
|
|
342
|
+
throw new Error('Could not locate the bindings file. (test forced)');
|
|
343
|
+
}
|
|
344
|
+
const probe = new Database(':memory:');
|
|
345
|
+
probe.close();
|
|
346
|
+
_cachedDatabaseCtor = Database;
|
|
347
|
+
} catch (err) {
|
|
348
|
+
// Stderr-trace-then-silent: an empty catch would collapse plugin-
|
|
349
|
+
// marketplace's "no .node binding" case together with ABI mismatches,
|
|
350
|
+
// disk full, fd exhaustion, OOM, and tampered native modules — all
|
|
351
|
+
// distinct causes with distinct fixes. Following the project's hook
|
|
352
|
+
// pattern (e.g. session-summary.js, post-commit.js), we surface a
|
|
353
|
+
// single line on stderr (NOT stdout — Claude Code's hook contract
|
|
354
|
+
// requires stdout stays a single JSON document or empty) and let
|
|
355
|
+
// each caller continue its silent-skip behavior. The stderr trace
|
|
356
|
+
// is visible to anyone running `memesh doctor` or inspecting hook
|
|
357
|
+
// exit logs; it does NOT reach the Claude Code conversation.
|
|
358
|
+
try {
|
|
359
|
+
const code = err && typeof err === 'object' && 'code' in err ? err.code : '';
|
|
360
|
+
const msg = (err && typeof err === 'object' && 'message' in err ? err.message : String(err)) || 'unknown';
|
|
361
|
+
process.stderr.write(`[memesh hook] better-sqlite3 probe failed: ${code} ${msg}\n`);
|
|
362
|
+
} catch {
|
|
363
|
+
// stderr write itself failed (closed pipe, etc.) — give up silently.
|
|
364
|
+
}
|
|
328
365
|
_cachedDatabaseCtor = null;
|
|
329
366
|
}
|
|
330
367
|
return _cachedDatabaseCtor;
|