Skip to main content

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

Project description

CodeMapper

Pylint PyTest TODO logo

Overview

[!IMPORTANT] CodeMapper: Bridging Code Understanding for AI and Human Analysis Install: pip install codemapper

CodeMapper is a powerful Python tool that transforms complex codebases into navigable, single-file Markdown artifacts, with a unique ability to bootstrap AI chat prompts for code analysis. Designed with both AI engineers and hobbyist developers in mind, it serves as a bridge between traditional code exploration and modern AI-assisted development workflows. Whether you're training large language models, conducting interactive AI-assisted code reviews, or simply trying to understand a new project, CodeMapper provides a unified, accessible view of your codebase that's optimized for both human readability and AI consumption.

Key Features

  • Unified Code Visualization: Automatically generates a comprehensive Markdown representation of your entire codebase, including:

    • Complete directory structure visualization
    • Syntax-highlighted code content
    • Intelligent file categorization
    • Documentation aggregation
  • AI Integration Optimizations:

    • Structured output format ideal for LLM training and analysis
    • Consistent formatting for improved token efficiency
    • Built-in support for common documentation patterns
    • Metadata preservation for enhanced context
  • Git-Aware Processing:

    • Respects .gitignore rules by default
    • Direct GitHub repository URL support
    • Handles large repositories efficiently
    • Smart binary file detection
  • Documentation Focus:

    • Dedicated DocMap generation for documentation-heavy projects
    • README file prioritization
    • Support for multiple documentation directory conventions
    • Markdown-native output for universal compatibility

AI Chat Integration

CodeMapper excels at bootstrapping AI chat interactions for code analysis. When you need to understand, debug, or enhance your code with AI assistance:

  1. Generate a codemap of your project
  2. Copy the generated markdown into your AI chat
  3. Start asking detailed questions about your codebase

The AI assistant receives:

  • Complete project structure
  • All file contents with proper syntax highlighting
  • Documentation in context
  • Clear navigation structure

This enables the AI to provide more accurate, contextual responses about your code without manual file copying or context limitations.

Use Cases

For AI Engineers

  • AI Chat Prompt Bootstrapping: Instantly generate context-rich prompts for AI chat interactions about your code
  • Interactive Code Analysis: Seamlessly feed comprehensive codebase context to AI assistants
  • Training Data Preparation: Generate consistently formatted codebase representations for model training
  • Documentation Generation: Train models on well-structured documentation patterns
  • Code Understanding: Feed entire codebases to LLMs for comprehensive analysis

Example AI Chat Workflow:

# Generate a codemap for your project
codemapper /path/to/project

# The generated codemap can be directly used in AI chat prompts:
"Here's my project structure and code, help me understand the dependency flow:
[paste _codemap.md content]"

For Hobbyists

  • Project Exploration: Quickly understand new codebases without complex IDE setup
  • Documentation Creation: Generate comprehensive project documentation automatically
  • Code Reviews: Facilitate easier code reviews with a unified view
  • Learning Tool: Study and understand how different projects are structured

Getting Started

# Install from PyPI
pip install codemapper

# Basic usage
codemapper /path/to/project

# Generate documentation map
codemapper --docs /path/to/project

# Process GitHub repository
codemapper https://github.com/username/repo

Example Output

CodeMapper generates two main types of outputs:

  1. CodeMap (project_codemap.md):

    • Complete directory tree
    • File contents with syntax highlighting
    • Smart handling of binary and large files
    • Navigation-optimized structure
  2. DocMap (project_docmap.md):

    • Documentation-focused view
    • README files
    • Documentation directory contents
    • Structured for easy consumption

Future Development

CodeMapper is actively developing focused on:

ToDos

  • Expanded format support (JSON, YAML, reStructuredText)
  • Enhanced AI integration capabilities
  • Real-time code change tracking
  • Collaborative annotation features
  • Intelligent code pattern recognition
  • API access for programmatic integration

Target Audiences

AI Engineers Will Appreciate

  • Consistent, clean output format for training data
  • Efficient handling of large repositories
  • Structured metadata preservation
  • Integration-ready design

Hobbyists Will Value

  • Simple, straightforward installation
  • Clear, readable output
  • No complex configuration required
  • Immediate utility for project understanding

Installation Options

# For basic installation
pip install codemapper

# For development installation
git clone https://github.com/shaneholloman/codemapper
cd codemapper
pip install -e .

Contributing

CodeMapper welcomes contributions from both AI engineers and hobbyist developers. The project maintains a balance between sophisticated features for AI integration and accessibility for general use.

Visit the GitHub repository to:

  • Report issues
  • Submit feature requests
  • Contribute code
  • Join the discussion

Resources

CodeMapper represents a bridge between traditional code exploration and modern AI-assisted development, making codebases more accessible and understandable for everyone from AI researchers to hobbyist developers.

License

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

Acknowledgments

  • Thanks to the pathspec and chardet libraries for enhancing CodeMapper's functionality.

Version History

For a detailed version history, please refer to the changelog.md.


If you find CodeMapper useful, don't forget to star this repository!

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

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

codemapper-4.1.0-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for codemapper-4.1.0.tar.gz
Algorithm Hash digest
SHA256 f293b527527646a8fa6f0d1242719b21d1d6371dc81075da47c79b0d35d8cfc8
MD5 fe7b10700c49a852e8aeb6ac7b357bd8
BLAKE2b-256 fa45a0e422c6910995452f735c74d8b697b6e8abf632272eb87f92a9e68bb0b0

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for codemapper-4.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 117b98d03c36fce1c6597ee44b9b70f53ff13047db9e11c09ba5451ca6473856
MD5 c744989b9559cff7167ef0cdf7fc4da8
BLAKE2b-256 a696dd97ddc36cfb70813b2f705f184625f7cb37f6d59865f642190db8c1cdea

See more details on using hashes here.

Supported by

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