docdex 0.2.14 → 0.2.15

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/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Changelog
2
2
 
3
- ## 0.2.14
3
+ ## 0.2.15
4
4
  - Repo memory now tags items with `repoId` and filters recalls to prevent cross-repo leakage in multi-repo daemons.
5
5
  - MCP HTTP requires explicit repo selection when multiple repos are active.
6
6
  - Postinstall banner now guides users to run `docdex setup`.
package/lib/platform.js CHANGED
@@ -160,9 +160,13 @@ function detectLibcFromRuntime(options) {
160
160
  return override;
161
161
  }
162
162
 
163
- const report =
164
- options?.report ??
165
- (typeof process.report?.getReport === "function" ? process.report.getReport() : null);
163
+ const hasReportOverride =
164
+ options != null && Object.prototype.hasOwnProperty.call(options, "report");
165
+ const report = hasReportOverride
166
+ ? options.report
167
+ : typeof process.report?.getReport === "function"
168
+ ? process.report.getReport()
169
+ : null;
166
170
 
167
171
  const glibcVersion = report?.header?.glibcVersionRuntime;
168
172
  if (typeof glibcVersion === "string" && glibcVersion.trim()) return "gnu";
@@ -434,6 +434,14 @@ function resolveBinaryPath({ binaryPath } = {}) {
434
434
  return null;
435
435
  }
436
436
 
437
+ function resolveMcpBinaryPath(binaryPath) {
438
+ if (!binaryPath) return null;
439
+ const dir = path.dirname(binaryPath);
440
+ const name = process.platform === "win32" ? "docdex-mcp-server.exe" : "docdex-mcp-server";
441
+ const candidate = path.join(dir, name);
442
+ return fs.existsSync(candidate) ? candidate : null;
443
+ }
444
+
437
445
  function ensureDaemonRoot() {
438
446
  const root = daemonRootPath();
439
447
  fs.mkdirSync(root, { recursive: true });
@@ -987,7 +995,7 @@ async function maybePromptOllamaModel({
987
995
  return { status: "skipped", reason: "invalid_selection" };
988
996
  }
989
997
 
990
- function registerStartup({ binaryPath, port, repoRoot, logger }) {
998
+ function registerStartup({ binaryPath, mcpBinaryPath, port, repoRoot, logger }) {
991
999
  if (!binaryPath) return { ok: false, reason: "missing_binary" };
992
1000
  const args = [
993
1001
  "daemon",
@@ -1001,12 +1009,21 @@ function registerStartup({ binaryPath, port, repoRoot, logger }) {
1001
1009
  "warn",
1002
1010
  "--secure-mode=false"
1003
1011
  ];
1012
+ const envMcpBin = mcpBinaryPath ? `DOCDEX_MCP_SERVER_BIN=${mcpBinaryPath}` : null;
1004
1013
 
1005
1014
  if (process.platform === "darwin") {
1006
1015
  const plistPath = path.join(os.homedir(), "Library", "LaunchAgents", "com.docdex.daemon.plist");
1007
1016
  const logDir = path.join(os.homedir(), ".docdex", "logs");
1008
1017
  fs.mkdirSync(logDir, { recursive: true });
1009
1018
  const programArgs = [binaryPath, ...args];
1019
+ const envVars = [
1020
+ " <key>DOCDEX_BROWSER_AUTO_INSTALL</key>\n",
1021
+ " <string>0</string>\n"
1022
+ ];
1023
+ if (mcpBinaryPath) {
1024
+ envVars.push(" <key>DOCDEX_MCP_SERVER_BIN</key>\n");
1025
+ envVars.push(` <string>${mcpBinaryPath}</string>\n`);
1026
+ }
1010
1027
  const plist = `<?xml version="1.0" encoding="UTF-8"?>\n` +
1011
1028
  `<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n` +
1012
1029
  `<plist version="1.0">\n` +
@@ -1015,8 +1032,7 @@ function registerStartup({ binaryPath, port, repoRoot, logger }) {
1015
1032
  ` <string>com.docdex.daemon</string>\n` +
1016
1033
  ` <key>EnvironmentVariables</key>\n` +
1017
1034
  ` <dict>\n` +
1018
- ` <key>DOCDEX_BROWSER_AUTO_INSTALL</key>\n` +
1019
- ` <string>0</string>\n` +
1035
+ envVars.join("") +
1020
1036
  ` </dict>\n` +
1021
1037
  ` <key>ProgramArguments</key>\n` +
1022
1038
  ` <array>\n` +
@@ -1057,13 +1073,14 @@ function registerStartup({ binaryPath, port, repoRoot, logger }) {
1057
1073
  "[Service]",
1058
1074
  `ExecStart=${binaryPath} ${args.join(" ")}`,
1059
1075
  "Environment=DOCDEX_BROWSER_AUTO_INSTALL=0",
1076
+ envMcpBin ? `Environment=${envMcpBin}` : null,
1060
1077
  "Restart=always",
1061
1078
  "RestartSec=2",
1062
1079
  "",
1063
1080
  "[Install]",
1064
1081
  "WantedBy=default.target",
1065
1082
  ""
1066
- ].join("\n");
1083
+ ].filter(Boolean).join("\n");
1067
1084
  fs.writeFileSync(unitPath, unit);
1068
1085
  const reload = spawnSync("systemctl", ["--user", "daemon-reload"]);
1069
1086
  const enable = spawnSync("systemctl", ["--user", "enable", "--now", "docdexd.service"]);
@@ -1075,8 +1092,12 @@ function registerStartup({ binaryPath, port, repoRoot, logger }) {
1075
1092
  if (process.platform === "win32") {
1076
1093
  const taskName = "Docdex Daemon";
1077
1094
  const joinedArgs = args.map((arg) => `"${arg}"`).join(" ");
1095
+ const envParts = ['set "DOCDEX_BROWSER_AUTO_INSTALL=0"'];
1096
+ if (mcpBinaryPath) {
1097
+ envParts.push(`set "DOCDEX_MCP_SERVER_BIN=${mcpBinaryPath}"`);
1098
+ }
1078
1099
  const taskArgs =
1079
- `"cmd.exe" /c "set DOCDEX_BROWSER_AUTO_INSTALL=0 && \"${binaryPath}\" ${joinedArgs}"`;
1100
+ `"cmd.exe" /c "${envParts.join(" && ")} && \"${binaryPath}\" ${joinedArgs}"`;
1080
1101
  const create = spawnSync("schtasks", [
1081
1102
  "/Create",
1082
1103
  "/F",
@@ -1100,8 +1121,12 @@ function registerStartup({ binaryPath, port, repoRoot, logger }) {
1100
1121
  return { ok: false, reason: "unsupported_platform" };
1101
1122
  }
1102
1123
 
1103
- function startDaemonNow({ binaryPath, port, repoRoot }) {
1124
+ function startDaemonNow({ binaryPath, mcpBinaryPath, port, repoRoot }) {
1104
1125
  if (!binaryPath) return false;
1126
+ const extraEnv = {};
1127
+ if (mcpBinaryPath) {
1128
+ extraEnv.DOCDEX_MCP_SERVER_BIN = mcpBinaryPath;
1129
+ }
1105
1130
  const child = spawn(
1106
1131
  binaryPath,
1107
1132
  [
@@ -1121,7 +1146,8 @@ function startDaemonNow({ binaryPath, port, repoRoot }) {
1121
1146
  detached: true,
1122
1147
  env: {
1123
1148
  ...process.env,
1124
- DOCDEX_BROWSER_AUTO_INSTALL: "0"
1149
+ DOCDEX_BROWSER_AUTO_INSTALL: "0",
1150
+ ...extraEnv
1125
1151
  }
1126
1152
  }
1127
1153
  );
@@ -1300,7 +1326,14 @@ async function runPostInstallSetup({ binaryPath, logger } = {}) {
1300
1326
 
1301
1327
  const daemonRoot = ensureDaemonRoot();
1302
1328
  const resolvedBinary = resolveBinaryPath({ binaryPath });
1303
- const startup = registerStartup({ binaryPath: resolvedBinary, port, repoRoot: daemonRoot, logger: log });
1329
+ const resolvedMcpBinary = resolveMcpBinaryPath(resolvedBinary);
1330
+ const startup = registerStartup({
1331
+ binaryPath: resolvedBinary,
1332
+ mcpBinaryPath: resolvedMcpBinary,
1333
+ port,
1334
+ repoRoot: daemonRoot,
1335
+ logger: log
1336
+ });
1304
1337
  if (!startup.ok) {
1305
1338
  if (!startupFailureReported()) {
1306
1339
  log.warn?.("[docdex] startup registration failed; run the daemon manually:");
@@ -1311,7 +1344,7 @@ async function runPostInstallSetup({ binaryPath, logger } = {}) {
1311
1344
  clearStartupFailure();
1312
1345
  }
1313
1346
 
1314
- startDaemonNow({ binaryPath: resolvedBinary, port, repoRoot: daemonRoot });
1347
+ startDaemonNow({ binaryPath: resolvedBinary, mcpBinaryPath: resolvedMcpBinary, port, repoRoot: daemonRoot });
1315
1348
  const setupLaunch = launchSetupWizard({ binaryPath: resolvedBinary, logger: log });
1316
1349
  if (!setupLaunch.ok && setupLaunch.reason !== "skipped") {
1317
1350
  log.warn?.("[docdex] setup wizard did not launch. Run `docdex setup`.");
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "docdex",
3
- "version": "0.2.14",
3
+ "version": "0.2.15",
4
4
  "mcpName": "io.github.bekirdag/docdex",
5
- "description": "Docdex CLI as an npm-installable binary wrapper.",
5
+ "description": "Local-first documentation and code indexer with HTTP/MCP search, AST, and agent memory.",
6
6
  "bin": {
7
7
  "docdex": "bin/docdex.js",
8
8
  "docdexd": "bin/docdex.js"
@@ -40,12 +40,20 @@
40
40
  "bugs": {
41
41
  "url": "https://github.com/bekirdag/docdex/issues"
42
42
  },
43
- "homepage": "https://github.com/bekirdag/docdex#readme",
43
+ "homepage": "https://docdex.org",
44
44
  "license": "MIT",
45
45
  "author": "bekir dağ",
46
46
  "keywords": [
47
47
  "docdex",
48
+ "documentation",
48
49
  "search",
50
+ "index",
51
+ "code-search",
52
+ "mcp",
53
+ "ai",
54
+ "agent",
55
+ "rag",
56
+ "knowledge-base",
49
57
  "cli"
50
58
  ],
51
59
  "publishConfig": {