feat(memory): make directory search limit on memory discovery configurable with settings.json (#4460)

This commit is contained in:
Brandon Keiji
2025-07-23 14:48:35 -07:00
committed by GitHub
parent 9d3164621a
commit d7a304bcff
11 changed files with 104 additions and 83 deletions

View File

@@ -4,7 +4,10 @@
* SPDX-License-Identifier: Apache-2.0
*/
import { getErrorMessage } from '@google/gemini-cli-core';
import {
getErrorMessage,
loadServerHierarchicalMemory,
} from '@google/gemini-cli-core';
import { MessageType } from '../types.js';
import {
CommandKind,
@@ -81,10 +84,20 @@ export const memoryCommand: SlashCommand = {
);
try {
const result = await context.services.config?.refreshMemory();
const config = await context.services.config;
if (config) {
const { memoryContent, fileCount } =
await loadServerHierarchicalMemory(
config.getWorkingDir(),
config.getDebugMode(),
config.getFileService(),
config.getExtensionContextFilePaths(),
config.getFileFilteringOptions(),
context.services.settings.merged.memoryDiscoveryMaxDirs,
);
config.setUserMemory(memoryContent);
config.setGeminiMdFileCount(fileCount);
if (result) {
const { memoryContent, fileCount } = result;
const successMessage =
memoryContent.length > 0
? `Memory refreshed successfully. Loaded ${memoryContent.length} characters from ${fileCount} file(s).`