Add way_of_working config for persisting CLI values - #95
Open
timgentry wants to merge 1 commit into
Open
Conversation
Adds `way_of_working config get/set` backed by ~/.config/way_of_working/config.yaml (dotted, feature-namespaced keys) so options like the code of conduct --contact-method don't need to be retyped on every run. --contact-method is now optional, falling back to the stored value and offering to remember a newly-provided one. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
❌MegaLinter analysis: Error
Detailed Issues❌ REPOSITORY / devskim - 1 error❌ COPYPASTE / jscpd - 10 errors
|
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.

What?
Adds
way_of_working config get/set, a small CLI subcommand for persisting values in~/.config/way_of_working/config.yamlso they don't have to be typed in on every invocation. The Code of Conduct generator's--contact-methodis the first consumer: it's now optional, falls back to a stored value, and offers to remember a newly-provided one.Why?
--contact-methodis a per-person/organisation setting, not a per-project one, so requiring it on everyway_of_working initcall is unnecessary friction. Storing it once removes that repetition while leaving room for other features (e.g. a future security contact) to store their own values under the same file.How?
Config keys are dotted paths namespaced by feature (
code_of_conduct.contact_method) rather than by variant, so swapping the underlying standard (e.g. a future Contributor Covenant v3 variant) won't orphan a stored value — matching this gem's existing promise that variant swaps stay additive. The generator resolves the effective contact method fresh on each run (option, then config), rather than baking a default into the Thor option declaration, so config changes are always picked up.Testing?
Added unit tests for
WayOfWorking::Config(get/set, nested keys, missing file) and extended the Code of Conduct generator's tests to cover the fallback, the remember-prompt, and the friendly error when nothing is available. Also manually exercised the real CLI end-to-end in a scratch directory (fresh config, stored config, accept/decline the remember prompt). Full test suite and RuboCop pass.Anything Else?
None of the other built-in features (changelog, decision records, etc.) take a comparable option today, so this only wires up Code of Conduct for now — the same pattern can be reused if/when a security contact or similar is added.