Skip to content

[azsdk-cli] Organize command line hierarchy#12564

Closed
benbp wants to merge 3 commits into
Azure:mainfrom
benbp:benbp/azsdk-cli-command-grouping
Closed

[azsdk-cli] Organize command line hierarchy#12564
benbp wants to merge 3 commits into
Azure:mainfrom
benbp:benbp/azsdk-cli-command-grouping

Conversation

@benbp

@benbp benbp commented Oct 20, 2025

Copy link
Copy Markdown
Member

This PR takes a first pass at organizing our command line hierarchy. This ensures alignment with #12071 as well as organizing the rest of the CLI commands not specified in that doc.

One area that I'm still not sure of is that we can probably merge the top-level spec-workflow and typespec commands, since they are both typespec related? @praveenkuttappan @maririos @chrisradek thoughts?

The new structure (levels 1 and 2):

⇉ ⇉ ⇉ dotnet run --no-restore -- -h
Description:
  azsdk cli - A Model Context Protocol (MCP) server that facilitates tasks for anyone working with the Azure SDK team.

Usage:
  azsdk [command] [options]

Options:
  -h, --help    Show help and usage information
  --version     Show version information
  --debug       Enable debug logging [default: False]
  -o, --output  The format of the output. Supported formats are: plain, json [default: plain]

Commands:
  mcp            Starts the MCP server (stdio mode)
  package, pkg   Package operations
  config         SDK service configuration commands
  azp, pipeline  Azure Pipelines commands
  release-plan   Manage release plans in AzureDevops
  tsp, typespec  Commands for setting up or working with TypeSpec projects
  spec-workflow  TypeSpec SDK generation commands
  test           Test operations for SDK packages
  eng            Internal azsdk engineering system commands
  example        Example tool demonstrating framework features
⇉ ⇉ ⇉ dotnet run --no-restore -- pkg -h
Description:
  Package operations

Usage:
  azsdk pkg [command] [options]

Options:
  -h, --help    Show help and usage information
  --debug       Enable debug logging [default: False]
  -o, --output  The format of the output. Supported formats are: plain, json [default: plain]

Commands:
  validate <All|Changelog|Cspell|Dependency|Format|Linting|Readme|Snippets>  Run validation checks for SDK packages [default: All]
  readme                                                                     README operations for SDK packages
  release-readiness                                                          Checks release readiness of a SDK package
  build                                                                      Builds SDK source code for a specified language and project
  generate                                                                   Generates SDK code for a specified language based on the provided 'tspconfig.yaml' or 'tsp-location.yaml'
  release                                                                    Run the release pipeline for the package
  test                                                                       Test operations for SDK packages
⇉ ⇉ ⇉ dotnet run --no-restore -- config -h
Description:
  SDK service configuration commands

Usage:
  azsdk config [command] [options]

Options:
  -h, --help    Show help and usage information
  --debug       Enable debug logging [default: False]
  -o, --output  The format of the output. Supported formats are: plain, json [default: plain]

Commands:
  codeowners    Validate and modify GitHub codeowners
  github-label  GitHub service label commands
⇉ ⇉ ⇉ dotnet run --no-restore -- release-plan -h
Description:
  Manage release plans in AzureDevops

Usage:
  azsdk release-plan [command] [options]

Options:
  -h, --help    Show help and usage information
  --debug       Enable debug logging [default: False]
  -o, --output  The format of the output. Supported formats are: plain, json [default: plain]

Commands:
  get                      Get release plan details
  create                   Create a release plan
  link-namespace-approval  Link namespace approval issue to release plan
⇉ ⇉ ⇉ dotnet run --no-restore -- tsp -h
Description:
  Commands for setting up or working with TypeSpec projects

Usage:
  azsdk tsp [command] [options]

Options:
  -h, --help    Show help and usage information
  --debug       Enable debug logging [default: False]
  -o, --output  The format of the output. Supported formats are: plain, json [default: plain]

Commands:
  project            TypeSpec project utilities
  validate           Run typespec validation
  convert            Convert an existing Azure service swagger definition to a TypeSpec project
  init               Initialize a new TypeSpec project
  client             TypeSpec client update helpers
  check-public-repo  Check if TypeSpec project is in public spec repo
⇉ ⇉ ⇉ dotnet run --no-restore -- spec-workflow -h
Description:
  TypeSpec SDK generation commands

Usage:
  azsdk spec-workflow [command] [options]

Options:
  -h, --help    Show help and usage information
  --debug       Enable debug logging [default: False]
  -o, --output  The format of the output. Supported formats are: plain, json [default: plain]

Commands:
  check-api-readiness  Check if API spec is ready to generate SDK
  generate-sdk         Generate SDK for a TypeSpec project
  get-sdk-pr           Get SDK pull request link from SDK generation pipeline
  link-sdk-pr          Link SDK pull request to release plan
⇉ ⇉ ⇉ dotnet run --no-restore -- test -h
Description:
  Test operations for SDK packages

Usage:
  azsdk test [command] [options]

Options:
  -h, --help    Show help and usage information
  --debug       Enable debug logging [default: False]
  -o, --output  The format of the output. Supported formats are: plain, json [default: plain]

Commands:
  results  Analyze test results
  run      Run tests for SDK packages
⇉ ⇉ ⇉ dotnet run --no-restore -- mcp -h
Description:
  Starts the MCP server (stdio mode)

Usage:
  azsdk mcp [options]

Options:
  --tools       If provided, the mcp server will only list and respond to tools named the same as provided in this option. Glob matching is honored.
  -h, --help    Show help and usage information
  --debug       Enable debug logging [default: False]
  -o, --output  The format of the output. Supported formats are: plain, json [default: plain]

@benbp
benbp requested a review from a team as a code owner October 20, 2025 17:56
@benbp benbp added the Central-EngSys This issue is owned by the Engineering System team. label Oct 20, 2025
Copilot AI review requested due to automatic review settings October 20, 2025 17:56
@benbp benbp added the azsdk-cli Issues related to Azure/azure-sdk-tools::tools/azsdk-cli label Oct 20, 2025
@benbp benbp moved this from 🤔 Triage to 🔬 Dev in PR in Azure SDK EngSys 🚀🌒🧑‍🚀 Oct 20, 2025
@benbp
benbp force-pushed the benbp/azsdk-cli-command-grouping branch from ff228ea to 5857828 Compare October 20, 2025 17:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 reorganizes the CLI command hierarchy to improve usability and consistency. The primary goal is to establish a clear, logical grouping of commands under well-defined top-level command groups, making the CLI easier to navigate and understand. Additionally, this work aligns with the documented command structure guidelines.

Key Changes:

  • Introduced consistent command aliases (e.g., pkg for package, tsp for typespec, azp for pipeline)
  • Reorganized commands under logical hierarchies (e.g., TypeSpec commands under tsp, config commands under config)
  • Renamed commands for clarity and brevity (e.g., convert-swaggerconvert, customized-updateupdate)
  • Removed outdated spec documentation files
  • Added validation logic to detect duplicate commands in DEBUG builds

Reviewed Changes

Copilot reviewed 38 out of 38 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
cli-commands-guidelines.md Updated command hierarchy documentation to reflect new structure with aliases
SharedCommandGroups.cs Added new command groups (Config, PackageReadme, PackageTest, TypeSpecProject, TypeSpecClient) and aliases for existing groups
CommandGroup.cs Extended record to support command aliases
CommandRunner.cs Added alias registration logic and DEBUG-mode duplicate command validation
HostServerCommand.cs Renamed start command to mcp with start as hidden legacy alias
Various Tool files Updated command hierarchies and renamed commands for consistency
Test files Updated references to renamed classes and removed obsolete tests
Spec files Removed outdated specification template and example files
Java test cleanup Removed tests for deprecated snippet and javadoc functionality

Comment thread tools/azsdk-cli/Azure.Sdk.Tools.Cli/Commands/HostServer/HostServerCommand.cs Outdated
@benbp
benbp force-pushed the benbp/azsdk-cli-command-grouping branch from 5857828 to 220021f Compare October 20, 2025 18:04
) : MCPMultiCommandTool
) : MCPNoCommandTool
{
public override CommandGroup[] CommandHierarchy { get; set; } = [new("spec-pr", "Pull request tools")];

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

FYI @praveenkuttappan @danieljurek I just removed the PR helpers from CLI mode, they are pretty redundant with the github CLI.

];

private const string RunChecksCommandName = "run-checks";
private readonly Argument<PackageCheckType> checkTypeArg = new("check-type")

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

FYI @l0lawrence I moved the check type to arguments instead an enum iteration to simplify the GetCommands() implementation here (this might allow me to refactor it in the base class to be a property instead of a method). The command line will still allow a lowercase check type and default to all however the help text shows an uppercase check type. I'm going to see if I can fix that so it always shows lowercase.

@benbp benbp self-assigned this Oct 21, 2025
);

public static readonly CommandGroup PackageTest = new(
Verb: "test",

@l0lawrence l0lawrence Oct 21, 2025

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.

I know this is the way it is currently, but we have an upper level azsdk test and then azsdk pkg test what differs, should we combine

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Oh yeah it should probably just be under pkg entirely.

var nameSet = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
foreach (var sub in command.Subcommands)
{
if (!nameSet.Add(sub.Name))

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.

Will it end up with same command object if two tools reuse the same verb at different points in their hierarchy?

@chrisradek

Copy link
Copy Markdown
Member

One area that I'm still not sure of is that we can probably merge the top-level spec-workflow and typespec commands, since they are both typespec related

I'm not entirely sure it makes sense to merge these - I've been thinking of typespec commands as being able to (someday, not now) run outside of the specs repo, whereas spec-workflow really has a hard dependency on the specs repo. But maybe I'm unique in this thinking - can totally be the case.

check-api-readiness Check if API spec is ready to generate SDK
generate-sdk Generate SDK for a TypeSpec project
get-sdk-pr Get SDK pull request link from SDK generation pipeline
link-sdk-pr Link SDK pull request to release plan

  • check-api-readiness is checking that a PR has been created and all the necessary labels are there to indicate it has been approved to merge. I'm not sure where/when it actually gets called.
  • generate-sdk seems like it could be a decent fit, though if I'm thinking of it being analogous to tsp compile, package generate seems like a better fit. I don't feel as strongly about this one, except it's less obvious that you need to run generate-sdk from the specs repo for it to trigger the pipeline to run.

The other 2 commands don't really seem to have anything to do with TypeSpec IMO, it's more release plan management?

```
Tools/
├── Package/ # Package-level operations
├── Package/ # Package-level operations

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.

Few thoughts on the package command organization:

  1. Streamline Code Generation Commands:

    • generate – Appears under azsdk pkg generate for SDK code generation and in the TypeSpec workflow (azsdk spec-workflow generate-sdk) for generating an SDK from a TypeSpec project. I think generate might fit better under the TypeSpec domain, since it's about turning specs into SDK code, rather than under general package operations.
  2. Organization of readme and sample commands: Having a top-level azsdk pkg readme command and a README check as part of pkg validate is overlapping. Similarly, sample code handling is embedded in validation (“Snippets”) but not as a top level command like Readme . Should README and sample code checks be grouped under a broader release or validation workflow instead of standalone commands? If release-readiness is meant to assess a package’s overall preparedness, it might incorporate ensuring the README and samples are up to date. Alternatively, README and sample updates could be sub-tasks of a release preparation command rather than each being top-level commands.

  3. Overlapping Release Commands
    Thoughts on combining release-readiness into the release command group. For example, use a subcommand like release check or an option (e.g. azsdk pkg release --dry-run) to perform readiness checks, instead of a separate top-level command.

  4. Naming ambiguity (minor concern):

    • validate – Exists in both groups but with different scope: azsdk pkg validate covers package-level checks (including docs and formatting) while azsdk tsp validate handles TypeSpec spec validation. The name overlap might confuse users even though the validations differ.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

  1. Does this mean we actually have two duplicate implementations of SDK generation right now, or do these tools differ even though they have the same name? (SpecWorkflowTool and SdkGenerationTool) @raych1 @praveenkuttappan
  2. Maybe azsdk pkg release [validate] and azsdk pkg generate [readme/sample]? Something like azsdk pkg release readme would indicate we're releasing a readme, not generating one.
  3. I'm for getting rid of release-readiness just based on naming alone.
  4. validate within a sub-command context indicates to me that it's validation for whatever that scope is, not that the validations would be the same. The help text for each should enumerate the possible checks (e.g. All|Changelog|... vs. All|Specs|...)

@maririos maririos Oct 23, 2025

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.

I'm for getting rid of release-readiness just based on naming alone.

Ohhh this is interesting. The reason we have this, is so locally people can understand what they are missing or why the release pipeline will fail for them.
tooling uses this too, like for example the Release planner.
Having said that, I like the suggestion @samvaity is giving about an option: azsdk pgk release --dry-run

@praveenkuttappan what do you think?

@samvaity samvaity Oct 23, 2025

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.

Maybe azsdk pkg release [validate] and azsdk pkg generate [readme/sample]? Something like azsdk pkg release readme would indicate we're releasing a readme, not generating one.

@benbp My suggestion would be, to drop the separate pkg readme command. Instead:
azsdk pkg generate – One command to generate necessary artifacts for a package.

  • azsdk pkg generate (default) – Generate SDK code (from specs, if no specific target given).
  • azsdk pkg generate readme – Generate or update the package’s README file.
  • azsdk pkg generate sample – Generate or update SDK sample code snippets or sample projects.

azsdk pkg validate – Validate various aspects of the package (no change in invocation, but continues to include checks for README format and code snippets among others).

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.

@benbp yes, we have two generate tools. One is for local experience, and the other is for release scenario using pipeline to generate the SDK. It makes sense to put generate-sdk under spec-workflow since it's part of that flow. I think generate fits better at the package level, as it supports generation from either typespec or an existing SDK project.

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.

as it supports generation from either typespec or an existing SDK project.

What it means to generate from an existing SDK project?
If I am re-generating is because my spec changed. If I am adding to my sdk it is because I am applying customizations. so it is not generate.
What am I missing?

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.

@samvaity
Overlaps occur across these assets: changelog, readme, samples, and snippets. We have individual tools for each of them, and the validation tool also provides sub-commands to verify them:

  • azsdk pkg validate --check-type changelog
  • azsdk pkg validate --check-type readme
  • azsdk pkg validate --check-type snippets --fix # updates snippets
  • ...
  • azsdk pkg validate # validates all checks

For pkg update tools:

  • azsdk pkg update --target changelog-content
  • azsdk pkg update --target version
  • azsdk pkg update --target metadata
  • azsdk pkg update --target ci
  • azsdk pkg update # updates all targets

I think it’s reasonable to have some overlap among these tools. Since the primary users of the CLI are likely automation pipelines, it would actually be more beneficial to provide aggregated commands for convenience. Updates to readme and snippets still wrapped in validation checks, so running pkg update and pkg validate should get everything in a package ready for release.
CC: @maririos

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.

What it means to generate from an existing SDK project?

It refers to regenerate the SDK in a local SDK repo folder after spec is changed. User can prompt like re-generate code for current project or generate code from {path_or_url_to_the_spec}.

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.

azsdk pgk release --dry-run

Filed an issue to track this change. #12865

@@ -90,9 +90,9 @@ For release planning and SDK coordination:

### 3. **typespec** - TypeSpec Operations and TypeSpec Client Operations

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.

I think there are some gaps breaking the overall flow between tsp and spec-workflow commands. From tehe divided command structure it seems that the users working with TypeSpec must use tsp commands for project setup and validation, then switch to spec-workflow commands for generating the SDK and handling the output.

Should we consider merging the spec-workflow functionality into the tsp group. This would create a single azsdk tsp command group encompassing the entire TypeSpec workflow, from project initiation to SDK generation. For example, azsdk tsp generate could replace spec-workflow generate-sdk, and give a continuous task flow?

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.

spec-workflow command to link sdk pr will be moved to release plan and another command to generate SDK using pipeline will be deprecated and we can remove spec-workflow hierarchy all together.

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.

I really like azsdk tsp generate because just with the name it is clear that this won't work for OpenAPI specs. it also shift left the concept of what Typespec brings to the table. and instead of spec-worflow then SDKs? client, thing`

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.

I don't think we need azsdk tsp generate. This should ideally be merged to azsdk package generate and we can completely deprecate the spec workflow based sdk generation. I will also move link sdk to release plan to release plan group so we can completely deprecate spec-workflow. I will file a separate issue and do it in a separate PR to move link sdk to release plan.

@praveenkuttappan

Copy link
Copy Markdown
Member

@benbp We can remove spec workflow tool class once local SDK generation is in complete state. It has two tools.

  1. SDK generation using pipeline( I am hoping that we can deprecate this once local SDK gen is fully ready)
  2. Link SDK PR to release plan: I can move this tool to release plan tool.

@praveenkuttappan praveenkuttappan left a comment

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.

Looks fine to me. We can do any further changes in incremental PR.

@samvaity

Copy link
Copy Markdown
Member

@benbp We can remove spec workflow tool class once local SDK generation is in complete state. It has two tools.

  1. SDK generation using pipeline( I am hoping that we can deprecate this once local SDK gen is fully ready)
  2. Link SDK PR to release plan: I can move this tool to release plan tool.

yayy 🥳 thanks, I think removing spec-workflow and merging it with tsp group provides advantage of single azsdk tsp command group encompassing the entire TypeSpec workflow

@praveenkuttappan

Copy link
Copy Markdown
Member

@benbp We can remove spec workflow tool class once local SDK generation is in complete state. It has two tools.

  1. SDK generation using pipeline( I am hoping that we can deprecate this once local SDK gen is fully ready)
  2. Link SDK PR to release plan: I can move this tool to release plan tool.

yayy 🥳 thanks, I think removing spec-workflow and merging it with tsp group provides advantage of single azsdk tsp command group encompassing the entire TypeSpec workflow

@samvaity Just to make sure we are all on the same page, my suggestion was to move link sdk pr to release plan. SDK generation currently has currently uses pipeline and is also associated with release plan as an optional property. So, I don't think this completely fit in tsp group. We can keep as it is and retire this tool completely when current local sdk generation is fully operational.

@praveenkuttappan

Copy link
Copy Markdown
Member

@benbp We can remove spec workflow tool class once local SDK generation is in complete state. It has two tools.

  1. SDK generation using pipeline( I am hoping that we can deprecate this once local SDK gen is fully ready)
  2. Link SDK PR to release plan: I can move this tool to release plan tool.

yayy 🥳 thanks, I think removing spec-workflow and merging it with tsp group provides advantage of single azsdk tsp command group encompassing the entire TypeSpec workflow

@samvaity Just to make sure we are all on the same page, my suggestion was to move link sdk pr to release plan. SDK generation currently has currently uses pipeline and is also associated with release plan as an optional property. So, I don't think this completely fit in tsp group. We can keep as it is and retire this tool completely when current local sdk generation is fully operational.

Filed issue to track this change. #12864

@benbp

benbp commented Dec 4, 2025

Copy link
Copy Markdown
Member Author

Changes merged via #12854

@benbp benbp closed this Dec 4, 2025
@github-project-automation github-project-automation Bot moved this from 🔬 Dev in PR to 🎊 Closed in Azure SDK EngSys 🚀🌒🧑‍🚀 Dec 4, 2025
@benbp
benbp deleted the benbp/azsdk-cli-command-grouping branch December 4, 2025 20:23
@ronniegeraghty ronniegeraghty added the AzSDK Tools Agent Issue related to the AzSDK Tools Agent. label May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AzSDK Tools Agent Issue related to the AzSDK Tools Agent. azsdk-cli Issues related to Azure/azure-sdk-tools::tools/azsdk-cli Central-EngSys This issue is owned by the Engineering System team.

Projects

Development

Successfully merging this pull request may close these issues.

9 participants