feat: Add app-level fields - #11
Conversation
|
Warning Review limit reached
Next review available in: 39 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThe change replaces untyped action dispatch with ChangesTyped action and resolution pipeline
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant Command
participant App
participant HelpTemplate
User->>Command: execute command
Command->>App: pass resolved action, hooks, and flags
App->>App: run before hook and action
App-->>Command: return result or error
Command->>HelpTemplate: provide visible local and global flags
HelpTemplate-->>User: render command help
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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.
Actionable comments posted: 3
🤖 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.
Inline comments:
In `@app.go`:
- Line 235: Update the fmt.Fprintf call in the error-reporting path to
explicitly discard its returned values, satisfying errcheck while preserving the
existing output and control flow.
In `@command.go`:
- Around line 405-417: Update VisibleFlags to copy c.Flags into a new slice
before appending c.globalFlags and HelpFlag, preventing mutation of the caller’s
backing array; follow the existing resolveFlags approach. Also verify whether
the c.HideHelp check should account for GlobalHideHelp despite the lack of ctx,
preserving the intended built-in help visibility behavior.
- Around line 398-403: Update resolveFlags and VisibleFlags to copy the
command's existing flags into a new slice before appending global flags.
Preserve the current NoGlobalFlags behavior and returned flag ordering while
ensuring neither method can mutate the caller's Command.Flags backing array.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: bca1a944-02a0-409d-b13e-40f0d64c10db
📒 Files selected for processing (6)
.gitignoreapp.goapp_test.gocommand.gohelp.gohelp_test.go
|
@harshavardhana When you get a chance can you take a look? Some alignment work for |
In
mcwe have many places with boilerplate that could be fixed by app-level defaults. This PR adds customizable app level default and globals:mc, Before is the same for all commands.mc, OnUsageError is the same for all commandsmc, HideHelpCommand is true for all relevant commands.mc, we have globalFlags that must be manually added or appended to the command flags.This PR is a breaking change as it changes Action to an
ActionFunc, which has been pending since 2016.The net effect of this PR can be seen here https://github.com/miniohq/ec/pull/597 - removal of 1400 lines of boilerplate and alignment of several commands to the project standard