Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new shopify store create CLI command that can create trial or development stores by calling Core’s Signups GraphQL API, supported by new cli-kit auth + API helpers.
Changes:
- Introduces
shopify store createcommand + service layer, with--dev,--name,--subdomain,--country,--json. - Adds
cli-kitSignups API support:ensureAuthenticatedSignups(),signupsRequest(), andsignupsFqdn(). - Extends session scope handling to support the
shop-create→shop.createscope transform and Identity-token usage for Signups.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/cli/src/index.ts | Registers the new store:create command. |
| packages/cli/src/cli/services/store/create/index.ts | Implements trial/dev store creation via Signups GraphQL mutations. |
| packages/cli/src/cli/services/store/create/index.test.ts | Adds unit tests for trial/dev creation flows and error handling. |
| packages/cli/src/cli/commands/store/create.ts | Adds the shopify store create oclif command, flags, and output behavior. |
| packages/cli/src/cli/commands/store/create.test.ts | Adds command-level tests for flag parsing and output. |
| packages/cli-kit/src/public/node/session.ts | Adds ensureAuthenticatedSignups() returning Identity bearer token. |
| packages/cli-kit/src/public/node/context/fqdn.ts | Adds signupsFqdn() resolver. |
| packages/cli-kit/src/public/node/api/signups.ts | Adds signupsRequest() GraphQL request helper for Signups. |
| packages/cli-kit/src/public/node/api/signups.test.ts | Tests signupsRequest() wiring (URL, token, variables). |
| packages/cli-kit/src/private/node/session/scopes.ts | Adds scope transform for shop-create → https://api.shopify.com/auth/shop.create. |
| packages/cli-kit/src/private/node/session/scopes.test.ts | Tests the new scope transform. |
| packages/cli-kit/src/private/node/session.ts | Adds Signups OAuth options + includes Signups scopes on Identity token without exchange. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
5fa9897 to
7d777e6
Compare
0bae4a6 to
6fad971
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>
6fad971 to
438d2ee
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
shopify store createcommand for programmatic store creation via Core's Signups GraphQL APIshopify store createcreates a trial store using theStoreCreatemutationshopify store create --devcreates a development store using theAppDevelopmentStoreCreatemutation--name,--subdomain,--country(default: US),--dev,--jsonshop.createscope (no application token exchange)cli-kit changes
ensureAuthenticatedSignups()— new auth function that returns the Identity token for Signups APIsignupsRequest()— new GraphQL request helper for/services/signups/graphqlsignupsFqdn()— FQDN resolver for the Signups APIshop-createscope transform in session scopesPrerequisites
shop.createon the CLI's Identity applicationapp_development_store_createapproval scope for--devflagTest plan
pnpm vitest runpasses for all new test files (31 tests)pnpm tsc --noEmitpasses for bothcli-kitandclipackagespnpm eslintpasses on all new/modified filesshopify store create --name "test" --country USagainst spin environment (after Core PR merges and Identity scope is granted)shopify store create --dev(afterapp_development_store_createapproval scope is granted)🤖 Generated with Claude Code