mcp-context-sync 1.0.11 → 1.0.12

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 (49) hide show
  1. package/dist/cli.js +57 -49
  2. package/dist/cli.js.map +1 -1
  3. package/dist/db/connection.d.ts +10 -1
  4. package/dist/db/connection.js +59 -23
  5. package/dist/db/connection.js.map +1 -1
  6. package/dist/db/json-adapter.d.ts +47 -0
  7. package/dist/db/json-adapter.js +235 -0
  8. package/dist/db/json-adapter.js.map +1 -0
  9. package/dist/db/sqlite-adapter.d.ts +37 -0
  10. package/dist/db/sqlite-adapter.js +78 -0
  11. package/dist/db/sqlite-adapter.js.map +1 -0
  12. package/dist/db/storage.d.ts +41 -0
  13. package/dist/db/storage.js +9 -0
  14. package/dist/db/storage.js.map +1 -0
  15. package/dist/index.js +4 -4
  16. package/dist/index.js.map +1 -1
  17. package/dist/resources/project-decisions.d.ts +2 -2
  18. package/dist/resources/project-decisions.js +3 -4
  19. package/dist/resources/project-decisions.js.map +1 -1
  20. package/dist/resources/project-snapshot.d.ts +2 -2
  21. package/dist/resources/project-snapshot.js +3 -4
  22. package/dist/resources/project-snapshot.js.map +1 -1
  23. package/dist/resources/status.d.ts +2 -2
  24. package/dist/resources/status.js +1 -2
  25. package/dist/resources/status.js.map +1 -1
  26. package/dist/tools/amend-snapshot.d.ts +2 -2
  27. package/dist/tools/amend-snapshot.js +9 -10
  28. package/dist/tools/amend-snapshot.js.map +1 -1
  29. package/dist/tools/get-history.d.ts +2 -2
  30. package/dist/tools/get-history.js +3 -4
  31. package/dist/tools/get-history.js.map +1 -1
  32. package/dist/tools/list-projects.d.ts +2 -2
  33. package/dist/tools/list-projects.js +1 -2
  34. package/dist/tools/list-projects.js.map +1 -1
  35. package/dist/tools/log-decision.d.ts +2 -2
  36. package/dist/tools/log-decision.js +2 -3
  37. package/dist/tools/log-decision.js.map +1 -1
  38. package/dist/tools/resume.d.ts +2 -2
  39. package/dist/tools/resume.js +7 -8
  40. package/dist/tools/resume.js.map +1 -1
  41. package/dist/tools/search-snapshots.d.ts +2 -2
  42. package/dist/tools/search-snapshots.js +2 -3
  43. package/dist/tools/search-snapshots.js.map +1 -1
  44. package/dist/tools/sync.d.ts +2 -2
  45. package/dist/tools/sync.js +5 -6
  46. package/dist/tools/sync.js.map +1 -1
  47. package/package.json +4 -2
  48. package/scripts/postinstall.cjs +14 -34
  49. package/scripts/preinstall.cjs +13 -86
@@ -1,97 +1,24 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  /**
4
- * preinstall check — runs BEFORE npm installs dependencies.
5
- * Detects known-broken combinations (Node 23+/Windows/no Build Tools)
6
- * and aborts with a clear message BEFORE npm leaves broken shims.
4
+ * preinstall check — informational only.
5
+ * Warns about Node 23+ on Windows where better-sqlite3 may not have
6
+ * prebuilt binaries. Installation always proceeds (JSON fallback available).
7
7
  */
8
8
 
9
9
  const nodeVersion = process.version;
10
10
  const major = parseInt(nodeVersion.slice(1), 10);
11
11
  const isWin = process.platform === 'win32';
12
12
 
13
- // Node 18-22 on any platform: prebuilt binaries exist, no issues
14
- if (major < 23) {
15
- process.exit(0);
13
+ if (major >= 23 && isWin) {
14
+ console.warn('');
15
+ console.warn(` mcp-context-sync: Node ${nodeVersion} on Windows detected.`);
16
+ console.warn(' better-sqlite3 may fail to install (no prebuilt binary).');
17
+ console.warn(' If so, JSON file storage will be used automatically.');
18
+ console.warn(' For best performance, use Node 20 or 22 LTS.');
19
+ console.warn('');
20
+ } else if (major >= 23) {
21
+ console.warn(`\n mcp-context-sync: Node ${nodeVersion} — better-sqlite3 may compile from source.\n`);
16
22
  }
17
23
 
18
- // Node 23+ on non-Windows: usually has build tools, let it try
19
- if (!isWin) {
20
- console.warn(`\n ⚠ Node ${nodeVersion} detected. better-sqlite3 may need to compile from source.`);
21
- console.warn(' If installation fails, use Node 20 or 22 LTS.\n');
22
- process.exit(0);
23
- }
24
-
25
- // Node 23+ on Windows: check if Build Tools are available
26
- let hasBuildTools = false;
27
- try {
28
- const { execSync } = require('child_process');
29
-
30
- // Method 1: Check for cl.exe (MSVC compiler)
31
- try {
32
- execSync('where cl.exe', { stdio: ['pipe', 'pipe', 'pipe'] });
33
- hasBuildTools = true;
34
- } catch {}
35
-
36
- // Method 2: Check for MSBuild (Visual Studio Build Tools)
37
- if (!hasBuildTools) {
38
- try {
39
- execSync('where msbuild', { stdio: ['pipe', 'pipe', 'pipe'] });
40
- hasBuildTools = true;
41
- } catch {}
42
- }
43
-
44
- // Method 3: Check VS install path
45
- if (!hasBuildTools) {
46
- const fs = require('fs');
47
- const vsPath = 'C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\vswhere.exe';
48
- if (fs.existsSync(vsPath)) {
49
- try {
50
- const output = execSync(`"${vsPath}" -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`, {
51
- encoding: 'utf-8',
52
- stdio: ['pipe', 'pipe', 'pipe'],
53
- }).trim();
54
- if (output) hasBuildTools = true;
55
- } catch {}
56
- }
57
- }
58
- } catch {}
59
-
60
- if (hasBuildTools) {
61
- console.warn(`\n ⚠ Node ${nodeVersion} on Windows — no prebuilt binary for better-sqlite3.`);
62
- console.warn(' Build Tools detected, will compile from source (may take a minute).\n');
63
- process.exit(0);
64
- }
65
-
66
- // Node 23+ on Windows without Build Tools — this WILL fail and leave broken shims
67
- console.error('');
68
- console.error('╔══════════════════════════════════════════════════════════════════╗');
69
- console.error('║ mcp-context-sync: installation will fail on this environment ║');
70
- console.error('╚══════════════════════════════════════════════════════════════════╝');
71
- console.error('');
72
- console.error(` Node: ${nodeVersion}`);
73
- console.error(` Platform: Windows`);
74
- console.error(' Build: Visual Studio Build Tools NOT found');
75
- console.error('');
76
- console.error(' better-sqlite3 has no prebuilt binary for Node 23+ on Windows,');
77
- console.error(' and native compilation requires Visual Studio Build Tools.');
78
- console.error(' Without them, npm will leave broken .cmd shims in your PATH.');
79
- console.error('');
80
- console.error(' ── Recommended fix (fastest) ──────────────────────────────────');
81
- console.error('');
82
- console.error(' Use Node 20 or 22 LTS:');
83
- console.error('');
84
- console.error(' nvm install 22');
85
- console.error(' nvm use 22');
86
- console.error(' npm install -g mcp-context-sync');
87
- console.error('');
88
- console.error(' ── Alternative fix ────────────────────────────────────────────');
89
- console.error('');
90
- console.error(' Install Visual Studio Build Tools:');
91
- console.error(' https://visualstudio.microsoft.com/visual-cpp-build-tools/');
92
- console.error(' Select "Desktop development with C++" workload');
93
- console.error(' Then retry: npm install -g mcp-context-sync');
94
- console.error('');
95
-
96
- // Exit with error to PREVENT npm from proceeding
97
- process.exit(1);
24
+ // Always exit 0 never block installation