Skip to content

Resetting System.CommandLine #2338

Closed
Closed

Description

@KathleenDollard

We are resetting the System.CommandLine project to better align with the current ecosystem, isolate parsing behavior so it can be shares with other parser libraries and clarify long term maintenance. This work is intended to bring System.CommandLine out of preview mode.

System.CommandLine provides command line parsing focused on providing a full featured strongly typed command line parser. It is used by the .NET CLI, many .NET tools, and other console applications. The effort has been primarily volunteer powered and changes are needed to shift maintenance responsibility to the .NET teams and align with changes in the ecosystem.

Going forward, the effort will have three parts:

  • A core parser which we plan to locate in the .NET Libraries
  • An open source full featured parser relying on the core parser and extensible subsystems for end user behavior such as help
  • An open ecosystem to encourage community creation/extension of parsers

We will separate the core parser which offers fast POSIX parsing, while also supporting other parsing styles including most Windows style parsers. This parser will be used by a full featured parser that will provide automatic help, tab completion, error reporting and other end-user features. The core parser itself will not provide any end user features, such as help.

A subsystem layer on top of the core parser will support full featured parsing with individually replaceable components. For example, it will support a help subsystem, and we will release the help system we use in the .NET CLI. CLI authors could select a different help subsystem within this extensibility model. We hope this design will foster creativity in the ecosystem by allowing folks to focus on specific aspects of the CLI experience while reusing the rest of the parser.

Parsers today

System.CommandLine is built on preview .NET CLI parsers and has had thousands of PRs across many years to match Posix guidance and user expectations. System.CommandLine has also been updated for fast parsing. While parsers seem simple, there are many hundreds of nuanced expectations within Posix, and parsing Windows command lines remains important for some tools.

For .NET, in addition to parsing behavior end users have expectations on the format of input and how those values are converted to strongly typed values. These two aspects - parsing behavior and type conversions - are the portion of System.CommandLine that is most stable and fast following performance work last year.

In the last five years, the ecosystem has done interesting things with command line libraries. For example, Spectre.Console has beautiful output and a CLI parser. We have worked with Spectre.Console's primary maintainer, @patriksvensson, who would like Spectre.Console's parser to have a dependency on a .NET-provided core parser, shifting responsibility for consistent POSIX parsing to .NET's core libraries. Working the other way, MSBuild is considering taking a dependency on Spectre.Console for output rendering.

A full featured parse will add a layer that meets end-user expectations for help, tab completion, error reporting and other supporting behavior. It will also provide the API used by CLI authors to supply information.

We believe the best way to build a ecosystem with consistent behavior and vibrant features is to provide a reusable core parser, an extensible model for features, and an open implementation of the features used in the .NET CLI and .NET tools.

The road here and onwards

System.CommandLine began as a side project for some Microsoft folks and has had many successes. Because we were creating a full featured parser, we combined feature behavior with core parser behavior. The long journey to redesign has been challenging and sometimes painful as we worked to balance needs of the community, .NET teams, the API review board, and the System.CommandLine team. We've delayed sharing plans until we had the first iteration of code isolating the parser and confidence in this design.

System.CommandLine will remain largely a community project. We are now aligned in intent and have the support of the API review board and the .NET Libraries team on the core parser, which we expect will be maintained by the .NET Libraries team. We are in the process of designing details of the subsystem layer. Overall, this effort involves very little new code since it mostly involves moving code. We have great tests across the system to make things easier.

There will be changes to the API for existing System.CommandLine CLI authors. The System.CommandLine preview will remain available so you can switch to the new library at your convenience. We intend a separate project to replace Dragonfruit with a simplified API that supports full features and subcommands.

The new project is code named "Powderhouse" and will live in a separate branch to avoid disrupting the existing stable main. The name comes from Powderhouse Square in Somerville, MA, in the Boston area.

We have a team, but we'd always love more help. One of the great aspects of that isolating the elements makes it easy to get involved. If you'd like to contribute, you'll find more in the main-powderhouse branch and with the Powderhouse label.

Activity

  1. added
    Powderhouse
    on Mar 5, 2024
  2. shaggygi commented on Mar 6, 2024

    @shaggygi
    Contributor

    @KathleenDollard this is great news! any chance with the reboot there could be a related .net community standup to reiterate this topic, introduce the team, approximate milestones/dates, etc.? again, glad to hear there will be focus (on this complex project) and eventually a "released" version. 👍

  3. KathleenDollard commented on Mar 6, 2024

    @KathleenDollard
    ContributorAuthor

    That is a great idea. I will see if we can get on the standup calendar, but we decided to skip next week (March) for the standup because several of us have conference commitments.

  4. KalleOlaviNiemitalo commented on Mar 7, 2024

    @KalleOlaviNiemitalo

    Are prerelease packages from the main-powderhouse branch being published to some NuGet feed? I don't see them in https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-libraries/nuget/v3/index.json.

  5. shaggygi commented on Mar 7, 2024

    @shaggygi
    Contributor

    @KathleenDollard I noticed the above link at "in the main-powerderhouse branch" is pointing back to this issue.

  6. KathleenDollard commented on Mar 7, 2024

    @KathleenDollard
    ContributorAuthor

    @KalleOlaviNiemitalo We are very early in the process and do not feel ready for a NuGet feed. We do plan to be on that feed when we are a bit further along.

  7. KathleenDollard commented on Mar 7, 2024

    @KathleenDollard
    ContributorAuthor

    @shaggygi Thanks! I thought I fixed that when I fixed the Wikipedia link, but messed up

  8. WeihanLi commented on Mar 20, 2024

    @WeihanLi

    Great news, is there a roadmap and schedule?

  9. justinmchase commented on Mar 21, 2024

    @justinmchase

    There has been a ton of commits in the main branch that are not published in a current nuget package. There are major bugs in the last beta4 release, it would be super nice if you could just drop one last release of whats in main before "resetting" and doing a major revamp.

  10. iSazonov commented on Mar 21, 2024

    @iSazonov

    Are you considering integration with shells? For example, PowerShell 7? The easiest way for it is probably to have metadata that it can read. (As a bonus, this metadata could be created for native applications in some manifest.)

  11. KathleenDollard commented on Mar 21, 2024

    @KathleenDollard
    ContributorAuthor

    @iSazonov

    Are you considering integration with shells? For example, PowerShell 7? The easiest way for it is probably to have metadata that it can read. (As a bonus, this metadata could be created for native applications in some manifest.)

    That's not in our current plans. I'd love to see an issue on the problems that it would solve and maybe some background on what would be needed as I am not familiar with that space.

    We want to walk that thin line that avoids both feature creep and blocking good ideas that could be implemented in the future or as extensions. The core parser will be fairly locked down when we are done, and the extensions pretty powerful.

  12. KathleenDollard commented on Mar 21, 2024

    @KathleenDollard
    ContributorAuthor

    @WeihanLi

    Great news, is there a roadmap and schedule?

    Not yet. We are still working out the architecture.

  13. 17 remaining items

  14. KalleOlaviNiemitalo commented on Dec 12, 2024

    @KalleOlaviNiemitalo
  15. reitowo commented on Dec 14, 2024

    @reitowo

    More like "Sunsetting System.CommandLine"

  16. gjaryczewski commented on Mar 19, 2025

    @gjaryczewski

    One year passed after resetting was announced. Is there any news about dropping the PREVIEW tag?

  17. Lordfirespeed commented on Mar 26, 2025

    @Lordfirespeed

    main-powderhouse: last commit 5 months ago
    main: last commit yesterday

    🤔 😂

    thanks for your ongoing work, maintainers :) the future looks bright!

  18. jamesshenry commented on Mar 28, 2025

    @jamesshenry

    If anyone is interested in a C# CLI parser that is AOT-compatible, supports Microsoft.Extensions.Hosting and the other Extension libraries, and is actually in active development you might be interested in the following:
    ConsoleAppFramework: ~200x faster than System.Commandline (when AOT compiled probably)
    Cocona: ~2x faster than System.Commandline and supports .NET Standard 2.0

  19. aetos382 commented on Mar 31, 2025

    @aetos382

    If Powderhouse has been canceled, please announce that officially.

  20. lloydjatkinson commented on Apr 8, 2025

    @lloydjatkinson

    What do we need to do to get the .NET team to invest in System.CommandLine?

  21. Lordfirespeed commented on May 15, 2025

    @Lordfirespeed

    What do we need to do to get the .NET team to invest in System.CommandLine?

    Sacrificing one's firstborn has been known to work in the past /j

  22. GABRIELNGBTUC commented on May 19, 2025

    @GABRIELNGBTUC

    They are still pushing to their nightly releases and the .NET CLI recently updated their dependency on SCL so they are definitely investing in it. The issue is that it's mainly opaque (Whole classes like the CommandLineBuilder just dissapeared?) and the breaking changes don't seem to have any obvious way to fix with no documentation yet on how to upgrade.

  23. precisionconage commented on Jun 4, 2025

    @precisionconage

    Adam Sitnik mentioned a month ago on #2500 that he'd ping people who might be able to provide more info, but given that there were no further comments, it seems they're not ready to talk discuss this yet. Hopefully there's an update soon.

  24. unpinned this issue on Jun 19, 2025
  25. justinmchase commented on Jun 19, 2025

    @justinmchase

    Congrats Microsoft for the new release! Genuine thanks for keeping this moving forward.

    Dig in ladies and gentlemen:

    https://github.com/dotnet/command-line-api/releases/tag/v2.0.0-beta5.25306.1

  26. dimension-zero commented on Sep 25, 2025

    @dimension-zero

    Just so confused

    1. how can such a critical project (it's used everywhere in Azure and GitHub) stay on Beta for so many years?
    2. how come progress is so slow, when other CLI libraries without MSFT's backing are doing nightly builds?
      Not complaining - just genuinely curious and confused. Can anyone clarify?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Powderhouse

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions