Skip to content

feat: adopt azdext SDK helpers — full extension framework migration#18

Open
jongio wants to merge 1 commit intomainfrom
feature/ext-framework-sdk-helpers
Open

feat: adopt azdext SDK helpers — full extension framework migration#18
jongio wants to merge 1 commit intomainfrom
feature/ext-framework-sdk-helpers

Conversation

@jongio
Copy link
Owner

@jongio jongio commented Feb 26, 2026

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

Metric Change
Files changed 9
Lines removed 404
Lines added 308
Net reduction -96 lines
Rate limiter boilerplate Removed (built into builder)
Arg parsing per tool -75%
Result construction -80%

Testing

  • \go build ./...\ ✅
  • \go test ./...\ ✅
  • All existing tests updated for new handler signatures

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>
@github-actions
Copy link
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.

github-actions bot added a commit that referenced this pull request Feb 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant