@bluecadet/launchpad-cli
Version:
CLI for @bluecadet/launchpad utilities
29 lines • 1.65 kB
TypeScript
/**
* Clean API for executing commands via controller or daemon.
* Handles daemon detection and routing automatically.
*/
import { LaunchpadController } from "@bluecadet/launchpad-controller";
import type { ResolvedControllerConfig } from "@bluecadet/launchpad-controller/config";
import { IPCClient } from "@bluecadet/launchpad-controller/ipc-client";
import { type Result, type ResultAsync } from "neverthrow";
import { DaemonNotRunningError, IPCConnectionError } from "../errors.js";
export { DaemonNotRunningError, IPCConnectionError };
type WithDaemonDeps = {
resolvePid?: (pidFile: string) => Result<number | null, Error>;
};
/**
* Execute a function with a connected IPC client if daemon is running.
* If daemon is not running, returns an error.
* Use this for commands that REQUIRE a daemon (status, stop).
*/
export declare function withDaemon<T>(baseDir: string, controllerConfig: ResolvedControllerConfig, relayLogs: boolean, operation: (client: IPCClient, pid: number) => ResultAsync<T, IPCConnectionError>, deps?: WithDaemonDeps): ResultAsync<T, DaemonNotRunningError | IPCConnectionError>;
/**
* Execute commands either via daemon (if running) or local controller (if not).
* Use this for commands that can work either way (content, monitor).
*/
export declare function withDaemonOrController<T>(baseDir: string, controllerConfig: ResolvedControllerConfig, options: {
mode: "task" | "persistent";
ifDaemon: (client: IPCClient, pid: number) => ResultAsync<T, Error>;
otherwise: (controller: LaunchpadController) => ResultAsync<T, Error>;
}): ResultAsync<T, Error>;
//# sourceMappingURL=controller-execution.d.ts.map