feat: implement auto-installation workflow for extensions - #5753
Conversation
- Add auto-installation support when users run unknown commands that match extension namespaces - Prompt users to install matching extensions with clear descriptions - Automatically execute the original command after successful installation - Maintain existing behavior for commands without matching extensions - Improves discoverability and reduces friction for extension adoption Fixes Azure#5752
wbreza
left a comment
There was a problem hiding this comment.
This is a great start! Added some feedback. Reach out if you have any questions.
…x the args for auto-install with the args for the extension command
…s and multi-namespace extensions
wbreza
left a comment
There was a problem hiding this comment.
Feels like we are doing more than we should be regarding any sort of flag/arg parsing.
Lets see if this is really needed and simplify the implementation.
…nstall-extensions
…nstall-extensions
…nstall-extensions
…parsing flags for auto-install
Azure Dev CLI Install InstructionsInstall scriptsMacOS/Linux
bash: pwsh: WindowsPowerShell install MSI install Standalone Binary
MSI
Documentationlearn.microsoft.com documentationtitle: Azure Developer CLI reference
|
Overview
This PR implements auto-installation of extensions when users attempt to run commands that match available extension namespaces but are not currently installed.
Problem
Users who try to run extension commands without having the extension installed receive unhelpful error messages like:
This creates friction in the user experience as users need to manually discover and install extensions.
Solution
New Approach: Proactive Extension Detection
Instead of running the command and capturing errors, the implementation now:
Key Implementation Details
findFirstNonFlagArg(): Extracts the actual command from arguments, ignoring flagscheckForMatchingExtension(): Queries the extension registry to find namespace matchestryAutoInstallExtension(): Handles user prompting and extension installationExecuteWithAutoInstall(): Main orchestration function that integrates with existing command executionUser Experience Improvements
Before:
After:
Changes Made
cmd/auto_install.go: New file containing auto-installation logicmain.go: Modified to useExecuteWithAutoInstallinstead of direct command executionTesting
azd demo,azd x)Fixes #5752