/**
 * completion-generator.ts — Commander command-tree → POSIX shell completion script.
 *
 * Phase B1 of olam-operator-onboarding-parity (plan
 * ~/.claude/plans/olam-operator-onboarding-parity.md).
 *
 * Decision 4 (plan): runtime-emit from the commander tree, NOT static
 * fixtures in the tarball. One source of truth: new CLI commands auto-
 * included in the next `olam completion <shell>` invocation.
 *
 * Supported shells: zsh + bash. Other shells throw `UnsupportedShellError`.
 *
 * Nesting depth: TWO levels of subcommand dispatch (top-level + one
 * nested). Covers ~95% of olam's tree (`olam kg build`, `olam auth login`,
 * `olam workspace list`, etc.). Deeper nesting (`olam world snapshot
 * restore`) falls through gracefully — top + one level still complete.
 *
 * Escaping:
 *   - zsh: descriptions inside `name:description` syntax need `:` escaped
 *     (since `:` is the field separator) and `'` doubled (since strings
 *     are single-quoted).
 *   - bash: descriptions inside double-quoted strings need `"`, `\`, `$`,
 *     and backtick escaped.
 *
 * Hidden commands (commander's private `_hidden` flag) are excluded:
 *   - `olam crystallize` is registered with `{ hidden: !isPleriConfigured() }`
 *     for fresh-install operators.
 *
 * Determinism: commander preserves command-registration order in
 * `Command.commands`. The walk is a pure-functional map → the output is
 * a deterministic function of the program tree. Snapshot tests rely on
 * this.
 */
import type { Command } from 'commander';
export interface CommandNode {
    readonly name: string;
    readonly description: string;
    readonly subcommands: ReadonlyArray<CommandNode>;
}
export declare class UnsupportedShellError extends Error {
    constructor(shell: string);
}
/**
 * Walk a commander `Command` recursively, extracting (name, description,
 * subcommands). Hidden commands (commander's private `_hidden` flag,
 * set via `.command(..., { hidden: true })`) are excluded.
 */
export declare function extractCommandTree(program: Command): CommandNode;
/**
 * Emit a zsh completion script.
 *
 * Format:
 *   #compdef <program>
 *
 *   _<program>() {
 *     local -a l1_subs
 *     l1_subs=(
 *       '<sub>:<description>'
 *       ...
 *     )
 *     if (( CURRENT == 2 )); then
 *       _describe '<program> command' l1_subs
 *       return
 *     fi
 *     case $words[2] in
 *       <sub-with-children>)
 *         if (( CURRENT == 3 )); then
 *           local -a l2_subs
 *           l2_subs=(...)
 *           _describe '<sub> subcommand' l2_subs
 *         fi
 *         ;;
 *       ...
 *     esac
 *   }
 *
 *   _<program> "$@"
 */
export declare function generateZshCompletion(tree: CommandNode): string;
/**
 * Emit a bash completion script.
 *
 * Format:
 *   _<program>_completions() {
 *     local cur="${COMP_WORDS[COMP_CWORD]}"
 *     local cword=$COMP_CWORD
 *     if [[ $cword -eq 1 ]]; then
 *       COMPREPLY=( $(compgen -W "<sub1> <sub2> ..." -- "$cur") )
 *       return
 *     fi
 *     case "${COMP_WORDS[1]}" in
 *       <sub-with-children>)
 *         if [[ $cword -eq 2 ]]; then
 *           COMPREPLY=( $(compgen -W "<l2-1> <l2-2> ..." -- "$cur") )
 *         fi
 *         ;;
 *     esac
 *   }
 *   complete -F _<program>_completions <program>
 */
export declare function generateBashCompletion(tree: CommandNode): string;
/**
 * Top-level API: walk the commander program + emit a completion script
 * for the requested shell.
 */
export declare function generateCompletion(program: Command, shell: 'zsh' | 'bash'): string;
//# sourceMappingURL=completion-generator.d.ts.map