feat: add configuration profiles - #26
Merged
Merged
Conversation
Closed
Add named configuration profiles declared under <section>.profiles.<name> in the tool's TOML file. A new builtin --profile option (repeatable, glob-aware) selects one or more profiles whose values are merged onto the base config before the usual key mapping and precedence, so CLI args and env vars still win. Supported: exact/glob selection, multiple profiles ordered by precedence, inherits (recursive, cycle-checked), and enabled=false to skip a directly selected profile. Values override (lists are replaced, not appended). The reserved profiles/inherits/precedence/enabled keys are consumed and never treated as options. Closes #4 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements configuration profiles (#4) — named sets of config overrides
that are selected at runtime with a new builtin
--profileoption.Behaviour
fnmatchglob; every pattern must match atleast one profile, else
ConfigDiscoveryError.profiles); lists are replaced, not appended.
inherits(name or list) merges parents first, recursively, with cycledetection.
precedence(int, default 0) orders multiple selected profiles — lowerapplied first, higher wins; ties keep selection order.
enabled = falseskips a directly selected profile (inherited parentsstill contribute).
profiles/inherits/precedence/enabledare reserved keys, never treated as options.Scope (deliberately minimal)
Modeled on a subset of robotcode's profiles. Not included (can follow later):
hidden,detached,default_profiles,extend_profiles, conditionexpressions, and env-based profile activation. Value extension from profiles
(append-style
extend_*) is intentionally omitted.Changes
profiles.py: selection, glob, inherits, precedence, enabled, overlay build.base.py: builtin--profileoption.processor.py:_apply_profilesoverlays selected profiles onto the basesection before mapping; strips the reserved
profilestable.__init__.py: exportbuild_profile_overlay,select_profiles.README.md: new "Profiles" section.tests/test_profiles.py: 16 tests.Closes #4