From fd419d162b5abfe471612b1cefe52b0877428ca1 Mon Sep 17 00:00:00 2001 From: Nikhil Patel Date: Tue, 22 Apr 2025 16:43:54 +0530 Subject: [PATCH 1/3] feat(bug-report): print bug report URL in terminal instead of opening browser (#510) --- .../components/chat/terminal-chat-input.tsx | 18 ++++++------------ codex-cli/src/components/help-overlay.tsx | 2 +- codex-cli/src/utils/slash-commands.ts | 2 +- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/codex-cli/src/components/chat/terminal-chat-input.tsx b/codex-cli/src/components/chat/terminal-chat-input.tsx index aad2e6b3c..0b082c296 100644 --- a/codex-cli/src/components/chat/terminal-chat-input.tsx +++ b/codex-cli/src/components/chat/terminal-chat-input.tsx @@ -470,19 +470,16 @@ export default function TerminalChatInput({ setInput(""); try { - // Dynamically import dependencies to avoid unnecessary bundle size - const [{ default: open }, os] = await Promise.all([ - import("open"), - import("node:os"), - ]); + // Dynamically import only OS info to build the report URL + const os = await import("node:os"); - // Lazy import CLI_VERSION to avoid circular deps + // Lazy import CLI_VERSION and URL builder const { CLI_VERSION } = await import("../../utils/session.js"); - const { buildBugReportUrl } = await import( "../../utils/bug-report.js" ); + // Construct the bug report URL const url = buildBugReportUrl({ items: items ?? [], cliVersion: CLI_VERSION, @@ -492,10 +489,7 @@ export default function TerminalChatInput({ .join(" | "), }); - // Open the URL in the user's default browser - await open(url, { wait: false }); - - // Inform the user in the chat history + // Display the URL in the chat history for users in terminal-only sessions setItems((prev) => [ ...prev, { @@ -505,7 +499,7 @@ export default function TerminalChatInput({ content: [ { 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}`, }, ], }, diff --git a/codex-cli/src/components/help-overlay.tsx b/codex-cli/src/components/help-overlay.tsx index 6eeffb9ef..de3d754e6 100644 --- a/codex-cli/src/components/help-overlay.tsx +++ b/codex-cli/src/components/help-overlay.tsx @@ -53,7 +53,7 @@ export default function HelpOverlay({ /clearhistory – clear command history - /bug – file a bug report with session log + /bug – generate a prefilled GitHub issue URL with session log /diff – view working tree git diff diff --git a/codex-cli/src/utils/slash-commands.ts b/codex-cli/src/utils/slash-commands.ts index b276c4913..cb8f16c2f 100644 --- a/codex-cli/src/utils/slash-commands.ts +++ b/codex-cli/src/utils/slash-commands.ts @@ -23,7 +23,7 @@ export const SLASH_COMMANDS: Array = [ { command: "/help", description: "Show list of commands" }, { command: "/model", description: "Open model 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", description: From c79cf41945f4225eab71151da02b4e89aebf9274 Mon Sep 17 00:00:00 2001 From: Thibault Sottiaux Date: Tue, 22 Apr 2025 10:36:49 -0400 Subject: [PATCH 2/3] Update terminal-chat-input.tsx --- codex-cli/src/components/chat/terminal-chat-input.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/codex-cli/src/components/chat/terminal-chat-input.tsx b/codex-cli/src/components/chat/terminal-chat-input.tsx index 0b082c296..039196c9b 100644 --- a/codex-cli/src/components/chat/terminal-chat-input.tsx +++ b/codex-cli/src/components/chat/terminal-chat-input.tsx @@ -470,16 +470,16 @@ export default function TerminalChatInput({ setInput(""); try { - // Dynamically import only OS info to build the report URL + // Dynamically import dependencies to avoid unnecessary bundle size. const os = await import("node:os"); - // Lazy import CLI_VERSION and URL builder + // Lazy import CLI_VERSION to avoid circular deps. const { CLI_VERSION } = await import("../../utils/session.js"); const { buildBugReportUrl } = await import( "../../utils/bug-report.js" ); - // Construct the bug report URL + // Construct the bug report URL. const url = buildBugReportUrl({ items: items ?? [], cliVersion: CLI_VERSION, @@ -489,7 +489,7 @@ export default function TerminalChatInput({ .join(" | "), }); - // Display the URL in the chat history for users in terminal-only sessions + // Display the URL in the chat history. setItems((prev) => [ ...prev, { @@ -505,7 +505,7 @@ export default function TerminalChatInput({ }, ]); } catch (error) { - // If anything went wrong, notify the user + // If anything went wrong, notify the user. setItems((prev) => [ ...prev, { From 003809a810df88c9033cb14d133c8f7a43f784b2 Mon Sep 17 00:00:00 2001 From: Nikhil Patel Date: Thu, 24 Apr 2025 15:11:57 +0530 Subject: [PATCH 3/3] refactor(bug-report): remove redundant comments in /bug handler --- codex-cli/src/components/chat/terminal-chat-input.tsx | 5 ----- codex-cli/src/components/help-overlay.tsx | 3 ++- codex-cli/src/utils/slash-commands.ts | 5 ++++- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/codex-cli/src/components/chat/terminal-chat-input.tsx b/codex-cli/src/components/chat/terminal-chat-input.tsx index 039196c9b..070f08f0c 100644 --- a/codex-cli/src/components/chat/terminal-chat-input.tsx +++ b/codex-cli/src/components/chat/terminal-chat-input.tsx @@ -470,16 +470,12 @@ export default function TerminalChatInput({ setInput(""); try { - // Dynamically import dependencies to avoid unnecessary bundle size. const os = await import("node:os"); - - // Lazy import CLI_VERSION to avoid circular deps. const { CLI_VERSION } = await import("../../utils/session.js"); const { buildBugReportUrl } = await import( "../../utils/bug-report.js" ); - // Construct the bug report URL. const url = buildBugReportUrl({ items: items ?? [], cliVersion: CLI_VERSION, @@ -489,7 +485,6 @@ export default function TerminalChatInput({ .join(" | "), }); - // Display the URL in the chat history. setItems((prev) => [ ...prev, { diff --git a/codex-cli/src/components/help-overlay.tsx b/codex-cli/src/components/help-overlay.tsx index de3d754e6..d302f7551 100644 --- a/codex-cli/src/components/help-overlay.tsx +++ b/codex-cli/src/components/help-overlay.tsx @@ -53,7 +53,8 @@ export default function HelpOverlay({ /clearhistory – clear command history - /bug – generate a prefilled GitHub issue URL with session log + /bug – generate a prefilled GitHub issue URL + with session log /diff – view working tree git diff diff --git a/codex-cli/src/utils/slash-commands.ts b/codex-cli/src/utils/slash-commands.ts index cb8f16c2f..4ccc3a9fc 100644 --- a/codex-cli/src/utils/slash-commands.ts +++ b/codex-cli/src/utils/slash-commands.ts @@ -23,7 +23,10 @@ export const SLASH_COMMANDS: Array = [ { command: "/help", description: "Show list of commands" }, { command: "/model", description: "Open model selection panel" }, { command: "/approval", description: "Open approval mode selection panel" }, - { command: "/bug", description: "Generate a prefilled GitHub issue URL with session log" }, + { + command: "/bug", + description: "Generate a prefilled GitHub issue URL with session log", + }, { command: "/diff", description: