import type { DispatchFn } from '../../../runtime/types.ts'; import type { NamespaceView, SessionView, StatPath } from '../../../ops/types.ts'; import { IOResult, type ByteSource } from '../../../io/types.ts'; import { type PathSpec } from '../../../types.ts'; import type { CLIInstall } from '../../cli/types.ts'; import type { Session } from '../../session/session.ts'; import { ExecutionNode } from '../../types.ts'; import type { Runtime } from '../../../runtime/base.ts'; /** * Workspace facts the dispatcher can offer but most CLIs do not want: an API * client needs no filesystem, while `git` is nothing but one. Forwarded whole * onto the leaf's opts bag, so a leaf that does not read them ignores them and * there is no allowlist of filesystem-aware CLIs to keep in step (the same rule * `links` follows for mount commands). */ export interface CLIContext { /** * The workspace's ordered runtime world, which a script leaf selects * its interpreter from; absent (outside a workspace) refuses script * installs. */ entries?: readonly Runtime[]; dispatch?: DispatchFn; statPath?: StatPath; ns?: NamespaceView; sessionView?: SessionView; } /** * Execute a line whose head word is an installed CLI. * * Dispatch is by NAME: the install resolves the program tree and the * validated config; no mount is consulted and no operand path picks a * backend (the one executor divergence from mount commands). The walk * consumes subcommand words and group options; the leaf's own argv * rides the ordinary spec machinery because a CLISpec IS a * CommandSpec. The leaf handler renders the line's one CLIInvocation, * built here and nowhere else: an fn leaf runs as `fn(inv)`, a script * leaf runs its embedded program on a workspace runtime * (scriptOutput), so usage refusals, limits, and classification all * happen in front of either tier. Help too, for every node that declared * a grammar to render it from (parseSpecFor). The workspace facts in * `context` reach a verb as one `inv.doors` field, one door per state * plane, so a verb that never reads it cannot touch a mount. */ export declare function handleCli(install: CLIInstall, parts: readonly (string | PathSpec)[], session: Session, stdin?: ByteSource | null, context?: CLIContext, dropCaches?: (() => Promise) | null): Promise<[ByteSource | null, IOResult, ExecutionNode]>; //# sourceMappingURL=cli.d.ts.map