chore: clean up launched memory features (#26941)

Co-authored-by: Jenna Inouye <jinouye@google.com>
This commit is contained in:
Sandy Tao
2026-05-13 14:22:56 -07:00
committed by GitHub
parent 0750b01fe4
commit 7504259d72
83 changed files with 617 additions and 4183 deletions
+14 -14
View File
@@ -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', () => {
+1 -1
View File
@@ -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.
*/