context-vault 3.1.0 → 3.1.1
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/bin/cli.js
CHANGED
|
@@ -375,26 +375,6 @@ async function runSetup() {
|
|
|
375
375
|
} catch {}
|
|
376
376
|
|
|
377
377
|
if (latestVersion === VERSION) {
|
|
378
|
-
// Even when "up to date", ensure the launcher points to a valid server
|
|
379
|
-
const dataDir = join(HOME, ".context-mcp");
|
|
380
|
-
const launcherPath = join(dataDir, "server.mjs");
|
|
381
|
-
let launcherOk = false;
|
|
382
|
-
if (existsSync(launcherPath)) {
|
|
383
|
-
const content = readFileSync(launcherPath, "utf-8");
|
|
384
|
-
const m = content.match(/import "(.+?)"/);
|
|
385
|
-
if (m && existsSync(m[1])) launcherOk = true;
|
|
386
|
-
}
|
|
387
|
-
if (!launcherOk && !isNpx()) {
|
|
388
|
-
mkdirSync(dataDir, { recursive: true });
|
|
389
|
-
writeFileSync(launcherPath, `import "${SERVER_PATH}";\n`);
|
|
390
|
-
console.log(
|
|
391
|
-
green(` ✓ context-vault v${VERSION} is up to date`) +
|
|
392
|
-
dim(` (vault: ${existingVault})`),
|
|
393
|
-
);
|
|
394
|
-
console.log(dim(` ↳ Repaired server launcher → ${SERVER_PATH}`));
|
|
395
|
-
console.log();
|
|
396
|
-
return;
|
|
397
|
-
}
|
|
398
378
|
console.log(
|
|
399
379
|
green(` ✓ context-vault v${VERSION} is up to date`) +
|
|
400
380
|
dim(` (vault: ${existingVault})`),
|
|
@@ -513,12 +493,12 @@ async function runSetup() {
|
|
|
513
493
|
if (detected.length === 0) {
|
|
514
494
|
console.log(yellow(" No supported tools detected.\n"));
|
|
515
495
|
console.log(" To manually configure, add to your tool's MCP config:\n");
|
|
516
|
-
if (isInstalledPackage()) {
|
|
496
|
+
if (isInstalledPackage() || isNpx()) {
|
|
517
497
|
console.log(` ${dim("{")}
|
|
518
498
|
${dim('"mcpServers": {')}
|
|
519
499
|
${dim('"context-vault": {')}
|
|
520
|
-
${dim('"command": "
|
|
521
|
-
${dim(`"args": ["
|
|
500
|
+
${dim('"command": "context-vault",')}
|
|
501
|
+
${dim(`"args": ["serve", "--vault-dir", "/path/to/vault"]`)}
|
|
522
502
|
${dim("}")}
|
|
523
503
|
${dim("}")}
|
|
524
504
|
${dim("}")}\n`);
|
|
@@ -665,11 +645,6 @@ async function runSetup() {
|
|
|
665
645
|
const dataDir = join(HOME, ".context-mcp");
|
|
666
646
|
mkdirSync(dataDir, { recursive: true });
|
|
667
647
|
|
|
668
|
-
// Keep server.mjs launcher up to date so it always resolves to the current installation
|
|
669
|
-
if (isInstalledPackage()) {
|
|
670
|
-
writeFileSync(join(dataDir, "server.mjs"), `import "${SERVER_PATH}";\n`);
|
|
671
|
-
}
|
|
672
|
-
|
|
673
648
|
// Write config.json to data dir (persistent, survives reinstalls)
|
|
674
649
|
const configPath = join(dataDir, "config.json");
|
|
675
650
|
const vaultConfig = {};
|
|
@@ -1137,11 +1112,25 @@ async function configureClaude(tool, vaultDir) {
|
|
|
1137
1112
|
],
|
|
1138
1113
|
{ stdio: "pipe", env },
|
|
1139
1114
|
);
|
|
1115
|
+
} else if (isInstalledPackage()) {
|
|
1116
|
+
const serverArgs = ["serve"];
|
|
1117
|
+
if (vaultDir) serverArgs.push("--vault-dir", vaultDir);
|
|
1118
|
+
execFileSync(
|
|
1119
|
+
"claude",
|
|
1120
|
+
[
|
|
1121
|
+
"mcp",
|
|
1122
|
+
"add",
|
|
1123
|
+
"-s",
|
|
1124
|
+
"user",
|
|
1125
|
+
"context-vault",
|
|
1126
|
+
"--",
|
|
1127
|
+
"context-vault",
|
|
1128
|
+
...serverArgs,
|
|
1129
|
+
],
|
|
1130
|
+
{ stdio: "pipe", env },
|
|
1131
|
+
);
|
|
1140
1132
|
} else {
|
|
1141
|
-
const
|
|
1142
|
-
? join(HOME, ".context-mcp", "server.mjs")
|
|
1143
|
-
: SERVER_PATH;
|
|
1144
|
-
const nodeArgs = [serverPath];
|
|
1133
|
+
const nodeArgs = [SERVER_PATH];
|
|
1145
1134
|
if (vaultDir) nodeArgs.push("--vault-dir", vaultDir);
|
|
1146
1135
|
execFileSync(
|
|
1147
1136
|
"claude",
|
|
@@ -1183,11 +1172,16 @@ async function configureCodex(tool, vaultDir) {
|
|
|
1183
1172
|
["mcp", "add", "context-vault", "--", "npx", ...serverArgs],
|
|
1184
1173
|
{ stdio: "pipe" },
|
|
1185
1174
|
);
|
|
1175
|
+
} else if (isInstalledPackage()) {
|
|
1176
|
+
const serverArgs = ["serve"];
|
|
1177
|
+
if (vaultDir) serverArgs.push("--vault-dir", vaultDir);
|
|
1178
|
+
execFileSync(
|
|
1179
|
+
"codex",
|
|
1180
|
+
["mcp", "add", "context-vault", "--", "context-vault", ...serverArgs],
|
|
1181
|
+
{ stdio: "pipe" },
|
|
1182
|
+
);
|
|
1186
1183
|
} else {
|
|
1187
|
-
const
|
|
1188
|
-
? join(HOME, ".context-mcp", "server.mjs")
|
|
1189
|
-
: SERVER_PATH;
|
|
1190
|
-
const nodeArgs = [serverPath];
|
|
1184
|
+
const nodeArgs = [SERVER_PATH];
|
|
1191
1185
|
if (vaultDir) nodeArgs.push("--vault-dir", vaultDir);
|
|
1192
1186
|
execFileSync(
|
|
1193
1187
|
"codex",
|
|
@@ -1237,13 +1231,11 @@ function configureJsonTool(tool, vaultDir) {
|
|
|
1237
1231
|
env: { NODE_OPTIONS: "--no-warnings=ExperimentalWarning" },
|
|
1238
1232
|
};
|
|
1239
1233
|
} else if (isInstalledPackage()) {
|
|
1240
|
-
const
|
|
1241
|
-
const serverArgs = [];
|
|
1234
|
+
const serverArgs = ["serve"];
|
|
1242
1235
|
if (vaultDir) serverArgs.push("--vault-dir", vaultDir);
|
|
1243
1236
|
config[tool.configKey]["context-vault"] = {
|
|
1244
|
-
command:
|
|
1245
|
-
args:
|
|
1246
|
-
env: { NODE_OPTIONS: "--no-warnings=ExperimentalWarning" },
|
|
1237
|
+
command: "context-vault",
|
|
1238
|
+
args: serverArgs,
|
|
1247
1239
|
};
|
|
1248
1240
|
} else {
|
|
1249
1241
|
const serverArgs = [SERVER_PATH];
|
|
@@ -1598,13 +1590,6 @@ async function runSwitch() {
|
|
|
1598
1590
|
const { detected } = await detectAllTools();
|
|
1599
1591
|
|
|
1600
1592
|
if (target === "local") {
|
|
1601
|
-
const launcherPath = join(dataDir, "server.mjs");
|
|
1602
|
-
if (!existsSync(launcherPath)) {
|
|
1603
|
-
const serverAbs = resolve(ROOT, "src", "server.js");
|
|
1604
|
-
mkdirSync(dataDir, { recursive: true });
|
|
1605
|
-
writeFileSync(launcherPath, `import "${serverAbs}";\n`);
|
|
1606
|
-
}
|
|
1607
|
-
|
|
1608
1593
|
vaultConfig.mode = "local";
|
|
1609
1594
|
mkdirSync(dataDir, { recursive: true });
|
|
1610
1595
|
writeFileSync(configPath, JSON.stringify(vaultConfig, null, 2) + "\n");
|
|
@@ -1636,7 +1621,7 @@ async function runSwitch() {
|
|
|
1636
1621
|
}
|
|
1637
1622
|
console.log();
|
|
1638
1623
|
console.log(green(" ✓ Switched to local mode."));
|
|
1639
|
-
console.log(dim(` Server:
|
|
1624
|
+
console.log(dim(` Server: context-vault serve`));
|
|
1640
1625
|
console.log();
|
|
1641
1626
|
} else {
|
|
1642
1627
|
const hostedUrl = getFlag("--url") || vaultConfig.hostedUrl || API_URL;
|
|
@@ -2044,8 +2029,7 @@ async function runStatus() {
|
|
|
2044
2029
|
const email = raw.email ? ` · ${raw.email}` : "";
|
|
2045
2030
|
modeDetail = ` (${raw.hostedUrl}${email})`;
|
|
2046
2031
|
} else {
|
|
2047
|
-
|
|
2048
|
-
modeDetail = ` (node ${launcherPath})`;
|
|
2032
|
+
modeDetail = ` (context-vault serve)`;
|
|
2049
2033
|
}
|
|
2050
2034
|
} catch {}
|
|
2051
2035
|
}
|
|
@@ -4687,35 +4671,34 @@ async function runDoctor() {
|
|
|
4687
4671
|
db?.close();
|
|
4688
4672
|
} catch {}
|
|
4689
4673
|
|
|
4690
|
-
// ──
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
}
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
` ${dim("Fix: run context-vault setup to reinstall")}`,
|
|
4707
|
-
);
|
|
4708
|
-
allOk = false;
|
|
4709
|
-
}
|
|
4710
|
-
} else {
|
|
4711
|
-
console.log(` ${green("✓")} Launcher exists ${dim(launcherPath)}`);
|
|
4712
|
-
}
|
|
4713
|
-
} else {
|
|
4714
|
-
console.log(` ${yellow("!")} Launcher not found at ${launcherPath}`);
|
|
4715
|
-
console.log(` ${dim("Fix: run context-vault setup")}`);
|
|
4674
|
+
// ── CLI binary ──────────────────────────────────────────────────────
|
|
4675
|
+
try {
|
|
4676
|
+
const binVersion = execSync("context-vault --version", {
|
|
4677
|
+
encoding: "utf-8",
|
|
4678
|
+
timeout: 5000,
|
|
4679
|
+
}).trim();
|
|
4680
|
+
console.log(
|
|
4681
|
+
` ${green("✓")} CLI binary ${dim(`(${binVersion})`)}`,
|
|
4682
|
+
);
|
|
4683
|
+
} catch {
|
|
4684
|
+
console.log(
|
|
4685
|
+
` ${red("✘")} CLI binary not found in PATH`,
|
|
4686
|
+
);
|
|
4687
|
+
console.log(
|
|
4688
|
+
` ${dim("Fix: npm install -g context-vault")}`,
|
|
4689
|
+
);
|
|
4716
4690
|
allOk = false;
|
|
4717
4691
|
}
|
|
4718
4692
|
|
|
4693
|
+
// Clean up legacy launcher if it exists
|
|
4694
|
+
const legacyLauncher = join(HOME, ".context-mcp", "server.mjs");
|
|
4695
|
+
if (existsSync(legacyLauncher)) {
|
|
4696
|
+
try {
|
|
4697
|
+
unlinkSync(legacyLauncher);
|
|
4698
|
+
console.log(` ${green("✓")} Removed legacy launcher ${dim(legacyLauncher)}`);
|
|
4699
|
+
} catch {}
|
|
4700
|
+
}
|
|
4701
|
+
|
|
4719
4702
|
// ── Error log ─────────────────────────────────────────────────────────
|
|
4720
4703
|
const logPath = errorLogPath(config.dataDir);
|
|
4721
4704
|
const logCount = errorLogCount(config.dataDir);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "context-vault",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Persistent memory for AI agents — saves and searches knowledge across sessions",
|
|
6
6
|
"bin": {
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"@context-vault/core"
|
|
58
58
|
],
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@context-vault/core": "^3.1.
|
|
60
|
+
"@context-vault/core": "^3.1.1",
|
|
61
61
|
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
62
62
|
"adm-zip": "^0.5.16",
|
|
63
63
|
"sqlite-vec": "^0.1.0"
|
package/scripts/postinstall.js
CHANGED
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
* 1. Installs @huggingface/transformers with --ignore-scripts to avoid sharp's
|
|
7
7
|
* broken install lifecycle in global contexts. Semantic search degrades
|
|
8
8
|
* gracefully if this step fails.
|
|
9
|
-
* 2.
|
|
9
|
+
* 2. Ensures data directory exists.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import { execSync } from "node:child_process";
|
|
13
|
-
import { existsSync,
|
|
13
|
+
import { existsSync, mkdirSync } from "node:fs";
|
|
14
14
|
import { join, dirname } from "node:path";
|
|
15
15
|
import { fileURLToPath } from "node:url";
|
|
16
16
|
import { homedir } from "node:os";
|
|
@@ -51,18 +51,9 @@ async function main() {
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
// ── 2.
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
const isNpx = PKG_ROOT.includes("/_npx/") || PKG_ROOT.includes("\\_npx\\");
|
|
58
|
-
if (!isNpx) {
|
|
59
|
-
const SERVER_ABS = join(PKG_ROOT, "src", "server.js");
|
|
60
|
-
const DATA_DIR = join(homedir(), ".context-mcp");
|
|
61
|
-
const LAUNCHER = join(DATA_DIR, "server.mjs");
|
|
62
|
-
mkdirSync(DATA_DIR, { recursive: true });
|
|
63
|
-
writeFileSync(LAUNCHER, `import "${SERVER_ABS}";\n`);
|
|
64
|
-
console.log("[context-vault] Local server launcher written to " + LAUNCHER);
|
|
65
|
-
}
|
|
54
|
+
// ── 2. Ensure data dir exists ────────────────────────────────────────
|
|
55
|
+
const DATA_DIR = join(homedir(), ".context-mcp");
|
|
56
|
+
mkdirSync(DATA_DIR, { recursive: true });
|
|
66
57
|
}
|
|
67
58
|
|
|
68
59
|
main().catch(() => {});
|