|
| 1 | +# GLUE 🌟 |
| 2 | + |
| 3 | +GLUE is a command-line utility that combines multiple files into a single, well-structured output file. It's specifically designed to prepare project contexts for Large Language Models (LLMs) by concatenating source files while preserving their structure and metadata. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- **Smart File Selection**: Uses glob patterns for inclusion and exclusion |
| 8 | +- **Gitignore Integration**: Respects `.gitignore` rules by default |
| 9 | +- **Binary File Handling**: Automatically detects and skips binary files |
| 10 | +- **UTF-8 Validation**: Ensures all content is valid UTF-8 |
| 11 | +- **Flexible Output**: Write to file or stdout |
| 12 | +- **Structured Format**: Clear file separators and metadata preservation |
| 13 | +- **Cross-Platform**: Works on Windows, macOS, and Linux |
| 14 | + |
| 15 | +## Installation |
| 16 | + |
| 17 | +### From Source |
| 18 | + |
| 19 | +1. Ensure you have Rust installed (1.70.0 or later) |
| 20 | +2. Clone the repository: |
| 21 | +```bash |
| 22 | +git clone https://github.com/tristanpoland/GLUE |
| 23 | +cd GLUE |
| 24 | +``` |
| 25 | +3. Build and install: |
| 26 | +```bash |
| 27 | +cargo install --path . |
| 28 | +``` |
| 29 | + |
| 30 | +## Usage |
| 31 | + |
| 32 | +Basic usage: |
| 33 | +```bash |
| 34 | +glue "src/**/*.rs" -o output.glue |
| 35 | +``` |
| 36 | + |
| 37 | +### Command Line Options |
| 38 | + |
| 39 | +```bash |
| 40 | +USAGE: |
| 41 | + glue [OPTIONS] <PATTERNS>... |
| 42 | + |
| 43 | +ARGS: |
| 44 | + <PATTERNS>... Input patterns (supports glob syntax) |
| 45 | + |
| 46 | +OPTIONS: |
| 47 | + -e, --exclude <PATTERNS> Patterns to exclude (in addition to .gitignore) |
| 48 | + -o, --output <FILE> Output file [default: output.glue] |
| 49 | + --no-ignore Include files that would be ignored by .gitignore |
| 50 | + --include-binary Include binary files (they will be skipped by default) |
| 51 | + -h, --help Print help information |
| 52 | + -V, --version Print version information |
| 53 | +``` |
| 54 | + |
| 55 | +### Examples |
| 56 | + |
| 57 | +Include all Rust files, exclude test files: |
| 58 | +```bash |
| 59 | +glue "**/*.rs" --exclude "**/tests/*" -o project.glue |
| 60 | +``` |
| 61 | + |
| 62 | +Process multiple file types: |
| 63 | +```bash |
| 64 | +glue "**/*.rs" "**/*.toml" "*.md" -o full-project.glue |
| 65 | +``` |
| 66 | + |
| 67 | +Include ignored files: |
| 68 | +```bash |
| 69 | +glue "src/**/*.rs" --no-ignore -o all-source.glue |
| 70 | +``` |
| 71 | + |
| 72 | +Output to stdout: |
| 73 | +```bash |
| 74 | +glue "src/**/*.rs" -o - |
| 75 | +``` |
| 76 | + |
| 77 | +## File Format |
| 78 | + |
| 79 | +GLUE files use a simple, readable format: |
| 80 | + |
| 81 | +``` |
| 82 | +$$--GLUE--$$ |
| 83 | +# This is a GLUE file; an amalgamation of files across one or more paths |
| 84 | +$$--GLUE--$$ |
| 85 | +./path/to/file1.rs |
| 86 | +$$--GLUE--$$ |
| 87 | +[content of file1.rs] |
| 88 | +$$--GLUE--$$ |
| 89 | +./path/to/file2.rs |
| 90 | +$$--GLUE--$$ |
| 91 | +[content of file2.rs] |
| 92 | +``` |
| 93 | + |
| 94 | +## Contributing |
| 95 | + |
| 96 | +Contributions are welcome! Please feel free to submit a Pull Request. |
| 97 | + |
| 98 | +## Known Limitations |
| 99 | + |
| 100 | +- Very large binary files are not optimally handled |
| 101 | +- No built-in compression support |
| 102 | +- No file metadata preservation (timestamps, permissions) |
| 103 | + |
| 104 | +## License |
| 105 | + |
| 106 | +This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. |
| 107 | + |
| 108 | +## Todo |
| 109 | + |
| 110 | +- [ ] Include file metadata options |
| 111 | +- [ ] Add progress indicators for large file sets |
| 112 | +- [ ] Add maximum file size limit options |
| 113 | +- [ ] Improve error reporting structure |
0 commit comments