Add --for-client flag for client transfer store creation#7280
Open
tizmagik wants to merge 3 commits intojg/store-create-commandfrom
Open
Add --for-client flag for client transfer store creation#7280tizmagik wants to merge 3 commits intojg/store-create-commandfrom
--for-client flag for client transfer store creation#7280tizmagik wants to merge 3 commits intojg/store-create-commandfrom
Conversation
5 tasks
07f69f7 to
a8f6fab
Compare
cb11b50 to
d714122
Compare
5b90ed5 to
0513e3d
Compare
Enables creating Shopify stores directly from the CLI via Core's Signups GraphQL API. Supports both trial stores (`shopify store create`) and development stores (`shopify store create --dev`) using the StoreCreate and AppDevelopmentStoreCreate mutations respectively. The CLI authenticates with Identity via PKCE and sends the bearer token directly to the Signups API (no application token exchange needed). Flags: --name, --subdomain, --country (default: US), --dev, --json Prerequisites: - Core PR shop/world#586779 (authorizes CLI on Signups API) - Identity scope grant for `shop.create` - `app_development_store_create` approval scope for --dev flag Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Enables creating Shopify stores directly from the CLI via Core's Signups GraphQL API. Supports both trial stores (`shopify store create`) and development stores (`shopify store create --dev`) using the StoreCreate and AppDevelopmentStoreCreate mutations respectively. The CLI authenticates with Identity via PKCE and sends the bearer token directly to the Signups API (no application token exchange needed). Flags: --name, --subdomain, --country (default: US), --dev, --json Prerequisites: - Core PR shop/world#586779 (authorizes CLI on Signups API) - Identity scope grant for `shop.create` - `app_development_store_create` approval scope for --dev flag Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds support for creating client transfer stores via the Organizations API `createClientDevelopmentShop` mutation. These are stores built by partners for their clients, on the affiliate plan. Usage: shopify store create --for-client --org <org-id> --name "Store" The --org flag is required with --for-client and provides the Partner organization ID. Uses Business Platform token auth via the Organizations API (different from the Signups API path used by trial/dev stores). Also adds flag validation: - --for-client and --dev are mutually exclusive - --subdomain is not supported with --for-client - --org is required with --for-client Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
d714122 to
28caff1
Compare
Contributor
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 declarationspackages/cli-kit/dist/public/node/api/signups.d.tsimport { GraphQLVariables } from './graphql.js';
/**
* Executes a GraphQL query against the Signups API.
* Uses the Identity bearer token directly (no application token exchange).
*
* @param query - GraphQL query to execute.
* @param token - Identity access token.
* @param variables - GraphQL variables to pass to the query.
* @returns The response of the query of generic type <T>.
*/
export declare function signupsRequest<T>(query: string, token: string, variables?: GraphQLVariables): Promise<T>;
Existing type declarationspackages/cli-kit/dist/private/node/session.d.ts@@ -41,6 +41,15 @@ interface BusinessPlatformAPIOAuthOptions {
/** List of scopes to request permissions for. */
scopes: BusinessPlatformScope[];
}
+/**
+ * A scope supported by the Signups API.
+ * The Signups API uses the Identity bearer token directly (no application token exchange).
+ */
+export type SignupsScope = 'shop-create';
+interface SignupsAPIOAuthOptions {
+ /** List of scopes to request permissions for. */
+ scopes: SignupsScope[];
+}
/**
* It represents the authentication requirements and
* is the input necessary to trigger the authentication
@@ -52,6 +61,7 @@ export interface OAuthApplications {
partnersApi?: PartnersAPIOAuthOptions;
businessPlatformApi?: BusinessPlatformAPIOAuthOptions;
appManagementApi?: AppManagementAPIOauthOptions;
+ signupsApi?: SignupsAPIOAuthOptions;
}
export interface OAuthSession {
admin?: AdminSession;
@@ -59,6 +69,7 @@ export interface OAuthSession {
storefront?: string;
businessPlatform?: string;
appManagement?: string;
+ identity?: string;
userId: string;
}
type AuthMethod = 'partners_token' | 'device_auth' | 'theme_access_token' | 'custom_app_token' | 'none';
packages/cli-kit/dist/public/node/session.d.ts@@ -1,4 +1,4 @@
-import { AdminAPIScope, AppManagementAPIScope, BusinessPlatformScope, EnsureAuthenticatedAdditionalOptions, PartnersAPIScope, StorefrontRendererScope } from '../../private/node/session.js';
+import { AdminAPIScope, AppManagementAPIScope, BusinessPlatformScope, EnsureAuthenticatedAdditionalOptions, PartnersAPIScope, SignupsScope, StorefrontRendererScope } from '../../private/node/session.js';
/**
* Session Object to access the Admin API, includes the token and the store FQDN.
*/
@@ -116,6 +116,19 @@ export declare function ensureAuthenticatedThemes(store: string, password: strin
* @returns The access token for the Business Platform API.
*/
export declare function ensureAuthenticatedBusinessPlatform(scopes?: BusinessPlatformScope[]): Promise<string>;
+/**
+ * Ensure that we have a valid session to access the Signups API.
+ * The Signups API uses the Identity bearer token directly (no application token exchange).
+ *
+ * @param scopes - Optional array of extra scopes to authenticate with.
+ * @param env - Optional environment variables to use.
+ * @param options - Optional extra options to use.
+ * @returns The Identity access token and user ID.
+ */
+export declare function ensureAuthenticatedSignups(scopes?: SignupsScope[], env?: NodeJS.ProcessEnv, options?: EnsureAuthenticatedAdditionalOptions): Promise<{
+ token: string;
+ userId: string;
+}>;
/**
* Logout from Shopify.
*
packages/cli-kit/dist/public/node/context/fqdn.d.ts@@ -37,6 +37,12 @@ export declare function developerDashboardFqdn(): Promise<string>;
* @returns Fully-qualified domain of the partners service we should interact with.
*/
export declare function businessPlatformFqdn(): Promise<string>;
+/**
+ * It returns the Signups API service we should interact with.
+ *
+ * @returns Fully-qualified domain of the Signups service we should interact with.
+ */
+export declare function signupsFqdn(): Promise<string>;
/**
* It returns the Identity service we should interact with.
*
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stacked on #7218.
Adds
--for-clientflag toshopify store createfor creating client transfer stores (stores built by partners for their clients, on the affiliate plan).shopify store create --for-client --org <id>— calls Organizations APIcreateClientDevelopmentShopmutation--orgis required with--for-client(Partner organization ID)Flag validation
--for-clientand--devare mutually exclusive--subdomainis not supported with--for-client--orgis required with--for-clientTest plan
pnpm vitest runpasses (41 tests total, 10 new for client transfer + validation)pnpm tsc --noEmitpassesshopify store create --for-client --org <id> --name "Client Store"🤖 Generated with Claude Code