You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/copilot-instructions.md
+78-17Lines changed: 78 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -279,38 +279,99 @@ By following these rules, the SDK release process will remain clear, structured,
279
279
280
280
## Steps to generate SDK from TypeSpec API specification
281
281
282
-
Follow [typespec to sdk](..\eng\common\instructions\azsdk-tools\typespec-to-sdk.instructions.md) to generate and release SDK from TypeSpec API specification. The process is divided into several steps, each with specific actions to ensure a smooth SDK generation and release process.
282
+
Follow below steps to generate and release SDK from TypeSpec API specification. The process is divided into several steps, each with specific actions to ensure a smooth SDK generation and release process.
283
283
Do not skip the step that choose SDK generation method to ensure the user selects the appropriate method for SDK generation, either locally or using the SDK generation pipeline. Do not repeat the steps. Before using tools, check if user has Powershell installed.
284
284
285
-
1.**Identify TypeSpec Project**: Locate the TypeSpec project root path by checking for `tspconfig.yaml` or `main.tsp` files.
286
-
2.**Validate TypeSpec Specification**: Ensure the TypeSpec specification compiles without errors.
287
-
3.**Verify Authentication and Repository Status**: Ensure user is authenticated and working in the correct public Azure repository.
288
-
4.**Review and Commit Changes**: Stage and commit TypeSpec modifications, ensuring the current branch is not "main". Do not create pull request yet.
289
-
5.**Create Specification Pull Request**: Create a pull request for TypeSpec changes if not already created. This is required only if there are TypeSpec changes in current branch.
290
-
6.**Choose SDK Generation Method**: Determine how to generate SDKs (locally or via pipeline).
291
-
7.**Generate SDKs via Pipeline**: Generate SDKs using [run sdk gen pipeline](..\eng\common\instructions\azsdk-tools\run-sdk-gen-pipeline.instructions.md), monitor the pipeline status and displaying generated SDK PR links.
292
-
8.**Show generated SDK PR**: Display the generated SDK pull request links for review.
293
-
9.**Create a release plan**: To create a release plan refer to [create release plan](..\eng\common\instructions\azsdk-tools\create-release-plan.instructions.md)
294
-
10.**Prompt user to change spec pull request to ready for review from draft status**: Update spec pull request to change it to ready for review.
295
-
11.**Release package**: Release the SDK package using `azsdk_release_sdk` tool.
296
-
297
-
## Release readiness of SDK and information about the release pipeline
285
+
Your goal is to guide the user through the process of generating SDKs from TypeSpec projects. **Before starting**, show all the high level steps to the user and ask:
286
+
287
+
> "Would you like to begin the SDK generation process now? (yes/no)"
288
+
289
+
Wait for the user to respond with a confirmation before proceeding to Step 1. Use the provided tools to perform actions and gather information as needed.
290
+
291
+
### Verify API spec
292
+
Step 1: Identify TypeSpec Project
293
+
**Goal**: Locate the TypeSpec project root path
294
+
**Actions**:
295
+
1. Check if `tspconfig.yaml` or `main.tsp` files are open in editor
296
+
2. If found, use the parent directory as project root
297
+
3. If not found, prompt user: "Please provide the path to your TypeSpec project root directory"
298
+
4. Validate the provided path contains required TypeSpec files main.tsp and tspconfig.yaml
299
+
5. Run `azsdk_typespec_check_project_in_public_repo` to verify repository
300
+
6. If not in public repo, inform: "Please make spec changes in Azure/azure-rest-api-specs public repo to generate SDKs"
**Goal**: Determine if the TypeSpec spec is already merged or if it's being modified.
305
+
**Actions**:
306
+
1. Prompt user to confirm if the TypeSpec spec is already merged in the main branch of https://github.com/Azure/azure-rest-api-specs : "Is your TypeSpec specification already merged in the main branch of repository(https://github.com/Azure/azure-rest-api-specs)? (yes/no)"
307
+
2. If already merged, follow the steps in [typespec to sdk](..\eng\common\instructions\azsdk-tools\typespec-to-sdk.instructions.md) to generate the SDK
308
+
3. If no, proceed to Step 3 to review and commit changes
309
+
**Success Criteria**: User decision on spec readiness obtained
310
+
311
+
Step 3: Validate TypeSpec Specification
312
+
**Goal**: Ensure TypeSpec specification compiles without errors. Povide a complete summary after running the tool. Highlight any errors and help user fix them.
313
+
**Condition**: Only if the spec is not already merged (from Step 2)
314
+
**Message to user**: "TypeSpec validation takes around 20 - 30 seconds."
315
+
**Actions**:
316
+
1. Run `azsdk_run_typespec_validation` to validate the TypeSpec project.
317
+
2. If validation succeeds, proceed to Step 4
318
+
3. If validation fails:
319
+
- Display all compilation errors to user
320
+
- Agent should provide suggestions to fix them and prompt the user to verify the fixes. If agent cannot resolve the errors, then prompt the user to fix compilation errors"
321
+
- Wait for user to fix errors and re-run validation. Provide detailed information about all the changes done by copilot and prompt the user before rerunning the validation.
322
+
**Success Criteria**: TypeSpec compilation passes without errors
323
+
324
+
Step 4: Review and Commit Changes
325
+
**Goal**: Stage and commit TypeSpec modifications
326
+
**Condition**: Only if the TypeSpec validation succeeds (from Step 3)
327
+
**Actions**:
328
+
1. Run `azsdk_get_modified_typespec_projects` to identify changes
329
+
2. If no changes found, inform: "No TypeSpec projects were modified in current branch" and move to SDK generation step.
330
+
3. Display all modified files (excluding `.github` and `.vscode` folders)
331
+
4. Prompt user: "Please review the modified files. Do you want to commit these changes? (yes/no)"
332
+
5. If yes:
333
+
- 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."
334
+
- Wait for user confirmation before continuing
335
+
- Run `git add <modified-files>`
336
+
- Prompt for commit message
337
+
- Run `git commit -m "<user-provided-message>"`
338
+
- Run `git push -u origin <current-branch-name>`
339
+
**Success Criteria**: Changes committed and pushed to remote branch
340
+
341
+
Step 5: Create Specification Pull Request
342
+
**Goal**: Create PR for TypeSpec changes if not already created
343
+
**Condition**: Only if there are committed changes (from Step 4)
344
+
**Actions**:
345
+
1. Prompt the user to confirm if a pull request already exists for API spec changes. If answer is no or unsure then check if spec PR already exists using `azsdk_get_pull_request_link_for_current_branch`
346
+
2. If PR exists, display PR details and proceed to next steps in SDK generation.
347
+
3. If no PR exists:
348
+
- Inform user: "No pull request found for the current branch. Proceeding to create a new pull request."
349
+
- Create a pull request using `azsdk_create_pull_request_for_current_branch`
Follow the steps in [typespec to sdk](..\eng\common\instructions\azsdk-tools\typespec-to-sdk.instructions.md) to generate the SDK.
357
+
358
+
# Release readiness of SDK and information about the release pipeline
298
359
299
360
Run [check package readiness](..\eng\common\instructions\azsdk-tools\check-package-readiness.instructions.md) to check the release readiness of an SDK package. This prompt will collect the required information from the user, execute the readiness check, and present the results.
300
361
301
-
##Instructions for GitHub coding agent to generate SDKs using GitHub.com
362
+
# Instructions for GitHub coding agent to generate SDKs using GitHub.com
302
363
303
364
Run only SDK generation step and Update SDK details back in issue description and release plan. Do not run TypeSpec validation, or service label check. This is applicable only when GitHub copilot coding agent is used to generate SDK and if a Release Plan is available in the context. Run SDK generation tool even if release plan already has SDK generation pipeline URL to support regenerating SDK.
304
365
Coding agent must wait until all SDK generation pipeline are in completed status and then fetch the SDK details from pipeline run. This is applicable only when a GitHub issue is assigned to GitHub coding agent to generate SDK from a TypeSpec project. This is not applicable when running Copilot from Visual Studio and VS Code.
305
366
306
-
###Additional instructions:
367
+
## Additional instructions:
307
368
308
369
- Run SDK generation pipeline for the given TypeSpec path for all languages mentioned in the description.
309
370
- Identify absolute path of TypeSpec project root path and send it to Run SDK generation MCP tool call.
310
371
- Keep checking the pipeline status until pipeline is in completed or failed status.
311
372
- Find SDK pull request links from the pipeline run.
312
373
313
-
###Constraints:
374
+
## Constraints:
314
375
315
376
- Do not invoke other steps.
316
377
- Do not modify main.tsp file or any files in TypeSpec project.
0 commit comments