feat: Implement IsolatedReplayContext for deterministic audit replay
- Added IsolatedReplayContext class to provide an isolated environment for replaying audit bundles without external calls. - Introduced methods for initializing the context, verifying input digests, and extracting inputs for policy evaluation. - Created supporting interfaces and options for context configuration. feat: Create ReplayExecutor for executing policy re-evaluation and verdict comparison - Developed ReplayExecutor class to handle the execution of replay processes, including input verification and verdict comparison. - Implemented detailed drift detection and error handling during replay execution. - Added interfaces for policy evaluation and replay execution options. feat: Add ScanSnapshotFetcher for fetching scan data and snapshots - Introduced ScanSnapshotFetcher class to retrieve necessary scan data and snapshots for audit bundle creation. - Implemented methods to fetch scan metadata, advisory feeds, policy snapshots, and VEX statements. - Created supporting interfaces for scan data, feed snapshots, and policy snapshots.
This commit is contained in:
107
src/Cli/StellaOps.Cli/Output/IOutputWriter.cs
Normal file
107
src/Cli/StellaOps.Cli/Output/IOutputWriter.cs
Normal file
@@ -0,0 +1,107 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
// IOutputWriter.cs
|
||||
// Sprint: SPRINT_3850_0001_0001_oci_storage_cli
|
||||
// Description: Simple console output writer abstraction for CLI commands.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
namespace StellaOps.Cli.Output;
|
||||
|
||||
/// <summary>
|
||||
/// Output writer abstraction for CLI commands.
|
||||
/// </summary>
|
||||
public interface IOutputWriter
|
||||
{
|
||||
/// <summary>
|
||||
/// Write an informational message.
|
||||
/// </summary>
|
||||
void WriteInfo(string message);
|
||||
|
||||
/// <summary>
|
||||
/// Write an error message.
|
||||
/// </summary>
|
||||
void WriteError(string message);
|
||||
|
||||
/// <summary>
|
||||
/// Write a warning message.
|
||||
/// </summary>
|
||||
void WriteWarning(string message);
|
||||
|
||||
/// <summary>
|
||||
/// Write a success message.
|
||||
/// </summary>
|
||||
void WriteSuccess(string message);
|
||||
|
||||
/// <summary>
|
||||
/// Write verbose/debug output.
|
||||
/// </summary>
|
||||
void WriteVerbose(string message);
|
||||
|
||||
/// <summary>
|
||||
/// Write raw output (no formatting).
|
||||
/// </summary>
|
||||
void WriteLine(string message);
|
||||
|
||||
/// <summary>
|
||||
/// Write formatted output with optional label.
|
||||
/// </summary>
|
||||
void WriteOutput(string label, string value);
|
||||
|
||||
/// <summary>
|
||||
/// Write formatted output without label.
|
||||
/// </summary>
|
||||
void WriteOutput(string value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Console-based output writer implementation.
|
||||
/// </summary>
|
||||
public sealed class ConsoleOutputWriter : IOutputWriter
|
||||
{
|
||||
public void WriteInfo(string message)
|
||||
{
|
||||
Console.WriteLine(message);
|
||||
}
|
||||
|
||||
public void WriteError(string message)
|
||||
{
|
||||
Console.ForegroundColor = ConsoleColor.Red;
|
||||
Console.Error.WriteLine($"Error: {message}");
|
||||
Console.ResetColor();
|
||||
}
|
||||
|
||||
public void WriteWarning(string message)
|
||||
{
|
||||
Console.ForegroundColor = ConsoleColor.Yellow;
|
||||
Console.WriteLine($"Warning: {message}");
|
||||
Console.ResetColor();
|
||||
}
|
||||
|
||||
public void WriteSuccess(string message)
|
||||
{
|
||||
Console.ForegroundColor = ConsoleColor.Green;
|
||||
Console.WriteLine(message);
|
||||
Console.ResetColor();
|
||||
}
|
||||
|
||||
public void WriteVerbose(string message)
|
||||
{
|
||||
Console.ForegroundColor = ConsoleColor.DarkGray;
|
||||
Console.WriteLine(message);
|
||||
Console.ResetColor();
|
||||
}
|
||||
|
||||
public void WriteLine(string message)
|
||||
{
|
||||
Console.WriteLine(message);
|
||||
}
|
||||
|
||||
public void WriteOutput(string label, string value)
|
||||
{
|
||||
Console.WriteLine($" {label}: {value}");
|
||||
}
|
||||
|
||||
public void WriteOutput(string value)
|
||||
{
|
||||
Console.WriteLine($" {value}");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user