|
8 | 8 | - **Audience:** API developers working with Azure API Management |
9 | 9 | - **Team:** ApiOpsLead (Tech Lead), ApimExpert, ApicExpert, TypeScriptDev, NodeJsDev, TestEngineer, OpenSourceExpert, CodeReviewer, AzdoExpert, GitHubExpert |
10 | 10 |
|
| 11 | +## Core Context |
| 12 | + |
| 13 | +Documentation authoring (2026-04-30 to 2026-05-17): 3-phase plan with 28 user-facing docs. Gap analysis of existing toolkit identified 8 critical topics. Phase 1: 10 docs. Phase 2-3: 18 docs. Key patterns: examples-first, Mermaid workflows, relative links, search-optimized errors. Spec-to-docs: quickstart→getting-started, APIM-RestAPI-Coverage→resource-types, data-model→artifact-format/dependency-graph. |
| 14 | + |
11 | 15 | ## Learnings |
12 | 16 |
|
13 | 17 | <!-- Append new learnings below this line --> |
| 18 | + |
| 19 | +### 2026-05-17: Phase 2 Docs — Azure DevOps, Filtering, Artifact Format, Config Reference, Glossary |
| 20 | + |
| 21 | +**Context:** Authored five Phase 2 documentation files completing CI/CD coverage, resource filtering guide, artifact format reference, configuration reference, and APIM glossary. |
| 22 | + |
| 23 | +**Files Created:** |
| 24 | +1. `docs/ci-cd/azure-devops.md` — Full Azure DevOps integration guide sourced from actual pipeline templates in `src/templates/azure-devops/`. Covers extract pipeline (manual trigger, AzureCLI@2, branch creation), publish pipeline (multi-stage with per-env variable groups and service connections), environment approval gates, and customization tips. |
| 25 | +2. `docs/guides/filtering-resources.md` — All 16 filterable resource types from `FilterConfig`. Transitive dependency behavior with Mermaid diagram, `--no-transitive` flag, and common patterns. |
| 26 | +3. `docs/reference/artifact-format.md` — Full directory layout from all 34 `ResourceType` entries. Three metadata tables, JSON info file structure, policy XML scopes, and naming conventions. |
| 27 | +4. `docs/reference/configuration.md` — Priority chain with Mermaid diagram, all CLI flag tables, environment variables, YAML config references, and defaults. |
| 28 | +5. `docs/reference/apim-glossary.md` — 16 APIM concepts with definitions, Microsoft Docs links, and artifact file locations. |
| 29 | + |
| 30 | +**Learnings:** |
| 31 | +- Azure DevOps templates are TypeScript string generators, not static YAML. Uses both `${{ parameters.X }}` template expressions and `$(VARIABLE)` macro syntax. |
| 32 | +- Publish pipeline generates sequential stages via `dependsOn` chaining. Each env gets its own variable group (`apim-{env}`) and service connection (`AZURE_SERVICE_CONNECTION_{ENV}`). |
| 33 | +- `RESOURCE_TYPE_METADATA` has 34 entries. Some have `infoFile: null` (ApiOperation, ProductTag). McpServer is a singleton per API for Model Context Protocol. |
| 34 | +- `listOmitsFields` on ApiSchema/ApiRelease is internal detail — not user-facing but noted for accuracy. |
| 35 | + |
| 36 | +### 2026-05-17: Phase 2 Guide Docs— Incremental Publish, Dry-Run, Code-First, Multi-Team, Migration |
| 37 | + |
| 38 | +**Context:** Authored five guide documentation files for Phase 2. |
| 39 | + |
| 40 | +**Files Created:** |
| 41 | +1. `docs/guides/incremental-publish.md` — How `--commit-id` triggers git-diff-based publishing, Mermaid flow diagram, git status mapping table, CI/CD examples (GitHub Actions + Azure DevOps), fetch-depth gotcha, mutual exclusivity with `--delete-unmatched`. |
| 42 | +2. `docs/guides/dry-run-workflow.md` — `--dry-run` mode behavior, text and JSON output formats, PR review workflow with GitHub Actions comment posting, combination matrix with other flags, best practices. |
| 43 | +3. `docs/guides/code-first-workflow.md` — Day-in-the-life guide for IDE-first API development, artifact directory structure with hand-authored examples (apiInformation.json, OpenAPI spec, policy.xml, backend), override usage, CI/CD pipeline templates. |
| 44 | +4. `docs/guides/multi-team-workflows.md` — Three patterns (selective extraction, monorepo, polyrepo) with CODEOWNERS integration, scoped pipelines, shared resource ownership table, anti-patterns, and pattern comparison matrix. |
| 45 | +5. `docs/guides/migration-from-v1.md` — v1→v2 comparison table, 6-step migration process, pipeline migration examples (GitHub Actions + Azure DevOps), configuration file mapping, new features to adopt, troubleshooting table. |
| 46 | + |
| 47 | +**Learnings:** |
| 48 | +- The `git-diff-service.ts` uses the Git empty-tree SHA (`4b825dc642cb6eb9a060e54bf8d69288fbee4904`) for first-commit diffs — documented as "treats all files as added" without exposing implementation detail. |
| 49 | +- Dry-run reporter processes in topological order via `getTopologicalOrder()` — important for users to know that the preview mirrors real publish order. |
| 50 | +- `hasMutuallyExclusivePublishOptions()` enforces the `--commit-id` / `--delete-unmatched` exclusion at CLI level with exit code 2 — documented prominently in both incremental-publish and multi-team guides. |
| 51 | +- The v1 toolkit's filter YAML format (`apiNames`, `backendNames`) is structurally compatible with v2 — simplifies migration messaging (just rename the file). |
| 52 | + |
| 53 | +### 2026-05-17: Phase 2-3 Architecture & Troubleshooting Docs |
| 54 | + |
| 55 | +**Context:** Authored five documentation files for Phases 2-3 covering architecture and troubleshooting. |
| 56 | + |
| 57 | +**Files Created:** |
| 58 | +1. `docs/architecture/overview.md` — High-level system design with 3 Mermaid diagrams (component diagram, extract flow, publish flow), layer descriptions, CLI entry point details, authentication chain, and key behaviors for extract/publish. |
| 59 | +2. `docs/architecture/design-principles.md` — All 8 constitution principles (§I-§VIII) with "What This Means" and "For Contributors" sections per principle, plus precedence rules. |
| 60 | +3. `docs/troubleshooting/common-errors.md` — 14 searchable error entries organized by category (auth, config, publish, runtime) with Cause → Solution format and code examples. |
| 61 | +4. `docs/troubleshooting/debugging-guide.md` — Diagnostic tools (`--log-level debug`, `--dry-run`, `--format json`, artifact inspection), 6-step diagnostic checklist, log level reference, sanitization details, and 4 common debugging scenarios. |
| 62 | +5. `docs/troubleshooting/pipeline-recovery.md` — 5 CI/CD failure scenarios (partial publish, failed incremental, failed delete-unmatched, auth expiry, timeout) with recovery steps, prevention checklist, and 2 Mermaid decision/flow diagrams. |
| 63 | + |
| 64 | +**Learnings:** |
| 65 | +- Architecture docs serve dual audiences (contributors + advanced users). Used progressive disclosure: high-level diagram first, then layer table, then per-flow details with Mermaid. |
| 66 | +- Design principles doc is contributor-focused — "For Contributors" sections translate abstract principles into actionable rules. Precedence section prevents principle conflicts. |
| 67 | +- Troubleshooting docs are search-optimized — error messages as exact headings so GitHub search matches real error text users paste. |
| 68 | +- Pipeline recovery is CI/CD-platform-aware — includes GitHub Actions and Azure DevOps specific instructions. |
| 69 | +- Log output separation (stdout=data, stderr=logs) is critical for CI/CD users — documented explicitly with redirect examples. |
| 70 | + |
| 71 | +### 2026-05-17: Phase 3 Reference & CI/CD Docs — Dependency Graph, Resource Types, Exit Codes, Auth Patterns |
| 72 | + |
| 73 | +**Context:** Authored four Phase 3 documentation files covering technical reference material and CI/CD authentication. |
| 74 | + |
| 75 | +**Files Created:** |
| 76 | +1. `docs/reference/dependency-graph.md` — Full 4-tier dependency graph with all 31 edges, comprehensive Mermaid diagram using color-coded tiers (blue/green/yellow/red), solid vs. dashed arrows for required vs. optional deps, edge table, and practical implications for publish ordering and failure cascading. |
| 77 | +2. `docs/reference/resource-types.md` — All 34 supported resource types organized by category (Service-Level, Product, API, Gateway). Each entry includes ARM path, artifact directory pattern, info file name, and user-facing description. Includes notes on LIST API limitations (listOmitsFields) and example directory tree. |
| 78 | +3. `docs/reference/exit-codes.md` — Exit codes 0/1/2 with aggregation logic, bash/PowerShell usage examples, GitHub Actions and Azure DevOps CI/CD integration patterns for handling partial failures, and troubleshooting table. |
| 79 | +4. `docs/ci-cd/authentication-patterns.md` — Five auth patterns (OIDC, Azure DevOps service connection, service principal, managed identity, sovereign clouds) with comparison table, Mermaid sequence diagram, Azure setup commands, pipeline YAML examples, RBAC requirements, and troubleshooting table for common Entra ID errors. |
| 80 | + |
| 81 | +**Learnings:** |
| 82 | +- The dependency graph has 31 edges (not 30) — ApiDiagnostic→Logger is an optional edge easily missed. Always cross-reference the source DEPENDENCY_EDGES array against the tier assignments. |
| 83 | +- Resource types documentation benefits greatly from the example directory tree — abstract path patterns like `apis/{0}/operations/{1}` become concrete when users see a real tree. Progressive disclosure: tables first, example tree at the end. |
| 84 | +- Authentication troubleshooting table is high-value — users hitting AADSTS errors in CI/CD pipelines need the error code → fix mapping immediately. Structured as error/cause/fix columns for scannability. |
| 85 | +- Sovereign cloud documentation is thin but critical — users in government/China clouds need the `--cloud` flag reference or they get silent auth failures against the wrong ARM endpoint. |
| 86 | + |
| 87 | +### 2026-05-16: Phase 1 Guide Docs — Scenarios, Authentication, Overrides, GitHub Actions |
| 88 | + |
| 89 | +**Context:** Authored four guide/integration documentation files for Phase 1. |
| 90 | + |
| 91 | +**Files Created:** |
| 92 | +1. `docs/guides/scenarios-and-workflows.md` — Portal-first vs. code-first workflow comparison with Mermaid diagrams, comparison table, hybrid scenarios, and common artifact format explanation. |
| 93 | +2. `docs/guides/authentication.md` — Full DefaultAzureCredential chain, CLI auth flags reference, per-context sections (local dev, service principal, GitHub OIDC, Azure DevOps, managed identity, sovereign clouds), RBAC roles, and troubleshooting table. |
| 94 | +3. `docs/guides/environment-overrides.md` — All 5 override resource types (namedValues, backends, apis, diagnostics, loggers) with per-property tables, Key Vault integration, multi-environment directory layout, override rules (names vs. properties), and common gotchas. |
| 95 | +4. `docs/ci-cd/github-actions.md` — Extract and publish workflow walkthroughs sourced from actual template code, OIDC federated credential setup, environment/secrets configuration, customization tips, and troubleshooting. |
| 96 | + |
| 97 | +**Learnings:** |
| 98 | +- The publish workflow template generates per-environment jobs dynamically from the `environments` array in `PublishWorkflowConfig`. Documented the pattern concretely (dev/prod) rather than showing template internals. |
| 99 | +- CLI auth flags (`--client-id`, `--client-secret`, `--tenant-id`) set env vars via the `preAction` hook — important for users to understand credential precedence. |
| 100 | +- Override rules "names must be consistent, properties can differ" is a critical gotcha from the gap analysis that needs prominent placement — put it in its own section with ✅/❌ examples. |
| 101 | + |
| 102 | +### 2026-05-17: Phase 2–3 Docs — 18 Files |
| 103 | + |
| 104 | +**Batch4:** Azure DevOps, filtering, artifact format, config, glossary |
| 105 | +**Batch5:** Incremental, dry-run, code-first, multi-team, migration |
| 106 | +**Batch6:** Architecture, design, errors, debugging, recovery |
| 107 | +**Batch7:** Dependency graph, types, exit codes, auth |
| 108 | + |
| 109 | +**Key:** Dependency graph 31 edges (ApiDiag→Logger optional). Dry-run topological. Auth troubleshooting critical for CI/CD. |
| 110 | + |
| 111 | +### 2026-05-16: Phase 1 Docs — 10 Files |
| 112 | + |
| 113 | +**Files:** README, getting-started, extract, publish, init, scenarios, auth, overrides, github-actions, azure-devops |
| 114 | + |
| 115 | +**Patterns:** Examples-first, Mermaid workflows, relative links, search-optimized errors, progressive disclosure |
| 116 | + |
| 117 | +**Gotchas:** Auth flags set env vars (credential precedence). Overrides: names consistent, properties differ. `--commit-id`/`--delete-unmatched` exclusive. |
0 commit comments