magic-commit icon indicating copy to clipboard operation
magic-commit copied to clipboard

๐Ÿš€ UPDATE: v0.2.7

Open warengonzaga opened this issue 1 year ago โ€ข 5 comments

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 for Text, Newline, BigText, and Gradient, and replaced the inline logo and version information display with the new Logo component. [1] [2]
  • source/utils/commit.js: Added the Logo component to wrap the commit message prompt and removed unnecessary whitespace. [1] [2] [3]

New component introduction:

  • source/utils/logo.js: Created a new Logo component 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.

warengonzaga avatar Oct 15 '24 13:10 warengonzaga

I think good addition to this PR is adding the logo to flags such as --version and --help what do you think? @spc-28

warengonzaga avatar Oct 15 '24 13:10 warengonzaga

I created a new issue here, #22. Maybe one of you @spc-28 @Abhinav-Bansal751 can take it.

warengonzaga avatar Oct 15 '24 14:10 warengonzaga

@warengonzaga its a good idea. Can i work on it?

spc-28 avatar Oct 15 '24 14:10 spc-28

@warengonzaga its a good idea. Can i work on it?

Yes, please!

warengonzaga avatar Oct 16 '24 05:10 warengonzaga

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 @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in 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 pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file 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.

coderabbitai[bot] avatar Jul 13 '25 03:07 coderabbitai[bot]