fix(cli): lazy-load server module so non-serve commands skip node:sqlite
All checks were successful
CI (Node) / build-test (push) Successful in 8s
All checks were successful
CI (Node) / build-test (push) Successful in 8s
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) <noreply@anthropic.com>
This commit is contained in:
@@ -4,7 +4,6 @@ import { existsSync, readFileSync } from "node:fs";
|
|||||||
import { dirname, join } from "node:path";
|
import { dirname, join } from "node:path";
|
||||||
import { fileURLToPath } from "node:url";
|
import { fileURLToPath } from "node:url";
|
||||||
import { resolveConfig, baseUrl, DEFAULT_PORT } from "./config.js";
|
import { resolveConfig, baseUrl, DEFAULT_PORT } from "./config.js";
|
||||||
import { startServer } from "./server.js";
|
|
||||||
import { autostartManager } from "./autostart/index.js";
|
import { autostartManager } from "./autostart/index.js";
|
||||||
import { runStdioMcp } from "./mcp-stdio.js";
|
import { runStdioMcp } from "./mcp-stdio.js";
|
||||||
import {
|
import {
|
||||||
@@ -82,6 +81,7 @@ program
|
|||||||
.action(async (opts: { port?: number; bind?: string; dbPath?: string; config?: string }) => {
|
.action(async (opts: { port?: number; bind?: string; dbPath?: string; config?: string }) => {
|
||||||
const cfg = resolveConfig(opts);
|
const cfg = resolveConfig(opts);
|
||||||
try {
|
try {
|
||||||
|
const { startServer } = await import("./server.js");
|
||||||
const { app } = await startServer(cfg);
|
const { app } = await startServer(cfg);
|
||||||
app.log.info(`ClaudeMailbox listening on ${baseUrl(cfg)} (db: ${cfg.dbPath})`);
|
app.log.info(`ClaudeMailbox listening on ${baseUrl(cfg)} (db: ${cfg.dbPath})`);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
Reference in New Issue
Block a user