/** * Word splitting for acceptance-gate command strings (T12718). * * A `test` gate's `command` is a single string written the way a shell user * writes it, but it is executed WITHOUT a shell (argv straight to `spawn`). * Splitting it on whitespace handed quote characters to the target verbatim: * `node -e "setTimeout(()=>process.exit(1),6000)"` reached node as the * JavaScript expression `"setTimeout(...)"` — a string literal — so node exited * 0 immediately and the gate recorded a false PASS in ~46 ms. * * This splitter applies POSIX `sh` quoting (single quotes, double quotes, * backslash escapes) so the argv is the one the author wrote, and it REFUSES * the shell syntax it cannot honour (operators, substitutions, variable * expansion). Passing `&&` or `$(...)` to the target as a literal word would * run a different program from the one the gate names, which is the same * false-verdict class. Glob characters are left as literal words, exactly as * before, because test runners commonly take them as filter patterns. * * @task T12718 */ /** * Split a gate command string into argv words using POSIX `sh` quoting rules. * * @param raw - The command string exactly as declared on the gate. * @param label - What `raw` is, for error messages (e.g. `testing.command`). * @returns The argv words, command first; empty when `raw` holds only whitespace. * @throws When a quote is unterminated, the string ends in a bare backslash, or * it contains shell syntax no shell will interpret: unquoted `| & ; < > ( ) $` * or a backtick, a `$`/backtick inside double quotes, a `#` comment or `~` * tilde expansion at the start of a word, or a leading `NAME=value` * environment assignment. * @example * ```typescript * splitCommandLine(`node -e "setTimeout(()=>process.exit(1),3000)"`); * // => ['node', '-e', 'setTimeout(()=>process.exit(1),3000)'] * ``` */ export declare function splitCommandLine(raw: string, label?: string): string[]; /** * Render argv words back into one POSIX `sh` command line — the inverse of * {@link splitCommandLine}, for putting a resolved command into a shell * context such as a workflow `run:` step. * * @param words - The argv words, command first. * @returns The words joined by spaces, each single-quoted when it holds a * character `sh` would interpret. A bare placeholder word (`{filters}`, * `{projects}`: braces around letters only, which no shell expands) stays bare * so an affected-command template keeps it as one word (T13125); any other * brace word (`src/{a,b}`, `{1..3}`) is quoted, since a shell would expand it. * @example * ```typescript * joinCommandLine(['vitest', 'run', '-t', 'my test']); * // => "vitest run -t 'my test'" * ``` */ export declare function joinCommandLine(words: readonly string[]): string; //# sourceMappingURL=command-line.d.ts.map