Repository navigation
[Feature] Add Dev Instance support to theme dev - #8976
Open
isaacroldan wants to merge 4 commits into
Open
isaacroldan wants to merge 4 commits into
isaacroldan wants to merge 4 commits into
Conversation
isaacroldan
added this pull request to stack #8953
October 22, 2026 08:41
isaacroldan
force-pushed
the
codex/theme-dev-instance
branch
from
October 22, 2026 16:06
5bbee4e to
ef7d27a
Compare
Contributor
Differences in type declarationsWe detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:
New type declarationsWe found no new type declarations in this PR Existing type declarationspackages/cli-kit/dist/private/node/dev-instance-output.d.ts@@ -2,18 +2,18 @@ import { zod } from '../../public/node/schema.js';
import { Writable, type WritableOptions } from 'stream';
export declare const devInstanceLogOutputSchema: import("../../public/node/json-output-schema.js").JsonOutputSchema<zod.ZodObject<{
timestamp: zod.ZodString;
- source: zod.ZodString;
+ source: zod.ZodOptional<zod.ZodString>;
level: zod.ZodOptional<zod.ZodEnum<["debug", "info", "warning", "error"]>>;
message: zod.ZodString;
}, "strict", zod.ZodTypeAny, {
- source: string;
message: string;
timestamp: string;
+ source?: string | undefined;
level?: "info" | "error" | "debug" | "warning" | undefined;
}, {
- source: string;
message: string;
timestamp: string;
+ source?: string | undefined;
level?: "info" | "error" | "debug" | "warning" | undefined;
}>>;
/** One line of a dev instance's JSON Lines log. */
@@ -30,7 +30,7 @@ export declare function createDevInstanceOutput({ logFile, logOutput, isActive,
timestamp?: string;
}) => Promise<void>;
tee: (target: Writable, { source, stringWritesAreMessages }: {
- source: string;
+ source?: string;
stringWritesAreMessages?: boolean;
}) => DevInstanceOutput;
flush: () => Promise<PromiseSettledResult<void>[]>;
packages/cli-kit/dist/public/node/dev-instance.d.ts@@ -80,7 +80,8 @@ export interface DevInstance {
* The returned stream forwards the original bytes to `target` unchanged.
*/
tee: (target: Writable, options: {
- source: string;
+ /** Omit the source field when the stream does not need to distinguish producers. */
+ source?: string;
/** Treat each string write as a complete message. Byte writes remain buffered into lines. */
stringWritesAreMessages?: boolean;
}) => Writable;
|
This branch has not been deployed
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.
WHY are these changes introduced?
Fixes https://github.com/shop/issues-develop/issues/24318
Agents cannot find a running
theme devsession or read its output after the command starts in another terminal.WHAT is this pull request doing?
Use Dev Instance to record the session, preview URLs, and JSONL logs under the theme's
.shopify/dev/directory. Ownership uses the store and theme ID, so a duplicate start can report the existing session. Acquisition stays in the service.Capture theme messages and setup progress through their current output path. Theme log records contain
timestampandmessage, without repeating asourcefield. The shared log schema allows this field to be omitted; app-dev continues to include its process sources. On Ctrl+C, SIGTERM, or loss of instance ownership, cancel dev work and drain queued output before releasing the instance. This also adds cancellation for the file watcher, theme-editor polling, and session refresh timer.This PR does not add
theme dev --json.The shared agent workflow is in
docs/cli/dev-instance-agent-workflow.md, with separate app and theme sections.How to manually test your changes?
pnpm shopify theme dev --path /path/to/theme --store your-store.myshopify.com --theme DEVELOPMENT_THEME_ID./path/to/theme/.shopify/dev/. Check the store, theme ID, status, and preview URLs. Open itslogFile, change a theme asset, and visit the local preview. Confirm that sync messages and request lines appear in the terminal and log.Validation and stress tests
Checklist