@optima-chat/optima-agent 0.9.13 → 0.9.15
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.
- package/.claude/skills/.kb-skills-managed.json +9 -9
- package/.claude/skills/ads/SKILL.md +244 -244
- package/.claude/skills/ads/template/campaign/CREATIVES.md +18 -18
- package/.claude/skills/ads/template/campaign/NOTES.md +10 -10
- package/.claude/skills/ads/template/campaign/STRATEGY.md +29 -29
- package/.claude/skills/ads/template/user/ADS.md +29 -29
- package/.claude/skills/ads/template/user/LEARNINGS.md +15 -15
- package/.claude/skills/ads/template/user/PROGRESS.md +20 -20
- package/.claude/skills/ads/template/user/README.md +25 -25
- package/.claude/skills/ads/template/user/assets/.gitignore +2 -2
- package/.claude/skills/bi/SKILL.md +131 -131
- package/.claude/skills/browser/SKILL.md +201 -201
- package/.claude/skills/channels/SKILL.md +188 -188
- package/.claude/skills/collection/SKILL.md +88 -88
- package/.claude/skills/douyin/SKILL.md +408 -408
- package/.claude/skills/ffmpeg/SKILL.md +164 -164
- package/.claude/skills/gen/SKILL.md +327 -279
- package/.claude/skills/growth/SKILL.md +90 -90
- package/.claude/skills/growth/template/ACCOUNTS.md +14 -14
- package/.claude/skills/growth/template/CALENDAR.md +7 -7
- package/.claude/skills/growth/template/COMMENTS.md +7 -7
- package/.claude/skills/growth/template/GROWTH.md +37 -37
- package/.claude/skills/growth/template/PROGRESS.md +4 -4
- package/.claude/skills/growth/template/README.md +20 -20
- package/.claude/skills/growth/template/TOPICS.md +7 -7
- package/.claude/skills/homepage/SKILL.md +177 -177
- package/.claude/skills/i18n/SKILL.md +517 -517
- package/.claude/skills/ingesting-sources/SKILL.md +94 -94
- package/.claude/skills/initializing-kb/SKILL.md +117 -117
- package/.claude/skills/instagram/SKILL.md +321 -321
- package/.claude/skills/inventory/SKILL.md +328 -328
- package/.claude/skills/kol-outreach/SKILL.md +232 -232
- package/.claude/skills/kol-outreach/template/campaign/CONFIG.md +60 -60
- package/.claude/skills/kol-outreach/template/campaign/KOLS.md +6 -6
- package/.claude/skills/kol-outreach/template/campaign/PROGRESS.md +3 -3
- package/.claude/skills/kol-outreach/template/campaign/TEMPLATES.md +88 -88
- package/.claude/skills/kol-outreach/template/merchant/BRAND.md +36 -36
- package/.claude/skills/kol-outreach/template/merchant/CAMPAIGNS.md +6 -6
- package/.claude/skills/kol-outreach/template/merchant/MERCHANT_LIMITS.md +16 -16
- package/.claude/skills/kol-outreach/template/merchant/PROGRESS.md +4 -4
- package/.claude/skills/kol-outreach/template/merchant/README.md +20 -20
- package/.claude/skills/linting-the-wiki/SKILL.md +68 -68
- package/.claude/skills/logistics/SKILL.md +180 -180
- package/.claude/skills/markdown-pdf/SKILL.md +72 -72
- package/.claude/skills/merchant/SKILL.md +110 -110
- package/.claude/skills/multigrid-poster/SKILL.md +192 -192
- package/.claude/skills/multigrid-poster/layouts/2x2.json +34 -34
- package/.claude/skills/multigrid-poster/layouts/3x3.json +43 -43
- package/.claude/skills/multigrid-poster/scripts/compose.py +116 -116
- package/.claude/skills/order/SKILL.md +452 -452
- package/.claude/skills/product/SKILL.md +379 -379
- package/.claude/skills/product-page/SKILL.md +106 -106
- package/.claude/skills/querying-the-wiki/SKILL.md +59 -59
- package/.claude/skills/reddit/SKILL.md +277 -277
- package/.claude/skills/review/SKILL.md +321 -321
- package/.claude/skills/scout/SKILL.md +575 -575
- package/.claude/skills/sentinel/SKILL.md +281 -281
- package/.claude/skills/shein/SKILL.md +246 -246
- package/.claude/skills/shipping/SKILL.md +200 -200
- package/.claude/skills/shop-content/SKILL.md +101 -101
- package/.claude/skills/shopify/SKILL.md +282 -282
- package/.claude/skills/skillify/SKILL.md +114 -114
- package/.claude/skills/taobao/SKILL.md +238 -238
- package/.claude/skills/tiktok/SKILL.md +381 -381
- package/.claude/skills/twitter/SKILL.md +302 -302
- package/.claude/skills/updating-related-pages/SKILL.md +65 -65
- package/.claude/skills/video-edit/SKILL.md +123 -138
- package/.claude/skills/video-gen/SKILL.md +720 -720
- package/.claude/skills/video-gen/templates/INDEX.md +78 -78
- package/.claude/skills/video-gen/templates/before-after-beauty.md +183 -183
- package/.claude/skills/video-gen/templates/drama-fmcg.md +183 -183
- package/.claude/skills/video-gen/templates/kol-reaction-food.md +193 -193
- package/.claude/skills/video-gen/templates/multi-point-apparel.md +185 -185
- package/.claude/skills/video-gen/templates/pain-solution-home.md +184 -184
- package/.claude/skills/video-gen/templates/pdp-360-showcase.md +189 -189
- package/.claude/skills/video-gen/templates/pdp-feature-highlight.md +182 -182
- package/.claude/skills/video-gen/templates/scene-digital.md +183 -183
- package/.claude/skills/wechat/SKILL.md +174 -174
- package/.claude/skills/xhs/SKILL.md +170 -170
- package/README.md +276 -276
- package/dist/bin/optima.js +26 -26
- package/dist/bin/serve.js +23 -23
- package/dist/src/agent.d.ts +1 -1
- package/dist/src/agent.js +4 -4
- package/dist/src/system-prompt.js +175 -175
- package/dist/src/tools/memory.js +10 -10
- package/dist/src/ui/headless.js +7 -7
- package/package.json +79 -79
- package/dist/bin/video-edit.d.ts +0 -3
- package/dist/bin/video-edit.d.ts.map +0 -1
- package/dist/bin/video-edit.js +0 -153
- package/dist/bin/video-edit.js.map +0 -1
|
@@ -1,282 +1,282 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: shopify
|
|
3
|
-
description: Shopify store integration for Optima Commerce. Connect Shopify stores, sync products/orders/inventory/customers, manage collections, discounts, draft orders, refunds, webhooks, markets, and analytics. Use when user mentions Shopify, wants to connect a Shopify store, or manage Shopify-related operations.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Shopify CLI - Shopify 店铺集成管理
|
|
7
|
-
|
|
8
|
-
Shopify 集成模块,用于连接和管理用户的 Shopify 店铺。
|
|
9
|
-
|
|
10
|
-
**重要**:这里管理的是用户在 Shopify 平台上的店铺,不是 Optima 自有店铺。用户可以将 Shopify 店铺连接到 Optima,实现跨平台管理。
|
|
11
|
-
|
|
12
|
-
## 典型场景
|
|
13
|
-
|
|
14
|
-
当用户说:
|
|
15
|
-
- "连接我的 Shopify 店铺" → 使用下方「连接 Shopify 店铺流程(AI Shell)」
|
|
16
|
-
- "查看我连接了哪些 Shopify 店铺" → `shopify auth stores`
|
|
17
|
-
- "看看 Shopify 上有哪些商品" → `shopify product list --store <storeId>`
|
|
18
|
-
- "把 Shopify 商品同步过来" → `shopify product sync --store <storeId>`
|
|
19
|
-
- "查看 Shopify 订单" → `shopify order list --store <storeId>`
|
|
20
|
-
- "Shopify 订单发货" → `shopify order fulfill --store <storeId> --order <orderId> --tracking <号码>`
|
|
21
|
-
- "查看 Shopify 库存" → `shopify inventory list --store <storeId>`
|
|
22
|
-
- "同步 Shopify 库存" → `shopify inventory sync --store <storeId>`
|
|
23
|
-
- "创建 Shopify 折扣码" → `shopify discount create --store <storeId> --code SAVE10 --percentage 10`
|
|
24
|
-
- "查看 Shopify 销售数据" → `shopify analytics report --store <storeId>`
|
|
25
|
-
|
|
26
|
-
### 场景决策表
|
|
27
|
-
|
|
28
|
-
| 用户需求 | 推荐命令 | 关键注意点 |
|
|
29
|
-
|---------|---------|-----------|
|
|
30
|
-
| 连接 Shopify 店铺 | 见下方 AI Shell 连接流程 | 两步式:获取 URL → 轮询状态 |
|
|
31
|
-
| 查看已连接店铺 | `shopify auth stores` | 显示所有已连接店铺 |
|
|
32
|
-
| 断开 Shopify 店铺 | `shopify auth stores --disconnect <storeId>` | 不可逆操作,需确认 |
|
|
33
|
-
| 浏览 Shopify 商品 | `shopify product list --store <id>` | 可用 --status 过滤 |
|
|
34
|
-
| 同步商品到 Optima | `shopify product sync --store <id>` | 从 Shopify 同步到 Optima |
|
|
35
|
-
| 查看 Shopify 订单 | `shopify order list --store <id>` | 可用 --status 过滤 |
|
|
36
|
-
| Shopify 订单发货 | `shopify order fulfill --store <id> --order <oid>` | 需要 tracking 号 |
|
|
37
|
-
| 库存对比 | `shopify inventory compare --store <id>` | 对比 Shopify 和 Optima 库存差异 |
|
|
38
|
-
| 客户同步 | `shopify customer sync --store <id>` | 同步客户数据到 Optima |
|
|
39
|
-
| 创建折扣码 | `shopify discount create --store <id>` | 支持百分比和固定金额 |
|
|
40
|
-
| 销售报表 | `shopify analytics report --store <id>` | ShopifyQL 数据分析 |
|
|
41
|
-
|
|
42
|
-
## 使用前提
|
|
43
|
-
|
|
44
|
-
1. 用户必须先登录 Optima(`optima auth login`)
|
|
45
|
-
2. 然后连接 Shopify 店铺(`shopify auth login --shop <domain>`)
|
|
46
|
-
3. 连接后通过 `--store <storeId>` 指定操作哪个店铺
|
|
47
|
-
|
|
48
|
-
### 获取 storeId
|
|
49
|
-
|
|
50
|
-
所有操作都需要 `--store <storeId>` 参数,先用 `shopify auth stores` 获取:
|
|
51
|
-
|
|
52
|
-
```bash
|
|
53
|
-
shopify auth stores
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
如果用户只连接了一个店铺,可以从输出中直接取 storeId。
|
|
57
|
-
|
|
58
|
-
## 连接 Shopify 店铺流程(AI Shell)
|
|
59
|
-
|
|
60
|
-
**重要**:在 AI Shell 环境中,**必须使用两步式流程**(`--url-only` + `auth check`),不要使用默认的 `auth login`(会阻塞等待浏览器授权)。
|
|
61
|
-
|
|
62
|
-
### 步骤 1:获取授权 URL
|
|
63
|
-
|
|
64
|
-
```bash
|
|
65
|
-
shopify auth login --shop mystore.myshopify.com --url-only
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
返回 JSON 包含 `installUrl` 和 `state`。
|
|
69
|
-
|
|
70
|
-
### 步骤 2:展示链接给用户
|
|
71
|
-
|
|
72
|
-
将 `installUrl` 作为**可点击的 Markdown 链接**展示给用户,例如:
|
|
73
|
-
|
|
74
|
-
> 请点击以下链接授权您的 Shopify 店铺:
|
|
75
|
-
> [授权 mystore.myshopify.com](https://mystore.myshopify.com/admin/oauth/authorize?...)
|
|
76
|
-
> 我会自动检测授权状态,请在浏览器中完成授权。
|
|
77
|
-
|
|
78
|
-
### 步骤 3:自动轮询授权状态
|
|
79
|
-
|
|
80
|
-
展示链接后,**立即开始轮询**,不需要等待用户回复:
|
|
81
|
-
|
|
82
|
-
```bash
|
|
83
|
-
# 等待 15 秒后检查
|
|
84
|
-
sleep 15 && shopify auth check --state <state值>
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
根据返回结果:
|
|
88
|
-
- `completed: true` → 授权成功,展示店铺信息
|
|
89
|
-
- `completed: false, expired: false` → 尚未完成,继续等 15 秒再查
|
|
90
|
-
- `completed: false, expired: true` → 已过期,提示用户重新连接
|
|
91
|
-
|
|
92
|
-
**轮询规则**:
|
|
93
|
-
- 每次间隔 **15 秒**
|
|
94
|
-
- 最多轮询 **20 次**(5 分钟)
|
|
95
|
-
- 每 3-4 次轮询时告知用户:"⏳ 仍在等待授权..."
|
|
96
|
-
- 超时后告知用户:"授权超时,请重试"
|
|
97
|
-
|
|
98
|
-
### 完整示例对话
|
|
99
|
-
|
|
100
|
-
```
|
|
101
|
-
用户:连接我的 Shopify 店铺 cool-gadgets.myshopify.com
|
|
102
|
-
|
|
103
|
-
AI:[执行 Bash: shopify auth login --shop cool-gadgets.myshopify.com --url-only]
|
|
104
|
-
→ 获取到 installUrl 和 state
|
|
105
|
-
|
|
106
|
-
请点击以下链接授权您的 Shopify 店铺:
|
|
107
|
-
[授权 cool-gadgets.myshopify.com](https://cool-gadgets.myshopify.com/admin/oauth/authorize?...)
|
|
108
|
-
我会自动检测授权状态。
|
|
109
|
-
|
|
110
|
-
[执行 Bash: sleep 15 && shopify auth check --state abc123]
|
|
111
|
-
→ completed: false
|
|
112
|
-
|
|
113
|
-
[执行 Bash: sleep 15 && shopify auth check --state abc123]
|
|
114
|
-
→ completed: false
|
|
115
|
-
|
|
116
|
-
⏳ 仍在等待授权...
|
|
117
|
-
|
|
118
|
-
[执行 Bash: sleep 15 && shopify auth check --state abc123]
|
|
119
|
-
→ completed: true, store: { shopName: "Cool Gadgets", ... }
|
|
120
|
-
|
|
121
|
-
✅ 已成功连接 Shopify 店铺!
|
|
122
|
-
- 店铺:Cool Gadgets
|
|
123
|
-
- 域名:cool-gadgets.myshopify.com
|
|
124
|
-
- 邮箱:owner@example.com
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
## 命令参考
|
|
128
|
-
|
|
129
|
-
### 认证和店铺管理
|
|
130
|
-
- `shopify auth login --shop <domain>` - 连接 Shopify 店铺(有浏览器环境)
|
|
131
|
-
- `shopify auth login --shop <domain> --url-only` - 获取授权 URL(AI Shell/无头环境)
|
|
132
|
-
- `shopify auth check --state <state>` - 检查 OAuth 授权状态(单次检查)
|
|
133
|
-
- `shopify auth status` - 查看认证状态
|
|
134
|
-
- `shopify auth stores` - 列出已连接店铺
|
|
135
|
-
- `shopify auth stores --info <storeId>` - 查看店铺实时信息
|
|
136
|
-
- `shopify auth stores --disconnect <storeId>` - 断开店铺连接
|
|
137
|
-
|
|
138
|
-
### 商品管理
|
|
139
|
-
- `shopify product list --store <id>` - 商品列表
|
|
140
|
-
- `shopify product get --store <id> --product <pid>` - 商品详情
|
|
141
|
-
- `shopify product search --store <id> --query <关键词>` - 搜索商品
|
|
142
|
-
- `shopify product sync --store <id>` - 同步商品到 Optima
|
|
143
|
-
- `shopify product publish --store <id> --product <pid>` - 发布商品到销售渠道
|
|
144
|
-
- `shopify product mapping --store <id>` - 查看 Shopify↔Optima 商品映射
|
|
145
|
-
|
|
146
|
-
### 订单管理
|
|
147
|
-
- `shopify order list --store <id>` - 订单列表
|
|
148
|
-
- `shopify order get --store <id> --order <oid>` - 订单详情
|
|
149
|
-
- `shopify order fulfill --store <id> --order <oid> --tracking <号码>` - 订单发货
|
|
150
|
-
- `shopify order sync --store <id>` - 同步订单到 Optima
|
|
151
|
-
|
|
152
|
-
### 库存管理
|
|
153
|
-
- `shopify inventory list --store <id>` - 库存列表
|
|
154
|
-
- `shopify inventory get --store <id> --product <pid>` - 查看商品库存
|
|
155
|
-
- `shopify inventory adjust --store <id> --item <itemId> --delta <数量>` - 调整库存
|
|
156
|
-
- `shopify inventory sync --store <id>` - 同步库存
|
|
157
|
-
- `shopify inventory compare --store <id>` - 对比 Shopify/Optima 库存差异
|
|
158
|
-
- `shopify inventory locations --store <id>` - 查看库存位置
|
|
159
|
-
|
|
160
|
-
### 位置管理
|
|
161
|
-
- `shopify location list --store <id>` - 仓库/位置列表
|
|
162
|
-
- `shopify location get --store <id> --location <lid>` - 位置详情
|
|
163
|
-
|
|
164
|
-
### 集合管理
|
|
165
|
-
- `shopify collection list --store <id>` - 集合列表
|
|
166
|
-
- `shopify collection get --store <id> --collection <cid>` - 集合详情
|
|
167
|
-
- `shopify collection create --store <id> --title <名称>` - 创建集合
|
|
168
|
-
- `shopify collection add --store <id> --collection <cid> --products <pid1,pid2>` - 添加商品到集合
|
|
169
|
-
|
|
170
|
-
### 客户管理
|
|
171
|
-
- `shopify customer list --store <id>` - 客户列表
|
|
172
|
-
- `shopify customer get --store <id> --customer <cid>` - 客户详情
|
|
173
|
-
- `shopify customer sync --store <id>` - 同步客户到 Optima
|
|
174
|
-
|
|
175
|
-
### 折扣管理
|
|
176
|
-
- `shopify discount list --store <id>` - 折扣列表
|
|
177
|
-
- `shopify discount get --store <id> --discount <did>` - 折扣详情
|
|
178
|
-
- `shopify discount create --store <id>` - 创建折扣码
|
|
179
|
-
- `shopify discount delete --store <id> --discount <did>` - 删除折扣
|
|
180
|
-
|
|
181
|
-
### 草稿订单
|
|
182
|
-
- `shopify draft-order list --store <id>` - 草稿订单列表
|
|
183
|
-
- `shopify draft-order get --store <id> --draft-order <did>` - 草稿订单详情
|
|
184
|
-
- `shopify draft-order create --store <id>` - 创建草稿订单
|
|
185
|
-
- `shopify draft-order complete --store <id> --draft-order <did>` - 完成草稿订单
|
|
186
|
-
- `shopify draft-order delete --store <id> --draft-order <did>` - 删除草稿订单
|
|
187
|
-
|
|
188
|
-
### 退款管理
|
|
189
|
-
- `shopify refund list --store <id> --order <oid>` - 退款列表
|
|
190
|
-
- `shopify refund create --store <id> --order <oid>` - 创建退款
|
|
191
|
-
|
|
192
|
-
### 市场管理
|
|
193
|
-
- `shopify market list --store <id>` - 市场列表
|
|
194
|
-
- `shopify market get --store <id> --market <mid>` - 市场详情
|
|
195
|
-
|
|
196
|
-
### 数据分析
|
|
197
|
-
- `shopify analytics report --store <id>` - 销售报表
|
|
198
|
-
- `shopify analytics query --store <id> --query <ShopifyQL>` - 自定义 ShopifyQL 查询
|
|
199
|
-
|
|
200
|
-
### Webhook 管理
|
|
201
|
-
- `shopify webhook list --store <id>` - 已订阅的 webhook
|
|
202
|
-
- `shopify webhook subscribe --store <id> --topic <topic>` - 订阅 webhook
|
|
203
|
-
- `shopify webhook unsubscribe --store <id> --subscription <sid>` - 取消订阅
|
|
204
|
-
|
|
205
|
-
## 详细示例
|
|
206
|
-
|
|
207
|
-
### 连接店铺并查看商品
|
|
208
|
-
```bash
|
|
209
|
-
# 连接 Shopify 店铺
|
|
210
|
-
shopify auth login --shop my-cool-store.myshopify.com
|
|
211
|
-
|
|
212
|
-
# 查看已连接店铺,获取 storeId
|
|
213
|
-
shopify auth stores
|
|
214
|
-
|
|
215
|
-
# 查看商品列表
|
|
216
|
-
shopify product list --store abc123
|
|
217
|
-
|
|
218
|
-
# 搜索特定商品
|
|
219
|
-
shopify product search --store abc123 --query "T-shirt"
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
### 同步商品和库存
|
|
223
|
-
```bash
|
|
224
|
-
# 将 Shopify 商品同步到 Optima Commerce
|
|
225
|
-
shopify product sync --store abc123
|
|
226
|
-
|
|
227
|
-
# 查看商品映射关系
|
|
228
|
-
shopify product mapping --store abc123
|
|
229
|
-
|
|
230
|
-
# 对比两个平台的库存差异
|
|
231
|
-
shopify inventory compare --store abc123
|
|
232
|
-
|
|
233
|
-
# 同步库存
|
|
234
|
-
shopify inventory sync --store abc123
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
### 订单发货
|
|
238
|
-
```bash
|
|
239
|
-
# 查看待发货订单
|
|
240
|
-
shopify order list --store abc123 --status unfulfilled
|
|
241
|
-
|
|
242
|
-
# 查看订单详情
|
|
243
|
-
shopify order get --store abc123 --order order_456
|
|
244
|
-
|
|
245
|
-
# 发货(提供 tracking 号码)
|
|
246
|
-
shopify order fulfill --store abc123 --order order_456 \
|
|
247
|
-
--tracking SF1234567890
|
|
248
|
-
```
|
|
249
|
-
|
|
250
|
-
### 创建折扣码
|
|
251
|
-
```bash
|
|
252
|
-
# 创建 10% 折扣码
|
|
253
|
-
shopify discount create --store abc123 \
|
|
254
|
-
--code SAVE10 \
|
|
255
|
-
--percentage 10 \
|
|
256
|
-
--title "新年促销 10% off"
|
|
257
|
-
|
|
258
|
-
# 创建固定金额折扣
|
|
259
|
-
shopify discount create --store abc123 \
|
|
260
|
-
--code FLAT20 \
|
|
261
|
-
--amount 20 \
|
|
262
|
-
--title "满减优惠 $20 off"
|
|
263
|
-
```
|
|
264
|
-
|
|
265
|
-
### 销售数据分析
|
|
266
|
-
```bash
|
|
267
|
-
# 生成销售报表
|
|
268
|
-
shopify analytics report --store abc123
|
|
269
|
-
|
|
270
|
-
# 自定义 ShopifyQL 查询
|
|
271
|
-
shopify analytics query --store abc123 \
|
|
272
|
-
--query "FROM orders SHOW sum(total_price) GROUP BY day SINCE -30d"
|
|
273
|
-
```
|
|
274
|
-
|
|
275
|
-
## 重要提示
|
|
276
|
-
|
|
277
|
-
- 所有命令都需要 `--store <storeId>` 参数,先用 `shopify auth stores` 获取
|
|
278
|
-
- 商品/订单/库存同步是从 **Shopify → Optima** 方向
|
|
279
|
-
- 折扣码在 **Shopify 平台**上创建和管理
|
|
280
|
-
- 连接店铺需要浏览器交互(OAuth 授权),在 AI Shell 中使用 `--url-only` + `auth check` 两步式流程
|
|
281
|
-
- 断开店铺是软删除,不会影响 Shopify 上的数据
|
|
282
|
-
- 使用 `--help` 查看命令详细参数
|
|
1
|
+
---
|
|
2
|
+
name: shopify
|
|
3
|
+
description: Shopify store integration for Optima Commerce. Connect Shopify stores, sync products/orders/inventory/customers, manage collections, discounts, draft orders, refunds, webhooks, markets, and analytics. Use when user mentions Shopify, wants to connect a Shopify store, or manage Shopify-related operations.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Shopify CLI - Shopify 店铺集成管理
|
|
7
|
+
|
|
8
|
+
Shopify 集成模块,用于连接和管理用户的 Shopify 店铺。
|
|
9
|
+
|
|
10
|
+
**重要**:这里管理的是用户在 Shopify 平台上的店铺,不是 Optima 自有店铺。用户可以将 Shopify 店铺连接到 Optima,实现跨平台管理。
|
|
11
|
+
|
|
12
|
+
## 典型场景
|
|
13
|
+
|
|
14
|
+
当用户说:
|
|
15
|
+
- "连接我的 Shopify 店铺" → 使用下方「连接 Shopify 店铺流程(AI Shell)」
|
|
16
|
+
- "查看我连接了哪些 Shopify 店铺" → `shopify auth stores`
|
|
17
|
+
- "看看 Shopify 上有哪些商品" → `shopify product list --store <storeId>`
|
|
18
|
+
- "把 Shopify 商品同步过来" → `shopify product sync --store <storeId>`
|
|
19
|
+
- "查看 Shopify 订单" → `shopify order list --store <storeId>`
|
|
20
|
+
- "Shopify 订单发货" → `shopify order fulfill --store <storeId> --order <orderId> --tracking <号码>`
|
|
21
|
+
- "查看 Shopify 库存" → `shopify inventory list --store <storeId>`
|
|
22
|
+
- "同步 Shopify 库存" → `shopify inventory sync --store <storeId>`
|
|
23
|
+
- "创建 Shopify 折扣码" → `shopify discount create --store <storeId> --code SAVE10 --percentage 10`
|
|
24
|
+
- "查看 Shopify 销售数据" → `shopify analytics report --store <storeId>`
|
|
25
|
+
|
|
26
|
+
### 场景决策表
|
|
27
|
+
|
|
28
|
+
| 用户需求 | 推荐命令 | 关键注意点 |
|
|
29
|
+
|---------|---------|-----------|
|
|
30
|
+
| 连接 Shopify 店铺 | 见下方 AI Shell 连接流程 | 两步式:获取 URL → 轮询状态 |
|
|
31
|
+
| 查看已连接店铺 | `shopify auth stores` | 显示所有已连接店铺 |
|
|
32
|
+
| 断开 Shopify 店铺 | `shopify auth stores --disconnect <storeId>` | 不可逆操作,需确认 |
|
|
33
|
+
| 浏览 Shopify 商品 | `shopify product list --store <id>` | 可用 --status 过滤 |
|
|
34
|
+
| 同步商品到 Optima | `shopify product sync --store <id>` | 从 Shopify 同步到 Optima |
|
|
35
|
+
| 查看 Shopify 订单 | `shopify order list --store <id>` | 可用 --status 过滤 |
|
|
36
|
+
| Shopify 订单发货 | `shopify order fulfill --store <id> --order <oid>` | 需要 tracking 号 |
|
|
37
|
+
| 库存对比 | `shopify inventory compare --store <id>` | 对比 Shopify 和 Optima 库存差异 |
|
|
38
|
+
| 客户同步 | `shopify customer sync --store <id>` | 同步客户数据到 Optima |
|
|
39
|
+
| 创建折扣码 | `shopify discount create --store <id>` | 支持百分比和固定金额 |
|
|
40
|
+
| 销售报表 | `shopify analytics report --store <id>` | ShopifyQL 数据分析 |
|
|
41
|
+
|
|
42
|
+
## 使用前提
|
|
43
|
+
|
|
44
|
+
1. 用户必须先登录 Optima(`optima auth login`)
|
|
45
|
+
2. 然后连接 Shopify 店铺(`shopify auth login --shop <domain>`)
|
|
46
|
+
3. 连接后通过 `--store <storeId>` 指定操作哪个店铺
|
|
47
|
+
|
|
48
|
+
### 获取 storeId
|
|
49
|
+
|
|
50
|
+
所有操作都需要 `--store <storeId>` 参数,先用 `shopify auth stores` 获取:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
shopify auth stores
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
如果用户只连接了一个店铺,可以从输出中直接取 storeId。
|
|
57
|
+
|
|
58
|
+
## 连接 Shopify 店铺流程(AI Shell)
|
|
59
|
+
|
|
60
|
+
**重要**:在 AI Shell 环境中,**必须使用两步式流程**(`--url-only` + `auth check`),不要使用默认的 `auth login`(会阻塞等待浏览器授权)。
|
|
61
|
+
|
|
62
|
+
### 步骤 1:获取授权 URL
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
shopify auth login --shop mystore.myshopify.com --url-only
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
返回 JSON 包含 `installUrl` 和 `state`。
|
|
69
|
+
|
|
70
|
+
### 步骤 2:展示链接给用户
|
|
71
|
+
|
|
72
|
+
将 `installUrl` 作为**可点击的 Markdown 链接**展示给用户,例如:
|
|
73
|
+
|
|
74
|
+
> 请点击以下链接授权您的 Shopify 店铺:
|
|
75
|
+
> [授权 mystore.myshopify.com](https://mystore.myshopify.com/admin/oauth/authorize?...)
|
|
76
|
+
> 我会自动检测授权状态,请在浏览器中完成授权。
|
|
77
|
+
|
|
78
|
+
### 步骤 3:自动轮询授权状态
|
|
79
|
+
|
|
80
|
+
展示链接后,**立即开始轮询**,不需要等待用户回复:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# 等待 15 秒后检查
|
|
84
|
+
sleep 15 && shopify auth check --state <state值>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
根据返回结果:
|
|
88
|
+
- `completed: true` → 授权成功,展示店铺信息
|
|
89
|
+
- `completed: false, expired: false` → 尚未完成,继续等 15 秒再查
|
|
90
|
+
- `completed: false, expired: true` → 已过期,提示用户重新连接
|
|
91
|
+
|
|
92
|
+
**轮询规则**:
|
|
93
|
+
- 每次间隔 **15 秒**
|
|
94
|
+
- 最多轮询 **20 次**(5 分钟)
|
|
95
|
+
- 每 3-4 次轮询时告知用户:"⏳ 仍在等待授权..."
|
|
96
|
+
- 超时后告知用户:"授权超时,请重试"
|
|
97
|
+
|
|
98
|
+
### 完整示例对话
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
用户:连接我的 Shopify 店铺 cool-gadgets.myshopify.com
|
|
102
|
+
|
|
103
|
+
AI:[执行 Bash: shopify auth login --shop cool-gadgets.myshopify.com --url-only]
|
|
104
|
+
→ 获取到 installUrl 和 state
|
|
105
|
+
|
|
106
|
+
请点击以下链接授权您的 Shopify 店铺:
|
|
107
|
+
[授权 cool-gadgets.myshopify.com](https://cool-gadgets.myshopify.com/admin/oauth/authorize?...)
|
|
108
|
+
我会自动检测授权状态。
|
|
109
|
+
|
|
110
|
+
[执行 Bash: sleep 15 && shopify auth check --state abc123]
|
|
111
|
+
→ completed: false
|
|
112
|
+
|
|
113
|
+
[执行 Bash: sleep 15 && shopify auth check --state abc123]
|
|
114
|
+
→ completed: false
|
|
115
|
+
|
|
116
|
+
⏳ 仍在等待授权...
|
|
117
|
+
|
|
118
|
+
[执行 Bash: sleep 15 && shopify auth check --state abc123]
|
|
119
|
+
→ completed: true, store: { shopName: "Cool Gadgets", ... }
|
|
120
|
+
|
|
121
|
+
✅ 已成功连接 Shopify 店铺!
|
|
122
|
+
- 店铺:Cool Gadgets
|
|
123
|
+
- 域名:cool-gadgets.myshopify.com
|
|
124
|
+
- 邮箱:owner@example.com
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## 命令参考
|
|
128
|
+
|
|
129
|
+
### 认证和店铺管理
|
|
130
|
+
- `shopify auth login --shop <domain>` - 连接 Shopify 店铺(有浏览器环境)
|
|
131
|
+
- `shopify auth login --shop <domain> --url-only` - 获取授权 URL(AI Shell/无头环境)
|
|
132
|
+
- `shopify auth check --state <state>` - 检查 OAuth 授权状态(单次检查)
|
|
133
|
+
- `shopify auth status` - 查看认证状态
|
|
134
|
+
- `shopify auth stores` - 列出已连接店铺
|
|
135
|
+
- `shopify auth stores --info <storeId>` - 查看店铺实时信息
|
|
136
|
+
- `shopify auth stores --disconnect <storeId>` - 断开店铺连接
|
|
137
|
+
|
|
138
|
+
### 商品管理
|
|
139
|
+
- `shopify product list --store <id>` - 商品列表
|
|
140
|
+
- `shopify product get --store <id> --product <pid>` - 商品详情
|
|
141
|
+
- `shopify product search --store <id> --query <关键词>` - 搜索商品
|
|
142
|
+
- `shopify product sync --store <id>` - 同步商品到 Optima
|
|
143
|
+
- `shopify product publish --store <id> --product <pid>` - 发布商品到销售渠道
|
|
144
|
+
- `shopify product mapping --store <id>` - 查看 Shopify↔Optima 商品映射
|
|
145
|
+
|
|
146
|
+
### 订单管理
|
|
147
|
+
- `shopify order list --store <id>` - 订单列表
|
|
148
|
+
- `shopify order get --store <id> --order <oid>` - 订单详情
|
|
149
|
+
- `shopify order fulfill --store <id> --order <oid> --tracking <号码>` - 订单发货
|
|
150
|
+
- `shopify order sync --store <id>` - 同步订单到 Optima
|
|
151
|
+
|
|
152
|
+
### 库存管理
|
|
153
|
+
- `shopify inventory list --store <id>` - 库存列表
|
|
154
|
+
- `shopify inventory get --store <id> --product <pid>` - 查看商品库存
|
|
155
|
+
- `shopify inventory adjust --store <id> --item <itemId> --delta <数量>` - 调整库存
|
|
156
|
+
- `shopify inventory sync --store <id>` - 同步库存
|
|
157
|
+
- `shopify inventory compare --store <id>` - 对比 Shopify/Optima 库存差异
|
|
158
|
+
- `shopify inventory locations --store <id>` - 查看库存位置
|
|
159
|
+
|
|
160
|
+
### 位置管理
|
|
161
|
+
- `shopify location list --store <id>` - 仓库/位置列表
|
|
162
|
+
- `shopify location get --store <id> --location <lid>` - 位置详情
|
|
163
|
+
|
|
164
|
+
### 集合管理
|
|
165
|
+
- `shopify collection list --store <id>` - 集合列表
|
|
166
|
+
- `shopify collection get --store <id> --collection <cid>` - 集合详情
|
|
167
|
+
- `shopify collection create --store <id> --title <名称>` - 创建集合
|
|
168
|
+
- `shopify collection add --store <id> --collection <cid> --products <pid1,pid2>` - 添加商品到集合
|
|
169
|
+
|
|
170
|
+
### 客户管理
|
|
171
|
+
- `shopify customer list --store <id>` - 客户列表
|
|
172
|
+
- `shopify customer get --store <id> --customer <cid>` - 客户详情
|
|
173
|
+
- `shopify customer sync --store <id>` - 同步客户到 Optima
|
|
174
|
+
|
|
175
|
+
### 折扣管理
|
|
176
|
+
- `shopify discount list --store <id>` - 折扣列表
|
|
177
|
+
- `shopify discount get --store <id> --discount <did>` - 折扣详情
|
|
178
|
+
- `shopify discount create --store <id>` - 创建折扣码
|
|
179
|
+
- `shopify discount delete --store <id> --discount <did>` - 删除折扣
|
|
180
|
+
|
|
181
|
+
### 草稿订单
|
|
182
|
+
- `shopify draft-order list --store <id>` - 草稿订单列表
|
|
183
|
+
- `shopify draft-order get --store <id> --draft-order <did>` - 草稿订单详情
|
|
184
|
+
- `shopify draft-order create --store <id>` - 创建草稿订单
|
|
185
|
+
- `shopify draft-order complete --store <id> --draft-order <did>` - 完成草稿订单
|
|
186
|
+
- `shopify draft-order delete --store <id> --draft-order <did>` - 删除草稿订单
|
|
187
|
+
|
|
188
|
+
### 退款管理
|
|
189
|
+
- `shopify refund list --store <id> --order <oid>` - 退款列表
|
|
190
|
+
- `shopify refund create --store <id> --order <oid>` - 创建退款
|
|
191
|
+
|
|
192
|
+
### 市场管理
|
|
193
|
+
- `shopify market list --store <id>` - 市场列表
|
|
194
|
+
- `shopify market get --store <id> --market <mid>` - 市场详情
|
|
195
|
+
|
|
196
|
+
### 数据分析
|
|
197
|
+
- `shopify analytics report --store <id>` - 销售报表
|
|
198
|
+
- `shopify analytics query --store <id> --query <ShopifyQL>` - 自定义 ShopifyQL 查询
|
|
199
|
+
|
|
200
|
+
### Webhook 管理
|
|
201
|
+
- `shopify webhook list --store <id>` - 已订阅的 webhook
|
|
202
|
+
- `shopify webhook subscribe --store <id> --topic <topic>` - 订阅 webhook
|
|
203
|
+
- `shopify webhook unsubscribe --store <id> --subscription <sid>` - 取消订阅
|
|
204
|
+
|
|
205
|
+
## 详细示例
|
|
206
|
+
|
|
207
|
+
### 连接店铺并查看商品
|
|
208
|
+
```bash
|
|
209
|
+
# 连接 Shopify 店铺
|
|
210
|
+
shopify auth login --shop my-cool-store.myshopify.com
|
|
211
|
+
|
|
212
|
+
# 查看已连接店铺,获取 storeId
|
|
213
|
+
shopify auth stores
|
|
214
|
+
|
|
215
|
+
# 查看商品列表
|
|
216
|
+
shopify product list --store abc123
|
|
217
|
+
|
|
218
|
+
# 搜索特定商品
|
|
219
|
+
shopify product search --store abc123 --query "T-shirt"
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### 同步商品和库存
|
|
223
|
+
```bash
|
|
224
|
+
# 将 Shopify 商品同步到 Optima Commerce
|
|
225
|
+
shopify product sync --store abc123
|
|
226
|
+
|
|
227
|
+
# 查看商品映射关系
|
|
228
|
+
shopify product mapping --store abc123
|
|
229
|
+
|
|
230
|
+
# 对比两个平台的库存差异
|
|
231
|
+
shopify inventory compare --store abc123
|
|
232
|
+
|
|
233
|
+
# 同步库存
|
|
234
|
+
shopify inventory sync --store abc123
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### 订单发货
|
|
238
|
+
```bash
|
|
239
|
+
# 查看待发货订单
|
|
240
|
+
shopify order list --store abc123 --status unfulfilled
|
|
241
|
+
|
|
242
|
+
# 查看订单详情
|
|
243
|
+
shopify order get --store abc123 --order order_456
|
|
244
|
+
|
|
245
|
+
# 发货(提供 tracking 号码)
|
|
246
|
+
shopify order fulfill --store abc123 --order order_456 \
|
|
247
|
+
--tracking SF1234567890
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
### 创建折扣码
|
|
251
|
+
```bash
|
|
252
|
+
# 创建 10% 折扣码
|
|
253
|
+
shopify discount create --store abc123 \
|
|
254
|
+
--code SAVE10 \
|
|
255
|
+
--percentage 10 \
|
|
256
|
+
--title "新年促销 10% off"
|
|
257
|
+
|
|
258
|
+
# 创建固定金额折扣
|
|
259
|
+
shopify discount create --store abc123 \
|
|
260
|
+
--code FLAT20 \
|
|
261
|
+
--amount 20 \
|
|
262
|
+
--title "满减优惠 $20 off"
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
### 销售数据分析
|
|
266
|
+
```bash
|
|
267
|
+
# 生成销售报表
|
|
268
|
+
shopify analytics report --store abc123
|
|
269
|
+
|
|
270
|
+
# 自定义 ShopifyQL 查询
|
|
271
|
+
shopify analytics query --store abc123 \
|
|
272
|
+
--query "FROM orders SHOW sum(total_price) GROUP BY day SINCE -30d"
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
## 重要提示
|
|
276
|
+
|
|
277
|
+
- 所有命令都需要 `--store <storeId>` 参数,先用 `shopify auth stores` 获取
|
|
278
|
+
- 商品/订单/库存同步是从 **Shopify → Optima** 方向
|
|
279
|
+
- 折扣码在 **Shopify 平台**上创建和管理
|
|
280
|
+
- 连接店铺需要浏览器交互(OAuth 授权),在 AI Shell 中使用 `--url-only` + `auth check` 两步式流程
|
|
281
|
+
- 断开店铺是软删除,不会影响 Shopify 上的数据
|
|
282
|
+
- 使用 `--help` 查看命令详细参数
|