- Implemented PolicyDslValidator with command-line options for strict mode and JSON output. - Created PolicySchemaExporter to generate JSON schemas for policy-related models. - Developed PolicySimulationSmoke tool to validate policy simulations against expected outcomes. - Added project files and necessary dependencies for each tool. - Ensured proper error handling and usage instructions across tools.
		
			
				
	
	
		
			57 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			57 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
using StellaOps.Policy;
 | 
						|
 | 
						|
if (args.Length == 0)
 | 
						|
{
 | 
						|
    Console.Error.WriteLine("Usage: policy-dsl-validator [--strict] [--json] <path-or-glob> [<path-or-glob> ...]");
 | 
						|
    Console.Error.WriteLine("Example: policy-dsl-validator --strict docs/examples/policies");
 | 
						|
    return 64; // EX_USAGE
 | 
						|
}
 | 
						|
 | 
						|
var inputs = new List<string>();
 | 
						|
var strict = false;
 | 
						|
var outputJson = false;
 | 
						|
 | 
						|
foreach (var arg in args)
 | 
						|
{
 | 
						|
    switch (arg)
 | 
						|
    {
 | 
						|
        case "--strict":
 | 
						|
        case "-s":
 | 
						|
            strict = true;
 | 
						|
            break;
 | 
						|
 | 
						|
        case "--json":
 | 
						|
        case "-j":
 | 
						|
            outputJson = true;
 | 
						|
            break;
 | 
						|
 | 
						|
        case "--help":
 | 
						|
        case "-h":
 | 
						|
        case "-?":
 | 
						|
            Console.WriteLine("Usage: policy-dsl-validator [--strict] [--json] <path-or-glob> [<path-or-glob> ...]");
 | 
						|
            Console.WriteLine("Example: policy-dsl-validator --strict docs/examples/policies");
 | 
						|
            return 0;
 | 
						|
 | 
						|
        default:
 | 
						|
            inputs.Add(arg);
 | 
						|
            break;
 | 
						|
    }
 | 
						|
}
 | 
						|
 | 
						|
if (inputs.Count == 0)
 | 
						|
{
 | 
						|
    Console.Error.WriteLine("No input files or directories provided.");
 | 
						|
    return 64; // EX_USAGE
 | 
						|
}
 | 
						|
 | 
						|
var options = new PolicyValidationCliOptions
 | 
						|
{
 | 
						|
    Inputs = inputs,
 | 
						|
    Strict = strict,
 | 
						|
    OutputJson = outputJson,
 | 
						|
};
 | 
						|
 | 
						|
var cli = new PolicyValidationCli();
 | 
						|
var exitCode = await cli.RunAsync(options, CancellationToken.None);
 | 
						|
return exitCode;
 |