Skip to content

Add typed JSON output to theme share - #8649

Draft
gonzaloriestra wants to merge 1 commit into
gonzalo/json-theme-pullfrom
gonzalo/json-theme-share
Draft

gonzaloriestra wants to merge 1 commit into
gonzalo/json-theme-pullfrom
gonzalo/json-theme-share

Conversation

@gonzaloriestra

@gonzaloriestra gonzaloriestra commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

WHY are these changes introduced?

Closes https://github.com/shop/issues-develop/issues/23693

theme share creates a theme but does not declare a JSON flag or expose its result schema.

WHAT is this pull request doing?

Add --json and a discoverable share schema using the push transfer contract. Preserve random theme naming, listing selection, upload warnings/errors, and the existing terminal output.

Normal output:

The theme 'Creative Theme' (#1) was pushed successfully.

Matching JSON:

{
  "theme": {
    "id": 1,
    "name": "Creative Theme",
    "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"
  }
}

Uses the draft multi-environment contract from this stack: one array in requested order, environment names on successful results, failures on stderr, [] when none succeed, and unchanged exit behavior. The shared tests also cover cancellation and analytics cleanup failures across all three commands.

How to manually test your changes?

pnpm shopify theme share --help
pnpm shopify theme share --json-schema
pnpm shopify theme share --store example.myshopify.com --path ./theme --json
pnpm shopify theme share --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, #8643.

@gonzaloriestra
gonzaloriestra added this pull request to stack #8650 September 24, 2026 09:31
@github-actions github-actions Bot added shopify.dev preview Area: @shopify/cli @shopify/cli package issues labels Sep 24, 2026
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/json-theme-share branch from da398e8 to 9ea0fcf Compare September 24, 2026 10:04
@gonzaloriestra
gonzaloriestra removed this pull request from stack #8650 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-share branch from 9ea0fcf to 9ea9818 Compare September 24, 2026 10:13
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/json-theme-share branch from 9ea9818 to 9b471ea 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-share branch from 9b471ea to 6fa7e17 Compare September 24, 2026 11:56
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/json-theme-share branch from 6fa7e17 to 27f1592 Compare September 24, 2026 13:46
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/json-theme-share branch from 27f1592 to 42d54fc Compare September 24, 2026 14:21
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/json-theme-share branch from 42d54fc to 36bed07 Compare September 24, 2026 14:36
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/json-theme-share branch from 36bed07 to 097f129 Compare September 25, 2026 11:43
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/json-theme-share branch from 097f129 to 04d63cb Compare September 25, 2026 11:59
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/json-theme-share branch from 04d63cb to 7c078ff 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
@github-actions

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

packages/cli-kit/dist/private/node/ui/tasks.d.ts
import { TokenizedString } from '../../../public/node/output.js';
export interface Task<TContext = unknown> {
    title: string | TokenizedString;
    task: (ctx: TContext, task: Task<TContext>) => Promise<void | Task<TContext>[]>;
    retry?: number;
    retryCount?: number;
    errors?: Error[];
    skip?: (ctx: TContext) => boolean;
}
export declare function runTasks<TContext>(tasks: Task<TContext>[], onTask?: (task: Task<TContext>) => void): Promise<TContext>;

Existing type declarations

packages/cli-kit/dist/private/node/ui/components/Tasks.d.ts
@@ -1,14 +1,7 @@
 import { AbortSignal } from '../../../../public/node/abort.js';
-import { TokenizedString } from '../../../../public/node/output.js';
+import { Task } from '../tasks.js';
 import React from 'react';
-export interface Task<TContext = unknown> {
-    title: string | TokenizedString;
-    task: (ctx: TContext, task: Task<TContext>) => Promise<void | Task<TContext>[]>;
-    retry?: number;
-    retryCount?: number;
-    errors?: Error[];
-    skip?: (ctx: TContext) => boolean;
-}
+export type { Task } from '../tasks.js';
 interface TasksProps<TContext> {
     tasks: Task<TContext>[];
     silent?: boolean;

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