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 🙏

© 2025 – Pkg Stats / Ryan Hefner

codetxt

v1.0.1

Published

CLI tool to analyze and create text dumps of codebases for LLMs. A Node.js/TypeScript implementation inspired by gitingest.

Readme

CodeTxt

A CLI tool to turn any Git repository into a prompt-friendly text ingest for LLMs.

Whether you're preparing codebases for AI analysis, training data, or static search indexing, CodeTxt helps you generate clean, filtered code dumps with ease.

Installation

Prerequisites

First, ensure you have Node.js (v18 or higher) installed on your system.

Global Installation

You can install the CLI globally in one of two ways:

Option 1: Install from local project

# After cloning the repository
npm install -g .

This command needs to be run from the root of the project. It will build the TypeScript code and link the codetxt command to your system.

Option 2: Install from npm registry (when published)

npm install -g codetxt

After installation, you can use the codetxt command from anywhere in your terminal.

Usage

The CLI is simple to use. You can point it to a remote Git repository or a local directory.

From a Remote URL

codetxt https://github.com/facebook/react

From a Local Directory

# Analyze the current directory
codetxt .

# Analyze a specific local path
codetxt /path/to/my/project

Options

| Flag | Alias | Description | Default | | --------------------------- | ----- | --------------------------------------------------------------------------- | ------------ | | --output <file> | -o | Specify an output file. Use - for stdout. | code.txt | | --max-size <bytes> | -s | Skip files larger than this size in bytes. | 10MB | | --branch <name> | -b | For remote repos, specify a branch to clone. | Default repo branch | | --include-pattern <glob> | | Only include files/directories matching the glob pattern(s). | - | | --exclude-pattern <glob> | | Exclude files/directories matching the glob pattern(s). | - | | --include-gitignored | | Process files and directories that are normally ignored by .gitignore. | false | | --force | -f | Overwrite an existing output file without asking for confirmation. | false | | --token <pat> | -t | GitHub Personal Access Token for private repositories. | - |

Examples

Basic Usage

Write to a specific file:

codetxt https://github.com/expressjs/express -o express-code.txt

Pipe output to another command (e.g., grep):

codetxt . -o - | grep "function"

Analyze a specific branch and ignore large files:

codetxt https://github.com/vuejs/core --branch main --max-size 50000

Include files normally ignored by .gitignore:

codetxt . --include-gitignored -o all-files.txt

Advanced Pattern Filtering

The tool supports powerful glob-style pattern filtering for fine-grained control over which files to include or exclude. This is especially useful for monorepos or workspaces with multiple projects.

Exclude Patterns (--exclude-pattern)

Use this to skip specific files or entire directories.

Exclude a specific directory (e.g., docs/):

codetxt . --exclude-pattern "docs/"

Result: Will analyze the entire project but skip the docs directory and all its contents.

Exclude multiple directories and file types:

codetxt . --exclude-pattern "project-A/" --exclude-pattern "tests/" --exclude-pattern "*.log"

Result: Will skip project-A, the tests directory, and any file ending with .log.

Include Patterns (--include-pattern)

Use this to create a "whitelist" of what you want to analyze. Everything else will be ignored.

Include only a specific directory and its contents:

codetxt . --include-pattern "project-A/**"

Result: Will analyze only the contents of project-A. All other files and directories will be ignored.

Include only JavaScript and Markdown files from the entire project:

codetxt . --include-pattern "**/*.js" --include-pattern "**/*.md"

Result: The digest will only contain JavaScript and Markdown files.

Important Notes on Include Logic

When using --include-pattern, the tool assumes you want nothing except what matches the pattern:

  • For files: The filename must match the pattern to be included.
  • For directories: The tool will traverse all directories, but only those containing files that match the include pattern will appear in the final output tree.

This gives you complete control over what gets analyzed, which is perfect for focusing on specific parts of a large codebase.

How to Set Up for Development

  1. Clone this repository.
  2. Install dependencies: npm install
  3. Build the project: npm run build
  4. Run directly using ts-node: npm start .