Skip to content

Commit eec74fc

Browse files
committed
refactor(cli): standardize on 'reload' verb for refreshing components
1 parent aba8c5f commit eec74fc

File tree

12 files changed

+89
-84
lines changed

12 files changed

+89
-84
lines changed

docs/cli/gemini-md.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ You can interact with the loaded context files by using the `/memory` command.
6363
- **`/memory show`**: Displays the full, concatenated content of the current
6464
hierarchical memory. This lets you inspect the exact instructional context
6565
being provided to the model.
66-
- **`/memory refresh`**: Forces a re-scan and reload of all `GEMINI.md` files
66+
- **`/memory reload`**: Forces a re-scan and reload of all `GEMINI.md` files
6767
from all configured locations.
6868
- **`/memory add <text>`**: Appends your text to your global
6969
`~/.gemini/GEMINI.md` file. This lets you add persistent memories on the fly.

docs/cli/settings.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ they appear in the UI.
8787
| UI Label | Setting | Description | Default |
8888
| ------------------------------------ | ------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
8989
| Memory Discovery Max Dirs | `context.discoveryMaxDirs` | Maximum number of directories to search for memory. | `200` |
90-
| Load Memory From Include Directories | `context.loadMemoryFromIncludeDirectories` | Controls how /memory refresh loads GEMINI.md files. When true, include directories are scanned; when false, only the current directory is used. | `false` |
90+
| Load Memory From Include Directories | `context.loadMemoryFromIncludeDirectories` | Controls how /memory reload loads GEMINI.md files. When true, include directories are scanned; when false, only the current directory is used. | `false` |
9191
| Respect .gitignore | `context.fileFiltering.respectGitIgnore` | Respect .gitignore files when searching. | `true` |
9292
| Respect .geminiignore | `context.fileFiltering.respectGeminiIgnore` | Respect .geminiignore files when searching. | `true` |
9393
| Enable Recursive File Search | `context.fileFiltering.enableRecursiveFileSearch` | Enable recursive file search functionality when completing @ references in the prompt. | `true` |

docs/core/remote-agents.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ Markdown file.
7575
Users can manage subagents using the following commands within the Gemini CLI:
7676

7777
- `/agents list`: Displays all available local and remote subagents.
78-
- `/agents refresh`: Reloads the agent registry. Use this after adding or
78+
- `/agents reload`: Reloads the agent registry. Use this after adding or
7979
modifying agent definition files.
8080
- `/agents enable <agent_name>`: Enables a specific subagent.
8181
- `/agents disable <agent_name>`: Disables a specific subagent.

docs/get-started/configuration-v1.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ a few things you can try in order of recommendation:
455455
```
456456

457457
- **`loadMemoryFromIncludeDirectories`** (boolean):
458-
- **Description:** Controls the behavior of the `/memory refresh` command. If
458+
- **Description:** Controls the behavior of the `/memory reload` command. If
459459
set to `true`, `GEMINI.md` files should be loaded from all directories that
460460
are added. If set to `false`, `GEMINI.md` should only be loaded from the
461461
current directory.
@@ -796,8 +796,8 @@ conventions and context.
796796
other Markdown files using the `@path/to/file.md` syntax. For more details,
797797
see the [Memory Import Processor documentation](../core/memport.md).
798798
- **Commands for memory management:**
799-
- Use `/memory refresh` to force a re-scan and reload of all context files
800-
from all configured locations. This updates the AI's instructional context.
799+
- Use `/memory reload` to force a re-scan and reload of all context files from
800+
all configured locations. This updates the AI's instructional context.
801801
- Use `/memory show` to display the combined instructional context currently
802802
loaded, allowing you to verify the hierarchy and content being used by the
803803
AI.

docs/get-started/configuration.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ their corresponding top-level category object in your `settings.json` file.
609609
- **Default:** `[]`
610610

611611
- **`context.loadMemoryFromIncludeDirectories`** (boolean):
612-
- **Description:** Controls how /memory refresh loads GEMINI.md files. When
612+
- **Description:** Controls how /memory reload loads GEMINI.md files. When
613613
true, include directories are scanned; when false, only the current
614614
directory is used.
615615
- **Default:** `false`
@@ -1515,8 +1515,8 @@ conventions and context.
15151515
other Markdown files using the `@path/to/file.md` syntax. For more details,
15161516
see the [Memory Import Processor documentation](../core/memport.md).
15171517
- **Commands for memory management:**
1518-
- Use `/memory refresh` to force a re-scan and reload of all context files
1519-
from all configured locations. This updates the AI's instructional context.
1518+
- Use `/memory reload` to force a re-scan and reload of all context files from
1519+
all configured locations. This updates the AI's instructional context.
15201520
- Use `/memory show` to display the combined instructional context currently
15211521
loaded, allowing you to verify the hierarchy and content being used by the
15221522
AI.

packages/cli/src/ui/commands/agentsCommand.test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -105,34 +105,34 @@ describe('agentsCommand', () => {
105105
);
106106
});
107107

108-
it('should reload the agent registry when refresh subcommand is called', async () => {
108+
it('should reload the agent registry when reload subcommand is called', async () => {
109109
const reloadSpy = vi.fn().mockResolvedValue(undefined);
110110
mockConfig.getAgentRegistry = vi.fn().mockReturnValue({
111111
reload: reloadSpy,
112112
});
113113

114-
const refreshCommand = agentsCommand.subCommands?.find(
115-
(cmd) => cmd.name === 'refresh',
114+
const reloadCommand = agentsCommand.subCommands?.find(
115+
(cmd) => cmd.name === 'reload',
116116
);
117-
expect(refreshCommand).toBeDefined();
117+
expect(reloadCommand).toBeDefined();
118118

119-
const result = await refreshCommand!.action!(mockContext, '');
119+
const result = await reloadCommand!.action!(mockContext, '');
120120

121121
expect(reloadSpy).toHaveBeenCalled();
122122
expect(result).toEqual({
123123
type: 'message',
124124
messageType: 'info',
125-
content: 'Agents refreshed successfully.',
125+
content: 'Agents reloaded successfully.',
126126
});
127127
});
128128

129-
it('should show an error if agent registry is not available during refresh', async () => {
129+
it('should show an error if agent registry is not available during reload', async () => {
130130
mockConfig.getAgentRegistry = vi.fn().mockReturnValue(undefined);
131131

132-
const refreshCommand = agentsCommand.subCommands?.find(
133-
(cmd) => cmd.name === 'refresh',
132+
const reloadCommand = agentsCommand.subCommands?.find(
133+
(cmd) => cmd.name === 'reload',
134134
);
135-
const result = await refreshCommand!.action!(mockContext, '');
135+
const result = await reloadCommand!.action!(mockContext, '');
136136

137137
expect(result).toEqual({
138138
type: 'message',

packages/cli/src/ui/commands/agentsCommand.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,9 @@ const configCommand: SlashCommand = {
322322
completion: completeAllAgents,
323323
};
324324

325-
const agentsRefreshCommand: SlashCommand = {
326-
name: 'refresh',
325+
const agentsReloadCommand: SlashCommand = {
326+
name: 'reload',
327+
altNames: ['refresh'],
327328
description: 'Reload the agent registry',
328329
kind: CommandKind.BUILT_IN,
329330
action: async (context: CommandContext) => {
@@ -339,15 +340,15 @@ const agentsRefreshCommand: SlashCommand = {
339340

340341
context.ui.addItem({
341342
type: MessageType.INFO,
342-
text: 'Refreshing agent registry...',
343+
text: 'Reloading agent registry...',
343344
});
344345

345346
await agentRegistry.reload();
346347

347348
return {
348349
type: 'message',
349350
messageType: 'info',
350-
content: 'Agents refreshed successfully.',
351+
content: 'Agents reloaded successfully.',
351352
};
352353
},
353354
};
@@ -358,7 +359,7 @@ export const agentsCommand: SlashCommand = {
358359
kind: CommandKind.BUILT_IN,
359360
subCommands: [
360361
agentsListCommand,
361-
agentsRefreshCommand,
362+
agentsReloadCommand,
362363
enableCommand,
363364
disableCommand,
364365
configCommand,

packages/cli/src/ui/commands/extensionsCommand.test.ts

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -796,17 +796,17 @@ describe('extensionsCommand', () => {
796796
});
797797
});
798798

799-
describe('restart', () => {
800-
let restartAction: SlashCommand['action'];
799+
describe('reload', () => {
800+
let reloadAction: SlashCommand['action'];
801801
let mockRestartExtension: MockedFunction<
802802
typeof ExtensionLoader.prototype.restartExtension
803803
>;
804804

805805
beforeEach(() => {
806-
restartAction = extensionsCommand().subCommands?.find(
807-
(c) => c.name === 'restart',
806+
reloadAction = extensionsCommand().subCommands?.find(
807+
(c) => c.name === 'reload',
808808
)?.action;
809-
expect(restartAction).not.toBeNull();
809+
expect(reloadAction).not.toBeNull();
810810

811811
mockRestartExtension = vi.fn();
812812
mockContext.services.config!.getExtensionLoader = vi
@@ -815,7 +815,7 @@ describe('extensionsCommand', () => {
815815
getExtensions: mockGetExtensions,
816816
restartExtension: mockRestartExtension,
817817
}));
818-
mockContext.invocation!.name = 'restart';
818+
mockContext.invocation!.name = 'reload';
819819
});
820820

821821
it('should show a message if no extensions are installed', async () => {
@@ -826,37 +826,37 @@ describe('extensionsCommand', () => {
826826
restartExtension: mockRestartExtension,
827827
}));
828828

829-
await restartAction!(mockContext, '--all');
829+
await reloadAction!(mockContext, '--all');
830830

831831
expect(mockContext.ui.addItem).toHaveBeenCalledWith({
832832
type: MessageType.INFO,
833833
text: 'No extensions installed. Run `/extensions explore` to check out the gallery.',
834834
});
835835
});
836836

837-
it('restarts all active extensions when --all is provided', async () => {
837+
it('reloads all active extensions when --all is provided', async () => {
838838
const mockExtensions = [
839839
{ name: 'ext1', isActive: true },
840840
{ name: 'ext2', isActive: true },
841841
{ name: 'ext3', isActive: false },
842842
] as GeminiCLIExtension[];
843843
mockGetExtensions.mockReturnValue(mockExtensions);
844844

845-
await restartAction!(mockContext, '--all');
845+
await reloadAction!(mockContext, '--all');
846846

847847
expect(mockRestartExtension).toHaveBeenCalledTimes(2);
848848
expect(mockRestartExtension).toHaveBeenCalledWith(mockExtensions[0]);
849849
expect(mockRestartExtension).toHaveBeenCalledWith(mockExtensions[1]);
850850
expect(mockContext.ui.addItem).toHaveBeenCalledWith(
851851
expect.objectContaining({
852852
type: MessageType.INFO,
853-
text: 'Restarting 2 extensions...',
853+
text: 'Reloading 2 extensions...',
854854
}),
855855
);
856856
expect(mockContext.ui.addItem).toHaveBeenCalledWith(
857857
expect.objectContaining({
858858
type: MessageType.INFO,
859-
text: '2 extensions restarted successfully.',
859+
text: '2 extensions reloaded successfully.',
860860
}),
861861
);
862862
expect(mockContext.ui.dispatchExtensionStateUpdate).toHaveBeenCalledWith({
@@ -869,15 +869,15 @@ describe('extensionsCommand', () => {
869869
});
870870
});
871871

872-
it('restarts only specified active extensions', async () => {
872+
it('reloads only specified active extensions', async () => {
873873
const mockExtensions = [
874874
{ name: 'ext1', isActive: false },
875875
{ name: 'ext2', isActive: true },
876876
{ name: 'ext3', isActive: true },
877877
] as GeminiCLIExtension[];
878878
mockGetExtensions.mockReturnValue(mockExtensions);
879879

880-
await restartAction!(mockContext, 'ext1 ext3');
880+
await reloadAction!(mockContext, 'ext1 ext3');
881881

882882
expect(mockRestartExtension).toHaveBeenCalledTimes(1);
883883
expect(mockRestartExtension).toHaveBeenCalledWith(mockExtensions[2]);
@@ -890,7 +890,7 @@ describe('extensionsCommand', () => {
890890
it('shows an error if no extension loader is available', async () => {
891891
mockContext.services.config!.getExtensionLoader = vi.fn();
892892

893-
await restartAction!(mockContext, '--all');
893+
await reloadAction!(mockContext, '--all');
894894

895895
expect(mockContext.ui.addItem).toHaveBeenCalledWith(
896896
expect.objectContaining({
@@ -902,31 +902,31 @@ describe('extensionsCommand', () => {
902902
});
903903

904904
it('shows usage error for no arguments', async () => {
905-
await restartAction!(mockContext, '');
905+
await reloadAction!(mockContext, '');
906906

907907
expect(mockContext.ui.addItem).toHaveBeenCalledWith(
908908
expect.objectContaining({
909909
type: MessageType.ERROR,
910-
text: 'Usage: /extensions restart <extension-names>|--all',
910+
text: 'Usage: /extensions reload <extension-names>|--all',
911911
}),
912912
);
913913
expect(mockRestartExtension).not.toHaveBeenCalled();
914914
});
915915

916-
it('handles errors during extension restart', async () => {
916+
it('handles errors during extension reload', async () => {
917917
const mockExtensions = [
918918
{ name: 'ext1', isActive: true },
919919
] as GeminiCLIExtension[];
920920
mockGetExtensions.mockReturnValue(mockExtensions);
921921
mockRestartExtension.mockRejectedValue(new Error('Failed to restart'));
922922

923-
await restartAction!(mockContext, '--all');
923+
await reloadAction!(mockContext, '--all');
924924

925925
expect(mockRestartExtension).toHaveBeenCalledWith(mockExtensions[0]);
926926
expect(mockContext.ui.addItem).toHaveBeenCalledWith(
927927
expect.objectContaining({
928928
type: MessageType.ERROR,
929-
text: 'Failed to restart some extensions:\n ext1: Failed to restart',
929+
text: 'Failed to reload some extensions:\n ext1: Failed to restart',
930930
}),
931931
);
932932
});
@@ -937,7 +937,7 @@ describe('extensionsCommand', () => {
937937
] as GeminiCLIExtension[];
938938
mockGetExtensions.mockReturnValue(mockExtensions);
939939

940-
await restartAction!(mockContext, 'ext1 ext2');
940+
await reloadAction!(mockContext, 'ext1 ext2');
941941

942942
expect(mockRestartExtension).toHaveBeenCalledTimes(1);
943943
expect(mockRestartExtension).toHaveBeenCalledWith(mockExtensions[0]);
@@ -949,13 +949,13 @@ describe('extensionsCommand', () => {
949949
);
950950
});
951951

952-
it('does not restart any extensions if none are found', async () => {
952+
it('does not reload any extensions if none are found', async () => {
953953
const mockExtensions = [
954954
{ name: 'ext1', isActive: true },
955955
] as GeminiCLIExtension[];
956956
mockGetExtensions.mockReturnValue(mockExtensions);
957957

958-
await restartAction!(mockContext, 'ext2 ext3');
958+
await reloadAction!(mockContext, 'ext2 ext3');
959959

960960
expect(mockRestartExtension).not.toHaveBeenCalled();
961961
expect(mockContext.ui.addItem).toHaveBeenCalledWith(
@@ -966,8 +966,8 @@ describe('extensionsCommand', () => {
966966
);
967967
});
968968

969-
it('should suggest only enabled extension names for the restart command', async () => {
970-
mockContext.invocation!.name = 'restart';
969+
it('should suggest only enabled extension names for the reload command', async () => {
970+
mockContext.invocation!.name = 'reload';
971971
const mockExtensions = [
972972
{ name: 'ext1', isActive: true },
973973
{ name: 'ext2', isActive: false },

packages/cli/src/ui/commands/extensionsCommand.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ async function restartAction(
170170
if (!all && names?.length === 0) {
171171
context.ui.addItem({
172172
type: MessageType.ERROR,
173-
text: 'Usage: /extensions restart <extension-names>|--all',
173+
text: 'Usage: /extensions reload <extension-names>|--all',
174174
});
175175
return Promise.resolve();
176176
}
@@ -204,7 +204,7 @@ async function restartAction(
204204

205205
const restartingMessage = {
206206
type: MessageType.INFO,
207-
text: `Restarting ${extensionsToRestart.length} extension${s}...`,
207+
text: `Reloading ${extensionsToRestart.length} extension${s}...`,
208208
color: theme.text.primary,
209209
};
210210
context.ui.addItem(restartingMessage);
@@ -236,12 +236,12 @@ async function restartAction(
236236
.join('\n ');
237237
context.ui.addItem({
238238
type: MessageType.ERROR,
239-
text: `Failed to restart some extensions:\n ${errorMessages}`,
239+
text: `Failed to reload some extensions:\n ${errorMessages}`,
240240
});
241241
} else {
242242
const infoItem: HistoryItemInfo = {
243243
type: MessageType.INFO,
244-
text: `${extensionsToRestart.length} extension${s} restarted successfully.`,
244+
text: `${extensionsToRestart.length} extension${s} reloaded successfully.`,
245245
icon: emptyIcon,
246246
color: theme.text.primary,
247247
};
@@ -597,6 +597,7 @@ export function completeExtensions(
597597
}
598598
if (
599599
context.invocation?.name === 'disable' ||
600+
context.invocation?.name === 'reload' ||
600601
context.invocation?.name === 'restart'
601602
) {
602603
extensions = extensions.filter((ext) => ext.isActive);
@@ -692,9 +693,10 @@ const exploreExtensionsCommand: SlashCommand = {
692693
action: exploreAction,
693694
};
694695

695-
const restartCommand: SlashCommand = {
696-
name: 'restart',
697-
description: 'Restart all extensions',
696+
const reloadExtensionsCommand: SlashCommand = {
697+
name: 'reload',
698+
altNames: ['restart'],
699+
description: 'Reload and restart all extensions',
698700
kind: CommandKind.BUILT_IN,
699701
autoExecute: false,
700702
action: restartAction,
@@ -722,7 +724,7 @@ export function extensionsCommand(
722724
listExtensionsCommand,
723725
updateExtensionsCommand,
724726
exploreExtensionsCommand,
725-
restartCommand,
727+
reloadExtensionsCommand,
726728
...conditionalCommands,
727729
],
728730
action: (context, args) =>

0 commit comments

Comments
 (0)