Skip to content

PoC: add a typed result contract for store:list - #8242

Draft
dmerand wants to merge 2 commits into
mainfrom
donald/store-list-result-contract-poc
Draft

PoC: add a typed result contract for store:list#8242
dmerand wants to merge 2 commits into
mainfrom
donald/store-list-result-contract-poc

Conversation

@dmerand

@dmerand dmerand commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

PoC intent

This draft migrates one finite command, store:list, toward a data-only execution result while preserving the current CLI behavior. The command still owns flag parsing and still returns Promise<void>.

Boundary

  • listStores produces typed data and does not print output.
  • StoreListDocument and encodeStoreListJson form an explicit, store-owned codec boundary. The codec whitelists the existing JSON fields and excludes internal metadata such as source.
  • presentStoreListResult is the explicit CLI presenter. It selects the JSON codec or the existing terminal rendering and keeps diagnostics on stderr.

Compatibility proof

Focused tests cover the service, terminal presenter, and codec. The codec test asserts the exact formatted JSON document, optional-field omission, and exclusion of internal fields. Existing presenter tests continue to verify terminal text, JSON output, stderr notices, and truncation warnings.

Deliberately not done

  • No BaseCommand changes.
  • No launcher auto-serialization or generic JSON.stringify(result) behavior.
  • No event or diagnostics plumbing.
  • Only store:list is migrated.
  • Authentication, organization resolution, and prompting remain in the existing service; dependency injection for non-CLI consumers is a later step.

Validation

  • Focused Vitest: 3 files, 22 tests passed.
  • ESLint on all changed files: passed (Nx project-graph warnings only).
  • pnpm --filter @shopify/store type-check: passed.
  • git diff --check: passed.

The type-check did not reproduce the reported pre-existing missing @shopify/organizations declaration failure in this checkout; no type errors were introduced by this change.

Open decisions in this PoC

  • source remains internal and is explicitly excluded from JSON.
  • Notices and truncation warnings remain stderr output in JSON mode, matching current behavior.
  • Execution failures continue through the existing command error boundary; this PoC adds no result-level failure envelope.
  • The contract and codec live under the store package, next to the command-specific domain types.

Assisted-By: devx/48f80679-7765-44d2-aae2-f54bc011f8da
@github-actions github-actions Bot added the Area: @shopify/cli @shopify/cli package issues label Aug 3, 2026
Assisted-By: devx/ecf1da3d-df27-457b-ba52-0a62492ff143
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