prefactor(commands): Command Service Prefactor for Extensible Commands (#4511)

This commit is contained in:
Abhi
2025-07-20 16:57:34 -04:00
committed by GitHub
parent 7a9821607b
commit 2a95c8287e
36 changed files with 919 additions and 720 deletions

View File

@@ -6,15 +6,21 @@
import { getErrorMessage } from '@google/gemini-cli-core';
import { MessageType } from '../types.js';
import { SlashCommand, SlashCommandActionReturn } from './types.js';
import {
CommandKind,
SlashCommand,
SlashCommandActionReturn,
} from './types.js';
export const memoryCommand: SlashCommand = {
name: 'memory',
description: 'Commands for interacting with memory.',
kind: CommandKind.BUILT_IN,
subCommands: [
{
name: 'show',
description: 'Show the current memory contents.',
kind: CommandKind.BUILT_IN,
action: async (context) => {
const memoryContent = context.services.config?.getUserMemory() || '';
const fileCount = context.services.config?.getGeminiMdFileCount() || 0;
@@ -36,6 +42,7 @@ export const memoryCommand: SlashCommand = {
{
name: 'add',
description: 'Add content to the memory.',
kind: CommandKind.BUILT_IN,
action: (context, args): SlashCommandActionReturn | void => {
if (!args || args.trim() === '') {
return {
@@ -63,6 +70,7 @@ export const memoryCommand: SlashCommand = {
{
name: 'refresh',
description: 'Refresh the memory from the source.',
kind: CommandKind.BUILT_IN,
action: async (context) => {
context.ui.addItem(
{