codemem 0.20.0-alpha.2 → 0.20.0-alpha.4

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 (34) hide show
  1. package/.opencode/{plugin → plugins}/codemem.js +98 -113
  2. package/dist/commands/claude-hook-ingest.d.ts.map +1 -1
  3. package/dist/commands/db.d.ts.map +1 -1
  4. package/dist/commands/enqueue-raw-event.d.ts.map +1 -1
  5. package/dist/commands/export-memories.d.ts.map +1 -1
  6. package/dist/commands/import-memories.d.ts.map +1 -1
  7. package/dist/commands/mcp.d.ts.map +1 -1
  8. package/dist/commands/memory.d.ts +3 -0
  9. package/dist/commands/memory.d.ts.map +1 -1
  10. package/dist/commands/memory.test.d.ts +2 -0
  11. package/dist/commands/memory.test.d.ts.map +1 -0
  12. package/dist/commands/pack.d.ts.map +1 -1
  13. package/dist/commands/recent.d.ts.map +1 -1
  14. package/dist/commands/search.d.ts.map +1 -1
  15. package/dist/commands/serve-invocation.d.ts +37 -0
  16. package/dist/commands/serve-invocation.d.ts.map +1 -0
  17. package/dist/commands/serve.d.ts +2 -0
  18. package/dist/commands/serve.d.ts.map +1 -1
  19. package/dist/commands/serve.test.d.ts +2 -0
  20. package/dist/commands/serve.test.d.ts.map +1 -0
  21. package/dist/commands/setup-config.d.ts +4 -0
  22. package/dist/commands/setup-config.d.ts.map +1 -0
  23. package/dist/commands/setup-config.test.d.ts +2 -0
  24. package/dist/commands/setup-config.test.d.ts.map +1 -0
  25. package/dist/commands/setup.d.ts.map +1 -1
  26. package/dist/commands/stats.d.ts.map +1 -1
  27. package/dist/commands/sync-helpers.d.ts +31 -0
  28. package/dist/commands/sync-helpers.d.ts.map +1 -0
  29. package/dist/commands/sync.d.ts.map +1 -1
  30. package/dist/commands/sync.test.d.ts +2 -0
  31. package/dist/commands/sync.test.d.ts.map +1 -0
  32. package/dist/index.js +801 -98
  33. package/dist/index.js.map +1 -1
  34. package/package.json +7 -7
@@ -1,6 +1,8 @@
1
1
  import { appendFile, mkdir } from "node:fs/promises";
2
+ import { existsSync, readFileSync } from "node:fs";
2
3
  import { dirname } from "node:path";
3
4
  import { createHash } from "node:crypto";
5
+ import { spawn as nodeSpawn, execSync } from "node:child_process";
4
6
  import { tool } from "@opencode-ai/plugin";
5
7
 
6
8
  import {
@@ -13,8 +15,7 @@ import {
13
15
 
14
16
  const TRUTHY_VALUES = ["1", "true", "yes"];
15
17
  const DISABLED_VALUES = ["0", "false", "off"];
16
- const PINNED_BACKEND_VERSION = "0.20.0-alpha.2";
17
- const DEFAULT_UVX_SOURCE = `codemem==${PINNED_BACKEND_VERSION}`;
18
+ const PINNED_BACKEND_VERSION = "0.20.0-alpha.4";
18
19
 
19
20
  const normalizeEnvValue = (value) => (value || "").toLowerCase();
20
21
  const envHasValue = (value, truthyValues) =>
@@ -22,6 +23,8 @@ const envHasValue = (value, truthyValues) =>
22
23
  const envNotDisabled = (value) =>
23
24
  !DISABLED_VALUES.includes(normalizeEnvValue(value));
24
25
 
26
+ const DEFAULT_LOG_PATH = (homeDir, cwd) => `${homeDir || cwd}/.codemem/plugin.log`;
27
+
25
28
  const resolveLogPath = (logPathEnvRaw, cwd, homeDir) => {
26
29
  const logPathEnv = normalizeEnvValue(logPathEnvRaw);
27
30
  const logEnabled = !!logPathEnvRaw && !DISABLED_VALUES.includes(logPathEnv);
@@ -29,11 +32,14 @@ const resolveLogPath = (logPathEnvRaw, cwd, homeDir) => {
29
32
  return null;
30
33
  }
31
34
  if (["true", "yes", "1"].includes(logPathEnv)) {
32
- return `${homeDir || cwd}/.codemem/plugin.log`;
35
+ return DEFAULT_LOG_PATH(homeDir, cwd);
33
36
  }
34
37
  return logPathEnvRaw;
35
38
  };
36
39
 
40
+ /** Path for error/warning logging — always available regardless of debug flag. */
41
+ const resolveErrorLogPath = (cwd, homeDir) => DEFAULT_LOG_PATH(homeDir, cwd);
42
+
37
43
  const createLogLine = (logPath) => async (line) => {
38
44
  if (!logPath) {
39
45
  return;
@@ -46,9 +52,15 @@ const createLogLine = (logPath) => async (line) => {
46
52
  }
47
53
  };
48
54
 
49
- const createDebugLogger = ({ debug, client, logTimeoutMs, getLogLine }) =>
55
+ const createDebugLogger = ({ debug, client, logTimeoutMs, getLogLine, getErrorLogLine }) =>
50
56
  async (level, message, extra = {}) => {
51
- if (!debug) {
57
+ // Always log errors and warnings to the error log path
58
+ const alwaysLog = level === "error" || level === "warn";
59
+ if (alwaysLog) {
60
+ const extraStr = Object.keys(extra).length > 0 ? ` ${JSON.stringify(extra)}` : "";
61
+ await getErrorLogLine()(`[${level}] ${message}${extraStr}`);
62
+ }
63
+ if (!debug && !alwaysLog) {
52
64
  return;
53
65
  }
54
66
  try {
@@ -387,22 +399,16 @@ const detectRunner = ({ cwd, envRunner }) => {
387
399
  if (envRunner) {
388
400
  return envRunner;
389
401
  }
390
- // Check if we're in the codemem repo (dev mode)
402
+ // Prefer the TS codemem if installed globally, fall back to npx
391
403
  try {
392
- const pyproject = Bun.file(`${cwd}/pyproject.toml`);
393
- if (pyproject.size > 0) {
394
- const content = require("fs").readFileSync(
395
- `${cwd}/pyproject.toml`,
396
- "utf-8"
397
- );
398
- if (content.includes('name = "codemem"')) {
399
- return "uv";
400
- }
404
+ const versionOutput = execSync("codemem --version", { encoding: "utf-8", timeout: 3000 }).trim();
405
+ if (versionOutput === PINNED_BACKEND_VERSION || versionOutput.startsWith("0.2")) {
406
+ return "codemem";
401
407
  }
402
- } catch (err) {
403
- // Not in dev mode
408
+ } catch {
409
+ // not on PATH or timed out
404
410
  }
405
- return "uvx";
411
+ return "npx";
406
412
  };
407
413
 
408
414
  /**
@@ -418,28 +424,21 @@ const tsCliAvailable = (cliPath) => {
418
424
  };
419
425
 
420
426
  const buildRunnerArgs = ({ runner, runnerFrom, runnerFromExplicit }) => {
421
- if (runner === "uvx") {
422
- if (runnerFromExplicit) {
423
- return ["--from", runnerFrom, "codemem"];
424
- }
425
- return [runnerFrom || "codemem"];
427
+ if (runner === "codemem") {
428
+ return [];
426
429
  }
427
- if (runner === "uv") {
428
- return ["run", "--directory", runnerFrom, "codemem"];
430
+ if (runner === "npx") {
431
+ const pkg = runnerFromExplicit ? runnerFrom : `codemem@${PINNED_BACKEND_VERSION}`;
432
+ return ["-y", pkg];
429
433
  }
430
434
  if (runner === "node") {
431
- // TS CLI — runnerFrom points to the built CLI entry or repo root.
432
- // Default: packages/cli/dist/index.js relative to repo root.
433
435
  const cliPath = runnerFromExplicit
434
436
  ? runnerFrom
435
- : require("path").join(runnerFrom, "packages/cli/dist/index.js");
437
+ : join(runnerFrom, "packages/cli/dist/index.js");
436
438
  return [cliPath];
437
439
  }
438
- if (runner === "npx") {
439
- const pkg = runnerFromExplicit ? runnerFrom : "@codemem/cli";
440
- return ["-y", pkg];
441
- }
442
- return [];
440
+ // Custom runner via CODEMEM_RUNNER env — pass through as-is
441
+ return runnerFromExplicit ? [runnerFrom] : [];
443
442
  };
444
443
 
445
444
  export const OpencodeMemPlugin = async ({
@@ -466,12 +465,15 @@ export const OpencodeMemPlugin = async ({
466
465
  );
467
466
  const logPathEnvRaw = process.env.CODEMEM_PLUGIN_LOG || "";
468
467
  const logPath = resolveLogPath(logPathEnvRaw, cwd, process.env.HOME);
468
+ const errorLogPath = resolveErrorLogPath(cwd, process.env.HOME);
469
469
  const logLine = createLogLine(logPath);
470
+ const errorLogLine = createLogLine(errorLogPath);
470
471
  const log = createDebugLogger({
471
472
  debug,
472
473
  client,
473
474
  logTimeoutMs,
474
475
  getLogLine: () => logLine,
476
+ getErrorLogLine: () => errorLogLine,
475
477
  });
476
478
  const pluginIgnored = envHasValue(
477
479
  process.env.CODEMEM_PLUGIN_IGNORE,
@@ -481,17 +483,12 @@ export const OpencodeMemPlugin = async ({
481
483
  return {};
482
484
  }
483
485
 
484
- // Determine runner mode:
485
- // - If CODEMEM_RUNNER is set, use that ("uvx", "uv", "node", "npx")
486
- // - If we're in a directory with pyproject.toml containing codemem, use "uv" (dev mode)
487
- // - Otherwise, use "uvx" with a package source pinned to plugin version
488
486
  const runner = detectRunner({
489
487
  cwd,
490
488
  envRunner: process.env.CODEMEM_RUNNER,
491
489
  });
492
490
  const runnerFromExplicit = Boolean(String(process.env.CODEMEM_RUNNER_FROM || "").trim());
493
- const defaultRunnerFrom = runner === "uvx" ? DEFAULT_UVX_SOURCE : cwd;
494
- const runnerFrom = process.env.CODEMEM_RUNNER_FROM || defaultRunnerFrom;
491
+ const runnerFrom = process.env.CODEMEM_RUNNER_FROM || cwd;
495
492
  const runnerArgs = buildRunnerArgs({ runner, runnerFrom, runnerFromExplicit });
496
493
  const viewerEnabled = envNotDisabled(process.env.CODEMEM_VIEWER || "1");
497
494
  const viewerAutoStart = envNotDisabled(
@@ -999,76 +996,73 @@ export const OpencodeMemPlugin = async ({
999
996
 
1000
997
  const startViewer = () => {
1001
998
  if (!viewerEnabled || !viewerAutoStart || viewerStarted) {
999
+ if (viewerStarted) logLine("viewer already started, skipping auto-start").catch(() => {});
1002
1000
  return;
1003
1001
  }
1004
1002
  viewerStarted = true;
1005
- log("info", "starting codemem viewer", { cwd });
1006
- Bun.spawn({
1007
- cmd: [runner, ...runnerArgs, "serve", "--background"],
1008
- cwd,
1009
- env: process.env,
1010
- stdout: "pipe",
1011
- stderr: "pipe",
1012
- });
1003
+ const cmd = [runner, ...runnerArgs, "serve", "start"];
1004
+ logLine(`auto-starting viewer: ${cmd.join(" ")}`).catch(() => {});
1005
+ try {
1006
+ const child = nodeSpawn(cmd[0], cmd.slice(1), {
1007
+ cwd,
1008
+ env: process.env,
1009
+ detached: true,
1010
+ stdio: "ignore",
1011
+ });
1012
+ child.on("error", (err) => {
1013
+ logLine(`viewer spawn error: ${err.message}`).catch(() => {});
1014
+ });
1015
+ child.unref();
1016
+ } catch (err) {
1017
+ logLine(`viewer spawn failed: ${err}`).catch(() => {});
1018
+ }
1013
1019
  };
1014
1020
 
1015
1021
  const runCommand = async (cmd, options = {}) => {
1016
1022
  const { stdinText = null } = options;
1017
- const proc = Bun.spawn({
1018
- cmd,
1019
- cwd,
1020
- env: process.env,
1021
- stdin: "pipe",
1022
- stdout: "pipe",
1023
- stderr: "pipe",
1024
- });
1025
- let stdinFailure = null;
1026
- if (typeof stdinText === "string") {
1023
+ const [command, ...args] = cmd;
1024
+ return new Promise((resolve) => {
1025
+ const proc = nodeSpawn(command, args, {
1026
+ cwd,
1027
+ env: process.env,
1028
+ stdio: ["pipe", "pipe", "pipe"],
1029
+ });
1030
+ let stdout = "";
1031
+ let stderr = "";
1032
+ proc.stdout.on("data", (chunk) => { stdout += chunk; });
1033
+ proc.stderr.on("data", (chunk) => { stderr += chunk; });
1034
+ if (typeof stdinText === "string") {
1035
+ try {
1036
+ proc.stdin.write(stdinText);
1037
+ } catch (stdinErr) {
1038
+ try { proc.kill(); } catch { /* ignore */ }
1039
+ resolve({ exitCode: 1, stdout: "", stderr: `stdin write failed: ${String(stdinErr)}` });
1040
+ return;
1041
+ }
1042
+ }
1027
1043
  try {
1028
- proc.stdin.write(stdinText);
1044
+ proc.stdin.end();
1029
1045
  } catch (stdinErr) {
1030
- stdinFailure = `stdin write failed: ${String(stdinErr)}`;
1031
- }
1032
- }
1033
- try {
1034
- proc.stdin.end();
1035
- } catch (stdinErr) {
1036
- if (!stdinFailure) {
1037
- stdinFailure = `stdin close failed: ${String(stdinErr)}`;
1046
+ try { proc.kill(); } catch { /* ignore */ }
1047
+ resolve({ exitCode: 1, stdout: "", stderr: `stdin close failed: ${String(stdinErr)}` });
1048
+ return;
1038
1049
  }
1039
- }
1040
- if (stdinFailure) {
1041
- try {
1042
- proc.kill();
1043
- } catch (killErr) {
1044
- // ignore
1050
+ let timer = null;
1051
+ if (Number.isFinite(commandTimeout) && commandTimeout > 0) {
1052
+ timer = setTimeout(() => {
1053
+ try { proc.kill(); } catch { /* ignore */ }
1054
+ resolve({ exitCode: null, stdout, stderr: "timeout" });
1055
+ }, commandTimeout);
1045
1056
  }
1046
- return { exitCode: 1, stdout: "", stderr: stdinFailure };
1047
- }
1048
- const resultPromise = Promise.all([
1049
- proc.exited,
1050
- new Response(proc.stdout).text(),
1051
- new Response(proc.stderr).text(),
1052
- ]).then(([exitCode, stdout, stderr]) => ({ exitCode, stdout, stderr }));
1053
- if (!Number.isFinite(commandTimeout) || commandTimeout <= 0) {
1054
- return resultPromise;
1055
- }
1056
- let timer = null;
1057
- const timeoutPromise = new Promise((resolve) => {
1058
- timer = setTimeout(() => {
1059
- try {
1060
- proc.kill();
1061
- } catch (err) {
1062
- // ignore
1063
- }
1064
- resolve({ exitCode: null, stdout: "", stderr: "timeout" });
1065
- }, commandTimeout);
1057
+ proc.once("exit", (exitCode) => {
1058
+ if (timer) clearTimeout(timer);
1059
+ resolve({ exitCode, stdout, stderr });
1060
+ });
1061
+ proc.once("error", (err) => {
1062
+ if (timer) clearTimeout(timer);
1063
+ resolve({ exitCode: 1, stdout: "", stderr: String(err) });
1064
+ });
1066
1065
  });
1067
- const result = await Promise.race([resultPromise, timeoutPromise]);
1068
- if (timer) {
1069
- clearTimeout(timer);
1070
- }
1071
- return result;
1072
1066
  };
1073
1067
 
1074
1068
  const runCli = async (args, options = {}) =>
@@ -1097,7 +1091,7 @@ export const OpencodeMemPlugin = async ({
1097
1091
  if (!viewerEnabled || !viewerAutoStart || !viewerStarted) {
1098
1092
  return { attempted: false, ok: false };
1099
1093
  }
1100
- const restartResult = await runCli(["serve", "--restart"]);
1094
+ const restartResult = await runCli(["serve", "restart"]);
1101
1095
  if (restartResult?.exitCode === 0) {
1102
1096
  await logLine("compat.auto_update_viewer_restart ok");
1103
1097
  return { attempted: true, ok: true };
@@ -1191,7 +1185,7 @@ export const OpencodeMemPlugin = async ({
1191
1185
  );
1192
1186
  if (viewerRestart.attempted && !viewerRestart.ok) {
1193
1187
  await showToast(
1194
- "Backend updated, but viewer restart failed. Run `codemem serve --restart`.",
1188
+ "Backend updated, but viewer restart failed. Run `codemem serve restart`.",
1195
1189
  "warning"
1196
1190
  );
1197
1191
  }
@@ -1341,25 +1335,17 @@ export const OpencodeMemPlugin = async ({
1341
1335
  }
1342
1336
  viewerStarted = false;
1343
1337
  await logLine("viewer stop requested");
1344
- await runCli(["serve", "--stop"]);
1338
+ await runCli(["serve", "stop"]);
1345
1339
  };
1346
1340
 
1347
1341
  // Get version info (commit hash) for debugging
1348
1342
  let version = "unknown";
1349
1343
  try {
1350
- const gitProc = Bun.spawn({
1351
- cmd: ["git", "rev-parse", "--short", "HEAD"],
1344
+ version = execSync("git rev-parse --short HEAD", {
1352
1345
  cwd: runnerFrom,
1353
- stdout: "pipe",
1354
- stderr: "pipe",
1355
- });
1356
- const gitResult = await Promise.race([
1357
- new Response(gitProc.stdout).text(),
1358
- new Promise((resolve) => setTimeout(() => resolve("timeout"), 500)),
1359
- ]);
1360
- if (typeof gitResult === "string" && gitResult !== "timeout") {
1361
- version = gitResult.trim();
1362
- }
1346
+ timeout: 500,
1347
+ encoding: "utf-8",
1348
+ }).trim();
1363
1349
  } catch (err) {
1364
1350
  // Ignore - version will remain 'unknown'
1365
1351
  }
@@ -1836,7 +1822,6 @@ export const OpencodeMemPlugin = async ({
1836
1822
  export default OpencodeMemPlugin;
1837
1823
  export const __testUtils = {
1838
1824
  PINNED_BACKEND_VERSION,
1839
- DEFAULT_UVX_SOURCE,
1840
1825
  buildRunnerArgs,
1841
1826
  appendWorkingSetFileArgs,
1842
1827
  extractApplyPatchPaths,
@@ -1 +1 @@
1
- {"version":3,"file":"claude-hook-ingest.d.ts","sourceRoot":"","sources":["../../src/commands/claude-hook-ingest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAUH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAkHpC,eAAO,MAAM,uBAAuB,SAqDjC,CAAC"}
1
+ {"version":3,"file":"claude-hook-ingest.d.ts","sourceRoot":"","sources":["../../src/commands/claude-hook-ingest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAUH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAkHpC,eAAO,MAAM,uBAAuB,SAsDjC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../../src/commands/db.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,eAAO,MAAM,SAAS,SAEe,CAAC"}
1
+ {"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../../src/commands/db.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AASpC,eAAO,MAAM,SAAS,SAEe,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"enqueue-raw-event.d.ts","sourceRoot":"","sources":["../../src/commands/enqueue-raw-event.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA0CpC,eAAO,MAAM,sBAAsB,SAkDhC,CAAC"}
1
+ {"version":3,"file":"enqueue-raw-event.d.ts","sourceRoot":"","sources":["../../src/commands/enqueue-raw-event.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA0CpC,eAAO,MAAM,sBAAsB,SAmDhC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"export-memories.d.ts","sourceRoot":"","sources":["../../src/commands/export-memories.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,eAAO,MAAM,qBAAqB,SA8ChC,CAAC"}
1
+ {"version":3,"file":"export-memories.d.ts","sourceRoot":"","sources":["../../src/commands/export-memories.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,eAAO,MAAM,qBAAqB,SAgDhC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"import-memories.d.ts","sourceRoot":"","sources":["../../src/commands/import-memories.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,eAAO,MAAM,qBAAqB,SAgD/B,CAAC"}
1
+ {"version":3,"file":"import-memories.d.ts","sourceRoot":"","sources":["../../src/commands/import-memories.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,eAAO,MAAM,qBAAqB,SAsDhC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/commands/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,eAAO,MAAM,UAAU,SAQpB,CAAC"}
1
+ {"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/commands/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,eAAO,MAAM,UAAU,SAUpB,CAAC"}
@@ -6,5 +6,8 @@
6
6
  * and inject is just pack_text output which the existing pack command covers.
7
7
  */
8
8
  import { Command } from "commander";
9
+ export declare const showMemoryCommand: Command;
10
+ export declare const forgetMemoryCommand: Command;
11
+ export declare const rememberMemoryCommand: Command;
9
12
  export declare const memoryCommand: Command;
10
13
  //# sourceMappingURL=memory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../src/commands/memory.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUpC,eAAO,MAAM,aAAa,SAEa,CAAC"}
1
+ {"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../src/commands/memory.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAwHpC,eAAO,MAAM,iBAAiB,SAA4B,CAAC;AAC3D,eAAO,MAAM,mBAAmB,SAA8B,CAAC;AAC/D,eAAO,MAAM,qBAAqB,SAAgC,CAAC;AAEnE,eAAO,MAAM,aAAa,SAEa,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=memory.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory.test.d.ts","sourceRoot":"","sources":["../../src/commands/memory.test.ts"],"names":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"pack.d.ts","sourceRoot":"","sources":["../../src/commands/pack.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,eAAO,MAAM,WAAW,SA+CtB,CAAC"}
1
+ {"version":3,"file":"pack.d.ts","sourceRoot":"","sources":["../../src/commands/pack.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,eAAO,MAAM,WAAW,SAkFtB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"recent.d.ts","sourceRoot":"","sources":["../../src/commands/recent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,eAAO,MAAM,aAAa,SAkBvB,CAAC"}
1
+ {"version":3,"file":"recent.d.ts","sourceRoot":"","sources":["../../src/commands/recent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,eAAO,MAAM,aAAa,SAoCxB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/commands/search.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,eAAO,MAAM,aAAa,SA0CvB,CAAC"}
1
+ {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/commands/search.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,eAAO,MAAM,aAAa,SAgExB,CAAC"}
@@ -0,0 +1,37 @@
1
+ export type ServeMode = "start" | "stop" | "restart";
2
+ export type ServeAction = ServeMode | undefined;
3
+ export interface LegacyServeOptions {
4
+ db?: string;
5
+ dbPath?: string;
6
+ host: string;
7
+ port: string;
8
+ background?: boolean;
9
+ foreground?: boolean;
10
+ stop?: boolean;
11
+ restart?: boolean;
12
+ }
13
+ export interface StartServeOptions {
14
+ db?: string;
15
+ dbPath?: string;
16
+ host: string;
17
+ port: string;
18
+ foreground?: boolean;
19
+ }
20
+ export interface StopRestartServeOptions {
21
+ db?: string;
22
+ dbPath?: string;
23
+ host: string;
24
+ port: string;
25
+ }
26
+ export interface ResolvedServeInvocation {
27
+ mode: ServeMode;
28
+ dbPath: string | null;
29
+ host: string;
30
+ port: number;
31
+ background: boolean;
32
+ }
33
+ export declare function resolveLegacyServeInvocation(opts: LegacyServeOptions): ResolvedServeInvocation;
34
+ export declare function resolveServeInvocation(action: ServeAction, opts: LegacyServeOptions): ResolvedServeInvocation;
35
+ export declare function resolveStartServeInvocation(opts: StartServeOptions): ResolvedServeInvocation;
36
+ export declare function resolveStopRestartInvocation(mode: "stop" | "restart", opts: StopRestartServeOptions): ResolvedServeInvocation;
37
+ //# sourceMappingURL=serve-invocation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serve-invocation.d.ts","sourceRoot":"","sources":["../../src/commands/serve-invocation.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;AAErD,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,SAAS,CAAC;AAEhD,MAAM,WAAW,kBAAkB;IAClC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,iBAAiB;IACjC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,uBAAuB;IACvC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,uBAAuB;IACvC,IAAI,EAAE,SAAS,CAAC;IAChB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,OAAO,CAAC;CACpB;AAUD,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,kBAAkB,GAAG,uBAAuB,CAe9F;AAED,wBAAgB,sBAAsB,CACrC,MAAM,EAAE,WAAW,EACnB,IAAI,EAAE,kBAAkB,GACtB,uBAAuB,CAWzB;AAED,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,iBAAiB,GAAG,uBAAuB,CAS5F;AAED,wBAAgB,4BAA4B,CAC3C,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,IAAI,EAAE,uBAAuB,GAC3B,uBAAuB,CASzB"}
@@ -1,3 +1,5 @@
1
1
  import { Command } from "commander";
2
+ import { type ResolvedServeInvocation } from "./serve-invocation.js";
3
+ export declare function buildForegroundRunnerArgs(scriptPath: string, invocation: ResolvedServeInvocation, execArgv?: string[]): string[];
2
4
  export declare const serveCommand: Command;
3
5
  //# sourceMappingURL=serve.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../../src/commands/serve.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAiFpC,eAAO,MAAM,YAAY,SAoHvB,CAAC"}
1
+ {"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../../src/commands/serve.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAEN,KAAK,uBAAuB,EAG5B,MAAM,uBAAuB,CAAC;AAsG/B,wBAAgB,yBAAyB,CACxC,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,uBAAuB,EACnC,QAAQ,GAAE,MAAM,EAAqB,GACnC,MAAM,EAAE,CAgBV;AAyKD,eAAO,MAAM,YAAY,SAuBtB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=serve.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serve.test.d.ts","sourceRoot":"","sources":["../../src/commands/serve.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ export declare function resolveOpencodeConfigPath(configDir: string): string;
2
+ export declare function loadJsoncConfig(path: string): Record<string, unknown>;
3
+ export declare function writeJsonConfig(path: string, data: Record<string, unknown>): void;
4
+ //# sourceMappingURL=setup-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup-config.d.ts","sourceRoot":"","sources":["../../src/commands/setup-config.ts"],"names":[],"mappings":"AAIA,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAMnE;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CASrE;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAGjF"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=setup-config.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup-config.test.d.ts","sourceRoot":"","sources":["../../src/commands/setup-config.test.ts"],"names":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/commands/setup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAOH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAgMpC,eAAO,MAAM,YAAY,SA6BtB,CAAC"}
1
+ {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/commands/setup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAOH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAmKpC,eAAO,MAAM,YAAY,SA6BtB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../src/commands/stats.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAcpC,eAAO,MAAM,YAAY,SAqDtB,CAAC"}
1
+ {"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../src/commands/stats.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAcpC,eAAO,MAAM,YAAY,SAsDtB,CAAC"}
@@ -0,0 +1,31 @@
1
+ export interface SyncAttemptRow {
2
+ peer_device_id: string;
3
+ ok: number;
4
+ ops_in: number;
5
+ ops_out: number;
6
+ error: string | null;
7
+ finished_at: string | null;
8
+ }
9
+ export declare function formatSyncAttempt(row: SyncAttemptRow): string;
10
+ export interface SyncLifecycleOptions {
11
+ db?: string;
12
+ dbPath?: string;
13
+ host?: string;
14
+ port?: string;
15
+ user?: boolean;
16
+ system?: boolean;
17
+ }
18
+ export declare function buildServeLifecycleArgs(action: "start" | "stop" | "restart", opts: SyncLifecycleOptions, scriptPath: string, execArgv?: string[]): string[];
19
+ export declare function formatSyncOnceResult(peerDeviceId: string, result: {
20
+ ok: boolean;
21
+ error?: string;
22
+ }): string;
23
+ export declare function parseProjectList(value: string | undefined): string[];
24
+ type InterfaceMap = Record<string, Array<{
25
+ address: string;
26
+ family?: string | number;
27
+ internal?: boolean;
28
+ }> | undefined>;
29
+ export declare function collectAdvertiseAddresses(explicitAddress: string | null, configuredHost: string | null, port: number, interfaces: InterfaceMap): string[];
30
+ export {};
31
+ //# sourceMappingURL=sync-helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sync-helpers.d.ts","sourceRoot":"","sources":["../../src/commands/sync-helpers.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC9B,cAAc,EAAE,MAAM,CAAC;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,cAAc,GAAG,MAAM,CAK7D;AAED,MAAM,WAAW,oBAAoB;IACpC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,wBAAgB,uBAAuB,CACtC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,EACpC,IAAI,EAAE,oBAAoB,EAC1B,UAAU,EAAE,MAAM,EAClB,QAAQ,GAAE,MAAM,EAAO,GACrB,MAAM,EAAE,CAcV;AAED,wBAAgB,oBAAoB,CACnC,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE;IAAE,EAAE,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GACrC,MAAM,CAIR;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,EAAE,CAMpE;AAED,KAAK,YAAY,GAAG,MAAM,CACzB,MAAM,EACN,KAAK,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,GAAG,SAAS,CACpF,CAAC;AAEF,wBAAgB,yBAAyB,CACxC,eAAe,EAAE,MAAM,GAAG,IAAI,EAC9B,cAAc,EAAE,MAAM,GAAG,IAAI,EAC7B,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,YAAY,GACtB,MAAM,EAAE,CAcV"}
@@ -1 +1 @@
1
- {"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/commands/sync.ts"],"names":[],"mappings":"AAAA;;GAEG;AAWH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,eAAO,MAAM,WAAW,SAE+B,CAAC"}
1
+ {"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/commands/sync.ts"],"names":[],"mappings":"AAAA;;GAEG;AAuBH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA8HpC,eAAO,MAAM,WAAW,SAE+B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=sync.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sync.test.d.ts","sourceRoot":"","sources":["../../src/commands/sync.test.ts"],"names":[],"mappings":""}