context-vault 3.1.1 → 3.1.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.
package/README.md CHANGED
@@ -10,13 +10,16 @@ Persistent memory for AI agents — saves and searches knowledge across sessions
10
10
  ## Quick Start
11
11
 
12
12
  ```bash
13
- npx context-vault
13
+ npm install -g context-vault
14
+ context-vault setup
14
15
  ```
15
16
 
16
- One command — no global install required. Setup detects your AI tools (Claude Code, Codex, Claude Desktop, Cursor, Windsurf, Cline, and more), downloads the embedding model (~22MB), seeds your vault, and configures MCP.
17
+ Setup detects your AI tools (Claude Code, Codex, Claude Desktop, Cursor, Windsurf, Cline, and more), downloads the embedding model (~22MB), seeds your vault, and configures MCP.
17
18
 
18
19
  Then open your AI tool and try: **"Search my vault for getting started"**
19
20
 
21
+ > **Quick try without installing?** `npx context-vault` works too, but a global install is recommended for reliable MCP server startup.
22
+
20
23
  ## What It Does
21
24
 
22
25
  - **Save** — insights, decisions, patterns, contacts. Your AI agent writes them as you work.
@@ -73,7 +76,7 @@ Claude Code exposes shell hooks that fire on session events. context-vault integ
73
76
  "hooks": [
74
77
  {
75
78
  "type": "command",
76
- "command": "npx context-vault flush",
79
+ "command": "context-vault flush",
77
80
  "timeout": 10
78
81
  }
79
82
  ]
package/bin/cli.js CHANGED
@@ -379,6 +379,45 @@ async function runSetup() {
379
379
  green(` ✓ context-vault v${VERSION} is up to date`) +
380
380
  dim(` (vault: ${existingVault})`),
381
381
  );
382
+
383
+ // Check for stale tool configs using hardcoded node paths
384
+ const staleConfigs = findStaleToolConfigs();
385
+ if (staleConfigs.length > 0) {
386
+ console.log();
387
+ console.log(
388
+ yellow(` ! ${staleConfigs.length} tool config(s) using legacy hardcoded paths`),
389
+ );
390
+ for (const s of staleConfigs) {
391
+ console.log(dim(` ${s.name}: ${s.command}`));
392
+ }
393
+ console.log();
394
+ const fix = await prompt(
395
+ ` Auto-fix to use context-vault binary? (Y/n):`,
396
+ "Y",
397
+ );
398
+ if (fix.toLowerCase() !== "n") {
399
+ let customVaultDir = null;
400
+ try {
401
+ const cfg = JSON.parse(readFileSync(existingConfig, "utf-8"));
402
+ const defaultVDir = join(HOME, "vault");
403
+ if (cfg.vaultDir && resolve(cfg.vaultDir) !== resolve(defaultVDir)) {
404
+ customVaultDir = cfg.vaultDir;
405
+ }
406
+ } catch {}
407
+ for (const s of staleConfigs) {
408
+ try {
409
+ repairToolConfig(s, customVaultDir);
410
+ console.log(` ${green("+")} ${s.name} — fixed`);
411
+ } catch (e) {
412
+ console.log(` ${red("x")} ${s.name} — ${e.message}`);
413
+ }
414
+ }
415
+ console.log();
416
+ console.log(green(" ✓ Tool configs updated."));
417
+ console.log(dim(" Restart your AI tools to apply the changes."));
418
+ }
419
+ }
420
+
382
421
  console.log();
383
422
  return;
384
423
  }
@@ -1195,6 +1234,77 @@ async function configureCodex(tool, vaultDir) {
1195
1234
  }
1196
1235
  }
1197
1236
 
1237
+ function findStaleToolConfigs() {
1238
+ const stale = [];
1239
+
1240
+ // Check Claude Code (~/.claude.json)
1241
+ const claudePath = join(HOME, ".claude.json");
1242
+ if (existsSync(claudePath)) {
1243
+ try {
1244
+ const cfg = JSON.parse(readFileSync(claudePath, "utf-8"));
1245
+ const srv = cfg?.mcpServers?.["context-vault"];
1246
+ if (srv && srv.command !== "context-vault" && srv.command !== "npx") {
1247
+ stale.push({
1248
+ name: "Claude Code",
1249
+ id: "claude-code",
1250
+ configType: "cli",
1251
+ configPath: claudePath,
1252
+ command: [srv.command, ...(srv.args || [])].join(" "),
1253
+ });
1254
+ }
1255
+ } catch {}
1256
+ }
1257
+
1258
+ // Check JSON-configured tools
1259
+ for (const tool of TOOLS.filter((t) => t.configType === "json")) {
1260
+ const cfgPath = tool.configPath;
1261
+ if (!cfgPath || !existsSync(cfgPath)) continue;
1262
+ try {
1263
+ const cfg = JSON.parse(readFileSync(cfgPath, "utf-8"));
1264
+ const srv = cfg?.[tool.configKey]?.["context-vault"];
1265
+ if (srv && srv.command !== "context-vault" && srv.command !== "npx") {
1266
+ stale.push({
1267
+ name: tool.name,
1268
+ id: tool.id,
1269
+ configType: "json",
1270
+ configPath: cfgPath,
1271
+ configKey: tool.configKey,
1272
+ command: [srv.command, ...(srv.args || [])].join(" "),
1273
+ });
1274
+ }
1275
+ } catch {}
1276
+ }
1277
+
1278
+ return stale;
1279
+ }
1280
+
1281
+ function repairToolConfig(staleEntry, vaultDir) {
1282
+ const serverArgs = ["serve"];
1283
+ if (vaultDir) serverArgs.push("--vault-dir", vaultDir);
1284
+ const newConfig = { command: "context-vault", args: serverArgs };
1285
+
1286
+ if (staleEntry.id === "claude-code") {
1287
+ // Use `claude mcp remove` + `claude mcp add`
1288
+ try {
1289
+ execFileSync("claude", ["mcp", "remove", "context-vault"], {
1290
+ stdio: "pipe",
1291
+ });
1292
+ } catch {}
1293
+ execFileSync(
1294
+ "claude",
1295
+ ["mcp", "add", "context-vault", "--", "context-vault", ...serverArgs],
1296
+ { stdio: "pipe" },
1297
+ );
1298
+ return;
1299
+ }
1300
+
1301
+ // JSON config tools
1302
+ const cfgPath = staleEntry.configPath;
1303
+ const cfg = JSON.parse(readFileSync(cfgPath, "utf-8"));
1304
+ cfg[staleEntry.configKey]["context-vault"] = newConfig;
1305
+ writeFileSync(cfgPath, JSON.stringify(cfg, null, 2) + "\n");
1306
+ }
1307
+
1198
1308
  function configureJsonTool(tool, vaultDir) {
1199
1309
  const configPath = tool.configPath;
1200
1310
  const configDir = dirname(configPath);
@@ -4729,6 +4839,8 @@ async function runDoctor() {
4729
4839
  console.log(bold(" Tool Configurations"));
4730
4840
  let anyToolConfigured = false;
4731
4841
 
4842
+ const isStaleCmd = (cmd) => cmd !== "context-vault" && cmd !== "npx";
4843
+
4732
4844
  // Check Claude Code
4733
4845
  const claudeConfigPath = join(HOME, ".claude.json");
4734
4846
  if (existsSync(claudeConfigPath)) {
@@ -4738,7 +4850,13 @@ async function runDoctor() {
4738
4850
  if (servers["context-vault"]) {
4739
4851
  const srv = servers["context-vault"];
4740
4852
  const cmd = [srv.command, ...(srv.args || [])].join(" ");
4741
- console.log(` ${green("+")} Claude Code: ${dim(cmd)}`);
4853
+ if (isStaleCmd(srv.command)) {
4854
+ console.log(` ${yellow("!")} Claude Code: ${dim(cmd)}`);
4855
+ console.log(` ${dim("Fix: run context-vault setup to update")}`);
4856
+ allOk = false;
4857
+ } else {
4858
+ console.log(` ${green("+")} Claude Code: ${dim(cmd)}`);
4859
+ }
4742
4860
  anyToolConfigured = true;
4743
4861
  } else {
4744
4862
  console.log(` ${dim("-")} Claude Code: not configured`);
@@ -4764,7 +4882,13 @@ async function runDoctor() {
4764
4882
  if (servers["context-vault"]) {
4765
4883
  const srv = servers["context-vault"];
4766
4884
  const cmd = [srv.command, ...(srv.args || [])].join(" ");
4767
- console.log(` ${green("+")} ${tool.name}: ${dim(cmd)}`);
4885
+ if (isStaleCmd(srv.command)) {
4886
+ console.log(` ${yellow("!")} ${tool.name}: ${dim(cmd)}`);
4887
+ console.log(` ${dim("Fix: run context-vault setup to update")}`);
4888
+ allOk = false;
4889
+ } else {
4890
+ console.log(` ${green("+")} ${tool.name}: ${dim(cmd)}`);
4891
+ }
4768
4892
  anyToolConfigured = true;
4769
4893
  } else if (servers["context-mcp"]) {
4770
4894
  console.log(
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@context-vault/core",
3
- "version": "3.1.1",
3
+ "version": "3.1.2",
4
4
  "type": "module",
5
5
  "description": "Pure local engine: capture, index, search, and utilities for context-vault",
6
6
  "main": "dist/main.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "context-vault",
3
- "version": "3.1.1",
3
+ "version": "3.1.2",
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.1",
60
+ "@context-vault/core": "^3.1.2",
61
61
  "@modelcontextprotocol/sdk": "^1.26.0",
62
62
  "adm-zip": "^0.5.16",
63
63
  "sqlite-vec": "^0.1.0"