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