Skip to content

Add production preview store create command#7764

Draft
alfonso-noriega wants to merge 1 commit into
mainfrom
productionize-preview-store-create-main
Draft

Add production preview store create command#7764
alfonso-noriega wants to merge 1 commit into
mainfrom
productionize-preview-store-create-main

Conversation

@alfonso-noriega

@alfonso-noriega alfonso-noriega commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

WHY are these changes introduced?

This productionizes shopify store create preview on top of the shipped preview-store backend endpoint so an agent can create a preview store and immediately use the returned Admin API token through existing store command auth plumbing.

The command now targets the production endpoint contract from shop/world:

  • unauthenticated POST /services/preview-stores
  • request body with optional name and explicit country_code
  • CLI attribution headers for rollout/rate-limit/tracking
  • response body with shop details and admin_api_token

WHAT is this pull request doing?

  • Adds shopify store create preview with flags:
    • --name
    • --country with two-letter code validation
    • --json
    • existing global --no-color / --verbose
  • Calls https://<app-management-fqdn>/services/preview-stores without Basic auth or Identity auth.
  • Sends:
    • X-Shopify-CLI-Instance from a stable locally persisted install id
    • X-Shopify-CLI-Version
    • User-Agent
    • JSON accept/content headers
  • Parses the production response shape:
    • shop.id
    • shop.name
    • shop.domain
    • placeholder_account_uuid when present
    • admin_api_token
  • Persists the returned Admin API token into the existing local store-auth session cache, tagged as kind: 'preview', so the store is immediately usable by shopify store execute --store <domain> without shopify store auth.
  • Adds preview-store metadata sanitization to the store-auth session cache.
  • Keeps output structured and link-free for now because the backend does not return storefront/save URLs yet.
  • Adds generated command README, OCLIF manifest, shopify.dev command interface docs, and a changeset.

Notes / open questions

  • --country is implemented and sent as country_code. If the currently deployed controller still only permits name, the backend will need to accept country_code; the CLI-side validation and request shape are ready.
  • The create response currently does not include storefront or save/account links, so JSON/text output intentionally omits those fields. They can be added later without changing the existing shape.
  • The CLI handles both the requested 422 preview_store_create_failed path and the currently observed backend 500 preview_store_create_failed path defensively.
  • I did not touch theme dev behavior.

How to test your changes?

Focused tests:

pnpm --filter @shopify/store exec vitest run \
  src/cli/services/store/create/preview/client.test.ts \
  src/cli/services/store/create/preview/index.test.ts \
  src/cli/services/store/create/preview/result.test.ts \
  src/cli/commands/store/create/preview.test.ts \
  src/cli/services/store/auth/session-store.test.ts

Static checks:

pnpm --filter @shopify/store run type-check
pnpm --filter @shopify/store run lint
pnpm --filter @shopify/store run build

I also attempted the full docs/manifest path:

pnpm refresh-manifests
pnpm shopify docs generate

Both were blocked locally before the CLI/docs generation step by an unrelated organizations:build dependency resolution failure (@graphql-typed-document-node/core / @shopify/cli-kit modules not found from packages/organizations). I regenerated the CLI manifest/README narrowly and added the docs artifacts minimally to keep diffs focused.

Post-release steps

None.

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows) — local persistence uses existing LocalStorage; command logic is platform-neutral.
  • I've considered possible documentation changes — command README, OCLIF manifest, generated docs interface, and generated docs data are updated.
  • I've considered analytics changes to measure impact — request sends CLI instance/version/user-agent headers read by the backend tracking path; store FQDN metadata is recorded before/after persistence.
  • The change is user-facing — minor changeset added for @shopify/cli and @shopify/store.

Copy link
Copy Markdown
Contributor Author

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

@github-actions github-actions Bot added the Area: @shopify/cli @shopify/cli package issues label Jun 9, 2026
@alfonso-noriega alfonso-noriega force-pushed the productionize-preview-store-create-main branch 6 times, most recently from a95b7a4 to 897e9ea Compare June 9, 2026 11:52
@alfonso-noriega alfonso-noriega force-pushed the productionize-preview-store-create-main branch 4 times, most recently from 68526fb to e6b9771 Compare June 10, 2026 13:12
@alfonso-noriega alfonso-noriega force-pushed the productionize-preview-store-create-main branch from e6b9771 to f0160e7 Compare June 10, 2026 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: @shopify/cli @shopify/cli package issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant