export async function copyWithSystemClipboard(text: string): Promise { const commands = process.platform === "darwin" ? [["pbcopy"]] : process.platform === "win32" ? [["clip.exe"]] : [["wl-copy"], ["xclip", "-selection", "clipboard"], ["xsel", "--clipboard", "--input"]] for (const command of commands) { try { const child = Bun.spawn(command, { stdin: "pipe", stdout: "ignore", stderr: "ignore" }) child.stdin.write(text) child.stdin.end() if (await child.exited === 0) return } catch { // Try the next platform clipboard provider. } } throw new Error("no clipboard provider available") }