33 lines
1.5 KiB
Markdown
33 lines
1.5 KiB
Markdown
# Policy DSL Compiler CLI
|
|
|
|
## Module
|
|
Cli
|
|
|
|
## Status
|
|
IMPLEMENTED
|
|
|
|
## Description
|
|
Compile policy DSL files to intermediate representation (IR) with optimization passes, strict mode (warnings as errors), SHA-256 digest output, and validation-only mode.
|
|
|
|
## Implementation Details
|
|
- **Command Group**: `src/Cli/StellaOps.Cli/Commands/PolicyCommandGroup.cs` -- policy commands including compile
|
|
- **Policy DSL**: `src/Policy/StellaOps.PolicyDsl/` -- DSL compiler infrastructure
|
|
- `PolicyCompiler.cs` -- main compiler
|
|
- `PolicyParser.cs` -- DSL parser
|
|
- `PolicyTokenizer.cs` / `DslTokenizer.cs` -- tokenization
|
|
- `PolicyIr.cs` -- intermediate representation
|
|
- `PolicyIrSerializer.cs` -- IR serialization
|
|
- `PolicySyntaxNodes.cs` -- syntax tree nodes
|
|
- `PolicyEngineFactory.cs` -- engine instantiation from compiled policy
|
|
- **Commands**:
|
|
- `stella policy compile <file>` -- compile DSL to IR. Options: `--strict` (warnings as errors), `--digest` (output SHA-256), `--validate-only`, `--output <path>`
|
|
|
|
## E2E Test Plan
|
|
- [ ] Run `stella policy compile ./policy.stella` and verify IR output generated
|
|
- [ ] Run with `--strict` and verify warnings treated as errors
|
|
- [ ] Run with `--digest` and verify SHA-256 digest output
|
|
- [ ] Run with `--validate-only` and verify syntax validation without compilation
|
|
- [ ] Run with `--output ./compiled.ir` and verify IR written to file
|
|
- [ ] Verify error messages include line numbers and descriptive messages
|
|
- [ ] Verify invalid DSL syntax produces clear compilation errors
|