chore: publish from main

This commit is contained in:
github-actions[bot]
2026-08-26 00:25:35 +00:00
parent 7aa0c93175
commit dc25d2bc3e
36 changed files with 7085 additions and 0 deletions
@@ -0,0 +1,19 @@
// Single-quoted arguments are literal in both POSIX shells and PowerShell; only the
// escape for an embedded apostrophe differs, so callers pick the target shell.
const SAFE_ARGUMENT = /^[A-Za-z0-9_\-./:@+=,]+$/;
export function detectShell(platform = "") {
return /^win/i.test(String(platform)) ? "powershell" : "posix";
}
export function quoteShellArg(value, shell = "posix") {
const text = String(value ?? "");
if (text === "") return "''";
if (SAFE_ARGUMENT.test(text)) return text;
const escaped = shell === "powershell" ? text.replace(/'/g, "''") : text.replace(/'/g, "'\\''");
return `'${escaped}'`;
}
export function formatShellCommand(parts, shell = "posix") {
return parts.map((part) => quoteShellArg(part, shell)).join(" ");
}