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

@mehti/codemap

v1.0.2

Published

A CLI tool to scan code files and generate a comprehensive Markdown documentation

Readme

CodeMap

A powerful CLI tool that scans your project directory and generates comprehensive Markdown documentation of all code files.

Features

  • Recursively scans directories for code files from any subdirectory
  • Supports 30+ programming languages and file types
  • Generates a clean, formatted Markdown document with:
    • Project structure tree view from current directory
    • File summary table with sizes and types
    • Full file contents with syntax-highlighted code blocks
  • Automatically detects project root (via .git or package.json)
  • Ignores common build directories and dependencies (node_modules, dist, etc.)
  • Handles large files gracefully (skips files over 1MB)
  • Cross-platform path normalization (uses forward slashes)
  • Robust error handling with detailed error messages
  • Smart Markdown escaping for special characters in file paths

Installation

Global Installation

Install globally to use codemap command anywhere:

npm install -g @mehti/codemap

Using npx (No Installation Required)

Run directly without installation:

npx @mehti/codemap

Local Development

Clone and test locally:

git clone <repository-url>
cd codemap
npm link
codemap

Usage

Navigate to any project directory and run:

codemap

This will:

  1. Scan all code files in the current directory and subdirectories
  2. Generate a CODEMAP.md file in the current directory
  3. Include a project tree structure starting from the current directory

Example Output

🗺️  CodeMap - Scanning your project...

📂 Working directory: /path/to/your/project
📍 Project root detected: Yes

🔍 Scanning files...
✅ Found 15 code file(s)

🌳 Building project tree...
📝 Generating markdown documentation...

✨ Success! Documentation generated at:
   /path/to/your/project/CODEMAP.md

Supported File Types

CodeMap recognizes and processes the following file types:

  • JavaScript/TypeScript: .js, .jsx, .ts, .tsx
  • Python: .py
  • Java: .java
  • C/C++: .c, .cpp, .h, .hpp
  • C#: .cs
  • Go: .go
  • Rust: .rs
  • Ruby: .rb
  • PHP: .php
  • Swift: .swift
  • Kotlin: .kt
  • Scala: .scala
  • Shell: .sh, .bash
  • SQL: .sql
  • R: .r
  • Objective-C: .m, .mm
  • Dart: .dart
  • Frameworks: .vue, .svelte
  • Web: .html, .css, .scss
  • Config: .json, .xml, .yaml, .yml, .toml
  • Documentation: .md, .txt

Ignored Directories

CodeMap automatically skips the following directories:

  • node_modules, .git, .svn, .hg
  • dist, build, out, target, bin, obj
  • .next, .nuxt, .cache, coverage
  • __pycache__, .pytest_cache
  • .venv, venv, env
  • .idea, .vscode

Output Format

The generated CODEMAP.md includes:

  1. Header - Project name and generation timestamp
  2. Table of Contents - Quick navigation links
  3. Project Overview - Directory path and root detection status
  4. Project Structure - ASCII tree view from current directory
  5. File Summary - Table with all files, types, and sizes
  6. File Contents - Full content of each file with syntax highlighting

Configuration

Currently, CodeMap uses sensible defaults. Future versions may include:

  • Custom ignore patterns
  • Configurable file size limits
  • Output format options
  • Filter by file type

Requirements

  • Node.js >= 14.0.0

License

MIT

Contributing

Contributions are welcome! Please feel free to submit issues or pull requests.

Use Cases

  • Documentation: Generate quick documentation for code reviews
  • Onboarding: Help new team members understand project structure
  • Archiving: Create snapshots of project code at specific points
  • AI/LLM Input: Prepare codebase context for AI assistants
  • Code Audits: Get a comprehensive view of all code files

Troubleshooting

Permission Errors

If you encounter permission errors, CodeMap will display a clear error message:

  • Permission denied: Cannot read file - File access is restricted
  • Permission denied: Cannot access directory - Directory access is restricted
  • Permission denied: Cannot write to the current directory - Output location is read-only

On Unix systems, you may need to make the CLI file executable:

chmod +x cli.js

No Files Found

If CodeMap reports no files found:

  • Check that you're in the correct directory
  • Verify your files have recognized extensions
  • Ensure files aren't in ignored directories

Large Files Skipped

Files larger than 1MB are automatically skipped to prevent memory issues. The markdown will show a placeholder message for these files.

Symbolic Links

Symbolic links are automatically skipped to avoid circular references and infinite loops.

Credits

Created to help developers quickly document and share their codebases.