repomix icon indicating copy to clipboard operation
repomix copied to clipboard

Feature request: pack only currently open files in VSCode (and forks like CursorAI or Windsurf)

Open mihailmariusiondev opened this issue 11 months ago • 5 comments

Description:
I would like to request a new feature that allows Repomix to pack only the files currently open in Visual Studio Code and its forks such as CursorAI or Windsurf.

Motivation:
Often, I already have the relevant files open in the editor, but I cannot efficiently use inclusion/exclusion patterns to specify them. Having an option to directly pack the files open in the current editor session would greatly streamline the workflow.
Furthermore, most developers already use an IDE based on Visual Studio Code, if not VSCode itself. Therefore, adding this feature would likely see high adoption with minimal friction. This enhancement would allow users to pack only the currently opened files without the need to manually specify inclusion/exclusion patterns, improving efficiency and ease of use.

Proposed Solution:
Implement a command-line option that detects and packs only the files currently open in the editor, leveraging the API of VSCode and compatible forks or by reading the workspace state.

Benefits:

  • Saves time by eliminating the need to manually define patterns.
  • Provides more accurate file selection.
  • Facilitates integration with customized development environments.

Expected Usage Example:

repomix --active-files

This command should generate a packed file containing only the currently open files in the editor session.

Considered Alternatives:
Currently, manually specifying the files or relying on include/exclude patterns is required, which can be tedious and imprecise in certain scenarios.

mihailmariusiondev avatar Jan 27 '25 15:01 mihailmariusiondev

Hi, @mihailmariusiondev !

Thank you for the feature suggestion! Being able to pack only currently open files indeed seems like it could enable various useful workflows. However, I'm uncertain about the feasibility of calling these APIs from CLI - if implementing this in CLI proves difficult, incorporating this feature into the VSCode extension might be a more practical approach.

What are your thoughts on providing this functionality as a VSCode extension?

The VSCode extension (Creator: @massdo) is already available at: https://marketplace.visualstudio.com/items?itemName=DorianMassoulier.repomix-runner

yamadashy avatar Jan 30 '25 01:01 yamadashy

Hi ! Yes I think it’s doable, I’ll take a look and update here once I have more details.

there is a typo in the link, extra w at the end 😆

massdo avatar Jan 30 '25 14:01 massdo

there is a typo in the link, extra w at the end 😆

Oops! My bad… I’ve fixed it!

I might ask for your help with this, so please keep an eye out!

yamadashy avatar Jan 30 '25 14:01 yamadashy

Hi @mihailmariusiondev and @yamadashy 👋

The feature is now available in v0.0.17 of the VS Code extension! (I just pushed it, so you just have to wait for the Marketplace update. I also noticed that the Cursor extension update takes much longer than the VS Code extension update.)

Check it out and let me know if you run into any issues.

To pack the open files, click on the files icon or run the Repomix Run On Open Files command

massdo avatar Jan 31 '25 14:01 massdo

Hi @yamadashy and @massdo,

Thank you both for your quick responses and for making this feature happen! @yamadashy, I appreciate you bringing up the extension as a possible solution. And @massdo, great job on implementing it so quickly! The Repomix Run On Open Files command is exactly what I needed, and I’m looking forward to using it in my workflow.

Really appreciate your effort!

Best, Marius

mihailmariusiondev avatar Jan 31 '25 18:01 mihailmariusiondev

Since everything has been running stably without any issues, I will proceed with closing this. @mihailmariusiondev Thank you for raising the issue, and @massdo great job on the implementation! I truly appreciate both of your contributions.

yamadashy avatar Mar 04 '25 15:03 yamadashy