Skip to content

Add --country flag to store create dev#7947

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

Add --country flag to store create dev#7947
amcaplan wants to merge 5 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 added 2 commits July 8, 2026 18:34
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
@amcaplan amcaplan force-pushed the add-country-flag-to-store-create-dev branch from 6d5c228 to 5e41699 Compare July 8, 2026 15:34
amcaplan added 3 commits July 8, 2026 18:41
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 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.

@@ -1,9 +1,10 @@
mutation CreateAppDevelopmentStore($shopName: String!, $priceLookupKey: String!, $prepopulateTestData: Boolean, $developerPreviewHandle: String) {
mutation CreateAppDevelopmentStore($shopName: String!, $priceLookupKey: String!, $prepopulateTestData: Boolean, $developerPreviewHandle: String, $country: String) {
Comment on lines 64 to +68
shopName: name,
priceLookupKey: DEV_STORE_PLANS[plan],
prepopulateTestData: options.withDemoData ?? false,
developerPreviewHandle: options.featurePreview,
country: options.country,
} else {
const rows: InlineToken[][] = []
pushRow(rows, 'Domain', shopDomain)
pushRow(rows, 'Admin', shopAdminUrl ? {link: {label: shopAdminUrl, url: shopAdminUrl}} : undefined)
Comment on lines +21 to +24
export const countryFlag = Flags.string({
description: 'Two-letter country code for the store, such as US, CA, or GB.',
env: 'SHOPIFY_FLAG_STORE_COUNTRY',
required: false,
Comment on lines +172 to +176
await createDevStore({name: 'test-store', organization: defaultOrg, plan: 'plus', country: 'CA', json: false})

expect(businessPlatformOrganizationsRequestDoc).toHaveBeenCalledWith(
expect.objectContaining({
variables: expect.objectContaining({country: 'CA'}),
@github-actions

github-actions Bot commented Jul 8, 2026

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.

🔧 Removed Environment Variables

The following env vars are no longer referenced in command flags:

Env Var Previously Used By
SHOPIFY_FLAG_PREVIEW_STORE_COUNTRY store:create:preview --country

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