Skip to content

Allow filtering store list by store type - #8472

Open
amcaplan wants to merge 1 commit into
mainfrom
allow-filtering-store-list-on-store-type
Open

Allow filtering store list by store type#8472
amcaplan wants to merge 1 commit into
mainfrom
allow-filtering-store-list-on-store-type

Conversation

@amcaplan

@amcaplan amcaplan commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

What

shopify store list --type dev
shopify store list --type production
shopify store list --type client_transfer
shopify store list --type collaborator

Values are the public store-type handles the listing already reports in its Type column and in --json, so the filter and the data share one vocabulary and a value read out of --json can be passed straight back in.

Why server-side

The filter goes to Business Platform's STORE_TYPE shop filter rather than being applied to the returned rows. That's a correctness fix, not just ergonomics: the listing is capped at 250 stores, so grouping client-side would report "no production stores" for an organization whose matches all sit past the cap.

filters moved from a literal in the query document to a [ShopFilterInput!] variable to make that possible; the STORE_STATUS = active filter is unchanged.

Output

Filtered listings name the filter in prose, since the 250-cap applies to the filtered set:

  • Listing dev stores. / No client transfer stores found.
  • Showing the 250 most recent production stores in Acme. More stores exist.
  • --json gains a storeType field when filtered.

Notes for review

  • No back-end work; contained to list/bp-source.ts, list/result.ts, and the store-type vocabulary in services/store/store-type.ts.
  • Single-valued on purpose. --type dev --type production would need N queries or client-side merging, which reintroduces the cap problem.
  • Regenerated: GraphQL types, oclif manifest, README, shopify.dev docs data.

🤖 Generated with Claude Code

@github-actions github-actions Bot added the Area: @shopify/cli @shopify/cli package issues label Sep 3, 2026
@amcaplan
amcaplan force-pushed the allow-filtering-store-list-on-store-type branch 2 times, most recently from 3f0b0df to c728496 Compare September 3, 2026 21:15
Adds `store list --type <dev|production|client_transfer|collaborator>`,
using the public store-type handles the listing already reports in its
Type column and JSON output, so the filter and the data share one
vocabulary.

The filter is applied server-side via BP's `STORE_TYPE` shop filter
rather than on the returned rows. That matters for correctness, not just
ergonomics: the listing is capped at 250 stores, so filtering afterwards
would report "no production stores" for an organization whose matches
all sit past the cap.

`dev` maps to BP's `development_superset` alias, which covers both
`development` (legacy partner dev stores) and `app_development` (what
`store create dev` makes), keeping `--type dev` a single query.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Assisted-By: devx/84554425-7df7-4dd7-8f8e-fa9581e69cdf
@amcaplan
amcaplan force-pushed the allow-filtering-store-list-on-store-type branch from c728496 to 95e7f8d Compare September 3, 2026 21:18
@amcaplan
amcaplan marked this pull request as ready for review September 3, 2026 21:18
@amcaplan
amcaplan requested review from a team as code owners September 3, 2026 21:18
@amcaplan
amcaplan requested review from dmerand and a lite review from Copilot September 3, 2026 21:18

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.

🟢 Approval recommended

The filter is applied server-side as intended, the new flag is validated, output/JSON behavior is covered by tests, and regenerated artifacts are consistent with the change.

Pull request overview

Adds a server-side --type filter to shopify store list, using the same public store-type handles already shown in the Type column / --json, and threads that filter through query → service result → text/JSON output.

Changes:

  • Introduces a stable store-type filter vocabulary (dev|production|client_transfer|collaborator) and maps it to BP STORE_TYPE filter values.
  • Updates the BP stores query to accept a filters variable and applies STORE_STATUS=active plus optional STORE_TYPE.
  • Updates output (headline, empty state, truncation warning, and JSON) to reflect the active filter, with tests and regenerated docs/artifacts.
File summaries
File Description
packages/store/src/cli/services/store/store-type.ts Defines accepted --type handles and maps them to BP STORE_TYPE filter values.
packages/store/src/cli/services/store/store-type.test.ts Adds coverage for handle normalization and filter-value mapping.
packages/store/src/cli/services/store/list/types.ts Extends result shape to optionally echo back the active store-type filter.
packages/store/src/cli/services/store/list/result.ts Names the active filter in text output and includes it in JSON output when present.
packages/store/src/cli/services/store/list/result.test.ts Tests headline/empty/truncation wording and JSON inclusion of storeType.
packages/store/src/cli/services/store/list/bp-source.ts Applies server-side BP shop filters, including optional STORE_TYPE.
packages/store/src/cli/services/store/list/bp-source.test.ts Verifies BP request variables include the correct filter list (with and without --type).
packages/store/src/cli/services/store/list.ts Plumbs storeType option into BP source and echoes it back in the result.
packages/store/src/cli/services/store/list.test.ts Tests passing/omitting storeType through the list service.
packages/store/src/cli/commands/store/list.ts Adds --type flag (validated against accepted handles) and passes it to listStores.
packages/store/src/cli/commands/store/list.test.ts Tests CLI flag wiring and expected flag options list.
packages/store/src/cli/api/graphql/business-platform-organizations/queries/list_accessible_shops.graphql Moves filters from inline literal to a $filters query variable.
packages/store/src/cli/api/graphql/business-platform-organizations/generated/types.d.ts Regenerates BP GraphQL types to include shop filter input types/enums.
packages/store/src/cli/api/graphql/business-platform-organizations/generated/list_accessible_shops.ts Regenerates typed document node + variables for $filters.
packages/cli/README.md Regenerates CLI help docs to include --type.
packages/cli/oclif.manifest.json Regenerates oclif manifest with the new flag metadata.
docs-shopify.dev/generated/generated_docs_data_v2.json Regenerates shopify.dev docs data to include --type.
.changeset/store-list-filter-by-store-type.md Adds a changeset for the new user-facing flag.
Review details
  • Files reviewed: 15/18 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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.

2 participants