|
| 1 | +# Azure SDK Tools CLI Command Guidelines |
| 2 | + |
| 3 | +This document provides comprehensive guidelines for creating CLI commands in the `Azure.Sdk.Tools.Cli` project. All CLI commands must follow these established patterns and conventions to ensure consistency, maintainability, and proper integration with both CLI and MCP (Model Context Protocol) server functionality. |
| 4 | +Azure SDK developers and service team can use these CLI commands to generate, build, test and release Azure SDK. |
| 5 | + |
| 6 | +## Namespace Organization |
| 7 | + |
| 8 | +### Directory Structure |
| 9 | + |
| 10 | +``` |
| 11 | +Tools/ |
| 12 | +├── Package/ # Package-level operations |
| 13 | +├── ReleasePlan/ # Release planning operations |
| 14 | +├── TypeSpec/ # TypeSpec operations |
| 15 | +``` |
| 16 | + |
| 17 | +## Command Hierarchy |
| 18 | + |
| 19 | +All CLI commands must follow a predefined top-level command hierarchy. Commands are organized into the following categories: |
| 20 | + |
| 21 | +### 1. **package** - Package Operations |
| 22 | + |
| 23 | +**Namespace:** `Azure.Sdk.Tools.Cli.Tools.Package` |
| 24 | +**Command Group:** `SharedCommandGroups.Package` |
| 25 | +**Verb:** `package` or `pkg` |
| 26 | + |
| 27 | +For operations at the SDK package level. The package group has further sub-grouping for better organization: |
| 28 | + |
| 29 | +#### Core Package Operations: |
| 30 | + |
| 31 | +- Build/compile SDK code |
| 32 | +- Generate SDKs |
| 33 | +- Release packages |
| 34 | +- Update version information |
| 35 | +- Validate packages |
| 36 | + |
| 37 | +#### Sub-Groups: |
| 38 | + |
| 39 | +##### **readme** - README Operations |
| 40 | + |
| 41 | +For generating and updating README files: |
| 42 | + |
| 43 | +- Generate README |
| 44 | +- Update README |
| 45 | + |
| 46 | +##### **sample** - Sample Operations |
| 47 | + |
| 48 | +For generating and updating SDK samples: |
| 49 | + |
| 50 | +- Create samples |
| 51 | +- Update samples |
| 52 | + |
| 53 | +##### **test** - Test Operations |
| 54 | + |
| 55 | +For creating, updating, and running tests for SDK packages: |
| 56 | + |
| 57 | +- Create tests |
| 58 | +- Update tests |
| 59 | +- Run tests for specific packages |
| 60 | + |
| 61 | +**Examples:** |
| 62 | + |
| 63 | +- `package build --package-path ./sdk/storage` |
| 64 | +- `package generate --typespec-project ./specification/storage` |
| 65 | +- `package readme generate --package-path ./sdk/compute` |
| 66 | +- `package readme update --package-path ./sdk/keyvault --section getting-started` |
| 67 | +- `package release --package-name azure-core` |
| 68 | +- `package sample generate --package-path ./sdk/compute` |
| 69 | +- `package sample update --package-path ./sdk/storage --sample-name basic-usage` |
| 70 | +- `package test generate --package-path ./sdk/storage --test-type <type>` |
| 71 | +- `package test run --package-path ./sdk/keyvault --test-suite integration` |
| 72 | +- `package validate --package-path ./sdk/keyvault` |
| 73 | + |
| 74 | +### 2. **release-plan** - Release Plan |
| 75 | + |
| 76 | +**Namespace:** `Azure.Sdk.Tools.Cli.Tools.ReleasePlan` |
| 77 | +**Command Group:** Custom (no predefined group) |
| 78 | +**Verb:** `release-plan` |
| 79 | + |
| 80 | +For release planning and SDK coordination: |
| 81 | + |
| 82 | +- Create release plans |
| 83 | +- Link SDK pull requests to release plan |
| 84 | +- Get release plan details |
| 85 | + |
| 86 | +**Examples:** |
| 87 | + |
| 88 | +- `release-plan get --workitem-id 456` |
| 89 | +- `release-plan link-sdk-pr --release-plan-id 123 --pr 789` |
| 90 | + |
| 91 | +### 3. **typespec** - TypeSpec Operations and TypeSpec Client Operations |
| 92 | + |
| 93 | +**Namespace:** `Azure.Sdk.Tools.Cli.Tools.TypeSpec` |
| 94 | +**Command Group:** `SharedCommandGroups.TypeSpec` |
| 95 | +**Verb:** `tsp` |
| 96 | + |
| 97 | +For TypeSpec-related operations: |
| 98 | + |
| 99 | +- Create TypeSpec projects |
| 100 | +- Convert Swagger to TypeSpec |
| 101 | +- Validate TypeSpec projects |
| 102 | +- Common TypeSpec workflows |
| 103 | + |
| 104 | +**Examples:** |
| 105 | + |
| 106 | +- `tsp convert --swagger-file ./swagger.json` |
| 107 | +- `tsp init --name MyService` |
| 108 | +- `tsp validate --project-path ./typespec` |
0 commit comments