[azsdk-cli] Add in some checks and niceties to make the tsp init command a bit easier for new users#11956
Conversation
… a novice to use: - Check that the output path we're choosing is under the azure-rest-api-specs folder, and that it's under specifications - Create the directory if it doesn't already exist - Provide some next steps that take into account the folder they created the project in.
There was a problem hiding this comment.
Pull Request Overview
This PR enhances the tsp init command to make it more user-friendly for new users by adding validation checks and helpful guidance. The changes ensure the command is used correctly within the Azure REST API specifications repository structure and provides clear next steps.
Key changes:
- Added validation to ensure the output directory is within the azure-rest-api-specs repository and under the "specification" folder
- Implemented automatic directory creation if the target directory doesn't exist
- Added next steps guidance in the response to help users know what to do after project initialization
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| TspInitTool.cs | Added git repository validation, directory path checks, automatic directory creation, and next steps guidance |
| TspToolResponse.cs | Enhanced ToString() method to include next steps in the output |
| TspInitToolTest.cs | Updated tests to accommodate new constructor parameter and added comprehensive test coverage for new validation features |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…k-msft/azure-sdk-tools into tools-tsp-client-ergo
|
Thanks, I like it! I'm also going to add a GitHub instructions to the specs repo that will tell copilot to read the typespec structure guidelines doc that's in that repo to figure out the right folder structure. It's working well with my local testing - but obviously great to have more covered by this tool as well. |
I think we can make this enforcing in the MCP tool as well, and just return next steps (on error) indicating what they need to fix. |
- Updated code to handle -pr repos. We had some shared code that was pretty close, so made some small adjustments.
| /// </summary> | ||
| /// <param name="path">Path within a repo</param> | ||
| /// <returns>true if within the azure-rest-api-specs repo, false otherwise</returns> | ||
| public bool IsRepoPathForPublicSpecRepo(string path); |
Add in some checks and niceties to make this command a bit easier for a novice to use: