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

gen-context

v1.0.3

Published

A tool to create a context for AI prompts from files.

Readme

gen-context

gen-context is a simple yet powerful command-line tool designed to gather the contents of multiple files within a project directory and consolidate them into a single text file named context.txt. This is particularly useful for providing a large language model (LLM) with a comprehensive overview of a project.

Key Features

  • File Consolidation: Combines multiple files into a single context.txt file.
  • Intelligent File Selection: By default, it processes only text files, ignoring binaries.
  • Flexible Filtering: Allows for the inclusion or exclusion of files based on their extensions.
  • Pattern Exclusion: Enables the exclusion of files whose names contain specific strings.
  • Directory Ignoring: Excludes common directories like node_modules, .git, and others by default.
  • Token Estimation: Provides an estimate of the token count for the generated context file.

Installation

Ensure you have Node.js installed on your system. You can then run this tool using npx without needing a global installation:

npx gen-context [options]

Usage

Run the command in your project's root directory. The tool will recursively scan the current directory, gather the content of relevant files, and create a context.txt file.

Default Behavior

When run without any arguments, gen-context will scan the current directory and all subdirectories. It will include the content of all text files it finds into the context.txt file. Directories such as node_modules, .git, .vscode, dist, and build are automatically ignored.

npx gen-context

Options

You can customize the behavior of gen-context with the following command-line arguments:

  • Include File Extensions: To include only files with specific extensions, simply list them.

    • Example: To include only .js and .html files:
      npx gen-context .js .html
  • Exclude File Extensions: To exclude files with specific extensions, prefix the extension with a -.

    • Example: To exclude .css and .md files:
      npx gen-context -.css -.md
  • Exclude Filename Patterns: To exclude files whose names contain a specific pattern (case-insensitive), prefix the pattern with a -.

    • Example: To exclude any file containing "test" or "config" in its name:
      npx gen-context -test -config

Combining Options

You can combine these options to further refine your file selection.

  • Include only .js and .css files, but exclude any file with "vendor" in its name:

    npx gen-context .js .css -vendor
  • Include all text files but exclude .log files and any file containing "temp":

    npx gen-context -.log -temp

Output

After running, the script will print the following to the console:

  1. A summary of the filters being applied (included/excluded extensions and patterns).
  2. A success message confirming the creation of context.txt.
  3. A list of all the files that were included in the context file.
  4. An estimated token count of the generated context.txt file, which is useful for LLM usage.

The resulting context.txt file will be formatted as follows:

The context is:

# File: path/to/file1.js
// content of file1.js

# File: path/to/file2.html
<!-- content of file2.html -->

...

Use Case

The primary use case for this tool is to quickly provide the entire context of a code project to a large language model. Instead of manually copying and pasting each file, you can simply run gen-context and use the content of the resulting context.txt file.