-
Notifications
You must be signed in to change notification settings - Fork 19
Feat: Add verbose mode for debugging and diff stats #125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Adds a flag for verbose output, including - diff statistics, repository details, and prompt info. - This helps debug LLM commit message generation issues.
WalkthroughThis PR fixes the previously unused Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes The changes follow a consistent pattern of adding a verbose parameter and conditional logging statements. While they span two files and involve function signature updates, the modifications are homogeneous and straightforward—passing a boolean flag through and adding conditional output based on its value. Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (5)
cmd/cli/createMsg.go (2)
134-138: Use prompt-based token estimate and rune-safe char count.For accuracy, estimate tokens from the actual prompt (wrapper + changes), and count characters by runes to avoid under/over-reporting with UTF‑8.
Apply within this block:
- pterm.Info.Printf("Diff statistics: %d lines, %d characters (within limits).\n", len(diffLines), len(changes)) - inputTokens := estimateTokens(changes) + pterm.Info.Printf("Diff statistics: %d lines, %d characters (within limits).\n", len(diffLines), utf8.RuneCountInString(changes)) + inputTokens := estimateTokens(types.BuildCommitPrompt(changes, nil))Add import:
import ( "context" "errors" "fmt" "os" "os/exec" "runtime" "strings" + "unicode/utf8"
655-657: Hint mentions only long flag; include shorthand for discoverability.- pterm.Info.Println("Use --toggle flag to see debug details.") + pterm.Info.Println("Use --toggle (-t) to see debug details.")cmd/cli/root.go (3)
33-36: Examples: show the -t alias alongside --toggle.- commit . --toggle - commit . --dry-run --toggle + commit . --toggle # or: -t + commit . --dry-run --toggle # or: -t
116-121: Support a 'verbose' alias at parse-time (non-breaking).- verbose, err := cmd.Flags().GetBool("toggle") - if err != nil { - return err - } + vToggle, err := cmd.Flags().GetBool("toggle") + if err != nil { + return err + } + vVerbose, _ := cmd.Flags().GetBool("verbose") + verbose := vToggle || vVerbose
136-140: Add a long-form alias flag for clarity while keeping --toggle for #86.rootCmd.PersistentFlags().Bool("dry-run", false, "Preview the prompt that would be sent to the LLM without making an API call") rootCmd.PersistentFlags().Bool("auto", false, "Automatically commit with the generated message") rootCmd.PersistentFlags().BoolP("toggle", "t", false, "Show verbose debug information (diff stats, full prompts, repository details)") +rootCmd.PersistentFlags().Bool("verbose", false, "Alias for --toggle; show verbose debug information")
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
cmd/cli/createMsg.go(5 hunks)cmd/cli/root.go(3 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
cmd/cli/createMsg.go (2)
cmd/cli/store/store.go (3)
StoreMethods(18-21)LLMProvider(50-53)Config(56-59)pkg/types/types.go (2)
LLMProvider(5-5)Config(60-63)
cmd/cli/root.go (1)
cmd/cli/createMsg.go (1)
CreateCommitMsg(27-299)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
- GitHub Check: Build Go Binary (macos-latest)
- GitHub Check: Build Go Binary (windows-latest)
- GitHub Check: Test (1.23)
- GitHub Check: Test (1.21)
- GitHub Check: Test (1.22)
🔇 Additional comments (6)
cmd/cli/createMsg.go (6)
26-27: Doc update is clear.Good addition clarifying verbose behavior.
71-75: Useful verbose repo/file summary.Looks good and gated by the flag.
143-143: Pass-through of verbose to dry-run is correct.Keeps output consistent across modes.
575-575: Signature change is consistent with caller.No concerns; good separation of concerns.
647-650: Nice extra stat only when verbose.No issues.
27-27: All CreateCommitMsg call sites updated Verified the sole usage at cmd/cli/root.go:121 matches the updated signature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
approved 🎊
Description
Adds a
--toggleflag (verbose mode) to display detailed debug information during commit message generation.Verbose output includes repository path, staged/unstaged/untracked file stats, diff summary, estimated LLM tokens, and full prompt in dry-run mode.
Type of Change
Related Issue
Fixes #86
Changes Made
--toggleflag to root command for verbose output.Testing
Checklist
Additional Notes
Verbose output is intended for debugging and help messages only; it does not affect commit generation or auto-commit behavior.
For Hacktoberfest Participants
Thank you for your contribution! 🎉
Summary by CodeRabbit
--toggle/-tpersistent flag to the CLI for enhanced control over command execution.