Turn any Git repository or local directory into a prompt-friendly text digest for LLMs — no install required, straight from npx.
npx gitoutput /path/to/directorynpx gitoutput https://github.com/AnEntrypoint/gitoutputThat's it — gitoutput writes a chunked digest (summary + mcp-thorns report in chunk 1, directory tree and file contents split across the rest) to <gitprojectname>-1.txt, -2.txt, etc. in the current directory. npx fetches the latest published version each time, so there's nothing to install or keep up to date.
# Print a single digest to stdout instead of writing files
npx gitoutput . --output -
npx gitoutput . --output - | pbcopy
# Point it at a subdirectory or branch
npx gitoutput https://github.com/AnEntrypoint/gitoutput/tree/main/src
npx gitoutput . --branch develop- Node.js 18+ (ships with
npx) gitinstalled and on yourPATH— used as a fallback for private repos, non-GitHub hosts, and anything a plain zip download can't express. Publicgithub.comrepos are fetched directly as a zipball instead, with nogitsubprocess involved.- For private repositories: a GitHub Personal Access Token (PAT). Generate one here.
npx gitoutput https://github.com/username/private-repo --token github_pat_...
# or via environment variable
export GITHUB_TOKEN=github_pat_...
npx gitoutput https://github.com/username/private-repoBy default, everything not matched by .gitignore/.gitingestignore or gitoutput's own built-in ignore list is included — the goal is a digest with exactly what an agent needs to plan changes, nothing more. The built-in list unconditionally excludes:
- All hidden files and directories (anything starting with
.—.github/,.eslintrc,.env.example, editor/IDE config, AI-agent tooling state, VCS internals, etc.) - Build/output directories that mirror or duplicate source (
build/,dist/,out/,output/,builds/,artifacts/,generated/,public/,static/, etc.) - Binaries and compiled artifacts across every major language/platform (executables, object files, ML model weights, 3D/game-engine assets, archives, media, fonts, office documents)
- Lockfiles, caches, and secrets (
node_modules,*.lock,*.key/*.pem/credentials.json, etc.)
npx gitoutput . --exclude-pattern "*.test.js"
npx gitoutput . --include-pattern "src/**"
npx gitoutput . --include-gitignored # also include .gitignore'd filesBy default, gitoutput writes chunked files instead of printing to stdout: <gitprojectname>-1.txt,
<gitprojectname>-2.txt, etc., each at most 80,000 characters. Chunk 1 contains the summary and an
mcp-thorns codebase report; later chunks contain the
directory tree and file contents.
npx gitoutput . # writes gitoutput-1.txt, gitoutput-2.txt, ...
npx gitoutput . --output digest.txt # writes digest-1.txt, digest-2.txt, ...
npx gitoutput . --output - # print a single digest to stdout instead| Flag | Short | Description |
|---|---|---|
--max-size <bytes> |
-s |
Maximum file size to process, in bytes (default: 10 MB) |
--exclude-pattern <p> |
-e |
Shell-style glob pattern to exclude (repeatable) |
--include-pattern <p> |
-i |
Shell-style glob pattern to include (repeatable) |
--branch <name> |
-b |
Branch to clone and ingest |
--include-gitignored |
Include files matched by .gitignore / .gitingestignore |
|
--exclude-submodules |
Exclude Git submodules (recursively included by default) | |
--token <token> |
-t |
GitHub PAT for private repositories (falls back to GITHUB_TOKEN env var) |
--output <path> |
-o |
Output file base name for chunked files. Defaults to <gitprojectname>.txt. Pass - for stdout |
npx gitoutput --helpBare user/repo slugs and scheme-less URLs are resolved against known hosts: github.com, gitlab.com,
bitbucket.org, gitea.com, codeberg.org, and gist.github.com. Self-hosted instances are also recognized
heuristically when the hostname starts with git., gitlab., or github. (e.g. GitHub Enterprise).
If you're building a Node.js tool on top of gitoutput rather than shelling out to the CLI:
npm install gitoutputimport { ingestAsync } from "gitoutput";
const [summary, tree, content] = await ingestAsync("https://github.com/AnEntrypoint/gitoutput");
console.log(summary);docker build -t gitoutput .
docker run --rm gitoutput https://github.com/AnEntrypoint/gitoutputIssues and pull requests welcome — see CONTRIBUTING.md.
- commander — CLI framework
- ignore —
.gitignore-style pattern matching - js-tiktoken — token estimation