Skip to content

feat(cli): added progress spinners - #21

Merged
nirvik34 merged 3 commits into
nirvik34:mainfrom
SATYAM-PRATIBHAN:feat/add-cli-progress-spinners
May 19, 2026
Merged

feat(cli): added progress spinners#21
nirvik34 merged 3 commits into
nirvik34:mainfrom
SATYAM-PRATIBHAN:feat/add-cli-progress-spinners

Conversation

@SATYAM-PRATIBHAN

@SATYAM-PRATIBHAN SATYAM-PRATIBHAN commented May 17, 2026

Copy link
Copy Markdown
Contributor

close #1

Description

This PR introduces interactive, visual progress indicators during slower CLI processes like analyzing git diffs, generating structured commit messages, and communicating with LLM/AI endpoints (such as Ollama).

Previously, Gitbun worked silently in the background during these processes, which could feel like the terminal was hanging or frozen, especially with large diffs or slow local model inferences. We now provide real-time status updates using ora.

Changes

  • Interactive Spinners: Initialized and updated ora status spinners for:
    • Analyzing staged changes...
    • Generating commit message...
    • Enhancing commit with AI (<model>)...
  • Graceful Termination: Ensures spinners stop cleanly (.succeed() or .fail()) before proceeding to the interactive commit prompt so it doesn't pollute the prompt layout.
  • Robust Exception Handling: Wrapped analysis/generation segments in a try-catch block to gracefully terminate the active spinner (.fail()) if any background operation fails, showing an accurate failure state before exiting.

Verification / Testing

Tested the CLI locally to verify the visual flows:

  1. Checked basic rule-based analysis:
    npm run dev
    
    

Summary by CodeRabbit

  • Refactor

    • Improved error handling during staged-change analysis with clearer success/failure feedback.
    • Consolidated progress indicator management for a more consistent analysis and AI-enhancement workflow.
  • Bug Fixes

    • Fixed inconsistent spinner behavior so enhancement and analysis steps reliably show start/success/failure states.

Review Change Stack

@vercel

vercel Bot commented May 17, 2026

Copy link
Copy Markdown

@SATYAM-PRATIBHAN is attempting to deploy a commit to the nirvik34's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented May 17, 2026

Copy link
Copy Markdown
Contributor

Warning

.coderabbit.yaml has a parsing error

The CodeRabbit configuration file in this repository has a parsing error and default settings were used instead. Please fix the error(s) in the configuration file. You can initialize chat with CodeRabbit to get help with the configuration file.

💥 Parsing errors (1)
Validation error: Invalid enum value. Expected 'chill' | 'assertive', received 'professional' at "reviews.profile"
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • 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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 49754825-f287-4a89-8dc9-3406b035a647

📥 Commits

Reviewing files that changed from the base of the PR and between 83488ac and c57a1c6.

📒 Files selected for processing (1)
  • src/index.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/index.ts

📝 Walkthrough

Walkthrough

The run() pipeline is wrapped in a try/catch and driven by one shared ora spinner; commitMessage is made mutable for post-generation enhancement. The AI enhancement step reuses the same spinner instead of creating a new instance.

Changes

Error Handling and Spinner Management

Layer / File(s) Summary
Analysis phase error handling and unified spinner flow
src/index.ts
Wraps diff enrichment, scope/type detection, summary generation, and initial commit-message generation in a try/catch with a shared ora spinner. commitMessage is now let to allow assignment and later AI enhancement; the AI enhancement step uses spinner.start() and reuses the same spinner instance.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • nirvik34/gitbun#13: Modifies the run() pipeline in src/index.ts and rewires parts of analysis and summary generation; code-level related.

Suggested labels

level: advanced, quality:clean

Suggested reviewers

  • 2PieRadian

Poem

🐰 I spun a light to show the way,
One loop that hums through night and day,
Try catches hold what might fall through,
The commit grows wise, the spinner true,
A hop, a patch — the changes brew.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'feat(cli): added progress spinners' accurately reflects the main change of introducing spinner indicators throughout the CLI workflow.
Linked Issues check ✅ Passed The implementation adds ora spinners for all three key operations (analyzing changes, generating messages, AI enhancement) and wraps them in try-catch for error handling as required by issue #1.
Out of Scope Changes check ✅ Passed All changes are directly related to adding progress spinners; no unrelated modifications to other features or functionality are present in the changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/index.ts (1)

99-100: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Log the error for debuggability.

The catch block silently swallows the error from enhanceCommit. When AI enhancement fails, developers have no error details to diagnose the issue.

📝 Proposed fix to log the error
-      } catch {
+      } catch (error) {
         spinner.fail("AI enhancement failed");
+        console.error(error);
       }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/index.ts` around lines 99 - 100, The catch block after enhanceCommit
currently swallows errors; update the catch to capture the thrown error (e.g.,
catch (err)) and log the error details before or as part of spinner.fail —
reference the enhanceCommit call and the spinner.fail("AI enhancement failed")
usage in src/index.ts; ensure the logged output uses the existing logger or
console.error to print the error stack/message for debugging.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@src/index.ts`:
- Around line 99-100: The catch block after enhanceCommit currently swallows
errors; update the catch to capture the thrown error (e.g., catch (err)) and log
the error details before or as part of spinner.fail — reference the
enhanceCommit call and the spinner.fail("AI enhancement failed") usage in
src/index.ts; ensure the logged output uses the existing logger or console.error
to print the error stack/message for debugging.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 23a3bd4e-b1e0-4f86-ae66-bb8f86ce85c8

📥 Commits

Reviewing files that changed from the base of the PR and between f578f5c and 83488ac.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (1)
  • src/index.ts

@SATYAM-PRATIBHAN

SATYAM-PRATIBHAN commented May 17, 2026

Copy link
Copy Markdown
Contributor Author

@nirvik34 do review it once!!!, do tell if need any changes

@nirvik34
nirvik34 merged commit a7afcdd into nirvik34:main May 19, 2026
4 of 6 checks passed
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.7.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@nirvik34 nirvik34 added type: feature Adds a new feature level:intermediate Decent knowledge required to work on quality:clean Bonus points under GSSOC for clean PR gssoc:approved Approved PR's under GSSOC mentor:nirvik34 labels May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved Approved PR's under GSSOC level:intermediate Decent knowledge required to work on mentor:nirvik34 quality:clean Bonus points under GSSOC for clean PR released type: feature Adds a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Loading Spinner During AI Generation

2 participants