/** * One CLI argument rendered exactly as an operator would type it, for surfaces * that print executable commands. * * A command a surface prints is a command the reader copies, so an argument * that could mean something else is a defect: a project named `odd $fleet` * must not render `--project odd $fleet` (two arguments, and a `$` that the * shell would read). Safe characters pass through unquoted; anything else is * wrapped in single quotes, folding an embedded quote with the standard * `'\''` — the same convention the privileged-step renderer applies to its * printed `sudo …` lines (#810). */ export function shellQuote(value: string): string { return /^[A-Za-z0-9_@%+=:,./-]+$/.test(value) ? value : `'${value.replaceAll("'", "'\\''")}'`; }