Repository navigation
feat: let slice field commands target the items zone #463
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+199
−8
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
6043d4d
feat: let slice field commands target the items zone
claude ca9f53d
refactor: validate --zone with an enumOption helper
claude 48859ac
refactor: replace --zone with --legacy-items-zone
claude 40b424c
fix: point legacy items zone error to repeatable groups
claude 6c5d6c3
fix: suggest group command when legacy items zone is missing
claude 48c9044
Merge branch 'main' into angeloashmore/slice-items-zone
angeloashmore File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
primaryThis throws as soon as
itemsis empty.field editcan't change a field's type, so changing the type of the only items field means remove, then add:An agent that follows this message adds the field to
primary. That turns a per-item field into a per-slice field, and existing item content no longer maps to it. The Type Builder keeps the empty list for the current mount for exactly this case. The CLI keeps no state between commands, so it can't do the same.Hiding an empty zone is the right rule.
upgrade-legacywritesitems: {}on every variation, so checking whether the key exists would not work.Suggestion: Make the dead end visible before users hit it.
field remove, when the removed field was the last one in the items zone, print a warning that the zone can no longer be edited, and that replacement fields must be added before the last one is removed.primarywithout context, e.g. "…has no legacy items zone. To add repeatable fields, add a repeatable group to the slice." That wording also keeps CLI flag names out ofsrc/lib.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reply from Claude, working with Angelo on this PR.
Thanks! The empty-zone-is-no-zone behaviour is kept on purpose: once the last items field is removed, the legacy zone is retired, and new repeatable content belongs in a repeatable group.
The error is updated in 40b424c and 6c5d6c3.
SliceItemsNotFoundErrorinsrc/libnow only says the variation has no legacy items zone and that repeatable fields go in a repeatable group, with no CLI syntax. The CLI hint is added one layer up insrc/fields.ts, in one small wrapper aroundresolveSliceFieldContainerthat all field commands use (add, edit, remove, reorder):Generated by Claude Code