From 048347df84186acdccd2c5ec2aa68c1697ee8bf4 Mon Sep 17 00:00:00 2001 From: chirag-nighut Date: Wed, 25 Mar 2026 11:39:25 +0530 Subject: [PATCH] =?UTF-8?q?fix:=20address=20PR=20review=20=E2=80=94=20TTY?= =?UTF-8?q?=20guard,=20test=20rename,=20unify=20debug=20env=20var?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add process.stdin.isTTY guard before --review prompt to prevent CI hangs - Rename misleading --verbose e2e test to reflect it checks help output - Replace DEBUG with GITNEXUS_VERBOSE for error stack traces Made-with: Cursor --- gitnexus/src/cli/wiki.ts | 11 ++++++++--- gitnexus/test/integration/cli-e2e.test.ts | 4 +--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/gitnexus/src/cli/wiki.ts b/gitnexus/src/cli/wiki.ts index 833338f61..6230a3fff 100644 --- a/gitnexus/src/cli/wiki.ts +++ b/gitnexus/src/cli/wiki.ts @@ -339,8 +339,13 @@ export const wikiCommand = async ( console.log(`\n Tree saved to: ${treeFile}`); console.log(' You can edit this file to remove/rename modules.\n'); - // Ask for confirmation - const answer = await prompt(' Continue with generation? (Y/n/edit): '); + // Ask for confirmation (auto-continue in non-interactive environments) + if (!process.stdin.isTTY) { + console.log(' Non-interactive mode — auto-continuing with generation.\n'); + } + const answer = process.stdin.isTTY + ? await prompt(' Continue with generation? (Y/n/edit): ') + : 'y'; const choice = answer.trim().toLowerCase(); if (choice === 'n' || choice === 'no') { @@ -465,7 +470,7 @@ export const wikiCommand = async ( } } else { console.log(`\n Error: ${err.message}\n`); - if (process.env.DEBUG) { + if (process.env.GITNEXUS_VERBOSE) { console.error(err); } } diff --git a/gitnexus/test/integration/cli-e2e.test.ts b/gitnexus/test/integration/cli-e2e.test.ts index 94edb1590..8bfd05171 100644 --- a/gitnexus/test/integration/cli-e2e.test.ts +++ b/gitnexus/test/integration/cli-e2e.test.ts @@ -305,13 +305,11 @@ describe('CLI end-to-end', () => { expect(combined).not.toMatch(/API key:/); }); - it('wiki --verbose sets GITNEXUS_VERBOSE env', () => { - // --verbose should be accepted as a valid flag (not rejected by Commander) + it('wiki --help includes --verbose flag description', () => { const result = runCliRaw(['wiki', '--help'], repoRoot); if (result.status === null) return; expect(result.status).toBe(0); - // Confirm the flag description is present expect(result.stdout).toMatch(/verbose/i); }); });