Add store list for organization stores#7708
Conversation
92fffc1 to
c7e152d
Compare
3ac3560 to
6fbe857
Compare
This stack of pull requests is managed by Graphite. Learn more about stacking. |
f516bbe to
79dbfa7
Compare
|
I believe you should be able to gitignore packages/store/src/cli/api/graphql/business-platform-organizations/organizations_schema.graphql |
5986997 to
b4c7faa
Compare
There was a problem hiding this comment.
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 listcommand + 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.
cb1e68e to
4a2c0dd
Compare
4a2c0dd to
0974dfd
Compare
c61df52 to
429141b
Compare
4075110 to
cd562c1
Compare
862e337 to
116cc0c
Compare
116cc0c to
0279eeb
Compare
5d0ad69 to
a96cc6f
Compare
a96cc6f to
2b41738
Compare
Assisted-By: devx/425e6a4b-6ec9-421c-8f98-ab1725d0b996
2b41738 to
7d2be83
Compare
isaacroldan
left a comment
There was a problem hiding this comment.
remove refreshBusinessPlatformToken before merging

Summary
Add
shopify store list, listing stores from one Shopify organization available to the current CLI account.Builds
store listout from the prototype in theshopify store create previewstack.Closes https://github.com/shop/issues-develop/issues/22723
Scope
shopify store listas an organization-backed store-management list--organization-idselects that organization and uses the shared integer organization flag--organization-id@shopify/organizations.selectOrganizationFromList()and use it from both app context and store listaccessibleShops(first: 250, sort: SHOP_CREATED_AT_DESC, filters: STORE_STATUS = active)Subdomain | Name | Type | Created, sorted newest firsttruncated: truein JSONorganization: {id, name}Review notes
--fromflag and no local store-auth fallback; Slack feedback on 2026-06-14/15 made the two jobs clearer as separate commands@shopify/organizationsNot changed / deferred
--from,auto, or store-auth fallback behavior. Those made one command responsible for two different jobs and were explicitly removed after Slack review.store listlist 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.--organization-idback 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 integerorganization-idflag. Reopen only if Shopify organization IDs can exceed JS safe integer range.store listshow whether each store is already authenticated forstore execute. That belongs to the direct store-auth listing command upstack, not the organization store-management list.