Skip to content

kndrad/mergo

Repository files navigation

mergo

A CLI tool that combines Go files from a module or directory into a single file for easy sharing with LLMs.

Features

  • Merges Go files while preserving package structure
  • Excludes test files and unwanted directories/extensions
  • Supports multiple packages
  • Handles imports deduplication
  • Outputs in a format suitable for LLM prompts

Installation

go install github.com/kndrad/mergo@latest

Or build from source:

git clone https://github.com/kndrad/mergo.git
cd mergo
go build

Usage

Merge Go module files:

mergo /path/to/module /path/to/output

Merge directory files:

mergo dir --path=/path/to/dir --out=/path/to/output

Options

  • --exclude: Exclude directories (default: .git, .gitignore)
  • --exclude-ext: Exclude file extensions (default: .sum, .md, .mod)

Requirements

  • Go 1.23.3 or later

License

MIT License - see LICENSE

About

Merge all .go project files contents for an easy LLM's input.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published