@orquentra/codebuddy 2.6.0 → 2.6.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.
Files changed (79) hide show
  1. package/CLAUDE_CODEX.md +6 -4
  2. package/WORKFLOW.md +5 -5
  3. package/dist/{chunk-UN57FKQX.js → chunk-2XDPKFUW.js} +111 -847
  4. package/dist/chunk-2XDPKFUW.js.map +1 -0
  5. package/dist/{chunk-QDBDYCM2.js → chunk-5FW3PMNP.js} +2 -2
  6. package/dist/{chunk-776EQXDV.js → chunk-5KZY6OTG.js} +82 -5
  7. package/dist/chunk-5KZY6OTG.js.map +1 -0
  8. package/dist/{chunk-UFZD3JAA.js → chunk-5MQOE4J6.js} +3 -3
  9. package/dist/chunk-5UH3BEQR.js +32 -0
  10. package/dist/chunk-5UH3BEQR.js.map +1 -0
  11. package/dist/{chunk-N34XHWBA.js → chunk-B6CO63SQ.js} +8 -7
  12. package/dist/chunk-B6CO63SQ.js.map +1 -0
  13. package/dist/chunk-CSRD5OQA.js +79 -0
  14. package/dist/chunk-CSRD5OQA.js.map +1 -0
  15. package/dist/{chunk-PYLH4MH5.js → chunk-FJOTP632.js} +1 -1
  16. package/dist/{chunk-U4HAJLIB.js → chunk-IBLJOHJL.js} +15 -2
  17. package/dist/chunk-IBLJOHJL.js.map +1 -0
  18. package/dist/chunk-IMFUYEZA.js +1607 -0
  19. package/dist/chunk-IMFUYEZA.js.map +1 -0
  20. package/dist/{chunk-SYWJG5NA.js → chunk-J2EAZ4MA.js} +20 -7
  21. package/dist/chunk-J2EAZ4MA.js.map +1 -0
  22. package/dist/{chunk-L5AYZC3F.js → chunk-NERKZSSE.js} +7 -7
  23. package/dist/{chunk-PCE4STAY.js → chunk-OWWCDRXW.js} +5 -5
  24. package/dist/{chunk-WHZSVY2L.js → chunk-QBDJXGG5.js} +2 -2
  25. package/dist/{chunk-VAKBJV26.js → chunk-R7CD6EXS.js} +307 -1822
  26. package/dist/chunk-R7CD6EXS.js.map +1 -0
  27. package/dist/{chunk-6MKEIDX5.js → chunk-RAJJSCIP.js} +2 -2
  28. package/dist/chunk-S6VEG4S2.js +991 -0
  29. package/dist/chunk-S6VEG4S2.js.map +1 -0
  30. package/dist/cli/index.js +14 -3
  31. package/dist/cli/index.js.map +1 -1
  32. package/dist/{codebuddy-DM-i0Fu5.d.ts → codebuddy-B_pCaQrV.d.ts} +22 -2
  33. package/dist/{config-KFEHLV6W.js → config-DEVHUDIU.js} +3 -3
  34. package/dist/docker-autostart-KDME7TVC.js +12 -0
  35. package/dist/index.d.ts +4 -2
  36. package/dist/index.js +19 -15
  37. package/dist/langgraph/index.d.ts +1 -1
  38. package/dist/lean-command-HTQCPH76.js +15 -0
  39. package/dist/{local-OTOY56B4.js → local-5MZURLCZ.js} +6 -2
  40. package/dist/{main-HFHLGID4.js → main-MTBQZGJV.js} +139 -171
  41. package/dist/main-MTBQZGJV.js.map +1 -0
  42. package/dist/{memory-4RGVLPKG.js → memory-KIC5FJVW.js} +4 -4
  43. package/dist/{operations-LOBAQRLO.js → operations-POCHY3WR.js} +5 -4
  44. package/dist/postgres-docker-QQZQ2ABK.js +16 -0
  45. package/dist/{pretool-command-MQQ2UNQM.js → pretool-command-AX6JXP25.js} +3 -3
  46. package/dist/{rerank-3P3C2UHN.js → rerank-5QZ3PNUW.js} +4 -4
  47. package/dist/runtime-CUBOOPZO.js +43 -0
  48. package/dist/runtime-CUBOOPZO.js.map +1 -0
  49. package/dist/stdio-HOV4P3DQ.js +12 -0
  50. package/dist/stdio-HOV4P3DQ.js.map +1 -0
  51. package/dist/{summaries-ZBV5IN7Y.js → summaries-SB5L2TSW.js} +6 -6
  52. package/dist/summaries-SB5L2TSW.js.map +1 -0
  53. package/dist/{zvec-MAPSJQSR.js → zvec-MSRKT7IV.js} +3 -3
  54. package/dist/zvec-MSRKT7IV.js.map +1 -0
  55. package/package.json +7 -10
  56. package/dist/chunk-776EQXDV.js.map +0 -1
  57. package/dist/chunk-N34XHWBA.js.map +0 -1
  58. package/dist/chunk-SYWJG5NA.js.map +0 -1
  59. package/dist/chunk-U4HAJLIB.js.map +0 -1
  60. package/dist/chunk-UN57FKQX.js.map +0 -1
  61. package/dist/chunk-VAKBJV26.js.map +0 -1
  62. package/dist/lean-command-C5YPFKHP.js +0 -15
  63. package/dist/main-HFHLGID4.js.map +0 -1
  64. /package/dist/{chunk-QDBDYCM2.js.map → chunk-5FW3PMNP.js.map} +0 -0
  65. /package/dist/{chunk-UFZD3JAA.js.map → chunk-5MQOE4J6.js.map} +0 -0
  66. /package/dist/{chunk-PYLH4MH5.js.map → chunk-FJOTP632.js.map} +0 -0
  67. /package/dist/{chunk-L5AYZC3F.js.map → chunk-NERKZSSE.js.map} +0 -0
  68. /package/dist/{chunk-PCE4STAY.js.map → chunk-OWWCDRXW.js.map} +0 -0
  69. /package/dist/{chunk-WHZSVY2L.js.map → chunk-QBDJXGG5.js.map} +0 -0
  70. /package/dist/{chunk-6MKEIDX5.js.map → chunk-RAJJSCIP.js.map} +0 -0
  71. /package/dist/{config-KFEHLV6W.js.map → config-DEVHUDIU.js.map} +0 -0
  72. /package/dist/{lean-command-C5YPFKHP.js.map → docker-autostart-KDME7TVC.js.map} +0 -0
  73. /package/dist/{local-OTOY56B4.js.map → lean-command-HTQCPH76.js.map} +0 -0
  74. /package/dist/{operations-LOBAQRLO.js.map → local-5MZURLCZ.js.map} +0 -0
  75. /package/dist/{memory-4RGVLPKG.js.map → memory-KIC5FJVW.js.map} +0 -0
  76. /package/dist/{pretool-command-MQQ2UNQM.js.map → operations-POCHY3WR.js.map} +0 -0
  77. /package/dist/{summaries-ZBV5IN7Y.js.map → postgres-docker-QQZQ2ABK.js.map} +0 -0
  78. /package/dist/{zvec-MAPSJQSR.js.map → pretool-command-AX6JXP25.js.map} +0 -0
  79. /package/dist/{rerank-3P3C2UHN.js.map → rerank-5QZ3PNUW.js.map} +0 -0
@@ -1,40 +1,53 @@
1
+ import {
2
+ runPreToolHookCommand
3
+ } from "./chunk-QBDJXGG5.js";
1
4
  import {
2
5
  loadLlmSummaries,
3
6
  summarizeRepository
4
- } from "./chunk-PCE4STAY.js";
7
+ } from "./chunk-OWWCDRXW.js";
5
8
  import {
6
9
  chatJson,
7
10
  coolingDown,
8
11
  usageToday
9
- } from "./chunk-UFZD3JAA.js";
12
+ } from "./chunk-5MQOE4J6.js";
13
+ import {
14
+ isDockerDaemonRunning,
15
+ tryStartDockerDesktop,
16
+ waitForDockerDaemon
17
+ } from "./chunk-5UH3BEQR.js";
18
+ import {
19
+ postgresDown,
20
+ postgresStatus,
21
+ postgresUp
22
+ } from "./chunk-CSRD5OQA.js";
10
23
  import {
11
24
  renderLeanBlock,
12
25
  runLeanHookCommand
13
- } from "./chunk-N34XHWBA.js";
14
- import {
15
- runPreToolHookCommand
16
- } from "./chunk-WHZSVY2L.js";
26
+ } from "./chunk-B6CO63SQ.js";
17
27
  import {
18
28
  failSoft,
19
29
  readHookInput,
20
30
  writeStdout
21
- } from "./chunk-PYLH4MH5.js";
31
+ } from "./chunk-FJOTP632.js";
32
+ import {
33
+ generateSuggestions,
34
+ migrateMemoryToFiles,
35
+ registerCodeBuddyTools,
36
+ startMcpServer,
37
+ watchRepository
38
+ } from "./chunk-IMFUYEZA.js";
22
39
  import {
23
40
  PlanFileStore,
24
41
  PlanLifecycle,
25
42
  ReviewStore,
26
- VERSION,
27
43
  WorklogStore,
28
44
  approveReviewItem,
29
45
  assessRisk,
30
46
  buildBeforeEditContext,
31
47
  buildBootstrapContext,
32
- generateSuggestions,
33
- migrateMemoryToFiles,
34
48
  openHookSemantics,
35
49
  parseTraceLines,
36
50
  readTraces,
37
- registerCodeBuddyTools,
38
51
  renderContextBlock,
39
52
  resolveRiskPaths,
40
53
  runCaptureHook,
@@ -42,15 +55,14 @@ import {
42
55
  runResetHook,
43
56
  runStageHook,
44
57
  runSyncHook,
45
- startMcpServer,
46
- tracePath,
47
- watchRepository
48
- } from "./chunk-VAKBJV26.js";
58
+ tracePath
59
+ } from "./chunk-R7CD6EXS.js";
49
60
  import "./chunk-IHQM2ZDV.js";
50
61
  import {
51
62
  SessionCapsuleLedger,
52
- estimateTokens
53
- } from "./chunk-SYWJG5NA.js";
63
+ estimateTokens,
64
+ hookRoot
65
+ } from "./chunk-J2EAZ4MA.js";
54
66
  import {
55
67
  buildArchitectureMap,
56
68
  generateGraphifyGraph,
@@ -60,13 +72,12 @@ import {
60
72
  neighbours,
61
73
  queryMap,
62
74
  setupGraphify
63
- } from "./chunk-L5AYZC3F.js";
75
+ } from "./chunk-NERKZSSE.js";
64
76
  import {
65
77
  extractSymbolTable,
66
78
  supportsSymbols
67
79
  } from "./chunk-PQK3GKZH.js";
68
80
  import {
69
- MemoryFileStore,
70
81
  bootstrapDatabase,
71
82
  buildProviderFromConfig,
72
83
  createDatabaseClient,
@@ -77,7 +88,11 @@ import {
77
88
  pingDatabase,
78
89
  runDoctor,
79
90
  runMigrations
80
- } from "./chunk-UN57FKQX.js";
91
+ } from "./chunk-2XDPKFUW.js";
92
+ import {
93
+ MemoryFileStore,
94
+ VERSION
95
+ } from "./chunk-S6VEG4S2.js";
81
96
  import {
82
97
  redactPersisted
83
98
  } from "./chunk-GDJH7XJC.js";
@@ -87,8 +102,9 @@ import {
87
102
  } from "./chunk-XBJQKCLU.js";
88
103
  import "./chunk-JFDRBPYF.js";
89
104
  import {
105
+ localRuntimeInstalled,
90
106
  modelCacheDir
91
- } from "./chunk-U4HAJLIB.js";
107
+ } from "./chunk-IBLJOHJL.js";
92
108
  import {
93
109
  DEFAULT_CLOUD_EMBEDDING_MODELS,
94
110
  DEFAULT_RERANK_MODELS,
@@ -99,10 +115,10 @@ import {
99
115
  DEFAULT_ZVEC_MODEL,
100
116
  buildZvecIndex,
101
117
  zvecStatus
102
- } from "./chunk-QDBDYCM2.js";
118
+ } from "./chunk-5FW3PMNP.js";
103
119
  import {
104
120
  resolveLlmConfig
105
- } from "./chunk-6MKEIDX5.js";
121
+ } from "./chunk-RAJJSCIP.js";
106
122
  import {
107
123
  PLAN_POLICIES,
108
124
  configPath,
@@ -111,6 +127,7 @@ import {
111
127
  initProjectScaffold,
112
128
  loadPlanPolicy,
113
129
  loadRuntimeConfig,
130
+ migrateLegacyNamespace,
114
131
  readConfigFile,
115
132
  redactSecrets,
116
133
  resolveNamespaceFrom,
@@ -120,7 +137,7 @@ import {
120
137
  setZvecEnabled,
121
138
  writeAtomic,
122
139
  writeConfigFile
123
- } from "./chunk-776EQXDV.js";
140
+ } from "./chunk-5KZY6OTG.js";
124
141
  import "./chunk-PZ5AY32C.js";
125
142
 
126
143
  // src/cli/main.ts
@@ -339,7 +356,7 @@ function runTestCommand(command, source, repositoryRoot, timeoutMs) {
339
356
  if (!Number.isFinite(timeoutMs) || timeoutMs <= 0) {
340
357
  throw new Error("--timeout must be a positive number of milliseconds.");
341
358
  }
342
- return new Promise((resolve14) => {
359
+ return new Promise((resolve13) => {
343
360
  const startedAt = Date.now();
344
361
  const child = spawn(command, {
345
362
  cwd: repositoryRoot,
@@ -364,7 +381,7 @@ ${output.slice(-MAX_TEST_OUTPUT_CHARS)}`;
364
381
  }, timeoutMs);
365
382
  child.on("close", (exitCode, signal) => {
366
383
  clearTimeout(timer);
367
- resolve14({
384
+ resolve13({
368
385
  status: timedOut ? "timed_out" : exitCode === 0 ? "passed" : "failed",
369
386
  command,
370
387
  source,
@@ -376,7 +393,7 @@ ${output.slice(-MAX_TEST_OUTPUT_CHARS)}`;
376
393
  });
377
394
  child.on("error", (error) => {
378
395
  clearTimeout(timer);
379
- resolve14({
396
+ resolve13({
380
397
  status: "failed",
381
398
  command,
382
399
  source,
@@ -641,7 +658,10 @@ function buildEntry(options) {
641
658
  if (options.groqApiKey) env.GROQ_API_KEY = options.groqApiKey;
642
659
  if (options.databaseUrl) env.DATABASE_URL = options.databaseUrl;
643
660
  return {
644
- command: "node",
661
+ // Absolute: Claude Desktop is a GUI app and does not inherit the shell's
662
+ // PATH (nvm, Homebrew), so a bare "node" may not resolve or may be another
663
+ // version. Re-run `codebuddy claude install` after switching Node.
664
+ command: process.execPath,
645
665
  args: [resolveCliEntrypoint(), "serve"],
646
666
  env
647
667
  };
@@ -1035,6 +1055,8 @@ function hook(command, payload) {
1035
1055
  child = spawn("codebuddy", ["hooks", command], {
1036
1056
  cwd: payload.cwd,
1037
1057
  stdio: ["pipe", "pipe", "ignore"],
1058
+ // npm installs a codebuddy.cmd shim on Windows, which spawn only runs through a shell.
1059
+ shell: process.platform === "win32",
1038
1060
  });
1039
1061
  } catch {
1040
1062
  done("");
@@ -2939,7 +2961,13 @@ data: ${data}
2939
2961
  `);
2940
2962
  };
2941
2963
  watchFile(path, { interval: options.pollMs ?? 1e3 }, () => void onChange());
2964
+ let boundPort = 0;
2942
2965
  const server = createServer(async (request, response) => {
2966
+ const host = request.headers.host ?? "";
2967
+ if (host !== `127.0.0.1:${boundPort}` && host !== `localhost:${boundPort}`) {
2968
+ response.writeHead(403, { "content-type": "text/plain" }).end("Forbidden host");
2969
+ return;
2970
+ }
2943
2971
  const url = new URL(request.url ?? "/", "http://localhost");
2944
2972
  if (request.method !== "GET") {
2945
2973
  response.writeHead(405).end();
@@ -2979,18 +3007,19 @@ data: ${data}
2979
3007
  response.writeHead(404, { "content-type": "text/plain" }).end("Not found");
2980
3008
  });
2981
3009
  const port = await listen(server, options.port ?? 4777);
3010
+ boundPort = port;
2982
3011
  const heartbeat = setInterval(() => {
2983
3012
  for (const client of clients) client.write(": ping\n\n");
2984
3013
  }, 25e3);
2985
3014
  heartbeat.unref();
2986
3015
  return {
2987
3016
  url: `http://127.0.0.1:${port}/`,
2988
- close: () => new Promise((resolve14) => {
3017
+ close: () => new Promise((resolve13) => {
2989
3018
  clearInterval(heartbeat);
2990
3019
  unwatchFile(path);
2991
3020
  for (const client of clients) client.end();
2992
3021
  server.closeAllConnections();
2993
- server.close(() => resolve14());
3022
+ server.close(() => resolve13());
2994
3023
  })
2995
3024
  };
2996
3025
  }
@@ -2998,11 +3027,11 @@ async function listen(server, port) {
2998
3027
  for (let attempt = 0; attempt < 10; attempt += 1) {
2999
3028
  const candidate = port === 0 ? 0 : port + attempt;
3000
3029
  try {
3001
- await new Promise((resolve14, reject) => {
3030
+ await new Promise((resolve13, reject) => {
3002
3031
  server.once("error", reject);
3003
3032
  server.listen(candidate, "127.0.0.1", () => {
3004
3033
  server.off("error", reject);
3005
- resolve14();
3034
+ resolve13();
3006
3035
  });
3007
3036
  });
3008
3037
  return server.address().port;
@@ -3040,8 +3069,8 @@ function registerDashboardCommand(program, runSafely2) {
3040
3069
  );
3041
3070
  console.log(pc4.dim(" Ctrl+C to stop."));
3042
3071
  if (opts.open) openBrowser(dashboard.url);
3043
- await new Promise((resolve14) => {
3044
- const stop = () => void dashboard.close().then(resolve14);
3072
+ await new Promise((resolve13) => {
3073
+ const stop = () => void dashboard.close().then(resolve13);
3045
3074
  process.once("SIGINT", stop);
3046
3075
  process.once("SIGTERM", stop);
3047
3076
  });
@@ -3147,7 +3176,7 @@ function registerGitHubCommands(program, runSafely2) {
3147
3176
  }
3148
3177
 
3149
3178
  // src/cli/commands/hooks.ts
3150
- import { spawn as spawn3 } from "child_process";
3179
+ import { execFile as execFile2, spawn as spawn3 } from "child_process";
3151
3180
  import { relative as relative2 } from "path";
3152
3181
  import pc7 from "picocolors";
3153
3182
  function registerHooksCommands(program, runSafely2) {
@@ -3169,7 +3198,8 @@ function registerHooksCommands(program, runSafely2) {
3169
3198
  `${changed ? pc7.green("installed") : pc7.dim("unchanged")} CodeBuddy hooks in ${where}`
3170
3199
  );
3171
3200
  await reconcileRules(client, "hooks");
3172
- syncInBackground(process.cwd());
3201
+ warnIfHookCommandStale();
3202
+ syncInBackground(process.cwd(), true);
3173
3203
  console.log(
3174
3204
  pc7.dim(
3175
3205
  ` prompt\u2192recall \xB7 edit\u2192stage \xB7 turn end\u2192capture \xB7 compaction\u2192reset. Restart ${CLIENT_ADAPTERS[client].name} to activate.`
@@ -3227,18 +3257,18 @@ function registerHooksCommands(program, runSafely2) {
3227
3257
  `codebuddy: captured from ${changedFiles.length} changed file(s) \u2014 ${result.saved.length} saved, ${result.queuedForReview.length} queued
3228
3258
  `
3229
3259
  );
3230
- if (result.saved.length > 0) syncInBackground(input.cwd ?? process.cwd());
3260
+ if (result.saved.length > 0) syncInBackground(hookRoot(input.cwd));
3231
3261
  }
3232
3262
  });
3233
3263
  });
3234
3264
  hooks.command("sync").description(
3235
3265
  "[hook] Reindex Markdown memory into PostgreSQL and embed it locally (runs detached after capture)."
3236
- ).action(async () => {
3266
+ ).option("--respace", "Also re-embed vectors made by another embedding model.").action(async (opts) => {
3237
3267
  await failSoft(async () => {
3238
- const result = await runSyncHook(process.cwd());
3268
+ const result = await runSyncHook(process.cwd(), opts.respace ? { respace: true } : {});
3239
3269
  process.stderr.write(
3240
3270
  result ? `codebuddy: synced ${result.reindex.facts.imported} new / ${result.reindex.facts.updated} updated fact(s)${result.reindex.reembedding ? `, ${result.reindex.reembedding} re-embedding` : ""}${result.drained ? "" : " (embeddings still pending)"}
3241
- ` : "codebuddy: no PostgreSQL configured; nothing to sync\n"
3271
+ ` : "codebuddy: nothing to sync (no PostgreSQL configured, or another sync is running)\n"
3242
3272
  );
3243
3273
  });
3244
3274
  });
@@ -3272,15 +3302,42 @@ async function reconcileRules(client, mode) {
3272
3302
  );
3273
3303
  }
3274
3304
  }
3275
- function syncInBackground(cwd) {
3305
+ function warnIfHookCommandStale() {
3306
+ execFile2(
3307
+ "codebuddy",
3308
+ ["--version"],
3309
+ { timeout: 1e4, shell: process.platform === "win32" },
3310
+ (error, stdout) => {
3311
+ const found = stdout.trim();
3312
+ if (error || !found) {
3313
+ console.log(
3314
+ pc7.yellow(
3315
+ " ! `codebuddy` is not on PATH, so the hooks cannot run. Install it globally: npm i -g @orquentra/codebuddy"
3316
+ )
3317
+ );
3318
+ } else if (found !== VERSION) {
3319
+ console.log(
3320
+ pc7.yellow(
3321
+ ` ! The hooks will run codebuddy ${found} from PATH, not ${VERSION}. Update it: npm i -g @orquentra/codebuddy@${VERSION}`
3322
+ )
3323
+ );
3324
+ }
3325
+ }
3326
+ );
3327
+ }
3328
+ function syncInBackground(cwd, respace = false) {
3276
3329
  const entry = process.argv[1];
3277
3330
  if (!entry) return;
3278
3331
  try {
3279
- spawn3(process.execPath, [...process.execArgv, entry, "hooks", "sync"], {
3280
- cwd,
3281
- detached: true,
3282
- stdio: "ignore"
3283
- }).unref();
3332
+ spawn3(
3333
+ process.execPath,
3334
+ [...process.execArgv, entry, "hooks", "sync", ...respace ? ["--respace"] : []],
3335
+ {
3336
+ cwd,
3337
+ detached: true,
3338
+ stdio: "ignore"
3339
+ }
3340
+ ).unref();
3284
3341
  } catch {
3285
3342
  }
3286
3343
  }
@@ -3447,81 +3504,6 @@ function printResult(result, compact = false) {
3447
3504
  // src/cli/commands/init-wizard.ts
3448
3505
  import { writeFile as writeFile2 } from "fs/promises";
3449
3506
  import { confirm, isCancel, log, note, password, spinner, text } from "@clack/prompts";
3450
-
3451
- // src/cli/commands/postgres-docker.ts
3452
- import { spawn as spawn4 } from "child_process";
3453
- import { existsSync as existsSync3 } from "fs";
3454
- import { dirname as dirname11, resolve as resolve12 } from "path";
3455
- import { fileURLToPath as fileURLToPath2 } from "url";
3456
- function resolveBundledComposeFile() {
3457
- const here = dirname11(fileURLToPath2(import.meta.url));
3458
- const candidates = [
3459
- // installed package: dist/cli/commands/ -> root
3460
- resolve12(here, "..", "..", "..", "docker-compose.yml"),
3461
- // source layout: src/cli/commands/ -> root
3462
- resolve12(here, "..", "..", "..", "..", "docker-compose.yml"),
3463
- resolve12(here, "..", "..", "docker-compose.yml"),
3464
- resolve12(process.cwd(), "docker-compose.yml")
3465
- ];
3466
- for (const candidate of candidates) {
3467
- if (existsSync3(candidate)) return candidate;
3468
- }
3469
- throw new Error(`Could not locate docker-compose.yml. Looked in:
3470
- ${candidates.join("\n ")}`);
3471
- }
3472
- async function runDockerCompose(args, options = {}) {
3473
- const spawnImpl = options.spawnImpl ?? spawn4;
3474
- const composeFile = resolveBundledComposeFile();
3475
- const attempts = [
3476
- { kind: "v2", bin: "docker", args: ["compose", "-f", composeFile, ...args] },
3477
- { kind: "v1", bin: "docker-compose", args: ["-f", composeFile, ...args] }
3478
- ];
3479
- let lastSpawnError = null;
3480
- for (const attempt of attempts) {
3481
- try {
3482
- return await spawnOnce(spawnImpl, attempt);
3483
- } catch (error) {
3484
- const err = error;
3485
- if (err.code !== "ENOENT") throw err;
3486
- lastSpawnError = err;
3487
- }
3488
- }
3489
- throw new Error(
3490
- `Could not find docker. Install Docker Desktop (or docker-compose v1) and ensure it is on your PATH. (${lastSpawnError?.message ?? "spawn ENOENT"})`
3491
- );
3492
- }
3493
- function spawnOnce(spawnImpl, attempt) {
3494
- return new Promise((resolvePromise, rejectPromise) => {
3495
- const child = spawnImpl(attempt.bin, attempt.args, {
3496
- stdio: ["ignore", "pipe", "pipe"]
3497
- });
3498
- let stdout = "";
3499
- let stderr = "";
3500
- child.stdout?.on("data", (chunk) => {
3501
- stdout += String(chunk);
3502
- });
3503
- child.stderr?.on("data", (chunk) => {
3504
- stderr += String(chunk);
3505
- });
3506
- child.on("error", (error) => {
3507
- rejectPromise(error);
3508
- });
3509
- child.on("close", (code) => {
3510
- resolvePromise({ code: code ?? 0, stdout, stderr });
3511
- });
3512
- });
3513
- }
3514
- async function postgresUp(options) {
3515
- return runDockerCompose(["up", "-d"], options ?? {});
3516
- }
3517
- async function postgresDown(options) {
3518
- return runDockerCompose(["down"], options ?? {});
3519
- }
3520
- async function postgresStatus(options) {
3521
- return runDockerCompose(["ps"], options ?? {});
3522
- }
3523
-
3524
- // src/cli/commands/init-wizard.ts
3525
3507
  function bail() {
3526
3508
  log.warn("Aborted. No config was written.");
3527
3509
  process.exit(1);
@@ -3587,7 +3569,7 @@ async function runInitWizard() {
3587
3569
  if (result.code === 0) {
3588
3570
  dockerSpinner.stop("Postgres container started.");
3589
3571
  for (let attempt = 0; attempt < 10 && !connected; attempt++) {
3590
- await new Promise((resolve14) => setTimeout(resolve14, 500));
3572
+ await new Promise((resolve13) => setTimeout(resolve13, 500));
3591
3573
  connected = await pingOnce(databaseUrl);
3592
3574
  }
3593
3575
  if (!connected) {
@@ -3776,7 +3758,7 @@ function registerMapCommands(program, runSafely2) {
3776
3758
  }
3777
3759
 
3778
3760
  // src/cli/commands/memory-review.ts
3779
- import { spawn as spawn5 } from "child_process";
3761
+ import { spawn as spawn4 } from "child_process";
3780
3762
  import { relative as relative3 } from "path";
3781
3763
  import pc12 from "picocolors";
3782
3764
  function registerMemoryCommands(program, runSafely2) {
@@ -3872,14 +3854,14 @@ function truncate(value, max) {
3872
3854
  function openEditor(path) {
3873
3855
  const editor = process.env.EDITOR ?? process.env.VISUAL ?? "vi";
3874
3856
  return new Promise((resolvePromise, reject) => {
3875
- const child = spawn5(editor, [path], { stdio: "inherit" });
3857
+ const child = spawn4(editor, [path], { stdio: "inherit" });
3876
3858
  child.on("error", reject);
3877
3859
  child.on("close", () => resolvePromise());
3878
3860
  });
3879
3861
  }
3880
3862
 
3881
3863
  // src/cli/commands/models.ts
3882
- import { existsSync as existsSync4 } from "fs";
3864
+ import { existsSync as existsSync3 } from "fs";
3883
3865
  import { join as join15 } from "path";
3884
3866
  import { spinner as spinner2 } from "@clack/prompts";
3885
3867
  import pc13 from "picocolors";
@@ -4154,7 +4136,7 @@ async function withSpinner(label, work, done) {
4154
4136
  progress.stop(done(value));
4155
4137
  return value;
4156
4138
  } catch (error) {
4157
- progress.stop(pc13.red(`\u2717 ${label}`), 1);
4139
+ progress.error(pc13.red(`\u2717 ${label}`));
4158
4140
  throw error;
4159
4141
  }
4160
4142
  }
@@ -4163,7 +4145,7 @@ function keyPresent(provider, apiKey) {
4163
4145
  }
4164
4146
  function localModelDownloaded(id, revision) {
4165
4147
  const dir = join15(modelCacheDir(), id, ...revision ? [revision] : []);
4166
- return existsSync4(join15(dir, "onnx", "model_quantized.onnx"));
4148
+ return existsSync3(join15(dir, "onnx", "model_quantized.onnx"));
4167
4149
  }
4168
4150
  async function vectorCounts(postgresUrl, namespace, space) {
4169
4151
  const client = createDatabaseClient({ postgresUrl, maxConnections: 1, connectTimeoutSeconds: 3 });
@@ -4195,7 +4177,12 @@ async function printStatus() {
4195
4177
  const next = [];
4196
4178
  console.log(pc13.bold("Embeddings"));
4197
4179
  console.log(row("provider", `${provider.type} ${pc13.dim(model)}`));
4198
- if (provider.type === "local") {
4180
+ if (provider.type === "local" && !localRuntimeInstalled()) {
4181
+ console.log(
4182
+ row("runtime", warn("@huggingface/transformers is not installed: dense recall is off"))
4183
+ );
4184
+ next.push("npm i -g @huggingface/transformers");
4185
+ } else if (provider.type === "local") {
4199
4186
  const ready = localModelDownloaded(LOCAL_EMBEDDING_MODEL.id, LOCAL_EMBEDDING_MODEL.revision);
4200
4187
  console.log(
4201
4188
  row(
@@ -4331,7 +4318,7 @@ Examples:
4331
4318
  );
4332
4319
  }
4333
4320
  if (!missingKey) {
4334
- syncInBackground(process.cwd());
4321
+ syncInBackground(process.cwd(), true);
4335
4322
  console.log(
4336
4323
  pc13.dim(" Re-embedding existing memory in the background (codebuddy hooks sync).")
4337
4324
  );
@@ -4371,7 +4358,7 @@ before keeping one on. A reranker never admits a fact, it only orders them.`
4371
4358
  });
4372
4359
  models.command("pull").description("Download the local models now instead of on first use.").action(async () => {
4373
4360
  await runSafely2(async () => {
4374
- const { LocalModelProvider, rerankLocally } = await import("./local-OTOY56B4.js");
4361
+ const { LocalModelProvider, rerankLocally } = await import("./local-5MZURLCZ.js");
4375
4362
  const file = await readConfigFile();
4376
4363
  let started = Date.now();
4377
4364
  await withSpinner(
@@ -4428,7 +4415,7 @@ before keeping one on. A reranker never admits a fact, it only orders them.`
4428
4415
  }
4429
4416
 
4430
4417
  // src/cli/commands/plan.ts
4431
- import { spawn as spawn6 } from "child_process";
4418
+ import { spawn as spawn5 } from "child_process";
4432
4419
  import { relative as relative4 } from "path";
4433
4420
  import pc14 from "picocolors";
4434
4421
  function makeLifecycle(cwd = process.cwd()) {
@@ -4490,15 +4477,15 @@ function renderPlan(plan) {
4490
4477
  }
4491
4478
  function openEditor2(path) {
4492
4479
  const editor = process.env.EDITOR ?? process.env.VISUAL ?? "vi";
4493
- return new Promise((resolve14, reject) => {
4494
- const child = spawn6(editor, [path], { stdio: "inherit" });
4480
+ return new Promise((resolve13, reject) => {
4481
+ const child = spawn5(editor, [path], { stdio: "inherit" });
4495
4482
  child.on("error", reject);
4496
- child.on("close", () => resolve14());
4483
+ child.on("close", () => resolve13());
4497
4484
  });
4498
4485
  }
4499
4486
  function runGit(args) {
4500
- return new Promise((resolve14, reject) => {
4501
- const child = spawn6("git", args, { stdio: ["ignore", "pipe", "pipe"] });
4487
+ return new Promise((resolve13, reject) => {
4488
+ const child = spawn5("git", args, { stdio: ["ignore", "pipe", "pipe"] });
4502
4489
  let stdout = "";
4503
4490
  let stderr = "";
4504
4491
  child.stdout.on("data", (c) => {
@@ -4508,7 +4495,7 @@ function runGit(args) {
4508
4495
  stderr += String(c);
4509
4496
  });
4510
4497
  child.on("error", reject);
4511
- child.on("close", (code) => resolve14({ code: code ?? 0, stdout, stderr }));
4498
+ child.on("close", (code) => resolve13({ code: code ?? 0, stdout, stderr }));
4512
4499
  });
4513
4500
  }
4514
4501
  function registerPlanCommands(program, runSafely2) {
@@ -4823,7 +4810,7 @@ function severityBadge2(severity) {
4823
4810
 
4824
4811
  // src/cli/commands/symbols.ts
4825
4812
  import { readFile as readFile13 } from "fs/promises";
4826
- import { resolve as resolve13 } from "path";
4813
+ import { resolve as resolve12 } from "path";
4827
4814
  import pc18 from "picocolors";
4828
4815
  function registerSymbolsCommand(program, runSafely2) {
4829
4816
  program.command("symbols").argument("<path>", "Repo-relative or absolute path to a code file.").option("--json", "Print machine-readable JSON.").description("List a file's top-level symbols (functions, classes, types, exports).").action(async (path, opts) => {
@@ -4832,7 +4819,7 @@ function registerSymbolsCommand(program, runSafely2) {
4832
4819
  console.log(pc18.dim(`no symbol extraction for ${path} (unsupported language)`));
4833
4820
  return;
4834
4821
  }
4835
- const content = await readFile13(resolve13(path), "utf8");
4822
+ const content = await readFile13(resolve12(path), "utf8");
4836
4823
  const table = extractSymbolTable(content);
4837
4824
  if (opts.json) {
4838
4825
  console.log(JSON.stringify({ path, symbols: table }, null, 2));
@@ -4862,7 +4849,7 @@ import pc19 from "picocolors";
4862
4849
  // src/core/global-config.ts
4863
4850
  import { chmod, mkdir as mkdir8, readFile as readFile14, writeFile as writeFile3 } from "fs/promises";
4864
4851
  import { homedir as homedir3 } from "os";
4865
- import { dirname as dirname12, join as join16 } from "path";
4852
+ import { dirname as dirname11, join as join16 } from "path";
4866
4853
  import { z as z2 } from "zod";
4867
4854
  var GLOBAL_DIR = ".codebuddy";
4868
4855
  var GLOBAL_FILE = "global.json";
@@ -4889,7 +4876,7 @@ async function readGlobalConfig(home = homedir3()) {
4889
4876
  }
4890
4877
  async function writeGlobalConfig(next, home = homedir3()) {
4891
4878
  const path = globalConfigPath(home);
4892
- await mkdir8(dirname12(path), { recursive: true, mode: 448 });
4879
+ await mkdir8(dirname11(path), { recursive: true, mode: 448 });
4893
4880
  await writeFile3(path, `${JSON.stringify(next, null, 2)}
4894
4881
  `, { mode: 384 });
4895
4882
  await chmod(path, 384);
@@ -4902,32 +4889,6 @@ async function mergeGlobalConfig(patch, home = homedir3()) {
4902
4889
  return { path, merged };
4903
4890
  }
4904
4891
 
4905
- // src/cli/commands/docker-autostart.ts
4906
- import { spawn as spawn7 } from "child_process";
4907
- async function isDockerDaemonRunning() {
4908
- return new Promise((resolve14) => {
4909
- const child = spawn7("docker", ["info"], { stdio: "ignore" });
4910
- child.on("error", () => resolve14(false));
4911
- child.on("close", (code) => resolve14(code === 0));
4912
- });
4913
- }
4914
- async function tryStartDockerDesktop() {
4915
- if (process.platform !== "darwin") return { started: false };
4916
- return new Promise((resolve14) => {
4917
- const child = spawn7("open", ["-ga", "Docker"], { stdio: "ignore" });
4918
- child.on("error", () => resolve14({ started: false }));
4919
- child.on("close", (code) => resolve14({ started: code === 0 }));
4920
- });
4921
- }
4922
- async function waitForDockerDaemon(timeoutMs = 6e4) {
4923
- const deadline = Date.now() + timeoutMs;
4924
- while (Date.now() < deadline) {
4925
- if (await isDockerDaemonRunning()) return true;
4926
- await new Promise((resolve14) => setTimeout(resolve14, 1e3));
4927
- }
4928
- return false;
4929
- }
4930
-
4931
4892
  // src/cli/commands/use-command.ts
4932
4893
  function bail2() {
4933
4894
  log2.warn("Aborted.");
@@ -4958,6 +4919,7 @@ async function runUseCommand(options = {}) {
4958
4919
  const folderName = basename2(process.cwd());
4959
4920
  const namespace = sanitizeNamespace(options.namespace ?? folderName);
4960
4921
  await initProjectScaffold();
4922
+ if (options.namespace === void 0) await migrateLegacyNamespace();
4961
4923
  const graphifyEnabled = options.graphify ?? unwrap2(
4962
4924
  await confirm2({
4963
4925
  message: "Set up Graphify for richer architecture context?",
@@ -5061,7 +5023,7 @@ Namespace: ${pc19.bold(namespace)}`,
5061
5023
  if (result.code === 0) {
5062
5024
  composeSpinner.stop("Postgres container started.");
5063
5025
  for (let attempt = 0; attempt < 12 && !connected; attempt++) {
5064
- await new Promise((resolve14) => setTimeout(resolve14, 500));
5026
+ await new Promise((resolve13) => setTimeout(resolve13, 500));
5065
5027
  connected = await pingOnce2(databaseUrl);
5066
5028
  }
5067
5029
  if (!connected) {
@@ -5472,7 +5434,7 @@ function createCli() {
5472
5434
  console.log(`Claude Desktop config: ${result.path}`);
5473
5435
  for (const entry of result.entries) {
5474
5436
  console.log(
5475
- ` ${entry.key} namespace=${entry.namespace ?? "?"} db=${entry.databaseUrl ?? "?"}`
5437
+ ` ${entry.key} namespace=${entry.namespace ?? "?"} db=${entry.databaseUrl ? String(redactSecrets(entry.databaseUrl)) : "?"}`
5476
5438
  );
5477
5439
  }
5478
5440
  });
@@ -5517,7 +5479,7 @@ function createCli() {
5517
5479
  console.log(`Codex config: ${result.path}`);
5518
5480
  for (const entry of result.entries) {
5519
5481
  console.log(
5520
- ` ${entry.key} namespace=${entry.namespace ?? "?"} db=${entry.databaseUrl ?? "?"}`
5482
+ ` ${entry.key} namespace=${entry.namespace ?? "?"} db=${entry.databaseUrl ? String(redactSecrets(entry.databaseUrl)) : "?"}`
5521
5483
  );
5522
5484
  }
5523
5485
  });
@@ -5703,6 +5665,9 @@ function printDoctor(report) {
5703
5665
  console.log(
5704
5666
  ` runtime=${report.namespace.runtime ?? "unset"} default=${report.namespace.expectedDefault}`
5705
5667
  );
5668
+ if (report.namespace.migrated) {
5669
+ console.log(` migrated legacy namespace "default" to "${report.namespace.migrated}"`);
5670
+ }
5706
5671
  if (report.namespace.warning) console.log(` ${report.namespace.warning}`);
5707
5672
  console.log(
5708
5673
  `vectors: ${report.vectors.count} index=${report.vectors.index ?? "missing"} tuning=${report.vectors.needsTuning ? "recommended" : "not-needed"}`
@@ -5732,9 +5697,12 @@ function printDbDoctor(report) {
5732
5697
  if (report.pgvector.error) console.log(` ${report.pgvector.error}`);
5733
5698
  console.log(`namespace: ${report.namespace.ok ? ok2 : warn2}`);
5734
5699
  console.log(` runtime=${report.namespace.runtime ?? "unset"}`);
5700
+ if (report.namespace.migrated) {
5701
+ console.log(` migrated legacy namespace "default" to "${report.namespace.migrated}"`);
5702
+ }
5735
5703
  if (report.namespace.warning) console.log(` ${report.namespace.warning}`);
5736
5704
  }
5737
5705
  export {
5738
5706
  createCli
5739
5707
  };
5740
- //# sourceMappingURL=main-HFHLGID4.js.map
5708
+ //# sourceMappingURL=main-MTBQZGJV.js.map