Skip to content

Add typed JSON output to theme delete - #8651

Open
gonzaloriestra wants to merge 1 commit into
gonzalo/json-theme-duplicatefrom
gonzalo/json-theme-delete
Open

gonzaloriestra wants to merge 1 commit into
gonzalo/json-theme-duplicatefrom
gonzalo/json-theme-delete

Conversation

@gonzaloriestra

@gonzaloriestra gonzaloriestra commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

WHY are these changes introduced?

theme delete has no JSON result contract, so automation must parse terminal output.

Part of shop/issues-develop#23692.

WHAT is this pull request doing?

Return status: "success" alongside the deleted themes only after every requested deletion succeeds. Reuse the shared mutation success schema. In multiple environments, the status belongs to each result; the response does not claim overall success when another environment fails.

Return deleted theme data and move final output into a presenter. Add an opt-in result collector to the shared theme runner; this preserves store sequencing and analytics while JSON results are encoded once. JSON environment diagnostics use the shared event channel. Add --json, expose the domain-owned schema, and refresh the manifest, README, and generated docs.

Normal output includes:

The theme 'Original' (#1) was deleted from example.myshopify.com.

Matching JSON:

{
  "status": "success",
  "themes": [
    {
      "id": 1,
      "name": "Original",
      "role": "unpublished",
      "processing": false,
      "createdAtRuntime": false,
      "shop": "example.myshopify.com"
    }
  ]
}

The optional src field is retained when present. Multiple environments return {"environments":[{"environment":"staging","result":...}]} in configured order. Failed or invalid environments are omitted and reported on stderr; total failure returns {"environments":[]}. Existing exit behavior and single-environment presentation are preserved.

How to manually test your changes?

pnpm shopify theme delete --help
pnpm shopify theme delete --json-schema
pnpm shopify theme delete --store "$STORE" --theme "$THEME_ID" --force
pnpm shopify theme delete --store "$STORE" --theme "$THEME_ID" --force --json
pnpm shopify theme delete --environment staging --environment production --theme "$THEME_ID" --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.

@gonzaloriestra
gonzaloriestra added this pull request to stack #8654 September 24, 2026 09:47
@github-actions github-actions Bot added the Area: @shopify/cli @shopify/cli package issues label Sep 24, 2026
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/json-theme-delete branch from 8039b3f to 989d6ce Compare September 24, 2026 10:04
@gonzaloriestra
gonzaloriestra removed this pull request from stack #8654 September 24, 2026 10:04
@gonzaloriestra
gonzaloriestra added this pull request to stack #8655 September 24, 2026 10:05
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/json-theme-delete branch from 989d6ce to 67f7391 Compare September 24, 2026 10:13
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/json-theme-delete branch from 67f7391 to 184ceb6 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-delete branch 2 times, most recently from 14b3b11 to e01e3ae Compare September 24, 2026 13:46
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/json-theme-delete branch from e01e3ae to 1f1fabf Compare September 24, 2026 14:21
@gonzaloriestra
gonzaloriestra marked this pull request as ready for review September 24, 2026 14:22
@gonzaloriestra
gonzaloriestra requested review from a team as code owners September 24, 2026 14:22
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/json-theme-delete branch 2 times, most recently from 4ddf016 to 4add04e Compare September 25, 2026 12:27
@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-delete branch from 4add04e to 00f02a7 Compare September 28, 2026 08:20
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/json-theme-delete branch from 00f02a7 to 8483445 Compare September 28, 2026 10:25
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/json-theme-delete branch from 8483445 to aa6488e Compare September 28, 2026 11:39
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/json-theme-delete branch from aa6488e to 1a5fd2e Compare September 28, 2026 11:51
import {defineJsonOutputSchema} from '@shopify/cli-kit/node/json-output-schema'
import {zod} from '@shopify/cli-kit/node/schema'

const ThemeDeleteResultSchema = zod.object({themes: zod.array(ThemeMutationThemeSchema)})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's include also status: success in the result, maybe abstract it to a shared "status" schema for other commands to reuse?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be a zod.literal

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added status: zod.literal('success') through the shared ThemeMutationSuccessSchema, introduced in #8640 and reused by delete, publish, and rename. Delete returns success only after all requested deletions succeed. Multiple environments carry the status per result, without claiming overall success.

@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/json-theme-delete branch from 1a5fd2e to cac1848 Compare September 29, 2026 10:28
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/json-theme-delete branch 2 times, most recently from 0839570 to e1f838f Compare September 29, 2026 11:38
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/json-theme-delete branch from e1f838f to 129ce9b Compare September 29, 2026 13:44
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/json-theme-delete branch from 129ce9b to 2a2bd4b Compare September 29, 2026 14:18
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/json-theme-delete branch from 2a2bd4b to d0abe86 Compare September 29, 2026 14:40
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/json-theme-delete branch from d0abe86 to f665300 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.

2 participants