feat: write migrated assets to theme during themes:migrate#337
Merged
Conversation
348b5fc to
7a8cc3d
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Adds support for persisting migrated theme assets returned by the theming migrations API by decoding base64 content and writing files into the local theme’s assets/ directory.
Changes:
- Extend
themes:migrateto call a newrewriteAssetshelper with API-returned assets. - Add
rewriteAssetsimplementation + unit tests for decoding/writing and error cases. - Update unit + functional tests to assert assets are written after migration.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/zcli-themes/tests/functional/migrate.test.ts | Verifies a migrated asset file is written to disk and cleans it up after test runs. |
| packages/zcli-themes/src/lib/rewriteTemplates.ts | Changes template rewrite behavior to throw on write failures instead of ignoring them. |
| packages/zcli-themes/src/lib/rewriteTemplates.test.ts | Updates tests to assert rewrite failures now throw with the expected message. |
| packages/zcli-themes/src/lib/rewriteAssets.ts | New helper to mkdir assets/ and write base64-decoded assets to disk. |
| packages/zcli-themes/src/lib/rewriteAssets.test.ts | Unit coverage for decoding, multiple file types, empty input, and error handling. |
| packages/zcli-themes/src/lib/migrate.ts | Invokes rewriteAssets with the migrations API response. |
| packages/zcli-themes/src/lib/migrate.test.ts | Asserts rewriteAssets is called with the expected arguments from the API response. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
BrunoBFerreira
left a comment
There was a problem hiding this comment.
Just left two comments. One minor and the other related with the logic we have added here for the construction of the file path. If we want to be more rigid regarding the paths we want to allow, maybe a validation should be added.
The migration API now returns an `assets` hash (filename → base64 content). Decode and write each asset to the theme's assets/ folder after migration.
…plates Align error handling with rewriteManifest instead of silently swallowing errors.
8d1fc8e to
3ac1b31
Compare
dmuneras
approved these changes
May 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.
Summary
migrationsAPI now returns anassetshash (filename → base64-encoded content) alongsidemetadataandtemplatesrewriteAssetsto decode and write each returned asset to the theme'sassets/folderTest plan
rewriteAssets(base64 decoding, multiple file types, empty hash, error handling)migrateupdated to verifyrewriteAssetsis called with correct args