feat: initial project setup with gai tool

This commit is contained in:
2026-06-09 16:41:02 +08:00
commit a058881b53
17 changed files with 952 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
export async function copyToClipboard(text: string): Promise<boolean> {
const commands: string[][] = [];
if (process.platform === "darwin") {
commands.push(["pbcopy"]);
} else if (process.platform === "linux") {
commands.push(["xclip", "-selection", "clipboard"]);
commands.push(["xsel", "--clipboard", "--input"]);
}
for (const cmd of commands) {
try {
const proc = Bun.spawn(cmd, {
stdin: "pipe",
stdout: "ignore",
stderr: "ignore",
});
proc.stdin.write(text);
proc.stdin.end();
const exitCode = await proc.exited;
if (exitCode === 0) return true;
} catch {}
}
return false;
}