Skip to content

Commit 36160ee

Browse files
CopilotspboyerCopilothemarinajongio
authored
Add structured docs/ directory and copilot instructions for documentation maintenance (#7208)
* Initial plan * Add structured docs/ directory, copilot instructions, and update README Create docs/ at repo root with concepts/, guides/, reference/, and architecture/ subdirectories. Add initial documentation covering: - Glossary, feature stages, alpha features (concepts) - Contributing, adding commands, creating extensions, observability (guides) - Environment variables, azure.yaml schema, feature status (reference) - System overview, command execution, extension framework, provisioning (architecture) - ADR template for future architecture decision records Add .github/instructions/documentation.instructions.md with copilot instructions to keep docs up to date when codebase changes. Update root README.md to link to the new docs/ directory. Co-authored-by: spboyer <7681382+spboyer@users.noreply.github.com> * Address code review: alphabetize feature status, improve action docs Co-authored-by: spboyer <7681382+spboyer@users.noreply.github.com> * fix: resolve cspell failures and review feedback - Add cspell overrides for technical terms in docs/ markdown files - Fix Jaeger OTLP endpoint to use explicit http://localhost:4318 - Update AGENTS.md link in README.md to root (symlink) - Verified errors.AsType is valid (Go 1.26, used in 10+ files) - Verified table syntax is correct (no || issues found) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chore: retrigger CI * Address review feedback: fix env vars, add pflag import, improve auth descriptions - Remove hallucinated AZD_DEBUG_DOTENV_OVERRIDES, replace with real AZD_DEBUG_LOG - Move AZD_AUTH_ENDPOINT/AZD_AUTH_KEY to new "IDE Integration" section with accurate descriptions (set by IDE hosts, not user-facing) - Add missing github.com/spf13/pflag import to code example in adding-a-new-command.md Agent-Logs-Url: https://github.com/Azure/azure-dev/sessions/6fcebb42-32ec-4d91-a394-7e4f5b46a3fd Co-authored-by: hemarina <104857065+hemarina@users.noreply.github.com> * Fixes: - extension-framework, creating-an-extension, glossary: correct capability names to match extension.schema.json (custom-commands, lifecycle-events, mcp-server, service-target-provider, framework-service-provider, metadata) - creating-an-extension: fix extension ID (microsoft.azd.extensions), YAML field (id: not name:), list all supported languages - command-execution-model: fix OutputFormat types, ActionResult description, add NoneFormat - adding-a-new-command: fix Bind signature, file path, root.Add - system-overview: fix IoC pattern to constructor injection - provisioning-pipeline: remove hallucinated preflight checks - azure-yaml-schema: fix host values (ai.endpoint, azure.ai.agent), add missing properties, hooks, languages, service fields - environment-variables: fix AZD_DEBUG_LOG description - feature-status: add missing commands, match canonical naming - alpha-features: add unset/disable commands, env var notation - feature-stages: fix graduation criteria per canonical source - observability: fix Span/Event terminology, add localhost note - glossary: fix preflight checks to include server-side validation * misc * add azure.yaml schema * docs: address Copilot review — fix output formatting docs, gofmt code, TTY description, add AZD_AUTH_CERT - command-execution-model.md: clarify OutputFormats wires flags only; actions emit structured output via injected output.Formatter - adding-a-new-command.md: convert code example to tab indentation (gofmt), add note that OutputFormats alone is insufficient - feature-status.md: remove misleading 'with graduation criteria' from link text - environment-variables.md: fix AZD_FORCE_TTY description to 'terminal detection mode', add missing AZD_AUTH_CERT env var Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * docs: address jongio round 4 — add ai_model_quota check, shell→kind, fix IoC regression, update glossary - provisioning-pipeline.md: add ai_model_quota as second preflight check - azure-yaml-schema.md: shell→kind in hook example, add infracreate/infradelete hooks - system-overview.md: fix IoC example regression (MustRegisterTransient→MustRegisterSingleton) - glossary.md: update preflight description to match implemented checks Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Update docs/reference/azure-yaml-schema.md Co-authored-by: Jon Gallant <2163001+jongio@users.noreply.github.com> * Update docs/concepts/glossary.md Co-authored-by: Jon Gallant <2163001+jongio@users.noreply.github.com> * Update docs/architecture/system-overview.md Co-authored-by: Jon Gallant <2163001+jongio@users.noreply.github.com> * docs: add reserved_resource_names to preflight check list Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * address feedback * Update docs/README.md Co-authored-by: Jon Gallant <2163001+jongio@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: spboyer <7681382+spboyer@users.noreply.github.com> Co-authored-by: Shayne Boyer <spboyer@live.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: hemarina <104857065+hemarina@users.noreply.github.com> Co-authored-by: hemarina <hemarina@microsoft.com> Co-authored-by: Jon Gallant <2163001+jongio@users.noreply.github.com>
1 parent 4b7d6fa commit 36160ee

18 files changed

Lines changed: 1217 additions & 1 deletion
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Documentation Maintenance
2+
3+
This repository uses a structured documentation system under `docs/` at the repo root.
4+
When making changes to the codebase, keep the documentation current.
5+
6+
## Documentation Structure
7+
8+
```text
9+
docs/
10+
├── README.md — Documentation index and navigation
11+
├── concepts/ — Core mental models, terminology, feature lifecycle
12+
├── guides/ — Task-oriented how-tos for contributors
13+
├── reference/ — Schemas, flags, environment variables, feature status
14+
└── architecture/ — System overviews, design context, ADRs
15+
```
16+
17+
## When to Update Documentation
18+
19+
- **New command or flag:** Update `docs/guides/adding-a-new-command.md` if the pattern changes; update `docs/reference/feature-status.md` with the new feature's stage.
20+
- **New environment variable:** Add it to `docs/reference/environment-variables.md`.
21+
- **New extension capability:** Update `docs/architecture/extension-framework.md` and `docs/guides/creating-an-extension.md`.
22+
- **Feature stage change:** Update `docs/reference/feature-status.md` when a feature graduates (alpha → beta → stable).
23+
- **New concept or term:** Add it to `docs/concepts/glossary.md`.
24+
- **Architecture decision:** Create a new ADR using the template at `docs/architecture/adr-template.md`.
25+
- **New hosting target or language:** Update `docs/reference/feature-status.md` and `docs/concepts/glossary.md`.
26+
27+
## Documentation Placement Guide
28+
29+
| Content type | Location |
30+
|---|---|
31+
| Term or concept definition | `docs/concepts/glossary.md` |
32+
| Contributor how-to | `docs/guides/` |
33+
| Configuration reference | `docs/reference/` |
34+
| System design or ADR | `docs/architecture/` |
35+
| Implementation design details | `cli/azd/docs/design/` |
36+
| Extension development details | `cli/azd/docs/extensions/` |
37+
| Code style standards | `cli/azd/docs/style-guidelines/` |
38+
39+
## Documentation Standards
40+
41+
- Use clear, concise language
42+
- Link to detailed implementation docs in `cli/azd/docs/` rather than duplicating content
43+
- Keep tables and lists scannable
44+
- Include code examples where they aid understanding

.vscode/cspell.misc.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,29 @@ overrides:
7272
- azureai
7373
- entra
7474
- flexconsumption
75+
- filename: docs/architecture/**/*.md
76+
words:
77+
- azapi
78+
- Errorf
79+
- grpcbroker
80+
- vsrpc
81+
- filename: docs/guides/**/*.md
82+
words:
83+
- errorlint
84+
- Errorf
85+
- gofmt
86+
- golangci
87+
- gosec
88+
- jaegertracing
89+
- mycommand
90+
- mypackage
91+
- pflag
92+
- staticcheck
93+
- stdlib
94+
- vsrpc
95+
- filename: docs/reference/**/*.md
96+
words:
97+
- appservice
98+
- Buildpacks
99+
- containerapp
100+
- staticwebapp

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
## 🤖 AI Agents
2929

30-
**Contributing to this repo?** See [AGENTS.md](cli/azd/AGENTS.md) for coding standards and guidelines.
30+
**Contributing to this repo?** See [AGENTS.md](AGENTS.md) for coding standards and [docs/](docs/README.md) for contributor documentation.
3131

3232
**Using `azd` with an AI coding assistant?** Check out the [docs](https://aka.ms/azd) and [templates](https://azure.github.io/awesome-azd/).
3333

docs/README.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Azure Developer CLI Documentation
2+
3+
> Internal documentation for contributors and AI coding agents working on the Azure Developer CLI (`azd`).
4+
5+
For end-user documentation, see [aka.ms/azd](https://aka.ms/azd). For template examples, see [awesome-azd](https://azure.github.io/awesome-azd/).
6+
7+
---
8+
9+
## Concepts
10+
11+
Core mental models, terminology, and feature lifecycle.
12+
13+
- [Glossary](concepts/glossary.md) — Key terms and concepts used throughout the codebase
14+
- [Feature Stages](concepts/feature-stages.md) — How features graduate from alpha → beta → stable
15+
- [Alpha Features](concepts/alpha-features.md) — How experimental features are gated and discovered
16+
17+
## Guides
18+
19+
Task-oriented how-tos for common contributor workflows.
20+
21+
- [Contributing](../CONTRIBUTING.md) — How to build, test, lint, and submit changes
22+
- [Adding a New Command](guides/adding-a-new-command.md) — End-to-end walkthrough for new CLI commands
23+
- [Creating an Extension](guides/creating-an-extension.md) — How to build and publish an azd extension
24+
- [Observability and Tracing](guides/observability.md) — Adding telemetry, traces, and debugging
25+
26+
## Reference
27+
28+
Schemas, flags, environment variables, and configuration details.
29+
30+
- [Environment Variables](reference/environment-variables.md) — All environment variables that configure azd behavior
31+
- [azure.yaml Schema](reference/azure-yaml-schema.md) — Project configuration file reference
32+
- [Feature Status](reference/feature-status.md) — Current maturity status of all features
33+
34+
## Architecture
35+
36+
System overviews, design context, and decision records.
37+
38+
- [System Overview](architecture/system-overview.md) — High-level architecture and code organization
39+
- [Command Execution Model](architecture/command-execution-model.md) — How commands are registered, resolved, and run
40+
- [Extension Framework](architecture/extension-framework.md) — gRPC-based extension system architecture
41+
- [Provisioning Pipeline](architecture/provisioning-pipeline.md) — How infrastructure provisioning works
42+
- [ADR Template](architecture/adr-template.md) — Template for lightweight architecture decision records
43+
44+
---
45+
46+
## Where do new docs go?
47+
48+
| You want to document… | Put it in… |
49+
|---|---|
50+
| A new term or concept | `docs/concepts/glossary.md` |
51+
| A how-to for contributors | `docs/guides/` |
52+
| A configuration reference | `docs/reference/` |
53+
| A system design or ADR | `docs/architecture/` |
54+
| Detailed implementation design | `cli/azd/docs/design/` |
55+
| Extension development details | `cli/azd/docs/extensions/` |
56+
| Style and coding standards | `cli/azd/docs/style-guidelines/` |
57+
58+
## Related documentation
59+
60+
- [AGENTS.md](../AGENTS.md) — AI agent coding instructions
61+
- [cli/azd/docs/](../cli/azd/docs/) — Detailed implementation-level documentation
62+
- [cli/azd/docs/style-guidelines/](../cli/azd/docs/style-guidelines/) — Code style guide
63+
- [cli/azd/docs/extensions/](../cli/azd/docs/extensions/) — Extension framework details

docs/architecture/adr-template.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# ADR Template
2+
3+
Use this template to record lightweight architecture decisions. ADRs document the context, decision, and consequences of significant technical choices.
4+
5+
## How to Use
6+
7+
1. Copy this template to a new file: `docs/architecture/adr-NNN-title.md`
8+
2. Fill in each section
9+
3. Submit as part of the PR that implements the decision
10+
11+
ADRs are immutable once accepted. If a decision is superseded, create a new ADR that references the original.
12+
13+
---
14+
15+
## ADR-NNN: [Title]
16+
17+
**Status:** Proposed | Accepted | Superseded by [ADR-NNN]
18+
19+
**Date:** YYYY-MM-DD
20+
21+
### Context
22+
23+
What is the issue that we're seeing that is motivating this decision or change?
24+
25+
### Decision
26+
27+
What is the change that we're proposing and/or doing?
28+
29+
### Consequences
30+
31+
What becomes easier or more difficult to do because of this change?
32+
33+
### Alternatives Considered
34+
35+
What other approaches were evaluated, and why were they not chosen?
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# Command Execution Model
2+
3+
How CLI commands are registered, resolved, and executed in azd.
4+
5+
## Pipeline Overview
6+
7+
```text
8+
ActionDescriptor → CobraBuilder → Cobra Command → Middleware → Action.Run()
9+
```
10+
11+
### 1. ActionDescriptor Registration
12+
13+
Commands are declared in `cmd/root.go` as a tree of ActionDescriptors:
14+
15+
```go
16+
root := actions.NewActionDescriptor("azd", nil)
17+
18+
root.Add("up", &actions.ActionDescriptorOptions{
19+
Command: newUpCmd(),
20+
ActionResolver: newUpAction,
21+
FlagsResolver: newUpFlags,
22+
OutputFormats: []output.Format{output.JsonFormat, output.NoneFormat},
23+
})
24+
```
25+
26+
Each descriptor specifies:
27+
28+
- **Command** — Cobra command metadata (name, description, examples)
29+
- **ActionResolver** — Factory function to create the action via IoC
30+
- **FlagsResolver** — Factory function to create the flags struct
31+
- **OutputFormats** — Supported output formats (JSON, table, none)
32+
33+
### 2. CobraBuilder
34+
35+
At startup, the CobraBuilder walks the ActionDescriptor tree and generates standard Cobra commands. This decouples command definition from Cobra's API.
36+
37+
### 3. Middleware Pipeline
38+
39+
Before an action runs, the middleware chain processes cross-cutting concerns:
40+
41+
| Middleware | Purpose |
42+
|---|---|
43+
| Telemetry | Creates root span, records command events and attributes |
44+
| Hooks | Executes pre/post lifecycle hooks from `azure.yaml` |
45+
| Extensions | Routes events to registered extensions |
46+
| Debug | Handles `--debug` flag behavior |
47+
48+
Middleware is registered in `cmd/middleware/` and composed as a chain around the action.
49+
50+
### 4. Action Execution
51+
52+
Actions implement the `actions.Action` interface:
53+
54+
```go
55+
type Action interface {
56+
Run(ctx context.Context) (*ActionResult, error)
57+
}
58+
```
59+
60+
The `ActionResult` contains a `Message *ResultMessage` field displayed to the user. There is no separate structured-data field — output formatting is handled by the middleware and formatter pipeline, not through `ActionResult`. Actions receive dependencies via constructor injection through the IoC container.
61+
62+
### 5. Output Formatting
63+
64+
`OutputFormats` declares which output modes a command supports and wires up flags such as `--output` and `--query`. Structured output is not derived from `ActionResult` — actions that need JSON or table output inject an `output.Formatter` dependency and emit it themselves within `Run()`. `ActionResult` carries only the user-facing UX message.
65+
66+
Supported formats:
67+
68+
- **JSON** — The action writes structured JSON through the formatter
69+
- **Table** — The action writes tabular output through the formatter
70+
- **None** — Only the `ActionResult` message is displayed
71+
72+
## Error Handling
73+
74+
- Actions return errors wrapped with `fmt.Errorf("context: %w", err)`
75+
- `internal.ErrorWithSuggestion` adds user-facing fix suggestions
76+
- The middleware pipeline catches and formats errors for display
77+
- Context cancellations are handled gracefully
78+
79+
## Adding a New Command
80+
81+
See [Adding a New Command](../guides/adding-a-new-command.md) for a step-by-step guide.
82+
83+
## Detailed Reference
84+
85+
- [cli/azd/docs/style-guidelines/new-azd-command.md](../../cli/azd/docs/style-guidelines/new-azd-command.md) — Full implementation reference
86+
- [Guiding Principles](../../cli/azd/docs/style-guidelines/guiding-principles.md) — Command design philosophy
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# Extension Framework
2+
3+
Architecture of the gRPC-based extension system in azd.
4+
5+
## Overview
6+
7+
Extensions are external processes that communicate with azd via gRPC. They allow third parties and first-party teams to add new capabilities — languages, hosting targets, event handlers, and more — without modifying the core CLI.
8+
9+
## Architecture
10+
11+
```text
12+
azd (host)
13+
├── Extension Registry (discovery)
14+
├── Extension Manager (lifecycle)
15+
└── gRPC Broker (communication)
16+
↕ gRPC
17+
Extension Process
18+
├── Capability Handlers
19+
└── Service Implementations
20+
```
21+
22+
### Discovery
23+
24+
Extensions are discovered from registries — JSON manifests that list available extensions with their versions, capabilities, and download URLs.
25+
26+
- **Official registry:** `https://aka.ms/azd/extensions/registry`
27+
- **Dev registry:** `https://aka.ms/azd/extensions/registry/dev` (unsigned builds)
28+
- **Local sources:** File-based manifests for development
29+
30+
### Lifecycle
31+
32+
1. User installs an extension: `azd extension install <name>`
33+
2. Extension binary is downloaded and cached locally
34+
3. When needed, azd spawns the extension process
35+
4. gRPC connection is established via the broker
36+
5. azd invokes capability methods on the extension
37+
6. Extension responds via gRPC
38+
39+
### Communication
40+
41+
The gRPC broker (`pkg/grpcbroker`) manages bidirectional communication. Extensions can both:
42+
43+
- **Receive calls** from azd (e.g., "build this service")
44+
- **Make calls** back to azd (e.g., "prompt the user", "read environment config")
45+
46+
## Capabilities
47+
48+
Extensions declare their capabilities in `extension.yaml`:
49+
50+
| Capability | Description |
51+
|---|---|
52+
| `custom-commands` | Expose new command groups and commands to azd |
53+
| `lifecycle-events` | Subscribe to azd project and service lifecycle events (pre/post provision, deploy, etc.) |
54+
| `mcp-server` | Provide Model Context Protocol tools for AI agents |
55+
| `framework-service-provider` | Add build/restore support for new languages |
56+
| `service-target-provider` | Add deployment support for new hosting targets |
57+
| `metadata` | Provide metadata about commands and capabilities |
58+
59+
## Available gRPC Services
60+
61+
Extensions can access these azd services via gRPC:
62+
63+
- **Project** — Read project configuration
64+
- **Environment** — Read/write environment values and secrets
65+
- **User Config** — Read user-level azd configuration
66+
- **Deployment** — Access deployment information
67+
- **Account** — Access Azure account details
68+
- **Prompt** — Display prompts and collect user input
69+
- **AI Model** — Query AI model availability and quotas
70+
- **Event** — Subscribe to and emit events
71+
- **Container** — Container registry operations
72+
- **Framework** — Framework service operations
73+
- **Service Target** — Deployment target operations
74+
75+
## Error Handling
76+
77+
Extensions use two structured error types:
78+
79+
- **`ServiceError`** — For Azure API or remote service errors
80+
- **`LocalError`** — For client-side validation or configuration errors
81+
82+
Error precedence: ServiceError → LocalError → azcore.ResponseError → gRPC auth → fallback
83+
84+
## First-Party Extensions
85+
86+
First-party extensions live in `cli/azd/extensions/` and are registered in `cli/azd/extensions/registry.json`.
87+
88+
## Detailed Reference
89+
90+
- [Extension Framework Guide](../../cli/azd/docs/extensions/extension-framework.md) — Getting started
91+
- [Extension Framework Services](../../cli/azd/docs/extensions/extension-framework-services.md) — Adding language support
92+
- [Extensions Style Guide](../../cli/azd/docs/extensions/extensions-style-guide.md) — Design guidelines
93+
- [Creating an Extension](../guides/creating-an-extension.md) — Step-by-step guide

0 commit comments

Comments
 (0)