feat: adopt azdext SDK helpers — full extension framework migration#18
Open
feat: adopt azdext SDK helpers — full extension framework migration#18
Conversation
Migrates azd-copilot to use the new azdext SDK helpers from Azure/azure-dev#6856, replacing hand-rolled boilerplate with the framework's built-in equivalents. Changes: - Root command: NewExtensionRootCommand() replaces manual Cobra setup - Metadata: NewMetadataCommand() replaces manual wrapper - Listen: NewListenCommand() replaces manual gRPC setup - Version: NewVersionCommand() replaces manual version command - MCP server: NewMCPServerBuilder() with WithRateLimit() replaces manual setup - Tool handlers: ToolArgs typed accessors replace raw map[string]any parsing - Results: MCPJSONResult/MCPErrorResult replace manual construction - Rate limiter: Removed (handled by builder) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
|
🚀 Website Preview Your PR preview is ready! 📎 Preview URL: https://jongio.github.io/azd-copilot/pr/18/ This preview will be automatically cleaned up when the PR is closed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Migrates azd-copilot to use the new \�zdext\ SDK helpers from Azure/azure-dev#6856, replacing hand-rolled boilerplate with the framework's built-in equivalents.
Depends on: Azure/azure-dev#6856 (merged)
Related: jongio/azd-core#22, jongio/azd-app#145
What changed
Root command (\main.go)
Before: ~130 lines of manual Cobra setup with flag definitions, env var fallback, OTel trace context injection, cwd handling.
After: \�zdext.NewExtensionRootCommand()\ — standard flags, env var fallback, and OTel propagation in one call. Extension-specific flags (--prompt, --resume, --yolo, --agent, --model, etc.) chained onto the returned command.
Metadata command (\metadata.go)
Before: Manual metadata generation wrapper.
After: \�zdext.NewMetadataCommand()\ — one-liner.
Listen command (\listen.go)
Before: Manual gRPC client setup, ExtensionHost creation, event handler registration.
After: \�zdext.NewListenCommand(configure)\ with callback for event handlers.
Version command (\�ersion.go)
Before: \coreversion.NewCommand()\ from azd-core.
After: \�zdext.NewVersionCommand().
MCP server (\mcp.go)
Before: Manual \server.NewMCPServer()\ + hand-wired tool registration + \�zdextutil.NewRateLimiter().
After: \�zdext.NewMCPServerBuilder()\ with .WithRateLimit(10, 1.0)\ and .WithResourceCapabilities(true, false).
All MCP tool handlers (\mcp_grpc_tools.go)
Before: Raw \map[string]interface{}\ type assertions + \mcp.NewToolResultError()\ + \json.MarshalIndent()\ + per-tool rate limit checks.
After: \�zdext.ToolArgs\ typed accessors (\RequireString, \OptionalString) + \�zdext.MCPJSONResult()\ / \MCPErrorResult(). Rate limiting handled by builder.
Impact
Testing