/** * Public installer surface for cadre-host. * * Orchestrates the install / uninstall flow described in * `tickets/implement/6.4.1-cadre-host-installer.md`. * * The class is purposefully thin — heavy lifting lives in the focused * subsystem modules (wizard.ts, config.ts, service-host/{systemd,launchd,nssm}.ts, * browser.ts). */ import { type SupportedPlatform } from './platform.js'; import { type ServiceHost } from './service-host/index.js'; import { defaultsForPlatform, runWizard, runWizardWith, DEFAULT_UI_PORT, type WizardAnswers, type WizardDefaults } from './wizard.js'; export type { HostConfigFile, PushSettings } from './config.js'; export { readHostConfig, updateHostConfig, writeHostConfig } from './config.js'; export type { WizardAnswers, WizardDefaults } from './wizard.js'; export type { ServiceHost, ServiceHostContext, ServiceHostStatus } from './service-host/index.js'; export interface InstallOptions { /** If true, all prompts use defaults; CLI flags override individual values. */ nonInteractive: boolean; /** Override the data dir. */ dataDir?: string; /** Override the UI port. */ uiPort?: number; /** Disable UPnP probing on first run. */ noUpnp?: boolean; /** Open browser at end (default true; suppressed by --no-browser or non-TTY). */ openBrowser?: boolean; /** System-wide install — v1 emits a not-yet-supported error. */ system?: boolean; /** Path to node.exe / node binary used by the service-host unit. */ nodePath?: string; /** * Write the data dir (config, NAT seed) but register no OS service. * The host is then run by hand with `cadre-host start`. Nothing is listening * after such an install, so the browser-open step is skipped too. */ noService?: boolean; /** Test-only: stub the service-host registration. */ serviceHost?: ServiceHost; /** Test-only: stub the interactive wizard. Production callers leave unset. */ wizard?: (defaults: WizardDefaults) => Promise; /** Test-only: stub the interface read that decides whether to ask about UPnP. */ publicInterfaceAddress?: () => string | null; } export interface InstallResult { dataDir: string; uiUrl: string; /** The registered service's name; absent when `noService` skipped registration. */ serviceName?: string; /** Path to the rendered config file. */ configPath: string; } export interface UninstallOptions { /** Also remove the data dir (default false — preserve hosted-node records, node identities and NAT state). */ removeData: boolean; /** Skip the confirmation prompt (for scripts). */ yes: boolean; /** Override the data dir to remove (defaults to platform default). */ dataDir?: string; /** Test-only: stub the service-host registration. */ serviceHost?: ServiceHost; } export interface InstallerOptions { platform?: SupportedPlatform; /** Installer version string written into host.config.json. */ installerVersion?: string; } export declare class Installer { private readonly platform; private readonly installerVersion; constructor(opts?: InstallerOptions); install(opts: InstallOptions): Promise; uninstall(opts: UninstallOptions): Promise; status(opts?: { serviceHost?: ServiceHost; }): Promise<{ installed: boolean; running: boolean; }>; /** Exposed for tests / unattended CI. Resolves the wizard answers without running prompts. */ resolveAnswersFromOptions(opts: InstallOptions): WizardAnswers; private resolveAnswers; } export { runWizardWith, defaultsForPlatform, DEFAULT_UI_PORT }; export { runWizard };