/** * Shell command tokenizer for guardrail compound command parsing * * Splits compound shell commands (cmd1 | cmd2 && cmd3) into individual * subcommands so each can be validated independently against guardrails. */ /** * A parsed subcommand from a compound shell command */ export interface ShellToken { /** Trimmed subcommand text */ command: string; /** Operator that preceded this token (undefined for the first) */ operator?: '|' | '&&' | '||' | ';'; /** 0-based position in the command sequence */ index: number; } /** * Parse a compound shell command into individual subcommands. * * Handles pipes, logical operators (&&, ||), semicolons, and respects * single-quoted, double-quoted, and backtick-quoted strings. * * @param input - The full command string * @returns Array of parsed subcommand tokens * * @example * ```typescript * parseShellCommand('ls && rm -rf /tmp') * // => [ * // { command: 'ls', index: 0 }, * // { command: 'rm -rf /tmp', operator: '&&', index: 1 } * // ] * ``` */ export declare function parseShellCommand(input: string): ShellToken[];