mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-05-01 05:00:46 +00:00
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
50 lines
1.5 KiB
TypeScript
50 lines
1.5 KiB
TypeScript
/**
|
|
* @license
|
|
* Copyright 2025 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
import { Box, Text } from 'ink';
|
|
import { theme } from '../semantic-colors.js';
|
|
import { useKeypress } from '../hooks/useKeypress.js';
|
|
import { relaunchApp } from '../../utils/processUtils.js';
|
|
import { type RestartReason } from '../hooks/useIdeTrustListener.js';
|
|
import { createDebugLogger } from '@qwen-code/qwen-code-core';
|
|
|
|
interface IdeTrustChangeDialogProps {
|
|
reason: RestartReason;
|
|
}
|
|
|
|
const debugLogger = createDebugLogger('IDE_TRUST_DIALOG');
|
|
|
|
export const IdeTrustChangeDialog = ({ reason }: IdeTrustChangeDialogProps) => {
|
|
useKeypress(
|
|
(key) => {
|
|
if (key.name === 'r' || key.name === 'R') {
|
|
relaunchApp();
|
|
}
|
|
},
|
|
{ isActive: true },
|
|
);
|
|
|
|
let message = 'Workspace trust has changed.';
|
|
if (reason === 'NONE') {
|
|
// This should not happen, but provides a fallback and a debug log.
|
|
debugLogger.error(
|
|
'IdeTrustChangeDialog rendered with unexpected reason "NONE"',
|
|
);
|
|
} else if (reason === 'CONNECTION_CHANGE') {
|
|
message =
|
|
'Workspace trust has changed due to a change in the IDE connection.';
|
|
} else if (reason === 'TRUST_CHANGE') {
|
|
message = 'Workspace trust has changed due to a change in the IDE trust.';
|
|
}
|
|
|
|
return (
|
|
<Box borderStyle="round" borderColor={theme.status.warning} paddingX={1}>
|
|
<Text color={theme.status.warning}>
|
|
{message} Press 'r' to restart Gemini to apply the changes.
|
|
</Text>
|
|
</Box>
|
|
);
|
|
};
|