chore: refactor handle_configure to reduce line count #6276
+212
−206
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
Refactors the
handle_configurefunction incrates/goose-cli/src/commands/configure.rsfrom 203 lines down to 9 lines by extracting logical sections into focused helper functions.Changes
Split the monolithic
handle_configurefunction into smaller, focused helpers:handle_first_time_setup(58 lines): Handles welcome flow and setup method selection (openrouter/tetrate/manual)handle_manual_provider_setup(28 lines): Handles manual provider configuration result and error handlingprint_manual_config_error(48 lines): Handles ConfigError display with platform-specific keyring messagesprint_keyring_error(platform-specific, cfg-gated): Platform-specific keyring error messages for macOS/Windows/Linuxhandle_existing_config(53 lines): Handles configuration updates for existing setupsThe main
handle_configurefunction is now just 9 lines, delegating to appropriate helpers based on whether config exists.Testing
cargo build -p goose-cli✅cargo test -p goose-cli✅ (112 tests pass)cargo fmt✅cargo clippy -p goose-cli✅ (no errors or warnings in configure.rs)Related
Part of TSK-696: Simplify clippy baseline system