skillshare icon indicating copy to clipboard operation
skillshare copied to clipboard

`skillshare target` expands YAML anchors under `targets` and `projects`

Open cescox opened this issue 1 month ago • 1 comments

Follow-up to #525: comments survive now, thanks! Anchors don't yet.

targets:
  a:
    skills:
      path: /tmp/a
      include: &shared
        - demo
  b:
    skills:
      path: /tmp/b
      include: *shared

After skillshare target a --add-exclude 'old-*', the anchor is gone and b has its own copy of the list, so the next edit to a no longer reaches b. Anchors under projects: get expanded the same way. Anchors under mcp.projects come through fine, I guess because that section is kept as raw YAML.

Could targets and projects keep them too? Tested on v0.25.5.

cescox avatar Oct 12 '26 20:10 cescox

Thanks for coming back with this after #525, and for the minimal example; it made the anchor case easy to reproduce.

Fixed in #551, which will ship in the next release. Commands that write config.yaml now keep anchors and aliases under targets and projects, the same way they keep comments. Editing the anchored node still reaches every alias, so your a/b example keeps sharing the list. If a command edits an aliased copy (say b) to something different, that one gets its own list and a is left alone. Merge keys (<<: *base and <<: [*a, *b]) are kept as well, and a key you add to or remove from the anchored mapping reaches the mappings that merge it. Two rare forms are still written out: anchors used inside an inline (unanchored) merge source, and a comment written right after an anchor (path: &p # note) moves in front of its key.

Once the release is out, please let me know if your config still comes out different, with the before and after, and I'll take another look.

runkids avatar Oct 13 '26 03:10 runkids