fix(#8149): azd tool list detects AI extension#8194
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes two azd tool bugs related to AI extension detection and VS Code Copilot Chat installation by correcting the AI extension manifest entry and unconditionally passing --force to code --install-extension.
Changes:
- Update
azdAIExtensionsmanifest to use the real extension idazure.ai.agents, drop the bogusaz-clidependency, pin--source azd, and rename to "azd AI Agent Extensions". - Always pass
--forcefrombuildCodeCommand, eliminating false "already installed" results caused by stale.obsoleteVS Code extension folders. - Refactor
TestBuildManagerCommandto assert multiple expected args, replace the contract test for the AI extension, and isolate dependency-resolution tests behind a synthetic 2-tool manifest.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| cli/azd/pkg/tool/manifest.go | Fix azdAIExtensions id/name/source flag and remove az-cli dep. |
| cli/azd/pkg/tool/manifest_test.go | Update built-in tool list and add AzdAIExtensionsContract test asserting id/category/detect-command/args/strategies. |
| cli/azd/pkg/tool/manager_test.go | Extract dependency-resolution subtests into a new function using a synthetic manifest decoupled from the AI extension's deps. |
| cli/azd/pkg/tool/installer.go | buildCodeCommand now always appends --force; upgrade parameter retained but unused with explanatory comment. |
| cli/azd/pkg/tool/installer_test.go | Generalize expectArg→expectArgs and assert both --install-extension and --force on code rows. |
…49-azd-tool-list-detect-extensions
jongio
left a comment
There was a problem hiding this comment.
The #8149 fix looks correct -- manifest ID, dependency removal, and --source azd flag are all solid. Category renames (ToolCategoryVSCodeExtension, ToolCategoryAzdExtension) are thorough across all files. The new contract test is a nice addition.
Two things need fixing before this can merge:
-
PR description is stale. The body and title reference fixing #8150 (VS Code
--force), but commita27b687removed that change.Fixes #8150in the body will auto-close that issue on merge without actually fixing it. Either remove the #8150 reference or re-add the fix. -
CI is red.
golangci-lintfails onmanifest_test.go-- the map literal alignment broke when the category constants got longer names. Runninggofmt -w manifest_test.gofixes it.
wbreza
left a comment
There was a problem hiding this comment.
Confirming the AI extension manifest fix looks correct — the ID swap (\�zure.ai.agents), dropping the \�z-cli\ dependency, and pinning --source azd\ directly address #8149. Approving the direction. Flagging two non-blocking polish items before merge.
1. PR description disagrees with the code
The "\ToolCategory\ rename — no breaking change" section asserts the JSON values are unchanged:
| Go constant | JSON value (unchanged) |
|---|---|
| \ToolCategoryVSCodeExtension\ | \�xtension\ |
| \ToolCategoryAzdExtension\ | \library\ |
But the code actually emits:
\\go
ToolCategoryVSCodeExtension ToolCategory = "VS Code extension"
ToolCategoryAzdExtension ToolCategory = "azd extension"
\\
Since \cli/azd/cmd/tool.go\ serializes via \Category: string(s.Tool.Category), the wire format does change. This is the same concern @jongio raised on \manifest.go:23.
The renamed display names are an improvement (\library\ was misleading for an azd extension; \�xtension\ was ambiguous between VS Code and azd extensions), so the right fix is to update the description to call out the wire change rather than revert the strings. Suggested rewrite of that section:
\ToolCategory\ rename — display names updated
The Go constants were renamed and their string values updated for clarity. \library\ was wrong for an azd extension; \�xtension\ was ambiguous between VS Code and azd extensions.
Wire change for \�zd tool list --output json\ consumers (beta/unreleased command): see #2 below for the proposed final values.
2. Consider more machine-friendly wire values while the format is still beta
Since \�zd tool list\ is still beta/unreleased, this is a one-shot opportunity to pick wire values that map to real-world usage and follow typical JSON enum conventions. Strings with embedded spaces ("VS Code extension", "azd extension") are unusual for serialized enums and awkward to consume programmatically — harder to grep, awkward in CLI args/URLs, and uncommon in CLI tool JSON contracts.
Suggested values that read well in both code and JSON:
| Go constant | Suggested JSON value |
|---|---|
| \ToolCategoryCLI\ | \cli\ (unchanged) |
| \ToolCategoryVSCodeExtension\ | \�scode-extension\ |
| \ToolCategoryServer\ | \server\ (unchanged) |
| \ToolCategoryAzdExtension\ | \�zd-extension\ |
Whichever direction you pick, please lock the wire format in the new \AzdAIExtensionsContract\ test with an explicit assertion like \�ssert.Equal(t, "azd-extension", string(tool.Category))\ so future renames can't silently break the format again — the current contract test only asserts the Go constant identity, not the wire string.
✅ Confirmed resolved from prior rounds:
- gofmt fix on \manifest_test.go\ landed in \89a7693\
- #8150\ / --force\ scope correctly removed from description and code; title now matches
- \TestManager_InstallToolsDependencyResolution\ is a clean synthetic-fixture replacement that restores the coverage previously coupled to the old \�zd-ai-extensions\ dependency shape
wbreza
left a comment
There was a problem hiding this comment.
Re-review of commit e6dab2bc — approving. The author cleanly addressed the substance of my prior feedback:
- ✅ PR description now has an explicit Breaking changes table documenting both wire format updates (
extension→vscode-extension,library→azd-extension) and the AI extension ID change. No more conflicting "deliberately unchanged" language. - ✅ Wire format values updated to the machine-friendly
vscode-extension/azd-extension(kebab-case, no embedded spaces) — good fit for JSON consumers since the command is still beta. - ✨ Bonus: the new
wrapToolNotFoundIfErrhelper oninstall/install --dry-run/upgrade/showis a thoughtful UX touch — users who pass a tool name instead of an ID now get a clear "Run 'azd tool list' to see available tool IDs" hint.
One optional nit (non-blocking)
The AzdAIExtensionsContract test in manifest_test.go still only asserts the Go constant identity (ToolCategoryAzdExtension), not the wire string. A future rename could silently re-break the JSON contract. A one-line lock would close that loop:
assert.Equal(t, "azd-extension", string(tool.Category), "wire format must remain stable")
Happy to land as-is or in a follow-up — nothing blocking.
…49-azd-tool-list-detect-extensions
Azure Dev CLI Install InstructionsInstall scriptsMacOS/Linux
bash: pwsh: WindowsPowerShell install MSI install Standalone Binary
MSI
Documentationlearn.microsoft.com documentationtitle: Azure Developer CLI reference
|
Summary
Fixes #8149 —
azd tool listwas missing the azd AI agent extension.This PR also improves the
azd toolcommand UX and renames internal tool category constants for clarity.What changed
pkg/tool/manifest.goToolCategoryExtension→ToolCategoryVSCodeExtension(JSON value:"extension"→"vscode-extension").ToolCategoryLibrary→ToolCategoryAzdExtension(JSON value:"library"→"azd-extension").azd tool listdetects it:Id:azd-ai-extensions→azure.ai.agents(matches the real extension ID used for detection)Name:azd AI Extensions→azd AI Agent ExtensionsInstallCommand: now uses--source azdaz-clidependency (not required)pkg/tool/detector.go,pkg/tool/version_provider.gocmd/tool.goFindToolerrors withinternal.ErrorWithSuggestionininstall,install --dry-run,upgrade, andshowactions so a bad arg (e.g.azd tool install GitHub) returns a clear hint to runazd tool listfor the correct tool IDs.Tests
manifest_test.go,detector_test.go,manager_test.go,installer_test.go,version_provider_test.goto use the renamed constants and the new AI extension manifest.Breaking changes
azd tool list --output json→category"extension""vscode-extension"azd tool list --output json→category"library""azd-extension"azd-ai-extensionsazure.ai.agentsScripts parsing
azd tool list --output jsonfor thecategoryfield or referencing the AI extension by the old ID will need updating.Validation
gofmt -s -w .,go fix ./...,golangci-lint run ./...cleango test ./pkg/tool/... ./cmd/...passing