feat(bug-report): print bug report URL in terminal instead of opening browser (#510) (#528)

Solves #510 
This PR changes the `/bug` command to print the URL into the terminal
(so it works in headless sessions) instead of trying to open a browser.

---------

Co-authored-by: Thibault Sottiaux <tibo@openai.com>
This commit is contained in:
nvp159
2025-04-25 05:30:14 +05:30
committed by GitHub
parent 36a5a02d5c
commit 5e40d9d221
3 changed files with 9 additions and 16 deletions

View File

@@ -470,15 +470,8 @@ export default function TerminalChatInput({
setInput(""); setInput("");
try { try {
// Dynamically import dependencies to avoid unnecessary bundle size const os = await import("node:os");
const [{ default: open }, os] = await Promise.all([
import("open"),
import("node:os"),
]);
// Lazy import CLI_VERSION to avoid circular deps
const { CLI_VERSION } = await import("../../utils/session.js"); const { CLI_VERSION } = await import("../../utils/session.js");
const { buildBugReportUrl } = await import( const { buildBugReportUrl } = await import(
"../../utils/bug-report.js" "../../utils/bug-report.js"
); );
@@ -492,10 +485,6 @@ export default function TerminalChatInput({
.join(" | "), .join(" | "),
}); });
// Open the URL in the user's default browser
await open(url, { wait: false });
// Inform the user in the chat history
setItems((prev) => [ setItems((prev) => [
...prev, ...prev,
{ {
@@ -505,13 +494,13 @@ export default function TerminalChatInput({
content: [ content: [
{ {
type: "input_text", type: "input_text",
text: "📋 Opened browser to file a bug report. Please include any context that might help us fix the issue!", text: `🔗 Bug report URL: ${url}`,
}, },
], ],
}, },
]); ]);
} catch (error) { } catch (error) {
// If anything went wrong, notify the user // If anything went wrong, notify the user.
setItems((prev) => [ setItems((prev) => [
...prev, ...prev,
{ {

View File

@@ -53,7 +53,8 @@ export default function HelpOverlay({
<Text color="cyan">/clearhistory</Text> clear command history <Text color="cyan">/clearhistory</Text> clear command history
</Text> </Text>
<Text> <Text>
<Text color="cyan">/bug</Text> file a bug report with session log <Text color="cyan">/bug</Text> generate a prefilled GitHub issue URL
with session log
</Text> </Text>
<Text> <Text>
<Text color="cyan">/diff</Text> view working tree git diff <Text color="cyan">/diff</Text> view working tree git diff

View File

@@ -23,7 +23,10 @@ export const SLASH_COMMANDS: Array<SlashCommand> = [
{ command: "/help", description: "Show list of commands" }, { command: "/help", description: "Show list of commands" },
{ command: "/model", description: "Open model selection panel" }, { command: "/model", description: "Open model selection panel" },
{ command: "/approval", description: "Open approval mode selection panel" }, { command: "/approval", description: "Open approval mode selection panel" },
{ command: "/bug", description: "Generate a prefilled GitHub bug report" }, {
command: "/bug",
description: "Generate a prefilled GitHub issue URL with session log",
},
{ {
command: "/diff", command: "/diff",
description: description: