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.
| // Fetches only the newest STORE_LIST_LIMIT stores for the organization, sorted server-side, rather | ||
| // than paginating the whole org. The global newest-N is a subset of each org's newest-N, so a | ||
| // single bounded page per organization is enough and keeps huge orgs from being walked end to end. |
| import {Flags} from '@oclif/core' | ||
|
|
||
| export default class StoreList extends StoreCommand { | ||
| static summary = 'List stores in your Shopify organization.' |
b4c7faa to
cb1e68e
Compare

Summary
Add
shopify store list, listing the stores in the Shopify organizations available to the current CLI account.Builds
store listout from the prototype in theshopify store create previewstack.Scope
shopify store list(organization source, backed by Business Platform internally)Subdomain | Name | Type | Created, sorted newest firstaccessibleShops(sort: SHOP_CREATED_AT_DESC, first: 250), one page) instead of paginating the whole org, then merge/sort/cap to 250 — bounds the work for orgs with thousands of storestruncated: trueflag in JSON--organization-idto list a single organization; an unknown/inaccessible id errors with the organizations you can accesssuccess | unresolved-session | organization-not-foundresult so fallback policy can live in the service indexReview notes
--fromflag, thestore-authsource, and the auto fallback land in Add store-auth source and auto fallback to store list #7714