namespace StellaOps.Audit.ReplayToken;
///
/// Generates CLI snippets for one-click reproduce functionality.
///
public sealed class ReplayCliSnippetGenerator
{
///
/// Generates a CLI command to reproduce a decision.
///
public string GenerateDecisionReplay(
ReplayToken token,
string alertId,
string? feedManifestUri = null,
string? policyVersion = null)
{
ArgumentNullException.ThrowIfNull(token);
ArgumentException.ThrowIfNullOrWhiteSpace(alertId);
var parts = new List
{
"stellaops",
"replay",
"decision",
$"--token {token.Value}",
$"--alert-id {alertId}"
};
if (!string.IsNullOrWhiteSpace(feedManifestUri))
{
parts.Add($"--feed-manifest {feedManifestUri.Trim()}");
}
if (!string.IsNullOrWhiteSpace(policyVersion))
{
parts.Add($"--policy-version {policyVersion.Trim()}");
}
return string.Join(" \\\n+ ", parts);
}
///
/// Generates a CLI command to reproduce unknowns scoring.
///
public string GenerateScoringReplay(
ReplayToken token,
string subjectKey,
string? configVersion = null)
{
ArgumentNullException.ThrowIfNull(token);
ArgumentException.ThrowIfNullOrWhiteSpace(subjectKey);
var parts = new List
{
"stellaops",
"replay",
"scoring",
$"--token {token.Value}",
$"--subject {subjectKey}"
};
if (!string.IsNullOrWhiteSpace(configVersion))
{
parts.Add($"--config-version {configVersion.Trim()}");
}
return string.Join(" \\\n+ ", parts);
}
}