docdex 0.2.37 → 0.2.39

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,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.39
4
+ - Bump release metadata to 0.2.39.
5
+
6
+ ## 0.2.38
7
+ - Bump release metadata to 0.2.38.
8
+
3
9
  ## 0.2.37
4
10
  - Bump release metadata to 0.2.37.
5
11
 
package/assets/agents.md CHANGED
@@ -1,4 +1,4 @@
1
- ---- START OF DOCDEX INFO V0.2.37 ----
1
+ ---- START OF DOCDEX INFO V0.2.39 ----
2
2
  Docdex URL: http://127.0.0.1:28491
3
3
  Use this base URL for Docdex HTTP endpoints.
4
4
  Health check endpoint: `GET /healthz` (not `/v1/health`).
@@ -305,9 +305,10 @@ When answering a complex coding query, follow this "Reasoning Trace":
305
305
  Save more memories for both lobes during the task, not just at the end.
306
306
 
307
307
  1. Repo memory: After each meaningful discovery or code change, save at least one durable fact (file location, behavior, config, gotcha) via `docdex_memory_save`.
308
- 2. Profile memory: When the user expresses a preference, constraint, or workflow correction, call `docdex_save_preference` immediately with the right category.
309
- 3. Keep it crisp: 1-3 short sentences, include file paths when relevant, avoid raw code blobs.
310
- 4. Safety: Never store secrets, tokens, or sensitive user data. Skip transient or speculative info.
308
+ 2. Memory overrides: When a new repo memory replaces older facts, include `metadata.supersedes` with the prior memory id(s). Docdex marks the superseded entries with `supersededBy`/`supersededAtMs`, down-ranks them during recall, and they can be removed via `docdex memory compact` (dry-run unless `--apply`).
309
+ 3. Profile memory: When the user expresses a preference, constraint, or workflow correction, call `docdex_save_preference` immediately with the right category.
310
+ 4. Keep it crisp: 1-3 short sentences, include file paths when relevant, avoid raw code blobs.
311
+ 5. Safety: Never store secrets, tokens, or sensitive user data. Skip transient or speculative info.
311
312
 
312
313
  ### 3. Index Health + Diff-Aware Search (Mandatory)
313
314
 
package/lib/install.js CHANGED
@@ -2286,6 +2286,14 @@ function printPostInstallBanner() {
2286
2286
  return false;
2287
2287
  }
2288
2288
  };
2289
+ const writeStderr = (message) => {
2290
+ try {
2291
+ process.stderr.write(message);
2292
+ return true;
2293
+ } catch {
2294
+ return false;
2295
+ }
2296
+ };
2289
2297
  let width = 0;
2290
2298
  const content = [
2291
2299
  "\x1b[31m _ _ \x1b[0m",
@@ -2320,7 +2328,9 @@ function printPostInstallBanner() {
2320
2328
  lines.push(bottom);
2321
2329
  const banner = `\r\x1b[2K${lines.join("\n")}\n`;
2322
2330
  if (!writeDirect(banner)) {
2323
- console.log(banner);
2331
+ if (!writeStderr(banner)) {
2332
+ console.log(banner);
2333
+ }
2324
2334
  }
2325
2335
  }
2326
2336
 
package/lib/paths.js CHANGED
@@ -102,11 +102,20 @@ function resolveWindowsRunnerPath(options = {}) {
102
102
  return pathModule.join(resolveDocdexDataDir({ ...options, pathModule }), "run-daemon.cmd");
103
103
  }
104
104
 
105
+ function resolveWindowsSetupRunnerPath(options = {}) {
106
+ const pathModule = options.pathModule || path;
107
+ if (options.distBaseDir) {
108
+ return pathModule.join(pathModule.dirname(options.distBaseDir), "run-setup.cmd");
109
+ }
110
+ return pathModule.join(resolveDocdexDataDir({ ...options, pathModule }), "run-setup.cmd");
111
+ }
112
+
105
113
  module.exports = {
106
114
  resolveUserDataDir,
107
115
  resolveDocdexDataDir,
108
116
  resolveDistBaseCandidates,
109
117
  resolveDistBaseDir,
110
118
  resolveBinDir,
111
- resolveWindowsRunnerPath
119
+ resolveWindowsRunnerPath,
120
+ resolveWindowsSetupRunnerPath
112
121
  };
@@ -15,7 +15,8 @@ const {
15
15
  resolveDistBaseDir,
16
16
  resolveDistBaseCandidates,
17
17
  resolveBinDir,
18
- resolveWindowsRunnerPath
18
+ resolveWindowsRunnerPath,
19
+ resolveWindowsSetupRunnerPath
19
20
  } = require("./paths");
20
21
 
21
22
  const DEFAULT_HOST = "127.0.0.1";
@@ -2261,6 +2262,27 @@ function writeWindowsRunner({ binaryPath, args, envPairs, workingDir, logger, di
2261
2262
  }
2262
2263
  }
2263
2264
 
2265
+ function writeWindowsSetupRunner({ binaryPath, args, logger, distBaseDir } = {}) {
2266
+ if (!binaryPath) return null;
2267
+ const runnerPath = resolveWindowsSetupRunnerPath({ distBaseDir });
2268
+ const lines = [
2269
+ "@echo off",
2270
+ "setlocal",
2271
+ "set \"DOCDEX_SETUP_AUTO=1\"",
2272
+ "set \"DOCDEX_SETUP_MODE=auto\""
2273
+ ];
2274
+ const argString = (args || []).map((arg) => escapeCmdArg(arg)).join(" ");
2275
+ lines.push(`${escapeCmdArg(binaryPath)} ${argString}`.trim());
2276
+ try {
2277
+ fs.mkdirSync(path.dirname(runnerPath), { recursive: true });
2278
+ fs.writeFileSync(runnerPath, `${lines.join("\r\n")}\r\n`);
2279
+ return runnerPath;
2280
+ } catch (err) {
2281
+ logger?.warn?.(`[docdex] failed to write Windows setup runner: ${err?.message || err}`);
2282
+ return null;
2283
+ }
2284
+ }
2285
+
2264
2286
  function registerStartup({ binaryPath, port, repoRoot, logger, distBaseDir }) {
2265
2287
  if (!binaryPath) return { ok: false, reason: "missing_binary" };
2266
2288
  stopDaemonService({ logger });
@@ -2514,7 +2536,8 @@ function launchSetupWizard({
2514
2536
  spawnFn = spawn,
2515
2537
  spawnSyncFn = spawnSync,
2516
2538
  platform = process.platform,
2517
- canPrompt = canPromptWithTty
2539
+ canPrompt = canPromptWithTty,
2540
+ distBaseDir
2518
2541
  }) {
2519
2542
  if (!binaryPath) return { ok: false, reason: "missing_binary" };
2520
2543
  if (shouldSkipSetup(env)) return { ok: false, reason: "skipped" };
@@ -2535,9 +2558,21 @@ function launchSetupWizard({
2535
2558
  }
2536
2559
 
2537
2560
  if (platform === "win32") {
2538
- const quoted = `"${binaryPath}" ${args.map((arg) => `"${arg}"`).join(" ")}`;
2539
- const cmdline = `set DOCDEX_SETUP_AUTO=1 && set DOCDEX_SETUP_MODE=auto && ${quoted}`;
2540
- const result = spawnSyncFn("cmd", ["/c", "start", "", "cmd", "/c", cmdline]);
2561
+ const runnerPath = writeWindowsSetupRunner({
2562
+ binaryPath,
2563
+ args,
2564
+ logger,
2565
+ distBaseDir
2566
+ });
2567
+ if (!runnerPath) return { ok: false, reason: "runner_failed" };
2568
+ const result = spawnSyncFn("cmd", [
2569
+ "/c",
2570
+ "start",
2571
+ "",
2572
+ "cmd",
2573
+ "/c",
2574
+ escapeCmdArg(runnerPath)
2575
+ ]);
2541
2576
  if (result.status === 0) return { ok: true };
2542
2577
  logger?.warn?.(`[docdex] cmd start failed: ${result.stderr || "unknown error"}`);
2543
2578
  return { ok: false, reason: "terminal_launch_failed" };
@@ -2681,13 +2716,20 @@ async function runPostInstallSetup({ binaryPath, logger, env, skipDaemon, distBa
2681
2716
  if (startupOk) {
2682
2717
  clearStartupFailure();
2683
2718
  }
2684
- const skipWizard = isNpmLifecycle(effectiveEnv) || shouldSkipSetup(effectiveEnv);
2719
+ const skipExplicit = shouldSkipSetup(effectiveEnv);
2720
+ const skipWizard = isNpmLifecycle(effectiveEnv) || skipExplicit;
2685
2721
  const setupLaunch = skipWizard
2686
- ? { ok: false, reason: "skipped" }
2687
- : launchSetupWizard({ binaryPath: startupBinaries.binaryPath, logger: log });
2688
- if (!setupLaunch.ok && setupLaunch.reason !== "skipped") {
2689
- log.warn?.("[docdex] setup wizard did not launch. Run `docdex setup`.");
2690
- recordSetupPending({ reason: setupLaunch.reason, port, repoRoot: daemonRoot });
2722
+ ? { ok: false, reason: skipExplicit ? "skipped" : "npm_lifecycle" }
2723
+ : launchSetupWizard({
2724
+ binaryPath: startupBinaries.binaryPath,
2725
+ logger: log,
2726
+ distBaseDir: resolvedDistBaseDir
2727
+ });
2728
+ if (!setupLaunch.ok) {
2729
+ if (setupLaunch.reason !== "skipped") {
2730
+ log.warn?.("[docdex] setup wizard did not launch. Run `docdex setup`.");
2731
+ recordSetupPending({ reason: setupLaunch.reason, port, repoRoot: daemonRoot });
2732
+ }
2691
2733
  }
2692
2734
  return { port, url, configPath };
2693
2735
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docdex",
3
- "version": "0.2.37",
3
+ "version": "0.2.39",
4
4
  "mcpName": "io.github.bekirdag/docdex",
5
5
  "description": "Local-first documentation and code indexer with HTTP/MCP search, AST, and agent memory.",
6
6
  "bin": {