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

generate-context

v1.0.1

Published

CLI tool to generate LLM-friendly code context files for AI, agents, embeddings, and prompt engineering.

Readme

📝 generate-context

Effortless context file generator for AI, LLMs, prompt engineering, code agents & embeddings.
Recursively grabs your codebase, filters noise, and spits out clean, LLM-friendly context files. 🚀

License: MIT

🚀 Features

  • Recursively scans files & nested folders
  • Fully configurable file filtering
  • Priority files ordering (put your important files on top!)
  • Auto prioritizes README.md by default
  • Works for files at any depth
  • Exclude unwanted folders, extensions, or specific files
  • Supports both CLI args & config file
  • Friendly CLI: supports comma-separated OR space-separated inputs
  • Dry-run mode to preview files
  • Clean, LLM-friendly output format
  • Beautiful colored CLI output 🎨
  • Fast & lightweight pure Node.js CLI

📦 Installation

Clone the repo & install dependencies:

git clone <your-repo-url>
cd generate-context
npm install

Optional: link globally:

npm link

Or:

npm install -g .

⚡ Quick Usage

generate-context

Scans current directory and creates prompt-context.txt like:

FILE: /src/file1.js
BEGIN FILE CONTENT
<file content here>
END FILE CONTENT

FILE: /public/index.html
BEGIN FILE CONTENT
<file content here>
END FILE CONTENT

🔧 CLI Options

| Option | Description | Default | | ----------------------------------------- | -------------------------------------------------------------- | ------------------------------------------------------------------------- | | -p, --path <path> | Path to scan | . | | -o, --output <filename> | Output filename | prompt-context.txt | | -F, --ignore-folders [folders...] | Folders to ignore (space/comma separated) | .git .vscode node_modules dist | | -f, --ignore-files [files...] | Files to ignore (space/comma separated) | .env package-lock.json .generatecontextrc.json prompt-context.txt | | -e, --ignore-extensions [extensions...] | Extensions to ignore (space/comma separated, no dot) | bat log tmp | | -P, --priority-files [files...] | Files to always place on top (space/comma separated, any path) | README.md always default | | -d, --dry-run | Show files that would be included without writing | false |

✅ Both comma , and space-separated values are supported.

🔧 Config File Support (.generatecontextrc.json)

You can also configure via file in project root:

{
  "output": "my-context.txt",
  "ignoreFolders": [".git", ".vscode", "node_modules", "dist", "coverage"],
  "ignoreExtensions": ["bat", "log", "tmp", "env"],
  "ignoreFiles": ["package-lock.json", ".env"],
  "dryRun": false
}
  • CLI flags always override config values.
  • Priority files take absolute priority regardless of directory depth.

🔥 Examples

Default usage

generate-context

Custom priority files

generate-context -P index.js bin/cli.js src/app.js

Scan specific folder

generate-context -p ./src

Change output filename

generate-context -o context.txt

Ignore folders

generate-context -F dist .cache coverage
# OR
generate-context --ignore-folders dist,.cache,coverage

Ignore file extensions

generate-context -e log tmp env
# OR
generate-context --ignore-extensions log,tmp,env

Ignore specific files

generate-context -f .env .DS_Store package-lock.json
# OR
generate-context --ignore-files .env,.DS_Store,package-lock.json

Combine everything

generate-context -p ./backend -o my-context.txt -F dist .cache -e log tmp -f .env package-lock.json -P index.js schema/prisma/schema.prisma -d

Dry-run mode

generate-context -d

📊 Output format (LLM optimized)

FILE: /relative/path/to/file.js
BEGIN FILE CONTENT
<actual file content>
END FILE CONTENT
  • ✅ Easy to parse
  • ✅ No YAML or JSON headaches
  • ✅ Perfect for LLM context injection

💡 Why this tool?

LLMs work better with clean, structured context from your codebase. generate-context helps you package your files into simple, predictable formats for:

  • AI agents
  • Embeddings
  • Prompt chains
  • Fine-tuning data prep
  • Code summarization pipelines

🤝 Contribute

Got ideas? Found bugs? Issues, PRs, and feedback always welcome!

Made with ❤️ by Mihir Patel