Skip to content

Cli clap#4

Merged
b4prog merged 4 commits into
mainfrom
cli-clap
Jun 26, 2026
Merged

Cli clap#4
b4prog merged 4 commits into
mainfrom
cli-clap

Conversation

@b4prog

@b4prog b4prog commented Jun 26, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features

    • Updated command-line handling to support clearer, more consistent argument parsing, including repeated flags and list-style inputs.
    • Added support for standard long-form options while continuing to accept existing legacy command formats.
  • Bug Fixes

    • Improved validation for invalid or conflicting command-line options.
    • Default file extensions are now applied automatically when none are provided.
  • Chores

    • Bumped the crate version to 0.4.0.

@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@b4prog, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 32 minutes and 36 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more credits in the billing tab to continue.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 credits.

🚦 How do rate 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 see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c4094919-8330-4db3-af2d-1ef86fa419b4

📥 Commits

Reviewing files that changed from the base of the PR and between 69a2b81 and 8f93e74.

📒 Files selected for processing (3)
  • Cargo.toml
  • src/cli.rs
  • src/model.rs
📝 Walkthrough

Walkthrough

Cargo.toml bumps the crate version and adds clap. src/cli.rs introduces a clap-derived CLI parser, normalizes legacy argument forms, and rebuilds CliConfig from parsed clap values.

Changes

CLI parser update

Layer / File(s) Summary
Clap dependency and parser shape
Cargo.toml, src/cli.rs
Cargo.toml updates the version and adds clap; src/cli.rs imports clap types and defines ClapCli with counted flags and repeated-value fields.
Legacy argument normalization
src/cli.rs
src/cli.rs maps legacy short forms to clap-compatible long options, prefixes the program name, and rejects unknown long options except --report-duplicate.
Clap parsing and validation
src/cli.rs
parse_args now parses normalized arguments with ClapCli, enforces repetition and exclusivity rules, and constructs CliConfig from the parsed data.

Sequence Diagram(s)

sequenceDiagram
  participant parse_args
  participant normalized_clap_args
  participant ClapCli
  participant CliConfig
  parse_args->>normalized_clap_args: normalize legacy args
  normalized_clap_args-->>parse_args: clap-compatible argv
  parse_args->>ClapCli: try_parse_from(...)
  ClapCli-->>parse_args: parsed fields
  parse_args->>CliConfig: build config
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and directly reflects the main change: migrating the CLI to clap.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cli-clap

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.

@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: 2

🤖 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 `@Cargo.toml`:
- Line 12: Add a rust-version field to Cargo.toml so the crate explicitly
enforces the minimum Rust toolchain required by clap 4.6.1. Update the package
metadata alongside the existing clap dependency declaration, using the
Cargo.toml package section, so builds fail early on toolchains older than 1.85
instead of relying on CI or accidental local compatibility.

In `@src/cli.rs`:
- Around line 145-164: The validation in the CLI parsing logic is inconsistent
because `parsed.report_duplicate` is counted but never rejected when repeated,
unlike `git_branch`, `file_extensions`, and `files`. Update the argument
validation in `src/cli.rs` to add a symmetric duplicate check for
`report_duplicate` (using the same pattern as the other fields) and return a
`CodeM8Error::new` with a matching “provided more than once” message when it
exceeds one.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 71623573-56b3-4475-9bee-a03ac9162074

📥 Commits

Reviewing files that changed from the base of the PR and between d0cc69f and 69a2b81.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (2)
  • Cargo.toml
  • src/cli.rs
📜 Review details
🔇 Additional comments (2)
src/cli.rs (2)

255-269: LGTM!


85-98: 🩺 Stability & Availability

No issue found: CodeM8Error already implements std::error::Error and std::fmt::Display.

Verification of src/error.rs confirms that CodeM8Error explicitly implements std::fmt::Display (line 44) and std::error::Error (line 50). Consequently, the parse_file_extensions and parse_file_list functions satisfy clap's requirement for value_parser error types, and the code compiles as intended.

No action required.

Comment thread Cargo.toml
Comment thread src/cli.rs
@b4prog b4prog merged commit 72cbef8 into main Jun 26, 2026
3 checks passed
@b4prog b4prog deleted the cli-clap branch June 26, 2026 04:56
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