Skip to main content

A tool to generate comprehensive Markdown artifacts of directory structures and file contents

Project description

CodeMapper

Pylint TODO logo

Overview

The CodeMapper is a powerful Python script that creates a comprehensive Markdown document representing the structure and contents of a given directory or GitHub repository. This tool is designed to provide a quick and thorough overview of codebases, making it invaluable for developers, AI systems, and analysts who need to quickly understand the layout and content of a project.

See audio explainers for this project:

  • podcasts Auto generated by Gemini (NotebookLLM)

Features

  • Generates a hierarchical table of contents based on file structure
  • Creates an accurate file tree representation of the directory structure
  • Produces code blocks for each file's contents with appropriate syntax highlighting
  • Respects .gitignore rules when processing files and directories
  • Excludes .git directories by default
  • Supports various file types with appropriate code fence highlighting
  • Handles file encoding detection for accurate content reading
  • Provides an option to include files normally ignored by .gitignore
  • Can clone and analyze GitHub repositories
  • Saves output in a '_codemaps' directory
  • Automatically acknowledges large and binary files without printing their contents
  • Displays file type and size information for large and binary files

Roadmap

Requirements

  • Python 3.6+
  • pathspec library (for handling .gitignore rules)
  • chardet library (for file encoding detection)

Installation

From PyPI

You can install CodeMapper directly from PyPI using pip:

pip install codemapper

From Source

  1. Clone this repository:

    git clone https://github.com/yourusername/codemapper.git
    
  2. Install the required dependencies:

    pip install pathspec chardet
    

Usage

Run the script from the command line, providing the path to the directory or GitHub repository URL you want to analyze:

codemapper <path_to_directory_or_github_url> [--include-ignored]

Options

  • <path_to_directory_or_github_url>: The path to the directory or GitHub repository URL you want to analyze (required)
  • --include-ignored: Include files that are normally ignored by .gitignore (optional)

Output

The script generates a Markdown file named <directory_name>codemap.md in the '_codemaps' directory. This file contains:

  1. A table of contents for easy navigation
  2. A file tree representation of the directory structure
  3. The contents of each file, formatted with appropriate syntax highlighting
  4. Information about large and binary files (type and size) without their contents

Example use and output:

codemapper https://github.com/shaneholloman/ansible-role-apache

Example output see here

Use Cases

  • Quickly understand the structure of new or unfamiliar projects
  • Generate documentation for your code-based Ai prompts
  • Facilitate code reviews by providing a comprehensive one page overview
  • Assist AI systems in analyzing and understanding codebases
  • Analyze GitHub repositories without needing to clone them manually

TODO

codemapper todo list is here

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

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

Acknowledgments

  • Thanks to the pathspec and chardet libraries for making this tool possible.

Version History

[For full version history, see changelog.md]


Don't forget to star this repository if you find it useful!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

codemapper-3.5.0.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

codemapper-3.5.0-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file codemapper-3.5.0.tar.gz.

File metadata

  • Download URL: codemapper-3.5.0.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for codemapper-3.5.0.tar.gz
Algorithm Hash digest
SHA256 b0003134503f5733d27e3fc89640dc7c84407abc3dfc572229c125e7b187a0ca
MD5 8fcd647922b3bf94c9d2a65a55abf2d3
BLAKE2b-256 5ce5f4b7badee550e4db75ba826486ebdce5cd4526a160195c2025fccdf4f23e

See more details on using hashes here.

File details

Details for the file codemapper-3.5.0-py3-none-any.whl.

File metadata

  • Download URL: codemapper-3.5.0-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for codemapper-3.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6c382a91d115118b35e69601b41c9011d63c163dd98d4882692b2110c53f22c6
MD5 554c94ceeca4f790e4c398f0238a42c7
BLAKE2b-256 50d851c11e78f121d60535e917f29807185f3669627e7b31d4883faf48ac05c5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page