A go tool to create a LLM friendly bundle to be able to understand a golang codebase.
Created by an LLM 🙃, with some fixes along the way 😉.
You can install go-llm-bundler directly using Go's install command:
go install github.com/pcfreak30/go-llm-bundler@latest
This will download the source, compile it, and install the binary in your $GOPATH/bin
directory. Make sure this directory is in your system's PATH.
After installation, you can run the tool using:
go-llm-bundler [options]
-dir string
: The root directory of the Go project (default: current directory)-out string
: The output file (default:<project_name>_bundle.txt
)-meta
: Include metadata such as package structure (default: false)-minify int
: Minification level (1-3, default: 1)-exclude string
: Comma-separated list of directories to exclude (default: "vendor,testdata")
-
Bundle the current directory with default options:
go-llm-bundler
-
Bundle a specific project with metadata and higher minification:
go-llm-bundler -dir /path/to/my-project -meta -minify 2
-
Exclude additional directories and specify an output file:
go-llm-bundler -dir /path/to/my-project -exclude "vendor,testdata,examples" -out my_custom_bundle.txt
The tool generates a file containing:
- A JSON line with project metadata (dependencies, imports, and optionally structure)
- The content of each Go file, prefixed with
###FILE:<filename>###
This format is designed to be easily parsed by AI models while remaining human-readable.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
- Try to come up with better way to represent the data to reduce tokens
- Take this idea and port to other languages (preferably in go, 1 file binaries rule!)
- Create a super LLM tool for multiple languages (framework?).
- A previous iteration used pure JSON, but the LLM thought a hybrid text might be better on tokens. Not actually tested but guess we will find out 🙃.
- AI Code tools in IDE's I believe are doing things like this, but this isolated creates an agnostic way to tell any LLM about your project and ask questions. I have been tinkering with this on/off for a while now.