Skip to content

[azsdk-cli] Add in some checks and niceties to make the tsp init command a bit easier for new users#11956

Merged
richardpark-msft merged 9 commits into
Azure:mainfrom
richardpark-msft:tools-tsp-client-ergo
Sep 4, 2025
Merged

[azsdk-cli] Add in some checks and niceties to make the tsp init command a bit easier for new users#11956
richardpark-msft merged 9 commits into
Azure:mainfrom
richardpark-msft:tools-tsp-client-ergo

Conversation

@richardpark-msft
Copy link
Copy Markdown
Member

Add in some checks and niceties to make this command a bit easier for 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.

… 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.
Copilot AI review requested due to automatic review settings September 3, 2025 23:29
@github-actions github-actions Bot added the azsdk-cli Issues related to Azure/azure-sdk-tools::tools/azsdk-cli label Sep 3, 2025
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread tools/azsdk-cli/Azure.Sdk.Tools.Cli/Tools/TypeSpec/TspInitTool.cs Outdated
Comment thread tools/azsdk-cli/Azure.Sdk.Tools.Cli/Tools/TypeSpec/TspInitTool.cs Outdated
Comment thread tools/azsdk-cli/Azure.Sdk.Tools.Cli/Tools/TypeSpec/TspInitTool.cs Outdated
richardpark-msft and others added 5 commits September 3, 2025 16:45
Comment thread tools/azsdk-cli/Azure.Sdk.Tools.Cli/Tools/TypeSpec/TspInitTool.cs Outdated
Comment thread tools/azsdk-cli/Azure.Sdk.Tools.Cli/Tools/TypeSpec/TspInitTool.cs Outdated
@chrisradek
Copy link
Copy Markdown
Member

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.

@richardpark-msft
Copy link
Copy Markdown
Member Author

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.

richardpark-msft added 3 commits September 4, 2025 12:56
- Updated code to handle -pr repos. We had some shared code that was pretty close, so made some small adjustments.
Copy link
Copy Markdown
Member

@praveenkuttappan praveenkuttappan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@richardpark-msft richardpark-msft merged commit a1de118 into Azure:main Sep 4, 2025
13 checks passed
@richardpark-msft richardpark-msft deleted the tools-tsp-client-ergo branch September 4, 2025 22:20
/// </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);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

who is using this function?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

azsdk-cli Issues related to Azure/azure-sdk-tools::tools/azsdk-cli

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants