Add --country flag to store create dev#7947
Conversation
6d5c228 to
5e41699
Compare
There was a problem hiding this comment.
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
countryFlagwith normalization + validation, and wires it into bothstore create devandstore create preview. - Extends dev store creation to accept a
countryoption and include it in JSON/success outputs. - Updates the dev-store GraphQL mutation + generated document to include an optional
countryvariable/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.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
360670c to
2337ab2
Compare
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 declarationsWe found no new type declarations in this PR Existing type declarationspackages/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.
*
|
c6cddfa to
e69c6a6
Compare
2337ab2 to
6017086
Compare
6017086 to
79a9328
Compare
e69c6a6 to
5e141f3
Compare
79a9328 to
cca2e79
Compare
fa7747b to
b2ebd9e
Compare
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
cca2e79 to
8463c35
Compare

What
Adds a
--countryflag toshopify store create dev, implementing the country piece of shop/world#22968, and shares the flag — definition, validation, and error message — withshopify store create preview.flags.tsexports a single sharedcountryFlagconstant (envSHOPIFY_FLAG_STORE_COUNTRY). Itsparsenormalizes the value to trimmed uppercase and validates the two-letter shape, throwing a consistentAbortErrorbefore a command'srunbody executes.isCountryCodeand the error message are internal implementation details of the flag.store create devandstore create previewreference this onecountryFlag, so validation and error output are identical and defined in exactly one place — no per-commandif-checks.store create devthreads--countryintocreateDevStore, which sends it to the BPcreateAppDevelopmentStoremutation and surfaces it in JSON and success output.Notes
parse(oclif enforces it), rather than being duplicated in each command.SHOPIFY_FLAG_PREVIEW_STORE_COUNTRYto the sharedSHOPIFY_FLAG_STORE_COUNTRY. The--countryflag is new/unreleased and the command ishidden, so there's no external impact.hidden; no changeset.