YAML library design
AlignTrue uses specific YAML parsing strategies for determinism and compatibility.
Library choice
AlignTrue uses js-yaml for YAML parsing with strict schema validation.
Design principles
- Deterministic parsing - Same YAML produces same IR
- Strict validation - Reject invalid YAML early
- JSON compatibility - YAML subset that maps cleanly to JSON
- No custom types - Avoid YAML tags and anchors
Canonicalization
YAML is canonicalized only at boundaries:
- Lockfile generation (team mode)
Not during normal operations like sync or export.
Error handling
Invalid YAML produces actionable error messages:
Error: Invalid YAML in .aligntrue.yaml at line 12
Expected mapping, got string
Fix: Add proper indentationSee packages/schema/src/validator.ts for implementation.
Last updated on