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

ai-context-packer

v2.0.0

Published

Package your codebase into a single LLM-optimized Markdown or XML context file

Readme

Markdown

📦 ai-context-packer

Package your codebase into a single, LLM-optimized context file — instantly.

ai-context-packer walks a directory (or file list), filters out noise, and produces one clean Markdown or XML document you can paste directly into Claude, GPT-4, Gemini, or any other LLM.

🔥 v2.0.0 Update: Now features Interactive TUI, Git-Diff packing, Skeleton mode, Auto-splitting, and Direct Ask API!


✨ Features

| Feature | Details | |---|---| | Intelligent ignoring | Auto-ignores node_modules, .git, binaries, lock files. Respects .gitignore. | | 🧠 Direct Ask API | Send your codebase context and a prompt directly to OpenAI/Anthropic APIs from the terminal. | | 🎛️ Interactive UI | Use -i to visually select exactly which folders and files to pack. | | 🐙 Git-Diff Packing | Use --changed to only pack files you've modified or added. | | 🦴 Skeleton Mode | Strip function implementations but keep signatures/classes to pack massive repos. | | 🪓 Auto-Splitting | Set a token limit and automatically chunk the output into multiple files. | | Secret scanner | Detects .env files, API keys, private keys, connection strings — prompts before including them. |


🚀 Quick Start

Run without installing (npx)

npx ai-context-packer .
Install globally
Bash

npm install -g ai-context-packer
ai-context-packer .
📖 Usage
ai-context-packer [target] [options]
Arguments
Argument	Description	Default
target	Directory or file path to pack	. (current dir)

Options
Flag	Description	Default
-i, --interactive	Interactively select files and folders to include	—
--changed	Only pack files modified, staged, or untracked in git	—
--skeleton	Strip function bodies, keep signatures only (saves massive tokens)	—
--chunk <limit>	Split output into multiple files if tokens exceed this limit	—
--ask <query>	Send the packed codebase + your query directly to an AI API	—
--minify	Strip comments and blank lines to save LLM tokens	—
-f, --format <format>	Output format: markdown or xml	markdown
-o, --output <file>	Write output to a file (instead of clipboard)	—
--no-tree	Omit the directory tree	—
--no-clipboard	Skip clipboard copy	—
--include <globs>	Only include matching files (comma-separated)	—
--exclude <globs>	Force-exclude matching files (comma-separated)	—
--max-file-size <kb>	Skip files larger than N KB	500
--no-secrets-scan	Disable secret scanning	—
-V, --version	Print version	—

🔥 Advanced Examples (v2.0)
Bash

# Ask AI directly (requires OPENAI_API_KEY or ANTHROPIC_API_KEY exported in env)
ai-context-packer . --ask "Find security vulnerabilities in this code"

# Visual selection: choose exactly what to pack
ai-context-packer . -i

# Only pack files you've modified in Git
ai-context-packer . --changed

# Pack a huge repo by only keeping class/function signatures
ai-context-packer . --skeleton

# Auto-split the output into multiple files if it exceeds 500k tokens
ai-context-packer . --chunk 500000
Basic Examples
Bash

# Pack current directory → clipboard (Markdown)
ai-context-packer .

# Only include TypeScript and Markdown files
ai-context-packer . --include "*.ts,*.md"

# Pack a remote GitHub repository directly
ai-context-packer https://github.com/user/repo
🔐 Secret Scanning
If a secret is detected you'll see:

  🔐 SECRETS DETECTED IN PAYLOAD  
────────────────────────────────────────────────────────────
  ⚠  .env
       .env file
  ⚠  src/config.js
       API key or secret assignment
────────────────────────────────────────────────────────────
  Sending secrets to an LLM poses a serious privacy risk!

? Continue anyway and include these files? › (y/N)
Answering N aborts with no output written. You can suppress this check entirely with --no-secrets-scan.

📊 Token Counter
After packing, you'll see a summary like:

── Summary ───────────────────────────────────
  Format          MARKDOWN
  Files packed    42
  Files skipped   118
  Total size      184.3 KB
  Est. tokens     ~47,200
  Fits in         GPT-5.5 Pro (1M), Claude Opus 4.7 (1M), Gemini 3.1 Pro (1M)
──────────────────────────────────────────────
Tokens are estimated using the fast heuristic max(wordCount, charCount / 4), which is within ~5% of cl100k_base for typical code.

🛠️ Architecture
src/
├── api.js           OpenAI / Anthropic direct fetch client
├── cli.js           Main entry point & command wiring
├── collector.js     Directory walker, ignore rules, file reader
├── formatter.js     Markdown & XML output builders, skeletonizer
├── tokenCounter.js  Fast heuristic token estimator & chunking logic
├── secretScanner.js Regex-based secret/credential detection
└── ui.js            Banner, summary, chalk colours
License
MIT