mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-06-23 09:47:45 -07:00
chore: clean up launched memory features (#26941)
Co-authored-by: Jenna Inouye <jinouye@google.com>
This commit is contained in:
@@ -28,8 +28,8 @@ const mockCommands: readonly SlashCommand[] = [
|
||||
altNames: ['mem'],
|
||||
subCommands: [
|
||||
{
|
||||
name: 'add',
|
||||
description: 'Add to memory',
|
||||
name: 'list',
|
||||
description: 'List memory files',
|
||||
action: async () => {},
|
||||
kind: CommandKind.BUILT_IN,
|
||||
},
|
||||
@@ -64,27 +64,27 @@ describe('parseSlashCommand', () => {
|
||||
});
|
||||
|
||||
it('should parse a subcommand', () => {
|
||||
const result = parseSlashCommand('/memory add', mockCommands);
|
||||
expect(result.commandToExecute?.name).toBe('add');
|
||||
const result = parseSlashCommand('/memory list', mockCommands);
|
||||
expect(result.commandToExecute?.name).toBe('list');
|
||||
expect(result.args).toBe('');
|
||||
expect(result.canonicalPath).toEqual(['memory', 'add']);
|
||||
expect(result.canonicalPath).toEqual(['memory', 'list']);
|
||||
});
|
||||
|
||||
it('should parse a subcommand with arguments', () => {
|
||||
const result = parseSlashCommand(
|
||||
'/memory add some important data',
|
||||
'/memory list some important data',
|
||||
mockCommands,
|
||||
);
|
||||
expect(result.commandToExecute?.name).toBe('add');
|
||||
expect(result.commandToExecute?.name).toBe('list');
|
||||
expect(result.args).toBe('some important data');
|
||||
expect(result.canonicalPath).toEqual(['memory', 'add']);
|
||||
expect(result.canonicalPath).toEqual(['memory', 'list']);
|
||||
});
|
||||
|
||||
it('should handle a command alias', () => {
|
||||
const result = parseSlashCommand('/mem add some data', mockCommands);
|
||||
expect(result.commandToExecute?.name).toBe('add');
|
||||
const result = parseSlashCommand('/mem list some data', mockCommands);
|
||||
expect(result.commandToExecute?.name).toBe('list');
|
||||
expect(result.args).toBe('some data');
|
||||
expect(result.canonicalPath).toEqual(['memory', 'add']);
|
||||
expect(result.canonicalPath).toEqual(['memory', 'list']);
|
||||
});
|
||||
|
||||
it('should handle a subcommand alias', () => {
|
||||
@@ -113,12 +113,12 @@ describe('parseSlashCommand', () => {
|
||||
|
||||
it('should handle extra whitespace', () => {
|
||||
const result = parseSlashCommand(
|
||||
' /memory add some data ',
|
||||
' /memory list some data ',
|
||||
mockCommands,
|
||||
);
|
||||
expect(result.commandToExecute?.name).toBe('add');
|
||||
expect(result.commandToExecute?.name).toBe('list');
|
||||
expect(result.args).toBe('some data');
|
||||
expect(result.canonicalPath).toEqual(['memory', 'add']);
|
||||
expect(result.canonicalPath).toEqual(['memory', 'list']);
|
||||
});
|
||||
|
||||
it('should return undefined if query does not start with a slash', () => {
|
||||
|
||||
@@ -16,7 +16,7 @@ export type ParsedSlashCommand = {
|
||||
* Parses a raw slash command string into its command, arguments, and canonical path.
|
||||
* If no valid command is found, the `commandToExecute` property will be `undefined`.
|
||||
*
|
||||
* @param query The raw input string, e.g., "/memory add some data" or "/help".
|
||||
* @param query The raw input string, e.g., "/memory show" or "/help".
|
||||
* @param commands The list of available top-level slash commands.
|
||||
* @returns An object containing the resolved command, its arguments, and its canonical path.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user