Skip to content

Conversation

@dsillman2000
Copy link
Owner

@dsillman2000 dsillman2000 commented Feb 8, 2026

CLI I/O Mode Change

Overview

Refactored the CLI tool to output JSON instead of YAML for better interoperability and deterministic formatting. For consistency, the tool now reads exclusively from stdin and writes to stdout.

Changes Made

1. Output Format Changed

  • Before: Outputs YAML with ruamel.yaml formatting
  • After: Outputs JSON with sorted keys and 2-space indentation

2. Simplified Interface

  • Removed file I/O arguments (-i/--input, -o/--output)
  • Now reads exclusively from stdin and writes to stdout
  • Eliminated dependency on ruamel.yaml

Benefits

  1. Deterministic Output: JSON provides consistent key ordering
  2. Interoperability: JSON is widely supported across programming languages
  3. Simplified Usage: Single-purpose tool (stdin -> stdout)
  4. Reduced Dependencies: Removes ruamel.yaml dependency

Usage Example

# Before
yref-compile -i input.yaml -o output.yaml

# After
cat input.yaml | yref-compile > output.json

Testing

The core functionality remains unchanged - only the output format differs. The !reference tag resolution logic in YAMLReference class is unaffected.

@dsillman2000 dsillman2000 merged commit 2daa871 into main Feb 8, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant