Skip to content

Add --country flag to store create dev#7947

Open
amcaplan wants to merge 6 commits into
mainfrom
add-country-flag-to-store-create-dev
Open

Add --country flag to store create dev#7947
amcaplan wants to merge 6 commits into
mainfrom
add-country-flag-to-store-create-dev

Conversation

@amcaplan

@amcaplan amcaplan commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

What

Adds a --country flag to shopify store create dev, implementing the country piece of shop/world#22968, and shares the flag — definition, validation, and error message — with shopify store create preview.

  • flags.ts exports a single shared countryFlag constant (env SHOPIFY_FLAG_STORE_COUNTRY). Its parse normalizes the value to trimmed uppercase and validates the two-letter shape, throwing a consistent AbortError before a command's run body executes. isCountryCode and the error message are internal implementation details of the flag.
  • Both store create dev and store create preview reference this one countryFlag, so validation and error output are identical and defined in exactly one place — no per-command if-checks.
  • store create dev threads --country into createDevStore, which sends it to the BP createAppDevelopmentStore mutation and surfaces it in JSON and success output.

Notes

  • Validation now lives in the flag's parse (oclif enforces it), rather than being duplicated in each command.
  • The preview command's env var changed from SHOPIFY_FLAG_PREVIEW_STORE_COUNTRY to the shared SHOPIFY_FLAG_STORE_COUNTRY. The --country flag is new/unreleased and the command is hidden, so there's no external impact.
  • Command is hidden; no changeset.
  • Tests pass (command + service); manifest updated for the env-var change.

@github-actions github-actions Bot added the no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users. label Jun 28, 2026
@amcaplan
amcaplan force-pushed the add-country-flag-to-store-create-dev branch from 6d5c228 to 5e41699 Compare July 8, 2026 15:34
@amcaplan
amcaplan marked this pull request as ready for review July 8, 2026 15:52
@amcaplan
amcaplan requested a review from a team as a code owner July 8, 2026 15:52
Copilot AI review requested due to automatic review settings July 8, 2026 15:52
@amcaplan
amcaplan requested a review from a team as a code owner July 8, 2026 15:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a normalized/validated --country flag to shopify store create dev (and reuses the same flag in store create preview) and threads the value through to the dev-store creation flow and outputs, aiming to share validation logic between store-creation commands.

Changes:

  • Introduces a shared countryFlag with normalization + validation, and wires it into both store create dev and store create preview.
  • Extends dev store creation to accept a country option and include it in JSON/success outputs.
  • Updates the dev-store GraphQL mutation + generated document to include an optional country variable/argument.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
packages/store/src/cli/services/store/create/dev.ts Adds optional country to dev-store creation options, sends it in variables, and surfaces it in success/JSON output.
packages/store/src/cli/services/store/create/dev.test.ts Updates expectations for the mutation variables and adds coverage around country behavior.
packages/store/src/cli/flags.ts Adds shared countryFlag with normalization/validation and a single env var binding.
packages/store/src/cli/commands/store/create/preview.ts Switches preview command to use the shared countryFlag and removes inline validation.
packages/store/src/cli/commands/store/create/dev.ts Adds --country flag and passes it through to the dev-store service.
packages/store/src/cli/commands/store/create/dev.test.ts Adds CLI-level coverage for --country normalization and invalid input rejection.
packages/store/src/cli/api/graphql/business-platform-organizations/mutations/create_app_development_store.graphql Adds $country and country: $country to the mutation operation.
packages/store/src/cli/api/graphql/business-platform-organizations/generated/create_app_development_store.ts Updates generated types/document AST to include country.
packages/cli/oclif.manifest.json Regenerates manifest to reflect the new --country flag and env var metadata.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/store/src/cli/services/store/create/dev.ts
Comment thread packages/store/src/cli/services/store/create/dev.ts Outdated
Comment thread packages/store/src/cli/flags.ts
Comment thread packages/store/src/cli/services/store/create/dev.test.ts

amcaplan commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@amcaplan
amcaplan changed the base branch from main to graphite-base/7947 July 9, 2026 11:27
@amcaplan
amcaplan force-pushed the add-country-flag-to-store-create-dev branch from 360670c to 2337ab2 Compare July 9, 2026 11:27
@amcaplan
amcaplan changed the base branch from graphite-base/7947 to unhide-store-commands July 9, 2026 11:27
@github-actions github-actions Bot added Area: @shopify/cli @shopify/cli package issues and removed no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users. labels Jul 9, 2026
@github-actions

github-actions Bot commented Jul 9, 2026

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
@@ -6,6 +6,7 @@ export declare const environmentVariables: {
     doctor: string;
     enableCliRedirect: string;
     env: string;
+    firstPartyDev: string;
     noAnalytics: string;
     optOutInstrumentation: string;
     appAutomationToken: string;
packages/cli-kit/dist/private/node/session.d.ts
@@ -90,7 +90,6 @@ export declare function setLastSeenUserIdAfterAuth(id: string): void;
  */
 export declare function getLastSeenAuthMethod(): Promise<AuthMethod>;
 export declare function setLastSeenAuthMethod(method: AuthMethod): void;
-export declare function setCommandSessionId(sessionId: string | undefined): void;
 export interface EnsureAuthenticatedAdditionalOptions {
     noPrompt?: boolean;
     forceRefresh?: boolean;
packages/cli-kit/dist/public/node/base-command.d.ts
@@ -16,7 +16,6 @@ declare abstract class BaseCommand extends Command {
     protected parse<TFlags extends FlagOutput & {
         path?: string;
         verbose?: boolean;
-        'auth-alias'?: string;
     }, TGlobalFlags extends FlagOutput, TArgs extends ArgOutput>(options?: Input<TFlags, TGlobalFlags, TArgs>, argv?: string[]): Promise<ParserOutput<TFlags, TGlobalFlags, TArgs> & {
         argv: string[];
     }>;
packages/cli-kit/dist/public/node/cli.d.ts
@@ -39,9 +39,6 @@ export declare const globalFlags: {
 export declare const jsonFlag: {
     json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
 };
-export declare const authAliasFlag: {
-    'auth-alias': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
-};
 /**
  * Builds a  flag that only accepts a valid port number. The flag parses its
  * value as an integer and rejects anything that isn't a whole number between 1 and
packages/cli-kit/dist/public/node/session.d.ts
@@ -22,19 +22,6 @@ export type AccountInfo = UserAccountInfo | ServiceAccountInfo | UnknownAccountI
  * @param userId - User identifier to report on the command analytics event.
  */
 export declare function setLastSeenUserId(userId: string): void;
-/**
- * Finds a stored Shopify account session by alias without changing the current session.
- *
- * @param alias - The account alias to find.
- * @returns The matching session ID, or undefined if no session matches.
- */
-export declare function findSessionIdByAlias(alias: string): Promise<string | undefined>;
-/**
- * Selects a stored Shopify account session by alias for the current command process.
- *
- * @param alias - The account alias to select. Passing undefined clears the command selection.
- */
-export declare function setCurrentSessionAlias(alias?: string): Promise<void>;
 interface UserAccountInfo {
     type: 'UserAccount';
     email: string;
packages/cli-kit/dist/public/node/context/local.d.ts
@@ -63,6 +63,13 @@ export declare function alwaysLogAnalytics(env?: NodeJS.ProcessEnv): boolean;
  * @returns True if SHOPIFY_CLI_ALWAYS_LOG_METRICS is truthy.
  */
 export declare function alwaysLogMetrics(env?: NodeJS.ProcessEnv): boolean;
+/**
+ * Returns true if the CLI User is 1P.
+ *
+ * @param env - The environment variables from the environment of the current process.
+ * @returns True if SHOPIFY_CLI_1P is truthy.
+ */
+export declare function firstPartyDev(env?: NodeJS.ProcessEnv): boolean;
 /**
  * Returns true if the CLI can run the "doctor-release" command.
  *

@amcaplan
amcaplan force-pushed the unhide-store-commands branch from c6cddfa to e69c6a6 Compare July 9, 2026 11:40
@amcaplan
amcaplan force-pushed the add-country-flag-to-store-create-dev branch from 2337ab2 to 6017086 Compare July 9, 2026 11:40
@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 Jul 9, 2026
@amcaplan
amcaplan force-pushed the add-country-flag-to-store-create-dev branch from 6017086 to 79a9328 Compare July 9, 2026 12:48
@amcaplan
amcaplan force-pushed the unhide-store-commands branch from e69c6a6 to 5e141f3 Compare July 9, 2026 12:48
@amcaplan
amcaplan force-pushed the add-country-flag-to-store-create-dev branch from 79a9328 to cca2e79 Compare July 9, 2026 13:10
@amcaplan
amcaplan force-pushed the unhide-store-commands branch 3 times, most recently from fa7747b to b2ebd9e Compare July 9, 2026 16:30
Base automatically changed from unhide-store-commands to stable/4.5 July 9, 2026 20:01
@amcaplan
amcaplan changed the base branch from stable/4.5 to main July 12, 2026 19:45
@amcaplan
amcaplan marked this pull request as draft July 12, 2026 19:45
amcaplan added 6 commits July 17, 2026 00:11
Extracts and shares the country-code validation already used by
store create preview: countryFlag, isCountryCode, and a shared
invalidCountryCodeMessage in flags.ts, plus devStoreFlags.country.

The flag is validated, plumbed into createDevStore options, and shown
in JSON/success output, but is NOT yet sent to the BP
createAppDevelopmentStore mutation -- the published schema does not
expose a country argument until shop/world#671185 (part of
shop/world#22968) merges. GraphQL wiring is a trivial follow-up.

Command is hidden; no changeset (not functional end-to-end yet).

Assisted-By: devx/bf777827-dc69-4993-9b11-c401dc19c4be
The --country flag was collected and shown in output but never sent
to the createAppDevelopmentStore mutation. Wire it through as the
'country' argument now that the backend supports it.

Assisted-By: devx/de0d96e7-211c-4a8b-991d-240b9f675823
Assisted-By: devx/7f40dd7e-8ac5-44cb-8a46-99677b33f144
Assisted-By: devx/7f40dd7e-8ac5-44cb-8a46-99677b33f144
Assisted-By: devx/7f40dd7e-8ac5-44cb-8a46-99677b33f144
Assisted-By: devx/7f40dd7e-8ac5-44cb-8a46-99677b33f144
@amcaplan
amcaplan force-pushed the add-country-flag-to-store-create-dev branch from cca2e79 to 8463c35 Compare July 16, 2026 21:12
@amcaplan
amcaplan marked this pull request as ready for review July 16, 2026 21:15
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants