Skip to content

Commit bf44084

Browse files
jeo02azure-sdk
authored andcommitted
place prompts in common place
1 parent 88c8db4 commit bf44084

10 files changed

+380
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
mode: 'agent'
3+
tools: ['CheckApiReadyForSDKGeneration', 'codebase', 'GetPullRequest', 'GetGitHubUserDetails', 'GetPullRequestForCurrentBranch']
4+
description: 'Check API Readiness for SDK Generation'
5+
---
6+
Your goal is to check if API spec pull request is ready for SDK generation. Identify the next action required from user based on the comments on spec pull request if spec is not ready and notify the user.
7+
Before running, get spec pull request link for current branch or from user if not available in current context. If pull request has APIView links, then highlight them to user.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
mode: 'agent'
3+
tools: ['CheckPackageReleaseReadiness']
4+
description: 'This prompt is designed to check the release readiness of a SDK package.'
5+
---
6+
## Goal
7+
Check the release readiness of an SDK package by collecting the required information from the user and executing the readiness check.
8+
9+
## Instructions
10+
1. **Collect Required Information**:
11+
- Prompt the user for the exact package name
12+
- Prompt the user to select the programming language from the following options (case sensitive):
13+
- Python
14+
- Java
15+
- JavaScript
16+
- .NET
17+
- Go
18+
19+
2. **Execute Readiness Check**:
20+
- Use the `CheckPackageReleaseReadiness` tool with the provided package name and selected language
21+
- Do not check for existing pull requests to run this step.
22+
- Do not ask the user to create a release plan to run this step.
23+
24+
3. **Present Results**:
25+
- If the package is ready for release, highlight and provide the link to the release pipeline
26+
- If the package is not ready, display the specific issues that need to be resolved
27+
28+
4. **Follow-up Actions**:
29+
- Provide clear next steps based on the readiness status
30+
- If issues are found, offer guidance on how to resolve them
31+
32+
## Expected User Interaction Flow
33+
1. Ask: "What is the exact name of the package you want to check for release readiness?"
34+
2. Ask: "Please select the programming language for this package: Python, Java, JavaScript, .NET, or Go"
35+
3. Execute the readiness check using the provided information
36+
4. Display results and next steps
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
mode: 'agent'
3+
tools: ['CreateReleasePlan', 'GetReleasePlanForPullRequest', 'GetReleasePlan', 'LinkSdkPullRequestToReleasePlan']
4+
---
5+
6+
# Release Plan Creation Process
7+
You goal is to create a valid release plan. You must prompt user to provide all required information and all input must match the format and requirement mentioned in step 3 below.
8+
Follow these steps in order to create or manage a release plan for an API specification pull request:
9+
10+
## Step 1: Validate Prerequisites
11+
- Check if an API spec pull request is available in the current context
12+
- If no pull request is available, prompt the user to provide the API spec pull request link
13+
- Validate that the provided pull request link is accessible and valid
14+
15+
## Step 2: Check Existing Release Plan
16+
- Use `GetReleasePlanForPullRequest` to check if a release plan already exists for the API spec pull request
17+
- If a release plan exists:
18+
- Display the existing release plan details to the user
19+
- Skip to Step 5 (Link SDK Pull Requests)
20+
- If no release plan exists, proceed to Step 3
21+
22+
## Step 3: Gather Release Plan Information
23+
Collect the following required information from the user. Do not create a release plan with temporary values. Confirm the values with the user before proceeding to create the release plan.
24+
If any details are missing, prompt the user accordingly:
25+
26+
- **API Lifecycle Stage**: Must be one of:
27+
- Private Preview
28+
- Public Preview
29+
- GA (Generally Available)
30+
- **Service Tree ID**: GUID format identifier for the service in Service Tree. Before creating release plan, always show the value to user and ask them to confirm it's a valid value in service tree.
31+
- **Product Service Tree ID**: GUID format identifier for the product in Service Tree. Before creating release plan, always show the value to user and ask them to confirm it's a valid value in service tree.
32+
- **Expected Release Timeline**: Format must be in "Month YYYY"
33+
- **API Version**: The version of the API being released
34+
- **SDK Release Type**: Value must be beta or stable.
35+
- "beta" for preview API versions
36+
- "stable" for GA API versions
37+
38+
## Step 4: Create Release Plan
39+
- If the user doesn't know the required details, direct them to create a release plan using the release planner
40+
- Provide this resource: [Release Plan Creation Guide](https://eng.ms/docs/products/azure-developer-experience/plan/release-plan-create)
41+
- Once all information is gathered, use `CreateReleasePlan` to create the release plan
42+
- Display the newly created release plan details to the user for confirmation
43+
- Refer [sdk details in release plan](sdk-details-in-release-plan.prompt.md) to identify languages configured in the TypeSpec project and add them to the release plan
44+
45+
## Step 5: Update SDK Details in Release Plan
46+
- Run [sdk details in release plan](sdk-details-in-release-plan.prompt.md) to add languages and package names to the release plan
47+
- If the TypeSpec project is for a management plane, run [verify namespace approval](verify-namespace-approval.prompt.md) if this is first release of SDK.
48+
49+
## Step 6: Link SDK Pull Requests (if applicable)
50+
- Ask the user if they have already created SDK pull requests locally for any programming language
51+
- If SDK pull requests exist:
52+
- Collect the pull request links from the user
53+
- Use `LinkSdkPullRequestToReleasePlan` to link each SDK pull request to the release plan
54+
- Confirm successful linking for each SDK pull request
55+
56+
## Step 7: Summary
57+
- Display a summary of the completed actions:
58+
- Release plan status (created or existing)
59+
- Linked SDK pull requests (if any)
60+
- Next steps or recommendations for the user
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
mode: 'agent'
3+
tools: ['codebase']
4+
---
5+
Your goal is to help guide the user to create SDK locally for TypeSpec changes. This is currently supported for **Python** only. User can generate SDK for other languages using SDK generation pipeline.
6+
## Steps to create Python SDK locally from TypeSpec
7+
### Step 1: Check for existing azure-sdk-for-python repository
8+
- Prompt the user to provide the path to their cloned azure-sdk-for-python repository.
9+
### Step 2: Validate repository path
10+
- If the user provides a path to the azure-sdk-for-python repository:
11+
- Check if the repository exists at the specified path.
12+
- If the repository exists, proceed to Step 5.
13+
### Step 3: Guide user to set up azure-sdk-for-python repository (if not found)
14+
- If the user does not have the repository or the path is invalid:
15+
- Go to parent directory of current repo root path.
16+
- Provide instructions to fork https://github.com/Azure/azure-sdk-for-python repository to the user's GitHub account.
17+
- Provide instructions to clone the forked repository to the local machine:
18+
```bash
19+
git clone https://github.com/<github-username>/azure-sdk-for-python.git
20+
```
21+
### Step 4: Set repository path
22+
- Consider the cloned path as the path to the azure-sdk-for-python repository.
23+
### Step 5: Open azure-sdk-for-python repository in VSCode
24+
- Do not ask the user to run tsp compile.
25+
- Prompt user to open the azure-sdk-for-python repository in VSCode.
26+
### Step 6: Provide SDK generation instructions
27+
- Inform user to use the following prompt to start SDK generation using GitHub Copilot agent:
28+
```
29+
"Help me generate SDK for Python from TypeSpec API specification for project <path to TypeSpec project root>."
30+
```
31+
### Step 7: Inform user about SDK generation
32+
- Inform user to provide link to SDK pull request if they generate DSK locally and created a pull request for it. SDK generation
33+
step below will skip it for the language and reuse the pull request link provided by the user.
34+
- In some cases, user will come back and make more changes to TypeSpec so start the process from step 1 again.
35+
- If user provides a link to SDK pull request then link SDK pull request to release plan if a release plan already exists and skip SDK generation for that language.
36+
- If a release plan does not exits then link the SDK pull request when release plan is created.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
mode: 'agent'
3+
tools: ['codebase', 'CreatePullRequest', 'GetModifiedTypeSpecProjects', 'GetGitHubUserDetails', 'CheckIfSpecInPublicRepo', 'GetPullRequest', 'GetPullRequestForCurrentBranch']
4+
---
5+
Your goal is to identify modified TypeSpec project in current branch and create a pull request for it.
6+
Check if a pull request already exists using GetPullRequestForCurrentBranch. If a pull request exists, inform the user and show the pull request details. If no pull request exists, create a new pull request using CreatePullRequest.
7+
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
mode: 'agent'
3+
tools: ['GenerateSDK', 'GetSDKPullRequestDetails', 'GetReleasePlan', 'GetReleasePlanForPullRequest', 'GetPipelineRun', 'GetPipelineRunStatus', 'LinkSdkPullRequestToReleasePlan']
4+
description: 'Generate SDKs from TypeSpec using pipeline'
5+
---
6+
Your goal is to generate SDKs from the TypeSpec spec pull request. Get API spec pull request link for current branch or from user if not available in current context.
7+
Provide links to SDK pull request when generated for each language.
8+
9+
## Steps for SDK Generation
10+
11+
### Step 1: Check for Existing SDK Pull Requests
12+
- Check if SDK pull requests exist from local SDK generation for any languages
13+
- If SDK pull request exists for a language, skip SDK generation for that language
14+
- Link existing SDK pull request to release plan
15+
16+
### Step 2: Retrieve and Validate Release Plan
17+
- Retrieve the release plan for the API spec
18+
- If API Lifecycle Stage is `Private Preview` then inform user that SDK generation is not supported for this stage and complete the workflow.
19+
- Check if SDK generation has already occurred for each language
20+
- Verify if SDK pull requests exist for each language:
21+
- If an SDK pull request exists, display its details
22+
- If no pull request exists or regeneration is needed, proceed to next step
23+
24+
### Step 3: Execute SDK Generation Pipeline
25+
- Run SDK generation for each required language: Python, .NET, JavaScript, Java, and Go
26+
- Execute the SDK generation pipeline with the following required parameters:
27+
- TypeSpec project root path
28+
- Pull request number (if the API spec is not merged to the main branch)
29+
- API version
30+
- SDK release type (beta for preview API versions, stable otherwise)
31+
- Language options: `Python`, `.NET`, `JavaScript`, `Java`, `Go`
32+
- Release plan work item ID
33+
34+
### Step 4: Monitor Pipeline Status
35+
- Check the status of SDK generation pipeline every 2 minutes
36+
- Continue monitoring until pipeline succeeds or fails
37+
- Get SDK pull request link from pipeline once available
38+
39+
### Step 5: Display Results
40+
- Show all pipeline details once pipeline is in completed status
41+
- Highlight the language name for each SDK generation task when displaying details
42+
- Once SDK pull request URL is available:
43+
- Inform the user of successful SDK generation
44+
- Display the pull request details for each language
45+
- Provide links to each generated SDK pull request
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
mode: 'agent'
3+
description: 'Identify languages configured in the TypeSpec project and add it to release plan'
4+
tools: ['GetReleasePlanForPullRequest', 'GetReleasePlan', 'UpdateReleasePlanSDKInfo']
5+
---
6+
# Step 1: Find the list of languages and package names
7+
**Goal**: Identify languages configured in the TypeSpec project and generate the json object with language and package name.
8+
1. Identify the language emitter configuration in the `tspconfig.yaml` file in the TypeSpec project root.
9+
2. Identify the package name or namespace for each language emitter.
10+
3. Map the language name in emitter to one of the following in Pascal case(except .NET):
11+
- .NET
12+
- Java
13+
- Python
14+
- JavaScript
15+
- Go
16+
4. Remove `github.com/Azure/azure-sdk-for-go/` from Go package name.
17+
4. Create a JSON array object with the following structure:
18+
```json
19+
[
20+
{
21+
"language": "<LanguageName>",
22+
"packageName": "<PackageName>"
23+
},
24+
...
25+
]
26+
```
27+
5. If no languages are configured, inform the user: "No languages configured in TypeSpec project. Please add at least one language emitter in tspconfig.yaml."
28+
**Success Criteria**: JSON object with languages and package names created.
29+
30+
# Step 2: Check if release plan exists
31+
**Goal**: Determine if a release plan exists for the API spec pull request or work item Id or release plan Id in current context.
32+
1. Get release plan
33+
2. If no release plan exists, inform the user: "No release plan exists for the API spec pull request. Please create a release plan first."
34+
3. If a release plan exists, proceed to Step 3.
35+
**Success Criteria**: Release plan exists or user informed to create one.
36+
37+
# Step 3: Update Release Plan with SDK Information
38+
**Goal**: Update the release plan with the languages and package names identified in Step 1.
39+
1. Use `UpdateReleasePlanSDKInfo` to update the release plan work item with the JSON object created in Step 1.
40+
2. Confirm successful update of the release plan with the SDK information and summary of languages and package names.
41+
**Success Criteria**: Release plan updated with languages and package names.
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
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.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
mode: 'agent'
3+
tools: ['RunTypeSpecValidation']
4+
description: 'Validate TypeSpec'
5+
---
6+
Your goal is identify the TypeSpec project root if not available in current context and validate TypeSpec project.
7+
Before running, inform user that TypeSpec validation takes around 20 - 30 seconds. Provide complete summary after
8+
running the tool and highlight any errors and help user fix them.

0 commit comments

Comments
 (0)