feat: let extensions contribute command follow-up text - #9794
feat: let extensions contribute command follow-up text#9794Hui Miao (huimiu) wants to merge 2 commits into
Conversation
|
Azure Pipelines: Successfully started running 1 pipeline(s). 20 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
|
Azure Pipelines: Successfully started running 1 pipeline(s). 26 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
Pull request overview
Adds extension-contributed follow-up guidance to successful project lifecycle commands while preserving core messages and JSON output.
Changes:
- Adds
ProjectEventArgs.FollowUpand transports it through existing handler status messages. - Collects, replaces, retracts, and deterministically merges extension guidance.
- Adds comprehensive tests and extension documentation.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
docs/guides/creating-an-extension.md |
Documents lifecycle follow-up usage. |
docs/architecture/extension-framework.md |
Describes framework behavior. |
cli/azd/pkg/azdext/event_manager.go |
Adds and returns extension follow-up text. |
cli/azd/pkg/azdext/event_manager_test.go |
Tests SDK message propagation. |
cli/azd/internal/grpcserver/event_service.go |
Collects successful post-event contributions. |
cli/azd/internal/grpcserver/event_service_test.go |
Tests collection eligibility and retraction. |
cli/azd/internal/commandresult/follow_up.go |
Implements thread-safe contribution collection. |
cli/azd/internal/commandresult/follow_up_test.go |
Tests ordering, replacement, clearing, and concurrency. |
cli/azd/docs/extensions/extension-sdk-reference.md |
Adds SDK API documentation. |
cli/azd/docs/extensions/extension-framework.md |
Documents extension-facing behavior. |
cli/azd/cmd/middleware/ux.go |
Merges contributions into human-readable results. |
cli/azd/cmd/middleware/ux_test.go |
Tests UX merging and JSON exclusion. |
cli/azd/.vscode/cspell.yaml |
Adds package-name spelling exceptions. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
📋 Prioritization NoteThanks for the contribution! The linked issue isn't in the current milestone yet. |
Azure Dev CLI Install InstructionsInstall scriptsMacOS/Linux
bash: pwsh: WindowsPowerShell install MSI install Standalone Binary
MSI
Documentationlearn.microsoft.com documentationtitle: Azure Developer CLI reference
|
Why this change is needed
After
azd provisionorazd deploy, the user should be able to see a command-levelNext:hint. Lifecycle extensions already run at those points, but they have no way to put that text on the parent command's completion message.The hint then either never shows up, or the extension has to print it somewhere else (its own stdout, a service artifact note, and so on). That is the gap behind #8804. This PR is the core API for that hint. It does not wire Azure AI Agents yet.
Why this approach
Extensions set optional
ProjectEventArgs.FollowUp. The existing successful handler status message carries it, so we did not change protobuf. azd collects completed projectpost*text for the current command and appends it to the human-readable completion message. JSON output is unchanged.If the same extension contributes twice in one command, the later text wins. An empty value removes that extension's earlier text. That is how
azd upcan drop provision guidance after deploy instead of leaving a staleNext: azd deploy.Handler signatures and failure behavior stay the same. Older hosts ignore the extra success text. Older extensions keep working because they leave the field empty.
Scope
Azure AI Agents integration is a follow-up PR.
Related to #8804
Closes #9806