ProjectCompactor is a powerful, user-friendly Python tool designed to generate comprehensive project trees and extract detailed file contents from any directory. Whether you're a developer, project manager, or enthusiast, ProjectCompactor streamlines the process of documenting and analyzing your project structure, making it easier to understand, share, and maintain your codebase.
-
🔍 Comprehensive Project Tree Generation
- Automatically traverses directories to create a detailed hierarchical tree structure.
- Visualizes the entire project layout with proper indentation for easy readability.
-
📄 Detailed File Content Extraction
- Extracts and includes contents of text-based files (e.g.,
.py,.html,.txt,.md). - Identifies binary or non-text files (e.g.,
.png,.jpg,.exe) and lists them without attempting to read their contents.
- Extracts and includes contents of text-based files (e.g.,
-
⚙️ Highly Configurable
- Customizable File Extensions: Specify additional file types to treat as text files.
- Exclusion Filters: Exclude specific directories or file types from the analysis.
- Verbose Logging: Enable detailed logging for troubleshooting and insights.
-
🚀 Efficient and Fast
- Utilizes multi-threading for concurrent file processing, ensuring quick execution even for large projects.
- Progress indicators with
tqdmprovide real-time feedback during operation.
-
🛠️ Easy to Use Command-Line Interface
- Simple commands to generate project structures with optional parameters for customization.
- Output can be directed to a specified file for easy sharing and documentation.
-
📈 SEO-Friendly Documentation
- Generates structured and detailed documentation ideal for project analysis and onboarding.
Install ProjectCompactor easily using pip:
pip install projectcompactorEnsure you have Python 3.6 or higher installed.
After installation, you can use the projectcompactor command directly from your terminal.
Generate a project structure of the current directory:
projectcompactorSpecify a Directory Analyze a specific directory:
projectcompactor /path/to/your/projectCustomize Output File Specify a custom output file name:
projectcompactor -o my_structure.txtAdd Additional Text File Extensions Include additional file extensions to treat as text files:
projectcompactor -e .rst .confExclude Specific Directories and File Types Exclude directories like node_modules and file types like .log:
projectcompactor --exclude-dirs node_modules .git --exclude-files .log .tmpEnable Verbose Logging Get detailed logs during execution:
projectcompactor -vFull Example Combine multiple options for a comprehensive analysis:
projectcompactor /path/to/your/project -o project_structure.txt -e .rst .conf --exclude-dirs node_modules .git --exclude-files .log .tmp -v📂 Sample Output Project Structure Section
# Project Structure
project/
README.md
src/
main.py
utils.py
assets/
logo.png
styles.cssFile Details Section
# File Details
## README.md
### Contents of README.md
# Sample Project
This is a sample project.
## src/main.py
### Contents of main.py
print("Hello, World!")
## src/utils.py
### Contents of utils.py
def helper():
pass
## assets/logo.png
[Binary or Non-text file: logo.png]
## assets/styles.css
### Contents of styles.css
body { margin: 0; padding: 0; }🎯 Use Cases 📚 Project Documentation 🔍 Uploading to Chat Assistant 🗃️ Archiving Projects 📊 Reporting