GenXdev.Data.Preferences provides a tiered preference system: a session-scoped global variable for temporary overrides, and persistent JSON-based key-value stores for durable storage with support for synchronization over Onedrive.
| Command | Aliases | What it does |
|---|---|---|
| Set-GenXdevPreference | setPreference |
Store a preference value persistently |
| Get-GenXdevPreference | getPreference |
Retrieve a preference value |
| Set-GenXdevDefaultPreference | setPreferenceDefault |
Set a default value, used when no explicit preference exists |
| Remove-GenXdevPreference | removePreference |
Delete a preference |
| Get-GenXdevPreferenceNames | getPreferenceNames |
List all known preference names |
| Get-GenXdevPreferencesDatabasePath | — | Get the filesystem path to the preferences database |
| Set-GenXdevPreferencesDatabasePath | — | Change where the preferences database lives |
When you run Set-AILLMSettings to configure an LLM provider, it stores
the settings as preferences. When Open-Webbrowser needs to know which
monitor to use, it reads DefaultSecondaryMonitor from preferences. When
Confirm-InstallationConsent asks if you want to auto-install tools, the
answer is persisted as a preference.
Get-GenXdevPreference looks up values through a five-tier fallback,
reading from disk at each persistent tier (nothing is held in memory
between lookups):
- Session variable — a global PowerShell variable set by a previous
Set-GenXdevPreferencein this session, or explicitly via-SessionOnly - Local preferences —
GenXdev.PowerShell.PreferencesJSON store - Local defaults —
GenXdev.PowerShell.DefaultsJSON store - OneDrive defaults —
OneDrive\GenXdev\Defaults_Preferences.json - Hardcoded fallback — the
-DefaultValueparameter or the module's built-in default
If the exact (lowercased) key isn't found, it does a second pass with case-insensitive scanning across all tiers before falling back.
Set-GenXdevPreference writes to local preferences and the session
variable. Set-GenXdevDefaultPreference writes to local defaults and the
session variable, but only if no existing value is found — so modules can
ship with sensible defaults that users can override.
Preferences can be shared across machines through OneDrive, but it's opt-in per write — nothing syncs unless you explicitly ask for it.
The lookup on read always checks the five tiers listed above in order. So if a preference was written to OneDrive from another machine (and OneDrive has synced the file), it gets picked up automatically during reads.
To write a preference to OneDrive, use -AllMachines:
Set-GenXdevPreference -Name "Theme" -Value "Dark" -AllMachines
Set-GenXdevDefaultPreference -Name "Theme" -Value "Dark" -AllMachinesBoth cmdlets write to OneDrive\GenXdev\Defaults_Preferences.json when
-AllMachines is specified. Without that switch, preferences stay local.
On another machine signed into the same OneDrive account, the synced file
is read as tier 4 of the lookup chain. If OneDrive isn't available, the
write silently falls back to local-only.
Preferences are also used by GenXdev.Coding's refactoring engine (refactor definitions are stored as JSON preferences), GenXdev.Console's monitor configuration, and GenXdev.Software's installation consent tracking.
- GenXdev.Data.KeyValueStore — JSON file storage
- GenXdev.AI — LLM settings stored as preferences
- Full Cmdlet Reference