You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Request
Desired capability
Provide a public formatter that accepts complete YAML text or line-oriented pipeline input and returns one deterministic YAML stream. Formatting must preserve 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
Technical decisions
Representation path: Parse with the repository-owned YAML parser and emit directly from the representation graph. PowerShell object projection is not used because it cannot preserve unknown tags, explicit standard tags, complex keys, empty documents, or recursive alias graphs losslessly.
Normalization: Emit deterministic block presentation with one explicit --- marker per document, canonical standard-tag shorthand where available, verbatim effective tags otherwise, and deterministic anchor renaming.
Safety and errors: Reuse parser defaults, ranges, duplicate-key policy, and classified terminating errors without broad fallback handling.
Conformance: Compare canonical representation events and node identity before and after formatting, require valid reparse and byte-identical second formatting, and classify duplicate representation-key cases from parser behavior rather than case IDs.
Implementation plan
Core
Add direct representation-to-emission graph conversion
Add deterministic effective-tag and anchor emission
Add the public Format-Yaml advanced function and parser safety parameters
Export the command in the generated module package
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.
Request
Desired capability
Provide a public formatter that accepts complete YAML text or line-oriented pipeline input and returns one deterministic YAML stream. Formatting must preserve 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-YamlTechnical decisions
Representation path: Parse with the repository-owned YAML parser and emit directly from the representation graph. PowerShell object projection is not used because it cannot preserve unknown tags, explicit standard tags, complex keys, empty documents, or recursive alias graphs losslessly.
Normalization: Emit deterministic block presentation with one explicit
---marker per document, canonical standard-tag shorthand where available, verbatim effective tags otherwise, and deterministic anchor renaming.Safety and errors: Reuse parser defaults, ranges, duplicate-key policy, and classified terminating errors without broad fallback handling.
Conformance: Compare canonical representation events and node identity before and after formatting, require valid reparse and byte-identical second formatting, and classify duplicate representation-key cases from parser behavior rather than case IDs.
Implementation plan
Core
Format-Yamladvanced function and parser safety parametersTests
Documentation and delivery
implement-yaml-file-io