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

codebase-digest

v1.0.9

Published

A highly configurable tool to turn any codebase into a simple text digest for LLM consumption

Readme

Codebase Digest

A high-performance, enterprise-grade utility for transforming codebases into structured text digests optimized for Large Language Model (LLM) consumption, documentation generation, and code analysis.

npm version License: MIT

Table of Contents

Overview

Codebase Digest transforms source code repositories into structured text representations optimized for:

  • LLM model ingestion
  • Documentation generation
  • Code analysis and metrics
  • Security auditing

Key Features

  • Multiple Output Formats: Text, JSON, Markdown, and Tree structure
  • Intelligent Processing: Smart file handling, encoding detection, and metadata extraction
  • High Performance: Parallel processing with configurable resource management
  • Enterprise Ready: Comprehensive error handling, retry mechanisms, and detailed logging

Quick Start

Installation

Global installation

npm install -g codebase-digest

Local project installation

npm install --save-dev codebase-digest

Basic Usage

CLI usage

codebase-digest ./src -f json -o output.json

Node.js usage

import { processDirectory } from 'codebase-digest';
const result = await processDirectory('./src');

Documentation

Comprehensive documentation is available in:

Project Structure

codebase-digest/
├── src/
│   ├── index.js         # Main entry point
│   ├── cli/            # Command-line interface
│   ├── core/           # Core processing logic
│   ├── formatters/     # Output formatters
│   │   ├── json-formatter.js
│   │   ├── markdown-formatter.js
│   │   ├── text-formatter.js
│   │   └── tree-formatter.js
│   └── utils/          # Utility functions
│       ├── encoding.js
│       ├── file-detection.js
│       ├── git.js
│       ├── logger.js
│       └── metadata.js
├── docs/              # Documentation
│   ├── api.md         # API reference
│   ├── cli.md         # CLI usage guide
│   ├── configuration.md # Configuration options
│   └── plugins.md     # Plugin development guide
└── examples/          # Example implementations
    ├── api-usage/     # Programmatic usage examples
    ├── plugins/       # Plugin examples
    └── integrations/  # Third-party integrations

The project is organized to provide a clear separation of concerns:

  • src/: Contains the core implementation
  • docs/: Comprehensive documentation for all aspects of the tool
  • examples/: Real-world usage examples and integrations

Output Formats

Text

Simple, readable text output with configurable formatting:

File: src/index.js
Size: 1.25 KB
Content: ...

JSON

Structured data format for programmatic usage:

{
  "path": "src/index.js",
  "size": 1280,
  "content": "..."
}

Markdown

Rich documentation with syntax highlighting:

## src/index.js
\`\`\`javascript
const code = 'here';
\`\`\`

Tree

Hierarchical view of codebase structure:

.
├── src/
│   ├── index.js (1.25 KB)
│   └── utils/

Common Use Cases

  1. LLM Processing
codebase-digest ./src --llm-format --strip-comments
  1. Documentation
codebase-digest ./src -f markdown --code-statistics
  1. Code Analysis
codebase-digest ./src --code-metrics --git-stats
  1. Security Audit
codebase-digest ./src --security-scan --dependency-check

See CLI Documentation for more advanced examples.

Configuration

Basic configuration via command line:

codebase-digest ./src --include "**/*.js" --exclude "**/*.test.js"

Advanced configuration via JSON:

{
  "outputFormat": "json",
  "maxFileSize": 1048576,
  "parallel": true,
  "maxParallelProcesses": 8
}

See CLI Documentation and API Documentation for complete configuration options.

Requirements

  • Node.js 14.16.0 or higher
  • NPM 6.14.0 or higher

Contributing

  1. Fork the repository
  2. Create your feature branch: git checkout -b feature/my-feature
  3. Commit your changes: git commit -am 'Add my feature'
  4. Push to the branch: git push origin feature/my-feature
  5. Submit a pull request

License

This project is licensed under the MIT License - see the LICENSE file for details.