mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-20 02:51:55 -07:00
Allow for slash commands to opt-out of autocompletion and /help discovery. (#7847)
This commit is contained in:
@@ -349,36 +349,4 @@ describe('CommandService', () => {
|
||||
expect(deployExtension).toBeDefined();
|
||||
expect(deployExtension?.description).toBe('[gcp] Deploy to Google Cloud');
|
||||
});
|
||||
|
||||
it('should filter out hidden commands', async () => {
|
||||
const visibleCommand = createMockCommand('visible', CommandKind.BUILT_IN);
|
||||
const hiddenCommand = {
|
||||
...createMockCommand('hidden', CommandKind.BUILT_IN),
|
||||
hidden: true,
|
||||
};
|
||||
const initiallyVisibleCommand = createMockCommand(
|
||||
'initially-visible',
|
||||
CommandKind.BUILT_IN,
|
||||
);
|
||||
const hiddenOverrideCommand = {
|
||||
...createMockCommand('initially-visible', CommandKind.FILE),
|
||||
hidden: true,
|
||||
};
|
||||
|
||||
const mockLoader = new MockCommandLoader([
|
||||
visibleCommand,
|
||||
hiddenCommand,
|
||||
initiallyVisibleCommand,
|
||||
hiddenOverrideCommand,
|
||||
]);
|
||||
|
||||
const service = await CommandService.create(
|
||||
[mockLoader],
|
||||
new AbortController().signal,
|
||||
);
|
||||
|
||||
const commands = service.getCommands();
|
||||
expect(commands).toHaveLength(1);
|
||||
expect(commands[0].name).toBe('visible');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -85,9 +85,7 @@ export class CommandService {
|
||||
});
|
||||
}
|
||||
|
||||
const finalCommands = Object.freeze(
|
||||
Array.from(commandMap.values()).filter((cmd) => !cmd.hidden),
|
||||
);
|
||||
const finalCommands = Object.freeze(Array.from(commandMap.values()));
|
||||
return new CommandService(finalCommands);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user