mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 08:47:44 +00:00
Revert "feat: Add /config refresh command" (#5060)
This commit is contained in:
@@ -29,7 +29,6 @@ import { statsCommand } from '../ui/commands/statsCommand.js';
|
||||
import { themeCommand } from '../ui/commands/themeCommand.js';
|
||||
import { toolsCommand } from '../ui/commands/toolsCommand.js';
|
||||
import { vimCommand } from '../ui/commands/vimCommand.js';
|
||||
import { configCommand } from '../ui/commands/configCommand.js';
|
||||
|
||||
/**
|
||||
* Loads the core, hard-coded slash commands that are an integral part
|
||||
@@ -55,7 +54,6 @@ export class BuiltinCommandLoader implements ICommandLoader {
|
||||
compressCommand,
|
||||
copyCommand,
|
||||
corgiCommand,
|
||||
configCommand,
|
||||
docsCommand,
|
||||
editorCommand,
|
||||
extensionsCommand,
|
||||
|
||||
@@ -39,12 +39,8 @@ import { EditorSettingsDialog } from './components/EditorSettingsDialog.js';
|
||||
import { ShellConfirmationDialog } from './components/ShellConfirmationDialog.js';
|
||||
import { Colors } from './colors.js';
|
||||
import { Help } from './components/Help.js';
|
||||
import {
|
||||
loadHierarchicalGeminiMemory,
|
||||
loadCliConfig,
|
||||
parseArguments,
|
||||
} from '../config/config.js';
|
||||
import { LoadedSettings, loadSettings } from '../config/settings.js';
|
||||
import { loadHierarchicalGeminiMemory } from '../config/config.js';
|
||||
import { LoadedSettings } from '../config/settings.js';
|
||||
import { Tips } from './components/Tips.js';
|
||||
import { ConsolePatcher } from './utils/ConsolePatcher.js';
|
||||
import { registerCleanup } from '../utils/cleanup.js';
|
||||
@@ -66,7 +62,6 @@ import {
|
||||
AuthType,
|
||||
type IdeContext,
|
||||
ideContext,
|
||||
sessionId,
|
||||
} from '@google/gemini-cli-core';
|
||||
import { validateAuthMethod } from '../config/auth.js';
|
||||
import { useLogger } from './hooks/useLogger.js';
|
||||
@@ -94,7 +89,6 @@ import { OverflowProvider } from './contexts/OverflowContext.js';
|
||||
import { ShowMoreLines } from './components/ShowMoreLines.js';
|
||||
import { PrivacyNotice } from './privacy/PrivacyNotice.js';
|
||||
import { appEvents, AppEvent } from '../utils/events.js';
|
||||
import { loadExtensions } from '../config/extension.js';
|
||||
|
||||
const CTRL_EXIT_PROMPT_DURATION_MS = 1000;
|
||||
|
||||
@@ -113,14 +107,12 @@ export const AppWrapper = (props: AppProps) => (
|
||||
</SessionStatsProvider>
|
||||
);
|
||||
|
||||
const App = (props: AppProps) => {
|
||||
const [config, setConfig] = useState<Config>(props.config);
|
||||
const [settings, setSettings] = useState<LoadedSettings>(props.settings);
|
||||
const App = ({ config, settings, startupWarnings = [], version }: AppProps) => {
|
||||
const isFocused = useFocus();
|
||||
useBracketedPaste();
|
||||
const [updateMessage, setUpdateMessage] = useState<string | null>(null);
|
||||
const { stdout } = useStdout();
|
||||
const nightly = props.version.includes('nightly');
|
||||
const nightly = version.includes('nightly');
|
||||
|
||||
useEffect(() => {
|
||||
checkForUpdates().then(setUpdateMessage);
|
||||
@@ -315,22 +307,6 @@ const App = (props: AppProps) => {
|
||||
}
|
||||
}, [config, addItem, settings.merged]);
|
||||
|
||||
const refreshConfig = useCallback(async () => {
|
||||
const newSettings = loadSettings(process.cwd());
|
||||
const newExtensions = loadExtensions(process.cwd());
|
||||
const argv = await parseArguments();
|
||||
const newConfig = await loadCliConfig(
|
||||
newSettings.merged,
|
||||
newExtensions,
|
||||
sessionId,
|
||||
argv,
|
||||
);
|
||||
await newConfig.initialize();
|
||||
setConfig(newConfig);
|
||||
setSettings(newSettings);
|
||||
setGeminiMdFileCount(newConfig.getGeminiMdFileCount());
|
||||
}, []);
|
||||
|
||||
// Watch for model changes (e.g., from Flash fallback)
|
||||
useEffect(() => {
|
||||
const checkModelChange = () => {
|
||||
@@ -498,7 +474,6 @@ const App = (props: AppProps) => {
|
||||
openPrivacyNotice,
|
||||
toggleVimEnabled,
|
||||
setIsProcessing,
|
||||
refreshConfig,
|
||||
);
|
||||
|
||||
const {
|
||||
@@ -802,7 +777,7 @@ const App = (props: AppProps) => {
|
||||
{!settings.merged.hideBanner && (
|
||||
<Header
|
||||
terminalWidth={terminalWidth}
|
||||
version={props.version}
|
||||
version={version}
|
||||
nightly={nightly}
|
||||
/>
|
||||
)}
|
||||
@@ -846,7 +821,7 @@ const App = (props: AppProps) => {
|
||||
{showHelp && <Help commands={slashCommands} />}
|
||||
|
||||
<Box flexDirection="column" ref={mainControlsRef}>
|
||||
{props.startupWarnings && props.startupWarnings.length > 0 && (
|
||||
{startupWarnings.length > 0 && (
|
||||
<Box
|
||||
borderStyle="round"
|
||||
borderColor={Colors.AccentYellow}
|
||||
@@ -854,7 +829,7 @@ const App = (props: AppProps) => {
|
||||
marginY={1}
|
||||
flexDirection="column"
|
||||
>
|
||||
{props.startupWarnings.map((warning, index) => (
|
||||
{startupWarnings.map((warning, index) => (
|
||||
<Text key={index} color={Colors.AccentYellow}>
|
||||
{warning}
|
||||
</Text>
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2025 Google LLC
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import {
|
||||
CommandKind,
|
||||
SlashCommand,
|
||||
SlashCommandActionReturn,
|
||||
} from './types.js';
|
||||
|
||||
export const configCommand: SlashCommand = {
|
||||
name: 'config',
|
||||
description: 'Commands for interacting with the CLI configuration.',
|
||||
kind: CommandKind.BUILT_IN,
|
||||
subCommands: [
|
||||
{
|
||||
name: 'refresh',
|
||||
description: 'Reload settings and extensions from the filesystem.',
|
||||
kind: CommandKind.BUILT_IN,
|
||||
action: async (context): Promise<SlashCommandActionReturn> => {
|
||||
await context.ui.refreshConfig();
|
||||
return {
|
||||
type: 'message',
|
||||
messageType: 'info',
|
||||
content:
|
||||
'Configuration, extensions, memory, and tools have been refreshed.',
|
||||
};
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
@@ -59,7 +59,6 @@ export interface CommandContext {
|
||||
/** Toggles a special display mode. */
|
||||
toggleCorgiMode: () => void;
|
||||
toggleVimEnabled: () => Promise<boolean>;
|
||||
refreshConfig: () => Promise<void>;
|
||||
};
|
||||
// Session-specific data
|
||||
session: {
|
||||
|
||||
@@ -50,7 +50,6 @@ export const useSlashCommandProcessor = (
|
||||
openPrivacyNotice: () => void,
|
||||
toggleVimEnabled: () => Promise<boolean>,
|
||||
setIsProcessing: (isProcessing: boolean) => void,
|
||||
refreshConfig: () => Promise<void>,
|
||||
) => {
|
||||
const session = useSessionStats();
|
||||
const [commands, setCommands] = useState<readonly SlashCommand[]>([]);
|
||||
@@ -159,7 +158,6 @@ export const useSlashCommandProcessor = (
|
||||
setPendingItem: setPendingCompressionItem,
|
||||
toggleCorgiMode,
|
||||
toggleVimEnabled,
|
||||
refreshConfig,
|
||||
},
|
||||
session: {
|
||||
stats: session.stats,
|
||||
@@ -182,7 +180,6 @@ export const useSlashCommandProcessor = (
|
||||
toggleCorgiMode,
|
||||
toggleVimEnabled,
|
||||
sessionShellAllowlist,
|
||||
refreshConfig,
|
||||
],
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user