Skip to content

Add shopify store create command#7218

Open
tizmagik wants to merge 1 commit intomainfrom
jg/store-create-command
Open

Add shopify store create command#7218
tizmagik wants to merge 1 commit intomainfrom
jg/store-create-command

Conversation

@tizmagik
Copy link
Copy Markdown

@tizmagik tizmagik commented Apr 8, 2026

Summary

  • Adds shopify store create command for programmatic store creation via Core's Signups GraphQL API
  • shopify store create creates a trial store using the StoreCreate mutation
  • shopify store create --dev creates a development store using the AppDevelopmentStoreCreate mutation
  • Flags: --name, --subdomain, --country (default: US), --dev, --json
  • Auth: Uses Identity bearer token directly with shop.create scope (no application token exchange)

cli-kit changes

  • ensureAuthenticatedSignups() — new auth function that returns the Identity token for Signups API
  • signupsRequest() — new GraphQL request helper for /services/signups/graphql
  • signupsFqdn() — FQDN resolver for the Signups API
  • shop-create scope transform in session scopes

Prerequisites

  • Core PR shop/world#586779 (authorizes CLI client on Signups API) — open, needs review
  • Identity scope grant for shop.create on the CLI's Identity application
  • app_development_store_create approval scope for --dev flag

Test plan

  • pnpm vitest run passes for all new test files (31 tests)
  • pnpm tsc --noEmit passes for both cli-kit and cli packages
  • pnpm eslint passes on all new/modified files
  • Manual test: shopify store create --name "test" --country US against spin environment (after Core PR merges and Identity scope is granted)
  • Manual test: shopify store create --dev (after app_development_store_create approval scope is granted)

🤖 Generated with Claude Code

@tizmagik tizmagik requested a review from a team as a code owner April 8, 2026 02:44
Copilot AI review requested due to automatic review settings April 8, 2026 02:44
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 create command + service layer, with --dev, --name, --subdomain, --country, --json.
  • Adds cli-kit Signups API support: ensureAuthenticatedSignups(), signupsRequest(), and signupsFqdn().
  • Extends session scope handling to support the shop-createshop.create scope 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-createhttps://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.

@tizmagik tizmagik force-pushed the jg/store-create-command branch 2 times, most recently from 5fa9897 to 7d777e6 Compare April 8, 2026 03:03
@tizmagik tizmagik requested a review from a team as a code owner April 8, 2026 03:03
@tizmagik tizmagik force-pushed the jg/store-create-command branch 2 times, most recently from 0bae4a6 to 6fad971 Compare April 8, 2026 03:11
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>
@tizmagik tizmagik force-pushed the jg/store-create-command branch from 6fad971 to 438d2ee Compare April 8, 2026 03:32
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

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/public/node/api/signups.d.ts
import { 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 declarations

packages/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.
  *

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants