Skip to content

Create shared helper module for tsp-client commands#12051

Closed
samvaity wants to merge 13 commits into
mainfrom
tsp-cleint-helper
Closed

Create shared helper module for tsp-client commands#12051
samvaity wants to merge 13 commits into
mainfrom
tsp-cleint-helper

Conversation

@samvaity
Copy link
Copy Markdown
Member

@samvaity samvaity commented Sep 11, 2025

Created shared helpers for tsp-client commands (common utility class used by multiple tools) so they provide single implementation of core logic

  • Looser coupling (for multiple tool calls to use)
  • Clear separation of “UI” (CLI command) vs logic

Will add update workflow in a follow-up PR, which will include details with the TspClientUpdate Tooling (it was increasing the size of PR)

@github-actions github-actions Bot added the azsdk-cli Issues related to Azure/azure-sdk-tools::tools/azsdk-cli label Sep 11, 2025
@samvaity samvaity marked this pull request as ready for review September 11, 2025 21:17
@samvaity samvaity requested a review from benbp as a code owner September 11, 2025 21:17
Copilot AI review requested due to automatic review settings September 11, 2025 21:17
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 refactors the TypeSpec conversion tool to use a shared helper module for tsp-client commands. The goal is to create reusable logic that can be shared across multiple tools while maintaining loose coupling between UI commands and core business logic.

  • Extracts the tsp-client convert command execution logic into a dedicated helper class
  • Introduces dependency injection for the new ITspClientHelper interface
  • Updates existing tests to accommodate the new constructor dependencies

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
TspConvertTool.cs Refactored to use injected ITspClientHelper instead of inline tsp-client execution
ServiceRegistrations.cs Added DI registration for the new ITspClientHelper interface
TspClientHelper.cs New implementation class containing the extracted tsp-client convert logic
ITspClientHelper.cs New interface defining the contract for tsp-client operations
TspConvertToolTest.cs Updated test constructor calls to include the new dependency
Comments suppressed due to low confidence (1)

tools/azsdk-cli/Azure.Sdk.Tools.Cli/Tools/TypeSpec/TspConvertTool.cs:161

  • Duplicate file existence check. Lines 151-155 already perform the same validation with fullPath variable. Remove this redundant check.
            var fullPathToSwaggerReadme = Path.GetFullPath(pathToSwaggerReadme.Trim());
            if (!File.Exists(fullPathToSwaggerReadme))
            {
                return $"Failed: pathToSwaggerReadme '{fullPathToSwaggerReadme}' does not exist.";
            }

samvaity and others added 12 commits September 11, 2025 15:14
* Add variable updates on the yaml

* Add variable updates on the yaml

* as variable and with condition

* variables

* debugging

* debugging

* lets try

* initial approach again?

* Simplified

* Fix comparison to string

* Clean up codE
* update logic

* up

---------

Co-authored-by: Kyle Zhang <v-zhanh@microsoft.com>
…iling, and update `GetRepoRemoteUri` to support ssh URIs by converting to https (#12036)

Co-authored-by: Christopher Radek <Christopher.Radek@microsoft.com>
* [Python APIView] add quotes to string Literals

* changelog

* apply code review comments

* change order of azure tests to fix random tox error

* fix test

* fix test
* Refactor evals. Add `cli eval run` command.

* Add tiny test for debugging.

* Refactor to avoid importing evals in CLI.

* Temporary testing.

* Eval fixes. Should be runnable!

* Clean up.

* Fixes.

* Fixes.
Co-authored-by: Christopher Radek <Christopher.Radek@microsoft.com>
@samvaity samvaity closed this Sep 11, 2025
@samvaity
Copy link
Copy Markdown
Member Author

Did a poor rebase

@samvaity samvaity deleted the tsp-cleint-helper branch November 5, 2025 22:06
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.