/** * Runtime completion resolver — the authoritative, in-process answer to * "what should I suggest at this cursor position?". * * The static bash/zsh/fish generators bake the whole command tree into shell * case-tables, which go stale the moment a command/flag is added (the script * must be regenerated + reinstalled). The DYNAMIC completion path instead * installs a thin, tree-independent shim that, on every , hands the live * command line back to the binary and calls THIS function. Because the binary * always knows its own current command tree, a dynamic shim never goes stale — * install once, ever. * * This mirrors the path-walking the static bash driver does, but in one place * and in TypeScript, so all three shells share identical behavior. It is * deliberately decoupled from Commander internals via the CommandSpec tree * (walkProgram), exactly like the static generators. */ import type { Command } from "commander"; import { type CompletionContextLookup } from "./walk.js"; /** Bitmask of post-processing hints for the shell shim (Cobra-style). */ export declare const Directive: { /** Use the returned candidates as completion values. */ readonly Default: 0; /** No candidates apply here — the shell should fall back to file completion. */ readonly File: 1; }; export interface Candidate { value: string; description?: string; } export interface CompletionResult { candidates: Candidate[]; directive: number; } /** Provider runner injected by the host CLI (same contract as `__complete`). */ export type CompletionProviderRunner = (provider: string, partial: string) => Promise; /** * Compute completion candidates for `words` with the cursor at `cword`. * `words[0]` is the bin name; `words[cword]` is the (possibly empty) token * being completed. The shell shim does the final prefix-filtering against that * token, so this returns the full candidate set for the slot. */ export declare function resolveCompletions(program: Command, words: string[], cword: number, lookup: CompletionContextLookup, runProvider: CompletionProviderRunner): Promise; /** Sentinel prefix for the trailing directive line in the wire protocol. */ export declare const DIRECTIVE_PREFIX = "\u001F:"; /** * Serialize a result for the shell shim: one `value\tdescription` line per * candidate, then a final `\x1f:` line. The \x1f (unit separator) * prefix makes the directive line unambiguous against real candidate values. */ export declare function encodeResult(result: CompletionResult): string; //# sourceMappingURL=resolve.d.ts.map