/** * CLI substrate entry point (Phase 40 / PH40-01). * * This module is the runtime entry point used by `bin/hivemind-tools.cjs`. * It wires the built-in command sources into a router and exposes a * single `runCli(argv, io?)` function that: * - Parses argv (stripped of `node` and the script name). * - Dispatches to the matching command via {@link createRouter}. * - Writes the handler's `output` to stdout (when present). * - Writes any `error` to stderr (always `[Hivemind]`-prefixed). * - Resolves the handler's exit code (default 0). * * The substrate is dependency-free except for the harness's own modules; * see `src/cli/router.ts` for the rationale. * * @example * ```ts * // Subpath import resolved by the package's "exports" field. * import { runCli } from "/cli" * const exitCode = await runCli(process.argv.slice(2)) * process.exit(exitCode) * ``` */ import { type CliCommand, type CliRouter } from "./router.js"; export type CliIO = { stdout: (chunk: string) => void; stderr: (chunk: string) => void; }; /** * Build the canonical CLI router with the harness's built-in commands. * * Exposed as a separate factory so tests can introspect the registry * without going through `runCli`. */ export declare function buildHivemindCli(extraCommands?: readonly CliCommand[]): CliRouter; /** * Top-level CLI entrypoint. Dispatches argv to the matching command, * pipes its output through the supplied IO interface, and returns the * handler's exit code (or 64 for usage errors / 70 for handler crashes * per the router's policy). */ export declare function runCli(argv: readonly string[], io?: CliIO): Promise; export type { CliCommand, CliRouter, CliRouterResult } from "./router.js"; export { createRouter, parseArgs } from "./router.js"; export { discoverCommands, validateCommand } from "./discovery.js"; export { renderError, renderHelp, renderJson, renderTable } from "./renderer.js"; //# sourceMappingURL=index.d.ts.map