shopify-agentic-dev-workflow 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/.cursor/rules/shopify-agentic-dev.mdc +290 -0
  2. package/AGENTS.md +285 -0
  3. package/CHANGELOG.md +14 -0
  4. package/CLAUDE.md +285 -0
  5. package/GEMINI.md +285 -0
  6. package/HANDOFF.md +351 -0
  7. package/LICENSE +21 -0
  8. package/README.md +370 -0
  9. package/bin/shopify-agent.js +2786 -0
  10. package/docs/00-prerequisites.md +88 -0
  11. package/docs/01-onboarding.md +111 -0
  12. package/docs/02-theme-sdlc.md +106 -0
  13. package/docs/03-app-sdlc.md +66 -0
  14. package/docs/04-admin-api-ops.md +58 -0
  15. package/docs/05-codex-prompts.md +37 -0
  16. package/docs/06-security-guardrails.md +47 -0
  17. package/docs/07-github-rollout.md +30 -0
  18. package/docs/08-product-design.md +168 -0
  19. package/docs/09-shopify-cli-4-capabilities.md +48 -0
  20. package/docs/10-field-learnings.md +66 -0
  21. package/package.json +82 -0
  22. package/scripts/bootstrap.sh +35 -0
  23. package/scripts/validate-graphql.js +303 -0
  24. package/templates/.env.example +20 -0
  25. package/templates/codex-config.toml +3 -0
  26. package/templates/github-actions/deploy-theme.yml +32 -0
  27. package/templates/graphql/content/pages-list.graphql +12 -0
  28. package/templates/graphql/content/redirects-list.graphql +9 -0
  29. package/templates/graphql/customers/new-customers.graphql +15 -0
  30. package/templates/graphql/customers/top-spenders.graphql +16 -0
  31. package/templates/graphql/discounts/active-discounts.graphql +27 -0
  32. package/templates/graphql/discounts-list.graphql +40 -0
  33. package/templates/graphql/inventory-audit.graphql +38 -0
  34. package/templates/graphql/metafields/product-metafields.graphql +14 -0
  35. package/templates/graphql/orders/list-open.graphql +30 -0
  36. package/templates/graphql/orders/revenue-summary.graphql +15 -0
  37. package/templates/graphql/products/list.graphql +16 -0
  38. package/templates/graphql/products/low-inventory.graphql +18 -0
  39. package/templates/graphql/products-seo-audit.graphql +14 -0
  40. package/templates/graphql/shop-query.graphql +9 -0
  41. package/templates/graphql/store/full-info.graphql +23 -0
  42. package/templates/graphql/store/webhooks.graphql +16 -0
  43. package/templates/prompts/admin-operation.md +12 -0
  44. package/templates/prompts/theme-task.md +19 -0
package/CLAUDE.md ADDED
@@ -0,0 +1,285 @@
1
+ # Shopify Agentic Dev Workflow — Agent Guardrails
2
+
3
+ This project is managed by `shopify-agentic-dev-workflow`.
4
+ All store operations run through the `shopify-agent` CLI. Never call Shopify Admin GraphQL directly — always use the commands below.
5
+
6
+ ---
7
+
8
+ ## Hard Rules — Never Bypass These
9
+
10
+ 1. **Never push to a live/published theme without explicit user confirmation.**
11
+ - Before any `theme:push` or `shopify theme push`, check if the active theme is live (role: live).
12
+ - If it is live: STOP, explain the consequences below, and ask the user to choose:
13
+ a. Push to a NEW staging theme (`--unpublished`) — RECOMMENDED
14
+ b. Push to live (CLI requires typing the store domain to confirm)
15
+ - If the user chooses staging: run `shopify-agent theme:push` and tell them to preview before publishing.
16
+ - Never silently push to a live theme.
17
+
18
+ 2. **Never publish a theme without explicit user confirmation.**
19
+ - `shopify-agent theme:publish` prompts before going live — never skip or auto-approve on the user's behalf.
20
+ - Use `--yes` only when the user has already previewed and explicitly approved the theme for publication.
21
+
22
+ 3. **Never run any mutation command without explicit user confirmation.**
23
+ - Every write command (`inventory:set`, `inventory:adjust`, `products:create`, `products:delete`,
24
+ `variants:update`, `orders:cancel`, `orders:close`, `customers:create`, `customers:tags`,
25
+ `discounts:create`, `discounts:delete`, `discounts:enable`, `discounts:disable`,
26
+ `gift-cards:create`, `pages:create`, `redirects:create`, `metafields:set`,
27
+ `collections:create`, `admin:mutate`) prompts for confirmation before executing.
28
+ - Always show what will change and which store before asking.
29
+ - Use `--yes` only when the user has already reviewed and explicitly approved the operation.
30
+
31
+ 4. **Never commit or print secrets.**
32
+ - Do not read, log, or include `.env`, access tokens, client secrets, or session tokens in any output.
33
+ - `.env` and `.shopify-agent/` are git-ignored — never stage them.
34
+
35
+ 5. **Never mix files between themes or pull into the project root.**
36
+ - Theme code lives under `themes/<theme-name>-<theme-id>/`, never directly in the package root.
37
+ - Before `theme:pull`, `theme:push`, or `theme:publish`, verify the active store, theme ID, theme role, and local theme folder metadata.
38
+ - If the Git worktree is dirty, stop and ask the user to commit or stash first. Pulling Theme A into Theme B's folder or branch is a release blocker.
39
+
40
+ ---
41
+
42
+ ## Live Theme Consequences (always explain before any live push)
43
+
44
+ - The storefront updates IMMEDIATELY — customers browsing right now see the new code
45
+ - Liquid errors, broken CSS, or JS issues go live instantly
46
+ - Shopify does NOT auto-revert — rollback requires manually republishing the previous theme
47
+ - A single typo in a section template can render pages blank for real customers
48
+
49
+ ---
50
+
51
+ ## Setup & Diagnostics
52
+
53
+ ```bash
54
+ shopify-agent init # Full interactive setup wizard (connect store, auth, pick theme)
55
+ shopify-agent doctor # Check tools, show active config + install hints
56
+ shopify-agent capabilities # Detect which Shopify CLI 4.x commands are available
57
+ shopify-agent auth # shopify auth login (opens browser)
58
+ shopify-agent agents:install # Write/update these guardrail files
59
+ shopify-agent mcp:install # Add Shopify Dev MCP to ~/.codex/config.toml
60
+ shopify-agent profile:list # List saved profiles
61
+ shopify-agent profile:use # Switch active profile
62
+ shopify-agent store:list # Show Shopify orgs linked to your account
63
+ shopify-agent store:auth # Create Admin API token with selected scopes
64
+ ```
65
+
66
+ ---
67
+
68
+ ## Theme Development (Developers)
69
+
70
+ ```bash
71
+ shopify-agent theme:list # List themes with roles (live vs unpublished)
72
+ shopify-agent theme:select # Pick active theme (live ⚠ warning included)
73
+ shopify-agent theme:pull # Download theme files locally
74
+ shopify-agent theme:dev # Hot-reload dev server — opens browser automatically
75
+ shopify-agent theme:check # Liquid linting via Theme Check
76
+ shopify-agent theme:push # Push to staging (3-option guard if theme is live)
77
+ shopify-agent theme:publish # Prompts for confirmation before going live
78
+ ```
79
+
80
+ Recommended theme dev workflow:
81
+ 1. `shopify-agent init` → select an UNPUBLISHED staging theme
82
+ 2. `shopify-agent theme:pull` → download theme files into `themes/<theme-name>-<theme-id>/`
83
+ 3. `shopify-agent theme:dev` → hot-reload dev server
84
+ 4. Edit Liquid / CSS / JS files locally
85
+ 5. `shopify-agent theme:check` → lint after edits
86
+ 6. `shopify-agent theme:push` → push to staging theme
87
+ 7. Preview in Shopify Admin → Themes → Preview
88
+ 8. `shopify-agent theme:publish` → go live after review
89
+
90
+ If the user asks to push to a live theme, respond:
91
+ > "The configured theme is LIVE. I recommend `shopify-agent theme:push` which will offer a safe staging option. Push directly only after you confirm the store domain."
92
+
93
+ ### Theme Folder and Git Discipline
94
+
95
+ - Treat each Shopify theme as its own versioned artifact: `themes/dawn-169809707321/`, `themes/brand-refresh-123456789/`, etc.
96
+ - A pull must write only into the folder for the selected `SHOPIFY_THEME_ID`. If files appear in the repo root, stop and fix the command/path before continuing.
97
+ - Commit after every successful pull and before every push. This gives the team a rollback point and prevents accidental Theme A/Theme B overwrites.
98
+ - Do not switch themes by editing files in place. Run `shopify-agent theme:select`, then `shopify-agent theme:pull`, and let the CLI create or reuse the matching theme folder.
99
+ - Never remove, rewrite, or bypass `.shopify-theme.json` metadata in a theme folder; it is the local proof that the folder belongs to the selected store and theme.
100
+
101
+ ### Figma-to-Dawn Build Rules
102
+
103
+ - Read the Figma file before coding, then map frames to Dawn sections/templates: home, collection/PLP, product/PDP, cart, header, and footer.
104
+ - Build real Shopify Liquid sections with schema settings instead of static HTML where merchants may need control later.
105
+ - Keep design-preview data and live Shopify data separate. Demo store products can break the visual match; add explicit settings such as "Use live collection products" or "Use live product data" before letting catalog data override Figma assets.
106
+ - Make header, menu, product-card, CTA, social, and footer links real and clickable. Fallback links should go to search, collection, product, account, cart, or policy URLs, not dead placeholders.
107
+ - After frontend work, run `shopify-agent theme:check` and visually inspect desktop and mobile previews for home, collection, product, header, footer, and horizontal overflow.
108
+
109
+ ---
110
+
111
+ ## App Development (Developers)
112
+
113
+ ```bash
114
+ shopify-agent app:dev # shopify app dev
115
+ shopify-agent app:deploy # shopify app deploy
116
+ ```
117
+
118
+ ---
119
+
120
+ ## Raw GraphQL (Developers / Power Users)
121
+
122
+ ```bash
123
+ shopify-agent admin:query <file.graphql> # Read-only Admin GraphQL
124
+ shopify-agent admin:mutate <file.graphql> # Mutation (always prompts for confirmation)
125
+ ```
126
+
127
+ Pre-built templates in `templates/graphql/`:
128
+ - `shop-query.graphql`, `inventory-audit.graphql`, `discounts-list.graphql`, `products-seo-audit.graphql`
129
+ - `products/list.graphql`, `products/low-inventory.graphql`
130
+ - `orders/list-open.graphql`, `orders/revenue-summary.graphql`
131
+ - `customers/top-spenders.graphql`, `customers/new-customers.graphql`
132
+ - `discounts/active-discounts.graphql`
133
+ - `store/full-info.graphql`, `store/webhooks.graphql`
134
+ - `content/pages-list.graphql`, `content/redirects-list.graphql`
135
+ - `metafields/product-metafields.graphql`
136
+
137
+ Schema hygiene:
138
+ - Shopify Admin GraphQL is versioned and fields move or disappear. If a query fails with `undefinedField`, treat the template as stale and update it against the configured `SHOPIFY_API_VERSION`.
139
+ - Do not assume dashboard, discount, inventory, or product payload shapes from memory. Run the smallest read-only query first, then expand.
140
+ - Keep mutations behind `admin:mutate` so the CLI confirmation and store context are visible before anything changes.
141
+
142
+ ---
143
+
144
+ ## Products & Catalog (Catalogers)
145
+
146
+ ```bash
147
+ shopify-agent products:list [--status active|draft|archived] [--limit N]
148
+ shopify-agent products:get # Interactive full product detail viewer
149
+ shopify-agent products:create # Wizard: title, type, vendor, price, SKU, inventory, status
150
+ shopify-agent products:publish # Set product to Active (visible in store) — prompts
151
+ shopify-agent products:archive # Set product to Archived — prompts
152
+ shopify-agent products:draft # Set product back to Draft — prompts
153
+ shopify-agent products:delete # Delete a product — prompts with confirmation
154
+
155
+ shopify-agent variants:list # Pick a product → see all variants with price/SKU/qty
156
+ shopify-agent variants:update # Update price, SKU, barcode for a variant — prompts
157
+
158
+ shopify-agent collections:list # List all collections (manual + smart)
159
+ shopify-agent collections:create # Wizard: manual or smart (with rule builder) — prompts
160
+ ```
161
+
162
+ ---
163
+
164
+ ## Inventory (Catalogers / Operations)
165
+
166
+ ```bash
167
+ shopify-agent inventory:list # List all inventory levels across locations
168
+ shopify-agent inventory:set <qty> # Set ALL variants to <qty> in bulk — prompts
169
+ shopify-agent inventory:adjust # Adjust one variant: +5, -3, or =10 — prompts
170
+ ```
171
+
172
+ ---
173
+
174
+ ## Orders (Business Admins)
175
+
176
+ ```bash
177
+ shopify-agent orders:list [--status open|closed|cancelled|any] [--limit N]
178
+ shopify-agent orders:get # Full order detail: line items, tracking, totals
179
+ shopify-agent orders:cancel # Cancel an open order (choose reason, refund, restock) — prompts
180
+ shopify-agent orders:close # Mark an order as closed — prompts
181
+ ```
182
+
183
+ ---
184
+
185
+ ## Customers (Business Admins / Marketing)
186
+
187
+ ```bash
188
+ shopify-agent customers:list [--limit N]
189
+ shopify-agent customers:search # Search by name, email, phone, or tag
190
+ shopify-agent customers:get # Full customer profile + recent order history
191
+ shopify-agent customers:create # Wizard: name, email, phone, tags, marketing opt-in — prompts
192
+ shopify-agent customers:tags # Add or remove tags on a customer — prompts
193
+ ```
194
+
195
+ ---
196
+
197
+ ## Discounts & Gift Cards (Marketing)
198
+
199
+ ```bash
200
+ shopify-agent discounts:list # List all discount codes with usage stats
201
+ shopify-agent discounts:create # Wizard: % off, fixed amount, per-customer limit, expiry — prompts
202
+ shopify-agent discounts:delete # Delete a discount code — prompts
203
+ shopify-agent discounts:enable # Re-activate a disabled discount — prompts
204
+ shopify-agent discounts:disable # Deactivate without deleting — prompts
205
+
206
+ shopify-agent gift-cards:list # List all gift cards with balance
207
+ shopify-agent gift-cards:create # Create a gift card (with optional customer assignment) — prompts
208
+ ```
209
+
210
+ ---
211
+
212
+ ## Store Info (Business Admins)
213
+
214
+ ```bash
215
+ shopify-agent store:info # Name, plan, currency, timezone, multi-currency
216
+ shopify-agent store:locations # List locations with fulfillment status
217
+ shopify-agent store:dashboard # Snapshot: open orders + low-stock + active discounts
218
+ shopify-agent dashboard # Alias for store:dashboard
219
+ ```
220
+
221
+ ---
222
+
223
+ ## Content (Marketing)
224
+
225
+ ```bash
226
+ shopify-agent pages:list # List all pages
227
+ shopify-agent pages:create # Wizard: title, body HTML, publish immediately — prompts
228
+ shopify-agent blogs:list # List blogs with 5 recent articles each
229
+ shopify-agent articles:list # Pick a blog → list articles with author + status
230
+ shopify-agent redirects:list # List all URL redirects
231
+ shopify-agent redirects:create # Create a URL redirect (from → to) — prompts
232
+ ```
233
+
234
+ ---
235
+
236
+ ## Metafields (Developers / Catalogers)
237
+
238
+ ```bash
239
+ shopify-agent metafields:list # List metafields for any resource
240
+ shopify-agent metafields:set # Create or update a metafield on any resource — prompts
241
+ # Works with: Product, Collection, Customer, Order, Shop
242
+ ```
243
+
244
+ ---
245
+
246
+ ## Flags
247
+
248
+ ```bash
249
+ --yes, -y Auto-confirm all prompts (scripting / CI — only use after reviewing the operation)
250
+ --status <s> Filter by status where supported (products:list, orders:list)
251
+ --limit <n> Limit result count where supported
252
+ ```
253
+
254
+ ---
255
+
256
+ ## Role-Based Workflow Examples
257
+
258
+ **Cataloger — bulk inventory reset before a sale:**
259
+ ```bash
260
+ shopify-agent inventory:list # review current levels
261
+ shopify-agent inventory:set 50 # bulk-set all variants to 50 (prompts)
262
+ shopify-agent products:list --status active --limit 50 # verify
263
+ ```
264
+
265
+ **Marketing — launch a discount campaign:**
266
+ ```bash
267
+ shopify-agent discounts:list # check existing codes
268
+ shopify-agent discounts:create # wizard → 10% off, first order, 7-day expiry (prompts)
269
+ shopify-agent pages:create # create a landing page for the campaign (prompts)
270
+ ```
271
+
272
+ **Business admin — morning dashboard:**
273
+ ```bash
274
+ shopify-agent dashboard # open orders + low-stock + active discounts
275
+ shopify-agent orders:list --status open
276
+ shopify-agent customers:list --limit 10
277
+ ```
278
+
279
+ **Developer — theme deploy pipeline:**
280
+ ```bash
281
+ shopify-agent theme:check # lint
282
+ shopify-agent theme:push # push to staging
283
+ # preview in Admin
284
+ shopify-agent theme:publish # go live (prompts)
285
+ ```
package/GEMINI.md ADDED
@@ -0,0 +1,285 @@
1
+ # Shopify Agentic Dev Workflow — Agent Guardrails
2
+
3
+ This project is managed by `shopify-agentic-dev-workflow`.
4
+ All store operations run through the `shopify-agent` CLI. Never call Shopify Admin GraphQL directly — always use the commands below.
5
+
6
+ ---
7
+
8
+ ## Hard Rules — Never Bypass These
9
+
10
+ 1. **Never push to a live/published theme without explicit user confirmation.**
11
+ - Before any `theme:push` or `shopify theme push`, check if the active theme is live (role: live).
12
+ - If it is live: STOP, explain the consequences below, and ask the user to choose:
13
+ a. Push to a NEW staging theme (`--unpublished`) — RECOMMENDED
14
+ b. Push to live (CLI requires typing the store domain to confirm)
15
+ - If the user chooses staging: run `shopify-agent theme:push` and tell them to preview before publishing.
16
+ - Never silently push to a live theme.
17
+
18
+ 2. **Never publish a theme without explicit user confirmation.**
19
+ - `shopify-agent theme:publish` prompts before going live — never skip or auto-approve on the user's behalf.
20
+ - Use `--yes` only when the user has already previewed and explicitly approved the theme for publication.
21
+
22
+ 3. **Never run any mutation command without explicit user confirmation.**
23
+ - Every write command (`inventory:set`, `inventory:adjust`, `products:create`, `products:delete`,
24
+ `variants:update`, `orders:cancel`, `orders:close`, `customers:create`, `customers:tags`,
25
+ `discounts:create`, `discounts:delete`, `discounts:enable`, `discounts:disable`,
26
+ `gift-cards:create`, `pages:create`, `redirects:create`, `metafields:set`,
27
+ `collections:create`, `admin:mutate`) prompts for confirmation before executing.
28
+ - Always show what will change and which store before asking.
29
+ - Use `--yes` only when the user has already reviewed and explicitly approved the operation.
30
+
31
+ 4. **Never commit or print secrets.**
32
+ - Do not read, log, or include `.env`, access tokens, client secrets, or session tokens in any output.
33
+ - `.env` and `.shopify-agent/` are git-ignored — never stage them.
34
+
35
+ 5. **Never mix files between themes or pull into the project root.**
36
+ - Theme code lives under `themes/<theme-name>-<theme-id>/`, never directly in the package root.
37
+ - Before `theme:pull`, `theme:push`, or `theme:publish`, verify the active store, theme ID, theme role, and local theme folder metadata.
38
+ - If the Git worktree is dirty, stop and ask the user to commit or stash first. Pulling Theme A into Theme B's folder or branch is a release blocker.
39
+
40
+ ---
41
+
42
+ ## Live Theme Consequences (always explain before any live push)
43
+
44
+ - The storefront updates IMMEDIATELY — customers browsing right now see the new code
45
+ - Liquid errors, broken CSS, or JS issues go live instantly
46
+ - Shopify does NOT auto-revert — rollback requires manually republishing the previous theme
47
+ - A single typo in a section template can render pages blank for real customers
48
+
49
+ ---
50
+
51
+ ## Setup & Diagnostics
52
+
53
+ ```bash
54
+ shopify-agent init # Full interactive setup wizard (connect store, auth, pick theme)
55
+ shopify-agent doctor # Check tools, show active config + install hints
56
+ shopify-agent capabilities # Detect which Shopify CLI 4.x commands are available
57
+ shopify-agent auth # shopify auth login (opens browser)
58
+ shopify-agent agents:install # Write/update these guardrail files
59
+ shopify-agent mcp:install # Add Shopify Dev MCP to ~/.codex/config.toml
60
+ shopify-agent profile:list # List saved profiles
61
+ shopify-agent profile:use # Switch active profile
62
+ shopify-agent store:list # Show Shopify orgs linked to your account
63
+ shopify-agent store:auth # Create Admin API token with selected scopes
64
+ ```
65
+
66
+ ---
67
+
68
+ ## Theme Development (Developers)
69
+
70
+ ```bash
71
+ shopify-agent theme:list # List themes with roles (live vs unpublished)
72
+ shopify-agent theme:select # Pick active theme (live ⚠ warning included)
73
+ shopify-agent theme:pull # Download theme files locally
74
+ shopify-agent theme:dev # Hot-reload dev server — opens browser automatically
75
+ shopify-agent theme:check # Liquid linting via Theme Check
76
+ shopify-agent theme:push # Push to staging (3-option guard if theme is live)
77
+ shopify-agent theme:publish # Prompts for confirmation before going live
78
+ ```
79
+
80
+ Recommended theme dev workflow:
81
+ 1. `shopify-agent init` → select an UNPUBLISHED staging theme
82
+ 2. `shopify-agent theme:pull` → download theme files into `themes/<theme-name>-<theme-id>/`
83
+ 3. `shopify-agent theme:dev` → hot-reload dev server
84
+ 4. Edit Liquid / CSS / JS files locally
85
+ 5. `shopify-agent theme:check` → lint after edits
86
+ 6. `shopify-agent theme:push` → push to staging theme
87
+ 7. Preview in Shopify Admin → Themes → Preview
88
+ 8. `shopify-agent theme:publish` → go live after review
89
+
90
+ If the user asks to push to a live theme, respond:
91
+ > "The configured theme is LIVE. I recommend `shopify-agent theme:push` which will offer a safe staging option. Push directly only after you confirm the store domain."
92
+
93
+ ### Theme Folder and Git Discipline
94
+
95
+ - Treat each Shopify theme as its own versioned artifact: `themes/dawn-169809707321/`, `themes/brand-refresh-123456789/`, etc.
96
+ - A pull must write only into the folder for the selected `SHOPIFY_THEME_ID`. If files appear in the repo root, stop and fix the command/path before continuing.
97
+ - Commit after every successful pull and before every push. This gives the team a rollback point and prevents accidental Theme A/Theme B overwrites.
98
+ - Do not switch themes by editing files in place. Run `shopify-agent theme:select`, then `shopify-agent theme:pull`, and let the CLI create or reuse the matching theme folder.
99
+ - Never remove, rewrite, or bypass `.shopify-theme.json` metadata in a theme folder; it is the local proof that the folder belongs to the selected store and theme.
100
+
101
+ ### Figma-to-Dawn Build Rules
102
+
103
+ - Read the Figma file before coding, then map frames to Dawn sections/templates: home, collection/PLP, product/PDP, cart, header, and footer.
104
+ - Build real Shopify Liquid sections with schema settings instead of static HTML where merchants may need control later.
105
+ - Keep design-preview data and live Shopify data separate. Demo store products can break the visual match; add explicit settings such as "Use live collection products" or "Use live product data" before letting catalog data override Figma assets.
106
+ - Make header, menu, product-card, CTA, social, and footer links real and clickable. Fallback links should go to search, collection, product, account, cart, or policy URLs, not dead placeholders.
107
+ - After frontend work, run `shopify-agent theme:check` and visually inspect desktop and mobile previews for home, collection, product, header, footer, and horizontal overflow.
108
+
109
+ ---
110
+
111
+ ## App Development (Developers)
112
+
113
+ ```bash
114
+ shopify-agent app:dev # shopify app dev
115
+ shopify-agent app:deploy # shopify app deploy
116
+ ```
117
+
118
+ ---
119
+
120
+ ## Raw GraphQL (Developers / Power Users)
121
+
122
+ ```bash
123
+ shopify-agent admin:query <file.graphql> # Read-only Admin GraphQL
124
+ shopify-agent admin:mutate <file.graphql> # Mutation (always prompts for confirmation)
125
+ ```
126
+
127
+ Pre-built templates in `templates/graphql/`:
128
+ - `shop-query.graphql`, `inventory-audit.graphql`, `discounts-list.graphql`, `products-seo-audit.graphql`
129
+ - `products/list.graphql`, `products/low-inventory.graphql`
130
+ - `orders/list-open.graphql`, `orders/revenue-summary.graphql`
131
+ - `customers/top-spenders.graphql`, `customers/new-customers.graphql`
132
+ - `discounts/active-discounts.graphql`
133
+ - `store/full-info.graphql`, `store/webhooks.graphql`
134
+ - `content/pages-list.graphql`, `content/redirects-list.graphql`
135
+ - `metafields/product-metafields.graphql`
136
+
137
+ Schema hygiene:
138
+ - Shopify Admin GraphQL is versioned and fields move or disappear. If a query fails with `undefinedField`, treat the template as stale and update it against the configured `SHOPIFY_API_VERSION`.
139
+ - Do not assume dashboard, discount, inventory, or product payload shapes from memory. Run the smallest read-only query first, then expand.
140
+ - Keep mutations behind `admin:mutate` so the CLI confirmation and store context are visible before anything changes.
141
+
142
+ ---
143
+
144
+ ## Products & Catalog (Catalogers)
145
+
146
+ ```bash
147
+ shopify-agent products:list [--status active|draft|archived] [--limit N]
148
+ shopify-agent products:get # Interactive full product detail viewer
149
+ shopify-agent products:create # Wizard: title, type, vendor, price, SKU, inventory, status
150
+ shopify-agent products:publish # Set product to Active (visible in store) — prompts
151
+ shopify-agent products:archive # Set product to Archived — prompts
152
+ shopify-agent products:draft # Set product back to Draft — prompts
153
+ shopify-agent products:delete # Delete a product — prompts with confirmation
154
+
155
+ shopify-agent variants:list # Pick a product → see all variants with price/SKU/qty
156
+ shopify-agent variants:update # Update price, SKU, barcode for a variant — prompts
157
+
158
+ shopify-agent collections:list # List all collections (manual + smart)
159
+ shopify-agent collections:create # Wizard: manual or smart (with rule builder) — prompts
160
+ ```
161
+
162
+ ---
163
+
164
+ ## Inventory (Catalogers / Operations)
165
+
166
+ ```bash
167
+ shopify-agent inventory:list # List all inventory levels across locations
168
+ shopify-agent inventory:set <qty> # Set ALL variants to <qty> in bulk — prompts
169
+ shopify-agent inventory:adjust # Adjust one variant: +5, -3, or =10 — prompts
170
+ ```
171
+
172
+ ---
173
+
174
+ ## Orders (Business Admins)
175
+
176
+ ```bash
177
+ shopify-agent orders:list [--status open|closed|cancelled|any] [--limit N]
178
+ shopify-agent orders:get # Full order detail: line items, tracking, totals
179
+ shopify-agent orders:cancel # Cancel an open order (choose reason, refund, restock) — prompts
180
+ shopify-agent orders:close # Mark an order as closed — prompts
181
+ ```
182
+
183
+ ---
184
+
185
+ ## Customers (Business Admins / Marketing)
186
+
187
+ ```bash
188
+ shopify-agent customers:list [--limit N]
189
+ shopify-agent customers:search # Search by name, email, phone, or tag
190
+ shopify-agent customers:get # Full customer profile + recent order history
191
+ shopify-agent customers:create # Wizard: name, email, phone, tags, marketing opt-in — prompts
192
+ shopify-agent customers:tags # Add or remove tags on a customer — prompts
193
+ ```
194
+
195
+ ---
196
+
197
+ ## Discounts & Gift Cards (Marketing)
198
+
199
+ ```bash
200
+ shopify-agent discounts:list # List all discount codes with usage stats
201
+ shopify-agent discounts:create # Wizard: % off, fixed amount, per-customer limit, expiry — prompts
202
+ shopify-agent discounts:delete # Delete a discount code — prompts
203
+ shopify-agent discounts:enable # Re-activate a disabled discount — prompts
204
+ shopify-agent discounts:disable # Deactivate without deleting — prompts
205
+
206
+ shopify-agent gift-cards:list # List all gift cards with balance
207
+ shopify-agent gift-cards:create # Create a gift card (with optional customer assignment) — prompts
208
+ ```
209
+
210
+ ---
211
+
212
+ ## Store Info (Business Admins)
213
+
214
+ ```bash
215
+ shopify-agent store:info # Name, plan, currency, timezone, multi-currency
216
+ shopify-agent store:locations # List locations with fulfillment status
217
+ shopify-agent store:dashboard # Snapshot: open orders + low-stock + active discounts
218
+ shopify-agent dashboard # Alias for store:dashboard
219
+ ```
220
+
221
+ ---
222
+
223
+ ## Content (Marketing)
224
+
225
+ ```bash
226
+ shopify-agent pages:list # List all pages
227
+ shopify-agent pages:create # Wizard: title, body HTML, publish immediately — prompts
228
+ shopify-agent blogs:list # List blogs with 5 recent articles each
229
+ shopify-agent articles:list # Pick a blog → list articles with author + status
230
+ shopify-agent redirects:list # List all URL redirects
231
+ shopify-agent redirects:create # Create a URL redirect (from → to) — prompts
232
+ ```
233
+
234
+ ---
235
+
236
+ ## Metafields (Developers / Catalogers)
237
+
238
+ ```bash
239
+ shopify-agent metafields:list # List metafields for any resource
240
+ shopify-agent metafields:set # Create or update a metafield on any resource — prompts
241
+ # Works with: Product, Collection, Customer, Order, Shop
242
+ ```
243
+
244
+ ---
245
+
246
+ ## Flags
247
+
248
+ ```bash
249
+ --yes, -y Auto-confirm all prompts (scripting / CI — only use after reviewing the operation)
250
+ --status <s> Filter by status where supported (products:list, orders:list)
251
+ --limit <n> Limit result count where supported
252
+ ```
253
+
254
+ ---
255
+
256
+ ## Role-Based Workflow Examples
257
+
258
+ **Cataloger — bulk inventory reset before a sale:**
259
+ ```bash
260
+ shopify-agent inventory:list # review current levels
261
+ shopify-agent inventory:set 50 # bulk-set all variants to 50 (prompts)
262
+ shopify-agent products:list --status active --limit 50 # verify
263
+ ```
264
+
265
+ **Marketing — launch a discount campaign:**
266
+ ```bash
267
+ shopify-agent discounts:list # check existing codes
268
+ shopify-agent discounts:create # wizard → 10% off, first order, 7-day expiry (prompts)
269
+ shopify-agent pages:create # create a landing page for the campaign (prompts)
270
+ ```
271
+
272
+ **Business admin — morning dashboard:**
273
+ ```bash
274
+ shopify-agent dashboard # open orders + low-stock + active discounts
275
+ shopify-agent orders:list --status open
276
+ shopify-agent customers:list --limit 10
277
+ ```
278
+
279
+ **Developer — theme deploy pipeline:**
280
+ ```bash
281
+ shopify-agent theme:check # lint
282
+ shopify-agent theme:push # push to staging
283
+ # preview in Admin
284
+ shopify-agent theme:publish # go live (prompts)
285
+ ```