Skip to content

feat(plan): add copy subcommand to plan (#20491)#20988

Merged
jerop merged 2 commits intomainfrom
18309-copy-plan
Mar 3, 2026
Merged

feat(plan): add copy subcommand to plan (#20491)#20988
jerop merged 2 commits intomainfrom
18309-copy-plan

Conversation

@ruomengz
Copy link
Contributor

@ruomengz ruomengz commented Mar 3, 2026

Summary

Adds a new /plan copy subcommand to allow users to easily copy the contents of the generated plan to their clipboard.

Details

This PR implements the copy subcommand within the existing plan command structure. It improves the user workflow by providing a quick way to extract the plan content for sharing or external review without needing to manually highlight and copy text from the terminal.

  • Added copy subcommand logic to planCommand.ts.
  • Added unit tests for the new command in planCommand.test.ts.
  • Updated documentation in plan-mode.md and commands.md to document the new feature.

Related Issues

Fixes #18309

How to Validate

  1. Run the CLI locally: npm run start
  2. Enter plan mode.
  3. Once a plan is generated, execute the command: /plan copy
  4. Paste the contents into a text editor to verify that the clipboard contains the exact markdown of the generated plan.

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

@ruomengz ruomengz requested review from a team as code owners March 3, 2026 16:57
@gemini-code-assist
Copy link
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 introduces a new /plan copy subcommand to the CLI, significantly enhancing the user experience by providing a quick and efficient way to transfer generated plan content to the clipboard. This feature streamlines workflows, allowing users to easily share or utilize plan details without manual text selection, thereby improving overall productivity and interaction with the planning functionality.

Highlights

  • New Subcommand: A new /plan copy subcommand has been added to allow users to copy the contents of a generated plan to their clipboard.
  • Core Logic Implementation: The core logic for the copy subcommand, including reading the approved plan and copying it to the clipboard, has been implemented in planCommand.ts.
  • Unit Tests: Comprehensive unit tests have been added for the new copy subcommand, covering successful copy operations and scenarios where no approved plan is found.
  • Documentation Updates: The official documentation in plan-mode.md and commands.md has been updated to reflect the availability and usage of the new /plan copy feature.
Changelog
  • docs/cli/plan-mode.md
    • Updated the command section to include the new /plan copy subcommand.
  • docs/reference/commands.md
    • Added a new 'Sub-commands' section under /plan to document the copy subcommand and its description.
  • packages/cli/src/ui/commands/planCommand.test.ts
    • Imported readFileWithEncoding and copyToClipboard for testing purposes.
    • Mocked readFileWithEncoding and copyToClipboard to control test behavior.
    • Added a basename mock to node:path for consistent test results.
    • Implemented a new test suite for the copy subcommand, including tests for successful copying and handling cases where no approved plan is found.
  • packages/cli/src/ui/commands/planCommand.ts
    • Imported CommandContext, readFileWithEncoding, and copyToClipboard.
    • Created a new asynchronous function copyAction to encapsulate the logic for copying the approved plan to the clipboard, including error handling and feedback emission.
    • Modified the planCommand definition to set autoExecute to false.
    • Added a subCommands array to planCommand, defining the new copy subcommand with its name, description, kind, autoExecute status, and the copyAction.
Activity
  • The pull request introduces a new feature as described in the summary and implemented across several files.
  • Unit tests have been added to ensure the reliability of the new functionality.
  • Documentation has been updated to guide users on the new command.
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
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 introduces a /plan copy subcommand, which is a useful addition for users of the plan mode. The implementation is clean, includes necessary documentation updates, and has corresponding unit tests. No high-severity issues were identified.

@github-actions
Copy link

github-actions bot commented Mar 3, 2026

Size Change: +899 B (0%)

Total Size: 25.8 MB

ℹ️ View Unchanged
Filename Size Change
./bundle/gemini.js 25.3 MB +899 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 area/core Issues related to User Interface, OS Support, Core Functionality area/security Issues related to security area/enterprise Issues related to Telemetry, Policy, Quota / Licensing 🔒 maintainer only ⛔ Do not contribute. Internal roadmap item. labels Mar 3, 2026
@jerop jerop added this pull request to the merge queue Mar 3, 2026
Merged via the queue into main with commit b5f3eb2 Mar 3, 2026
27 checks passed
@jerop jerop deleted the 18309-copy-plan branch March 3, 2026 21:53
BryanBradfo pushed a commit to BryanBradfo/gemini-cli that referenced this pull request Mar 5, 2026
struckoff pushed a commit to struckoff/gemini-cli that referenced this pull request Mar 6, 2026
yashodipmore pushed a commit to yashodipmore/geemi-cli that referenced this pull request Mar 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core Issues related to User Interface, OS Support, Core Functionality area/enterprise Issues related to Telemetry, Policy, Quota / Licensing area/security Issues related to security 🔒 maintainer only ⛔ Do not contribute. Internal roadmap item.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support copying approved plans

3 participants