/** * Completion Context Parser * * Parses command line input to determine the current completion context. * Supports hierarchical subcommand format: * pontx [options] * pontx [options] (single spec mode) */ import { CompletionInput, CompletionContext, CompletionOptions } from "./types.d.ts"; /** * Check if an option requires a value */ export declare function optionNeedsValue(option: string): boolean; /** * Check if an option is a boolean flag */ export declare function isBooleanOption(option: string): boolean; /** * Parse words into options and positional arguments */ export declare function parseWordsToOptionsAndArgs(words: string[]): { options: Set; args: string[]; }; /** * Parse completion input to determine context * * State machine for hierarchical command format: * * words[0]: program name (pontx) * words[1]: spec name OR global command * - is global command -> position: "command" * - is known spec name -> record specName, enter spec subcommand layer * - typing -> complete both spec names and command names * * words[2] (with spec prefix): spec-scoped command * -> complete call / show-api / gen / search / list / show-schema / list-cases * * words[3] (with spec + API command like call/show-api/gen): * - hasTags -> complete tag name (position: "tag") * - !hasTags -> complete api name (position: "api") * * words[4] (with spec + API command + tag): complete api name (position: "api") * * Subsequent positions: complete options (--debug, --petId, etc.) */ export declare function parseCompletionContext(input: CompletionInput, options?: CompletionOptions): CompletionContext; /** * Create a CompletionInput from shell environment variables * * @param line COMP_LINE - the full command line * @param wordIndex COMP_CWORD - current word index * @param cursor COMP_POINT - cursor position (optional) * @returns CompletionInput */ export declare function createCompletionInput(line: string, wordIndex: number, cursor?: number): CompletionInput;