Skip to content

refactor(config,cli_tools)!: Improved initialization params and docs - #151

Merged
christerswahn merged 3 commits into
mainfrom
new-better-command
Nov 22, 2026
Merged

christerswahn merged 3 commits into
mainfrom
new-better-command

Conversation

@christerswahn

@christerswahn christerswahn commented Nov 22, 2026 •

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features
    • Commands can now define their own invocation text and summary for usage output.
    • Leaf commands can individually allow unexpected positional arguments, instead of relying on a runner-wide setting.
  • Bug Fixes
    • Completion runs no longer apply the regular log-level setting.

@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Commands now control whether unmatched positional arguments are accepted. Command usage definitions accept invocation and summary values. Runner and completion code use command-level settings, and the better runner skips log-level updates during completion.

Changes: Command configuration

Layer / File(s) Summary
Command settings and usage metadata
packages/config/lib/src/config/arg_parser/command_definition.dart, packages/config/lib/src/command/abstract_command.dart, packages/config/lib/src/command/command.dart, packages/config/test/command/*, packages/config/test/config/arg_parser/*
Commands expose ignoreUnexpectedPositionalArgs, defaulting to false, and command constructors accept invocation and summary. Tests verify the values are forwarded and retained in usage definitions.
Runner configuration and completion
packages/config/lib/src/command/command_runner.dart, packages/config/lib/src/command/completion/completion_engine.dart, packages/config/test/command/command_line_run_test.dart, packages/config/test/command/completion/*, packages/cli_tools/test/analytics/command_line_properties_test.dart
The runner-level positional-argument setting is removed. Configuration resolution and positional completion now use the command’s setting. Tests and fixtures set the setting on leaf commands.
Better runner completion handling
packages/cli_tools/lib/src/better_command_runner/better_command_runner.dart
The better runner removes the runner-level positional-argument parameter and skips setting the log level during completion runs.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested reviewers: nielsenko

Merge Risk: Minimal · up to a3da3

This refactor moves the handling of unexpected positional arguments from the runner to individual commands and adds invocation and summary options to commands. No concrete defects were found. The runner-parameter removal is an intentional breaking change that downstream users must adapt to.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title uses a conventional commit prefix and names the scope (config, cli_tools) and the breaking-change marker. The changeset moves ignoreUnexpectedPositionalArgs from CommandRunner to individual …
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.
Full details: Title check

Explanation

The title uses a conventional commit prefix and names the scope (config, cli_tools) and the breaking-change marker. The changeset moves ignoreUnexpectedPositionalArgs from CommandRunner to individual leaf commands, adds invocation and summary parameters to command constructors, and removes related documentation. The title 'Improved initialization params and docs' refers to real parts of the change, including the constructor parameter refactor and documentation updates. It does not name the main behavioral shift, so it is partially related rather than fully specific.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: b7e1ec39-3bfc-402e-a79e-30960f2280fa
Commits

Reviewing files that changed from the base of the PR and between 5628537 and a3da36a.

Files selected for processing: 15

  • packages/cli_tools/lib/src/better_command_runner/better_command_runner.dart
  • packages/cli_tools/test/analytics/command_line_properties_test.dart
  • packages/config/lib/src/command/abstract_command.dart
  • packages/config/lib/src/command/command.dart
  • packages/config/lib/src/command/command_runner.dart
  • packages/config/lib/src/command/completion/completion_engine.dart
  • packages/config/lib/src/config/arg_parser/command_definition.dart
  • packages/config/test/command/command_fixtures.dart
  • packages/config/test/command/command_line_run_test.dart
  • packages/config/test/command/command_tree_test.dart
  • packages/config/test/command/completion/completion_engine_test.dart
  • packages/config/test/command/completion/fixtures/completion_cli.dart
  • packages/config/test/command/usage_formatting_test.dart
  • packages/config/test/config/arg_parser/arg_parser_test_support.dart
  • packages/config/test/config/arg_parser/scan_and_parse_commands_test.dart

Included review availability: This review used your included allowance. 2 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 3 reviews per hour.

@christerswahn
christerswahn merged commit c96ae7b into main Nov 22, 2026
36 checks passed
@christerswahn
christerswahn deleted the new-better-command branch November 22, 2026 13:37
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