CodeView is an open-source script designed to help you consolidate and analyze your codebase using large language models (LLMs). This utility is perfect for generating a comprehensive overview of your project, including file contents, structure, and line numbers, making it easier for LLMs to provide insightful analysis and assistance.
- Directory Traversal: Recursively explores your project directory, including only important files.
- Content Consolidation: Aggregates file contents into a single document with metadata.
- Dynamic Line Number Tracking: Ensures accurate line numbers for each file segment.
- Directory Tree Generation: Creates a visual representation of the project structure.
- Performance Metrics: Includes timing information for the analysis process.
- Directory and File Exclusion: Dynamically exclude specific directories or files beyond the default ignored ones.
- Directory and File Inclusion: Optionally include only specific directories or files for processing.
- Minification: Optionally minify the output by removing all whitespace (spaces, tabs, and newlines).
Ensure you have Node.js installed on your system. You can download it from Node.js.
Clone this repository to your local machine:
git clone https://github.com/CanParlayan/CodeView.git
cd CodeViewRun the CodeView script with the path to your project directory as an argument:
node script.js /path/to/your/projectTo exclude specific directories or files:
node script.js /path/to/your/project --exclude tests,docs --exclude-file __init__.py,setup.pyor using the short form:
node script.js /path/to/your/project -e tests,docs -ef __init__.py,setup.pyTo include only specific directories or files:
node script.js /path/to/your/project --include src,lib --include-file main.js,utils.jsor using the short form:
node script.js /path/to/your/project -i src,lib -if main.js,utils.jsTo minify the output (remove all whitespace):
node script.js /path/to/your/project --minifyor using the short form:
node script.js /path/to/your/project -mnode script.js /path/to/your/project --include src --include-file main.js --minifyThis will generate a codebase_review.txt file with the following structure (if not minified):
Summary:
- Directory: /path/to/your/project
- Files processed: 21
- Total lines: 872
- Duration: 0.02 seconds
- Excluded directories: None
- Excluded files: None
- Included directories: src
- Included files: main.js
================================================================================
Directory Structure:
src/
├── components/
│ └── ui/
│ ├── alert.jsx
│ ├── button.jsx
│ ├── card.jsx
│ ├── dialog.jsx
│ └── input.jsx
├── lib/
│ └── utils.js
├── App.css
├── App.js
├── App.test.js
├── index.css
├── index.js
├── reportWebVitals.js
└── setupTests.js
Files extracted:
src/main.js (starts at line 1)
src/lib/utils.js (starts at line 80)
...
================================================================================
File: src/main.js (starts at line 1)
import React from 'react';
import ReactDOM from 'react-dom';
...
================================================================================
File: src/lib/utils.js (starts at line 80)
export function formatDate(date) {
...
}
| Argument | Alias | Description |
|---|---|---|
--exclude |
-e |
Comma-separated list of directories to exclude from processing |
--exclude-file |
-ef |
Comma-separated list of files to exclude from processing |
--include |
-i |
Comma-separated list of directories to include (only these will be processed) |
--include-file |
-if |
Comma-separated list of files to include (only these will be processed) |
--minify |
-m |
Minify the output by removing all whitespace (spaces, tabs, and newlines) |
Contributions are welcome! Please fork this repository and submit pull requests to improve the project.
- Fork the repository
- Create a new branch (
git checkout -b feature-branch) - Make your changes
- Commit your changes (
git commit -am 'Add new feature') - Push to the branch (
git push origin feature-branch) - Create a new Pull Request
This project is licensed under the MIT License. See the LICENSE file for more details.
Inspired by various open-source projects aimed at improving codebase understanding and analysis using LLMs.