Theme Run CLI workflows
Applies to:0.1.2
Theme Run connects Vite and Shopify CLI inside one run context. Choose a command from the task; build, push, and package are not interchangeable entry points.
| Task | Command | Completion condition |
|---|---|---|
| Local development | dev | Vite and shopify theme dev run together; termination signals are forwarded and Vite closes after Shopify CLI exits |
| Production assets | build | The Vite production build finishes and the production Mixer, layout render tag, and development-client checks pass |
| Push a theme | push | One run completes the build, production verification, and shopify theme push |
| Package a theme | package | Build and verify, package only standard theme directories, and verify the ZIP contents before returning its final path |
| Read diagnostics | doctor | Plugin-owned state is reported without taking the lock, changing Git, or connecting to a store; any failed check returns exit code 1 |
| Restore the worktree | restore | The Mixer is restored from the Git index and its skip-worktree flag returns to its prior state |
| Merge for a rebuild | merge | Merge full commit SHAs in order; leave the final merge uncommitted so the next build can be included |
Arguments
Every command requires --path <theme> and runs from the Vite project root. Theme Run parses only the command and --path:
dev,push, andpackageforward every other argument unchanged to Shopify CLI, together with the resolved--path. Environments, stores, remote Theme IDs, authentication, and option validation stay with Shopify CLI.buildandrestoreaccept no Shopify options.doctoraccepts only--json, which returns stable diagnostic codes.mergeaccepts full commit SHAs, not Shopify CLI options.
Version 0.1 removed the old local --theme and forced --env options. Use --path and Shopify CLI's native --environment.
See the repository Theme Run CLI reference for the installed version's exact behavior. In automation, invoke the command that owns the whole task rather than running a detached Vite build and assuming a later push shares its protected context.
Use doctor to inspect a blocked state and restore to end a development Mixer state deliberately. Diagnostics do not modify Git; restoration does, and it requires the Git index to hold the current production Mixer.
Package a distributable theme
shopify-theme package --path theme-frame builds and checks the theme, then packages a temporary copy containing only standard Shopify theme directories. Engineering instructions, tooling, source maps, and development metadata stay out of the ZIP. Before delivery, the command compares archive entries with the packaged files byte for byte. A mismatch fails the command. The completed ZIP is moved back to the Theme Target and its final path is printed.
Merge before rebuilding
shopify-theme merge --path theme-ci <demo-sha> <source-sha> merges full commit SHAs into the target’s current branch in the given order. It commits each merge except the last, allowing you to build and include regenerated assets in that final merge commit.
This command changes Git state. Review the inputs and start with a clean target worktree. Conflicts limited to plugin-generated assets and the Mixer use the current branch’s version, or its absence, and are reported; rebuild those outputs afterward. Source conflicts and other Git failures stop the command. Inspect the reported Git state and resolve or abort the merge before continuing. merge does not build, push, or publish the theme.
Configuration ownership
Separate host Vite settings, plugin responsibilities, and Shopify CLI options so each fact has one owner, with every plugin option and its default.
Mixer Snippet and Git
Understand development and production Mixer forms, the Git-index prerequisite, and restoration after an interrupted run.