Created
November 1, 2025 18:50
-
-
Save orvitpng/5e256c27c4ec84c010f4b48af650c7f2 to your computer and use it in GitHub Desktop.
compile project into xml file for llm context
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env fish | |
| set target (if set -q argv[1]; echo $argv[1]; else; echo "."; end) | |
| set output output.xml | |
| if not test -d $target | |
| echo "Error: Directory \"$target\" does not exist" | |
| exit 1 | |
| end | |
| echo "Compiling project from $target to $output..." | |
| echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" > $output | |
| echo "<project>" >> $output | |
| set files ( | |
| begin | |
| git -C $target status --short | grep "^?" | cut -d\ -f2- | |
| and git -C $target ls-files | |
| end | sort -u | |
| ) | |
| for file in $files | |
| echo " Processing: $file" | |
| echo " <file path=\"$file\"><![CDATA[" >> $output | |
| cat "$target/$file" >> $output | |
| echo " ]]></file>" >> $output | |
| end | |
| echo "</project>" >> $output | |
| echo "Done! Output written to $output" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment