Skip to content

Conversation

@christerswahn
Copy link
Collaborator

@christerswahn christerswahn commented Aug 6, 2025

Moves the config library from the cli_tools package into the new config package. config will be independently published on pub.dev.

Summary by CodeRabbit

  • New Features

    • Introduced a new standalone config package for advanced command-line and configuration file parsing, featuring typed options, environment variable support, and improved error handling.
    • Added comprehensive documentation and examples for the new config package.
    • Added new example programs demonstrating CLI and configuration usage.
  • Refactor

    • Extracted the config library from cli_tools into its own package.
    • Updated import paths and dependencies in both cli_tools and config packages to reflect the separation.
  • Documentation

    • Simplified cli_tools documentation to reference the new config package.
    • Made banner images in READMEs clickable links to the Serverpod GitHub repository.
  • Chores

    • Added CI and publishing workflows for the config package.
    • Updated changelogs and package metadata for both packages.
    • Added license, analysis options, and ignore files for the new config package.
  • Tests

    • Updated test imports and configurations to use the new config package.

@coderabbitai
Copy link

coderabbitai bot commented Aug 6, 2025

📝 Walkthrough

Walkthrough

This change extracts the config library from the cli_tools package into its own standalone config package, updating all references, imports, exports, and documentation accordingly. CI and publishing workflows are expanded to include the new package. Example code, tests, and documentation are refactored to demonstrate and use the separated config package.

Changes

Cohort / File(s) Change Summary
CI & Publishing Workflows
.github/workflows/ci.yml, .github/workflows/publish-cli_tools.yaml, .github/workflows/publish-config.yaml
CI updated to test both cli_tools and new config package; new publish workflow added for config; minor name update for CLI tools publish workflow.
Root & Package Documentation
README.md, packages/cli_tools/README.md, packages/config/README.md
Main README and cli_tools README updated to reference the new config package; detailed config docs moved to new config README; banner images made clickable.
Changelogs & Licensing
packages/cli_tools/CHANGELOG.md, packages/config/CHANGELOG.md, packages/config/LICENSE
Changelogs updated/created to document the extraction; BSD license added to config.
Package Manifests & Analysis
packages/cli_tools/pubspec.yaml, packages/cli_tools/pubspec_overrides.yaml, packages/config/pubspec.yaml, packages/config/analysis_options.yaml, packages/config/.gitignore
cli_tools dependencies updated to use external config; overrides added for local development; new manifests and analysis options for config.
Exports & Imports Refactor
packages/cli_tools/lib/cli_tools.dart, packages/cli_tools/lib/src/better_command_runner/better_command.dart, packages/cli_tools/lib/src/better_command_runner/better_command_runner.dart, packages/cli_tools/lib/src/documentation_generator/documentation_generator.dart, packages/cli_tools/lib/src/prompts/select.dart, packages/config/lib/src/config/config.dart, packages/config/lib/src/config/configuration.dart, packages/config/lib/src/config/exceptions.dart, packages/config/lib/src/config/options.dart
All references to config within cli_tools updated to import from the new package; exports and imports refactored for modularity and clarity; new export for formatConfigError in config.
Examples & Usage
packages/cli_tools/example/main.dart, packages/cli_tools/example/simple_command_example.dart, packages/config/example/main.dart, packages/config/example/config_file_example.dart
Examples updated or added to demonstrate usage of the standalone config package; command runner and direct config resolution examples provided.
Tests & Test Imports
packages/cli_tools/test/documentation_generator/generate_markdown_test.dart, packages/cli_tools/test/prompts/multiple_select_test.dart, packages/cli_tools/test/prompts/select_test.dart, packages/cli_tools/test/better_command_runner/analytics_test.dart, packages/cli_tools/test/better_command_runner/better_command_test.dart, packages/config/test/config/args_compatibility/args_test.dart, packages/config/test/config/args_compatibility/parse_performance_test.dart, packages/config/test/config/args_compatibility/parse_test.dart, packages/config/test/config/args_compatibility/trailing_options_test.dart, packages/config/test/config/args_compatibility/usage_test.dart, packages/config/test/config/config_source_test.dart, packages/config/test/config/configuration_test.dart, packages/config/test/config/configuration_type_test.dart, packages/config/test/config/date_parsing_test.dart, packages/config/test/config/duration_parsing_test.dart, packages/config/test/config/file_options_test.dart
Test files updated to import from the new config package; some imports made more selective; no logic changes.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CLI_Tools
    participant Config_Package

    User->>CLI_Tools: Runs CLI command
    CLI_Tools->>Config_Package: Imports and resolves configuration
    Config_Package->>Config_Package: Parses args, env, config files
    Config_Package-->>CLI_Tools: Returns resolved configuration
    CLI_Tools-->>User: Executes command with configuration
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • SandPod

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ece8c4f and 0124b1a.

📒 Files selected for processing (1)
  • packages/cli_tools/lib/src/documentation_generator/documentation_generator.dart (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/cli_tools/lib/src/documentation_generator/documentation_generator.dart
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch pkg-split

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@christerswahn christerswahn marked this pull request as ready for review August 6, 2025 16:00
@christerswahn christerswahn requested a review from SandPod August 6, 2025 16:00
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

♻️ Duplicate comments (4)
packages/config/test/better_command_runner/exit_exceptions_test.dart (1)

2-2: Same package-name clash as noted in logging_test.dart
See previous comment; all package:config/... imports will need to change if the package is renamed.

packages/config/test/config/args_compatibility/parse_performance_test.dart (1)

8-8: Import path update acknowledged

Same remark as in args_test.dart – path change is correct for the new package layout.

packages/config/test/config/args_compatibility/usage_test.dart (1)

7-7: Import path update acknowledged

Matches new standalone config package.

packages/config/test/config/configuration_test.dart (1)

4-4: Import path update acknowledged

Points at the new package; implementation looks fine.

🧹 Nitpick comments (7)
README.md (1)

1-1: Prefer relative link to avoid hard-coding the GitHub domain

Keeping the banner’s target as a repository-relative link (/serverpod/serverpod) avoids an unnecessary protocol/domain hard-coding and still works both on GitHub and when the README is rendered elsewhere (e.g. pkg.dev).

-[![Serverpod banner](https://github.com/serverpod/serverpod/raw/main/misc/images/github-header.webp)](https://github.com/serverpod/serverpod)
+[![Serverpod banner](https://github.com/serverpod/serverpod/raw/main/misc/images/github-header.webp)](/serverpod/serverpod)
packages/config/test/better_command_test.dart (1)

3-4: Consider relying on the barrel export to reduce churn

If better_command_runner.dart is re-exported by config.dart, you can drop the direct import and just

import 'package:config/config.dart';

to cut down on import maintenance whenever files move.
Not blocking, just a stylistic hint.

packages/config/example/config_file_example.dart (1)

4-5: Minor import tidy-up opportunity.

If better_command_runner.dart is already re-exported by package:config/config.dart, you can drop the second import for brevity:

-import 'package:config/config.dart';
-import 'package:config/better_command_runner.dart';
+import 'package:config/config.dart';

Otherwise, feel free to ignore.

packages/config/example/config_simple_example.dart (1)

1-2: Same import simplification applies here.

Consider relying on a single package:config/config.dart export if it already exposes BetterCommandRunner.

packages/config/README.md (3)

54-55: Fix typo “Tracability” → “Traceability”

- - Tracability - the information on an option's value source is retained.
+- Traceability – the information on an option's value source is retained.

228-230: Correct typo “specifed” → “specified”

-  - Non-const values are specifed with a callback using `fromDefault`
+  - Non-const values are specified with a callback using `fromDefault`

72-74: Tighten wording for clarity

The phrase “with the exception of addCommand(), which you can replace with …” is a bit verbose. Consider something like:

-It achieves complete compatibility with the original package with the exception
-of addCommand(), which you can replace with
-[`BetterCommandRunner`](lib/src/better_command_runner/better_command_runner.dart).
+It is fully compatible except for `addCommand()`, which is covered by
+[`BetterCommandRunner`](lib/src/better_command_runner/better_command_runner.dart).
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a0af0d1 and 4430db6.

⛔ Files ignored due to path filters (2)
  • packages/cli_tools/pubspec.lock is excluded by !**/*.lock
  • packages/config/pubspec.lock is excluded by !**/*.lock
📒 Files selected for processing (47)
  • .github/workflows/ci.yml (3 hunks)
  • .github/workflows/publish-cli_tools.yaml (1 hunks)
  • .github/workflows/publish-config.yaml (1 hunks)
  • README.md (1 hunks)
  • packages/cli_tools/CHANGELOG.md (1 hunks)
  • packages/cli_tools/README.md (3 hunks)
  • packages/cli_tools/example/main.dart (1 hunks)
  • packages/cli_tools/lib/cli_tools.dart (0 hunks)
  • packages/cli_tools/lib/src/documentation_generator/documentation_generator.dart (1 hunks)
  • packages/cli_tools/lib/src/prompts/select.dart (1 hunks)
  • packages/cli_tools/pubspec.yaml (2 hunks)
  • packages/cli_tools/pubspec_overrides.yaml (1 hunks)
  • packages/cli_tools/test/documentation_generator/generate_markdown_test.dart (1 hunks)
  • packages/cli_tools/test/prompts/multiple_select_test.dart (1 hunks)
  • packages/cli_tools/test/prompts/select_test.dart (1 hunks)
  • packages/config/.gitignore (1 hunks)
  • packages/config/CHANGELOG.md (1 hunks)
  • packages/config/LICENSE (1 hunks)
  • packages/config/README.md (1 hunks)
  • packages/config/analysis_options.yaml (1 hunks)
  • packages/config/example/config_file_example.dart (1 hunks)
  • packages/config/example/config_simple_example.dart (1 hunks)
  • packages/config/lib/src/better_command_runner/better_command.dart (1 hunks)
  • packages/config/lib/src/better_command_runner/better_command_runner.dart (1 hunks)
  • packages/config/lib/src/config/configuration.dart (1 hunks)
  • packages/config/lib/src/config/exceptions.dart (1 hunks)
  • packages/config/lib/src/config/options.dart (1 hunks)
  • packages/config/pubspec.yaml (1 hunks)
  • packages/config/test/better_command_runner/analytics_test.dart (1 hunks)
  • packages/config/test/better_command_runner/command_test.dart (1 hunks)
  • packages/config/test/better_command_runner/default_flags_test.dart (1 hunks)
  • packages/config/test/better_command_runner/exit_exceptions_test.dart (1 hunks)
  • packages/config/test/better_command_runner/logging_test.dart (1 hunks)
  • packages/config/test/better_command_runner/parse_log_level_test.dart (1 hunks)
  • packages/config/test/better_command_test.dart (1 hunks)
  • packages/config/test/config/args_compatibility/args_test.dart (1 hunks)
  • packages/config/test/config/args_compatibility/parse_performance_test.dart (1 hunks)
  • packages/config/test/config/args_compatibility/parse_test.dart (1 hunks)
  • packages/config/test/config/args_compatibility/trailing_options_test.dart (1 hunks)
  • packages/config/test/config/args_compatibility/usage_test.dart (1 hunks)
  • packages/config/test/config/config_source_test.dart (1 hunks)
  • packages/config/test/config/configuration_test.dart (1 hunks)
  • packages/config/test/config/configuration_type_test.dart (1 hunks)
  • packages/config/test/config/date_parsing_test.dart (1 hunks)
  • packages/config/test/config/duration_parsing_test.dart (1 hunks)
  • packages/config/test/config/file_options_test.dart (1 hunks)
  • packages/config/test/test_utils/test_utils.dart (1 hunks)
💤 Files with no reviewable changes (1)
  • packages/cli_tools/lib/cli_tools.dart
🧰 Additional context used
🧠 Learnings (4)
📚 Learning: the codebase relies on a recent version of `package:args` where `argparser.addflag` accepts the `hid...
Learnt from: christerswahn
PR: serverpod/cli_tools#47
File: lib/src/config/options.dart:552-567
Timestamp: 2025-06-12T14:55:38.006Z
Learning: The codebase relies on a recent version of `package:args` where `ArgParser.addFlag` accepts the `hideNegatedUsage` parameter.

Applied to files:

  • packages/config/test/config/args_compatibility/trailing_options_test.dart
  • packages/config/test/better_command_runner/logging_test.dart
  • packages/config/test/config/configuration_test.dart
  • packages/config/test/better_command_runner/command_test.dart
  • packages/config/test/config/args_compatibility/parse_performance_test.dart
  • packages/config/test/better_command_runner/exit_exceptions_test.dart
  • packages/config/example/config_simple_example.dart
  • packages/config/test/better_command_runner/default_flags_test.dart
  • packages/config/test/config/date_parsing_test.dart
  • packages/config/test/better_command_runner/parse_log_level_test.dart
  • packages/config/test/config/args_compatibility/parse_test.dart
  • packages/cli_tools/test/prompts/multiple_select_test.dart
  • packages/config/lib/src/better_command_runner/better_command_runner.dart
  • packages/config/test/config/duration_parsing_test.dart
  • packages/config/test/config/args_compatibility/args_test.dart
  • packages/config/test/better_command_test.dart
  • packages/cli_tools/test/documentation_generator/generate_markdown_test.dart
  • packages/config/test/better_command_runner/analytics_test.dart
  • packages/cli_tools/README.md
  • packages/config/example/config_file_example.dart
  • packages/config/test/config/args_compatibility/usage_test.dart
  • packages/config/pubspec.yaml
  • packages/config/lib/src/config/options.dart
  • packages/cli_tools/test/prompts/select_test.dart
  • packages/cli_tools/pubspec.yaml
  • packages/config/lib/src/better_command_runner/better_command.dart
  • packages/cli_tools/example/main.dart
📚 Learning: for this project, avoid review comments that simply repeat compile-time errors the dart analyzer alr...
Learnt from: christerswahn
PR: serverpod/cli_tools#47
File: lib/src/config/options.dart:552-567
Timestamp: 2025-06-12T14:55:38.006Z
Learning: For this project, avoid review comments that simply repeat compile-time errors the Dart analyzer already reports; focus on issues not caught by the analyzer.

Applied to files:

  • packages/config/.gitignore
  • packages/config/analysis_options.yaml
  • .github/workflows/ci.yml
  • packages/config/example/config_file_example.dart
  • packages/config/lib/src/config/options.dart
  • packages/cli_tools/example/main.dart
📚 Learning: assertions should not be used in production code in the serverpod/cli_tools repository, as they are ...
Learnt from: christerswahn
PR: serverpod/cli_tools#46
File: lib/src/config/options.dart:313-316
Timestamp: 2025-05-15T07:45:59.256Z
Learning: Assertions should not be used in production code in the serverpod/cli_tools repository, as they are only active in development mode and not in production builds.

Applied to files:

  • packages/config/analysis_options.yaml
  • README.md
  • packages/cli_tools/README.md
📚 Learning: the durationparser constructor in the serverpod/cli_tools repository is const, which means it cannot...
Learnt from: christerswahn
PR: serverpod/cli_tools#46
File: lib/src/config/options.dart:313-316
Timestamp: 2025-05-15T07:45:59.256Z
Learning: The DurationParser constructor in the serverpod/cli_tools repository is const, which means it cannot contain runtime validation code such as throwing exceptions. All validation must be done through documentation or other compile-time approaches.

Applied to files:

  • packages/config/test/config/date_parsing_test.dart
  • packages/config/test/config/duration_parsing_test.dart
🪛 LanguageTool
packages/config/README.md

[style] ~72-~72: Consider using “except” or “except for”
Context: ...compatibility with the original package with the exception of addCommand(), which you can replace wit...

(WITH_THE_EXCEPTION_OF)

🪛 markdownlint-cli2 (0.17.2)
packages/config/README.md

371-371: Emphasis style
Expected: underscore; Actual: asterisk

(MD049, emphasis-style)


371-371: Emphasis style
Expected: underscore; Actual: asterisk

(MD049, emphasis-style)


374-374: Emphasis style
Expected: underscore; Actual: asterisk

(MD049, emphasis-style)


374-374: Emphasis style
Expected: underscore; Actual: asterisk

(MD049, emphasis-style)

🔇 Additional comments (42)
packages/config/.gitignore (1)

1-4: Looks good – standard Dart ignore file
No issues detected.

packages/config/LICENSE (1)

3-17: Confirm correct copyright statement

Just double-check that “2025” is the intended first year; if the code predates 2025 you may want a range such as “2024-2025”.

packages/config/test/config/args_compatibility/args_test.dart (1)

10-10: Import path update looks correct – just ensure the config package is on the test compile path

The switch to package:config/config.dart is expected after the package split. No further action required as long as packages/config/pubspec.yaml declares name: config and the library exports config.dart.

packages/config/test/better_command_runner/command_test.dart (1)

4-4: Imports correctly updated to new package name

The switch from cli_tools to config aligns with the split-out package. Make sure packages/config/pubspec.yaml exposes better_command_runner.dart, and that dependent packages add config to their dev_dependencies so these tests compile.

packages/config/test/config/file_options_test.dart (1)

5-5: Import path looks good

package:config/config.dart resolves to the new package entry-point. Confirm that any IDE-generated imports inside the config package itself continue to use relative paths rather than package:config/... to avoid cyclic deps when the package is published.

packages/config/test/better_command_runner/parse_log_level_test.dart (1)

2-2: LGTM – test now targets the standalone package

No functional change; the rename is consistent with the new layout.

packages/config/test/config/date_parsing_test.dart (1)

3-3: Import updated

Looks correct; no other changes needed.

packages/cli_tools/test/prompts/select_test.dart (1)

7-8: New ExitException import is appropriate

The symbol is referenced later in the test (Lines 116-122). Double-check that cli_tools declares a dev_dependency on config so that this test continues to compile once the packages are published independently.

packages/config/test/config/args_compatibility/trailing_options_test.dart (1)

7-8: Import path correctly migrated to new package

The change from package:cli_tools/config.dart to package:config/config.dart matches the package split and should compile once the new config package is on the test runner’s path. Nothing else to flag.

packages/config/test/config/args_compatibility/parse_test.dart (1)

9-10: Import path update is accurate

The updated import reflects the new standalone package. Looks good.

packages/config/test/config/configuration_type_test.dart (1)

3-4: Import migrated successfully

Import now targets package:config/config.dart; no further issues detected.

packages/config/test/config/duration_parsing_test.dart (1)

3-4: Import path aligned with package split

Migration to the new config package is correct. No other concerns.

packages/config/lib/src/config/exceptions.dart (1)

1-2: Switched to relative import – OK

Using a relative path ('options.dart') inside lib/src/config keeps the file internal-to-package and avoids a public API leak. Verified that both files reside in the same directory, so the import will resolve.

packages/cli_tools/test/prompts/multiple_select_test.dart (1)

7-8: Imports updated correctly – no stragglers found

All occurrences of better_command_runner have been switched to the new package:config/better_command_runner.dart path. I ran a global search for any lingering imports from package:cli_tools and found none.

packages/config/test/config/config_source_test.dart (1)

3-3: Import relocation LGTM

The test now pulls config.dart from the new standalone package. No further action required.

.github/workflows/publish-cli_tools.yaml (1)

1-1: Workflow rename acknowledged

The updated workflow name better reflects the package being published. 👍

packages/config/lib/src/config/configuration.dart (1)

18-18: Docs updated to new package ‒ looks good

The example now points at package:config/config.dart, keeping the guide in sync with the refactor.

packages/cli_tools/CHANGELOG.md (1)

3-5: Entry reads clearly – no concerns.

The new 0.7.0-beta.2 bullet is consistent with the existing style and communicates the breaking refactor unambiguously.

packages/config/lib/src/config/options.dart (1)

3-3: Good switch to a relative import.

Using exceptions.dart keeps the library’s internal imports private and avoids an unnecessary public package dependency.

packages/config/CHANGELOG.md (1)

1-5: Changelog entry looks fine.

The initial version note succinctly describes the package extraction and keeps versioning in sync with cli_tools.

packages/config/test/better_command_runner/analytics_test.dart (2)

4-4: LGTM - Correct package import update

The import has been properly updated to reference the new standalone config package instead of cli_tools.


7-7: Good practice using explicit import

Using the show clause to explicitly import only flushEventQueue improves code clarity and reduces namespace pollution.

packages/cli_tools/pubspec_overrides.yaml (1)

1-3: LGTM - Proper local dependency override

This correctly overrides the config dependency to use the local package during development, which is the standard approach for monorepo package dependencies.

packages/config/analysis_options.yaml (1)

1-5: LGTM - Appropriate analysis configuration

The linting configuration is consistent with project standards using serverpod_lints/cli.yaml, and the unnecessary_final: false setting is a reasonable choice for code clarity.

packages/config/test/test_utils/test_utils.dart (1)

1-5: LGTM - Standard async testing utility

This is a well-documented utility function that follows the standard pattern for flushing the event queue in async tests. The Future.delayed(Duration.zero) approach is the correct way to allow pending async events to complete.

packages/cli_tools/test/documentation_generator/generate_markdown_test.dart (1)

5-6: LGTM - Correct import updates for package separation

The imports have been properly updated to reference the extracted config package. Using explicit show clauses for Configuration and OptionDefinition improves code clarity.

packages/cli_tools/lib/src/documentation_generator/documentation_generator.dart (1)

1-1: LGTM! Clean import update.

The import path correctly references the new config package and uses selective importing to only bring in BetterCommandRunner. This aligns perfectly with the package extraction objective.

packages/cli_tools/pubspec.yaml (2)

2-2: Version bump is appropriate for breaking change.

The version increment from 0.7.0-beta.1 to 0.7.0-beta.2 correctly reflects the breaking nature of extracting the config library.


20-20: Versions are aligned across packages

The config dependency (^0.7.0-beta.2) in packages/cli_tools/pubspec.yaml matches the version: 0.7.0-beta.2 in packages/config/pubspec.yaml. No changes needed.

packages/config/lib/src/better_command_runner/better_command.dart (1)

6-8: LGTM! Import paths correctly updated for new package structure.

The imports properly reference the new config package structure with appropriate selective importing of formatConfigError. These self-referential imports within the config package are correct.

.github/workflows/ci.yml (3)

17-17: LGTM! Comprehensive CI coverage for both packages.

Adding config to the package matrix ensures both cli_tools and the new config package receive proper CI validation across formatting, analysis, and testing.


33-33: Consistent matrix strategy across all jobs.

The dart_analyze job correctly includes both packages in the matrix, maintaining consistency with the formatting job.


51-51: Testing coverage extended to both packages.

The dart_test job appropriately covers both packages, ensuring the extracted config functionality is properly validated.

packages/cli_tools/lib/src/prompts/select.dart (1)

4-4: LGTM! Correct import update for ExitException.

The import properly references ExitException from the new config package with selective importing, maintaining the quit functionality for interactive prompts.

packages/config/lib/src/better_command_runner/better_command_runner.dart (1)

6-8: LGTM! Import updates correctly reflect the package extraction.

The import changes properly reference the new config package instead of cli_tools. The selective import of formatConfigError is appropriate and maintains the existing functionality.

.github/workflows/publish-config.yaml (1)

1-16: LGTM! Well-structured publishing workflow for the new config package.

The workflow correctly:

  • Uses semantic versioning tag pattern with config prefix
  • Leverages the official dart-lang/setup-dart reusable workflow
  • Sets appropriate permissions and working directory
  • Follows GitHub Actions best practices
packages/config/pubspec.yaml (2)

1-30: LGTM! Well-configured package manifest for the extracted config package.

The pubspec.yaml properly defines the new config package with:

  • Appropriate version (beta release for initial extraction)
  • Relevant dependencies and topics
  • Modern Dart SDK constraints
  • Correct repository references

6-6: Documentation URL Verified

The README file is present at packages/config/README.md, so the documentation URL in pubspec.yaml is correct and requires no changes.

packages/cli_tools/README.md (2)

10-10: LGTM! Clear direction to users about the config library extraction.

The README correctly informs users that the config library has been moved to its own package with a helpful link to pub.dev.


1-1: Nice improvement making the banner clickable.

The banner is now a clickable link to the Serverpod repository, improving user experience.

packages/cli_tools/example/main.dart (1)

6-12: LGTM! Appropriate simplification removing config dependencies.

The example correctly removes the complex command runner setup and focuses on demonstrating the core StdOutLogger functionality. The manual flag parsing is appropriate for this simplified example.

packages/config/README.md (1)

192-201: Verify intra-repo links render on pub.dev

Relative links such as
[OptionDefinition](lib/src/config/configuration.dart)
work on GitHub but are stripped on pub.dev. Consider linking to API
documentation instead, e.g. https://pub.dev/documentation/config/latest/config/OptionDefinition-class.html,
or prefixing with package: so they resolve everywhere.

Copy link

@coderabbitai coderabbitai bot left a 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 (3)
packages/config/README.md (3)

52-56: Misspelling: “Tracability” → “Traceability”

Minor typo that can undermine professionalism.
[Suggest fix]

-- Tracability - the information on an option's value source is retained.
+- Traceability – the information on an option's value source is retained.

223-230: Typo in “specifed”

Small spelling error in the bullet about default values.
[Suggest fix]

-  - Non-const values are specifed with a callback using `fromDefault`
+  - Non-const values are specified with a callback using `fromDefault`

21-24: Broken link on pub.dev for CONTRIBUTING.md

/CONTRIBUTING.md resolves on GitHub but becomes an absolute path on pub.dev, resulting in a 404. Use a relative or full GitHub URL.

-See also [CONTRIBUTING](/CONTRIBUTING.md).
+See also [CONTRIBUTING](https://github.com/serverpod/cli_tools/blob/main/CONTRIBUTING.md).
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4430db6 and 7d78318.

📒 Files selected for processing (1)
  • packages/config/README.md (1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: christerswahn
PR: serverpod/cli_tools#57
File: packages/config/test/better_command_runner/logging_test.dart:2-2
Timestamp: 2025-08-07T07:56:11.913Z
Learning: The maintainer christerswahn owns the `config` package name on pub.dev, so using `config` as the package name in this codebase is valid and will not cause publication conflicts.
Learnt from: christerswahn
PR: serverpod/cli_tools#57
File: packages/config/test/better_command_runner/default_flags_test.dart:1-1
Timestamp: 2025-08-07T07:55:17.221Z
Learning: In the `config` package, `better_command_runner.dart` is intentionally kept as a separate import (`package:config/better_command_runner.dart`) rather than being re-exported through the main `packages/config/lib/config.dart` barrel file. This separation is by design according to the package maintainer christerswahn.
📚 Learning: in the `config` package, `better_command_runner.dart` is intentionally kept as a separate import (`p...
Learnt from: christerswahn
PR: serverpod/cli_tools#57
File: packages/config/test/better_command_runner/default_flags_test.dart:1-1
Timestamp: 2025-08-07T07:55:17.221Z
Learning: In the `config` package, `better_command_runner.dart` is intentionally kept as a separate import (`package:config/better_command_runner.dart`) rather than being re-exported through the main `packages/config/lib/config.dart` barrel file. This separation is by design according to the package maintainer christerswahn.

Applied to files:

  • packages/config/README.md
📚 Learning: the maintainer christerswahn owns the `config` package name on pub.dev, so using `config` as the pac...
Learnt from: christerswahn
PR: serverpod/cli_tools#57
File: packages/config/test/better_command_runner/logging_test.dart:2-2
Timestamp: 2025-08-07T07:56:11.913Z
Learning: The maintainer christerswahn owns the `config` package name on pub.dev, so using `config` as the package name in this codebase is valid and will not cause publication conflicts.

Applied to files:

  • packages/config/README.md
🪛 LanguageTool
packages/config/README.md

[style] ~72-~72: Consider using “except” or “except for”
Context: ...compatibility with the original package with the exception of addCommand(), which you can replace wit...

(WITH_THE_EXCEPTION_OF)

🪛 markdownlint-cli2 (0.17.2)
packages/config/README.md

371-371: Emphasis style
Expected: underscore; Actual: asterisk

(MD049, emphasis-style)


371-371: Emphasis style
Expected: underscore; Actual: asterisk

(MD049, emphasis-style)


374-374: Emphasis style
Expected: underscore; Actual: asterisk

(MD049, emphasis-style)


374-374: Emphasis style
Expected: underscore; Actual: asterisk

(MD049, emphasis-style)

Copy link
Contributor

@SandPod SandPod left a comment

Choose a reason for hiding this comment

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

In packages/config/lib/config.dart it is a shame that we need to re-export UsageException. Is it really required by the package?

For some reason I can't comment in the file since it was only subject to a move.

Otherwise changes look good, just had some minor questions.

@christerswahn
Copy link
Collaborator Author

In packages/config/lib/config.dart it is a shame that we need to re-export UsageException. Is it really required by the package?

For some reason I can't comment in the file since it was only subject to a move.

Otherwise changes look good, just had some minor questions.

Yes, that is part of the contract, it is thrown with error and usage information upon user configuration errors. This is compatible with the args package - although that is inconsistent in how it throws it; we do it in a consistent manner.

The idea is that when we replace the underlying ArgParser, we define this exception ourselves. User code will not notice, the reexport will be replaced by our own export.

@christerswahn christerswahn requested a review from SandPod August 7, 2025 12:34
Copy link
Contributor

@SandPod SandPod left a comment

Choose a reason for hiding this comment

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

🚀

@christerswahn christerswahn changed the title feat!: Moved config & better_cmd_ libs to new config pkg feat!: Moved config library to new config pkg Aug 7, 2025
@christerswahn christerswahn merged commit 80c8c80 into main Aug 7, 2025
16 checks passed
@christerswahn christerswahn deleted the pkg-split branch August 7, 2025 13:38
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.

3 participants