Skip to content

Add typed JSON output to theme push - #8647

Open
gonzaloriestra wants to merge 1 commit into
gonzalo/json-theme-renamefrom
gonzalo/json-theme-push
Open

gonzaloriestra wants to merge 1 commit into
gonzalo/json-theme-renamefrom
gonzalo/json-theme-push

Conversation

@gonzaloriestra

@gonzaloriestra gonzaloriestra commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

WHY are these changes introduced?

Related to https://github.com/shop/issues-develop/issues/23693

theme push has JSON output, but its result schema is not discoverable and execution chooses the final presentation. Strict checks and multiple environments can also produce several JSON documents on stdout.

WHAT is this pull request doing?

Add status: "success" when all upload operations succeed, or status: "failed" when any upload operation fails. A failed result can still contain a theme and partially uploaded files; the existing warning and error details remain available. Each environment has its own status.

Return typed transfer data and move final output into a validating codec and presenter. Keep compact JSON formatting, optional warnings/errors, terminal text, publish behavior, and the exported push() compatibility adapter. Progress and strict-check diagnostics use typed side events.

Normal output:

The theme 'MyTheme' (#1) was pushed successfully.

Matching JSON:

{
  "status": "success",
  "theme": {
    "id": 1,
    "name": "MyTheme",
    "role": "unpublished",
    "shop": "example.myshopify.com",
    "editor_url": "https://example.myshopify.com/admin/themes/1/editor",
    "preview_url": "https://example.myshopify.com?preview_theme_id=1"
  }
}

Draft contract for review: multiple environments produce one array in requested order. Each entry includes environment. Environments that throw, are skipped, or are cancelled are omitted; diagnostics go to stderr. Completed uploads with file errors remain in the array with status: "failed". No completed environment results produces []. Existing exit behavior stays unchanged, including partial and total environment failures. Single-environment cancellation still emits no success result.

The shared collector preserves store sequencing and waits for analytics cleanup before collecting successful results. JSON execution bypasses the terminal concurrency renderer to avoid escape sequences in stderr. The exported programmatic wrapper retains its existing strict-check output; the CLI uses side events.

Refresh the upload progress title when the upload finishes, so the completed event reports 100% even when the last polling update happened earlier.

How to manually test your changes?

pnpm shopify theme push --help
pnpm shopify theme push --json-schema
pnpm shopify theme push --store example.myshopify.com --theme MyTheme --unpublished --path ./theme --json
pnpm shopify theme push --store example.myshopify.com --theme MyTheme --unpublished --path ./theme --strict --json
pnpm shopify theme push --environment staging --environment production --force --json

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes
  • I've considered analytics changes to measure impact
  • A single changeset for all theme migrations is added in the last PR, #8682.

@github-actions github-actions Bot added the Area: @shopify/cli @shopify/cli package issues label Sep 24, 2026
@gonzaloriestra gonzaloriestra changed the title gonzalo/json theme push Add typed JSON output to theme push Sep 24, 2026
@gonzaloriestra
gonzaloriestra added this pull request to stack #8650 September 24, 2026 09:31
@gonzaloriestra
gonzaloriestra removed this pull request from stack #8650 September 24, 2026 10:04
@gonzaloriestra
gonzaloriestra changed the base branch from main to gonzalo/json-theme-rename September 24, 2026 10:05
@gonzaloriestra
gonzaloriestra added this pull request to stack #8655 September 24, 2026 10:05
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/json-theme-push branch 2 times, most recently from 96095dc to ff21d01 Compare September 24, 2026 10:25
@github-actions github-actions Bot added no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users. and removed Area: @shopify/cli @shopify/cli package issues labels Sep 24, 2026
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/json-theme-push branch 2 times, most recently from a17bb51 to e719f0c Compare September 24, 2026 14:21
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/json-theme-push branch 2 times, most recently from 8afadb0 to 5c4a5e5 Compare September 25, 2026 11:43
@gonzaloriestra
gonzaloriestra marked this pull request as ready for review September 25, 2026 11:56
@gonzaloriestra
gonzaloriestra requested review from a team as code owners September 25, 2026 11:56
@gonzaloriestra
gonzaloriestra removed this pull request from stack #8655 September 25, 2026 12:28
@gonzaloriestra
gonzaloriestra added this pull request to stack #8673 September 25, 2026 12:29
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/json-theme-push branch 2 times, most recently from f8fd1ed to c689639 Compare September 28, 2026 10:25
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/json-theme-push branch 2 times, most recently from 01f9e27 to 59a30f0 Compare September 29, 2026 11:11
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/json-theme-push branch 2 times, most recently from 81490b0 to 4a678df Compare September 29, 2026 13:44
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/json-theme-push branch from ae8d031 to 4b54221 Compare October 1, 2026 08:52
@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Differences in type declarations

We 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:

  • Some seemingly private modules might be re-exported through public modules.
  • If the branch is behind main you might see odd diffs, rebase main into this branch.

New type declarations

We found no new type declarations in this PR

Existing type declarations

packages/cli-kit/dist/public/node/base-command.d.ts
@@ -35,6 +35,7 @@ declare abstract class BaseCommand extends Command {
         argv: string[];
     }>;
     protected environmentsFilename(): string | undefined;
+    protected validateNonTTYFlags(flags: FlagOutput): void;
     protected failMissingNonTTYFlags(flags: FlagOutput, requiredFlags: string[]): void;
     private failMissingNonTTYFlagRequirements;
     private applicableNonTTYFlagRequirements;

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users. shopify.dev preview

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant