chore: refactor configure_extensions_dialog to reduce line count #6277
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
configure_extensions_dialogfunction from 353 lines down to 36 lines by extracting common functionality into focused helper functions.Changes
Split the monolithic function into smaller, reusable helpers:
prompt_extension_timeout(): Prompts for extension timeoutprompt_extension_description(): Prompts for extension descriptionprompt_extension_name(): Prompts for extension name with validationcollect_env_vars(): Collects environment variables interactivelycollect_headers(): Collects custom headers interactivelyconfigure_builtin_extension(): Handles built-in extension setupconfigure_stdio_extension(): Handles stdio extension setupconfigure_sse_extension(): Handles SSE extension setupconfigure_streamable_http_extension(): Handles streaming HTTP setupResult
The refactoring improves code readability and maintainability while preserving all existing functionality.
Testing
cargo build -p goose-cli✅cargo fmt✅cargo clippy -p goose-cli -- -D warnings✅./scripts/clippy-lint.sh✅