//
// SPDX-License-Identifier: BUSL-1.1
// Sprint: SPRINT_20260112_014_CLI_config_viewer (CLI-CONFIG-010, CLI-CONFIG-011)
//
using System.CommandLine;
using StellaOps.Cli.Services;
namespace StellaOps.Cli.Commands;
///
/// CLI commands for inspecting StellaOps configuration.
///
internal static class ConfigCommandGroup
{
public static Command Create(IBackendOperationsClient client)
{
var configCommand = new Command("config", "Inspect StellaOps configuration");
// stella config list
var listCommand = new Command("list", "List all available configuration paths");
var categoryOption = new Option("--category", "-c")
{
Description = "Filter by category (e.g., policy, scanner, notifier)"
};
listCommand.AddOption(categoryOption);
listCommand.SetHandler(
async (string? category) => await CommandHandlers.Config.ListAsync(category),
categoryOption);
// stella config show
var pathArgument = new Argument("path")
{
Description = "Configuration path (e.g., policy.determinization, scanner.epss)"
};
var showCommand = new Command("show", "Show configuration for a specific path");
showCommand.AddArgument(pathArgument);
var formatOption = new Option("--format", "-f")
{
Description = "Output format: table, json, yaml"
};
formatOption.SetDefaultValue("table");
var showSecretsOption = new Option("--show-secrets")
{
Description = "Show secret values (default: redacted)"
};
showSecretsOption.SetDefaultValue(false);
showCommand.AddOption(formatOption);
showCommand.AddOption(showSecretsOption);
showCommand.SetHandler(
async (string path, string format, bool showSecrets) =>
await CommandHandlers.Config.ShowAsync(client, path, format, showSecrets),
pathArgument, formatOption, showSecretsOption);
configCommand.AddCommand(listCommand);
configCommand.AddCommand(showCommand);
return configCommand;
}
}