npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@avinashchby/repopack

v0.1.0

Published

Pack an entire codebase into a single LLM-optimized markdown file

Downloads

17

Readme

repopack

Pack an entire codebase into a single LLM-optimized markdown file.


Install

npm install -g repopack

Or run without installing:

npx repopack

Requires Node.js >= 18.


Usage

# Pack current directory → repopack-output.md
npx repopack

# Pack a specific directory with a custom output file
npx repopack ./src -o context.md

# Truncate largest files first to stay under a token budget
npx repopack --max-tokens 100000

# Only include TypeScript files, skip tests
npx repopack --include "*.ts,*.tsx" --exclude "*.test.*"

# Strip comments and collapse blank lines (shrinks token count)
npx repopack --compress

# Print token stats without writing any file
npx repopack --stats

# Copy output to clipboard instead of writing a file
npx repopack --copy

All options

| Flag | Default | Description | |------|---------|-------------| | [dir] | . | Directory to pack | | -o, --output <file> | repopack-output.md | Output file path | | --include <globs> | **/* | Comma-separated glob patterns to include | | --exclude <globs> | — | Comma-separated glob patterns to exclude | | --max-tokens <n> | — | Token budget; drops largest files first until under limit | | --compress | off | Strip comments and collapse blank lines | | --stats | off | Print token stats to stdout, skip file write | | --copy | off | Copy output to clipboard instead of writing a file |


Output format

# Repository: my-project
Generated by repopack | 42 files | ~18,400 tokens

## File Tree

my-project ├── src │ ├── index.ts │ └── utils.ts └── package.json


## src/index.ts
```typescript
// ... file contents

src/utils.ts

// ... file contents

Each file gets a level-2 heading with its relative path and a fenced code block with the correct language tag. Paste the whole file directly into any chat or API call.

---

## Smart defaults

The following are excluded automatically, with no configuration needed:

- `node_modules/`
- `.git/`
- Lock files: `package-lock.json`, `yarn.lock`, `pnpm-lock.yaml`, `bun.lockb`
- Environment files: `.env`, `.env.*`
- Binary files: images, fonts, audio, video, archives, executables, PDFs

Your `.gitignore` rules are also respected automatically.

---

## Token counting

repopack uses `cl100k_base` (tiktoken) to count tokens — the same encoding used by GPT-4. Claude and Gemini token counts are approximated with the same encoder, which is accurate to within ~5% for typical source code.

`--stats` output shows usage against each model's context window:

Total tokens: 18,400

Model context usage: GPT-4 18,400 / 128,000 tokens (14.4%) Claude 18,400 / 200,000 tokens (9.2%) Gemini 18,400 / 1,000,000 tokens (1.8%)


**Context limits used for comparison:**

| Model | Limit |
|-------|-------|
| GPT-4 | 128,000 tokens |
| Claude | 200,000 tokens |
| Gemini | 1,000,000 tokens |

Use `--max-tokens` to truncate when you need to stay within a specific limit. Files are dropped largest-first until the output fits.

---

## .repopackignore

Place a `.repopackignore` file in your project root to exclude files that you don't want in `.gitignore`. Uses the same syntax as `.gitignore`.

.repopackignore

dist/ *.generated.ts fixtures/


Priority order (highest to lowest): `--exclude` flag → `.repopackignore` → `.gitignore` → built-in defaults.

---

## Compression

`--compress` reduces token count by:

1. Stripping comments (JS/TS/Python; other languages are left untouched)
2. Collapsing consecutive blank lines to a single blank line
3. Trimming trailing whitespace per line

Typical reduction is 10–30% depending on how comment-heavy the codebase is.

---

## License

MIT — see [LICENSE](LICENSE).