Skip to content
This repository was archived by the owner on Mar 10, 2026. It is now read-only.

refactor(cli): Implement Layered Configuration for Zero-Config Execution#42

Merged
TKanX merged 20 commits intomainfrom
feature/41-refactor-configuration-system-for-usability-and-zero-config-execution
Sep 1, 2025
Merged

refactor(cli): Implement Layered Configuration for Zero-Config Execution#42
TKanX merged 20 commits intomainfrom
feature/41-refactor-configuration-system-for-usability-and-zero-config-execution

Conversation

@TKanX
Copy link
Member

@TKanX TKanX commented Sep 1, 2025

Summary:

Introduces a major refactoring of the CLI's configuration system to significantly improve usability and enable zero-config execution for common use cases. The previous monolithic configuration logic has been replaced with a layered, hierarchical system that merges settings from three sources: built-in defaults, an optional user-provided TOML file, and command-line arguments. This allows users to run the place command with minimal flags, relying on sensible defaults, while still offering granular control through a config file or CLI overrides when needed.

Changes:

  • Implemented a Layered Configuration Model:

    • A new config module was created with a three-tier hierarchy:
      1. defaults.rs: Defines a DefaultsConfig struct with sensible, hard-coded default values for all core workflow parameters.
      2. file.rs: Implements FileConfig with serde to parse a user-provided TOML configuration file. All fields are optional.
      3. builder.rs: Contains the build_config function, which intelligently merges the three layers (Defaults -> File -> CLI) to produce a final, validated AppConfig.
  • Enabled Zero-Config Execution:

    • The --config flag in the place subcommand is now optional. If omitted, the CLI will use the built-in defaults, allowing users to run a placement with only --input and --output.
    • CLI arguments now serve as the final layer of overrides, providing maximum flexibility for scripting and quick experiments without needing to modify a config file.
  • Improved Data Path Resolution:

    • The config::builder now centralizes the logic for resolving logical data names (e.g., amber@rmsd-1.0) into absolute file paths via the DataManager, simplifying the main command logic.
  • Enhanced Code Organization:

    • The configuration logic was extracted from the main commands::place module into its own dedicated config module with submodules for each layer (builder, defaults, file, models).
    • This separation of concerns makes the configuration flow more transparent, maintainable, and easier to test.

TKanX added 20 commits September 1, 2025 15:17
@TKanX TKanX self-assigned this Sep 1, 2025
Copilot AI review requested due to automatic review settings September 1, 2025 23:11
@TKanX TKanX added the enhancement ✨ New feature or request label Sep 1, 2025
@TKanX TKanX linked an issue Sep 1, 2025 that may be closed by this pull request
25 tasks
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Introduces a major refactoring of the CLI's configuration system to enable zero-config execution through a layered, hierarchical configuration approach. This allows users to run the place command with minimal flags while maintaining full configurability through optional TOML files and CLI overrides.

  • Implemented a three-tier configuration hierarchy: built-in defaults → optional file config → CLI arguments
  • Made the --config flag optional to enable zero-config execution with sensible defaults
  • Refactored the monolithic configuration logic into a dedicated modular config package with clear separation of concerns

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
crates/scream-cli/src/config/models.rs Defines the AppConfig struct that holds the final merged configuration
crates/scream-cli/src/config/mod.rs Module declarations for the new config package structure
crates/scream-cli/src/config/file.rs Handles TOML file configuration parsing with optional fields
crates/scream-cli/src/config/defaults.rs Provides sensible default values for all configuration parameters
crates/scream-cli/src/config/builder.rs Core logic for merging the three configuration layers and path resolution
crates/scream-cli/src/config.rs Removes the old monolithic configuration implementation
crates/scream-cli/src/commands/place.rs Updates to use the new layered configuration system
crates/scream-cli/src/cli.rs Makes the --config flag optional to enable zero-config execution

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@TKanX TKanX merged commit 20eaaa5 into main Sep 1, 2025
2 checks passed
@TKanX TKanX deleted the feature/41-refactor-configuration-system-for-usability-and-zero-config-execution branch September 1, 2025 23:13
TKanX added a commit that referenced this pull request Sep 28, 2025
…ion-system-for-usability-and-zero-config-execution

refactor(cli): Implement Layered Configuration for Zero-Config Execution
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement ✨ New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor Configuration System for Usability and Zero-Config Execution

2 participants