From 2163f5ac344c435a846fe39bf3eaf4f9250b5fdb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 17 May 2026 21:14:39 +0000 Subject: [PATCH 1/7] Initial plan From 8605da37bbfbd3ae18ffd5f28f4bb4adc6f22b31 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 17 May 2026 21:17:22 +0000 Subject: [PATCH 2/7] feat: add issue command to open GitHub issue page Agent-Logs-Url: https://github.com/bernoussama/lazyshell/sessions/ff277bec-e58e-4fdf-b30f-c9b784d45a8c --- README.md | 3 +++ src/index.ts | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/README.md b/README.md index 6af503a..812086c 100644 --- a/README.md +++ b/README.md @@ -117,6 +117,9 @@ On first run, LazyShell will guide you through: ```bash # Open configuration UI lazyshell config + +# Open GitHub page to create a new issue +lazyshell issue ``` ### Manual Environment Variables (Optional) diff --git a/src/index.ts b/src/index.ts index e3d97a9..2af3758 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,6 +1,7 @@ import { Command } from 'commander'; import { select, text as input, spinner, outro, isCancel, cancel, intro } from '@clack/prompts'; import chalk from 'chalk'; +import { exec } from 'child_process'; import { info, print, runCommand, printWrapped } from './utils'; import { generateCommandStruct, getDefaultModel, getModelFromConfig, type ModelConfig } from './lib/ai'; import { getOrInitializeConfig } from './lib/config'; @@ -52,6 +53,26 @@ async function refineCommand(currentPrompt: string, command: string): Promise { + const issueUrl = 'https://github.com/bernoussama/lazyshell/issues/new'; + const openCommand = + process.platform === 'darwin' + ? `open "${issueUrl}"` + : process.platform === 'win32' + ? `start "" "${issueUrl}"` + : `xdg-open "${issueUrl}"`; + + await new Promise((resolve, reject) => { + exec(openCommand, error => { + if (error) { + reject(error); + return; + } + resolve(); + }); + }); +} + const program = new Command(); program .version(require('../package.json').version) @@ -125,4 +146,17 @@ program await showConfigUI(); }); +program + .command('issue') + .description('Open browser to create a new GitHub issue') + .action(async () => { + try { + await openIssuePage(); + await print(chalk.green('Opened browser to create a new issue.')); + } catch (error) { + console.error(chalk.red(`Failed to open issue page: ${error}`)); + process.exit(1); + } + }); + program.parse(process.argv); From ddc21d0836c11872a4bfea7c64a16564fad44351 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 17 May 2026 21:18:20 +0000 Subject: [PATCH 3/7] fix: improve issue command error reporting Agent-Logs-Url: https://github.com/bernoussama/lazyshell/sessions/ff277bec-e58e-4fdf-b30f-c9b784d45a8c --- src/index.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/index.ts b/src/index.ts index 2af3758..4d7243d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -63,9 +63,10 @@ async function openIssuePage(): Promise { : `xdg-open "${issueUrl}"`; await new Promise((resolve, reject) => { - exec(openCommand, error => { + exec(openCommand, (error, _stdout, stderr) => { if (error) { - reject(error); + const details = stderr?.trim() || error.message; + reject(new Error(details)); return; } resolve(); @@ -154,7 +155,8 @@ program await openIssuePage(); await print(chalk.green('Opened browser to create a new issue.')); } catch (error) { - console.error(chalk.red(`Failed to open issue page: ${error}`)); + const message = error instanceof Error ? error.message : String(error); + console.error(chalk.red(`Failed to open issue page: ${message}`)); process.exit(1); } }); From 2e2ceb118a3a704209b76cdea5a547be3c802a5e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 17 May 2026 21:19:17 +0000 Subject: [PATCH 4/7] chore: polish issue command messaging Agent-Logs-Url: https://github.com/bernoussama/lazyshell/sessions/ff277bec-e58e-4fdf-b30f-c9b784d45a8c --- src/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 4d7243d..4c78b85 100644 --- a/src/index.ts +++ b/src/index.ts @@ -63,8 +63,9 @@ async function openIssuePage(): Promise { : `xdg-open "${issueUrl}"`; await new Promise((resolve, reject) => { - exec(openCommand, (error, _stdout, stderr) => { + exec(openCommand, (error, ...output) => { if (error) { + const stderr = typeof output[1] === 'string' ? output[1] : ''; const details = stderr?.trim() || error.message; reject(new Error(details)); return; @@ -153,7 +154,7 @@ program .action(async () => { try { await openIssuePage(); - await print(chalk.green('Opened browser to create a new issue.')); + await print(chalk.green('Attempted to open browser to create a new issue.')); } catch (error) { const message = error instanceof Error ? error.message : String(error); console.error(chalk.red(`Failed to open issue page: ${message}`)); From e332d8b28d9d96c866269a83b224fedb8d09a176 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 17 May 2026 21:20:15 +0000 Subject: [PATCH 5/7] refactor: clarify issue command exec callback Agent-Logs-Url: https://github.com/bernoussama/lazyshell/sessions/ff277bec-e58e-4fdf-b30f-c9b784d45a8c --- src/index.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/index.ts b/src/index.ts index 4c78b85..4d7243d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -63,9 +63,8 @@ async function openIssuePage(): Promise { : `xdg-open "${issueUrl}"`; await new Promise((resolve, reject) => { - exec(openCommand, (error, ...output) => { + exec(openCommand, (error, _stdout, stderr) => { if (error) { - const stderr = typeof output[1] === 'string' ? output[1] : ''; const details = stderr?.trim() || error.message; reject(new Error(details)); return; @@ -154,7 +153,7 @@ program .action(async () => { try { await openIssuePage(); - await print(chalk.green('Attempted to open browser to create a new issue.')); + await print(chalk.green('Opened browser to create a new issue.')); } catch (error) { const message = error instanceof Error ? error.message : String(error); console.error(chalk.red(`Failed to open issue page: ${message}`)); From fdbb3c65217d9ee33436a5c1fd7358619bbd322d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 17 May 2026 21:21:17 +0000 Subject: [PATCH 6/7] fix: use execFile for issue URL opening Agent-Logs-Url: https://github.com/bernoussama/lazyshell/sessions/ff277bec-e58e-4fdf-b30f-c9b784d45a8c --- src/index.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/index.ts b/src/index.ts index 4d7243d..fc8ca54 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,7 +1,7 @@ import { Command } from 'commander'; import { select, text as input, spinner, outro, isCancel, cancel, intro } from '@clack/prompts'; import chalk from 'chalk'; -import { exec } from 'child_process'; +import { execFile } from 'child_process'; import { info, print, runCommand, printWrapped } from './utils'; import { generateCommandStruct, getDefaultModel, getModelFromConfig, type ModelConfig } from './lib/ai'; import { getOrInitializeConfig } from './lib/config'; @@ -55,15 +55,15 @@ async function refineCommand(currentPrompt: string, command: string): Promise { const issueUrl = 'https://github.com/bernoussama/lazyshell/issues/new'; - const openCommand = + const [command, args] = process.platform === 'darwin' - ? `open "${issueUrl}"` + ? ['open', [issueUrl]] : process.platform === 'win32' - ? `start "" "${issueUrl}"` - : `xdg-open "${issueUrl}"`; + ? ['cmd', ['/c', 'start', '', issueUrl]] + : ['xdg-open', [issueUrl]]; await new Promise((resolve, reject) => { - exec(openCommand, (error, _stdout, stderr) => { + execFile(command, args, (error, _stdout, stderr) => { if (error) { const details = stderr?.trim() || error.message; reject(new Error(details)); @@ -153,7 +153,7 @@ program .action(async () => { try { await openIssuePage(); - await print(chalk.green('Opened browser to create a new issue.')); + await print(chalk.green('Attempted to open browser to create a new issue.')); } catch (error) { const message = error instanceof Error ? error.message : String(error); console.error(chalk.red(`Failed to open issue page: ${message}`)); From ea84342e15d9fb3ad5f1eea588a13e889ff45465 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 17 May 2026 21:22:15 +0000 Subject: [PATCH 7/7] chore: refine issue command user messages Agent-Logs-Url: https://github.com/bernoussama/lazyshell/sessions/ff277bec-e58e-4fdf-b30f-c9b784d45a8c --- src/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index fc8ca54..a9a6ce4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -66,7 +66,7 @@ async function openIssuePage(): Promise { execFile(command, args, (error, _stdout, stderr) => { if (error) { const details = stderr?.trim() || error.message; - reject(new Error(details)); + reject(new Error(`Failed to execute browser command: ${details}`)); return; } resolve(); @@ -153,7 +153,7 @@ program .action(async () => { try { await openIssuePage(); - await print(chalk.green('Attempted to open browser to create a new issue.')); + await print(chalk.green('Opened issue page in browser.')); } catch (error) { const message = error instanceof Error ? error.message : String(error); console.error(chalk.red(`Failed to open issue page: ${message}`));