feat: add explicit enable/disable toggles for every provider in Settings - #44
Merged
Conversation
Let users enable or disable each provider from the Settings panel. Disabled providers are fully gated at the registry level — no configuration checks, setup probes, fetches, or helper operations run for them. Stored credentials and local installations are preserved when a provider is disabled.
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
Every registered provider now has an enable/disable toggle in its Settings card. The
ProviderRegistrygates all provider operations — fetch, setup, helper management, credential import — on enablement, and disabled providers never call into a provider module. TheQuotaViewModelmanages an observable set of enabled IDs, starts work only for enabled providers, and stops provider-owned tasks when a provider is disabled.Why
Previously, a provider was implicitly activated when the user saved an API key or installed a CLI helper. The user had no way to keep a provider installed but prevent Filbert from reading it. This branch makes enablement an explicit, persistent choice that is independent of configuration. (ui 17)
What changed
Sources/Core/ProviderEnablement.swift— newUserDefaults-backed enablement store. Missing values resolve to enabled for API-key providers with a saved key and disabled for all others. Provider-ID-neutral.Sources/Core/ProviderRegistry.swift— every method now checks enablement before calling into a provider.isConfiguredandfetchRequestalso gate on enablement, so no provider method runs for a disabled provider.Sources/App/QuotaViewModel.swift— addedenabledProviderIdsset andsetProviderEnabled(). Refactored into four extensions (Lifecycle,Presentation,Results,Setup) so lifecycle and presentation logic is testable in isolation.Sources/App/APIKeyFreeSettingsRow.swift(new) — extracted the API-key-free provider card fromSettingsView. Renders disabled guidance when the provider is off, and setup/install/remove controls only when it is on.Sources/App/SettingsView.swift— passes enablement state and toggle action into every provider card header. API-key cards keep their key field even while disabled, so the user can save a key and enable in one action.Sources/App/SettingsVisualComponents.swift(new) — shared visual helpers for provider cards.Sources/App/Resources/Localizable.xcstrings— new strings for the toggle, disabled status, and disabled guidance text.ProviderEnablementTests,ProviderEnablementViewModelTests,CredentialImportViewModelTests,ConfiguredProvidersOrderedTests, andProviderRegistryProactiveRefreshTestscover AC3 through AC11 with isolatedUserDefaults, keychain stubs, and provider spies.Notes for review
QuotaViewModelrefactor split one file into four extensions. Review the extracted files alongside the diff toQuotaViewModel.swiftto confirm no logic changed during the split.saveKeynow callssetProviderEnabled(true)after the Keychain write succeeds (AC4). Check that the failed-save path is tested.