memorix background start can spawn dist/index.js stdio instead of the HTTP CLI
Description
memorix background start is supposed to spawn node <cli-entry> serve-http --port 3211. After tsup bundles the CLI into dist/cli/index.js, a naive path.resolve(dirname(import.meta.url), '..', 'index.js') resolves to dist/index.js — the library stdio MCP entry, not the HTTP CLI.
The child logs MCP Server running on stdio and stdin closed — exiting (stdio is ignore). The control plane never stays up. This reproduced on macOS and Linux after a rebuild.
Steps to Reproduce
- Install a built
memorixwheredist/index.jsanddist/cli/index.jsboth exist. - From a git project:
memorix background start - Read
~/.memorix/background.log.
Expected Behavior
Child command is node …/dist/cli/index.js serve-http --port 3211. /health becomes {"status":"ok","mode":"control-plane"}.
Actual Behavior
[memorix] MCP Server running on stdio (project: …)
[memorix] stdin closed — exiting
[ERROR] Background process exited unexpectedly.
Environment
- Memorix 1.6.0 built with tsup
- macOS (MacBook 13/16) and Linux (dev-001)
Additional Context
#214 resolves the bundled CLI file when basename(here) === 'index.js' and basename(dir) === 'cli', and never treats dist/index.js as the daemon entry.
Related: #69, #70, #214.
Fix is in PR https://github.com/AVIDS2/memorix/pull/214 — not on main yet, so leaving this issue open until that PR merges.
Relevant work:
13142d320f—memorix background startspawnsdist/cli/index.js(HTTP CLI), not librarydist/index.js(stdio)- Files:
src/cli/commands/background.ts,tests/cli/background-launcher.test.ts
Fixed by #214 and released in v1.6.2. Background mode now launches the compiled HTTP CLI entry rather than the stdio library entry. Closing as shipped.