FN-5805: add fn onboard command with sequential runOnboard flow

Add a new interactive onboarding CLI flow that guides first-time setup end to end.

- add new `fn onboard` command wiring in CLI entrypoint and usage help
- implement `runOnboard()` with sequential prompts for central DB, provider auth, init, test mode, and project maxConcurrent
- persist `cliOnboardingCompletedAt` marker in global settings with `--force` rerun support
- add onboarding command tests and global settings regression coverage
- document `fn onboard` usage and options in CLI reference
- add a minor changeset for published `@runfusion/fusion`

Files changed:
 .changeset/fn-5805-onboard-command.md              |   5 +
 docs/cli-reference.md                              |  20 ++
 packages/cli/src/bin.ts                            |  10 +
 packages/cli/src/commands/__tests__/onboard.test.ts| 193 ++++++++++++++++
 packages/cli/src/commands/onboard.ts               | 249 +++++++++++++++++++++
 packages/core/src/__tests__/global-settings.test.ts|  11 +
 packages/core/src/index.ts                         |   2 +-
 packages/core/src/settings-schema.ts               |   1 +
 packages/core/src/types.ts                         |   4 +
 9 files changed, 494 insertions(+), 1 deletion(-)

Fusion-Task-Id: FN-5805

Fusion-Task-Lineage: b1bcaf27-9bd7-4569-b685-225a97fa1200
This commit is contained in:
gsxdsm
2026-06-01 01:42:19 -07:00
parent 9ba3a8e453
commit e854d33375
9 changed files with 494 additions and 1 deletions

View File

@@ -219,6 +219,17 @@ describe("GlobalSettingsStore", () => {
expect(settings.themeMode).toBe("dark"); // preserved default
});
it("round-trips cliOnboardingCompletedAt without changing setupComplete", async () => {
await store.init();
const marker = "2026-05-31T00:00:00.000Z";
await store.updateSettings({ cliOnboardingCompletedAt: marker });
const settings = await store.getSettings();
expect(settings.cliOnboardingCompletedAt).toBe(marker);
expect(settings.setupComplete).toBeUndefined();
});
it("round-trips testMode in global settings", async () => {
await store.init();

View File

@@ -769,7 +769,7 @@ export {
export { CentralCore } from "./central-core.js";
export type { CentralCoreEvents } from "./central-core.js";
export { CentralDatabase, createCentralDatabase } from "./central-db.js";
export { CentralDatabase, createCentralDatabase, getDefaultCentralDbPath } from "./central-db.js";
export { NodeConnection } from "./node-connection.js";
export { NodeDiscovery } from "./node-discovery.js";
export { collectSystemMetrics } from "./system-metrics.js";

View File

@@ -58,6 +58,7 @@ export const DEFAULT_GLOBAL_SETTINGS = {
customProviders: [],
defaultProjectId: undefined,
setupComplete: undefined,
cliOnboardingCompletedAt: undefined,
favoriteProviders: undefined,
favoriteModels: undefined,
openrouterModelSync: true,

View File

@@ -2542,6 +2542,10 @@ export interface GlobalSettings {
* Set to true when the user completes the multi-project setup process.
* Default: false (undefined until setup is completed). */
setupComplete?: boolean;
/** ISO timestamp for completion of the `fn onboard` CLI wizard.
* Distinct from dashboard `setupComplete` first-run flow state.
* Undefined means CLI onboarding has not completed yet. */
cliOnboardingCompletedAt?: string;
/** List of favorite provider names. Favorite providers appear at the top of
* model selection dropdowns. Order is preserved - earlier entries appear higher. */
favoriteProviders?: string[];