/** Every command segment of a shell command, at any nesting depth — or an * `opaque` reason when the scan met a construct it cannot delimit the way * the shell does, so checkGitPolicy can fail closed. */ export interface ShellScan { segments: string[][]; opaque?: string; } /** * Minimal quote-aware split of a shell command into segments (one per * `;`, `|`, `&`, `(`, `)` or newline) of whitespace-separated tokens, with * quotes and backslash escapes REMOVED from token text. Not a shell parser: * it exists only so the classifier sees `sh -c "git push"` as the tokens * `sh`, `-c`, `git push`, sees `git pu""sh` as `git push`, and does NOT see * `git commit -m "fix: git push hook"` as a second git call. * * The shell runs a command substitution wherever it appears, so `$(…)`, * backticks and `<(…)`/`>(…)` are scanned recursively — unquoted, inside * double quotes, in assignments, in `${…}` and in unquoted here-document * bodies — and their commands become segments of their own (#257: only an * unquoted `$(` used to be seen). The token keeps the raw substitution text, * so `git $(echo push)` stays unclassifiable. Only single quotes and quoted * here-documents are literal. Comments, here-document bodies and `$'…'` are * consumed the way the shell consumes them: a stray `'` in any of them used to * swallow every following line into one "quoted" token. */ export declare function shellSegments(cmd: string): ShellScan; //# sourceMappingURL=shell-scan.d.ts.map