A powerful Python tool that automatically generates comprehensive markdown documentation templates for your code repositories. The tool provides both a user-friendly GUI and command-line interface, allowing you to create structured documentation with customizable file selection and intelligent filtering.
- Interactive GUI with file explorer integration
- File Preview System - Review and select which files to document
- Smart Filtering - Respects
.gitignorefiles and excludes common package/cache directories - Structured Output - Generates organized markdown with description templates
- Cross-Platform - Works on Windows, macOS, and Linux
- Gitignore Integration - Automatically respects repository
.gitignorerules - Package Directory Exclusion - Skips
node_modules,__pycache__,bin,obj, etc. - Cache File Filtering - Excludes temporary files, logs, and IDE configurations
- Custom Exclusions - Manual file selection in preview mode
- Organized by Directory - Files grouped by their directory structure
- File Metadata - Includes file size, modification date, and path information
- Template Sections - Pre-formatted sections for descriptions, features, and dependencies
- Completion Tracking - Built-in checklist for documentation progress
- Python 3.6+
- tkinter (usually included with Python)
- Built-in Python libraries:
pathlib,fnmatch,threading,argparse
Linux Users: Some distributions don't include tkinter by default:
# Ubuntu/Debian
sudo apt-get install python3-tk
# CentOS/RHEL
sudo yum install tkinter
# Fedora
sudo dnf install python3-tkinter# Clone or download the script
mkdir repo-doc-generator
cd repo-doc-generator
# Create virtual environment
python3 -m venv repo_doc_env
# Activate virtual environment
# Linux/macOS:
source repo_doc_env/bin/activate
# Windows:
repo_doc_env\Scripts\activate
# Save the script as repo_structure_generator.py
# Then run it
python repo_structure_generator.py# Simply save the script and run
python repo_structure_generator.pyLinux/macOS:
#!/bin/bash
# setup.sh
echo "Setting up Repository Documentation Generator..."
python3 -m venv repo_doc_env
source repo_doc_env/bin/activate
python3 -c "import tkinter; print('β tkinter available')" || {
echo "β tkinter not found. Install with:"
echo "Ubuntu/Debian: sudo apt-get install python3-tk"
exit 1
}
echo "β Setup complete! Run: python repo_structure_generator.py"Windows:
@echo off
REM setup.bat
echo Setting up Repository Documentation Generator...
python -m venv repo_doc_env
call repo_doc_env\Scripts\activate.bat
python -c "import tkinter; print('β tkinter available')" || (
echo β tkinter not found. Please install Python with tkinter support.
exit /b 1
)
echo β Setup complete! Run: python repo_structure_generator.py# Launch GUI interface
python repo_structure_generator.py
# Force GUI even with directory argument
python repo_structure_generator.py --guiGUI Workflow:
- Select Directory: Click "Browse..." to choose your repository
- Preview Files: Click "Preview Files" to see what will be documented
- Customize Selection: In the preview window:
- β Check/uncheck files to include/exclude
- Use "Select All", "Deselect All", or "Toggle Selection"
- Filter files using the search box
- Double-click items to toggle selection
- Generate: Click "Generate Documentation" to create the markdown file
# Basic usage
python repo_structure_generator.py /path/to/your/repo
# Custom output file
python repo_structure_generator.py /path/to/your/repo -o custom_docs.md
# Show help
python repo_structure_generator.py --helpThe tool intelligently excludes common files and directories:
Package Managers:
node_modules,bower_components(JavaScript)bin,obj,packages(.NET)__pycache__,venv,.pytest_cache(Python)
Development Files:
.git,.vscode,.idea*.log,*.tmp, cache directories- OS files (
.DS_Store,Thumbs.db)
Documentation Files:
README.md,LICENSE,CHANGELOG.md
The tool automatically reads and respects .gitignore files:
- Supports standard gitignore patterns
- Handles negation rules (
!prefix) - Processes directory-specific rules
# File Documentation: ProjectName
**Generated on:** 2025-05-23 21:35:56 UTC
**Generated by:** jordanboyce
**Source directory:** `/path/to/project`
**Total files documented:** 15
## Root Directory
### `main.py`
**Path:** `main.py`
**Size:** 2.4 KB
**Last Modified:** 2025-05-23 15:30:22
**Description:**
_[Please describe the purpose and functionality of this file]_
**Key Features:**
- _[List main features or functions]_
- _[Add more items as needed]_
**Dependencies:**
_[List any dependencies or related files]_
---Each generated file includes:
- All file descriptions completed
- All key features documented
- All dependencies identified
- Documentation reviewed and approved
Generate documentation templates to help new developers understand your codebase structure.
Create comprehensive file documentation before major code reviews.
Document your project structure when transferring to another team.
Generate templates for architectural documentation and system overviews.
You can modify the DEFAULT_IGNORE_PATTERNS set in the RepoDocumentationGenerator class:
DEFAULT_IGNORE_PATTERNS = {
'node_modules',
'__pycache__',
'.git',
# Add your custom patterns here
}The tool automatically looks for .gitignore in the repository root. For custom locations:
# Modify the GitignoreParser initialization
gitignore_parser = GitignoreParser(custom_path / '.gitignore')1. "tkinter not found" Error
# Solution varies by OS (see Installation section above)
sudo apt-get install python3-tk # Ubuntu/Debian2. "Permission Denied" Errors
- Ensure you have read permissions for the target directory
- Some system directories may be restricted
3. GUI Not Opening
# Test tkinter installation
python3 -c "import tkinter; tkinter.Tk()"4. No Files Found
- Check if your directory contains files that aren't filtered out
- Verify
.gitignorepatterns aren't too restrictive - Use the preview to see what files are being excluded
For troubleshooting, you can add debug output:
# Add to the beginning of main()
import logging
logging.basicConfig(level=logging.DEBUG)# Clone/download the project
git clone <repository-url>
cd repo-documentation-generator
# Create development environment
python3 -m venv dev-env
source dev-env/bin/activate # Linux/macOS
# dev-env\Scripts\activate # Windows
# Install development dependencies (if any)
pip install -r requirements-dev.txt # If you create this file- Follow PEP 8 style guidelines
- Use type hints where appropriate
- Add docstrings for all classes and functions
- Keep functions focused and single-purpose
# Manual testing
python repo_structure_generator.py --gui
python repo_structure_generator.py test-directoryWhen suggesting new features:
- Describe the use case
- Provide example scenarios
- Consider backward compatibility
- Think about cross-platform implications
# Generate docs for a Python project
python repo_structure_generator.py my-python-app
# Output: my-python-app_documentation.md# Document a React/Node.js app (automatically excludes node_modules)
python repo_structure_generator.py my-web-app -o webapp-docs.md# Document a complex project with multiple languages
python repo_structure_generator.py enterprise-app
# Use preview mode to select only relevant filesThe tool provides insights about your project:
- Total files scanned
- Files included/excluded
- Directory structure overview
- File size and modification information
Potential improvements for future versions:
- Code Analysis: Detect function/class definitions
- Dependency Mapping: Automatically detect file dependencies
- Export Formats: Support for other documentation formats
- Template Customization: User-defined documentation templates
- Git Integration: Show commit history and authors
This project is released under the MIT License. Feel free to use, modify, and distribute as needed.
jordanboyce
- Created: 2025-05-23
- Last Updated: 2025-05-23 21:35:56 UTC
- Built with Python's excellent standard library
- GUI powered by tkinter
- Inspired by the need for better code documentation workflows
Happy Documenting! π
For issues, feature requests, or contributions, please feel free to reach out or submit a pull request.