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,88 @@
1
+ # Prerequisites
2
+
3
+ ## Zero-to-working install (macOS)
4
+
5
+ ```bash
6
+ # 1. Homebrew (if missing)
7
+ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
8
+
9
+ # 2. Node.js 18+ (required)
10
+ brew install node
11
+
12
+ # 3. Git (required)
13
+ brew install git
14
+
15
+ # 4. Shopify CLI 4.x (required)
16
+ npm install -g @shopify/cli@latest
17
+
18
+ # 5. GitHub CLI (optional — for pushing the repo)
19
+ brew install gh
20
+
21
+ # 6. This toolkit
22
+ npm install -g github:sagarchauhan005/shopify-agentic-dev-workflow
23
+ ```
24
+
25
+ ## Windows
26
+
27
+ - Node.js: https://nodejs.org (LTS installer)
28
+ - Git: https://git-scm.com/download/win
29
+ - Shopify CLI: `npm install -g @shopify/cli@latest` (run in PowerShell after Node install)
30
+ - GitHub CLI: https://cli.github.com
31
+ - Toolkit: `npm install -g github:sagarchauhan005/shopify-agentic-dev-workflow`
32
+
33
+ ## Linux (Ubuntu/Debian)
34
+
35
+ ```bash
36
+ curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
37
+ sudo apt-get install -y nodejs git
38
+ npm install -g @shopify/cli@latest
39
+ npm install -g github:sagarchauhan005/shopify-agentic-dev-workflow
40
+ ```
41
+
42
+ ## Verify
43
+
44
+ ```bash
45
+ shopify-agent doctor
46
+ # All rows should show OK
47
+ ```
48
+
49
+ ## Shopify access requirements
50
+
51
+ Each developer needs **one** of:
52
+
53
+ - Store owner access
54
+ - Staff access with theme/app permissions
55
+ - Collaborator access with theme/app permissions
56
+ - **Theme Access token** (simplest for theme-only work — see below)
57
+
58
+ ### Theme Access token (recommended for theme work)
59
+
60
+ The Theme Access token lets you run all theme commands without needing full Partners/staff login.
61
+
62
+ 1. In Shopify Admin → Online Store → Themes
63
+ 2. Install the [Theme Access app](https://apps.shopify.com/theme-access)
64
+ 3. Generate a password (one per developer, or one for CI)
65
+ 4. Enter it when `shopify-agent init` asks for a Theme Access token
66
+
67
+ Store it as `SHOPIFY_CLI_THEME_TOKEN` in `.env` (never commit).
68
+
69
+ ## Auth model
70
+
71
+ This toolkit supports two local auth modes:
72
+
73
+ | Mode | How | Best for |
74
+ |---|---|---|
75
+ | Shopify CLI session | `shopify auth login` (browser OAuth) | Local dev with full Partners access |
76
+ | Theme Access token | Password from Theme Access app | Theme-only work, CI, agencies |
77
+
78
+ Shopify CLI stores its session internally. This toolkit invokes CLI commands and never reads or copies Shopify's internal tokens.
79
+
80
+ ## Codex MCP
81
+
82
+ Install Shopify Dev MCP into Codex so it uses current Shopify docs and schemas:
83
+
84
+ ```bash
85
+ shopify-agent mcp:install
86
+ ```
87
+
88
+ Then restart Codex.
@@ -0,0 +1,111 @@
1
+ # Developer Onboarding
2
+
3
+ ## First-Time Setup
4
+
5
+ Clone the repo:
6
+
7
+ ```bash
8
+ git clone <repo-url>
9
+ cd <repo-folder>
10
+ ```
11
+
12
+ Configure local values:
13
+
14
+ ```bash
15
+ npm run setup
16
+ ```
17
+
18
+ During setup:
19
+
20
+ - Log in with Shopify CLI when prompted, or skip and run `npm run auth` later.
21
+ - Enter the store domain.
22
+ - Let the tool fetch themes.
23
+ - Select a staging or unpublished theme.
24
+ - Save the resulting local profile.
25
+
26
+ Check the machine:
27
+
28
+ ```bash
29
+ npm run doctor
30
+ ```
31
+
32
+ Install Shopify Dev MCP for Codex:
33
+
34
+ ```bash
35
+ npm run mcp:install
36
+ ```
37
+
38
+ Restart Codex.
39
+
40
+ ## Authenticate Shopify CLI
41
+
42
+ Preferred local path:
43
+
44
+ ```bash
45
+ npm run auth
46
+ ```
47
+
48
+ For browser login:
49
+
50
+ ```bash
51
+ shopify theme info --store your-store.myshopify.com
52
+ ```
53
+
54
+ For Theme Access token auth, put the token in `.env`:
55
+
56
+ ```bash
57
+ SHOPIFY_CLI_THEME_TOKEN=...
58
+ ```
59
+
60
+ ## Validate Theme Access
61
+
62
+ ```bash
63
+ npm run theme:list
64
+ npm run theme:select
65
+ npm run theme:pull
66
+ npm run theme:check
67
+ npm run theme:dev
68
+ ```
69
+
70
+ ## Profiles
71
+
72
+ List profiles:
73
+
74
+ ```bash
75
+ npm run profile:list
76
+ ```
77
+
78
+ Switch profiles:
79
+
80
+ ```bash
81
+ node ./bin/shopify-agent.js profile:use
82
+ ```
83
+
84
+ Profiles let one developer switch between client stores, staging themes, and app configs without changing code.
85
+
86
+ ## Validate App Access
87
+
88
+ From a Shopify app directory:
89
+
90
+ ```bash
91
+ npm run app:dev
92
+ ```
93
+
94
+ If the app is not inside this repo, run the underlying Shopify CLI command from the app repo:
95
+
96
+ ```bash
97
+ shopify app dev
98
+ ```
99
+
100
+ ## First Codex Task
101
+
102
+ Use `templates/prompts/theme-task.md` and replace the placeholders.
103
+
104
+ Ask Codex to:
105
+
106
+ - Inspect the current theme files.
107
+ - Explain the files it will change.
108
+ - Implement the smallest scoped change.
109
+ - Run Theme Check.
110
+ - Start local preview.
111
+ - Use Browser QA for mobile and desktop.
@@ -0,0 +1,106 @@
1
+ # Theme SDLC
2
+
3
+ ## Default Rule
4
+
5
+ Never write directly to the live theme first. Work against a staging/unpublished theme or a Shopify development theme.
6
+
7
+ ## Pull
8
+
9
+ List and select the active theme first:
10
+
11
+ ```bash
12
+ npm run theme:list
13
+ npm run theme:select
14
+ ```
15
+
16
+ ```bash
17
+ npm run theme:pull
18
+ ```
19
+
20
+ Theme files are pulled into a unique folder:
21
+
22
+ ```text
23
+ themes/<theme-name>-<theme-id>/
24
+ ```
25
+
26
+ Do not pull theme files into the project root. Each theme folder includes `.shopify-theme.json` metadata so the CLI can detect if a folder belongs to a different store or theme.
27
+
28
+ This uses:
29
+
30
+ - `SHOPIFY_STORE`
31
+ - `SHOPIFY_THEME_ID`
32
+ - `SHOPIFY_CLI_THEME_TOKEN`
33
+
34
+ If `SHOPIFY_CLI_THEME_TOKEN` is missing, Shopify CLI uses its logged-in local session.
35
+
36
+ ## Develop
37
+
38
+ ```bash
39
+ npm run theme:dev
40
+ ```
41
+
42
+ Use Codex to edit:
43
+
44
+ - `sections/*.liquid`
45
+ - `snippets/*.liquid`
46
+ - `assets/*.css`
47
+ - `assets/*.js`
48
+ - `templates/*.json`
49
+ - `config/settings_schema.json`
50
+
51
+ Keep each theme's work inside its own folder. If a merchant duplicates a theme in Shopify, pull it as a separate folder and commit that snapshot before editing. Do not reuse a folder from another theme ID.
52
+
53
+ ## Validate
54
+
55
+ ```bash
56
+ npm run theme:check
57
+ ```
58
+
59
+ For visual QA, Codex should open the preview in Browser and inspect:
60
+
61
+ - Home page.
62
+ - Product page.
63
+ - Collection page.
64
+ - Cart.
65
+ - Search.
66
+ - Header/menu.
67
+ - Mobile viewport.
68
+ - Desktop viewport.
69
+
70
+ ## Push
71
+
72
+ ```bash
73
+ npm run theme:push
74
+ ```
75
+
76
+ Push only to the configured staging/unpublished theme.
77
+
78
+ The worktree must be clean before pushing. Commit or stash changes first so the pushed code is traceable:
79
+
80
+ ```bash
81
+ git add themes
82
+ git commit -m "Describe the theme change"
83
+ ```
84
+
85
+ ## Publish
86
+
87
+ Publishing requires an explicit environment variable:
88
+
89
+ ```bash
90
+ CONFIRM_PUBLISH=yes npm run theme:publish
91
+ ```
92
+
93
+ Before publishing, attach:
94
+
95
+ - Files changed.
96
+ - Theme Check result.
97
+ - Desktop/mobile screenshots or notes.
98
+ - Rollback theme id.
99
+
100
+ ## Rollback
101
+
102
+ Rollback options:
103
+
104
+ - Publish the previous theme from Shopify CLI.
105
+ - Revert the Git commit and push again.
106
+ - Restore from a duplicate theme.
@@ -0,0 +1,66 @@
1
+ # App SDLC
2
+
3
+ ## App Creation
4
+
5
+ For a new app:
6
+
7
+ ```bash
8
+ shopify app init
9
+ ```
10
+
11
+ For an existing app, keep app code in a normal Git repo and keep `shopify.app.toml` under review.
12
+
13
+ ## Local Development
14
+
15
+ ```bash
16
+ shopify app dev
17
+ ```
18
+
19
+ Shopify CLI handles the local preview, tunnel, app URL updates, and supported extension hot reload.
20
+
21
+ ## Extensions
22
+
23
+ Generate extensions with:
24
+
25
+ ```bash
26
+ shopify app generate extension
27
+ ```
28
+
29
+ Use Codex with Shopify Dev MCP when creating:
30
+
31
+ - Theme app extensions.
32
+ - Admin UI extensions.
33
+ - Checkout UI extensions.
34
+ - Customer account extensions.
35
+ - Shopify Functions.
36
+
37
+ ## Config
38
+
39
+ Use `shopify.app.toml` and environment-specific files such as:
40
+
41
+ - `shopify.app.dev.toml`
42
+ - `shopify.app.staging.toml`
43
+ - `shopify.app.production.toml`
44
+
45
+ Validate config:
46
+
47
+ ```bash
48
+ shopify app config validate
49
+ ```
50
+
51
+ ## Deploy
52
+
53
+ ```bash
54
+ shopify app deploy
55
+ ```
56
+
57
+ Important: `shopify app deploy` deploys app configuration and extensions. It does not deploy the web app server to Vercel, Cloud Run, Fly.io, or another hosting provider.
58
+
59
+ ## Logs
60
+
61
+ ```bash
62
+ shopify app logs
63
+ ```
64
+
65
+ Use logs during smoke tests after extension/app deploys.
66
+
@@ -0,0 +1,58 @@
1
+ # Admin API Operations
2
+
3
+ ## Recommended Boundary
4
+
5
+ Use Shopify Admin GraphQL for store data and operations, but separate dev-store execution from production writes.
6
+
7
+ Good Codex-driven operations:
8
+
9
+ - Product audits.
10
+ - SEO missing-field reports.
11
+ - Metafield definition planning.
12
+ - Collection analysis.
13
+ - Inventory risk reports.
14
+ - GraphQL query generation.
15
+ - Dev-store mutation tests.
16
+
17
+ Production writes need stronger controls:
18
+
19
+ - Explicit human approval.
20
+ - Dry-run report.
21
+ - Mutation file committed to Git.
22
+ - Backup/export where practical.
23
+ - Rollback plan.
24
+
25
+ ## CLI Execution
26
+
27
+ Run a GraphQL file against the configured store:
28
+
29
+ ```bash
30
+ node ./bin/shopify-agent.js admin:query templates/graphql/shop-query.graphql
31
+ ```
32
+
33
+ Shopify CLI `app execute` supports Admin GraphQL execution. Treat mutations as development-store only unless Shopify changes the CLI behavior and your team approves a production-write policy.
34
+
35
+ The wrapper adapts to different Shopify CLI versions. Some versions accept `--query-file` and `--version`; older versions only accept `--query`. The toolkit detects the installed command help and uses the supported path.
36
+
37
+ ## Custom Admin Bridge
38
+
39
+ For production automation, build a small internal app/API bridge instead of giving Codex unbounded store control.
40
+
41
+ Minimum features:
42
+
43
+ - Uses Shopify GraphQL Admin API.
44
+ - Uses least-privilege scopes.
45
+ - Has allowlisted operations.
46
+ - Requires a dry-run mode.
47
+ - Requires approval for mutations.
48
+ - Logs actor, request, response, and rollback metadata.
49
+ - Supports rate-limit backoff.
50
+
51
+ Suggested MCP/tool split:
52
+
53
+ - `shopify-products-admin`
54
+ - `shopify-orders-admin`
55
+ - `shopify-inventory-admin`
56
+ - `shopify-content-admin`
57
+
58
+ Smaller tool surfaces reduce accidental tool selection.
@@ -0,0 +1,37 @@
1
+ # Codex Prompt Playbook
2
+
3
+ ## Theme Task
4
+
5
+ Use:
6
+
7
+ ```text
8
+ Use Shopify Dev MCP if available. Inspect the theme structure first. Implement only the requested change. Run Theme Check. Start Shopify theme dev if needed. Verify desktop and mobile with Browser. Do not publish.
9
+
10
+ Task:
11
+ <describe task>
12
+
13
+ Acceptance criteria:
14
+ <list criteria>
15
+ ```
16
+
17
+ ## Liquid Review
18
+
19
+ ```text
20
+ Review this Shopify theme change for Liquid syntax, section schema correctness, accessibility, responsiveness, and performance. Prioritize findings with file and line references. Do not refactor unless needed to fix a bug.
21
+ ```
22
+
23
+ ## Admin GraphQL Draft
24
+
25
+ ```text
26
+ Use Shopify Dev MCP to inspect the current Admin GraphQL schema. Generate a read-only query first. Validate scopes needed. Do not create a mutation until I approve the dry-run output.
27
+
28
+ Goal:
29
+ <describe store operation>
30
+ ```
31
+
32
+ ## Production Mutation Review
33
+
34
+ ```text
35
+ Review this Admin GraphQL mutation for production risk. Identify required scopes, affected resource count, rate-limit concerns, rollback plan, and dry-run checks. Do not execute it.
36
+ ```
37
+
@@ -0,0 +1,47 @@
1
+ # Security Guardrails
2
+
3
+ ## Secrets
4
+
5
+ Never commit:
6
+
7
+ - `.env`
8
+ - Theme Access passwords
9
+ - Admin API access tokens
10
+ - Client secrets
11
+ - Refresh tokens
12
+ - Private app credentials
13
+
14
+ Use:
15
+
16
+ - GitHub Actions secrets.
17
+ - 1Password, Bitwarden, Doppler, or another team secret manager.
18
+ - Separate credentials for local dev and CI.
19
+
20
+ ## Access Scopes
21
+
22
+ Use least privilege:
23
+
24
+ - Theme developer: theme scopes only.
25
+ - Product operator: product scopes only.
26
+ - Order operator: order scopes only.
27
+ - Inventory operator: inventory scopes only.
28
+
29
+ Avoid full store scopes for daily agentic workflows.
30
+
31
+ ## Production Writes
32
+
33
+ Production writes require:
34
+
35
+ - Explicit approval.
36
+ - Dry-run report.
37
+ - Mutation file in Git.
38
+ - Resource count.
39
+ - Rollback plan.
40
+ - Post-run audit.
41
+
42
+ ## Browser Automation
43
+
44
+ Use Browser/Chrome/Computer Use only when CLI/API paths cannot do the job.
45
+
46
+ Do not automate payment, password, or customer-sensitive workflows without explicit approval.
47
+
@@ -0,0 +1,30 @@
1
+ # GitHub Rollout
2
+
3
+ ## Create Repo
4
+
5
+ With GitHub CLI:
6
+
7
+ ```bash
8
+ git init
9
+ git add .
10
+ git commit -m "Initial Shopify agentic workflow toolkit"
11
+ gh repo create shopify-agentic-dev-workflow --private --source=. --remote=origin --push
12
+ ```
13
+
14
+ ## Team Setup
15
+
16
+ Add branch protections:
17
+
18
+ - Require PR review.
19
+ - Require status checks for Theme Check.
20
+ - Require signed or linear commits if your team uses them.
21
+ - Restrict direct pushes to `main`.
22
+
23
+ Add repository secrets:
24
+
25
+ - `SHOPIFY_FLAG_STORE`
26
+ - `SHOPIFY_CLI_THEME_TOKEN`
27
+ - `SHOPIFY_STAGING_THEME_ID`
28
+
29
+ Do not store production Admin API write tokens unless you have a formal approval workflow.
30
+