Enable full figspec generation for extensions with metadata capability#6620
Enable full figspec generation for extensions with metadata capability#6620
Conversation
Co-authored-by: JeffreyCA <9157833+JeffreyCA@users.noreply.github.com>
Co-authored-by: JeffreyCA <9157833+JeffreyCA@users.noreply.github.com>
|
@copilot can you run the Figspec snapshot tests and verify they're up to date? |
Ran the Figspec snapshot tests - they pass successfully and the snapshot file is up to date with no uncommitted changes: The test installs all extensions from the local registry, generates the figspec with full extension command trees, and verifies against the committed snapshot. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
/azp run azure-dev - cli |
|
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Pull request overview
This PR extends Fig spec generation to incorporate full command trees for azd extensions that support the metadata capability and adds dynamic completion for azd config keys, improving IntelliSense in VS Code and other Fig consumers.
Changes:
- Wire the Fig spec builder to the extensions
Managerand consume extensionmetadata.jsonto generate full subcommand/flag trees for metadata-capable extensions (azure.ai.agents,azure.ai.finetune,azure.coding-agent,microsoft.azd.demo,microsoft.azd.extensions,microsoft.azd.concurx). - Add a TypeScript generator and Go wiring for dynamic completion of
azd config get/set/unsetpatharguments usingazd config options --output json. - Improve TypeScript rendering of args (indentation and array formatting) and update the snapshot-based Fig spec test to assert the end-to-end CLI-generated spec, including extension metadata.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
cli/azd/pkg/extensions/manager.go |
Refactors LoadMetadata to use a reusable LoadMetadataFromDir helper and adds HasMetadataCapability for checking whether an extension exposes metadata, enabling the Fig builder to query this via the Manager. |
cli/azd/internal/figspec/typescript_renderer.go |
Adjusts arg rendering indentation for both subcommand args and option args, fixing formatting issues in the generated TypeScript spec without changing semantics. |
cli/azd/internal/figspec/spec_builder.go |
Extends SpecBuilder with an ExtensionMetadataProvider, tracks global flag names, and adds logic to replace extension entrypoint commands with full metadata-derived command trees (and matching help trees) when available. |
cli/azd/internal/figspec/resources/generators.ts |
Introduces the AzdConfigOption type and a new listConfigKeys Fig generator that shells out to azd config options --output json, filters out envvar-type entries, and exposes config keys plus descriptions for completion. |
cli/azd/internal/figspec/fig_generators.go |
Defines the FigGenListConfigKeys constant pointing at azdGenerators.listConfigKeys, so Go-side spec generation can refer to the new generator. |
cli/azd/internal/figspec/extension_metadata.go |
Adds the ExtensionMetadataProvider interface and conversion helpers (convertExtensionCommand, convertExtensionFlag, convertExtensionArg, convertExtensionCommandForHelp) to translate extension metadata (commands, flags, args) into Fig Subcommand/Option/Arg structures, filtering out global flags. |
cli/azd/internal/figspec/extension_metadata_test.go |
Introduces unit tests that validate conversion of extension commands, flags, args, and help-only command trees to Fig structures, including handling of aliases, hidden entities, global-flag filtering, repeatable and dangerous flags, and suggestion lists. |
cli/azd/internal/figspec/customizations.go |
Wires the new config-key generator into the customization layer by returning FigGenListConfigKeys for the path argument of azd config get/set/unset, enabling dynamic completions for config keys. |
cli/azd/cmd/testdata/TestFigSpec.ts |
Updates the snapshot of the generated Fig spec to include full extension command trees for metadata-capable extensions, new listConfigKeys generator wiring, and corrected arg/option indentation. |
cli/azd/cmd/figspec_test.go |
Changes the Fig spec snapshot test to invoke azd completion fig via the CLI helper instead of calling figspec directly, thereby exercising the full wiring including extensions, metadata loading, and generators. |
cli/azd/cmd/completion.go |
Extends the completionFigAction to receive an *extensions.Manager from DI and configures the Fig SpecBuilder to use it via WithExtensionMetadata, so extension metadata is available during spec construction. |
cli/azd/.vscode/cspell.yaml |
Adds subcmd to the custom dictionary to avoid false-positive spell-check warnings on the new tests and comments. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
/azp run azure-dev - cli |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Azure Dev CLI Install InstructionsInstall scriptsMacOS/Linux
bash: pwsh: WindowsPowerShell install MSI install Standalone Binary
MSI
Documentationlearn.microsoft.com documentationtitle: Azure Developer CLI reference
|
#6620) * Fix indentation * Add metadata capability checks and improve error handling * Support dynamic suggestions for `azd config` commands * Exclude global persistent flags --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: JeffreyCA <9157833+JeffreyCA@users.noreply.github.com>
#6620) * Fix indentation * Add metadata capability checks and improve error handling * Support dynamic suggestions for `azd config` commands * Exclude global persistent flags --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: JeffreyCA <9157833+JeffreyCA@users.noreply.github.com>
* fix security issue with playwright/test 1.49.1 (#6592) * Checkpoint from VS Code for cloud agent session * Update parameter popup border color to cyan in concurX extension Co-authored-by: vhvb1989 <24213737+vhvb1989@users.noreply.github.com> * Complete concurX parameter popup color update Co-authored-by: vhvb1989 <24213737+vhvb1989@users.noreply.github.com> * cspell * Remove unintended changes to azure.ai.finetune extension Co-authored-by: vhvb1989 <24213737+vhvb1989@users.noreply.github.com> * azure.ai.agents - Set `CGO_ENABLED=0` for x64 Linux build (#6611) * Set CGO_ENABLED=0 for x64 Linux build * Bump version * Bump version to 0.1.8-preview (#6613) * Extension update fixes/enhancements (#6604) * Clarify extension list latest version column * Add update availability JSON property and show asterisk besides outdated extensions * Add upgrade hints to extension list output * Fix cooldown logic and shallow copy * Update AGENTS.md --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: JeffreyCA <9157833+JeffreyCA@users.noreply.github.com> * Fix bicep CLI uninitialized path in container app deployments (#6610) * fix security issue with playwright/test 1.49.1 (#6592) * Checkpoint from VS Code for cloud agent session * Fix bicep CLI initialization by restoring EnsureInstalled calls - Restore public EnsureInstalled() method in bicep.go - Remove automatic installation from Build() and BuildBicepParam() - Add explicit EnsureInstalled() calls in service_target_containerapp.go and bicep_provider.go - Update all test files to use public EnsureInstalled() method - Reverts incorrect changes from previous checkpoint commit This fix follows the same pattern as PR #6593 for GitHub CLI. Co-authored-by: vhvb1989 <24213737+vhvb1989@users.noreply.github.com> * Checkpoint from VS Code for cloud agent session --------- Co-authored-by: Victor Vazquez <vhvb1989@gmail.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: vhvb1989 <24213737+vhvb1989@users.noreply.github.com> * Add azure.ai.agent 0.1.8-preview to registry (#6615) * Release 1.23.2 (#6616) * Initial plan * Release 1.23.2 Co-authored-by: vhvb1989 <24213737+vhvb1989@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: vhvb1989 <24213737+vhvb1989@users.noreply.github.com> * Increment CLI version after release (#6617) * Migrate to use new shared eng package (#6600) * Fix VS Code extension commands failing with undefined fsPath in virtual file systems (#6601) * Initial plan * Add defensive checks for undefined fsPath in VS Code extension commands This fixes the issue where provision and other commands would fail with "The 'path' argument must be of type string. Received undefined" when used with virtual file systems or certain VS Code contexts. Changes: - Added validation for selectedFile.fsPath before calling getWorkingFolder - Provides clear error messages that include URI scheme and selectedItem type - Suppresses automatic issue reporting since this is a user error - Applied fix to all affected commands: provision, deploy, up, down, restore, monitor, packageCli, and pipelineConfig - Added unit tests for the new validation logic Co-authored-by: vhvb1989 <24213737+vhvb1989@users.noreply.github.com> * Simplify provision.test.ts based on code review feedback Removed unused stub functions that weren't actually being used. Simplified tests to focus on the core validation logic. Co-authored-by: vhvb1989 <24213737+vhvb1989@users.noreply.github.com> * Refactor validation logic into shared utility function Based on code review feedback: - Extracted duplicated validation logic to validateFileSystemUri() in cmdUtil.ts - Updated all 8 command files to use the shared function - Simplified test assertions - Improved code maintainability by reducing duplication Co-authored-by: vhvb1989 <24213737+vhvb1989@users.noreply.github.com> * Fix validation to use strict equality check for undefined Changed condition from `!selectedFile.fsPath` to `selectedFile.fsPath === undefined` to avoid incorrectly rejecting empty string paths which are valid for root directories. Co-authored-by: vhvb1989 <24213737+vhvb1989@users.noreply.github.com> * Fix l10n.t() to use single string literal instead of concatenation The first argument to vscode.l10n.t() should be a single string literal for proper localization tooling compatibility. Removed string concatenation and used a single multi-line string literal instead. Co-authored-by: vhvb1989 <24213737+vhvb1989@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: vhvb1989 <24213737+vhvb1989@users.noreply.github.com> * Add missing keys to `azd config options` (#6619) * Add missing config options --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: JeffreyCA <9157833+JeffreyCA@users.noreply.github.com> * Raising for missing method type (#6628) * adding project-endpoint to init command * adding 12 preview release * fixig default customization method & adding training type * correct version * RFT grader fixes (#6629) * adding project-endpoint to init command * adding 12 preview release * fixig default customization method & adding training type * correct version * adding grader to cloning code * adding missing grader functionality * merging master * including .14-preview to main registry (#6630) * Add a naive attempt at downloading manifest (#6631) * Add a naive attempt at downloading * Address PR comments Signed-off-by: trangevi <trangevi@microsoft.com> * Update download directory as well Signed-off-by: trangevi <trangevi@microsoft.com> * Use net/url parsing in parseGitHubUrlNaive to handle fragments and query params (#6634) * Initial plan * Use net/url parsing to handle query params and fragments in parseGitHubUrlNaive Co-authored-by: trangevi <26490000+trangevi@users.noreply.github.com> * Final review completed Co-authored-by: trangevi <26490000+trangevi@users.noreply.github.com> * Revert unintended changes to other extensions Co-authored-by: trangevi <26490000+trangevi@users.noreply.github.com> * Address PR comments Signed-off-by: trangevi <trangevi@microsoft.com> * Update download directory as well Signed-off-by: trangevi <trangevi@microsoft.com> * Initial plan * Rebased on latest base branch --------- Signed-off-by: trangevi <trangevi@microsoft.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: trangevi <26490000+trangevi@users.noreply.github.com> Co-authored-by: trangevi <trangevi@microsoft.com> --------- Signed-off-by: trangevi <trangevi@microsoft.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: trangevi <26490000+trangevi@users.noreply.github.com> * Dev container feature - allow installing extensions (#6460) * Add extensions option to the azd devcontainer feature to allow specifying extensions to install * Review updates * Revert whitespace changes * Address feedback on shell script. Add multiple extensions to the test config to validate * Enable full figspec generation for extensions with metadata capability (#6620) * Fix indentation * Add metadata capability checks and improve error handling * Support dynamic suggestions for `azd config` commands * Exclude global persistent flags --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: JeffreyCA <9157833+JeffreyCA@users.noreply.github.com> * Add concurX binary to gitignore Co-authored-by: vhvb1989 <24213737+vhvb1989@users.noreply.github.com> * lint * Update TestAskerConsoleExternalPrompt to use new external prompt mechanism Co-authored-by: vhvb1989 <24213737+vhvb1989@users.noreply.github.com> --------- Signed-off-by: trangevi <trangevi@microsoft.com> Co-authored-by: Victor Vazquez <vhvb1989@gmail.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: vhvb1989 <24213737+vhvb1989@users.noreply.github.com> Co-authored-by: JeffreyCA <jeffreychen@microsoft.com> Co-authored-by: JeffreyCA <9157833+JeffreyCA@users.noreply.github.com> Co-authored-by: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Co-authored-by: Brandon Waterloo [MSFT] <36966225+bwateratmsft@users.noreply.github.com> Co-authored-by: Amit Chauhan <70937115+achauhan-scc@users.noreply.github.com> Co-authored-by: Travis Angevine <trangevi@microsoft.com> Co-authored-by: trangevi <26490000+trangevi@users.noreply.github.com> Co-authored-by: Stuart Leeks <stuartle@microsoft.com>
Fixes #6543
Fixes #6623
This PR enables Fig autocomplete spec generation to include full command trees for azd extensions that declare the
metadatacapability, improving VS Code terminal IntelliSense for extension commands. Previously, the generated spec only included the extension namespace and did not have any subcommand or flag information.Extensions with full completions:
azure.ai.agentsazure.ai.finetuneazure.coding-agentmicrosoft.azd.demomicrosoft.azd.extensionsmicrosoft.azd.concurxThis PR also fixes indentation issues and enables dynamic suggestions for
azd config set/get/unsetusing the newazd config options --output jsoncommand under the hood.How it works
When building figspec, the
SpecBuilder:extension.idannotationmetadatacapability viaHasMetadataCapability()Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
aka.ms/home/REDACTED/work/azure-dev/azure-dev/cli/azd/azd /home/REDACTED/work/azure-dev/azure-dev/cli/azd/azd extension source add -n local -t file -l /home/REDACTED/work/azure-dev/azure-dev/cli/azd/extensions/registry.json /home/REDACTED/work/azure-dev/azure-dev/cli/azd/pkg/prompt/prompt_models.go /home/REDACTED/work/azure-dev/azure-dev/cli/azd/pkg/prompt/prompt_service.go -qui�� hs9hXAu9J cfg x_amd64/vet . AD/microsoft-aut-o x86_64-linux-gnu/tmp/go-build2537574258/b738/_pkg_.a x_amd64/vet(dns block)/home/REDACTED/work/azure-dev/azure-dev/cli/azd/azd /home/REDACTED/work/azure-dev/azure-dev/cli/azd/azd extension list --source local --output json -importcfg /tmp/go-build2537574258/b738/importcfg -pack /home/REDACTED/work/azure-dev/azure-dev/cli/azd/pkg/infra/azure_resource_manager.go /home/REDACTED/work/azure-dev/azure-dev/cli/azd/pkg/infra/deployment_manager.go -W dMToCaQSI cfg x_amd64/vet . AD/microsoft-aut-o --64 x_amd64/vet(dns block)/home/REDACTED/work/azure-dev/azure-dev/cli/azd/azd /home/REDACTED/work/azure-dev/azure-dev/cli/azd/azd extension install azure.ai.agents --source local --version 0.1.8-preview -p s-go-api/azurede-atomic -lang=go1.23 x_amd64/vet -W LxQsGdGrv cfg x_amd64/vet . AD/microsoft-aut-o --64 x_amd64/vet(dns block)code.cloudfoundry.org/update-job-proxy /update-job-proxy -o br-f1a9f09b2487 -j DOCKER-ISOLATION-STAGE-2 fb36b73.0 64/pkg/tool/linu-e(dns block)/update-job-proxy /update-job-proxy DROP e/git-remote-htt/etc/ssl/certs/feffd413.0 test -e C_RAIZ_FNMT-RCM_SERVIDORES_SEGUROS.pem e/git-remote-htt/usr/share/ca-certificates/mozilla/Hongkong_Post_Root_CA_3.crt test om/gofrs/uuid --auto /bin/git test -e oot_CA_2022.pem /usr/bin/git /usr/bin/test 88a3ebd39425b66a/usr/sbin/iptables b9711f78:go.mod e/git-remote-htt-t test(dns block)dario.cat/update-job-proxy /update-job-proxy -o br-f1a9f09b2487 -j DOCKER-ISOLATION-STAGE-2 fb36b73.0 64/pkg/tool/linu-e(dns block)/update-job-proxy /update-job-proxy DROP e/git-remote-htt/etc/ssl/certs/feffd413.0 test -e C_RAIZ_FNMT-RCM_SERVIDORES_SEGUROS.pem e/git-remote-htt/usr/share/ca-certificates/mozilla/Hongkong_Post_Root_CA_3.crt test om/gofrs/uuid --auto /bin/git test -e oot_CA_2022.pem /usr/bin/git /usr/bin/test 88a3ebd39425b66a/usr/sbin/iptables b9711f78:go.mod e/git-remote-htt-t test(dns block)go.googlesource.com/update-job-proxy /update-job-proxy -o br-f1a9f09b2487 -j DOCKER-ISOLATION-STAGE-2 fb36b73.0 64/pkg/tool/linu-e(dns block)/update-job-proxy /update-job-proxy DROP e/git-remote-htt/etc/ssl/certs/feffd413.0 test -e C_RAIZ_FNMT-RCM_SERVIDORES_SEGUROS.pem e/git-remote-htt/usr/share/ca-certificates/mozilla/Hongkong_Post_Root_CA_3.crt test om/gofrs/uuid --auto /bin/git test -e oot_CA_2022.pem /usr/bin/git /usr/bin/test 88a3ebd39425b66a/usr/sbin/iptables b9711f78:go.mod e/git-remote-htt-t test(dns block)go.opentelemetry.io/update-job-proxy /update-job-proxy -o br-f1a9f09b2487 -j DOCKER-ISOLATION-STAGE-2 fb36b73.0 64/pkg/tool/linu-e(dns block)/update-job-proxy /update-job-proxy DROP e/git-remote-htt/etc/ssl/certs/feffd413.0 test -e C_RAIZ_FNMT-RCM_SERVIDORES_SEGUROS.pem e/git-remote-htt/usr/share/ca-certificates/mozilla/Hongkong_Post_Root_CA_3.crt test om/gofrs/uuid --auto /bin/git test -e oot_CA_2022.pem /usr/bin/git /usr/bin/test 88a3ebd39425b66a/usr/sbin/iptables b9711f78:go.mod e/git-remote-htt-t test(dns block)go.uber.org/update-job-proxy /update-job-proxy -o br-f1a9f09b2487 -j DOCKER-ISOLATION-STAGE-2 fb36b73.0 64/pkg/tool/linu-e(dns block)/update-job-proxy /update-job-proxy DROP e/git-remote-htt/etc/ssl/certs/feffd413.0 test -e C_RAIZ_FNMT-RCM_SERVIDORES_SEGUROS.pem e/git-remote-htt/usr/share/ca-certificates/mozilla/Hongkong_Post_Root_CA_3.crt test om/gofrs/uuid --auto /bin/git test -e oot_CA_2022.pem /usr/bin/git /usr/bin/test 88a3ebd39425b66a/usr/sbin/iptables b9711f78:go.mod e/git-remote-htt-t test(dns block)google.golang.org/update-job-proxy /update-job-proxy -o br-f1a9f09b2487 -j DOCKER-ISOLATION-STAGE-2 fb36b73.0 64/pkg/tool/linu-e(dns block)/update-job-proxy /update-job-proxy DROP e/git-remote-htt/etc/ssl/certs/feffd413.0 test -e C_RAIZ_FNMT-RCM_SERVIDORES_SEGUROS.pem e/git-remote-htt/usr/share/ca-certificates/mozilla/Hongkong_Post_Root_CA_3.crt test om/gofrs/uuid --auto /bin/git test -e oot_CA_2022.pem /usr/bin/git /usr/bin/test 88a3ebd39425b66a/usr/sbin/iptables b9711f78:go.mod e/git-remote-htt-t test(dns block)gopkg.in/update-job-proxy /update-job-proxy -o br-f1a9f09b2487 -j DOCKER-ISOLATION-STAGE-2 fb36b73.0 64/pkg/tool/linu-e(dns block)/update-job-proxy /update-job-proxy DROP e/git-remote-htt/etc/ssl/certs/feffd413.0 test -e C_RAIZ_FNMT-RCM_SERVIDORES_SEGUROS.pem e/git-remote-htt/usr/share/ca-certificates/mozilla/Hongkong_Post_Root_CA_3.crt test om/gofrs/uuid --auto /bin/git test -e oot_CA_2022.pem /usr/bin/git /usr/bin/test 88a3ebd39425b66a/usr/sbin/iptables b9711f78:go.mod e/git-remote-htt-t test(dns block)westus-0.in.applicationinsights.azure.com/home/REDACTED/work/azure-dev/azure-dev/cli/azd/azd /home/REDACTED/work/azure-dev/azure-dev/cli/azd/azd telemetry upload 64/pkg/tool/linux_amd64/vet -uns�� c/extension_metadata.go /tmp/go-build276716392/b108/vet.cfg cfg ty@v0.0.20/doc.g/opt/hostedtoolcache/go/1.25.6/x64/pkg/tool/linux_amd64/cgo ty@v0.0.20/isatt-V=full x_amd64/compile ache/go/1.25.6/x64/pkg/tool/linux_amd64/vet -ato�� -bool -buildtags 4c49fdc4a8c0/bash -errorsas -ifaceassert -nilfunc ache/go/1.25.6/x-v(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.