@pcircle/memesh 4.2.0 → 4.2.2

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.
Files changed (41) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/README.de.md +5 -2
  4. package/README.es.md +5 -2
  5. package/README.fr.md +5 -2
  6. package/README.ja.md +5 -2
  7. package/README.ko.md +5 -2
  8. package/README.md +5 -2
  9. package/README.pt.md +5 -2
  10. package/README.th.md +5 -2
  11. package/README.vi.md +5 -2
  12. package/README.zh-CN.md +5 -2
  13. package/README.zh-TW.md +5 -2
  14. package/dashboard/dist/index.html +9 -9
  15. package/dist/cli/view.js +7 -1
  16. package/dist/cli/view.js.map +1 -1
  17. package/dist/core/analytics.d.ts +17 -0
  18. package/dist/core/analytics.d.ts.map +1 -1
  19. package/dist/core/analytics.js +40 -0
  20. package/dist/core/analytics.js.map +1 -1
  21. package/dist/core/kg-backfill.d.ts +10 -1
  22. package/dist/core/kg-backfill.d.ts.map +1 -1
  23. package/dist/core/kg-backfill.js +167 -2
  24. package/dist/core/kg-backfill.js.map +1 -1
  25. package/dist/mcp/launcher.d.ts +3 -0
  26. package/dist/mcp/launcher.d.ts.map +1 -0
  27. package/dist/mcp/launcher.js +37 -0
  28. package/dist/mcp/launcher.js.map +1 -0
  29. package/dist/skills-manifest.json +4 -4
  30. package/dist/transports/cli/cli.js +10 -0
  31. package/dist/transports/cli/cli.js.map +1 -1
  32. package/dist/transports/http/server.d.ts.map +1 -1
  33. package/dist/transports/http/server.js +12 -1
  34. package/dist/transports/http/server.js.map +1 -1
  35. package/dist/transports/schemas.d.ts +4 -4
  36. package/dist/transports/schemas.d.ts.map +1 -1
  37. package/dist/transports/schemas.js +7 -3
  38. package/dist/transports/schemas.js.map +1 -1
  39. package/package.json +5 -3
  40. package/scripts/hooks/session-summary.js +2 -3
  41. package/scripts/postinstall-rebuild.mjs +41 -0
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env node
2
+ // Runs after `npm install` to ensure better-sqlite3's native binding is compiled.
3
+ // The plugin marketplace sometimes runs `npm install --ignore-scripts`, which
4
+ // skips better-sqlite3's own build step. This script is a safety net that
5
+ // detects a missing binary and attempts a rebuild. Errors are non-fatal —
6
+ // the hook and MCP server will report the missing binding at runtime.
7
+ import { execFileSync } from 'child_process';
8
+ import { createRequire } from 'module';
9
+ import { fileURLToPath } from 'url';
10
+ import { dirname } from 'path';
11
+
12
+ const require = createRequire(import.meta.url);
13
+
14
+ function isBinaryPresent() {
15
+ // better-sqlite3 loads its native binding lazily inside Database() —
16
+ // a plain require() always succeeds. Must instantiate to trigger the probe.
17
+ try {
18
+ const Db = require('better-sqlite3');
19
+ new Db(':memory:').close();
20
+ return true;
21
+ } catch {
22
+ return false;
23
+ }
24
+ }
25
+
26
+ if (isBinaryPresent()) {
27
+ process.exit(0);
28
+ }
29
+
30
+ // dirname(fileURLToPath(...)) → scripts/ ; one more dirname → package root
31
+ const cwd = dirname(dirname(fileURLToPath(import.meta.url)));
32
+ const npm = process.platform === 'win32' ? 'npm.cmd' : 'npm';
33
+
34
+ try {
35
+ process.stdout.write('[memesh] Compiling better-sqlite3 native addon...\n');
36
+ execFileSync(npm, ['rebuild', 'better-sqlite3'], { cwd, stdio: 'inherit' });
37
+ process.stdout.write('[memesh] better-sqlite3 compiled successfully.\n');
38
+ } catch (err) {
39
+ // Non-fatal: user can still use the CLI without the native module if no DB ops.
40
+ process.stderr.write(`[memesh] Warning: Could not compile better-sqlite3 (${err?.message}). Run "npm rebuild better-sqlite3" manually inside the install directory.\n`);
41
+ }