Skip to content

fix(cli): improve command conflict handling for skills#21942

Merged
NTaylorMullen merged 1 commit intomainfrom
ntm/fix-slash-command-conflicts
Mar 14, 2026
Merged

fix(cli): improve command conflict handling for skills#21942
NTaylorMullen merged 1 commit intomainfrom
ntm/fix-slash-command-conflicts

Conversation

@NTaylorMullen
Copy link
Copy Markdown
Collaborator

@NTaylorMullen NTaylorMullen commented Mar 10, 2026

Summary

Improve slash command conflict handling for skills and ensure built-in commands retain their intended names.

Otherwise with common extensions it's more likely to get conflicts like:
image

Details

Built-in commands like /chat and /docs were being renamed (e.g., to /chat1) on startup if an extension (like google-workspace) provided skills with the same name. This happened because SkillCommandLoader was prioritized over BuiltinCommandLoader and the conflict resolution logic didn't properly identify skills.

Changes:

  • Moved BuiltinCommandLoader to the top of the loaders array in slashCommandProcessor to give core commands precedence.
  • Added extensionName metadata to SkillDefinition and ensured ExtensionManager populates it.
  • Updated SlashCommandResolver to recognize the SKILL kind and use the extensionName for standard /extension.command prefixing.
  • Updated SlashCommandConflictHandler to provide descriptive notifications for skill conflicts.

Related Issues

Part of issue where built-in commands were being renamed on startup.

How to Validate

  1. Install an extension that has a skill named chat (e.g. google-workspace).
  2. Launch the CLI.
  3. Observe that /chat remains the built-in command.
  4. Observe a notification: "Extension 'google-workspace' skill '/chat' was renamed to '/google-workspace.chat' because it conflicts with built-in command."
  5. Run npm test -w @google/gemini-cli -- src/services/SlashCommandResolver.test.ts src/services/SlashCommandConflictHandler.test.ts src/services/SkillCommandLoader.test.ts to verify unit tests.

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods:
    • MacOS
      • npm run

@NTaylorMullen NTaylorMullen requested a review from a team as a code owner March 10, 2026 23:00
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses an issue where built-in CLI commands were being inadvertently renamed when extensions provided skills with conflicting names. The changes ensure that built-in commands take precedence, and any conflicting extension skills are automatically prefixed with their extension name, maintaining clarity and preventing unexpected command remappings. This improves the reliability and predictability of the command-line interface for users interacting with both core functionalities and installed extensions.

Highlights

  • Command Prioritization: Prioritized built-in commands over extension skills by reordering command loaders, ensuring core commands like /chat retain their original names.
  • Skill Metadata: Introduced an extensionName property to SkillDefinition and ensured it is populated by the ExtensionManager when loading skills.
  • Conflict Resolution Logic: Updated the SlashCommandResolver to correctly identify SKILL commands and use their extensionName for prefixing (e.g., /extension.command) when conflicts occur.
  • User Notifications: Enhanced the SlashCommandConflictHandler to provide more descriptive notifications to users when skill commands are renamed due to conflicts.
Changelog
  • packages/cli/src/config/extension-manager.ts
    • Added extensionName to skill and agent definitions during loading from extensions.
  • packages/cli/src/services/SkillCommandLoader.test.ts
    • Added a test case to verify that extensionName is correctly propagated to generated slash commands.
  • packages/cli/src/services/SkillCommandLoader.ts
    • Included extensionName in the command definition for skills.
  • packages/cli/src/services/SlashCommandConflictHandler.test.ts
    • Added a test to confirm that descriptive messages are displayed for skill conflicts.
  • packages/cli/src/services/SlashCommandConflictHandler.ts
    • Modified getCommandDescription to provide specific descriptions for SKILL commands, incorporating their extensionName.
  • packages/cli/src/services/SlashCommandResolver.test.ts
    • Added test cases to ensure skills are correctly prefixed with their extension name or 'skill' when conflicting with built-in commands.
  • packages/cli/src/services/SlashCommandResolver.ts
    • Updated getPrefix to use extensionName or the command kind for SKILL commands when determining prefixes.
  • packages/cli/src/ui/hooks/slashCommandProcessor.ts
    • Reordered the command loaders to place BuiltinCommandLoader first, giving built-in commands priority in conflict resolution.
  • packages/core/src/skills/skillLoader.ts
    • Added an optional extensionName property to the SkillDefinition interface.
Activity
  • The author confirmed that relevant documentation and README were updated.
  • The author confirmed that tests were added or updated as needed.
  • The author validated the changes on MacOS using npm run.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request effectively addresses the command conflict issue by prioritizing built-in commands and improving the conflict resolution logic for skills. The changes are well-structured and include necessary test updates. I've identified one critical issue regarding a potential type mismatch for agent definitions that should be addressed.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 10, 2026

Size Change: +279 B (0%)

Total Size: 26.5 MB

ℹ️ View Unchanged
Filename Size Change
./bundle/gemini.js 26.1 MB +279 B (0%)
./bundle/node_modules/@google/gemini-cli-devtools/dist/client/main.js 221 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/_client-assets.js 227 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/index.js 11.5 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/types.js 132 B 0 B
./bundle/sandbox-macos-permissive-open.sb 890 B 0 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB 0 B
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB 0 B
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB 0 B
./bundle/sandbox-macos-strict-open.sb 4.82 kB 0 B
./bundle/sandbox-macos-strict-proxied.sb 5.02 kB 0 B

compressed-size-action

@gemini-cli gemini-cli bot added the status/need-issue Pull requests that need to have an associated issue. label Mar 10, 2026
@NTaylorMullen NTaylorMullen force-pushed the ntm/fix-slash-command-conflicts branch from 5174b9c to 92d6fae Compare March 11, 2026 01:09
Copy link
Copy Markdown
Collaborator

@mattKorwel mattKorwel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable pending passing tests and double check of 1 comment.

@NTaylorMullen NTaylorMullen requested a review from a team as a code owner March 11, 2026 19:32
@NTaylorMullen NTaylorMullen force-pushed the ntm/fix-slash-command-conflicts branch 2 times, most recently from e727bf6 to 0647dc4 Compare March 12, 2026 00:51
- Prioritize built-in commands in slashCommandProcessor to ensure they retain their intended names.
- Add extensionName to SkillDefinition to track source extensions.
- Update ExtensionManager to tag loaded skills with their source extension name.
- Update SlashCommandResolver and SlashCommandConflictHandler to properly handle and describe conflicts involving skills.
- Skill conflicts from extensions now produce clear notifications like "Extension 'google-workspace' skill '/chat' was renamed to '/google-workspace.chat'" instead of generic "Existing command" messages.

Fixes built-in command rename issues observed on startup.
@NTaylorMullen NTaylorMullen force-pushed the ntm/fix-slash-command-conflicts branch from 0647dc4 to bc8c52f Compare March 12, 2026 01:09
@NTaylorMullen NTaylorMullen added this pull request to the merge queue Mar 14, 2026
Merged via the queue into main with commit bd590bb Mar 14, 2026
27 checks passed
@NTaylorMullen NTaylorMullen deleted the ntm/fix-slash-command-conflicts branch March 14, 2026 23:47
kunal-10-cloud pushed a commit to kunal-10-cloud/gemini-cli that referenced this pull request Mar 21, 2026
ProthamD pushed a commit to ProthamD/gemini-cli that referenced this pull request Mar 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status/need-issue Pull requests that need to have an associated issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants