Skip to content

JAFAR564/code-scanner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

CodeScanner

A simple yet powerful Python utility that scans your codebase and compiles all source code files into a single document. Perfect for feeding your entire project context to AI assistants like Claude or ChatGPT.

🚀 Why CodeScanner?

AI assistants work best when they can see the big picture. Instead of sharing individual files or code snippets, CodeScanner lets you give AI tools complete context about your entire codebase in one go.

✨ Features

  • Easy to use: Simple command-line interface
  • Customizable: Filter by file extensions, ignore specific directories
  • Smart filtering: Automatically skips binary files and large generated files
  • Well-formatted output: Clear file separators and summary statistics
  • Cross-platform: Works on Windows, macOS, and Linux

📋 Installation

# Clone the repository
git clone https://github.com/yourusername/code-scanner.git
cd code-scanner

# Make the script executable (Linux/macOS)
chmod +x code_scanner.py

🔧 Usage

Basic Usage

python code_scanner.py /path/to/your/project

This will scan your project directory and create a file called codebase_for_ai.txt with all your code.

Advanced Options

usage: code_scanner.py [-h] [-o OUTPUT] [-e EXTENSIONS] [-i IGNORE] [-m MAX_FILE_SIZE] directory

Scan directories for source code and combine into a single file

positional arguments:
  directory             Directory to scan for source code

options:
  -h, --help            show this help message and exit
  -o OUTPUT, --output OUTPUT
                        Output file name (default: codebase_for_ai.txt)
  -e EXTENSIONS, --extensions EXTENSIONS
                        Comma-separated list of file extensions to include
  -i IGNORE, --ignore IGNORE
                        Comma-separated list of directories to ignore
  -m MAX_FILE_SIZE, --max-file-size MAX_FILE_SIZE
                        Maximum file size in bytes to include (default: 1MB)

Examples

Scan a project and specify output file name:

python code_scanner.py /path/to/your/project -o my_code.txt

Only include specific file types:

python code_scanner.py /path/to/your/project -e py,js,html,css

Ignore specific directories:

python code_scanner.py /path/to/your/project -i node_modules,build,tests

Set maximum file size:

python code_scanner.py /path/to/your/project -m 500000

🧠 Using with AI Assistants

  1. Run CodeScanner on your project
  2. Upload the generated file to your AI assistant of choice
  3. Ask questions about your code with full context
  4. Profit! 🎉

📄 License

MIT License - See LICENSE file for details.

🤝 Contributing

Contributions welcome! Feel free to submit a Pull Request.

About

Scan your codebase and compile it for AI assistants

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages