gemini-cli - ✅(Solved) Fix feat: add /enhance command to improve user prompts [1 pull requests, 2 comments, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
google-gemini/gemini-cli#25133Fetched 2026-04-11 06:31:15
View on GitHub
Comments
2
Participants
1
Timeline
9
Reactions
1
Author
Participants
Assignees
Timeline (top)
labeled ×3commented ×2assigned ×1cross-referenced ×1

Fix Action

Fixed

PR fix notes

PR #25135: feat(cli): add /enhance command to improve user prompts

Description (problem / solution / changelog)

Summary

This PR introduces the /enhance command, allowing users to leverage the LLM to refine and expand their prompts. It uses the conversation history as context for generating high-quality prompt rephrasings.

Details

The new command reads the user's initial prompt draft, requests an enhancement from the configured model, and automatically populates the input buffer with the refined prompt via a new setInput method on CommandContext. It also updates settings.json to organize plan settings.

Related Issues

Resolves #25133

How to Validate

  1. Check out the branch: gh pr checkout <pr-number>
  2. Run the application: npm run start
  3. Enter a basic prompt and use the command: /enhance write a function
  4. The CLI should replace the text in the input buffer with a more detailed, enhanced version of the prompt.
  5. Unit tests should pass: npm test -w @google/gemini-cli -- packages/cli/src/ui/commands/enhanceCommand.test.ts

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
      • npx
      • Docker
      • Podman
      • Seatbelt
    • Windows
      • npm run
      • npx
      • Docker
    • Linux
      • npm run
      • npx
      • Docker

Changed files

  • .gemini/settings.json (modified, +8/-2)
  • packages/cli/src/services/BuiltinCommandLoader.ts (modified, +2/-0)
  • packages/cli/src/test-utils/mockCommandContext.ts (modified, +1/-0)
  • packages/cli/src/ui/__snapshots__/App.test.tsx.snap (modified, +148/-94)
  • packages/cli/src/ui/__snapshots__/ToolConfirmationFullFrame-Full-Terminal-Tool-Confirmation-Snapshot-renders-tool-confirmation-box-in-the-frame-of-the-entire-terminal.snap.svg (modified, +68/-289)
  • packages/cli/src/ui/__snapshots__/ToolConfirmationFullFrame.test.tsx.snap (modified, +49/-37)
  • packages/cli/src/ui/commands/enhanceCommand.test.ts (added, +175/-0)
  • packages/cli/src/ui/commands/enhanceCommand.ts (added, +105/-0)
  • packages/cli/src/ui/commands/types.ts (modified, +6/-0)
  • packages/cli/src/ui/components/Help.tsx (modified, +6/-0)
  • packages/cli/src/ui/components/InputPrompt.tsx (modified, +12/-0)
  • packages/cli/src/ui/components/ShortcutsHelp.tsx (modified, +4/-0)
  • packages/cli/src/ui/components/__snapshots__/AppHeaderIcon-AppHeader-Icon-Rendering-renders-the-default-icon-in-standard-terminals.snap.svg (modified, +13/-13)
  • packages/cli/src/ui/components/__snapshots__/AppHeaderIcon-AppHeader-Icon-Rendering-renders-the-symmetric-icon-in-Apple-Terminal.snap.svg (modified, +14/-14)
  • packages/cli/src/ui/components/__snapshots__/AskUserDialog.test.tsx.snap (modified, +480/-67)
  • packages/cli/src/ui/components/__snapshots__/Banner-Banner-handles-newlines-in-text.snap.svg (modified, +10/-11)
  • packages/cli/src/ui/components/__snapshots__/Banner-Banner-renders-in-info-mode.snap.svg (modified, +10/-15)
  • packages/cli/src/ui/components/__snapshots__/FooterConfigDialog--FooterConfigDialog-highlights-the-active-item-in-the-preview.snap.svg (modified, +127/-127)
  • packages/cli/src/ui/components/__snapshots__/FooterConfigDialog--FooterConfigDialog-renders-correctly-with-default-settings.snap.svg (modified, +124/-124)
  • packages/cli/src/ui/components/__snapshots__/FooterConfigDialog--FooterConfigDialog-updates-the-preview-when-Show-footer-labels-is-toggled-off.snap.svg (modified, +120/-120)
  • packages/cli/src/ui/components/__snapshots__/HistoryItemDisplay.test.tsx.snap (modified, +217/-129)
  • packages/cli/src/ui/components/__snapshots__/HookStatusDisplay--HookStatusDisplay-matches-SVG-snapshot-for-single-hook.snap.svg (modified, +60/-3)
  • packages/cli/src/ui/components/__snapshots__/HookStatusDisplay.test.tsx.snap (modified, +179/-4)
  • packages/cli/src/ui/components/__snapshots__/InputPrompt-InputPrompt-Highlighting-and-Cursor-Display-multi-line-scenarios-should-display-cursor-correctly-at-the-beginning-of-a-line-in-a-multiline-block.snap.svg (modified, +62/-13)
  • packages/cli/src/ui/components/__snapshots__/InputPrompt-InputPrompt-Highlighting-and-Cursor-Display-multi-line-scenarios-should-display-cursor-correctly-at-the-end-of-a-line-in-a-multiline-block.snap.svg (modified, +62/-12)
  • packages/cli/src/ui/components/__snapshots__/InputPrompt-InputPrompt-Highlighting-and-Cursor-Display-multi-line-scenarios-should-display-cursor-correctly-in-the-middle-of-a-line-in-a-multiline-block.snap.svg (modified, +62/-17)
  • packages/cli/src/ui/components/__snapshots__/InputPrompt-InputPrompt-Highlighting-and-Cursor-Display-multi-line-scenarios-should-display-cursor-on-a-blank-line-in-a-multiline-block.snap.svg (modified, +62/-14)
  • packages/cli/src/ui/components/__snapshots__/InputPrompt-InputPrompt-Highlighting-and-Cursor-Display-single-line-scenarios-should-display-cursor-correctly-after-multi-byte-unicode-characters-.snap.svg (modified, +62/-10)
  • packages/cli/src/ui/components/__snapshots__/InputPrompt-InputPrompt-Highlighting-and-Cursor-Display-single-line-scenarios-should-display-cursor-correctly-at-the-beginning-of-the-line-.snap.svg (modified, +62/-10)
  • packages/cli/src/ui/components/__snapshots__/InputPrompt-InputPrompt-Highlighting-and-Cursor-Display-single-line-scenarios-should-display-cursor-correctly-at-the-end-of-a-line-with-unicode-cha-.snap.svg (modified, +62/-8)
  • packages/cli/src/ui/components/__snapshots__/InputPrompt-InputPrompt-Highlighting-and-Cursor-Display-single-line-scenarios-should-display-cursor-correctly-at-the-end-of-a-short-line-with-unico-.snap.svg (modified, +62/-9)
  • packages/cli/src/ui/components/__snapshots__/InputPrompt-InputPrompt-Highlighting-and-Cursor-Display-single-line-scenarios-should-display-cursor-correctly-at-the-end-of-the-line-.snap.svg (modified, +62/-9)
  • packages/cli/src/ui/components/__snapshots__/InputPrompt-InputPrompt-Highlighting-and-Cursor-Display-single-line-scenarios-should-display-cursor-correctly-for-multi-byte-unicode-characters-.snap.svg (modified, +62/-11)
  • packages/cli/src/ui/components/__snapshots__/InputPrompt-InputPrompt-Highlighting-and-Cursor-Display-single-line-scenarios-should-display-cursor-correctly-mid-word-.snap.svg (modified, +62/-11)
  • packages/cli/src/ui/components/__snapshots__/InputPrompt-InputPrompt-Highlighting-and-Cursor-Display-single-line-scenarios-should-display-cursor-correctly-on-a-highlighted-token-.snap.svg (modified, +62/-12)
  • packages/cli/src/ui/components/__snapshots__/InputPrompt-InputPrompt-Highlighting-and-Cursor-Display-single-line-scenarios-should-display-cursor-correctly-on-a-space-between-words-.snap.svg (modified, +62/-10)
  • packages/cli/src/ui/components/__snapshots__/InputPrompt-InputPrompt-Highlighting-and-Cursor-Display-single-line-scenarios-should-display-cursor-correctly-on-an-empty-line-.snap.svg (modified, +62/-9)
  • packages/cli/src/ui/components/__snapshots__/InputPrompt-InputPrompt-multiline-rendering-should-correctly-render-multiline-input-including-blank-lines.snap.svg (modified, +62/-14)
  • packages/cli/src/ui/components/__snapshots__/InputPrompt-InputPrompt-snapshots-should-not-show-inverted-cursor-when-shell-is-focused.snap.svg (modified, +62/-12)
  • packages/cli/src/ui/components/__snapshots__/InputPrompt.test.tsx.snap (modified, +764/-59)
  • packages/cli/src/ui/components/__snapshots__/MainContent-MainContent-renders-multiple-thinking-messages-sequentially-correctly.snap.svg (modified, +29/-8)
  • packages/cli/src/ui/components/__snapshots__/MainContent.test.tsx.snap (modified, +100/-38)
  • packages/cli/src/ui/components/__snapshots__/SettingsDialog-SettingsDialog-Initial-Rendering-should-render-settings-list-with-visual-indicators.snap.svg (modified, +115/-115)
  • packages/cli/src/ui/components/__snapshots__/SettingsDialog-SettingsDialog-Snapshot-Tests-should-render-accessibility-settings-enabled-correctly.snap.svg (modified, +115/-115)
  • packages/cli/src/ui/components/__snapshots__/SettingsDialog-SettingsDialog-Snapshot-Tests-should-render-all-boolean-settings-disabled-correctly.snap.svg (modified, +114/-114)
  • packages/cli/src/ui/components/__snapshots__/SettingsDialog-SettingsDialog-Snapshot-Tests-should-render-default-state-correctly.snap.svg (modified, +115/-115)
  • packages/cli/src/ui/components/__snapshots__/SettingsDialog-SettingsDialog-Snapshot-Tests-should-render-file-filtering-settings-configured-correctly.snap.svg (modified, +115/-115)
  • packages/cli/src/ui/components/__snapshots__/SettingsDialog-SettingsDialog-Snapshot-Tests-should-render-focused-on-scope-selector-correctly.snap.svg (modified, +114/-114)
  • packages/cli/src/ui/components/__snapshots__/SettingsDialog-SettingsDialog-Snapshot-Tests-should-render-mixed-boolean-and-number-settings-correctly.snap.svg (modified, +114/-114)
  • packages/cli/src/ui/components/__snapshots__/SettingsDialog-SettingsDialog-Snapshot-Tests-should-render-tools-and-security-settings-correctly.snap.svg (modified, +115/-115)
  • packages/cli/src/ui/components/__snapshots__/SettingsDialog-SettingsDialog-Snapshot-Tests-should-render-various-boolean-settings-enabled-correctly.snap.svg (modified, +114/-114)
  • packages/cli/src/ui/components/__snapshots__/ShortcutsHelp.test.tsx.snap (modified, +2/-0)
  • packages/cli/src/ui/components/__snapshots__/Table-Table-should-render-headers-and-data-correctly.snap.svg (modified, +1/-1)
  • packages/cli/src/ui/components/__snapshots__/Table-Table-should-support-custom-cell-rendering.snap.svg (modified, +1/-1)
  • packages/cli/src/ui/components/__snapshots__/Table-Table-should-support-inverse-text-rendering.snap.svg (modified, +1/-1)
  • packages/cli/src/ui/components/__snapshots__/ThemeDialog.test.tsx.snap (modified, +264/-177)
  • packages/cli/src/ui/components/__snapshots__/ToolConfirmationQueue-ToolConfirmationQueue-height-allocation-and-layout-should-handle-security-warning-height-correctly.snap.svg (modified, +73/-73)
  • packages/cli/src/ui/components/__snapshots__/ToolConfirmationQueue-ToolConfirmationQueue-height-allocation-and-layout-should-render-the-full-queue-wrapper-with-borders-and-content-for-large-edit-diffs.snap.svg (modified, +402/-402)
  • packages/cli/src/ui/components/__snapshots__/ToolConfirmationQueue-ToolConfirmationQueue-height-allocation-and-layout-should-render-the-full-queue-wrapper-with-borders-and-content-for-large-exec-commands.snap.svg (modified, +144/-144)
  • packages/cli/src/ui/components/messages/__snapshots__/DenseToolMessage-DenseToolMessage-Visual-Regression-matches-SVG-snapshot-for-a-Rejected-tool-call.snap.svg (modified, +62/-5)
  • packages/cli/src/ui/components/messages/__snapshots__/DenseToolMessage-DenseToolMessage-Visual-Regression-matches-SVG-snapshot-for-an-Accepted-file-edit-with-diff-stats.snap.svg (modified, +62/-27)
  • packages/cli/src/ui/components/messages/__snapshots__/DenseToolMessage.test.tsx.snap (modified, +135/-6)
  • packages/cli/src/ui/components/messages/__snapshots__/GeminiMessage.test.tsx.snap (modified, +216/-17)
  • packages/cli/src/ui/components/messages/__snapshots__/ShellToolMessage.test.tsx.snap (modified, +176/-16)
  • packages/cli/src/ui/components/messages/__snapshots__/ThinkingMessage-ThinkingMessage-filters-out-progress-dots-and-empty-lines.snap.svg (modified, +4/-4)
  • packages/cli/src/ui/components/messages/__snapshots__/ThinkingMessage-ThinkingMessage-normalizes-escaped-newline-tokens.snap.svg (modified, +4/-4)
  • packages/cli/src/ui/components/messages/__snapshots__/ThinkingMessage-ThinkingMessage-renders-Thinking-header-when-isFirstThinking-is-true.snap.svg (modified, +4/-4)
  • packages/cli/src/ui/components/messages/__snapshots__/ThinkingMessage-ThinkingMessage-renders-full-mode-with-left-border-and-full-text.snap.svg (modified, +4/-4)
  • packages/cli/src/ui/components/messages/__snapshots__/ThinkingMessage-ThinkingMessage-renders-multiple-thinking-messages-sequentially-correctly.snap.svg (modified, +18/-18)
  • packages/cli/src/ui/components/messages/__snapshots__/ThinkingMessage-ThinkingMessage-renders-subject-line-with-vertical-rule-and-Thinking-header.snap.svg (modified, +4/-4)
  • packages/cli/src/ui/components/messages/__snapshots__/ThinkingMessage-ThinkingMessage-uses-description-when-subject-is-empty.snap.svg (modified, +2/-2)
  • packages/cli/src/ui/components/messages/__snapshots__/ToolConfirmationMessage-ToolConfirmationMessage-height-allocation-and-layout-should-expand-to-available-height-for-large-edit-diffs.snap.svg (modified, +0/-0)
  • packages/cli/src/ui/components/messages/__snapshots__/ToolConfirmationMessage-ToolConfirmationMessage-height-allocation-and-layout-should-expand-to-available-height-for-large-exec-commands.snap.svg (modified, +0/-0)
  • packages/cli/src/ui/components/messages/__snapshots__/ToolConfirmationMessage-ToolConfirmationMessage-should-render-multiline-shell-scripts-with-correct-newlines-and-syntax-highlighting.snap.svg (modified, +0/-0)
  • packages/cli/src/ui/components/messages/__snapshots__/ToolGroupMessage.compact.test.tsx.snap (modified, +0/-0)
  • packages/cli/src/ui/components/messages/__snapshots__/ToolGroupMessage.test.tsx.snap (modified, +0/-0)
  • packages/cli/src/ui/components/messages/__snapshots__/ToolMessage.test.tsx.snap (modified, +0/-0)
  • packages/cli/src/ui/components/messages/__snapshots__/ToolMessageFocusHint.test.tsx.snap (modified, +0/-0)
  • packages/cli/src/ui/components/messages/__snapshots__/ToolMessageRawMarkdown.test.tsx.snap (modified, +0/-0)
  • packages/cli/src/ui/components/messages/__snapshots__/ToolResultDisplay-ToolResultDisplay-truncates-ANSI-output-when-maxLines-is-provided-even-if-availableTerminalHeight-is-undefined.snap.svg (modified, +0/-0)
  • packages/cli/src/ui/components/messages/__snapshots__/ToolResultDisplay.test.tsx.snap (modified, +0/-0)
  • packages/cli/src/ui/components/views/__snapshots__/ToolsList.test.tsx.snap (modified, +0/-0)
  • packages/cli/src/ui/hooks/slashCommandProcessor.ts (modified, +0/-0)
  • packages/cli/src/ui/key/keyBindings.ts (modified, +0/-0)
  • packages/cli/src/ui/noninteractive/nonInteractiveUi.ts (modified, +0/-0)
  • packages/cli/src/ui/utils/__snapshots__/CodeColorizer-colorizeCode-does-not-let-colors-from-ansi-escape-codes-leak-into-colorized-code.snap.svg (modified, +0/-0)
  • packages/cli/src/ui/utils/__snapshots__/MarkdownDisplay.test.tsx.snap (modified, +0/-0)
  • packages/cli/src/ui/utils/__snapshots__/TableRenderer-TableRenderer-calculates-column-widths-based-on-ren-.snap.svg (modified, +0/-0)
  • packages/cli/src/ui/utils/__snapshots__/TableRenderer-TableRenderer-calculates-width-correctly-for-conten-.snap.svg (modified, +0/-0)
  • packages/cli/src/ui/utils/__snapshots__/TableRenderer-TableRenderer-does-not-parse-markdown-inside-code-s-.snap.svg (modified, +0/-0)
  • packages/cli/src/ui/utils/__snapshots__/TableRenderer-TableRenderer-handles-nested-markdown-styles-recurs-.snap.svg (modified, +0/-0)
  • packages/cli/src/ui/utils/__snapshots__/TableRenderer-TableRenderer-handles-non-ASCII-characters-emojis-.snap.svg (modified, +0/-0)
  • packages/cli/src/ui/utils/__snapshots__/TableRenderer-TableRenderer-handles-wrapped-bold-headers-without-showing-markers.snap.svg (modified, +0/-0)
  • packages/cli/src/ui/utils/__snapshots__/TableRenderer-TableRenderer-renders-a-3x3-table-correctly.snap.svg (modified, +0/-0)
  • packages/cli/src/ui/utils/__snapshots__/TableRenderer-TableRenderer-renders-a-complex-table-with-mixed-content-lengths-correctly.snap.svg (modified, +0/-0)
  • packages/cli/src/ui/utils/__snapshots__/TableRenderer-TableRenderer-renders-a-table-with-long-headers-and-4-columns-correctly.snap.svg (modified, +0/-0)
  • packages/cli/src/ui/utils/__snapshots__/TableRenderer-TableRenderer-renders-a-table-with-mixed-emojis-As-.snap.svg (modified, +0/-0)
  • packages/cli/src/ui/utils/__snapshots__/TableRenderer-TableRenderer-renders-a-table-with-only-Asian-chara-.snap.svg (modified, +0/-0)
  • packages/cli/src/ui/utils/__snapshots__/TableRenderer-TableRenderer-renders-a-table-with-only-emojis-and-.snap.svg (modified, +0/-0)
  • packages/cli/src/ui/utils/__snapshots__/TableRenderer-TableRenderer-renders-complex-markdown-in-rows-and-.snap.svg (modified, +0/-0)
RAW_BUFFERClick to expand / collapse

What would you like to be added?

Add a new built-in command /enhance <prompt> that uses an LLM to rephrase and expand the user's prompt using the current conversation history as context.

Why is this needed?

Users often need help refining their prompts to get better results from the model. This command provides an easy way to iterate on prompts within the CLI, leveraging the model's own capabilities to improve clarity and detail. It helps bridge the gap between a vague initial idea and a high-quality prompt.

Additional context

  • The command leverages the current conversation history to ensure the enhanced prompt is contextually relevant.
  • It introduces a new setInput method to the CommandContext, allowing commands to programmatically update the user's input buffer.
  • Includes unit tests for the new command.
  • Moves the plan configuration to a more structured location in settings.json.

extent analysis

TL;DR

Implement the new /enhance <prompt> command by integrating an LLM to rephrase and expand user prompts within the CLI, utilizing conversation history as context.

Guidance

  • Review the proposed CommandContext update, specifically the new setInput method, to ensure seamless integration with existing commands.
  • Verify that the unit tests for the new command cover various conversation history scenarios to guarantee contextual relevance.
  • Examine the updated settings.json structure to confirm the plan configuration is correctly relocated and accessible.
  • Consider the potential impact of the LLM on performance and user experience, ensuring the command enhances prompts without introducing significant latency or errors.

Example

No explicit code example is provided due to the lack of specific implementation details in the issue.

Notes

The effectiveness of the /enhance <prompt> command heavily relies on the quality of the integrated LLM and its ability to understand the conversation context. Ensuring the LLM is well-trained and fine-tuned for this specific task is crucial.

Recommendation

Apply the proposed workaround by implementing the /enhance <prompt> command, as it directly addresses the need for users to refine their prompts within the CLI, leveraging the model's capabilities for improvement.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING