CodeMuse is an AI-powered code review CLI tool that leverages Large Language Models (LLMs) to analyze pull requests, generate insightful code reviews, and create detailed PR descriptions. Designed for developers, it simplifies code reviews by providing structured insights and markdown-formatted outputs.
- 🔍 Automated Code Reviews: Comprehensive analysis of your code changes.
- 📝 PR Description Generation: Detailed descriptions with technical context and diagrams.
- 🎯 Flexible Review Modes: Choose between brief summaries, in-depth reviews, or PR descriptions.
- 📊 Structured Git Diff Analysis: Organized change breakdowns.
- 📋 Extensive Logging: Detailed logs for easier debugging.
- 🛡️ Robust Error Handling: Graceful failure recovery and cleanup.
- Node.js: Version 14 or higher
- npm: Version 6 or higher
- Git: Installed and configured
- OpenAI API Key: Required for LLM integration
# Linux/macOS
export OPEN_API_KEY=your_openai_api_key
# Windows (Command Prompt)
set OPEN_API_KEY=your_openai_api_key
# Windows (PowerShell)
$env:OPEN_API_KEY="your_openai_api_key"
-
Install required dependencies:
npm install commander winston
-
Install CodeMuse globally:
npm install -g .
code-muse [options]
Options:
-V, --version Output version number
-b, --branch <branch> Branch name to review (required)
-m, --mode <mode> Review mode (review/description/brief) (default: "review")
-t, --target-branch <branch> Target branch to compare against (default: "development")
-v, --verbose Enable verbose logging
-o, --output <output> Output folder (default: "tmp")
-h, --help Display help for command
# Basic review of a branch
code-muse -b feature/new-feature
# Generate a detailed PR description
code-muse -b feature/new-feature -m description -t main
# Verbose logging for debugging
code-muse -b feature/new-feature -v
# Help menu
code-muse --help
-
review (default)
- Detailed code review with issue identification and improvement suggestions.
- Includes best practices and performance analysis.
-
description
- Comprehensive PR descriptions with technical details and diagrams.
- Lists key changes and their impact.
-
brief
- High-level summary of changes.
- Focused on key points for reviewers.
Generated files include:
combined.log
: Full execution log.error.log
: Logs of errors encountered.- Temporary Git diff files (automatically cleaned).
- AI-generated review or description output in markdown format.
-
Initialization:
- Parses CLI arguments.
- Sets up the environment and logging.
-
Git Diff Analysis:
- Compares the specified branch with the target branch.
- Structures the changes for analysis.
-
AI Processing:
- Sends structured changes to LLM.
- Generates markdown-formatted outputs.
-
Logging & Cleanup:
- Logs operation details.
- Cleans temporary files.
-
Git Operation Failures:
- Ensure Git is installed and configured correctly.
-
API Key Errors:
- Verify that
OPEN_API_KEY
is correctly set.
- Verify that
-
Invalid Branch/Diff:
- Check if the branch exists and has valid changes.
code-muse/
├── src/
│ ├── GitOperations.js
│ ├── DiffParser.js
│ ├── ReviewGenerator.js
│ ├── LLMAdapter.js
├── logs/
│ ├── combined.log
│ └── error.log
└── package.json
- Follow the modular design of the project.
- Include proper error handling and logging.
Prompts can be tailored to fit your needs by editing prompts.js
in the project root.
module.exports = {
PROMPTS: {
review: "Custom review prompt...",
description: "Custom description prompt...",
brief: "Custom brief prompt...",
},
};
- Fork the repository.
- Create a feature branch.
- Submit a pull request with a detailed description.
This project is licensed under the MIT License. See the LICENSE file for details.
Pirate-Emperor
- GitHub: Pirate-Emperor
- Reddit: PirateKingRahul
- Twitter: PirateKingRahul
- Discord: PirateKingRahul
- LinkedIn: PirateKingRahul
- Skype: Join Skype
- Medium: PirateKingRahul
Thank you for visiting the CipherX project!
For more details, please refer to the GitHub repository.