๐ UPDATE: v0.2.7
This pull request refactors the App component and introduces a new Logo component to simplify and centralize the display of the application logo and version information. The changes primarily focus on improving the code structure and readability.
Refactoring and code structure improvements:
-
source/app.js: Removed imports forText,Newline,BigText, andGradient, and replaced the inline logo and version information display with the newLogocomponent. [1] [2] -
source/utils/commit.js: Added theLogocomponent to wrap the commit message prompt and removed unnecessary whitespace. [1] [2] [3]
New component introduction:
-
source/utils/logo.js: Created a newLogocomponent to encapsulate the display of the application logo, version, author, and help information.
Minor formatting adjustments:
-
source/app.js: Adjusted the formatting of console log messages for better readability.
Summary by CodeRabbit
-
New Features
- Introduced support for generating commit messages using both OpenAI and Ollama AI models.
- Added interactive model selection and improved CLI logo and help display.
- Enhanced configuration to support multiple AI models with customizable settings.
-
Improvements
- Streamlined the commit message workflow for better user experience.
- Added informative notifications to cleanup scripts for easier troubleshooting.
-
Bug Fixes
- Improved error handling and user prompts when AI model connectivity fails or required configurations are missing.
I think good addition to this PR is adding the logo to flags such as --version and --help what do you think? @spc-28
I created a new issue here, #22. Maybe one of you @spc-28 @Abhinav-Bansal751 can take it.
@warengonzaga its a good idea. Can i work on it?
@warengonzaga its a good idea. Can i work on it?
Yes, please!
Walkthrough
The update introduces modular AI model support for commit message generation, refactoring the application to use a new logo component and a model selection UI. New modules handle OpenAI and Ollama integrations. Git utilities are refactored, configuration is restructured for multiple models, and the main app logic is simplified to delegate control to new components.
Changes
| File(s) | Change Summary |
|---|---|
package.json |
Added "ollama" dependency; updated cleanup scripts to include fallback echo messages. |
source/app.js |
Replaced all logic/UI with a single Logo component. |
source/cli.js |
Added initial logo render; adjusted render options and usage formatting. |
source/models/ollama.js |
New module: Exports ollamaModel for interacting with Ollama API for commit message generation. |
source/models/openai.js |
New module: Exports openAiModel for OpenAI-based commit message generation. |
source/utils/commit.js |
Refactored: Updated imports, function signatures; added git utility functions. |
source/utils/config.json |
Restructured: Nested commit prompts, added models array, removed flat config keys. |
source/utils/generateCommitMessage.js |
New module: Orchestrates commit message generation via selected AI model. |
source/utils/logo.js |
New component: Renders stylized logo, info, and help prompt. |
source/utils/modelSelection.js |
New component: Handles AI model selection and triggers commit prompt flow. |
source/utils/openai.js |
Deleted: Old OpenAI commit message utility removed. |
Sequence Diagram(s)
sequenceDiagram
participant User
participant CLI
participant Logo
participant ModelSelection
participant GitUtils
participant AIModel (OpenAI/Ollama)
User->>CLI: Run magicc CLI
CLI->>Logo: Render logo and info
Logo->>ModelSelection: Show model selection
User->>ModelSelection: Select AI model
ModelSelection->>GitUtils: Check git repo & committer
GitUtils-->>ModelSelection: Return status
ModelSelection->>AIModel: Request commit message (with git diff)
AIModel-->>ModelSelection: Return category & message
ModelSelection->>User: Show commit message prompt
Poem
๐
In the garden of code, a logo now shines,
With models to pick and magical lines.
Ollama and OpenAI, side by side,
Crafting commit messages with AI pride.
The configโs refreshed, the scripts are neatโ
This bunnyโs work is quite the treat!
โจ Finishing Touches
- [ ] ๐ Generate Docstrings
๐ชง Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
-
I pushed a fix in commit <commit_id>, please review it. -
Explain this complex logic. -
Open a follow-up GitHub issue for this discussion.
-
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:-
@coderabbitai explain this code block. -
@coderabbitai modularize this function.
-
- PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:-
@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase. -
@coderabbitai read src/utils.ts and explain its main purpose. -
@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format. -
@coderabbitai help me debug CodeRabbit configuration file.
-
Support
Need help? Create a ticket on our support page for assistance with any issues or questions.
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.
CodeRabbit Commands (Invoked using PR comments)
-
@coderabbitai pauseto pause the reviews on a PR. -
@coderabbitai resumeto resume the paused reviews. -
@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository. -
@coderabbitai full reviewto do a full review from scratch and review all the files again. -
@coderabbitai summaryto regenerate the summary of the PR. -
@coderabbitai generate docstringsto generate docstrings for this PR. -
@coderabbitai generate sequence diagramto generate a sequence diagram of the changes in this PR. -
@coderabbitai resolveresolve all the CodeRabbit review comments. -
@coderabbitai configurationto show the current CodeRabbit configuration for the repository. -
@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
CodeRabbit Configuration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile to the root of your repository. - Please see the configuration documentation for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation:
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.