From f73d662260c1b94f0405d3ef76d5238a47676412 Mon Sep 17 00:00:00 2001 From: "koalazf.99" Date: Tue, 26 Aug 2025 19:44:02 +0800 Subject: [PATCH] update: remove context.services.config?.getUserMemory() logic from project level memory show --- packages/cli/src/ui/commands/memoryCommand.ts | 41 ++++++++++++------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/packages/cli/src/ui/commands/memoryCommand.ts b/packages/cli/src/ui/commands/memoryCommand.ts index 2c1bda37..ec778f7a 100644 --- a/packages/cli/src/ui/commands/memoryCommand.ts +++ b/packages/cli/src/ui/commands/memoryCommand.ts @@ -51,23 +51,34 @@ export const memoryCommand: SlashCommand = { description: 'Show project-level memory contents.', kind: CommandKind.BUILT_IN, action: async (context) => { - const memoryContent = - context.services.config?.getUserMemory() || ''; - const fileCount = - context.services.config?.getGeminiMdFileCount() || 0; + try { + const projectMemoryPath = path.join(process.cwd(), 'QWEN.md'); + const memoryContent = await fs.readFile( + projectMemoryPath, + 'utf-8', + ); - const messageContent = - memoryContent.length > 0 - ? `Project memory content from ${fileCount} file(s):\n\n---\n${memoryContent}\n---` - : 'Project memory is currently empty.'; + const messageContent = + memoryContent.trim().length > 0 + ? `Project memory content from ${projectMemoryPath}:\n\n---\n${memoryContent}\n---` + : 'Project memory is currently empty.'; - context.ui.addItem( - { - type: MessageType.INFO, - text: messageContent, - }, - Date.now(), - ); + context.ui.addItem( + { + type: MessageType.INFO, + text: messageContent, + }, + Date.now(), + ); + } catch (_error) { + context.ui.addItem( + { + type: MessageType.INFO, + text: 'Project memory file not found or is currently empty.', + }, + Date.now(), + ); + } }, }, {