@pcircle/memesh 4.2.5 → 4.2.7
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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/README.de.md +61 -0
- package/README.es.md +61 -0
- package/README.fr.md +61 -0
- package/README.ja.md +61 -0
- package/README.ko.md +61 -0
- package/README.md +73 -1
- package/README.pt.md +61 -0
- package/README.th.md +108 -4
- package/README.vi.md +61 -0
- package/README.zh-CN.md +61 -0
- package/README.zh-TW.md +61 -0
- package/dist/core/doctor.d.ts +1 -0
- package/dist/core/doctor.d.ts.map +1 -1
- package/dist/core/doctor.js +41 -6
- package/dist/core/doctor.js.map +1 -1
- package/dist/core/install-hooks.d.ts +6 -0
- package/dist/core/install-hooks.d.ts.map +1 -1
- package/dist/core/install-hooks.js +37 -0
- package/dist/core/install-hooks.js.map +1 -1
- package/dist/skills-manifest.json +4 -4
- package/dist/transports/cli/cli.js +24 -4
- package/dist/transports/cli/cli.js.map +1 -1
- package/dist/transports/http/server.d.ts.map +1 -1
- package/dist/transports/http/server.js +7 -0
- package/dist/transports/http/server.js.map +1 -1
- package/package.json +1 -1
- package/scripts/hooks/_shared.js +30 -11
package/package.json
CHANGED
package/scripts/hooks/_shared.js
CHANGED
|
@@ -387,23 +387,42 @@ export function tryRequireBetterSqlite() {
|
|
|
387
387
|
function _attemptBetterSqliteRebuild() {
|
|
388
388
|
try {
|
|
389
389
|
// Package root = parent of the scripts/hooks/ directory that contains
|
|
390
|
-
// this file. That's where `package.json`
|
|
390
|
+
// this file. That's where memesh's own `package.json` lives.
|
|
391
391
|
const here = dirname(fileURLToPath(import.meta.url));
|
|
392
392
|
const pkgRoot = dirname(dirname(here));
|
|
393
393
|
if (!existsSync(join(pkgRoot, 'package.json'))) return;
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
394
|
+
// Resolve better-sqlite3's actual install location via Node's normal
|
|
395
|
+
// resolution algorithm, which follows hoisting (the consumer's
|
|
396
|
+
// top-level node_modules holds the package when memesh is installed
|
|
397
|
+
// as a dependency). Looking at `<pkgRoot>/node_modules/better-sqlite3`
|
|
398
|
+
// directly would false-negative on every hoisted install.
|
|
399
|
+
let bsqliteDir;
|
|
400
|
+
try {
|
|
401
|
+
// `require.resolve` returns the path to `lib/index.js` inside the
|
|
402
|
+
// package. Walk up to the package directory.
|
|
403
|
+
const entry = require.resolve('better-sqlite3', { paths: [pkgRoot] });
|
|
404
|
+
// `<bsqliteDir>/lib/index.js` → walk back twice to the package root.
|
|
405
|
+
bsqliteDir = dirname(dirname(entry));
|
|
406
|
+
} catch {
|
|
407
|
+
// Genuinely not installed anywhere on the resolution path. `npm
|
|
408
|
+
// rebuild` cannot help; the user needs a full install.
|
|
399
409
|
try {
|
|
400
410
|
process.stderr.write(
|
|
401
|
-
`[memesh hook]
|
|
402
|
-
+ `Run: cd
|
|
411
|
+
`[memesh hook] better-sqlite3 is not installed (Node could not resolve from ${pkgRoot}). `
|
|
412
|
+
+ `Run: cd to the project that depends on @pcircle/memesh and run \`npm install\`.\n`,
|
|
403
413
|
);
|
|
404
414
|
} catch {}
|
|
405
415
|
return;
|
|
406
416
|
}
|
|
417
|
+
// The hoisted install location's package root — npm rebuild needs to
|
|
418
|
+
// be run from a project that owns this node_modules tree. Walking
|
|
419
|
+
// up to the nearest directory that has its own package.json gives
|
|
420
|
+
// us the right cwd.
|
|
421
|
+
let rebuildCwd = dirname(bsqliteDir);
|
|
422
|
+
while (rebuildCwd !== dirname(rebuildCwd)) {
|
|
423
|
+
if (existsSync(join(rebuildCwd, 'package.json')) && !rebuildCwd.endsWith('node_modules')) break;
|
|
424
|
+
rebuildCwd = dirname(rebuildCwd);
|
|
425
|
+
}
|
|
407
426
|
const memesh = join(homedir(), '.memesh');
|
|
408
427
|
try { mkdirSync(memesh, { recursive: true, mode: 0o700 }); } catch {}
|
|
409
428
|
const markerPath = join(memesh, 'last-rebuild-attempt.lock');
|
|
@@ -429,13 +448,13 @@ function _attemptBetterSqliteRebuild() {
|
|
|
429
448
|
}
|
|
430
449
|
process.stderr.write(
|
|
431
450
|
`[memesh hook] Attempting to rebuild better-sqlite3 in background — `
|
|
432
|
-
+ `next session should capture normally. (
|
|
451
|
+
+ `next session should capture normally. (rebuildCwd: ${rebuildCwd})\n`
|
|
433
452
|
+ `[memesh hook] To retry later, manually: rm "${markerPath}" && `
|
|
434
|
-
+ `cd "${
|
|
453
|
+
+ `cd "${rebuildCwd}" && npm rebuild better-sqlite3\n`,
|
|
435
454
|
);
|
|
436
455
|
const npm = process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
|
437
456
|
const child = spawn(npm, ['rebuild', 'better-sqlite3'], {
|
|
438
|
-
cwd:
|
|
457
|
+
cwd: rebuildCwd,
|
|
439
458
|
detached: true,
|
|
440
459
|
stdio: 'ignore',
|
|
441
460
|
windowsHide: true,
|