Skip to content
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

Support for unpack #226

Open
tombelieber opened this issue Dec 29, 2024 · 5 comments
Open

Support for unpack #226

tombelieber opened this issue Dec 29, 2024 · 5 comments
Labels
enhancement New feature or request needs discussion Issues needing discussion and a decision to be made before action can be taken

Comments

@tombelieber
Copy link

Since this tool is to pack a repo (codebase) into a prompt, after asking ChatGPT or other LLM AI to review, the LLM should edit the repomix-output.txt, and repomix should support unpack to apply LLM edited changes in the repo.

@yamadashy
Copy link
Owner

Hi, @tombelieber!
Thanks for the suggestion!

I personally use Claude and get artifacts as individual files, so I can just copy and paste.
However, I'm curious how you are using it. Are you getting all the output in one single output? If you're using a JSON output or something similar, then unpacking would probably be easy, but otherwise, the format would be difficult to define, so it might be hard.

@yamadashy yamadashy added enhancement New feature or request needs discussion Issues needing discussion and a decision to be made before action can be taken labels Dec 31, 2024
@yoloyash
Copy link

yoloyash commented Jan 2, 2025

From what I understand, Cursor does something similar. It asks the LLMs for diffs and then runs the diffs past a llama3.1-70b to get the full files (someone can confirm). You should look into that. Unpacking directly by itself might not be possible otherwise like @yamadashy said.

@rockmandash
Copy link

@yoloyash I think you mean only outputing code changes, like this project: https://github.com/mckaywrigley/o1-xml-parser

By only outputing changes like this:

<code_changes>
...changes goes here
</code_changes>

Then people can build a parser to massively reduce output token, and the only benefit is recuding output token.

@rockmandash
Copy link

@yamadashy it will be super cool if we can do this:

repomix --request-for-code-changes : this option not only pack repo, but also add prompt to tell LLM to generate a code changes .xml file, containing only what need to be changed.

repomix --apply-code-changes path-to-output-file.xml : this can read the output .xml file from LLM and automatically apply the change to the repo, so this can massively reduce output token, and is easier for user who what to tell LLM to modify a peice of code of their repo.

@rockmandash
Copy link

rockmandash commented Jan 2, 2025

We could literally copy paste https://github.com/mckaywrigley/o1-xml-parser 's prompt:

https://github.com/mckaywrigley/o1-xml-parser/blob/main/README.md?plain=1#L33-L81

The XML Prompt

You are an expert software engineer.

You are tasked with following my instructions.

Use the included project instructions as a general guide.

You will respond with 2 sections: A summary section and an XML section.

Here are some notes on how you should respond in the summary section:

  • Provide a brief overall summary
  • Provide a 1-sentence summary for each file changed and why.
  • Provide a 1-sentence summary for each file deleted and why.
  • Format this section as markdown.

Here are some notes on how you should respond in the XML section:

  • Respond with the XML and nothing else
  • Include all of the changed files
  • Specify each file operation with CREATE, UPDATE, or DELETE
  • If it is a CREATE or UPDATE include the full file code. Do not get lazy.
  • Each file should include a brief change summary.
  • Include the full file path
  • I am going to copy/paste that entire XML section into a parser to automatically apply the changes you made, so put the XML block inside a markdown codeblock.
  • Make sure to enclose the code with ![CDATA[CODE HERE]]

Here is how you should structure the XML:

<code_changes>
<changed_files>

<file_summary>BRIEF CHANGE SUMMARY HERE</file_summary>
<file_operation>FILE OPERATION HERE</file_operation>
<file_path>FILE PATH HERE</file_path>
<file_code></file_code>

REMAINING FILES HERE
</changed_files>
</code_changes>

So the XML section will be:

__XML HERE__

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs discussion Issues needing discussion and a decision to be made before action can be taken
Projects
None yet
Development

No branches or pull requests

4 participants