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

@ -16,7 +16,11 @@ import type {
GeminiClient,
ShellExecutionResult,
} from '@qwen-code/qwen-code-core';
import { isBinary, ShellExecutionService } from '@qwen-code/qwen-code-core';
import {
createDebugLogger,
isBinary,
ShellExecutionService,
} from '@qwen-code/qwen-code-core';
import { type PartListUnion } from '@google/genai';
import type { UseHistoryManagerReturn } from './useHistoryManager.js';
import { SHELL_COMMAND_NAME } from '../constants.js';
@ -29,6 +33,7 @@ import { themeManager } from '../../ui/themes/theme-manager.js';
export const OUTPUT_UPDATE_INTERVAL_MS = 1000;
const MAX_OUTPUT_LENGTH = 10000;
const debugLogger = createDebugLogger('SHELL_COMMAND_PROCESSOR');
function addShellCommandToGeminiHistory(
geminiClient: GeminiClient,
@ -231,7 +236,7 @@ export const useShellCommandProcessor = (
shellExecutionConfig,
);
console.log(terminalHeight, terminalWidth);
debugLogger.debug(terminalHeight, terminalWidth);
executionPid = pid;
if (pid) {