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

code-context-extractor

v0.2.1

Published

Local-only CLI tool to extract codebase context into a single text or Markdown file.

Readme

CodeContextExtractor

CodeContextExtractor is a local-only CLI that captures a deterministic snapshot of a codebase and writes it to a single text or Markdown file. It exists for one purpose: safely sharing repository context with an AI assistant or teammate without uploading the repo itself or exposing sensitive files.

Why it exists

  • Developers need a clean, reliable way to send project context to AI tools
  • Repositories contain secrets, binaries, and noise that should be skipped by default

Who it is for

  • Engineers who want fast, offline context exports
  • Teams who need predictable, reproducible outputs
  • Anyone who shares code with AI systems and wants safe defaults

Quick start

  1. Open a terminal at your project root (the folder you want to scan).
    Example on Windows:
cd C:\projects\MyNewProject
  1. Run the command (npx will install on first use if needed):
npx code-context-extractor extract . --verbose
  1. Open the code-context/ folder in your project (for example: C:\projects\MyNewProject\code-context).
  2. Locate the newest file, named like:
code-context/<root>_context_YYYY-MM-DD_HHMMSS.txt

Example:

code-context/MyNewProject_context_2026-01-20_145743.txt
  1. Paste that file into your AI tool when you want it to understand the codebase.

Important: .gitignore your outputs

Warning ⚠️
CodeContextExtractor writes files into a code-context/ folder inside your project root. If that folder is not ignored, you may accidentally commit and push your context exports.

Add this line to your project's .gitignore:

code-context/

Install from GitHub (optional)

git clone https://github.com/Rwstrobe/CodeContextExtractor.git
cd CodeContextExtractor
npm install
npm run build
npm link

Run the linked CLI:

code-context-extractor extract . --verbose

Or run the built CLI directly:

node dist/cli.js extract . --verbose

Features

  • Local-only operation (no network calls, telemetry, or analytics)
  • Cross-platform: Windows, macOS, Linux
  • Safe defaults with common sensitive excludes
  • Configurable include/exclude globs and max file size
  • Deterministic ordering and normalized paths/line endings
  • Streaming output (does not load large files into memory)
  • Conservative redaction enabled by default
  • Optional Markdown output
  • Automatic output folder code-context/

Commands

Extract

code-context-extractor extract [path]

Example:

code-context-extractor extract ./project --format md --depth 3 --verbose

Options

--out <file>            Output file (default: code-context/<root>_context_YYYY-MM-DD_HHMMSS.txt)
--format <text|md>      Output format (default: text)
--depth <n>             Tree depth (default: 4)
--include <glob>        Include glob (repeatable)
--exclude <glob>        Exclude glob (repeatable)
--max-bytes <n>         Max file size in bytes (default: 500000)
--redact                Enable redaction (default: true)
--no-redact             Disable redaction
--respect-gitignore     Honor .gitignore (default: true)
--no-gitignore          Ignore .gitignore rules
--config <file>         Optional JSON config file
--verbose               Verbose logging

Output format

Each output file contains:

  • LLM context header (how to interpret the file)
  • Metadata header (root path, timestamp, tool version, command, config summary)
  • Folder tree (depth-limited)
  • Included files summary (count and total size)
  • Skipped files summary (total, by reason, top roots)
  • For each included file: path, size, last modified, and contents in fenced blocks

Redaction

Redaction is enabled by default to reduce accidental secret leakage. It targets:

  • Common key/value patterns (tokens, passwords, api keys)
  • Private key blocks
  • Common credential formats (JWTs, GitHub tokens, AWS keys, etc.)

Disable redaction only when you are sure the output is safe:

code-context-extractor extract . --no-redact

Default excludes

The following are excluded by default:

node_modules
dist
build
out
code-context
.next
.turbo
.git
.idea
.vscode
coverage
package-lock.json
yarn.lock
pnpm-lock.yaml
bun.lockb
.npmrc
.yarnrc
.yarnrc.yml
*.lock
*.log
*.pem
*.key
*.p12
*.env
.env.*
secrets.*
id_rsa
id_ed25519

Lock files are excluded by default because they are machine-generated, often large, and typically add little architectural context.

Configuration file

Use an optional JSON file (example: example-config.json) to set defaults.

{
  "outFile": "code-context/project_context_2026-01-19_145227.txt",
  "format": "text",
  "depth": 4,
  "include": [],
  "exclude": [],
  "maxBytes": 500000,
  "redact": true,
  "respectGitignore": true
}

Use it like this:

code-context-extractor extract . --config example-config.json

Safety posture

  • No network access or external services
  • Does not execute or evaluate code from your repository
  • Skips common sensitive files by default
  • Redacts likely secrets unless --no-redact is specified

Development

npm run build
npm test

FAQ

Does this upload my repo or call any APIs?
No. It is local-only, with no network calls or telemetry.

Why use npx?
npx runs the CLI without a global install. It will download the package if needed.

Why are .git and node_modules excluded?
They add a lot of noise and size without improving architectural context.

The output is huge. How do I reduce it?
Use --depth, --max-bytes, and more --exclude globs, or add a config file.

License

MIT