Files
natsnet/tools/NatsNet.PortTracker/Program.cs
Joseph Doherty c5e0416793 Add batch commands to PortTracker CLI and migrate batch tables into porting.db
Implements batch list/show/ready/next/start/complete commands with dependency
validation, migrates 42 implementation batches (2377 features, 2087 tests) from
porting_batches.db into the live tracking database, and documents the batch
workflow in AGENTS.md.
2026-02-27 13:02:43 -05:00

48 lines
1.7 KiB
C#

using System.CommandLine;
using NatsNet.PortTracker.Commands;
using NatsNet.PortTracker.Data;
var dbOption = new Option<string>("--db")
{
Description = "Path to the SQLite database file",
DefaultValueFactory = _ => Path.Combine(Directory.GetCurrentDirectory(), "porting.db"),
Recursive = true
};
var schemaOption = new Option<string>("--schema")
{
Description = "Path to the SQL schema file",
DefaultValueFactory = _ => Path.Combine(Directory.GetCurrentDirectory(), "porting-schema.sql"),
Recursive = true
};
var rootCommand = new RootCommand("NATS .NET Porting Tracker");
rootCommand.Add(dbOption);
rootCommand.Add(schemaOption);
// init command
var initCommand = new Command("init", "Create or reset the database schema");
initCommand.SetAction(parseResult =>
{
var dbPath = parseResult.GetValue(dbOption)!;
var schemaPath = parseResult.GetValue(schemaOption)!;
using var db = new Database(dbPath);
Schema.Initialize(db, schemaPath);
Console.WriteLine($"Database initialized at {dbPath}");
});
rootCommand.Add(initCommand);
rootCommand.Add(ModuleCommands.Create(dbOption, schemaOption));
rootCommand.Add(FeatureCommands.Create(dbOption, schemaOption));
rootCommand.Add(TestCommands.Create(dbOption, schemaOption));
rootCommand.Add(LibraryCommands.Create(dbOption, schemaOption));
rootCommand.Add(DependencyCommands.Create(dbOption, schemaOption));
rootCommand.Add(ReportCommands.Create(dbOption, schemaOption));
rootCommand.Add(PhaseCommands.Create(dbOption, schemaOption));
rootCommand.Add(AuditCommand.Create(dbOption));
rootCommand.Add(OverrideCommands.Create(dbOption));
rootCommand.Add(BatchCommands.Create(dbOption));
var parseResult = rootCommand.Parse(args);
return await parseResult.InvokeAsync();