mirror of
https://github.com/kalvin0x8d0/repoflat.git
synced 2026-05-03 20:45:41 +08:00
No description
- Go 97.8%
- Dockerfile 1.9%
- Vim Snippet 0.3%
| Caddyfile.snippet | ||
| docker-compose.yml | ||
| Dockerfile | ||
| go.mod | ||
| LICENSE | ||
| main.go | ||
| pack.go | ||
| README.md | ||
| repoflat-ignore.example | ||
RepoFlat
A minimal, zero-dependency Go tool that packs a code repository into a single AI-friendly file — Markdown, XML, or plain text.
Built as a lean alternative to repomix.
repoflat 1.0.0
Features
- Single binary — no Node, no npm, no runtime deps
- Three output formats — Markdown (default), XML, plain text
- Smart ignoring — respects
.gitignoreand.repoflat-ignore - Binary-safe — skips images, compiled files, lock files automatically
- Token estimation — rough GPT-style token count per file and total
- Web UI — beautiful Material Design 3 dark interface, embedded in the binary
- CLI and server — use it locally or self-host on a VPS
Usage
CLI
# Pack current directory → stdout (Markdown)
repoflat
# Pack a specific project → file
repoflat /path/to/project -o output.md
# Choose format
repoflat -f xml -o pack.xml
repoflat -f txt -o pack.txt
# Filter files
repoflat --include "**/*.go,**/*.html" --exclude "*_test.go"
# Limit file size (bytes; default 1 MiB)
repoflat --max-size 512000
Web server
# Start on port 8080, restrict to /home/kalvin/projects
repoflat --web --port 8080 --root /home/kalvin/projects
Then open http://localhost:8080.
Self-hosting on a VPS (Docker + Caddy)
git clone https://git.obulou.org/kalvin0x8d0/repoflat
cd repoflat
# Edit docker-compose.yml — set your projects volume path
docker compose up -d
Add to your Caddy config:
repoflat.obulou.xyz {
reverse_proxy localhost:8432
}
Options
| Flag | Default | Description |
|---|---|---|
dir (positional) |
. |
Directory to pack |
-f |
md |
Output format: md, xml, txt |
-o |
stdout | Output file path |
--include |
(all) | Comma-separated glob patterns to include |
--exclude |
(none) | Comma-separated glob patterns to exclude |
--max-size |
1048576 |
Max file size in bytes |
--web |
false | Start web server |
--port |
8080 |
Web server port |
--root |
(none) | Restrict web server to this path (security) |
--version |
Print version |
.repoflat-ignore
Place a .repoflat-ignore file in your project root. It works exactly like
.gitignore. Copy .repoflat-ignore.example as a starting point.
Building from source
git clone https://git.obulou.org/kalvin0x8d0/repoflat
cd repoflat
go build -ldflags="-s -w" -o repoflat .
Go 1.22+ required. No external dependencies.
Comparison
| repomix | RepoFlat | |
|---|---|---|
| Language | TypeScript/Node | Go |
| Runtime required | Node.js | None |
| Install | npm i -g |
go build |
| Binary size | ~50 MB + Node | ~7 MB |
| External deps | ~50 npm packages | Zero |
| Web UI | Separate service | Embedded |
.gitignore |
✓ | ✓ |
| Custom ignore | .repomixignore |
.repoflat-ignore |
| Remote repos | ✓ | ✗ (KISS) |
| Formats | txt, xml, md | md, xml, txt |