-
Notifications
You must be signed in to change notification settings - Fork 14.3k
fix(patch): cherry-pick 06fcdc2 to release/v0.37.0-pr-24839 [CONFLICTS] #25051
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
gemini-cli-robot
wants to merge
1
commit into
release/v0.37.0-pr-24839
from
hotfix/v0.37.0/0.37.1/stable/cherry-pick-06fcdc2/pr-24839
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,6 +10,11 @@ import { MemoryCommand } from './commands/memory.js'; | |
| import { ExtensionsCommand } from './commands/extensions.js'; | ||
| import { InitCommand } from './commands/init.js'; | ||
| import { RestoreCommand } from './commands/restore.js'; | ||
| <<<<<<< HEAD | ||
| ======= | ||
| import { AboutCommand } from './commands/about.js'; | ||
| import { HelpCommand } from './commands/help.js'; | ||
| >>>>>>> 06fcdc231 (feat(acp): add /help command (#24839)) | ||
|
Comment on lines
+13
to
+17
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| export class CommandHandler { | ||
| private registry: CommandRegistry; | ||
|
|
@@ -24,6 +29,11 @@ export class CommandHandler { | |
| registry.register(new ExtensionsCommand()); | ||
| registry.register(new InitCommand()); | ||
| registry.register(new RestoreCommand()); | ||
| <<<<<<< HEAD | ||
| ======= | ||
| registry.register(new AboutCommand()); | ||
| registry.register(new HelpCommand(registry)); | ||
| >>>>>>> 06fcdc231 (feat(acp): add /help command (#24839)) | ||
|
Comment on lines
+32
to
+36
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| return registry; | ||
| } | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| /** | ||
| * @license | ||
| * Copyright 2026 Google LLC | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| import { describe, it, expect } from 'vitest'; | ||
| import { HelpCommand } from './help.js'; | ||
| import { CommandRegistry } from './commandRegistry.js'; | ||
| import type { Command, CommandContext } from './types.js'; | ||
|
|
||
| describe('HelpCommand', () => { | ||
| it('returns formatted help text with sorted commands', async () => { | ||
| const registry = new CommandRegistry(); | ||
|
|
||
| const cmdB: Command = { | ||
| name: 'bravo', | ||
| description: 'Bravo command', | ||
| execute: async () => ({ name: 'bravo', data: '' }), | ||
| }; | ||
|
|
||
| const cmdA: Command = { | ||
| name: 'alpha', | ||
| description: 'Alpha command', | ||
| execute: async () => ({ name: 'alpha', data: '' }), | ||
| }; | ||
|
|
||
| registry.register(cmdB); | ||
| registry.register(cmdA); | ||
|
|
||
| const helpCommand = new HelpCommand(registry); | ||
|
|
||
| const context = {} as CommandContext; | ||
|
|
||
| const response = await helpCommand.execute(context, []); | ||
|
|
||
| expect(response.name).toBe('help'); | ||
|
|
||
| const data = response.data as string; | ||
|
|
||
| expect(data).toContain('Gemini CLI Help:'); | ||
| expect(data).toContain('### Basics'); | ||
| expect(data).toContain('### Commands'); | ||
|
|
||
| const lines = data.split('\n'); | ||
| const alphaIndex = lines.findIndex((l) => l.includes('/alpha')); | ||
| const bravoIndex = lines.findIndex((l) => l.includes('/bravo')); | ||
|
|
||
| expect(alphaIndex).toBeLessThan(bravoIndex); | ||
| expect(alphaIndex).not.toBe(-1); | ||
| expect(bravoIndex).not.toBe(-1); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| /** | ||
| * @license | ||
| * Copyright 2026 Google LLC | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| import type { | ||
| Command, | ||
| CommandContext, | ||
| CommandExecutionResponse, | ||
| } from './types.js'; | ||
| import type { CommandRegistry } from './commandRegistry.js'; | ||
|
|
||
| export class HelpCommand implements Command { | ||
| readonly name = 'help'; | ||
| readonly description = 'Show available commands'; | ||
|
|
||
| constructor(private registry: CommandRegistry) {} | ||
|
|
||
| async execute( | ||
| _context: CommandContext, | ||
| _args: string[] = [], | ||
| ): Promise<CommandExecutionResponse> { | ||
| const commands = this.registry | ||
| .getAllCommands() | ||
| .sort((a, b) => a.name.localeCompare(b.name)); | ||
|
|
||
| const lines: string[] = []; | ||
|
|
||
| lines.push('Gemini CLI Help:'); | ||
| lines.push(''); | ||
| lines.push('### Basics'); | ||
| lines.push( | ||
| '- **Add context**: Use `@` to specify files for context (e.g., `@src/myFile.ts`) to target specific files or folders.', | ||
| ); | ||
| lines.push(''); | ||
|
|
||
| lines.push('### Commands'); | ||
| for (const cmd of commands) { | ||
| if (cmd.description) { | ||
| lines.push(`- **/${cmd.name}** - ${cmd.description}`); | ||
| } | ||
| } | ||
|
|
||
| return { | ||
| name: this.name, | ||
| data: lines.join('\n'), | ||
| }; | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file contains unresolved merge conflict markers. This will cause the build to fail. Please resolve the conflicts before merging.