skillshare icon indicating copy to clipboard operation
skillshare copied to clipboard

`config.yaml` loses its comments when a command writes it

Open cescox opened this issue 1 month ago • 2 comments

Split out from #497.

On v0.25.4, skillshare target universal --mode copy --target-naming prefixed wrote the right values to config.yaml but dropped its comments, including marker comments a script of mine relies on (# BEGIN HUMAN-ONLY (generated) / # END HUMAN-ONLY). As confirmed in #497, this happens with every command that writes the config.

Expected: writing a key leaves the rest of the file unchanged, comments included.

cescox avatar Oct 11 '26 11:10 cescox

Thanks for the clear report, and for testing the migration on your real setup first; that is what surfaced this.

Fixed in v0.25.5. Every command that writes config.yaml (and registry.yaml) now keeps the comments it finds there: head comments, inline comments, and ones with odd spacing or no space after #. A comment on a key the command removes is kept too; it moves in front of the next key, or to the end of its section. Two things the write still normalizes, so you know what to expect: top-level section order and the blank lines between sections.

Your # BEGIN HUMAN-ONLY (generated) / # END HUMAN-ONLY case is covered by a test and an end-to-end run of target --mode copy --target-naming prefixed. If anything in your file still comes out different, please reopen this with the before and after and I'll look at it right away.

runkids avatar Oct 11 '26 14:10 runkids

Confirmed on v0.25.5: comments and our marker blocks survive skillshare target … --add-exclude. Thanks. One thing left: that command expands YAML anchors (include: *global) into separate lists, while plugin add keeps them.

cescox avatar Oct 11 '26 21:10 cescox