Skip to content

feat(core): add --convert-flow-to-block option#409

Draft
looztra wants to merge 2 commits into
mainfrom
claude/intelligent-hypatia-zSW1B
Draft

feat(core): add --convert-flow-to-block option#409
looztra wants to merge 2 commits into
mainfrom
claude/intelligent-hypatia-zSW1B

Conversation

@looztra

@looztra looztra commented May 24, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds a new -b / --convert-flow-to-block CLI flag that converts flow-style (JSON-style) sequences and mappings to block style during formatting
  • Implements convert_flow_to_block_style() in helpers.py — recursively walks CommentedMap / CommentedSeq nodes and calls set_block_style() on each
  • Wires the flag through YamkixConfig, create_yamkix_config_from_typer_args(), and yamkix_dump_all() / round_trip_and_format()

Test plan

  • tests/test_helpers.py — unit tests for convert_flow_to_block_style covering sequences, mappings, nested structures, already-block-style inputs, and scalar pass-through
  • tests/test_yamkix.py — integration tests confirming flow→block conversion changes content (unchanged=False) and that block input with flag disabled stays unchanged
  • tests/test_cli.py — verifies convert_flow_to_block is passed through to create_yamkix_config_from_typer_args
  • tests/test_config.py — verifies the flag is present in YamkixConfig and plumbed through get_yamkix_config_from_default / create_yamkix_config_from_typer_args
  • All 172 tests pass; linters (ruff, ty, pylint, pyright) all clean

…elements to block style

Closes #278. When --convert-flow-to-block (-b) is set, yamkix recursively
walks the parsed YAML structure and calls fa.set_block_style() on any
CommentedMap or CommentedSeq that was loaded in flow style, converting
constructs like [a, b, c] and {key: val} to their block equivalents
before the dump pass.

https://claude.ai/code/session_01N1AMyP46KHiaVtprAKgNFh
@codecov

codecov Bot commented May 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.04%. Comparing base (9b7be30) to head (b1a11ce).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #409      +/-   ##
==========================================
+ Coverage   95.90%   96.04%   +0.13%     
==========================================
  Files          10       10              
  Lines         342      354      +12     
  Branches       58       63       +5     
==========================================
+ Hits          328      340      +12     
  Misses         12       12              
  Partials        2        2              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

…k option (#410)

$(cat <<'EOF'
## Summary

- Adds `tests/data/source/flow-sequences-and-maps.yml` — a source
fixture covering flow sequences, flow mappings, nested flow structures,
and already-block-style content
- Adds
`tests/data/expected/flow-sequences-and-maps--convert-flow-to-block.yml`
— expected output after applying `--convert-flow-to-block`
- Adds
`tests/data/expected/lists-and-maps-json-style--convert-flow-to-block.yml`
— expected output for the existing JSON-style source with
`--convert-flow-to-block`
- Wires two new `pytest.param` entries into
`TestNonRegression.test_config` in `tests/test_non_regression.py`

Total test count: 172 → 174 (all passing).

## Test plan

- [x] `uv run poe test` — 174 tests pass
- [x] `uv run poe lint:all` — ruff, ty, pylint, pyright all clean

https://claude.ai/code/session_01Q5mujYy8DSeij4XpXDJQV8
EOF
)

---
_Generated by [Claude
Code](https://claude.ai/code/session_01Q5mujYy8DSeij4XpXDJQV8)_

Co-authored-by: Claude <noreply@anthropic.com>
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.

2 participants