A tool to generate comprehensive Markdown artifacts of directory structures and file contents
Project description
CodeMapper
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
-
Clone this repository:
git clone https://github.com/yourusername/codemapper.git
-
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:
- A table of contents for easy navigation
- A file tree representation of the directory structure
- The contents of each file, formatted with appropriate syntax highlighting
- Information about large and binary files (type and size) without their contents
Example use and output:
codemapper https://github.com/shaneholloman/ansible-role-apache
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
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
andchardet
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file codemapper-3.4.0.tar.gz
.
File metadata
- Download URL: codemapper-3.4.0.tar.gz
- Upload date:
- Size: 10.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 47c5646d5f938b0e972a85d077a5699118948a12654e7751eedaad9c72492e53 |
|
MD5 | 6af9a7fda8c4d88e6f6bb4ff8c365dfa |
|
BLAKE2b-256 | 04d6aeba99882f68b661d858e6574763bb42e1285d9ac37470d57ac77d29a866 |
File details
Details for the file codemapper-3.4.0-py3-none-any.whl
.
File metadata
- Download URL: codemapper-3.4.0-py3-none-any.whl
- Upload date:
- Size: 9.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b0264f9fc68674be7dc114366720a7520deaf2d8d498e4aa605a3556691625e7 |
|
MD5 | ebf406040e48b0e2c5beb65f8261b35b |
|
BLAKE2b-256 | b2d795a2ee711fb929e391b6563f3a5a8f772f23e360e50918649d8f50e42d03 |