Add typed JSON output to theme delete - #8651
gonzaloriestra wants to merge 1 commit into
Conversation
8039b3f to
989d6ce
Compare
989d6ce to
67f7391
Compare
67f7391 to
184ceb6
Compare
14b3b11 to
e01e3ae
Compare
e01e3ae to
1f1fabf
Compare
4ddf016 to
4add04e
Compare
4add04e to
00f02a7
Compare
00f02a7 to
8483445
Compare
8483445 to
aa6488e
Compare
aa6488e to
1a5fd2e
Compare
| 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)}) |
There was a problem hiding this comment.
Let's include also status: success in the result, maybe abstract it to a shared "status" schema for other commands to reuse?
There was a problem hiding this comment.
It can be a zod.literal
There was a problem hiding this comment.
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.
1a5fd2e to
cac1848
Compare
0839570 to
e1f838f
Compare
e1f838f to
129ce9b
Compare
129ce9b to
2a2bd4b
Compare
2a2bd4b to
d0abe86
Compare
d0abe86 to
f665300
Compare
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/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;
|
WHY are these changes introduced?
theme deletehas 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:
Matching JSON:
{ "status": "success", "themes": [ { "id": 1, "name": "Original", "role": "unpublished", "processing": false, "createdAtRuntime": false, "shop": "example.myshopify.com" } ] }The optional
srcfield 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?
Checklist