From 01c22ff9a3b8f2a831e1d548522dffe09451c630 Mon Sep 17 00:00:00 2001 From: Mika Kuns Date: Wed, 20 May 2026 13:30:04 +0200 Subject: [PATCH] fix(cli): lazy-load server module so non-serve commands skip node:sqlite Importing server.js statically also imports db.ts, which pulls in node:sqlite at startup. On Linux that emits an ExperimentalWarning to stderr for every CLI invocation -- visible to users running the hook on every prompt. Defer the server import into the serve action so check --hook / session-announce / send / peek / list never touch sqlite. Co-Authored-By: Claude Opus 4.7 (1M context) --- node/src/cli.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/src/cli.ts b/node/src/cli.ts index 579527c..bf5aa5a 100644 --- a/node/src/cli.ts +++ b/node/src/cli.ts @@ -4,7 +4,6 @@ import { existsSync, readFileSync } from "node:fs"; import { dirname, join } from "node:path"; import { fileURLToPath } from "node:url"; import { resolveConfig, baseUrl, DEFAULT_PORT } from "./config.js"; -import { startServer } from "./server.js"; import { autostartManager } from "./autostart/index.js"; import { runStdioMcp } from "./mcp-stdio.js"; import { @@ -82,6 +81,7 @@ program .action(async (opts: { port?: number; bind?: string; dbPath?: string; config?: string }) => { const cfg = resolveConfig(opts); try { + const { startServer } = await import("./server.js"); const { app } = await startServer(cfg); app.log.info(`ClaudeMailbox listening on ${baseUrl(cfg)} (db: ${cfg.dbPath})`); } catch (err) {