Skip to content

deepmonapara9/codecrush

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ CodeCrush

Flatten GitHub repositories into single, searchable HTML pages

CodeCrush is a powerful tool that transforms any GitHub repository into a beautiful, interactive HTML page with syntax highlighting, search functionality, and both human-readable and LLM-optimized views.

✨ Features

  • 🎨 Beautiful UI - Modern, responsive design with GitHub-inspired styling
  • πŸ” Advanced Search - Search through filenames and file content with real-time highlighting
  • πŸ’» Syntax Highlighting - Powered by Pygments for 200+ languages
  • πŸ“± Mobile Friendly - Responsive design that works on all devices
  • πŸ€– LLM Ready - Includes CXML format view optimized for AI analysis
  • πŸ“‹ Copy & Fold - Easy code copying and collapsing for large files
  • ⌨️ Keyboard Shortcuts - Fast navigation with keyboard controls
  • 🌐 Offline Browsing - Self-contained HTML files work without internet

πŸ› οΈ Installation

Prerequisites

  • Python 3.10+
  • Git

Install Dependencies

pip install markdown pygments

πŸš€ Quick Start

Basic Usage

python3 main.py https://github.com/username/repository

This will:

  1. Clone the repository to a temporary directory
  2. Analyze all files and generate an HTML page
  3. Automatically open the result in your browser

Command Line Options

python3 main.py [OPTIONS] REPO_URL

Options:
  -h, --help                    Show help message
  -o, --out PATH               Output HTML file path (default: temp file)
  --max-bytes SIZE             Max file size to render in bytes (default: 100KB)
  --no-open                    Don't open HTML file in browser after generation

Examples

# Basic usage
python3 main.py https://github.com/torvalds/linux

# Save to specific file
python3 main.py https://github.com/facebook/react -o react_analysis.html

# Process larger files and don't open browser
python3 main.py https://github.com/microsoft/vscode --max-bytes 500000 --no-open

# Analyze your own repository
python3 main.py https://github.com/yourusername/yourproject

🎯 Use Cases

For Developers

  • Code Reviews - Get a complete overview of a project in one page
  • Project Analysis - Understand repository structure and content quickly
  • Documentation - Create offline snapshots of codebases
  • Learning - Study well-structured open source projects

For AI/LLM Users

  • Code Analysis - Feed entire repositories to AI models using the CXML format
  • Documentation Generation - Create AI-powered documentation from codebases
  • Code Understanding - Help AI models understand project context and structure

For Teams

  • Onboarding - Help new team members understand project structure
  • Knowledge Sharing - Share code overviews without requiring repository access
  • Presentations - Create visual representations of codebases for meetings

🎨 Interface Features

Human View (Default)

  • Sidebar Navigation - File tree with search functionality
  • Directory Tree - Visual representation of project structure
  • Syntax Highlighted Code - All supported languages beautifully formatted
  • File Statistics - Size information and processing details
  • Interactive Elements - Copy buttons, code folding, smooth scrolling

LLM View

  • CXML Format - Structured XML format optimized for AI consumption
  • Easy Copying - One-click copy for pasting into AI tools
  • Complete Context - All files in a single, parseable format

Search Functionality

  • Real-time Search - Instant filtering as you type
  • Content Search - Search within file contents, not just filenames
  • Highlighting - Search terms highlighted in yellow
  • Keyboard Shortcuts - Ctrl+F to focus, ESC to clear

⌨️ Keyboard Shortcuts

  • Ctrl+F / Cmd+F - Focus search box
  • Ctrl+1 / Cmd+1 - Switch to Human view
  • Ctrl+2 / Cmd+2 - Switch to LLM view
  • ESC - Clear search and unfocus

πŸ”§ How It Works

  1. Clone - Repository is cloned to a temporary directory
  2. Analyze - Files are scanned and categorized
  3. Filter - Binary files and oversized files are skipped
  4. Process - Text files are syntax highlighted, Markdown is rendered
  5. Generate - Single HTML file is created with embedded CSS/JS
  6. Cleanup - Temporary files are automatically removed

File Processing Rules

  • βœ… Included: Text files, source code, documentation
  • ❌ Skipped: Binary files (images, executables, archives)
  • ❌ Skipped: Files larger than --max-bytes (default 100KB)
  • ❌ Skipped: .git directories and VCS files

πŸ“Š What Gets Analyzed

CodeCrush processes and displays:

  • Source Code - All programming languages with syntax highlighting
  • Documentation - Markdown files rendered as HTML
  • Configuration - JSON, YAML, TOML, XML files
  • Scripts - Shell scripts, batch files, etc.
  • Data Files - CSV, text files, logs (within size limits)

🎨 Supported Languages

Thanks to Pygments, CodeCrush supports syntax highlighting for 200+ languages including:

  • Popular Languages: Python, JavaScript, TypeScript, Java, C++, C#, Go, Rust
  • Web Technologies: HTML, CSS, SCSS, React JSX, Vue
  • Data Formats: JSON, YAML, XML, SQL, GraphQL
  • DevOps: Dockerfile, Kubernetes YAML, Terraform
  • And many more...

πŸš€ Advanced Usage

Repository Analysis

CodeCrush automatically detects and handles:

  • Multiple programming languages in one repository
  • Mixed documentation formats
  • Large repositories (with smart filtering)
  • Complex directory structures

Performance Optimization

  • Files larger than the size limit are listed but not processed
  • Binary files are automatically detected and skipped
  • Git history and metadata are ignored
  • Efficient processing for repositories with thousands of files

πŸ”§ Configuration

File Size Limits

Adjust the maximum file size to process:

python3 main.py https://github.com/repo --max-bytes 1048576  # 1MB

Output Control

# Don't open browser automatically
python3 main.py https://github.com/repo --no-open

# Specify output location
python3 main.py https://github.com/repo -o /path/to/output.html

🀝 Contributing

We welcome contributions! Here are some ways you can help:

  • πŸ› Bug Reports - Found an issue? Please report it
  • πŸ’‘ Feature Requests - Have an idea? We'd love to hear it
  • πŸ”§ Code Contributions - Submit pull requests for improvements
  • πŸ“– Documentation - Help improve our docs

πŸ“‹ Requirements

  • Python: 3.10 or higher
  • Dependencies: markdown, pygments
  • System: Git must be installed and available in PATH
  • Memory: Sufficient RAM for repository size (typically minimal)

πŸ” Troubleshooting

Common Issues

Repository clone fails

  • Ensure the repository URL is correct and accessible
  • Check internet connection
  • Verify Git is installed: git --version

Large repositories are slow

  • Use --max-bytes to limit file processing
  • Consider focusing on specific directories if possible

Missing syntax highlighting

  • Ensure pygments is installed: pip install pygments
  • Check if your file extension is supported

Browser doesn't open

  • Use --no-open flag and manually open the HTML file
  • Check your system's default browser settings

πŸ“ License

MIT License - see LICENSE file for details

πŸ™ Acknowledgments

  • Pygments - For excellent syntax highlighting
  • Python Markdown - For Markdown processing
  • GitHub - For hosting amazing open source projects to analyze

πŸ”— Links


Made with ❀️ for developers who love exploring code

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages