chore: remove unused exports and redundant hook files (#18681)

This commit is contained in:
Sandy Tao
2026-02-09 15:01:23 -08:00
committed by GitHub
parent ef957a368d
commit 14219bb57d
5 changed files with 1 additions and 142 deletions

View File

@@ -1,7 +0,0 @@
/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
export const REFRESH_MEMORY_COMMAND_NAME = '/refreshmemory';

View File

@@ -1,76 +0,0 @@
/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import type { Message } from '../types.js';
import { MessageType } from '../types.js';
import { debugLogger, type Config } from '@google/gemini-cli-core';
import type { LoadedSettings } from '../../config/settings.js';
export function createShowMemoryAction(
config: Config | null,
settings: LoadedSettings,
addMessage: (message: Message) => void,
) {
return async () => {
if (!config) {
addMessage({
type: MessageType.ERROR,
content: 'Configuration not available. Cannot show memory.',
timestamp: new Date(),
});
return;
}
const debugMode = config.getDebugMode();
if (debugMode) {
debugLogger.log('[DEBUG] Show Memory command invoked.');
}
const currentMemory = config.getUserMemory();
const fileCount = config.getGeminiMdFileCount();
const contextFileName = settings.merged.context.fileName;
const contextFileNames = Array.isArray(contextFileName)
? contextFileName
: [contextFileName];
if (debugMode) {
debugLogger.log(
`[DEBUG] Showing memory. Content from config.getUserMemory() (first 200 chars): ${currentMemory.substring(0, 200)}...`,
);
debugLogger.log(`[DEBUG] Number of context files loaded: ${fileCount}`);
}
if (fileCount > 0) {
const allNamesTheSame = new Set(contextFileNames).size < 2;
const name = allNamesTheSame ? contextFileNames[0] : 'context';
addMessage({
type: MessageType.INFO,
content: `Loaded memory from ${fileCount} ${name} file${
fileCount > 1 ? 's' : ''
}.`,
timestamp: new Date(),
});
}
if (currentMemory && currentMemory.trim().length > 0) {
addMessage({
type: MessageType.INFO,
content: `Current combined memory content:\n\`\`\`markdown\n${currentMemory}\n\`\`\``,
timestamp: new Date(),
});
} else {
addMessage({
type: MessageType.INFO,
content:
fileCount > 0
? 'Hierarchical memory (GEMINI.md or other context files) is loaded but content is empty.'
: 'No hierarchical memory (GEMINI.md or other context files) is currently loaded.',
timestamp: new Date(),
});
}
};
}

View File

@@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
import { lightTheme, darkTheme, ansiTheme } from './theme.js';
import { lightTheme, darkTheme } from './theme.js';
export interface SemanticColors {
text: {
@@ -101,35 +101,3 @@ export const darkSemanticColors: SemanticColors = {
warning: darkTheme.AccentYellow,
},
};
export const ansiSemanticColors: SemanticColors = {
text: {
primary: ansiTheme.Foreground,
secondary: ansiTheme.Gray,
link: ansiTheme.AccentBlue,
accent: ansiTheme.AccentPurple,
response: ansiTheme.Foreground,
},
background: {
primary: ansiTheme.Background,
diff: {
added: ansiTheme.DiffAdded,
removed: ansiTheme.DiffRemoved,
},
},
border: {
default: ansiTheme.Gray,
focused: ansiTheme.AccentBlue,
},
ui: {
comment: ansiTheme.Comment,
symbol: ansiTheme.Gray,
dark: ansiTheme.DarkGray,
gradient: ansiTheme.GradientColors,
},
status: {
error: ansiTheme.AccentRed,
success: ansiTheme.AccentGreen,
warning: ansiTheme.AccentYellow,
},
};

View File

@@ -179,13 +179,6 @@ export const getCachedStringWidth = (str: string): number => {
return width;
};
/**
* Clear the string width cache
*/
export const clearStringWidthCache = (): void => {
stringWidthCache.clear();
};
const regex = ansiRegex();
/* Recursively traverses a JSON-like structure (objects, arrays, primitives)

View File

@@ -52,25 +52,6 @@ export function disableSimulationAfterFallback(): void {
fallbackOccurred = true;
}
/**
* Create a simulated 429 error response
*/
export function createSimulated429Error(): Error {
const error = new Error('Rate limit exceeded (simulated)') as Error & {
status: number;
};
error.status = 429;
return error;
}
/**
* Reset simulation state when switching auth methods
*/
export function resetSimulationState(): void {
fallbackOccurred = false;
resetRequestCounter();
}
/**
* Enable/disable 429 simulation programmatically (for tests)
*/