|
| 1 | +--- |
| 2 | +description: "Guide the user to generate and build SDKs locally for a TypeSpec based API spec" |
| 3 | +--- |
| 4 | + |
| 5 | +# Goal |
| 6 | + |
| 7 | +Help the user generate and build SDKs locally from TypeSpec API specifications using the `azure-sdk-mcp` tools. |
| 8 | + |
| 9 | +--- |
| 10 | + |
| 11 | +## Part A: Generate SDK Locally |
| 12 | + |
| 13 | +### Step 1: Outline workflow |
| 14 | + |
| 15 | +**Goal**: Ensure the user understands the overall SDK generation and build process before starting. |
| 16 | +**Actions**: |
| 17 | + |
| 18 | +- Present the high-level steps involved in generating and building SDK locally: |
| 19 | + 1. Select target language |
| 20 | + 2. Verify SDK repository |
| 21 | + 3. Validate repository path |
| 22 | + 4. Identify path to configuration file |
| 23 | + 5. Generate SDK using `azsdk_package_generate_code` MCP tool |
| 24 | + 6. Identify SDK project path |
| 25 | + 7. Build/Compile SDK using `azsdk_package_build_code` MCP tool |
| 26 | +- Ask the user to confirm readiness to proceed. |
| 27 | + |
| 28 | +--- |
| 29 | + |
| 30 | +### Step 2: Select language |
| 31 | + |
| 32 | +**Goal**: Confirm the target language for SDK generation. |
| 33 | +**Actions**: |
| 34 | + |
| 35 | +- Prompt user to choose one of the supported languages: |
| 36 | + - .NET |
| 37 | + - Java |
| 38 | + - JavaScript |
| 39 | + - Python |
| 40 | + - Go |
| 41 | +- Validate input against the allowed list. |
| 42 | + |
| 43 | +--- |
| 44 | + |
| 45 | +### Step 3: Verify SDK repository |
| 46 | + |
| 47 | +**Goal**: Ensure the correct Azure SDK language repository is available locally. |
| 48 | +**Actions**: |
| 49 | + |
| 50 | +- Prompt user to provide the path to their **locally cloned repository** for the selected language. |
| 51 | +- Note: The **local folder name can be arbitrary**, but the repository must have originated from one of the official Azure SDK repositories: |
| 52 | + - `azure-sdk-for-net` (.NET) |
| 53 | + - `azure-sdk-for-java` (Java) |
| 54 | + - `azure-sdk-for-js` (JavaScript) |
| 55 | + - `azure-sdk-for-python` (Python) |
| 56 | + - `azure-sdk-for-go` (Go) |
| 57 | +- If the repository is not cloned → instruct user to clone the appropriate remote repository from GitHub. |
| 58 | +- MCP tool will automatically validate the remote origin and repository structure. |
| 59 | + |
| 60 | +--- |
| 61 | + |
| 62 | +### Step 4: Validate repository path |
| 63 | + |
| 64 | +**Actions**: |
| 65 | + |
| 66 | +- Check if the provided repository path exists and matches the selected SDK language repository. |
| 67 | +- If invalid → prompt user to re-enter a valid path. |
| 68 | + |
| 69 | +--- |
| 70 | + |
| 71 | +### Step 5: Identify path to configuration file |
| 72 | + |
| 73 | +**Goal**: Determine the correct path to the TypeSpec configuration file based on the working context. |
| 74 | +**Actions**: |
| 75 | + |
| 76 | +- **Scenario A: Working in a repository cloned from `azure-rest-api-specs`** |
| 77 | + - Identify the path to `tspconfig.yaml` (local path or HTTPS URL). |
| 78 | + - The local folder name can be arbitrary; the MCP tool will validate that the remote origin URL points to the official `azure-rest-api-specs` repository. |
| 79 | + - Example paths (pointing directly to tspconfig.yaml): |
| 80 | + - `/home/usr/azure-rest-api-specs/specification/contosowidgetmanager/Contoso.Management/tspconfig.yaml` |
| 81 | + - `https://github.com/Azure/azure-rest-api-specs/blob/4af373fc5826cf5a2365a20dde01c4b2efde48f0/specification/contosowidgetmanager/Contoso.Management/tspconfig.yaml` |
| 82 | + |
| 83 | +- **Scenario B: Working in one of the official Azure SDK language repositories** |
| 84 | + (i.e., originally cloned from `azure-sdk-for-net`, `azure-sdk-for-java`, `azure-sdk-for-js`, `azure-sdk-for-python`, `azure-sdk-for-go`) |
| 85 | + - Identify the path to `tsp-location.yaml`. |
| 86 | + - The local folder name can be arbitrary; MCP tool will validate the remote origin URL. |
| 87 | + - Example path: |
| 88 | + `/home/usr/azure-sdk-for-net/sdk/contoso/Azure.ResourceManager.Contoso/tsp-location.yaml` |
| 89 | + |
| 90 | +--- |
| 91 | + |
| 92 | +### Step 6: Generate SDK |
| 93 | + |
| 94 | +**Actions**: |
| 95 | + |
| 96 | +- Run `azsdk_package_generate_code` MCP tool to generate the SDK locally. |
| 97 | + |
| 98 | +--- |
| 99 | + |
| 100 | +## Part B: Build / Compile SDK Locally |
| 101 | + |
| 102 | +### Step 1: Identify SDK project path |
| 103 | + |
| 104 | +**Goal**: Locate the generated SDK project directory for building/compiling. |
| 105 | +**Actions**: |
| 106 | + |
| 107 | +- Find the project directory inside the selected Azure SDK language repository. |
| 108 | +- Typical structure: |
| 109 | + `sdk/{service-name}/{package-name}/` |
| 110 | +- Example: |
| 111 | + `/path/to/azure-sdk-for-net/contoso/Azure.ResourceManager.Contoso/` |
| 112 | + |
| 113 | +--- |
| 114 | + |
| 115 | +### Step 2: Build/Compile the SDK |
| 116 | + |
| 117 | +**Actions**: |
| 118 | + |
| 119 | +- Run `azsdk_package_build_code` MCP tool to compile the SDK in the identified project directory. |
0 commit comments