@strvmarv/total-recall 0.6.8-beta.3 → 0.6.8-beta.5

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "total-recall",
3
3
  "description": "Multi-tiered memory and knowledge base with semantic search, auto-compaction, and built-in evaluation. Works across Claude Code, Copilot CLI, OpenCode, Cline, and Cursor.",
4
- "version": "0.6.8-beta.3",
4
+ "version": "0.6.8-beta.5",
5
5
  "author": {
6
6
  "name": "strvmarv"
7
7
  },
package/bin/start.cjs CHANGED
@@ -1,37 +1,50 @@
1
1
  'use strict';
2
2
  // Bootstrap wrapper for the total-recall MCP server.
3
- // Runs as plain CJS (no imports) so it works even when node_modules is absent.
4
- // Detects missing/incomplete node_modules and self-heals via npm install,
5
- // then re-execs dist/index.js with inherited stdio as a transparent passthrough.
3
+ //
4
+ // Why this exists: .mcp.json launches us under `node` (guaranteed present
5
+ // wherever Claude Code runs). Since 0.6.8 the server uses `bun:sqlite`, which
6
+ // only resolves under the Bun runtime, so this script locates bun and
7
+ // re-execs dist/index.js under it.
8
+ //
9
+ // Lookup order:
10
+ // 1. Bundled bun at ~/.total-recall/bun/<BUN_VERSION>/bun[.exe]
11
+ // (downloaded by scripts/postinstall.js during `npm install`)
12
+ // 2. System bun on PATH
13
+ // 3. Hard fail — node cannot run dist/index.js (bun:sqlite import errors)
14
+ //
15
+ // Kept as plain CJS (no imports) so it works even when node_modules is absent.
6
16
 
7
17
  const { existsSync } = require('fs');
8
- const { join, dirname } = require('path');
18
+ const { join } = require('path');
9
19
  const { spawnSync } = require('child_process');
20
+ const os = require('os');
10
21
 
11
- const root = join(__dirname, '..');
12
-
13
- // Use better-sqlite3/lib as the canary — it only exists after a successful install.
14
- const canary = join(root, 'node_modules', 'better-sqlite3', 'lib');
22
+ // Keep in sync with scripts/postinstall.js BUN_VERSION.
23
+ const BUN_VERSION = '1.2.10';
15
24
 
16
- if (!existsSync(canary)) {
17
- process.stderr.write('[total-recall] node_modules missing or incomplete — running npm install...\n');
25
+ const root = join(__dirname, '..');
26
+ const entry = join(root, 'dist', 'index.js');
18
27
 
19
- const npm = findNpm();
20
- const install = spawnSync(npm, ['install', '--production', '--prefer-offline'], {
21
- cwd: root,
22
- stdio: 'inherit',
23
- shell: true, // required on Windows to execute .cmd files; harmless on macOS/Linux
24
- });
28
+ if (!existsSync(entry)) {
29
+ process.stderr.write(
30
+ '[total-recall] dist/index.js not found. Run `npm install` (marketplace) or `npm run build` (git checkout).\n'
31
+ );
32
+ process.exit(1);
33
+ }
25
34
 
26
- if (install.status !== 0) {
27
- process.stderr.write('[total-recall] npm install failed — see output above for details\n');
28
- process.exit(1);
29
- }
35
+ const bun = findBun();
36
+ if (!bun) {
37
+ process.stderr.write(
38
+ '[total-recall] bun runtime not found.\n' +
39
+ ` Expected bundled bun at ~/.total-recall/bun/${BUN_VERSION}/bun (installed by \`npm install\`).\n` +
40
+ ' Fix: run `npm install` inside the plugin directory, or install bun manually (https://bun.sh/install).\n'
41
+ );
42
+ process.exit(1);
30
43
  }
31
44
 
32
- // Re-exec dist/index.js as a subprocess with inherited stdio.
33
- // spawnSync blocks until the server exits, transparently passing all I/O through.
34
- const server = spawnSync(process.execPath, [join(root, 'dist', 'index.js')], {
45
+ // Re-exec dist/index.js under bun with inherited stdio so the MCP JSON-RPC
46
+ // channel passes through transparently.
47
+ const server = spawnSync(bun, [entry], {
35
48
  stdio: 'inherit',
36
49
  env: process.env,
37
50
  });
@@ -40,18 +53,20 @@ process.exit(server.status ?? 1);
40
53
 
41
54
  // ---------------------------------------------------------------------------
42
55
 
43
- function findNpm() {
44
- const nodeDir = dirname(process.execPath);
56
+ function findBun() {
57
+ const isWin = process.platform === 'win32';
58
+ const ext = isWin ? '.exe' : '';
45
59
 
46
- // npm installs alongside node. On Windows it's npm.cmd; on macOS/Linux it's npm.
47
- const candidates = process.platform === 'win32'
48
- ? [join(nodeDir, 'npm.cmd'), join(nodeDir, 'npm')]
49
- : [join(nodeDir, 'npm')];
60
+ // 1. Bundled bun (preferred version-pinned, matches what postinstall downloaded)
61
+ const bundled = join(os.homedir(), '.total-recall', 'bun', BUN_VERSION, `bun${ext}`);
62
+ if (existsSync(bundled)) return bundled;
50
63
 
51
- for (const candidate of candidates) {
52
- if (existsSync(candidate)) return candidate;
64
+ // 2. System bun on PATH — let the OS resolver find it
65
+ const probe = spawnSync(isWin ? 'where' : 'which', ['bun'], { encoding: 'utf8' });
66
+ if (probe.status === 0) {
67
+ const first = String(probe.stdout || '').split(/\r?\n/).find(Boolean);
68
+ if (first && existsSync(first)) return first;
53
69
  }
54
70
 
55
- // Last resort: hope npm is somewhere on PATH.
56
- return 'npm';
71
+ return null;
57
72
  }
@@ -1,7 +1,8 @@
1
1
  @echo off
2
2
  SETLOCAL EnableDelayedExpansion
3
3
  :: total-recall MCP server launcher for Windows
4
- :: Prefers bundled Bun, falls back to system Bun, then system Node.
4
+ :: Requires Bun dist\index.js uses bun:sqlite, which node cannot resolve.
5
+ :: Prefers bundled Bun (installed by scripts\postinstall.js), falls back to system Bun.
5
6
 
6
7
  SET BUN_VERSION=1.2.10
7
8
  SET BUNDLED_BUN=%USERPROFILE%\.total-recall\bun\%BUN_VERSION%\bun.exe
@@ -21,7 +22,7 @@ IF EXIST "%BUNDLED_BUN%" (
21
22
  exit /b %ERRORLEVEL%
22
23
  )
23
24
 
24
- :: Priority 2: system Bun (warn)
25
+ :: Priority 2: system Bun (warn — version may not match)
25
26
  WHERE bun >nul 2>&1
26
27
  IF %ERRORLEVEL% EQU 0 (
27
28
  echo total-recall: warning: bundled bun v%BUN_VERSION% not found, using system bun. Version mismatch possible. 1>&2
@@ -30,15 +31,7 @@ IF %ERRORLEVEL% EQU 0 (
30
31
  exit /b !ERRORLEVEL!
31
32
  )
32
33
 
33
- :: Priority 3: system Node (warn)
34
- WHERE node >nul 2>&1
35
- IF %ERRORLEVEL% EQU 0 (
36
- echo total-recall: warning: bun not found, falling back to node. ABI issues may occur. 1>&2
37
- echo Install bun (https://bun.sh/install) or re-run 'npm install' to fix this. 1>&2
38
- node "%ENTRY%" %*
39
- exit /b !ERRORLEVEL!
40
- )
41
-
42
- echo total-recall: error: neither bun nor node found. 1>&2
43
- echo Install bun: https://bun.sh/install 1>&2
34
+ echo total-recall: error: bun runtime not found. 1>&2
35
+ echo Expected bundled bun at %%USERPROFILE%%\.total-recall\bun\%BUN_VERSION%\bun.exe (installed by 'npm install'). 1>&2
36
+ echo Fix: run 'npm install' inside the plugin directory, or install bun manually (https://bun.sh/install). 1>&2
44
37
  exit /b 1
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env bash
2
2
  # total-recall MCP server launcher
3
- # Prefers bundled Bun, falls back to system Bun, then system Node.
3
+ # Requires Bun dist/index.js uses bun:sqlite, which node cannot resolve.
4
+ # Prefers bundled Bun (installed by scripts/postinstall.js), falls back to system Bun.
4
5
 
5
6
  BUN_VERSION="1.2.10"
6
7
 
@@ -25,67 +26,6 @@ find_system_bun() {
25
26
  return 1
26
27
  }
27
28
 
28
- find_node() {
29
- # Check PATH first
30
- if command -v node &>/dev/null; then
31
- echo "node"
32
- return 0
33
- fi
34
-
35
- # Check nvm
36
- if [ -d "$HOME/.nvm/versions/node" ]; then
37
- local latest=$(ls -1d "$HOME/.nvm/versions/node"/v* 2>/dev/null | sort -V | tail -1)
38
- if [ -n "$latest" ] && [ -x "$latest/bin/node" ]; then
39
- echo "$latest/bin/node"
40
- return 0
41
- fi
42
- fi
43
-
44
- # Check fnm
45
- if [ -d "$HOME/.local/share/fnm/node-versions" ]; then
46
- local latest=$(ls -1d "$HOME/.local/share/fnm/node-versions"/v*/installation 2>/dev/null | sort -V | tail -1)
47
- if [ -n "$latest" ] && [ -x "$latest/bin/node" ]; then
48
- echo "$latest/bin/node"
49
- return 0
50
- fi
51
- fi
52
-
53
- # Check Homebrew
54
- if [ -x "/home/linuxbrew/.linuxbrew/bin/node" ]; then
55
- echo "/home/linuxbrew/.linuxbrew/bin/node"
56
- return 0
57
- fi
58
- if [ -x "/opt/homebrew/bin/node" ]; then
59
- echo "/opt/homebrew/bin/node"
60
- return 0
61
- fi
62
- if [ -x "/usr/local/bin/node" ]; then
63
- echo "/usr/local/bin/node"
64
- return 0
65
- fi
66
-
67
- # Check Volta
68
- if [ -x "$HOME/.volta/bin/node" ]; then
69
- echo "$HOME/.volta/bin/node"
70
- return 0
71
- fi
72
-
73
- # Check nvm4w (Windows nvm — Git Bash exposes C:\ as /c/)
74
- if [ -x "/c/nvm4w/nodejs/node" ]; then
75
- echo "/c/nvm4w/nodejs/node"
76
- return 0
77
- fi
78
-
79
- # Check MacPorts
80
- if [ -x "/opt/local/bin/node" ]; then
81
- echo "/opt/local/bin/node"
82
- return 0
83
- fi
84
-
85
- echo ""
86
- return 1
87
- }
88
-
89
29
  # Find the package entry point
90
30
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
91
31
  PACKAGE_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
@@ -103,7 +43,7 @@ if [ -n "$RUNTIME" ]; then
103
43
  exec "$RUNTIME" "$ENTRY" "$@"
104
44
  fi
105
45
 
106
- # Priority 2: system Bun (warn)
46
+ # Priority 2: system Bun (warn — version may not match)
107
47
  RUNTIME=$(find_system_bun)
108
48
  if [ -n "$RUNTIME" ]; then
109
49
  echo "total-recall: warning: bundled bun v$BUN_VERSION not found, using system bun. Version mismatch possible." >&2
@@ -111,14 +51,7 @@ if [ -n "$RUNTIME" ]; then
111
51
  exec "$RUNTIME" "$ENTRY" "$@"
112
52
  fi
113
53
 
114
- # Priority 3: system Node (warn)
115
- RUNTIME=$(find_node)
116
- if [ -n "$RUNTIME" ]; then
117
- echo "total-recall: warning: bun not found, falling back to node. Native addon ABI issues may occur." >&2
118
- echo " Install bun (https://bun.sh/install) or re-run 'npm install' to fix this." >&2
119
- exec "$RUNTIME" "$ENTRY" "$@"
120
- fi
121
-
122
- echo "total-recall: error: neither bun nor node found." >&2
123
- echo " Install bun: https://bun.sh/install" >&2
54
+ echo "total-recall: error: bun runtime not found." >&2
55
+ echo " Expected bundled bun at ~/.total-recall/bun/$BUN_VERSION/bun (installed by 'npm install')." >&2
56
+ echo " Fix: run 'npm install' inside the plugin directory, or install bun manually (https://bun.sh/install)." >&2
124
57
  exit 1
package/dist/index.js CHANGED
@@ -8664,6 +8664,9 @@ var Embedder = class {
8664
8664
  }
8665
8665
  };
8666
8666
 
8667
+ // src/tools/registry.ts
8668
+ import { readFileSync as readFileSync15 } from "fs";
8669
+
8667
8670
  // node_modules/zod/v3/helpers/util.js
8668
8671
  var util;
8669
8672
  (function(util2) {
@@ -25310,7 +25313,15 @@ var CopilotCliImporter = class {
25310
25313
  import { existsSync as existsSync7, readdirSync as readdirSync4, readFileSync as readFileSync8 } from "fs";
25311
25314
  import { join as join11 } from "path";
25312
25315
  import { homedir as homedir3 } from "os";
25316
+ import { fileURLToPath as fileURLToPath6 } from "url";
25313
25317
  import { Database as Database2 } from "bun:sqlite";
25318
+ function safeFileURLToPath(url2) {
25319
+ try {
25320
+ return fileURLToPath6(url2);
25321
+ } catch {
25322
+ return null;
25323
+ }
25324
+ }
25314
25325
  var CursorImporter = class {
25315
25326
  name = "cursor";
25316
25327
  configPath;
@@ -25334,7 +25345,7 @@ var CursorImporter = class {
25334
25345
  if (!existsSync7(wsJson)) continue;
25335
25346
  try {
25336
25347
  const ws = JSON.parse(readFileSync8(wsJson, "utf8"));
25337
- const projectPath = ws.folder ? decodeURIComponent(new URL(ws.folder).pathname) : ws.workspace ? decodeURIComponent(new URL(ws.workspace).pathname) : null;
25348
+ const projectPath = ws.folder ? safeFileURLToPath(ws.folder) : ws.workspace ? safeFileURLToPath(ws.workspace) : null;
25338
25349
  if (!projectPath) continue;
25339
25350
  if (existsSync7(join11(projectPath, ".cursorrules"))) knowledgeFiles++;
25340
25351
  const rulesDir = join11(projectPath, ".cursor", "rules");
@@ -25397,7 +25408,7 @@ var CursorImporter = class {
25397
25408
  if (!existsSync7(wsJson)) continue;
25398
25409
  try {
25399
25410
  const ws = JSON.parse(readFileSync8(wsJson, "utf8"));
25400
- const projectPath = ws.folder ? new URL(ws.folder).pathname : ws.workspace ? new URL(ws.workspace).pathname : null;
25411
+ const projectPath = ws.folder ? safeFileURLToPath(ws.folder) : ws.workspace ? safeFileURLToPath(ws.workspace) : null;
25401
25412
  if (projectPath) projectPaths.add(projectPath);
25402
25413
  } catch {
25403
25414
  }
@@ -26105,10 +26116,11 @@ function collectMarkdownFiles(dirPath, files) {
26105
26116
 
26106
26117
  // src/utils/project-detect.ts
26107
26118
  import { execFileSync } from "child_process";
26108
- import { basename as basename5 } from "path";
26119
+ import { basename as basename5, parse as parsePath } from "path";
26120
+ import { homedir as homedir7 } from "os";
26109
26121
  function detectProject(cwd) {
26110
- const home = process.env.HOME ?? "";
26111
- if (cwd === home || cwd === "/") return null;
26122
+ if (cwd === homedir7()) return null;
26123
+ if (cwd === parsePath(cwd).root) return null;
26112
26124
  try {
26113
26125
  const remote = execFileSync("git", ["remote", "get-url", "origin"], {
26114
26126
  cwd,
@@ -26127,8 +26139,8 @@ function detectProject(cwd) {
26127
26139
  // src/eval/smoke-test.ts
26128
26140
  import { resolve as resolve4, dirname as dirname6, basename as basename6 } from "path";
26129
26141
  import { readFileSync as readFileSync13 } from "fs";
26130
- import { fileURLToPath as fileURLToPath6 } from "url";
26131
- var __dirname3 = dirname6(fileURLToPath6(import.meta.url));
26142
+ import { fileURLToPath as fileURLToPath7 } from "url";
26143
+ var __dirname3 = dirname6(fileURLToPath7(import.meta.url));
26132
26144
  var PACKAGE_ROOT3 = basename6(__dirname3) === "dist" ? resolve4(__dirname3, "..") : resolve4(__dirname3, "..", "..");
26133
26145
  var SMOKE_PASS_THRESHOLD = 0.8;
26134
26146
  function getMetaValue(db, key) {
@@ -26875,9 +26887,13 @@ async function handleExtraTool(name, args, ctx) {
26875
26887
  }
26876
26888
 
26877
26889
  // src/tools/registry.ts
26890
+ function readPackageVersion() {
26891
+ const pkg = JSON.parse(readFileSync15(pkgPath("package.json"), "utf-8"));
26892
+ return pkg.version;
26893
+ }
26878
26894
  async function startServer(ctx) {
26879
26895
  const server = new Server(
26880
- { name: "total-recall", version: "0.5.9" },
26896
+ { name: "total-recall", version: readPackageVersion() },
26881
26897
  { capabilities: { tools: {} } }
26882
26898
  );
26883
26899
  server.oninitialized = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strvmarv/total-recall",
3
- "version": "0.6.8-beta.3",
3
+ "version": "0.6.8-beta.5",
4
4
  "description": "Multi-tiered memory and knowledge base plugin for TUI coding assistants",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",