Replace settings.json with global ~/.pv/pv.yml#32
Merged
munezaclovis merged 3 commits intomainfrom Mar 9, 2026
Merged
Conversation
Consolidate user-facing config into YAML, matching the per-project pv.yml
format. The global pv.yml uses a `defaults` key for TLD and PHP version:
defaults:
php: '8.4'
tld: test
- Settings struct now nests under Defaults (Defaults.TLD, Defaults.PHP)
- Transparent migration: LoadSettings() reads old settings.json on first
load, writes pv.yml, and removes the JSON file
- SettingsPath() moves from ~/.pv/config/settings.json to ~/.pv/pv.yml
- All callers updated (18 files across cmd/, internal/)
- Drop migrateOrDefault() and oldSettingsPath() entirely (v0.0.1, no backwards compat needed) - LoadSettings() now returns defaults when pv.yml is missing, errors on corrupt YAML - Save() validates TLD before writing — invalid state can never be persisted - Save() defaults empty TLD to "test" before validation - New tests: corrupt YAML returns error, Save() rejects invalid TLD, Save() defaults empty TLD - Remove migration test and encoding/json import
- Update E2E scripts to check ~/.pv/pv.yml instead of ~/.pv/config/settings.json - Propagate LoadSettings() error in install.go instead of silently falling back to defaults - Update README directory tree to show pv.yml at ~/.pv/ root
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
~/.pv/config/settings.json(JSON) with~/.pv/pv.yml(YAML), consolidating user-facing config into one format that mirrors per-projectpv.ymldefaultskey —GlobalPHPbecomesDefaults.PHP,TLDbecomesDefaults.TLDLoadSettings()reads oldsettings.json, writespv.yml, and removes the JSON fileThe resulting global config:
Test plan
go test ./...)TestLoadSettings_MigratesFromJSONverifies JSON → YAML migration and old file cleanupTestSettings_SaveAndLoad_WithPHPverifies PHP field round-trips through YAMLpv install/pv setupwrites~/.pv/pv.ymlcorrectlysettings.jsongets migrated on first command