Codeharbor Repo Digest
Turn a public GitHub repository or a ZIP into one prompt-ready text for AI.
How it works
Give a public GitHub address or upload a repository as ZIP or .tar.gz and get one text with the directory tree and every selected file under its path, with a token estimate. Filters leave out vendored code, lock files, binaries and large files; secret files such as .env are never included and obvious tokens are masked.
- The repository is read from GitHub’s public .tar.gz archive of the resolved commit (one REST request turns the branch or tag into a commit; no login, no token) or from the uploaded .zip/.tar.gz. Archives are limited to 25 MB packed, 150 MB unpacked and 5,000 files; tar headers are checksum-verified and every size is checked before reading.
- Every file gets one decision: secret files (.env, private keys, .npmrc, credentials, Terraform state …) are never included; then your leave-out and include patterns (globs with *, **, ?, [abc], {a,b}); then vendored folders and build output, lock files, generated files (*.min.js, *.map), binaries (by extension, NUL bytes or invalid UTF-8) and files above the size limit.
- Included files are masked for obvious secrets with the token rules Codeharbor shares with Opsdeck (private keys, JWTs, bearer tokens, AWS, GitHub, Slack, Stripe-style, AI provider, Google, GitLab, npm and Hugging Face formats, passwords in URLs) plus long string literals assigned to secret-named keys; placeholders and environment lookups stay.
- Token estimate: characters ÷ 4, OpenAI’s rule of thumb; real tokenizers differ by roughly 10–30 %. When the budget is short, files are taken by priority — README, manifests, source code, docs, tests, other — and smaller first; the output keeps the folder order.
Sources
- GitHub REST API: Get a commit (media type application/vnd.github.sha) and rate limits for unauthenticated requests (GitHub Docs)
- Downloading source code archives (GitHub Docs)
- pax — ustar and pax interchange formats (POSIX.1-2017) (The Open Group)
- What are tokens and how to count them? (OpenAI Help Center)
Part of Codeharbor
-
Codeharbor Coding IDE
A coding IDE: edit, preview and run web projects safely, then share them.
How to turn a GitHub repository into one prompt-ready text for AI
Pack a public GitHub repository or a ZIP into one Markdown or text file with the folder tree, every selected file and a token estimate — secrets left out.
What it is for
AI chat assistants and coding agents answer much better when they can see the whole project instead of one pasted file. Copying thirty files by hand is slow, and it is easy to forget the one that matters or to paste a .env file with a password by accident. This tool does the packing for you: give it a public GitHub address such as https://github.com/owner/repo (or upload the repository as .zip or .tar.gz) and you get one text that starts with the folder tree and then lists every selected file under its path.
It decides file by file what belongs in a prompt. Vendored code (node_modules, vendor, dist …), lock files, minified files, binaries and very large files are left out. Secret files such as .env, private keys, .npmrc or Terraform state are never included, and values that look like tokens are masked. It is the same engine Codeharbor uses for its Repo digest view.
It does not summarise or rewrite the code, and nothing is sent to an AI service — you decide where the text goes.
Worked example
The first example on this page uses a small sample repository called Tidewatch, uploaded as a ZIP. It has 25 files: TypeScript in src/, Python scripts, docs, an MIT licence, a .env file, a lock file, one vendored package and a PNG logo.
The tool answers:
21 files of tidewatch-main in one Markdown digest of about 1,976 tokens; 4 files were left out and 1 secret was masked.
The four files left out are the .env file (secret), node_modules/left-pad/index.js (vendored), package-lock.json (lock file) and public/logo.png (binary). In src/config.ts a hard-coded GitHub token became [REDACTED TOKEN], while process.env.GH_TOKEN right next to it stayed — environment lookups are not secrets.
The third example sets the token budget to 1,000. Now 11 files fit (about 963 tokens) and 10 are listed as over budget. README and package.json are taken first, because the budget is filled in priority order: README, manifests, source code, docs, tests, everything else.
How to read the result
- Files included / left out — the table "Files left out" gives the reason for every skipped group.
- Estimated tokens — characters ÷ 4, a common rule of thumb. Real tokenizers count roughly 10–30 % differently, so keep some headroom below your model's context limit.
- Directory tree — skipped files appear with a note such as
[binary]or[lock file]; a vendored folder shows as one line, e.g.node_modules/ [skipped: 1 file]. - Secrets masked — how many values were replaced. The warnings name secret files that were left out.
- Download — the full digest as
.md(or.txtin the plain layout). The page shows only the first 20,000 characters.
Tips and common mistakes
- Use Include only to focus:
src/**/*.tsgave 8 files and about 1,024 tokens in the second example. - Patterns without a slash match file names anywhere (
*.md); a trailing slash means a whole folder (tests/). - Add
/tree/<branch>/<folder>to the address, or fill in Only this folder, to digest part of a monorepo. - Masking catches common token formats, not every secret. Read the text before you paste it into a third-party service.
- Lower Largest file if one generated file eats your budget.
FAQ
Can it read private repositories?
No. Only public repositories, without a login or token. For a private project, download it as a ZIP yourself and upload the file — that works without GitHub at all.
How large can a repository be?
The archive may be up to 25 MB packed and 150 MB unpacked, with at most 5,000 files read. Larger archives get a clear error; upload just the folders you need instead.
Why is my count different from the token counter of my AI tool?
The estimate is characters divided by four. Each model has its own tokenizer, so the real count can differ by a few tens of per cent.
Does it change my code?
Only secret-looking values are masked. Everything else is copied exactly, each file in its own code fence.
Guide last updated:
For scripts and AI agents
- JSON API:
POST https://codeharborrepodigest.usefulweb.app/api/v1/calculate(same calculation as this page) - Interface description: OpenAPI 3.1 · AI guide: llms.txt
- MCP server (Streamable HTTP):
https://codeharborrepodigest.usefulweb.app/mcp· tool namecodeharbor_repo_digest
Example request
curl -s -X POST https://codeharborrepodigest.usefulweb.app/api/v1/calculate \
-H 'content-type: application/json' \
-d '{…see OpenAPI examples…}'