import { RuntimeAdapter } from "./adapter.mjs"; //#region src/runtime/node.d.ts /** * Minimal subset of the Node.js `process` object needed by the adapter. * * We avoid importing `@types/node` to keep the core runtime-agnostic * at the type level. This interface declares only what `createNodeAdapter` * actually reads from the global. */ interface NodeProcess { /** Raw process arguments (`[binary, script, ...userArgs]`). */ readonly argv: readonly string[]; /** Environment variables (values are `undefined` for unset keys). */ readonly env: Readonly>; /** Runtime version strings — used for version-guard checks. */ readonly versions?: { readonly node?: string; readonly bun?: string; }; /** Return the current working directory. */ cwd(): string; /** Platform identifier (e.g. `'linux'`, `'darwin'`, `'win32'`). */ readonly platform: string; /** Standard input stream with TTY detection and async iteration. */ readonly stdin: { readonly isTTY?: boolean; /** Async iterable for reading all of stdin (used by readStdin). */ [Symbol.asyncIterator](): AsyncIterator; }; /** Standard output stream with TTY detection and write. */ readonly stdout: { readonly isTTY?: boolean; readonly columns?: number; readonly rows?: number; getWindowSize?(): readonly [number, number]; on?(event: 'resize', listener: () => void): unknown; off?(event: 'resize', listener: () => void): unknown; removeListener?(event: 'resize', listener: () => void): unknown; write(data: string): unknown; }; /** Standard error stream with write. */ readonly stderr: { write(data: string): unknown; }; /** Terminate the process with the given exit code. */ exit(code: number): never; } /** * Create a runtime adapter backed by Node.js `process` globals. * * Reads `process.argv`, `process.env`, `process.cwd()`, and wraps * `process.stdout.write`/`process.stderr.write` as {@linkcode WriteFn} functions. * * Also works on Bun, which provides a Node-compatible `process` global. * * @param proc - Override the process object (useful for testing the adapter itself). * @returns A {@linkcode RuntimeAdapter} backed by Node.js process state. * * @example * ```ts * import { cli } from '@kjanat/dreamcli'; * import { createNodeAdapter } from '@kjanat/dreamcli/runtime/node'; * * cli('mycli') * .command(deploy) * .run({ adapter: createNodeAdapter() }); * ``` */ declare function createNodeAdapter(proc?: NodeProcess): RuntimeAdapter; //#endregion export { type NodeProcess, createNodeAdapter };