Why
YAML files and generated YAML streams can accumulate inconsistent indentation, comments, flow presentation, directives, and scalar styles. Automation needs a safe way to normalize presentation without losing YAML-only representation details that cannot be projected through PowerShell objects.
What
A public formatter that accepts complete YAML text or line-oriented pipeline input and returns one deterministic YAML stream. Formatting preserves document boundaries, empty documents, node kinds, scalar content, effective tags, anchors and aliases, recursive graphs, complex keys, collection structure, and mapping order.
Acceptance criteria
Format-Yaml accepts string[] pipeline input, joins records with LF, and returns exactly one string
- Output uses explicit document starts, configurable indentation, LF line endings, and no final newline
- Comments, directives, document-end markers, flow presentation, scalar styles, and source anchor names are normalized deterministically
- Formatting is byte-idempotent at the same options
- Parser safety controls and classified YAML failures match
ConvertFrom-Yaml
- The official 402-input YAML corpus verifies representation preservation, valid reparse, invalid rejection, and idempotence without changing existing corpus surfaces
- Public help, generated documentation, examples, exports, source tests, artifact tests, analysis, and site builds include the formatter
Why
YAML files and generated YAML streams can accumulate inconsistent indentation, comments, flow presentation, directives, and scalar styles. Automation needs a safe way to normalize presentation without losing YAML-only representation details that cannot be projected through PowerShell objects.
What
A public formatter that accepts complete YAML text or line-oriented pipeline input and returns one deterministic YAML stream. Formatting preserves document boundaries, empty documents, node kinds, scalar content, effective tags, anchors and aliases, recursive graphs, complex keys, collection structure, and mapping order.
Acceptance criteria
Format-Yamlacceptsstring[]pipeline input, joins records with LF, and returns exactly one stringConvertFrom-Yaml