feat(cli): migrate console calls to debugLogger and stdioHelpers (M3 Phase 7-9)

Route CLI console.* calls to structured logging:
- Debug/internal diagnostics → debugLogger (logfile)
- User-facing output → writeStdoutLine/writeStderrLine/clearScreen (stdioHelpers)
- Add stdioHelpers.ts with writeStdoutLine, writeStderrLine, clearScreen
- Migrate pre-session files (gemini.tsx, sandbox.ts, config.ts) to stdioHelpers
- Migrate extension/MCP commands to stdioHelpers
- Migrate non-interactive session/control to debugLogger
- Migrate UI hooks and components to debugLogger
This commit is contained in:
tanzhenxin 2026-01-26 15:02:37 +08:00
parent 45df0e8b82
commit 7995c65571
82 changed files with 606 additions and 485 deletions

View file

@ -5,6 +5,7 @@
*/
import process from 'node:process';
import { createDebugLogger } from '@qwen-code/qwen-code-core';
export enum AttentionNotificationReason {
ToolApproval = 'tool_approval',
@ -17,6 +18,7 @@ export interface TerminalNotificationOptions {
}
const TERMINAL_BELL = '\u0007';
const debugLogger = createDebugLogger('ATTENTION_NOTIFICATION');
/**
* Grabs the user's attention by emitting the terminal bell character.
@ -43,7 +45,7 @@ export function notifyTerminalAttention(
stream.write(TERMINAL_BELL);
return true;
} catch (error) {
console.warn('Failed to send terminal bell:', error);
debugLogger.warn('Failed to send terminal bell:', error);
return false;
}
}