fix: address PR review — TTY guard, test rename, unify debug env var

- 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
This commit is contained in:
chirag-nighut 2026-03-25 11:39:25 +05:30
parent f17bde69ba
commit 048347df84
2 changed files with 9 additions and 6 deletions

View file

@ -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);
}
}

View file

@ -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);
});
});