feat: add prismic slice upgrade-legacy - #388
Merged
Merged
Conversation
Legacy Builder repositories have legacy slices inside slice zones. The CLI and the Type Builder cannot edit them. This command converts them to shared slices, the same way as the Slice Machine upgrader. - Without arguments, it lists legacy slices and a command for each. - With an ID, it creates a shared slice, adds a variation with --to, or merges into an identical variation. - It writes `legacyPaths`, so Prismic serves old content as the new shared slice. - It tells the developer how the content shape changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H4jg7fmGVLhLJjo27eC7Mj
`prismic init` stopped with an error when a repository used the Legacy Builder, and only support could fix it. It now turns on the Type Builder with the new wroom endpoint and saves the detected framework. Only an administrator can do this. After the models sync, init tells the developer how many legacy slices need conversion with `prismic slice migrate`. The endpoint is POST /app/settings/enableTypeBuilder in wroom. Deploy it before this change is released. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H4jg7fmGVLhLJjo27eC7Mj
- Remove the --id option. --to covers slices with the same ID. - Compare fields with isDeepStrictEqual. - Print one line for the content change and one for the next step. - Remove the temporary state in init. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H4jg7fmGVLhLJjo27eC7Mj
Call PATCH /repository/type-builder in obelix instead of a new wroom endpoint. Also call it when the saved framework is not the project's framework, because the editor shows code snippets for that framework. If only the framework is wrong and the user is not an administrator, init shows a warning and continues. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H4jg7fmGVLhLJjo27eC7Mj
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H4jg7fmGVLhLJjo27eC7Mj
Replaces `slice migrate` with `slice upgrade-legacy <id> --from <type>`. The slice zone defaults to "body", invalid legacy IDs are converted, and `--to` targets a new or existing slice. When the target slice already exists, the error lists the options so agents ask the user. `slice list`, `type view`, `status`, and `init` now point at legacy slices, and editing commands explain how to upgrade one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H4jg7fmGVLhLJjo27eC7Mj
Throws a `CommandError` for legacy slices instead of a new error class. `getLegacySlices` returns the slice zone, so the upgrade edits it directly. Tests share one legacy type fixture. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H4jg7fmGVLhLJjo27eC7Mj
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H4jg7fmGVLhLJjo27eC7Mj
1 of 3 tasks
prismic slice upgrade-legacy
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H4jg7fmGVLhLJjo27eC7Mj
`slice list` marks legacy slices with * and shows the type that defines them. `slice list --legacy` lists only legacy slices. `type view` lists the slices in each slice zone and marks legacy ones. Commands that edit a slice now say when the slice is a legacy slice. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H4jg7fmGVLhLJjo27eC7Mj
1 of 3 tasks
angeloashmore
changed the base branch from
main
to
claude/focused-pascal-2fffvf-legacy
October 1, 2026 00:48
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H4jg7fmGVLhLJjo27eC7Mj
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H4jg7fmGVLhLJjo27eC7Mj
angeloashmore
marked this pull request as ready for review
October 1, 2026 01:02
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 0a828f6. Configure here.
When the target slice ID was the key of a different legacy slice in the same slice zone, the upgrade removed that legacy slice from the zone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H4jg7fmGVLhLJjo27eC7Mj
…-2fffvf # Conflicts: # src/adapters/index.ts # src/commands/slice-list.ts # src/commands/type-view.ts # src/lib/prismic/models.ts # test/slice-list.test.ts # test/slice-view.test.ts
The help text and the "slice already exists" error no longer tell the reader to ask the user. They say that combining slices is a choice for the project's owner, which keeps agents from deciding on their own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H4jg7fmGVLhLJjo27eC7Mj
lihbr
approved these changes
Oct 1, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

Resolves: DT-3535
Description
Before this PR, only Slice Machine's
/labsupgrader could upgrade legacy slices, the slices that the Legacy Builder defines inside a type.After this PR,
prismic slice upgrade-legacyupgrades one legacy slice at a time and says how its content changes.status,init, and the commands from #390 point at it. Content in Prismic does not change: the Content API returns upgraded slices throughlegacyPaths.People and AI agents both run this command. When the right choice is unclear, the command lists the options and leaves the choice to the project's owner:
prismic initturning on the Type Builder is in #389.Checklist
Preview
How to QA 1
In a project with legacy slices, run
npx prismic slice list --legacy, thennpx prismic slice upgrade-legacy <id> --from <type>. The evals "upgrades a legacy slice" and "asks before combining legacy slices" cover the agent flow.🤖 Generated with Claude Code
https://claude.ai/code/session_01H4jg7fmGVLhLJjo27eC7Mj
Note
Medium Risk
Changes custom type and slice models and editor-facing slice zones; mistakes in merge/variation or
legacyPathscould mis-map live content until components are updated and pushed.Overview
Adds
prismic slice upgrade-legacyso legacy slices embedded in custom types can be converted to SharedSlice models locally, withlegacyPathswired for content compatibility afterprismic push.The command supports
--from, optional--slice-zone,--to, and--variation(new slice, merge into an existing variation, or add as a variation). When a target slice already exists, it fails with guided options instead of picking a modeling choice.getLegacySlicesnow carries the slice zone for updating zone choices in place.init,status,slice list,type view, andgetSlicemessaging now point at upgrade instead of “cannot edit legacy slices.” Agent evals cover single-type upgrades and asking before combining duplicate legacy IDs across types.Coverage includes unit/integration tests and an isolated-repo push test.
Reviewed by Cursor Bugbot for commit c47782a. Bugbot is set up for automated code reviews on this repo. Configure here.
Footnotes
Please use these labels when submitting a review:
⚠️ #issue: Strongly suggest a change.
❓ #ask: Ask a question.
💡 #idea: Suggest an idea.
🎉 #nice: Share a compliment. ↩