Skip to content

feat(cli): add --version flag#137

Open
mason-sharp wants to merge 1 commit into
mainfrom
feature/ACE-166/version
Open

feat(cli): add --version flag#137
mason-sharp wants to merge 1 commit into
mainfrom
feature/ACE-166/version

Conversation

@mason-sharp

@mason-sharp mason-sharp commented Jul 2, 2026

Copy link
Copy Markdown
Member

Leverage urfave/cli/v3's built-in Version support by setting the root command's Version field. Default is 2.1.0, overridden at release time via the existing goreleaser -X main.version ldflag.

We support --version or -V for version.
Note that -v (lower case) is a convention for debug mode. It works with subcommands, but not the top level "ace -v" alone.

@mason-sharp mason-sharp requested a review from danolivo July 2, 2026 21:42
@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

A version variable is introduced in cmd/ace/main.go, defaulting to 2.1.0 and intended for override via -ldflags. SetupCLI in internal/cli/cli.go now accepts this version string as a parameter and assigns it to the root ace command's Version field.

Changes

CLI Version Propagation

Layer / File(s) Summary
Define and thread version string
cmd/ace/main.go, internal/cli/cli.go
Adds a package-level version variable defaulting to 2.1.0, updates SetupCLI to accept a version string parameter, passes version from main.go into SetupCLI, and sets it on the root ace command's Version field.

Sequence Diagram(s)

sequenceDiagram
  participant main as main.go
  participant cli as cli.SetupCLI
  participant cmd as ace Command

  main->>main: define version = "2.1.0"
  main->>cli: SetupCLI(version)
  cli->>cmd: set Version field
Loading

Poem

A rabbit hops with version in tow,
"2.1.0" now the CLI will show,
Through ldflags it may change its face,
But threaded safely to its place,
Hop, hop, hooray — the tag's in the code! 🐇🏷️

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title accurately summarizes the main change: adding version flag support to the CLI.
Description check ✅ Passed The description matches the PR objective and describes the version flag and release-time version override.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/ACE-166/version

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.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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 `@internal/cli/cli.go`:
- Around line 435-438: The CLI uses the shared -v alias in app setup and in
commonFlags/start/server, which conflicts with the built-in version flag
behavior. Update the cli.Command configuration in ace so only one meaning owns
-v: either remove/rename the debug alias in commonFlags and the related
subcommand flags, or explicitly override the default version flag handling. Make
sure the conflict is resolved consistently across the cli.Command definition and
the flag definitions used by start and server.
🪄 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: CHILL

Plan: Pro

Run ID: 7a8172e1-eb8f-4c8e-882c-bd194d4d99b7

📥 Commits

Reviewing files that changed from the base of the PR and between e8a5f1a and ec94740.

📒 Files selected for processing (2)
  • cmd/ace/main.go
  • internal/cli/cli.go

Comment thread internal/cli/cli.go
Leverage urfave/cli/v3's built-in Version support by setting the root
command's Version field. Default is 2.1.0, overridden at release time
via the existing goreleaser -X main.version ldflag.

Use -V (not the default -v) as the short alias so -v stays reserved for
the debug/verbose flag on subcommands.
@mason-sharp mason-sharp force-pushed the feature/ACE-166/version branch from ec94740 to 04a20ba Compare July 2, 2026 22:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant