Files
git.stella-ops.org/docs/features/checked/cli/policy-dsl-compiler-cli.md
2026-02-14 09:11:48 +02:00

42 lines
2.0 KiB
Markdown

# Policy DSL Compiler CLI
## Module
Cli
## Status
VERIFIED
## 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
## Verification
- **Verified**: 2026-02-13T15:30:00Z
- **Tier 0 (Source)**: pass -- all referenced source files exist on disk
- **Tier 1 (Build)**: pass -- module builds cleanly, 412 tests pass in StellaOps.Cli.Commands.Tests
- **Tier 2d (Integration)**: pass -- targeted integration tests confirm behavioral correctness
- **Test Project**: `src/Cli/__Tests/StellaOps.Cli.Commands.Tests/StellaOps.Cli.Commands.Tests.csproj`
- **Evidence**: `docs/qa/feature-checks/runs/cli/policy-dsl-compiler-cli/run-001/tier2-integration-check.json`