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.4.2.tar.gz (11.1 kB view details)

Uploaded Source

Built Distribution

codemapper-3.4.2-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for codemapper-3.4.2.tar.gz
Algorithm Hash digest
SHA256 6e8239551f96bab98e4ec94c299dffc256172cfcb6ce83574ae3e8a46ec5532a
MD5 fac447d2aac54db9f7dd5a6e9ff76a93
BLAKE2b-256 9123040a1062d483acd8b070e3236c3e8fe65831ce1779d022d380219bcd6eee

See more details on using hashes here.

File details

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

File metadata

  • Download URL: codemapper-3.4.2-py3-none-any.whl
  • Upload date:
  • Size: 9.8 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.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 29575578262010f591dc2d8655620d33aec262a9afed4f256c4b6761b9ea1e9a
MD5 4bf7016a784d622e7b9fb510870238a2
BLAKE2b-256 a3cea0df0a0b2b95755097b51aae8ce976dc36c9aaa16d6a85551fc6c4696967

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