English | [简体中文]
Syntex is a command-line tool for packing multiple source code files into a single, context-rich text file. It is designed specifically for Large Language Models (LLMs) to provide them with a complete snapshot of a project's codebase in non-interactive environments.
- Focused Packing: Specializes in consolidating file contents into Markdown or Org-Mode formats with contextual metadata.
- Intelligent Filtering: Respects
.gitignorerules by default and automatically skips binary files to ensure clean output. - Pipeline-Friendly: Built on the Unix philosophy, it works seamlessly with tools like
findandfdto create powerful packing workflows. - Works Out-of-the-Box: A single, native binary built with Go, requiring no runtime dependencies.
The recommended way is to download the latest pre-compiled binary from the Releases page.
Other Installation Methods
With go install:
go install github.com/jbwfu/syntex@latestFrom Source:
git clone https://github.com/jbwfu/syntex.git
cd syntex
make build
sudo make installsyntex follows the Unix philosophy of "composition over built-in features." We strongly recommend using it in combination with professional file-finding tools like fd or find, piping the file list to syntex.
# Recommended: Use with fd to find all .go and .md files and pack them
fd . -e go -e md --print0 | syntex -0 -o context.md
# Classic: Use with find
find . -name "*.go" -o -name "*.md" -print0 | syntex -0 --clipboard
# Simple cases: Use the built-in glob
syntex 'src/**/*.go'- The
-0/--print0combination safely handles filenames with special characters. - Use
-o <file>to write the result to a file, or-c/--clipboardto copy it to the clipboard.
You can use the --dry-run flag to preview which files will be packed without actually generating any output. This is very useful for verifying your find patterns and ignore rules.
syntex cmd --dry-runoutput:
[Dry Run] Planning to process files using the 'markdown' format:
go cmd/syntex/main.go
go cmd/syntex/options/options.go
[Dry Run] Total: 2
Contributions are welcome! Please feel free to open an issue or submit a pull request if you find a bug or have a feature request.
This project is licensed under the MIT License.