Skip to content

Commit 1620019

Browse files
jongioCopilot
andauthored
feat: full azd extension framework adoption - metadata, MCP server, lifecycle events (#37)
* feat: add metadata capability for IntelliSense and rich CLI help Add the metadata capability to the azd-exec extension to enable: - CLI help integration with rich usage information - IntelliSense support for extension flags and arguments - Configuration validation schemas Changes: - Add 'metadata' to capabilities in extension.yaml - Create hidden metadata command that outputs JSON metadata - Register metadata command in root command Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * feat: add lifecycle-events and mcp-server capabilities Implement full azd extension framework integration: - Real listen command with azdext.ExtensionHost for lifecycle events - MCP server with exec_script, exec_inline, list_shells, get_environment tools - Rate limiting (60 calls/min, burst 10) and security validation for MCP tools - Update extension.yaml with lifecycle-events and mcp-server capabilities - Add go.work entry for azure-dev dependency Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * feat: add distributed tracing and refactor to use azdextutil - Hydrate context with TRACEPARENT for distributed trace correlation - Replace duplicated rate limiter with azdextutil.RateLimiter - Use azdextutil security helpers for path/shell validation - Use azdextutil.GetProjectDir for safe directory resolution Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * refactor: use azdext SDK for tracing and metadata - Switch from azdextutil.SetupTracingFromEnv to azdext.NewContext() for proper OTel tracing - Replace hand-written metadata with azdext.GenerateExtensionMetadata() for framework-conforming schema Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: filter env vars in MCP tool and clean up lifecycle stubs - Filter get_environment to only return AZD_*/AZURE_*/ARM_* prefixed vars (security) - Remove meaningless lifecycle event handler stubs from listen command Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: preserve cobra context chain for signal handling Replace azdext.NewContext() (starts from context.Background()) with propagation.TraceContext{}.Extract() on the existing cobra context, preserving Ctrl+C handling and other context values. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: security hardening for MCP server - Filter secret-bearing env vars (SECRET, PASSWORD, KEY, TOKEN, etc.) - Switch from deprecated ValidatePath to security.ValidatePathWithinBases - Normalize shell binary names to lowercase for cross-platform compat Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * test: add MCP server unit tests for security-critical paths Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: add CONNECTION_STRING to secret denylist Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: update azd-core to latest (CI-compatible pseudo-version) Pin go.mod to azd-core v0.5.2-0.20260223042348-df3319c65059 which includes lint fixes, macOS symlink test fix, and gofmt formatting. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: resolve lint errors (errcheck, gofmt) - Check error return of fmt.Fprintln in metadata command - Fix gofmt formatting (CRLF -> LF line endings) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: resolve remaining lint (errcheck, unlambda, gofmt) - Use t.Setenv in tests instead of unchecked os.Setenv - Simplify lambda wrappers (gocritic unlambda) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: add azdext/traceparent terms to cspell dictionary Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chore: pin azd-core to tagged v0.5.2 release Replace pseudo-version with official tagged release. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 1ae69b6 commit 1620019

11 files changed

Lines changed: 1130 additions & 18 deletions

File tree

cli/extension.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ version: 0.3.7
77
language: go
88
capabilities:
99
- custom-commands
10+
- lifecycle-events
11+
- mcp-server
12+
- metadata
13+
mcp:
14+
serve:
15+
args: ["mcp", "serve"]
16+
env:
17+
- "AZD_EXEC_PROJECT_DIR=${AZD_PROJECT_DIR}"
1018
examples:
1119
- name: execute script
1220
description: Execute a script file with azd context

cli/go.mod

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,91 @@ module github.com/jongio/azd-exec/cli
33
go 1.26.0
44

55
require (
6-
github.com/jongio/azd-core v0.5.1
6+
github.com/azure/azure-dev/cli/azd v0.0.0-20260221052936-16626caf33f0
7+
github.com/jongio/azd-core v0.5.2
78
github.com/magefile/mage v1.15.0
9+
github.com/mark3labs/mcp-go v0.43.2
810
github.com/spf13/cobra v1.10.2
11+
go.opentelemetry.io/otel v1.38.0
912
)
1013

1114
require (
15+
dario.cat/mergo v1.0.2 // indirect
16+
github.com/AlecAivazis/survey/v2 v2.3.7 // indirect
1217
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.0 // indirect
1318
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.13.1 // indirect
1419
github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.2 // indirect
1520
github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets v1.4.0 // indirect
1621
github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.2.0 // indirect
1722
github.com/AzureAD/microsoft-authentication-library-for-go v1.6.0 // indirect
23+
github.com/Masterminds/semver/v3 v3.4.0 // indirect
24+
github.com/alecthomas/chroma/v2 v2.20.0 // indirect
25+
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
26+
github.com/aymerick/douceur v0.2.0 // indirect
27+
github.com/bahlo/generic-list-go v0.2.0 // indirect
28+
github.com/blang/semver/v4 v4.0.0 // indirect
29+
github.com/braydonk/yaml v0.9.0 // indirect
30+
github.com/buger/jsonparser v1.1.1 // indirect
31+
github.com/charmbracelet/colorprofile v0.3.2 // indirect
32+
github.com/charmbracelet/glamour v0.10.0 // indirect
33+
github.com/charmbracelet/lipgloss v1.1.1-0.20250404203927-76690c660834 // indirect
34+
github.com/charmbracelet/x/ansi v0.10.2 // indirect
35+
github.com/charmbracelet/x/cellbuf v0.0.13 // indirect
36+
github.com/charmbracelet/x/exp/slice v0.0.0-20251008171431-5d3777519489 // indirect
37+
github.com/charmbracelet/x/term v0.2.1 // indirect
38+
github.com/clipperhouse/uax29/v2 v2.2.0 // indirect
39+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
40+
github.com/dlclark/regexp2 v1.11.5 // indirect
41+
github.com/drone/envsubst v1.0.3 // indirect
42+
github.com/fatih/color v1.18.0 // indirect
43+
github.com/go-logr/logr v1.4.3 // indirect
44+
github.com/go-logr/stdr v1.2.2 // indirect
1845
github.com/golang-jwt/jwt/v5 v5.3.1 // indirect
46+
github.com/golobby/container/v3 v3.3.2 // indirect
1947
github.com/google/uuid v1.6.0 // indirect
48+
github.com/gorilla/css v1.0.1 // indirect
2049
github.com/inconshreveable/mousetrap v1.1.0 // indirect
50+
github.com/invopop/jsonschema v0.13.0 // indirect
51+
github.com/jmespath-community/go-jmespath v1.1.1 // indirect
52+
github.com/joho/godotenv v1.5.1 // indirect
2153
github.com/kylelemons/godebug v1.1.0 // indirect
54+
github.com/lucasb-eyer/go-colorful v1.3.0 // indirect
55+
github.com/mailru/easyjson v0.9.1 // indirect
56+
github.com/mattn/go-colorable v0.1.14 // indirect
57+
github.com/mattn/go-isatty v0.0.20 // indirect
58+
github.com/mattn/go-runewidth v0.0.19 // indirect
59+
github.com/microcosm-cc/bluemonday v1.0.27 // indirect
60+
github.com/microsoft/ApplicationInsights-Go v0.4.4 // indirect
61+
github.com/microsoft/go-deviceid v1.0.0 // indirect
62+
github.com/muesli/reflow v0.3.0 // indirect
63+
github.com/muesli/termenv v0.16.0 // indirect
64+
github.com/nathan-fiscaletti/consolesize-go v0.0.0-20220204101620-317176b6684d // indirect
2265
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
66+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
67+
github.com/rivo/uniseg v0.4.7 // indirect
68+
github.com/santhosh-tekuri/jsonschema/v6 v6.0.2 // indirect
69+
github.com/sethvargo/go-retry v0.3.0 // indirect
70+
github.com/spf13/cast v1.10.0 // indirect
2371
github.com/spf13/pflag v1.0.10 // indirect
72+
github.com/stretchr/testify v1.11.1 // indirect
73+
github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect
74+
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
75+
github.com/yosida95/uritemplate/v3 v3.0.2 // indirect
76+
github.com/yuin/goldmark v1.7.13 // indirect
77+
github.com/yuin/goldmark-emoji v1.0.6 // indirect
78+
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
79+
go.opentelemetry.io/otel/metric v1.38.0 // indirect
80+
go.opentelemetry.io/otel/sdk v1.38.0 // indirect
81+
go.opentelemetry.io/otel/trace v1.38.0 // indirect
82+
go.uber.org/atomic v1.11.0 // indirect
2483
golang.org/x/crypto v0.47.0 // indirect
84+
golang.org/x/exp v0.0.0-20250911091902-df9299821621 // indirect
2585
golang.org/x/net v0.49.0 // indirect
2686
golang.org/x/sys v0.40.0 // indirect
87+
golang.org/x/term v0.39.0 // indirect
2788
golang.org/x/text v0.33.0 // indirect
89+
google.golang.org/genproto/googleapis/rpc v0.0.0-20251007200510-49b9836ed3ff // indirect
90+
google.golang.org/grpc v1.76.0 // indirect
91+
google.golang.org/protobuf v1.36.10 // indirect
92+
gopkg.in/yaml.v3 v3.0.1 // indirect
2893
)

0 commit comments

Comments
 (0)