Skip to content

Commit 289f167

Browse files
ericc-chopencode
andcommitted
feat: fallback to output command if clipboardy fails with Claude Code flag
If copying to clipboard fails when using the Claude Code flag, output the command to the user instead of throwing. This improves UX for headless/unsupported environments. 🤖 Generated with [opencode](https://opencode.ai) Co-Authored-By: opencode <noreply@opencode.ai>
1 parent 8692006 commit 289f167

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/start.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,15 @@ export async function runServer(options: RunServerOptions): Promise<void> {
8989
"claude",
9090
)
9191

92-
clipboard.writeSync(command)
93-
consola.success("Copied Claude Code command to clipboard!")
92+
try {
93+
clipboard.writeSync(command)
94+
consola.success("Copied Claude Code command to clipboard!")
95+
} catch {
96+
consola.warn(
97+
"Failed to copy to clipboard. Here is the Claude Code command:",
98+
)
99+
consola.log(command)
100+
}
94101
}
95102

96103
consola.box(

0 commit comments

Comments
 (0)