Skip to content

Add store list for organization stores#7708

Merged
alfonso-noriega merged 5 commits into
mainfrom
donald/store-list-business-platform
Jun 19, 2026
Merged

Add store list for organization stores#7708
alfonso-noriega merged 5 commits into
mainfrom
donald/store-list-business-platform

Conversation

@dmerand

@dmerand dmerand commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Add shopify store list, listing stores from one Shopify organization available to the current CLI account.

Builds store list out from the prototype in the shopify store create preview stack.

Closes https://github.com/shop/issues-develop/issues/22723

Scope

  • add shopify store list as an organization-backed store-management list
  • resolve one organization before listing stores:
    • --organization-id selects that organization and uses the shared integer organization flag
    • a single accessible organization is selected automatically
    • multiple accessible organizations prompt in interactive terminals
    • non-interactive multiple-organization runs require --organization-id
  • move the reusable "select from an already-fetched organization list" flow into @shopify/organizations.selectOrganizationFromList() and use it from both app context and store list
  • fetch only active stores from the selected organization: accessibleShops(first: 250, sort: SHOP_CREATED_AT_DESC, filters: STORE_STATUS = active)
  • render Subdomain | Name | Type | Created, sorted newest first
  • cap output at 250 stores; on truncation, emit a stderr warning and truncated: true in JSON
  • include selected organization context in JSON as organization: {id, name}
  • model organization selection errors distinctly from unresolved-session results
  • harden the CLI session read against malformed persisted JSON

Review notes

  • user-facing output and the command contract avoid the internal "Business Platform" naming; the command is framed around Shopify organizations
  • this PR is organization-source only; directly authenticated store sessions are intentionally handled by a separate auth-listing command upstack
  • no --from flag and no local store-auth fallback; Slack feedback on 2026-06-14/15 made the two jobs clearer as separate commands
  • the command intentionally does not fan out across all organizations anymore
  • store list keeps command-specific policy local (zero-org result, non-interactive error), while ID matching and prompt selection reuse @shopify/organizations

Not changed / deferred

  • Did not add --from, auto, or store-auth fallback behavior. Those made one command responsible for two different jobs and were explicitly removed after Slack review.
  • Did not make store list list every organization. It still resolves one organization first to avoid broad fan-out, ambiguous output, and partial multi-org policy in this first command contract.
  • Did not switch --organization-id back to a string after follow-through review. There is a theoretical JS safe-integer concern, but the current reviewer direction is to use the shared integer organization-id flag. Reopen only if Shopify organization IDs can exceed JS safe integer range.
  • Did not make store list show whether each store is already authenticated for store execute. That belongs to the direct store-auth listing command upstack, not the organization store-management list.

@dmerand dmerand force-pushed the donald/store-list-business-platform branch from 92fffc1 to c7e152d Compare June 5, 2026 13:41
@dmerand dmerand changed the title Add Business Platform-backed store list command Add store list for organization stores Jun 5, 2026
@dmerand dmerand force-pushed the donald/store-list-business-platform branch from 3ac3560 to 6fbe857 Compare June 5, 2026 14:24

dmerand commented Jun 5, 2026

Copy link
Copy Markdown
Contributor Author

@dmerand dmerand force-pushed the donald/store-list-business-platform branch 3 times, most recently from f516bbe to 79dbfa7 Compare June 5, 2026 19:06

amcaplan commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

I believe you should be able to gitignore packages/store/src/cli/api/graphql/business-platform-organizations/organizations_schema.graphql

@dmerand dmerand force-pushed the donald/store-list-business-platform branch 2 times, most recently from 5986997 to b4c7faa Compare June 8, 2026 19:10
@dmerand dmerand marked this pull request as ready for review June 8, 2026 20:56
Copilot AI review requested due to automatic review settings June 8, 2026 20:56
@dmerand dmerand requested review from a team as code owners June 8, 2026 20:56

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 introduces a new shopify store list command in the @shopify/store plugin to list stores available through the current CLI account’s Shopify organizations, backed by Business Platform GraphQL. It also extends organizations fetching to expose “current user resolved/email” metadata and hardens CLI session persistence reads against malformed JSON.

Changes:

  • Add shopify store list command + output formatting (text table + JSON), including --organization-id, truncation cap (250), and partial-organization failure warnings.
  • Add a Business Platform Organizations GraphQL query + codegen plumbing for store listing, and wire it to organization discovery via @shopify/organizations.
  • Improve robustness of persisted CLI session reads by discarding malformed JSON and clearing the stored session.

Reviewed changes

Copilot reviewed 26 out of 33 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pnpm-lock.yaml Adds lockfile entries for new @shopify/store dependencies.
packages/store/src/index.ts Registers the new store:list command.
packages/store/src/cli/services/store/list/types.ts Defines store list result/entry types and the 250-entry cap constant.
packages/store/src/cli/services/store/list/result.ts Implements text/JSON presenters (table rendering, warnings, truncation messaging).
packages/store/src/cli/services/store/list/result.test.ts Tests presenter behavior (table fields, empty states, JSON, truncation warning).
packages/store/src/cli/services/store/list/index.ts Service entrypoint: handles discriminated results, org-not-found erroring, truncation.
packages/store/src/cli/services/store/list/index.test.ts Tests service behavior (success, unresolved session, org-not-found, truncation).
packages/store/src/cli/services/store/list/bp-source.ts Business Platform-backed store listing: org discovery + per-org store fetch + merge/sort.
packages/store/src/cli/services/store/list/bp-source.test.ts Tests Business Platform source behavior (filters, merging, hasMore, partial failure).
packages/store/src/cli/commands/store/list.ts Adds the shopify store list oclif command and --organization-id / --json.
packages/store/src/cli/commands/store/list.test.ts Tests CLI wiring: flags passthrough and presenter selection.
packages/store/src/cli/api/graphql/business-platform-organizations/queries/list_accessible_shops.graphql Adds query for newest stores per organization (sort: SHOP_CREATED_AT_DESC, first).
packages/store/src/cli/api/graphql/business-platform-organizations/generated/types.d.ts Adds generated schema typings for the store Business Platform orgs project.
packages/store/src/cli/api/graphql/business-platform-organizations/generated/list_accessible_shops.ts Adds generated typed document node for store listing query.
packages/store/project.json Adds Nx targets for GraphQL codegen + formatting/postfix steps for store package.
packages/store/package.json Adds dependencies required for typed GraphQL documents + organizations access info.
packages/organizations/src/index.ts Exports new fetchOrganizationsWithAccessInfo.
packages/organizations/src/cli/services/fetch.ts Implements fetchOrganizationsWithAccessInfo returning orgs + user-resolved/email metadata.
packages/organizations/src/cli/services/fetch.test.ts Adds tests for the new access-info fetch behavior and updates existing fixtures.
packages/organizations/src/cli/api/graphql/business-platform-destinations/queries/organizations.graphql Extends org query to include current user email.
packages/organizations/src/cli/api/graphql/business-platform-destinations/generated/organizations.ts Updates generated query typings to include email.
packages/e2e/data/snapshots/commands.txt Updates CLI command snapshot to include store list.
packages/cli/README.md Updates CLI command reference docs to include shopify store list.
packages/cli/oclif.manifest.json Adds manifest entry for store:list command.
packages/cli-kit/src/private/node/session/store.ts Hardens session store parsing: on malformed JSON, clear persisted sessions and return undefined.
packages/cli-kit/src/private/node/session/store.test.ts Adds test coverage for discarding malformed JSON session content.
package.json Updates knip config for packages/store (ignore generated + mark typed-doc-node dep as ignored).
graphql.config.ts Adds storeBusinessPlatformOrganizations graphql-codegen project configuration.
docs-shopify.dev/generated/generated_docs_data_v2.json Updates generated docs data to include store list command interface metadata.
docs-shopify.dev/commands/interfaces/store-list.interface.ts Adds generated TypeScript interface for store list flags.
bin/get-graphql-schemas.js Ensures BP organizations schema is fetched/copied for both app + store packages.
.gitignore Ignores Business Platform schema files under packages/store.
.changeset/store-list-bp-auto.md Changeset for new command + partial failure behavior + session parsing hardening.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

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

Comment thread packages/store/src/cli/services/store/list/bp-source.ts Outdated
Comment thread packages/store/src/cli/commands/store/list.ts Outdated
@dmerand dmerand force-pushed the donald/store-list-business-platform branch 2 times, most recently from cb1e68e to 4a2c0dd Compare June 10, 2026 14:34
@dmerand dmerand changed the base branch from main to ariel/store-info-command June 10, 2026 14:34
Base automatically changed from ariel/store-info-command to main June 10, 2026 14:34
@dmerand dmerand force-pushed the donald/store-list-business-platform branch from 4a2c0dd to 0974dfd Compare June 10, 2026 15:00
Comment thread .changeset/store-list-bp-auto.md Outdated
Comment thread packages/store/src/cli/commands/store/list.test.ts Outdated
Comment thread packages/store/src/cli/commands/store/list.ts Outdated
Comment thread packages/store/src/cli/services/store/list/bp-source.ts Outdated
Comment thread packages/store/src/cli/services/store/list/result.ts Outdated
Comment thread packages/store/src/cli/services/store/list/result.ts Outdated
Comment thread packages/store/src/cli/services/store/list/result.ts Outdated
Comment thread packages/store/src/cli/services/store/list/types.ts Outdated
Comment thread packages/store/src/cli/services/store/list/result.ts Outdated
@dmerand dmerand force-pushed the donald/store-list-business-platform branch from c61df52 to 429141b Compare June 11, 2026 01:58
Comment thread .changeset/store-list-bp-auto.md Outdated
@dmerand dmerand force-pushed the donald/store-list-business-platform branch 2 times, most recently from 4075110 to cd562c1 Compare June 11, 2026 15:28
@alfonso-noriega alfonso-noriega dismissed their stale review June 18, 2026 15:02

pr updated

@alfonso-noriega alfonso-noriega force-pushed the donald/store-list-business-platform branch 5 times, most recently from 862e337 to 116cc0c Compare June 19, 2026 07:36
Comment thread .changeset/store-list-bp-auto.md Outdated
Comment thread docs-shopify.dev/generated/generated_docs_data_v2.json Outdated
@alfonso-noriega alfonso-noriega requested a review from amcaplan June 19, 2026 09:13
Comment thread packages/store/src/cli/services/store/display.ts
@alfonso-noriega alfonso-noriega force-pushed the donald/store-list-business-platform branch from 116cc0c to 0279eeb Compare June 19, 2026 09:20
Comment thread packages/store/src/cli/services/store/list/bp-source.ts Outdated
Comment thread packages/store/src/cli/services/store/list/bp-source.ts Outdated
@alfonso-noriega alfonso-noriega force-pushed the donald/store-list-business-platform branch 2 times, most recently from 5d0ad69 to a96cc6f Compare June 19, 2026 10:50
@alfonso-noriega alfonso-noriega force-pushed the donald/store-list-business-platform branch from a96cc6f to 2b41738 Compare June 19, 2026 11:18
Comment thread packages/store/src/cli/services/store/business-platform.ts
Assisted-By: devx/425e6a4b-6ec9-421c-8f98-ab1725d0b996
@alfonso-noriega alfonso-noriega force-pushed the donald/store-list-business-platform branch from 2b41738 to 7d2be83 Compare June 19, 2026 11:55

@isaacroldan isaacroldan 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.

remove refreshBusinessPlatformToken before merging

@alfonso-noriega alfonso-noriega added this pull request to the merge queue Jun 19, 2026
Merged via the queue into main with commit f4eecce Jun 19, 2026
28 checks passed
@alfonso-noriega alfonso-noriega deleted the donald/store-list-business-platform branch June 19, 2026 15:07
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.

6 participants