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 @@ -87,7 +87,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
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
6 changes: 3 additions & 3 deletions docs/get-started/configuration-v1.md
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ a few things you can try in order of recommendation:
```

- **`loadMemoryFromIncludeDirectories`** (boolean):
- **Description:** Controls the behavior of the `/memory refresh` command. If
- **Description:** Controls the behavior of the `/memory reload` command. If
set to `true`, `GEMINI.md` files should be loaded from all directories that
are added. If set to `false`, `GEMINI.md` should only be loaded from the
current directory.
Expand Down Expand Up @@ -796,8 +796,8 @@ conventions and context.
other Markdown files using the `@path/to/file.md` syntax. For more details,
see the [Memory Import Processor documentation](../core/memport.md).
- **Commands for memory management:**
- Use `/memory refresh` to force a re-scan and reload of all context files
from all configured locations. This updates the AI's instructional context.
- Use `/memory reload` to force a re-scan and reload of all context files from
all configured locations. This updates the AI's instructional context.
- Use `/memory show` to display the combined instructional context currently
loaded, allowing you to verify the hierarchy and content being used by the
AI.
Expand Down
8 changes: 4 additions & 4 deletions docs/get-started/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,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 @@ -1515,13 +1515,13 @@ conventions and context.
other Markdown files using the `@path/to/file.md` syntax. For more details,
see the [Memory Import Processor documentation](../core/memport.md).
- **Commands for memory management:**
- Use `/memory refresh` to force a re-scan and reload of all context files
from all configured locations. This updates the AI's instructional context.
- Use `/memory reload` to force a re-scan and reload of all context files from
all configured locations. This updates the AI's instructional context.
- Use `/memory show` to display the combined instructional context currently
loaded, allowing you to verify the hierarchy and content being used by the
AI.
- See the [Commands documentation](../cli/commands.md#memory) for full details
on the `/memory` command and its sub-commands (`show` and `refresh`).
on 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
20 changes: 10 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,34 @@ 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(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
11 changes: 6 additions & 5 deletions packages/cli/src/ui/commands/agentsCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,9 @@ const configCommand: SlashCommand = {
completion: completeAllAgents,
};

const agentsRefreshCommand: SlashCommand = {
name: 'refresh',
const agentsReloadCommand: SlashCommand = {
name: 'reload',
altNames: ['refresh'],
description: 'Reload the agent registry',
kind: CommandKind.BUILT_IN,
action: async (context: CommandContext) => {
Expand All @@ -339,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 @@ -358,7 +359,7 @@ export const agentsCommand: SlashCommand = {
kind: CommandKind.BUILT_IN,
subCommands: [
agentsListCommand,
agentsRefreshCommand,
agentsReloadCommand,
enableCommand,
disableCommand,
configCommand,
Expand Down
48 changes: 24 additions & 24 deletions packages/cli/src/ui/commands/extensionsCommand.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -796,17 +796,17 @@ describe('extensionsCommand', () => {
});
});

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

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

mockRestartExtension = vi.fn();
mockContext.services.config!.getExtensionLoader = vi
Expand All @@ -815,7 +815,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 @@ -826,37 +826,37 @@ describe('extensionsCommand', () => {
restartExtension: mockRestartExtension,
}));

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

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

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 },
{ name: 'ext3', isActive: false },
] as GeminiCLIExtension[];
mockGetExtensions.mockReturnValue(mockExtensions);

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

expect(mockRestartExtension).toHaveBeenCalledTimes(2);
expect(mockRestartExtension).toHaveBeenCalledWith(mockExtensions[0]);
expect(mockRestartExtension).toHaveBeenCalledWith(mockExtensions[1]);
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 All @@ -869,15 +869,15 @@ 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 },
{ name: 'ext3', isActive: true },
] as GeminiCLIExtension[];
mockGetExtensions.mockReturnValue(mockExtensions);

await restartAction!(mockContext, 'ext1 ext3');
await reloadAction!(mockContext, 'ext1 ext3');

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

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

expect(mockContext.ui.addItem).toHaveBeenCalledWith(
expect.objectContaining({
Expand All @@ -902,31 +902,31 @@ describe('extensionsCommand', () => {
});

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

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[];
mockGetExtensions.mockReturnValue(mockExtensions);
mockRestartExtension.mockRejectedValue(new Error('Failed to restart'));

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

expect(mockRestartExtension).toHaveBeenCalledWith(mockExtensions[0]);
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 @@ -937,7 +937,7 @@ describe('extensionsCommand', () => {
] as GeminiCLIExtension[];
mockGetExtensions.mockReturnValue(mockExtensions);

await restartAction!(mockContext, 'ext1 ext2');
await reloadAction!(mockContext, 'ext1 ext2');

expect(mockRestartExtension).toHaveBeenCalledTimes(1);
expect(mockRestartExtension).toHaveBeenCalledWith(mockExtensions[0]);
Expand All @@ -949,13 +949,13 @@ 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[];
mockGetExtensions.mockReturnValue(mockExtensions);

await restartAction!(mockContext, 'ext2 ext3');
await reloadAction!(mockContext, 'ext2 ext3');

expect(mockRestartExtension).not.toHaveBeenCalled();
expect(mockContext.ui.addItem).toHaveBeenCalledWith(
Expand All @@ -966,8 +966,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
Loading