chore: refactor add_extension to reduce line count #6278
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
add_extensionfunction inextension_manager.rsto reduce its line count from 259 lines to 129 lines (well under the 200 line target).Changes
Extracted the following helper functions from
add_extension:merge_environments: Async function to merge environment variables from direct envs and keychain-stored env_keyssubstitute_env_vars: Function to substitute environment variables in strings (supports both ${VAR} and $VAR syntax)create_streamable_http_client: Async function to create StreamableHttp MCP clients with header substitution and OAuth supportcreate_stdio_client: Async function to create Stdio MCP clients with malware checkingAlso updated the test to use the module-level
substitute_env_varsfunction instead of duplicating it.Testing
Related
Part of TSK-696: Simplify clippy baseline system