Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/cli/gemini-md.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ You can interact with the loaded context files by using the `/memory` command.
- **`/memory show`**: Displays the full, concatenated content of the current
hierarchical memory. This lets you inspect the exact instructional context
being provided to the model.
- **`/memory refresh`**: Forces a re-scan and reload of all `GEMINI.md` files
- **`/memory reload`**: Forces a re-scan and reload of all `GEMINI.md` files
from all configured locations.
- **`/memory add <text>`**: Appends your text to your global
`~/.gemini/GEMINI.md` file. This lets you add persistent memories on the fly.
Expand Down
2 changes: 1 addition & 1 deletion docs/cli/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ they appear in the UI.
| UI Label | Setting | Description | Default |
| ------------------------------------ | ------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
| Memory Discovery Max Dirs | `context.discoveryMaxDirs` | Maximum number of directories to search for memory. | `200` |
| 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` |
| 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` |
| Respect .gitignore | `context.fileFiltering.respectGitIgnore` | Respect .gitignore files when searching. | `true` |
| Respect .geminiignore | `context.fileFiltering.respectGeminiIgnore` | Respect .geminiignore files when searching. | `true` |
| Enable Recursive File Search | `context.fileFiltering.enableRecursiveFileSearch` | Enable recursive file search functionality when completing @ references in the prompt. | `true` |
Expand Down
4 changes: 2 additions & 2 deletions docs/cli/tutorials/mcp-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ The agent will:

- **Server won't start?** Try running the docker command manually in your
terminal to see if it prints an error (e.g., "image not found").
- **Tools not found?** Run `/mcp refresh` to force the CLI to re-query the
server for its capabilities.
- **Tools not found?** Run `/mcp reload` to force the CLI to re-query the server
for its capabilities.

## Next steps

Expand Down
2 changes: 1 addition & 1 deletion docs/cli/tutorials/memory-management.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ excellent for debugging why the agent might be ignoring a rule.
If you edit a `GEMINI.md` file while a session is running, the agent won't know
immediately. Force a reload with:

**Command:** `/memory refresh`
**Command:** `/memory reload`

## Best practices

Expand Down
2 changes: 1 addition & 1 deletion docs/core/remote-agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Markdown file.
Users can manage subagents using the following commands within the Gemini CLI:

- `/agents list`: Displays all available local and remote subagents.
- `/agents refresh`: Reloads the agent registry. Use this after adding or
- `/agents reload`: Reloads the agent registry. Use this after adding or
modifying agent definition files.
- `/agents enable <agent_name>`: Enables a specific subagent.
- `/agents disable <agent_name>`: Disables a specific subagent.
Expand Down
4 changes: 2 additions & 2 deletions docs/reference/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ their corresponding top-level category object in your `settings.json` file.
- **Default:** `[]`

- **`context.loadMemoryFromIncludeDirectories`** (boolean):
- **Description:** Controls how /memory refresh loads GEMINI.md files. When
- **Description:** Controls how /memory reload loads GEMINI.md files. When
true, include directories are scanned; when false, only the current
directory is used.
- **Default:** `false`
Expand Down Expand Up @@ -1694,7 +1694,7 @@ conventions and context.
loaded, allowing you to verify the hierarchy and content being used by the
AI.
- See the [Commands documentation](./commands.md#memory) for full details on
the `/memory` command and its sub-commands (`show` and `refresh`).
the `/memory` command and its sub-commands (`show` and `reload`).

By understanding and utilizing these configuration layers and the hierarchical
nature of context files, you can effectively manage the AI's memory and tailor
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/config/settingsSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1154,7 +1154,7 @@ const SETTINGS_SCHEMA = {
requiresRestart: false,
default: false,
description: oneLine`
Controls how /memory refresh loads GEMINI.md files.
Controls how /memory reload loads GEMINI.md files.
When true, include directories are scanned; when false, only the current directory is used.
`,
showInDialog: true,
Expand Down
26 changes: 16 additions & 10 deletions packages/cli/src/ui/commands/agentsCommand.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,34 +105,40 @@ describe('agentsCommand', () => {
);
});

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

const refreshCommand = agentsCommand.subCommands?.find(
(cmd) => cmd.name === 'refresh',
const reloadCommand = agentsCommand.subCommands?.find(
(cmd) => cmd.name === 'reload',
);
expect(refreshCommand).toBeDefined();
expect(reloadCommand).toBeDefined();

const result = await refreshCommand!.action!(mockContext, '');
const result = await reloadCommand!.action!(mockContext, '');

expect(reloadSpy).toHaveBeenCalled();
expect(mockContext.ui.addItem).toHaveBeenCalledWith(
expect.objectContaining({
type: MessageType.INFO,
text: 'Reloading agent registry...',
}),
);
expect(result).toEqual({
type: 'message',
messageType: 'info',
content: 'Agents refreshed successfully.',
content: 'Agents reloaded successfully.',
});
});

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

const refreshCommand = agentsCommand.subCommands?.find(
(cmd) => cmd.name === 'refresh',
const reloadCommand = agentsCommand.subCommands?.find(
(cmd) => cmd.name === 'reload',
);
const result = await refreshCommand!.action!(mockContext, '');
const result = await reloadCommand!.action!(mockContext, '');

expect(result).toEqual({
type: 'message',
Expand Down
12 changes: 6 additions & 6 deletions packages/cli/src/ui/commands/agentsCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,9 +322,9 @@ const configCommand: SlashCommand = {
completion: completeAllAgents,
};

const agentsRefreshCommand: SlashCommand = {
name: 'refresh',
altNames: ['reload'],
const agentsReloadCommand: SlashCommand = {
name: 'reload',
altNames: ['refresh'],
description: 'Reload the agent registry',
kind: CommandKind.BUILT_IN,
action: async (context: CommandContext) => {
Expand All @@ -340,15 +340,15 @@ const agentsRefreshCommand: SlashCommand = {

context.ui.addItem({
type: MessageType.INFO,
text: 'Refreshing agent registry...',
text: 'Reloading agent registry...',
});

await agentRegistry.reload();

return {
type: 'message',
messageType: 'info',
content: 'Agents refreshed successfully.',
content: 'Agents reloaded successfully.',
};
},
};
Expand All @@ -359,7 +359,7 @@ export const agentsCommand: SlashCommand = {
kind: CommandKind.BUILT_IN,
subCommands: [
agentsListCommand,
agentsRefreshCommand,
agentsReloadCommand,
enableCommand,
disableCommand,
configCommand,
Expand Down
26 changes: 13 additions & 13 deletions packages/cli/src/ui/commands/extensionsCommand.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -830,15 +830,15 @@ describe('extensionsCommand', () => {
});
});

describe('restart', () => {
describe('reload', () => {
let restartAction: SlashCommand['action'];
let mockRestartExtension: MockedFunction<
typeof ExtensionLoader.prototype.restartExtension
>;

beforeEach(() => {
restartAction = extensionsCommand().subCommands?.find(
(c) => c.name === 'restart',
(c) => c.name === 'reload',
)?.action;
expect(restartAction).not.toBeNull();

Expand All @@ -849,7 +849,7 @@ describe('extensionsCommand', () => {
getExtensions: mockGetExtensions,
restartExtension: mockRestartExtension,
}));
mockContext.invocation!.name = 'restart';
mockContext.invocation!.name = 'reload';
});

it('should show a message if no extensions are installed', async () => {
Expand All @@ -868,7 +868,7 @@ describe('extensionsCommand', () => {
});
});

it('restarts all active extensions when --all is provided', async () => {
it('reloads all active extensions when --all is provided', async () => {
const mockExtensions = [
{ name: 'ext1', isActive: true },
{ name: 'ext2', isActive: true },
Expand All @@ -884,13 +884,13 @@ describe('extensionsCommand', () => {
expect(mockContext.ui.addItem).toHaveBeenCalledWith(
expect.objectContaining({
type: MessageType.INFO,
text: 'Restarting 2 extensions...',
text: 'Reloading 2 extensions...',
}),
);
expect(mockContext.ui.addItem).toHaveBeenCalledWith(
expect.objectContaining({
type: MessageType.INFO,
text: '2 extensions restarted successfully.',
text: '2 extensions reloaded successfully.',
}),
);
expect(mockContext.ui.dispatchExtensionStateUpdate).toHaveBeenCalledWith({
Expand Down Expand Up @@ -924,7 +924,7 @@ describe('extensionsCommand', () => {
);
});

it('restarts only specified active extensions', async () => {
it('reloads only specified active extensions', async () => {
const mockExtensions = [
{ name: 'ext1', isActive: false },
{ name: 'ext2', isActive: true },
Expand Down Expand Up @@ -962,13 +962,13 @@ describe('extensionsCommand', () => {
expect(mockContext.ui.addItem).toHaveBeenCalledWith(
expect.objectContaining({
type: MessageType.ERROR,
text: 'Usage: /extensions restart <extension-names>|--all',
text: 'Usage: /extensions reload <extension-names>|--all',
}),
);
expect(mockRestartExtension).not.toHaveBeenCalled();
});

it('handles errors during extension restart', async () => {
it('handles errors during extension reload', async () => {
const mockExtensions = [
{ name: 'ext1', isActive: true },
] as GeminiCLIExtension[];
Expand All @@ -981,7 +981,7 @@ describe('extensionsCommand', () => {
expect(mockContext.ui.addItem).toHaveBeenCalledWith(
expect.objectContaining({
type: MessageType.ERROR,
text: 'Failed to restart some extensions:\n ext1: Failed to restart',
text: 'Failed to reload some extensions:\n ext1: Failed to restart',
}),
);
});
Expand All @@ -1004,7 +1004,7 @@ describe('extensionsCommand', () => {
);
});

it('does not restart any extensions if none are found', async () => {
it('does not reload any extensions if none are found', async () => {
const mockExtensions = [
{ name: 'ext1', isActive: true },
] as GeminiCLIExtension[];
Expand All @@ -1021,8 +1021,8 @@ describe('extensionsCommand', () => {
);
});

it('should suggest only enabled extension names for the restart command', async () => {
mockContext.invocation!.name = 'restart';
it('should suggest only enabled extension names for the reload command', async () => {
mockContext.invocation!.name = 'reload';
const mockExtensions = [
{ name: 'ext1', isActive: true },
{ name: 'ext2', isActive: false },
Expand Down
24 changes: 13 additions & 11 deletions packages/cli/src/ui/commands/extensionsCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ async function restartAction(
if (!all && names?.length === 0) {
context.ui.addItem({
type: MessageType.ERROR,
text: 'Usage: /extensions restart <extension-names>|--all',
text: 'Usage: /extensions reload <extension-names>|--all',
});
return Promise.resolve();
}
Expand Down Expand Up @@ -208,12 +208,12 @@ async function restartAction(

const s = extensionsToRestart.length > 1 ? 's' : '';

const restartingMessage = {
const reloadingMessage = {
type: MessageType.INFO,
text: `Restarting ${extensionsToRestart.length} extension${s}...`,
text: `Reloading ${extensionsToRestart.length} extension${s}...`,
color: theme.text.primary,
};
context.ui.addItem(restartingMessage);
context.ui.addItem(reloadingMessage);

const results = await Promise.allSettled(
extensionsToRestart.map(async (extension) => {
Expand Down Expand Up @@ -254,12 +254,12 @@ async function restartAction(
.join('\n ');
context.ui.addItem({
type: MessageType.ERROR,
text: `Failed to restart some extensions:\n ${errorMessages}`,
text: `Failed to reload some extensions:\n ${errorMessages}`,
});
} else {
const infoItem: HistoryItemInfo = {
type: MessageType.INFO,
text: `${extensionsToRestart.length} extension${s} restarted successfully.`,
text: `${extensionsToRestart.length} extension${s} reloaded successfully.`,
icon: emptyIcon,
color: theme.text.primary,
};
Expand Down Expand Up @@ -707,7 +707,8 @@ export function completeExtensions(
}
if (
context.invocation?.name === 'disable' ||
context.invocation?.name === 'restart'
context.invocation?.name === 'restart' ||
context.invocation?.name === 'reload'
) {
extensions = extensions.filter((ext) => ext.isActive);
}
Expand Down Expand Up @@ -802,9 +803,10 @@ const exploreExtensionsCommand: SlashCommand = {
action: exploreAction,
};

const restartCommand: SlashCommand = {
name: 'restart',
description: 'Restart all extensions',
const reloadCommand: SlashCommand = {
name: 'reload',
altNames: ['restart'],
description: 'Reload all extensions',
kind: CommandKind.BUILT_IN,
autoExecute: false,
action: restartAction,
Expand Down Expand Up @@ -841,7 +843,7 @@ export function extensionsCommand(
listExtensionsCommand,
updateExtensionsCommand,
exploreExtensionsCommand,
restartCommand,
reloadCommand,
...conditionalCommands,
],
action: (context, args) =>
Expand Down
14 changes: 7 additions & 7 deletions packages/cli/src/ui/commands/mcpCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,10 +325,10 @@ const schemaCommand: SlashCommand = {
action: (context) => listAction(context, true, true),
};

const refreshCommand: SlashCommand = {
name: 'refresh',
altNames: ['reload'],
description: 'Restarts MCP servers',
const reloadCommand: SlashCommand = {
name: 'reload',
altNames: ['refresh'],
description: 'Reloads MCP servers',
kind: CommandKind.BUILT_IN,
autoExecute: true,
action: async (
Expand All @@ -354,7 +354,7 @@ const refreshCommand: SlashCommand = {

context.ui.addItem({
type: 'info',
text: 'Restarting MCP servers...',
text: 'Reloading MCP servers...',
});

await mcpClientManager.restart();
Expand Down Expand Up @@ -460,7 +460,7 @@ async function handleEnableDisable(
const mcpClientManager = config.getMcpClientManager();
if (mcpClientManager) {
context.ui.addItem(
{ type: 'info', text: 'Restarting MCP servers...' },
{ type: 'info', text: 'Reloading MCP servers...' },
Date.now(),
);
await mcpClientManager.restart();
Expand Down Expand Up @@ -521,7 +521,7 @@ export const mcpCommand: SlashCommand = {
descCommand,
schemaCommand,
authCommand,
refreshCommand,
reloadCommand,
enableCommand,
disableCommand,
],
Expand Down
Loading
Loading