Skip to content

Add typed JSON output to theme package - #8922

Open
gonzaloriestra wants to merge 5 commits into
gonzalo/json-theme-profilefrom
gonzalo/json-theme-package
Open

gonzaloriestra wants to merge 5 commits into
gonzalo/json-theme-profilefrom
gonzalo/json-theme-package

Conversation

@gonzaloriestra

@gonzaloriestra gonzaloriestra commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Original PR and review history: #8683.

WHY are these changes introduced?

Fixes https://github.com/shop/issues-develop/issues/23694

Packaging needs a machine-readable artifact receipt.

WHAT is this pull request doing?

Return a strict JSON artifact result with a validated absolute path to the ZIP actually written, while preserving the text presenter.

The public output follows docs/cli/json-output.md; explicitly named environments use one {environments: [...]} object.

How to manually test your changes?

shopify theme package --path . --json
shopify theme package --json-schema

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
  • The change is user-facing — I've identified the correct bump type (patch for bug fixes · minor for new features · major for breaking changes) and added a changeset with pnpm changeset add

@gonzaloriestra
gonzaloriestra added this pull request to stack #8925 October 15, 2026 12:34
@github-actions github-actions Bot added shopify.dev preview no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users. labels Oct 15, 2026
@gonzaloriestra gonzaloriestra changed the title gonzalo/json theme package Add typed JSON output to theme package Oct 15, 2026
@gonzaloriestra
gonzaloriestra marked this pull request as ready for review October 15, 2026 12:42
@gonzaloriestra
gonzaloriestra requested review from a team as code owners October 15, 2026 12:42
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/json-theme-package branch from 844e899 to c193fc0 Compare October 15, 2026 13:33
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/json-theme-package branch 2 times, most recently from 9cf7b1e to b737087 Compare October 15, 2026 14:10
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/json-theme-package branch from b737087 to 419b25d Compare October 15, 2026 14:33
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/json-theme-package branch from 419b25d to 3c93b2a Compare October 15, 2026 15:11
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/json-theme-package branch from 3c93b2a to d4a4e0e Compare October 15, 2026 16:13
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Potential Breaking Changes Detected

This PR contains changes that may break the existing contract.

@shopify/dev_experience — this PR contains breaking changes that require coordination for the next major release.

📦 Major Version Changesets

The following changesets request a major version bump:

Changeset Package
theme-check-json-contract.md '@shopify/cli': major
theme-duplicate-json-contract.md '@shopify/cli': major
theme-info-json-contract.md '@shopify/cli': major
theme-list-json-contract.md '@shopify/cli': major
theme-open-json-contract.md '@shopify/cli': major
theme-preview-json-contract.md '@shopify/cli': major
theme-profile-environments.md '@shopify/cli': major
theme-push-json-contract.md "@shopify/cli": major

@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

We found no new type declarations in this PR

Existing type declarations

packages/cli-kit/dist/private/node/constants.d.ts
@@ -8,7 +8,7 @@ export declare const environmentVariables: {
     env: string;
     noAnalytics: string;
     optOutInstrumentation: string;
-    serviceAccountToken: string;
+    organizationAutomationToken: string;
     appAutomationToken: string;
     partnersToken: string;
     runAsUser: string;
packages/cli-kit/dist/public/node/base-command.d.ts
@@ -1,4 +1,5 @@
 import { type JsonOutputSchema } from './json-output-schema.js';
+import { JsonMap } from '../../private/common/json.js';
 import { Command } from '@oclif/core';
 import { OutputFlags, Input, ParserOutput, FlagInput, OutputArgs } from '@oclif/core/parser';
 export type ArgOutput = OutputArgs<any>;
@@ -20,6 +21,7 @@ declare abstract class BaseCommand extends Command {
     static descriptionWithoutMarkdown(): string | undefined;
     static analyticsNameOverride(): string | undefined;
     static analyticsStopCommand(): string | undefined;
+    private jsonOutputFromFlags;
     catch(error: Error & {
         skipOclifErrorHandling: boolean;
     }): Promise<void>;
@@ -34,7 +36,10 @@ declare abstract class BaseCommand extends Command {
     }, TGlobalFlags extends FlagOutput, TArgs extends ArgOutput>(options?: Input<TFlags, TGlobalFlags, TArgs>, argv?: string[]): Promise<ParserOutput<TFlags, TGlobalFlags, TArgs> & {
         argv: string[];
     }>;
+    protected runWithParsedOutput<T>(flags: FlagOutput, execute: () => T): T;
     protected environmentsFilename(): string | undefined;
+    protected parseEnvironmentFlags<TFlags extends FlagOutput, TGlobalFlags extends FlagOutput, TArgs extends ArgOutput>(environment: JsonMap, options: Input<TFlags, TGlobalFlags, TArgs>, explicitFlags: FlagOutput): Promise<FlagOutput>;
+    protected validateNonTTYFlags(flags: FlagOutput): void;
     protected failMissingNonTTYFlags(flags: FlagOutput, requiredFlags: string[]): void;
     private failMissingNonTTYFlagRequirements;
     private applicableNonTTYFlagRequirements;
packages/cli-kit/dist/public/node/environment.d.ts
@@ -11,9 +11,9 @@
 export declare function getEnvironmentVariables(): NodeJS.ProcessEnv;
 /**
  * Returns the automation token the CLI authenticates with, from the first of these variables that is set:
- * SHOPIFY_SERVICE_ACCOUNT_TOKEN, SHOPIFY_APP_AUTOMATION_TOKEN, or the deprecated SHOPIFY_CLI_PARTNERS_TOKEN.
+ * SHOPIFY_ORGANIZATION_AUTOMATION_TOKEN, SHOPIFY_APP_AUTOMATION_TOKEN, or the deprecated SHOPIFY_CLI_PARTNERS_TOKEN.
  *
- * Returns undefined when the variables can't be used (an empty value, or the service account variable set alongside
+ * Returns undefined when the variables can't be used (an empty value, or the organization variable set alongside
  * another one). Callers then fall back to the login flow, which reports the problem instead of logging in.
  *
  * @returns The automation token, or undefined if there is no usable one.
packages/cli-kit/dist/public/node/session.d.ts
@@ -121,10 +121,6 @@ export declare function ensureAuthenticatedAdmin(store: string, scopes?: AdminAP
  * If a password is provided, that token will be used against Theme Access API.
  * Otherwise, it will ensure that the user is authenticated with the Admin API.
  *
- * Theme Access passwords only work with the store's permanent `.myshopify.com` domain, so when the password is a
- * Theme Access password the returned session uses the permanent domain of `store`, even if `store` is another of the
- * store's domains.
- *
  * @param store - Store fqdn to request auth for.
  * @param password - Password generated from Theme Access app.
  * @param scopes - Optional array of extra scopes to authenticate with.
@@ -152,24 +148,15 @@ export interface EnsureAuthenticatedBusinessPlatformOptions extends EnsureAuthen
  */
 export declare function ensureAuthenticatedBusinessPlatform(scopes?: BusinessPlatformScope[], options?: EnsureAuthenticatedBusinessPlatformOptions): Promise<string>;
 /**
- * Whether SHOPIFY_SERVICE_ACCOUNT_TOKEN is set, which makes it the automation token the CLI authenticates with.
- *
- * True even when it's empty or set together with another automation token variable. Commands use this to skip logins
- * saved on this machine, and authentication then reports any problem with the variables.
- *
- * @returns True when SHOPIFY_SERVICE_ACCOUNT_TOKEN is set.
- */
-export declare function isServiceAccountTokenSet(): boolean;
-/**
- * Fails when SHOPIFY_SERVICE_ACCOUNT_TOKEN is set, for commands that can't run with that token.
+ * Fails when SHOPIFY_ORGANIZATION_AUTOMATION_TOKEN is set, for commands that can't run with that token.
  *
- * Service account tokens can't log in as a user or call a store's Admin API, so commands that need either
+ * Organization automation tokens can't log in as a user or call a store's Admin API, so commands that need either
  * refuse to run instead of quietly using the person's own login. `ensureAuthenticated` runs this check before any
  * login. Commands that run on a login saved by `shopify store auth` call it before loading that login.
  *
- * @throws AbortError when SHOPIFY_SERVICE_ACCOUNT_TOKEN is set.
+ * @throws AbortError when SHOPIFY_ORGANIZATION_AUTOMATION_TOKEN is set.
  */
-export declare function ensureNoServiceAccountToken(): void;
+export declare function ensureNoOrganizationAutomationToken(): void;
 /**
  * Logout from Shopify.
  *
packages/cli-kit/dist/private/node/session/automation-token.d.ts
@@ -4,7 +4,7 @@ interface AutomationTokenVariablesProblem {
 }
 /**
  * Returns the name of the automation token variable the CLI authenticates with: the first one that is set, in
- * the order SHOPIFY_SERVICE_ACCOUNT_TOKEN, SHOPIFY_APP_AUTOMATION_TOKEN, SHOPIFY_CLI_PARTNERS_TOKEN.
+ * the order SHOPIFY_ORGANIZATION_AUTOMATION_TOKEN, SHOPIFY_APP_AUTOMATION_TOKEN, SHOPIFY_CLI_PARTNERS_TOKEN.
  *
  * A variable set to an empty string still counts as set, so `automationTokenVariablesProblem` can report it.
  *
@@ -16,7 +16,7 @@ export declare function automationTokenVariable(env?: NodeJS.ProcessEnv): string
  * Explains why the automation token variables can't be used, so a misconfigured environment fails instead of
  * falling back to the logged-in user.
  *
- * - SHOPIFY_SERVICE_ACCOUNT_TOKEN can't be set together with SHOPIFY_APP_AUTOMATION_TOKEN or
+ * - SHOPIFY_ORGANIZATION_AUTOMATION_TOKEN can't be set together with SHOPIFY_APP_AUTOMATION_TOKEN or
  *   SHOPIFY_CLI_PARTNERS_TOKEN.
  * - The selected variable can't be empty.
  *
packages/cli-kit/dist/public/node/themes/theme-manager.d.ts
@@ -11,5 +11,12 @@ export declare abstract class ThemeManager {
     findOrCreate(name?: string, role?: Role): Promise<Theme>;
     fetch(name?: string, role?: Role): Promise<Theme | undefined>;
     generateThemeName(context: string): string;
-    create(themeRole?: Role, themeName?: string): Promise<Theme>;
+    create(themeRole?: Role, themeName?: string): Promise<{
+        createdAtRuntime: boolean;
+        id: number;
+        name: string;
+        processing: boolean;
+        role: string;
+        src?: string;
+    }>;
 }
\ No newline at end of file

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