|
| 1 | +--- |
| 2 | +mode: 'agent' |
| 3 | +description: 'Generate SDKs from TypeSpec' |
| 4 | +--- |
| 5 | +Your goal is to guide user through the process of generating SDKs from TypeSpec projects. Show all the high level steps to the user to ensure they understand the flow. Use the provided tools to perform actions and gather information as needed. |
| 6 | + |
| 7 | +## Pre-Flight Check |
| 8 | +- Verify ${workspaceFolder} is not on main branch |
| 9 | +- If on main branch, prompt user: "You are currently on the main branch. Please create a new branch using `git checkout -b <branch-name>` before proceeding." |
| 10 | +- Wait for user confirmation before continuing |
| 11 | + |
| 12 | +## Step 1: Identify TypeSpec Project |
| 13 | +**Goal**: Locate the TypeSpec project root path |
| 14 | +**Actions**: |
| 15 | +1. Check if `tspconfig.yaml` or `main.tsp` files are open in editor |
| 16 | +2. If found, use the parent directory as project root |
| 17 | +3. If not found, prompt user: "Please provide the path to your TypeSpec project root directory" |
| 18 | +4. Validate the provided path contains required TypeSpec files |
| 19 | +**Success Criteria**: Valid TypeSpec project path identified |
| 20 | + |
| 21 | +## Step 2: Validate TypeSpec Specification |
| 22 | +**Goal**: Ensure TypeSpec specification compiles without errors |
| 23 | +**Actions**: |
| 24 | +1. Run [validate typespec](validate-typespec.prompt.md) command |
| 25 | +2. If validation succeeds, proceed to Step 3 |
| 26 | +3. If validation fails: |
| 27 | + - Display all compilation errors to user |
| 28 | + - Prompt: "Please fix the TypeSpec compilation errors before proceeding" |
| 29 | + - Wait for user to fix errors and re-run validation |
| 30 | +**Success Criteria**: TypeSpec compilation passes without errors |
| 31 | + |
| 32 | +## Step 3: Verify Authentication and Repository Status |
| 33 | +**Goal**: Ensure user is authenticated and working in correct repository |
| 34 | +**Actions**: |
| 35 | +1. Run `GetGitHubUserDetails` to verify login status |
| 36 | +2. If not logged in, prompt: "Please login to GitHub using `gh auth login`" |
| 37 | +3. Once logged in, display user details to confirm identity |
| 38 | +4. Run `CheckIfSpecInPublicRepo` to verify repository |
| 39 | +5. If not in public repo, inform: "Please make spec changes in Azure/azure-rest-api-specs public repo to generate SDKs" |
| 40 | +**Success Criteria**: User authenticated and working in public Azure repo |
| 41 | + |
| 42 | +## Step 4: Review and Commit Changes |
| 43 | +**Goal**: Stage and commit TypeSpec modifications |
| 44 | +**Actions**: |
| 45 | +1. Run `GetModifiedTypeSpecProjects` to identify changes |
| 46 | +2. If no changes found, inform: "No TypeSpec projects were modified in current branch" |
| 47 | +3. Display all modified files (excluding `.github` and `.vscode` folders) |
| 48 | +4. Prompt user: "Please review the modified files. Do you want to commit these changes? (yes/no)" |
| 49 | +5. If yes: |
| 50 | + - Verify current branch is not "main" |
| 51 | + - Run `git add <modified-files>` |
| 52 | + - Prompt for commit message |
| 53 | + - Run `git commit -m "<user-provided-message>"` |
| 54 | + - Run `git push -u origin <current-branch-name>` |
| 55 | +**Success Criteria**: Changes committed and pushed to remote branch |
| 56 | + |
| 57 | +## Step 5: Choose SDK Generation Method |
| 58 | +**Goal**: Determine how to generate SDKs |
| 59 | +**Actions**: |
| 60 | +1. Present options: "How would you like to generate SDKs?" |
| 61 | + - Option A: "Generate SDK locally". This is currently supported only for Python. Do not recommend this for other languages. |
| 62 | + - Option B: "Use SDK generation pipeline" |
| 63 | +2. Based on selection: |
| 64 | + - If Option A: Run [create sdk locally](create-sdk-locally.prompt.md) and then proceed to Step 6 |
| 65 | + - If Option B: Continue to Step 6 |
| 66 | +**Success Criteria**: SDK generation method selected |
| 67 | + |
| 68 | +## Step 6: Create Specification Pull Request |
| 69 | +**Goal**: Create PR for TypeSpec changes if not already created |
| 70 | +**Actions**: |
| 71 | +1. Check if spec PR already exists using `GetPullRequestForCurrentBranch` |
| 72 | +2. If PR exists, display PR details and proceed to Step 7 |
| 73 | +3. If no PR exists: |
| 74 | + - Run [create spec pullrequest](create-spec-pullrequest.prompt.md) |
| 75 | + - Wait for PR creation confirmation |
| 76 | + - Display created PR details |
| 77 | +**Success Criteria**: Specification pull request exists |
| 78 | + |
| 79 | +## Step 7: Generate SDKs via Pipeline |
| 80 | +**Goal**: Create release plan and generate SDKs |
| 81 | +**Actions**: |
| 82 | +1. Run [create release plan](create-release-plan.prompt.md) |
| 83 | +2. If SDK PRs exist, link them to the release plan |
| 84 | +3. Run [sdk details in release plan](sdk-details-in-release-plan.prompt.md) to add languages and package names to the release plan |
| 85 | +4. If TypeSpec project is for management plane, Run [verify namespace approval](verify-namespace-approval.prompt.md) to check package namespace approval. |
| 86 | +This step should not check package readiness to verify namespace approval for management plane SDK. |
| 87 | +5. Run [run sdk gen pipeline](run-sdk-gen-pipeline.prompt.md) with the spec PR |
| 88 | +6. Monitor pipeline status and provide updates |
| 89 | +7. Display generated SDK PR links when available |
| 90 | +**Success Criteria**: SDK generation pipeline initiated and SDKs generated |
| 91 | + |
| 92 | +## Step 8: Show Generated SDK PRs |
| 93 | +**Goal**: Display all created SDK pull requests |
| 94 | +**Actions**: |
| 95 | +1. Run `GetSDKPullRequestDetails` to fetch generated SDK PR info. |
| 96 | + |
| 97 | +## Step 9: Create release plan |
| 98 | +**Goal**: Create a release plan for the generated SDKs |
| 99 | +**Actions**: |
| 100 | +1. Run [create release plan](create-release-plan.prompt.md) to create a release plan using the spec pull request. |
| 101 | +2. If the release plan already exists, display the existing plan details. |
| 102 | + |
| 103 | +## Step 10: Mark Spec PR as Ready for Review |
| 104 | +**Goal**: Update spec PR to ready for review status |
| 105 | +**Actions**: |
| 106 | +1. Prompt user to change spec PR to ready for review: "Please change the spec pull request to ready for review status" |
| 107 | +2. Get approval and merge the spec PR |
| 108 | + |
| 109 | +## Step 11: Release SDK Package |
| 110 | +**Goal**: Release the SDK package using the release plan |
| 111 | +**Actions**: |
| 112 | +1. Run `ReleaseSdkPackage` to release the SDK package. |
| 113 | +2. Inform user to approve the package release using release pipeline. |
| 114 | + |
| 115 | +## Process Complete |
| 116 | +Display summary of all created PRs and next steps for user. |
0 commit comments