Skip to content

[Chore]: Migrate Program.cs to System.CommandLine 2.0.0-beta5 API #16

@ahmedig

Description

@ahmedig

Area

Application Services (API, Functions, etc.)

Motivation

After updating to System.CommandLine 2.0.0-beta5, the main entry point in Program.cs needs to be updated to use the new API patterns. The beta5 version introduces breaking changes that require:

  • Replacing rootCommand.AddCommand() calls with rootCommand.Subcommands.Add() syntax
  • Updating the main entry point to handle the new parsing and invocation separation
  • Modernizing the command registration pattern

Task Description

Update src/GenAIDBExplorer/GenAIDBExplorer.Console/Program.cs to use the new System.CommandLine 2.0.0-beta5 API patterns for command registration and program entry point.

Specific Changes Required:

  • Replace all rootCommand.AddCommand() calls with rootCommand.Subcommands.Add() syntax
  • Update the main entry point to handle the new parsing and invocation separation
  • Ensure the command registration follows the new mutable collections pattern
  • Update any global options registration to use the new pattern

Files to Modify:

  • src/GenAIDBExplorer/GenAIDBExplorer.Console/Program.cs

Acceptance Criteria

  • All command registration uses rootCommand.Subcommands.Add() instead of rootCommand.AddCommand()
  • Main entry point correctly uses new parsing and invocation pattern
  • Global options (if any) are properly registered using the new API
  • Project compiles without errors related to Program.cs
  • Application starts and shows help correctly with --help option
  • No regression in existing command-line interface behavior

Impact / Risk

  • Dependencies: Requires completion of issue [Chore]: Update System.CommandLine package reference to 2.0.0-beta5 #15 (package reference update) first
  • Risk Level: Medium - Changes to main entry point could affect all command execution
  • Breaking Changes: Internal only - external CLI interface should remain the same
  • Testing: Requires manual testing of application startup and help display

Related Issues:

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions