Ensure CLI startup operations settle before process exit on supported Node runtimes. - Keep awaited QMD probes and ephemeral port selection ref'd until completion. - Add CLI process regressions for init persistence and exit code 13. - Declare the Node 22.4 runtime floor and extend boot smoke coverage. Files changed: .changeset/fn-8954-cli-exit-13.md | 7 ++ docs/testing.md | 4 +- package.json | 3 + packages/cli/agent-browser.mjs | 6 ++ packages/cli/bin.mjs | 7 ++ packages/cli/package.json | 3 + packages/cli/src/__tests__/ci-workflow.test.ts | 9 +++ packages/cli/src/__tests__/cli-exit-code.test.ts | 82 ++++++++++++++++++++++ packages/cli/src/__tests__/package-config.test.ts | 12 ++++ packages/cli/src/bin.ts | 6 ++ .../__tests__/postgres/embedded-free-port.test.ts | 37 ++++++++++ packages/core/src/memory/memory-backend.ts | 17 +++-- packages/core/src/postgres/embedded-lifecycle.ts | 16 +++-- scripts/boot-smoke.mjs | 62 +++++++++++----- 14 files changed, 244 insertions(+), 27 deletions(-) Fusion-Task-Id: FN-8954 Fusion-Task-Lineage: 05303d07-2662-48d5-a442-6d43fa0a4493 Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
28 lines
961 B
JavaScript
Executable File
28 lines
961 B
JavaScript
Executable File
#!/usr/bin/env node
|
|
|
|
import { constants } from "node:fs";
|
|
import { access } from "node:fs/promises";
|
|
import { dirname, resolve } from "node:path";
|
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
|
|
const packageDir = dirname(fileURLToPath(import.meta.url));
|
|
const distEntry = resolve(packageDir, "dist", "bin.js");
|
|
|
|
try {
|
|
await access(distEntry, constants.F_OK);
|
|
} catch {
|
|
globalThis.console.error(
|
|
`Fusion CLI build output is missing at ${distEntry}. Run \`pnpm build\` before invoking this source checkout.`,
|
|
);
|
|
globalThis.process.exit(1);
|
|
}
|
|
|
|
/*
|
|
* FNXC:CliAwaitLiveness 2026-08-11-09:17:
|
|
* Retain top-level await so an unsettled CLI completion remains Node's loud,
|
|
* non-zero diagnostic rather than a silent partial success. FN-8954 fixes the
|
|
* awaited QMD child liveness at its source; this shim must not force exit 0,
|
|
* which would truncate `serve`, `dashboard`, or `daemon` as well.
|
|
*/
|
|
await import(pathToFileURL(distEntry).href);
|