feat(store): add shopify store list command#7609
Conversation
Lists every locally stored store-auth session — both standard PKCE-authenticated (shopify store auth) and preview-store (shopify store create preview) — with a 3-column table (Store, Kind, User), --kind filter, and --json output for agent consumption. Adds a LocalStorage#entries() enumerator in cli-kit and a listStoredStoreAppSessions() helper in @shopify/store so the command can resolve sessions across every stored shop without knowing the keys in advance. Stacked on store-create-preview-command (#7558) → preview-store-session-discriminator (#7557).
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Differences in type declarationsWe detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:
New type declarationsWe found no new type declarations in this PR Existing type declarationspackages/cli-kit/dist/public/node/local-storage.d.ts@@ -34,6 +34,19 @@ export declare class LocalStorage<T extends Record<string, any>> {
* @throws BugError if an unexpected error occurs.
*/
delete<TKey extends keyof T>(key: TKey): void;
+ /**
+ * Get every pair currently held in the local storage.
+ *
+ * Useful for callers that need to enumerate all stored values without knowing the
+ * full set of keys in advance (for example, a command iterating over every
+ * stored session). The package stores its entire state as a single JSON
+ * object, so this is just a typed wrapper around that object.
+ *
+ * @returns An array of tuples.
+ * @throws AbortError if a permission error occurs.
+ * @throws BugError if an unexpected error occurs.
+ */
+ entries(): [keyof T, T[keyof T]][];
/**
* Clear the local storage (delete all values).
*
|
| * trip through that nesting symmetrically, but the top-level enumerator only sees the | ||
| * outermost segment. To find every bucket regardless of how many dots the shop domain | ||
| * contains, this function walks the value tree under each prefix-matching top-level key | ||
| * and recognizes buckets by shape (`currentUserId` + `sessionsByUserId`). |
There was a problem hiding this comment.
This implementation detail + tree walking makes me feel like we should be doing something else here to simplify, because this code feels very brittle and confusing. I'd suggest we either:
1. Store the stores as a simple array
2. Use a different unique value as the key

WHY are these changes introduced?
Fixes #0000
WHAT is this pull request doing?
How to test your changes?
Post-release steps
Checklist
patchfor bug fixes ·minorfor new features ·majorfor breaking changes) and added a changeset withpnpm changeset add