$git clone https://github.com/Thomas-McKanna/Files2PromptCopy file contents in XML format for LLM prompts effortlessly.
| 1 | # Files2Prompt |
| 2 | |
| 3 | [](https://github.com/Thomas-McKanna/Files2Prompt) [](https://github.com/Thomas-McKanna/Files2Prompt/actions/workflows/publish.yml) |
| 4 | |
| 5 | Copy file contents in XML format for LLM prompts effortlessly. |
| 6 | |
| 7 |  |
| 8 | |
| 9 | ## Features |
| 10 | |
| 11 | - **Visual File Tree**: Browse and select files within your workspace using an intuitive tree view. |
| 12 | - **Selective Copying**: Easily choose which files to include in the copy operation with checkboxes. |
| 13 | - **XML Formatting**: Copies the content of selected files wrapped in XML `<file>` elements, ready for use in LLM prompts or other applications. |
| 14 | - **Custom System Message**: Optionally include a system message in your copied output, encapsulated within a `<systemMessage>` XML element. |
| 15 | - **Configurable Shortcuts**: Quickly refresh the file tree or copy files using customizable keyboard shortcuts. |
| 16 | - **Git Ignore Support**: Automatically ignores files and directories specified in your .gitignore. |
| 17 | - **Selection History**: Quickly switch between sets of previously selected files. |
| 18 | - **Paste XML Response**: If XML is pasted into the editor in the same format as the copied output, the files will automatically be updated or created in your workspace. This allows for rapid iteration. See [recommended workflow](#recommended-workflow) for more information. |
| 19 | |
| 20 | ## Installation |
| 21 | |
| 22 | ### Install from Marketplace: |
| 23 | |
| 24 | 1. Open VS Code. |
| 25 | 2. Go to the Extensions view by clicking on the Extensions icon in the Activity Bar or pressing `Ctrl+Shift+X` (`Cmd+Shift+X` on macOS). |
| 26 | 3. Search for "Files2Prompt". |
| 27 | 4. Click Install. |
| 28 | |
| 29 | ### Install from VSIX: |
| 30 | |
| 31 | 1. Download the .vsix file from the releases page. |
| 32 | 2. In VS Code, press `Ctrl+Shift+P` (`Cmd+Shift+P` on macOS) to open the Command Palette. |
| 33 | 3. Type `Extensions: Install from VSIX...` and select the command. |
| 34 | 4. Browse to the downloaded .vsix file and install. |
| 35 | |
| 36 | ## Usage |
| 37 | |
| 38 | ### Open Files2Prompt View: |
| 39 | |
| 40 | - Click on the Files2Prompt icon in the Activity Bar to open the Files2Prompt view. |
| 41 | |
| 42 | ### Select Files: |
| 43 | |
| 44 | - Browse through your workspace's file tree. |
| 45 | - Check the boxes next to the files you want to copy. |
| 46 | |
| 47 | ### Copy Files: |
| 48 | |
| 49 | - Click the Copy Files button in the view's title bar or use the keyboard shortcut: |
| 50 | - Windows/Linux: `Ctrl+C` |
| 51 | - macOS: `Cmd+C` |
| 52 | |
| 53 | ### Refresh File Tree: |
| 54 | |
| 55 | - To refresh the file tree view, click the Refresh button or use the keyboard shortcut: |
| 56 | - Windows/Linux: `Ctrl+R` |
| 57 | - macOS: `Cmd+R` |
| 58 | |
| 59 | ### Clear Selection: |
| 60 | |
| 61 | - To clear all file selections, click the Clear Selection button or use the keyboard shortcut: |
| 62 | - Windows/Linux: `Ctrl+Shift+C` |
| 63 | - macOS: `Cmd+Shift+C` |
| 64 | |
| 65 | ### Paste XML Response: |
| 66 | |
| 67 | - To update or create files in your workspace from LLM-outputted XML content, use the following keyboard shortcut while the extension UI is active: |
| 68 | - Windows/Linux: `Ctrl+V` |
| 69 | - macOS: `Cmd+V` |
| 70 | |
| 71 | It is recommended that if you use this feature you have a custom system message (see section below) to ensure that the XML content is correctly formatted. Here is an example of such a system message: |
| 72 | |
| 73 | ``` |
| 74 | Always provide full code listings. You only need to include files that have changed. I repeat, ALWAYS provide full code listings. Your output should be in XML format (in a code block) that mirrors the input format (that is, `<files>` element with a list of `<file>` in the interior). |
| 75 | ``` |
| 76 | |
| 77 | ### Include System Message: |
| 78 | |
| 79 | 1. Go to Settings (`Ctrl+,` or `Cmd+,` on macOS). |
| 80 | 2. Navigate to Extensions > Files2Prompt. |
| 81 | 3. Enter your custom system message in the System Message field. |
| 82 | 4. When you copy files, this message will be included at the top of the XML output. |
| 83 | |
| 84 | See recommended system message above. |
| 85 | |
| 86 | ## Configuration |
| 87 | |
| 88 | ### Customizing Keyboard Shortcuts |
| 89 | |
| 90 | You can customize the keyboard shortcuts for refreshing and copying files: |
| 91 | |
| 92 | 1. Open Keyboard Shortcuts: |
| 93 | - Press `Ctrl+K Ctrl+S` (`Cmd+K Cmd+S` on macOS). |
| 94 | 2. Search for "Files |