@optima-chat/optima-agent 0.9.8 → 0.9.10

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 (89) hide show
  1. package/.claude/skills/.kb-skills-managed.json +9 -9
  2. package/.claude/skills/ads/SKILL.md +244 -244
  3. package/.claude/skills/ads/template/campaign/CREATIVES.md +18 -18
  4. package/.claude/skills/ads/template/campaign/NOTES.md +10 -10
  5. package/.claude/skills/ads/template/campaign/STRATEGY.md +29 -29
  6. package/.claude/skills/ads/template/user/ADS.md +29 -29
  7. package/.claude/skills/ads/template/user/LEARNINGS.md +15 -15
  8. package/.claude/skills/ads/template/user/PROGRESS.md +20 -20
  9. package/.claude/skills/ads/template/user/README.md +25 -25
  10. package/.claude/skills/ads/template/user/assets/.gitignore +2 -2
  11. package/.claude/skills/bi/SKILL.md +131 -131
  12. package/.claude/skills/browser/SKILL.md +201 -201
  13. package/.claude/skills/channels/SKILL.md +188 -188
  14. package/.claude/skills/collection/SKILL.md +88 -88
  15. package/.claude/skills/douyin/SKILL.md +408 -408
  16. package/.claude/skills/ffmpeg/SKILL.md +164 -164
  17. package/.claude/skills/gen/SKILL.md +279 -279
  18. package/.claude/skills/growth/SKILL.md +90 -90
  19. package/.claude/skills/growth/template/ACCOUNTS.md +14 -14
  20. package/.claude/skills/growth/template/CALENDAR.md +7 -7
  21. package/.claude/skills/growth/template/COMMENTS.md +7 -7
  22. package/.claude/skills/growth/template/GROWTH.md +37 -37
  23. package/.claude/skills/growth/template/PROGRESS.md +4 -4
  24. package/.claude/skills/growth/template/README.md +20 -20
  25. package/.claude/skills/growth/template/TOPICS.md +7 -7
  26. package/.claude/skills/homepage/SKILL.md +177 -177
  27. package/.claude/skills/i18n/SKILL.md +517 -517
  28. package/.claude/skills/ingesting-sources/SKILL.md +94 -94
  29. package/.claude/skills/initializing-kb/SKILL.md +117 -117
  30. package/.claude/skills/instagram/SKILL.md +321 -321
  31. package/.claude/skills/inventory/SKILL.md +328 -328
  32. package/.claude/skills/kol-outreach/SKILL.md +232 -232
  33. package/.claude/skills/kol-outreach/template/campaign/CONFIG.md +60 -60
  34. package/.claude/skills/kol-outreach/template/campaign/KOLS.md +6 -6
  35. package/.claude/skills/kol-outreach/template/campaign/PROGRESS.md +3 -3
  36. package/.claude/skills/kol-outreach/template/campaign/TEMPLATES.md +88 -88
  37. package/.claude/skills/kol-outreach/template/merchant/BRAND.md +36 -36
  38. package/.claude/skills/kol-outreach/template/merchant/CAMPAIGNS.md +6 -6
  39. package/.claude/skills/kol-outreach/template/merchant/MERCHANT_LIMITS.md +16 -16
  40. package/.claude/skills/kol-outreach/template/merchant/PROGRESS.md +4 -4
  41. package/.claude/skills/kol-outreach/template/merchant/README.md +20 -20
  42. package/.claude/skills/linting-the-wiki/SKILL.md +68 -68
  43. package/.claude/skills/logistics/SKILL.md +180 -180
  44. package/.claude/skills/markdown-pdf/SKILL.md +72 -72
  45. package/.claude/skills/merchant/SKILL.md +110 -110
  46. package/.claude/skills/multigrid-poster/SKILL.md +192 -192
  47. package/.claude/skills/multigrid-poster/layouts/2x2.json +34 -34
  48. package/.claude/skills/multigrid-poster/layouts/3x3.json +43 -43
  49. package/.claude/skills/multigrid-poster/scripts/compose.py +116 -116
  50. package/.claude/skills/order/SKILL.md +452 -452
  51. package/.claude/skills/product/SKILL.md +379 -379
  52. package/.claude/skills/product-page/SKILL.md +106 -106
  53. package/.claude/skills/querying-the-wiki/SKILL.md +59 -59
  54. package/.claude/skills/reddit/SKILL.md +277 -277
  55. package/.claude/skills/review/SKILL.md +321 -321
  56. package/.claude/skills/scout/SKILL.md +575 -462
  57. package/.claude/skills/sentinel/SKILL.md +281 -281
  58. package/.claude/skills/shein/SKILL.md +246 -246
  59. package/.claude/skills/shipping/SKILL.md +200 -200
  60. package/.claude/skills/shop-content/SKILL.md +101 -101
  61. package/.claude/skills/shopify/SKILL.md +282 -282
  62. package/.claude/skills/skillify/SKILL.md +114 -114
  63. package/.claude/skills/taobao/SKILL.md +238 -238
  64. package/.claude/skills/tiktok/SKILL.md +381 -381
  65. package/.claude/skills/twitter/SKILL.md +302 -302
  66. package/.claude/skills/updating-related-pages/SKILL.md +65 -65
  67. package/.claude/skills/video-edit/SKILL.md +138 -143
  68. package/.claude/skills/video-gen/SKILL.md +548 -548
  69. package/.claude/skills/video-gen/templates/INDEX.md +78 -78
  70. package/.claude/skills/video-gen/templates/before-after-beauty.md +183 -183
  71. package/.claude/skills/video-gen/templates/drama-fmcg.md +183 -183
  72. package/.claude/skills/video-gen/templates/kol-reaction-food.md +193 -193
  73. package/.claude/skills/video-gen/templates/multi-point-apparel.md +185 -185
  74. package/.claude/skills/video-gen/templates/pain-solution-home.md +184 -184
  75. package/.claude/skills/video-gen/templates/pdp-360-showcase.md +189 -189
  76. package/.claude/skills/video-gen/templates/pdp-feature-highlight.md +182 -182
  77. package/.claude/skills/video-gen/templates/scene-digital.md +183 -183
  78. package/.claude/skills/wechat/SKILL.md +174 -174
  79. package/.claude/skills/xhs/SKILL.md +170 -170
  80. package/README.md +276 -276
  81. package/dist/bin/optima.js +26 -26
  82. package/dist/bin/serve.js +23 -23
  83. package/dist/src/agent.js +4 -4
  84. package/dist/src/system-prompt.d.ts.map +1 -1
  85. package/dist/src/system-prompt.js +173 -169
  86. package/dist/src/system-prompt.js.map +1 -1
  87. package/dist/src/tools/memory.js +10 -10
  88. package/dist/src/ui/headless.js +7 -7
  89. package/package.json +79 -79
@@ -1,188 +1,188 @@
1
- ---
2
- name: channels
3
- description: "社交渠道管理。接入/管理 Telegram、WhatsApp、Discord、Slack、飞书、LINE、Zalo 等社交渠道,绑定用户账号,发送通知。使用场景:接入渠道(connect channel)、绑定(bind)、社交(social)、Telegram、WhatsApp、Discord、Slack、飞书、LINE、Zalo、通知(notify)、推送(push)、消息(message)。"
4
- ---
5
-
6
- # Optima Channels - 社交渠道管理
7
-
8
- 管理社交渠道接入、用户绑定和消息推送。支持 Telegram、WhatsApp、Discord、Slack、飞书、LINE、Zalo。
9
-
10
- ## 社交渠道环境注意事项
11
-
12
- 当消息来自社交渠道(metadata.source === "channel_bridge")时:
13
-
14
- 1. **无浏览器环境** — 用户在 Telegram/WhatsApp 等社交 App 中,无法自动打开浏览器。所有需要浏览器的操作(如 OAuth 登录),必须把 URL 发给用户让他们手动打开。
15
-
16
- 2. **登录流程** — 当用户需要登录(如操作商品、订单等需要认证的功能):
17
- - 运行 `commerce auth login`
18
- - 命令会输出一个授权 URL 和验证码
19
- - **把 URL 和验证码发给用户**,告诉他们在手机浏览器中打开
20
- - 命令会自动等待用户完成授权
21
- - 不要说"浏览器已自动打开"——社交渠道里没有浏览器
22
-
23
- 3. **回复简洁** — 社交渠道消息应比 Web Chat 更简洁。避免长段落,用要点列表。
24
-
25
- ## 典型场景
26
-
27
- 当用户说:
28
- - "登录" → 运行 `commerce auth login`,把输出中的 URL 和验证码发给用户
29
- - "帮我接入 Telegram" → 引导创建 bot → `channels accounts add telegram --account-id store --token <token>`
30
- - "查看我的渠道" → `channels accounts list`
31
- - "关掉 Telegram" → `channels accounts disable telegram store`
32
- - "重新开启 Telegram" → `channels accounts enable telegram store`
33
- - "删除 Telegram 渠道" → `channels accounts remove telegram store`
34
- - "查看我的绑定" → `channels bind list`
35
- - "解绑 Telegram" → `channels bind remove --platform telegram --account-id store --platform-uid 123456`
36
- - "给用户发通知" → `channels send --user-id <id> --text "消息内容"`
37
- - "广播消息" → `channels broadcast --text "消息" --user-ids id1,id2`
38
- - "查看渠道状态" → `channels status`
39
-
40
- ### 场景决策表
41
-
42
- | 用户需求 | 推荐命令 | 关键注意点 |
43
- |---------|---------|-----------|
44
- | 接入新渠道 | `channels accounts add <platform>` | 不同平台需要不同参数,见下方 |
45
- | 查看渠道列表 | `channels accounts list` | 显示所有账号及状态 |
46
- | 启用/禁用渠道 | `channels accounts enable/disable` | 不删除配置,只是暂停 |
47
- | 删除渠道 | `channels accounts remove` | 永久删除,需重新配置 |
48
- | 查看绑定 | `channels bind list` | 显示当前用户绑定的社交账号 |
49
- | 解绑 | `channels bind remove` | 需要指定 platform、account-id、platform-uid |
50
- | 发送通知 | `channels send` | 发到用户所有已绑定渠道 |
51
- | 广播 | `channels broadcast` | 发给多个用户 |
52
-
53
- ## 场景1:接入 Telegram
54
-
55
- **流程**: 创建 Bot → 获取 Token → 添加到 Optima
56
-
57
- ```bash
58
- # 1. 引导用户:
59
- # "请在 Telegram 找 @BotFather,发送 /newbot,按提示创建 bot,然后把 token 发给我"
60
-
61
- # 2. 用户提供 token 后,添加渠道
62
- channels accounts add telegram --account-id store --token "123456:AAHxxxxxxxxxx"
63
-
64
- # 3. 验证
65
- channels status
66
- ```
67
-
68
- ## 场景2:接入 Discord
69
-
70
- ```bash
71
- # 1. 引导用户:
72
- # "请在 Discord Developer Portal (discord.com/developers) 创建 Application → Bot,
73
- # 开启 MESSAGE CONTENT Intent,复制 Bot Token"
74
-
75
- # 2. 添加渠道
76
- channels accounts add discord --account-id store --token "MTA3xxx..."
77
-
78
- # 3. 验证
79
- channels status
80
- ```
81
-
82
- ## 场景3:接入 Slack
83
-
84
- ```bash
85
- # 1. 引导用户:
86
- # "请在 api.slack.com 创建 App,启用 Socket Mode,获取 Bot Token 和 App Token"
87
-
88
- # 2. 添加渠道
89
- channels accounts add slack --account-id store \
90
- --bot-token "xoxb-..." \
91
- --app-token "xapp-..." \
92
- --signing-secret "..."
93
-
94
- # 3. 验证
95
- channels status
96
- ```
97
-
98
- ## 场景4:接入飞书
99
-
100
- ```bash
101
- # 1. 引导用户:
102
- # "请在飞书开发者后台创建应用,获取 App ID 和 App Secret"
103
-
104
- # 2. 添加渠道
105
- channels accounts add feishu --account-id store \
106
- --app-id "cli_xxx" \
107
- --app-secret "xxx"
108
-
109
- # 3. 验证
110
- channels status
111
- ```
112
-
113
- ## 场景5:接入 LINE
114
-
115
- ```bash
116
- # 1. 引导用户:
117
- # "请在 LINE Developers Console 创建 Messaging API channel,获取 Channel Access Token 和 Channel Secret"
118
-
119
- # 2. 添加渠道
120
- channels accounts add line --account-id store \
121
- --channel-access-token "xxx" \
122
- --channel-secret "xxx"
123
-
124
- # 3. 配置 Webhook URL(需在 LINE Developer Console 手动设置):
125
- # https://channels-api.optima.onl/webhook/line/store
126
-
127
- # 4. 验证
128
- channels status
129
- ```
130
-
131
- ## 场景6:社交账号自动绑定
132
-
133
- **无需 CLI 操作**。商家只需给 bot 发送任意消息,bot 会:
134
-
135
- 1. 自动回复一条授权链接(形如 `https://auth.optima.onl/api/v1/oauth/device?user_code=XXX-YYY`)
136
- 2. 商家点开链接在手机浏览器登录并授权
137
- 3. bot 发送 "✅ 授权成功" 消息,之后商家可以直接问任何业务问题
138
-
139
- 链接 10 分钟内有效。超过 14 天未活跃,bot 会要求重新授权。
140
-
141
- **开发者运维**:如需强制解绑某条绑定,用 `channels bind remove`(现有命令不变)。
142
-
143
- ## 场景7:发送通知
144
-
145
- ```bash
146
- # 发送给单个用户(发到所有已绑定渠道)
147
- channels send --user-id "uuid-xxx" --text "您的订单 #1234 已发货"
148
-
149
- # 指定渠道发送
150
- channels send --user-id "uuid-xxx" --text "消息" --platform telegram
151
-
152
- # 广播给多个用户
153
- channels broadcast --text "新品上架!限时8折" --user-ids "uuid-1,uuid-2,uuid-3"
154
- ```
155
-
156
- ## 各平台必需参数
157
-
158
- | 平台 | 必需参数 | 获取方式 |
159
- |------|---------|---------|
160
- | Telegram | `--token` | @BotFather 创建 bot |
161
- | Discord | `--token` | Developer Portal → Bot |
162
- | Slack | `--bot-token` `--app-token` `--signing-secret` | api.slack.com → App |
163
- | LINE | `--channel-access-token` `--channel-secret` | LINE Developers Console |
164
- | 飞书 | `--app-id` `--app-secret` | 飞书开发者后台 |
165
- | WhatsApp | `--session-dir`(可选) | baileys QR 扫码认证 |
166
- | Zalo | `--token` | Zalo Developer Console |
167
-
168
- ## 命令参考
169
-
170
- ```bash
171
- # 状态
172
- channels status
173
-
174
- # 账号管理
175
- channels accounts list
176
- channels accounts add <platform> --account-id <id> [平台参数]
177
- channels accounts remove <platform> <accountId>
178
- channels accounts enable <platform> <accountId>
179
- channels accounts disable <platform> <accountId>
180
-
181
- # 绑定管理
182
- channels bind list [--user-id <id>]
183
- channels bind remove --platform <p> --account-id <a> --platform-uid <uid>
184
-
185
- # 消息
186
- channels send --user-id <id> --text "消息"
187
- channels broadcast --text "消息" --user-ids "id1,id2"
188
- ```
1
+ ---
2
+ name: channels
3
+ description: "社交渠道管理。接入/管理 Telegram、WhatsApp、Discord、Slack、飞书、LINE、Zalo 等社交渠道,绑定用户账号,发送通知。使用场景:接入渠道(connect channel)、绑定(bind)、社交(social)、Telegram、WhatsApp、Discord、Slack、飞书、LINE、Zalo、通知(notify)、推送(push)、消息(message)。"
4
+ ---
5
+
6
+ # Optima Channels - 社交渠道管理
7
+
8
+ 管理社交渠道接入、用户绑定和消息推送。支持 Telegram、WhatsApp、Discord、Slack、飞书、LINE、Zalo。
9
+
10
+ ## 社交渠道环境注意事项
11
+
12
+ 当消息来自社交渠道(metadata.source === "channel_bridge")时:
13
+
14
+ 1. **无浏览器环境** — 用户在 Telegram/WhatsApp 等社交 App 中,无法自动打开浏览器。所有需要浏览器的操作(如 OAuth 登录),必须把 URL 发给用户让他们手动打开。
15
+
16
+ 2. **登录流程** — 当用户需要登录(如操作商品、订单等需要认证的功能):
17
+ - 运行 `commerce auth login`
18
+ - 命令会输出一个授权 URL 和验证码
19
+ - **把 URL 和验证码发给用户**,告诉他们在手机浏览器中打开
20
+ - 命令会自动等待用户完成授权
21
+ - 不要说"浏览器已自动打开"——社交渠道里没有浏览器
22
+
23
+ 3. **回复简洁** — 社交渠道消息应比 Web Chat 更简洁。避免长段落,用要点列表。
24
+
25
+ ## 典型场景
26
+
27
+ 当用户说:
28
+ - "登录" → 运行 `commerce auth login`,把输出中的 URL 和验证码发给用户
29
+ - "帮我接入 Telegram" → 引导创建 bot → `channels accounts add telegram --account-id store --token <token>`
30
+ - "查看我的渠道" → `channels accounts list`
31
+ - "关掉 Telegram" → `channels accounts disable telegram store`
32
+ - "重新开启 Telegram" → `channels accounts enable telegram store`
33
+ - "删除 Telegram 渠道" → `channels accounts remove telegram store`
34
+ - "查看我的绑定" → `channels bind list`
35
+ - "解绑 Telegram" → `channels bind remove --platform telegram --account-id store --platform-uid 123456`
36
+ - "给用户发通知" → `channels send --user-id <id> --text "消息内容"`
37
+ - "广播消息" → `channels broadcast --text "消息" --user-ids id1,id2`
38
+ - "查看渠道状态" → `channels status`
39
+
40
+ ### 场景决策表
41
+
42
+ | 用户需求 | 推荐命令 | 关键注意点 |
43
+ |---------|---------|-----------|
44
+ | 接入新渠道 | `channels accounts add <platform>` | 不同平台需要不同参数,见下方 |
45
+ | 查看渠道列表 | `channels accounts list` | 显示所有账号及状态 |
46
+ | 启用/禁用渠道 | `channels accounts enable/disable` | 不删除配置,只是暂停 |
47
+ | 删除渠道 | `channels accounts remove` | 永久删除,需重新配置 |
48
+ | 查看绑定 | `channels bind list` | 显示当前用户绑定的社交账号 |
49
+ | 解绑 | `channels bind remove` | 需要指定 platform、account-id、platform-uid |
50
+ | 发送通知 | `channels send` | 发到用户所有已绑定渠道 |
51
+ | 广播 | `channels broadcast` | 发给多个用户 |
52
+
53
+ ## 场景1:接入 Telegram
54
+
55
+ **流程**: 创建 Bot → 获取 Token → 添加到 Optima
56
+
57
+ ```bash
58
+ # 1. 引导用户:
59
+ # "请在 Telegram 找 @BotFather,发送 /newbot,按提示创建 bot,然后把 token 发给我"
60
+
61
+ # 2. 用户提供 token 后,添加渠道
62
+ channels accounts add telegram --account-id store --token "123456:AAHxxxxxxxxxx"
63
+
64
+ # 3. 验证
65
+ channels status
66
+ ```
67
+
68
+ ## 场景2:接入 Discord
69
+
70
+ ```bash
71
+ # 1. 引导用户:
72
+ # "请在 Discord Developer Portal (discord.com/developers) 创建 Application → Bot,
73
+ # 开启 MESSAGE CONTENT Intent,复制 Bot Token"
74
+
75
+ # 2. 添加渠道
76
+ channels accounts add discord --account-id store --token "MTA3xxx..."
77
+
78
+ # 3. 验证
79
+ channels status
80
+ ```
81
+
82
+ ## 场景3:接入 Slack
83
+
84
+ ```bash
85
+ # 1. 引导用户:
86
+ # "请在 api.slack.com 创建 App,启用 Socket Mode,获取 Bot Token 和 App Token"
87
+
88
+ # 2. 添加渠道
89
+ channels accounts add slack --account-id store \
90
+ --bot-token "xoxb-..." \
91
+ --app-token "xapp-..." \
92
+ --signing-secret "..."
93
+
94
+ # 3. 验证
95
+ channels status
96
+ ```
97
+
98
+ ## 场景4:接入飞书
99
+
100
+ ```bash
101
+ # 1. 引导用户:
102
+ # "请在飞书开发者后台创建应用,获取 App ID 和 App Secret"
103
+
104
+ # 2. 添加渠道
105
+ channels accounts add feishu --account-id store \
106
+ --app-id "cli_xxx" \
107
+ --app-secret "xxx"
108
+
109
+ # 3. 验证
110
+ channels status
111
+ ```
112
+
113
+ ## 场景5:接入 LINE
114
+
115
+ ```bash
116
+ # 1. 引导用户:
117
+ # "请在 LINE Developers Console 创建 Messaging API channel,获取 Channel Access Token 和 Channel Secret"
118
+
119
+ # 2. 添加渠道
120
+ channels accounts add line --account-id store \
121
+ --channel-access-token "xxx" \
122
+ --channel-secret "xxx"
123
+
124
+ # 3. 配置 Webhook URL(需在 LINE Developer Console 手动设置):
125
+ # https://channels-api.optima.onl/webhook/line/store
126
+
127
+ # 4. 验证
128
+ channels status
129
+ ```
130
+
131
+ ## 场景6:社交账号自动绑定
132
+
133
+ **无需 CLI 操作**。商家只需给 bot 发送任意消息,bot 会:
134
+
135
+ 1. 自动回复一条授权链接(形如 `https://auth.optima.onl/api/v1/oauth/device?user_code=XXX-YYY`)
136
+ 2. 商家点开链接在手机浏览器登录并授权
137
+ 3. bot 发送 "✅ 授权成功" 消息,之后商家可以直接问任何业务问题
138
+
139
+ 链接 10 分钟内有效。超过 14 天未活跃,bot 会要求重新授权。
140
+
141
+ **开发者运维**:如需强制解绑某条绑定,用 `channels bind remove`(现有命令不变)。
142
+
143
+ ## 场景7:发送通知
144
+
145
+ ```bash
146
+ # 发送给单个用户(发到所有已绑定渠道)
147
+ channels send --user-id "uuid-xxx" --text "您的订单 #1234 已发货"
148
+
149
+ # 指定渠道发送
150
+ channels send --user-id "uuid-xxx" --text "消息" --platform telegram
151
+
152
+ # 广播给多个用户
153
+ channels broadcast --text "新品上架!限时8折" --user-ids "uuid-1,uuid-2,uuid-3"
154
+ ```
155
+
156
+ ## 各平台必需参数
157
+
158
+ | 平台 | 必需参数 | 获取方式 |
159
+ |------|---------|---------|
160
+ | Telegram | `--token` | @BotFather 创建 bot |
161
+ | Discord | `--token` | Developer Portal → Bot |
162
+ | Slack | `--bot-token` `--app-token` `--signing-secret` | api.slack.com → App |
163
+ | LINE | `--channel-access-token` `--channel-secret` | LINE Developers Console |
164
+ | 飞书 | `--app-id` `--app-secret` | 飞书开发者后台 |
165
+ | WhatsApp | `--session-dir`(可选) | baileys QR 扫码认证 |
166
+ | Zalo | `--token` | Zalo Developer Console |
167
+
168
+ ## 命令参考
169
+
170
+ ```bash
171
+ # 状态
172
+ channels status
173
+
174
+ # 账号管理
175
+ channels accounts list
176
+ channels accounts add <platform> --account-id <id> [平台参数]
177
+ channels accounts remove <platform> <accountId>
178
+ channels accounts enable <platform> <accountId>
179
+ channels accounts disable <platform> <accountId>
180
+
181
+ # 绑定管理
182
+ channels bind list [--user-id <id>]
183
+ channels bind remove --platform <p> --account-id <a> --platform-uid <uid>
184
+
185
+ # 消息
186
+ channels send --user-id <id> --text "消息"
187
+ channels broadcast --text "消息" --user-ids "id1,id2"
188
+ ```
@@ -1,88 +1,88 @@
1
- ---
2
- name: collection
3
- description: 商品集合管理。创建、编辑集合,设置封面图,管理集合中的商品。当用户需要对商品进行分组、创建促销专区、管理商品分类、设置集合封面时使用。
4
- ---
5
-
6
- ## 概念
7
-
8
- Collection(集合)是商品的逻辑分组,用于在店铺中组织和展示商品。类似 Shopify 的 Collections。
9
-
10
- - 一个商品可以属于多个集合(多对多关系)
11
- - 集合支持层级结构(parent_id)
12
- - 集合通过 slug 在 URL 中标识,如 `/collections/summer-sale`
13
-
14
- ## 结构
15
-
16
- ```
17
- Collection
18
- ├── 基本信息
19
- │ ├── name: 集合名称
20
- │ ├── slug: URL 标识(商户内唯一)
21
- │ └── description: 描述
22
- ├── 显示设置
23
- │ ├── display_order: 显示顺序
24
- │ ├── is_active: 是否激活
25
- │ └── cover_media_id: 封面图
26
- ├── 层级
27
- │ └── parent_id: 父集合(可选)
28
- ├── SEO
29
- │ ├── meta_title: SEO 标题
30
- │ └── meta_description: SEO 描述
31
- └── 商品(多对多)
32
- └── products: 集合中的商品列表
33
- ```
34
-
35
- ## 典型场景
36
-
37
- 当用户说:
38
- - "查看所有集合" / "集合列表" → `commerce collection list`
39
- - "创建集合 XX" → `commerce collection create --name "XX" --slug xx`
40
- - "查看集合详情" → `commerce collection get --id xx`
41
- - "删除集合 XX" → `commerce collection delete --id xx --yes`
42
- - "把商品加到集合" → `commerce collection add-products --id xx --product-ids p1,p2`
43
- - "从集合移除商品" → `commerce collection remove-products --id xx --product-ids p1`
44
- - "查看集合里有哪些商品" → `commerce collection list-products --id xx`
45
- - "设置集合封面" / "给集合加封面图" → `commerce collection set-cover --id xx --path ./cover.jpg`
46
-
47
- ## 命令参考
48
-
49
- ### 集合 CRUD
50
- - `commerce collection list` - 列出所有集合
51
- - `commerce collection create --name <name> --slug <slug>` - 创建集合
52
- - `commerce collection get --id <id>` - 查看集合详情
53
- - `commerce collection update --id <id>` - 更新集合(支持 --name, --slug, --description 等)
54
- - `commerce collection delete --id <id> --yes` - 删除集合
55
- - `commerce collection set-cover --id <id>` - 设置封面图(支持 --media-id, --url, --path)
56
-
57
- ### 商品管理
58
- - `commerce collection add-products --id <id> --product-ids <ids>` - 添加商品
59
- - `commerce collection remove-products --id <id> --product-ids <ids>` - 移除商品
60
- - `commerce collection list-products --id <id>` - 列出集合中的商品
61
-
62
- ## 创建集合示例
63
-
64
- ```bash
65
- # 创建促销集合(返回 id,用于后续操作)
66
- commerce collection create \
67
- --name "Summer Sale 2024" \
68
- --slug summer-sale-2024 \
69
- --description "Hot deals for summer"
70
- # 输出: { "id": "coll_xxx", ... }
71
-
72
- # 添加商品到集合(使用返回的 id)
73
- commerce collection add-products \
74
- --id coll_xxx \
75
- --product-ids prod_123,prod_456,prod_789
76
-
77
- # 设置封面图
78
- commerce collection set-cover \
79
- --id coll_xxx \
80
- --path ./summer-sale-cover.jpg
81
- ```
82
-
83
- ## 注意事项
84
-
85
- - **slug 规范**:使用英文、数字、连字符,避免中文和特殊字符(影响 SEO 和 URL)
86
- - **删除确认**:删除操作需要 `--yes` 参数确认
87
- - **商品数量**:建议每个集合包含 5-30 个商品,过少显得空,过多难以浏览
88
- - **层级深度**:支持父子集合,但建议层级不超过 2 层
1
+ ---
2
+ name: collection
3
+ description: 商品集合管理。创建、编辑集合,设置封面图,管理集合中的商品。当用户需要对商品进行分组、创建促销专区、管理商品分类、设置集合封面时使用。
4
+ ---
5
+
6
+ ## 概念
7
+
8
+ Collection(集合)是商品的逻辑分组,用于在店铺中组织和展示商品。类似 Shopify 的 Collections。
9
+
10
+ - 一个商品可以属于多个集合(多对多关系)
11
+ - 集合支持层级结构(parent_id)
12
+ - 集合通过 slug 在 URL 中标识,如 `/collections/summer-sale`
13
+
14
+ ## 结构
15
+
16
+ ```
17
+ Collection
18
+ ├── 基本信息
19
+ │ ├── name: 集合名称
20
+ │ ├── slug: URL 标识(商户内唯一)
21
+ │ └── description: 描述
22
+ ├── 显示设置
23
+ │ ├── display_order: 显示顺序
24
+ │ ├── is_active: 是否激活
25
+ │ └── cover_media_id: 封面图
26
+ ├── 层级
27
+ │ └── parent_id: 父集合(可选)
28
+ ├── SEO
29
+ │ ├── meta_title: SEO 标题
30
+ │ └── meta_description: SEO 描述
31
+ └── 商品(多对多)
32
+ └── products: 集合中的商品列表
33
+ ```
34
+
35
+ ## 典型场景
36
+
37
+ 当用户说:
38
+ - "查看所有集合" / "集合列表" → `commerce collection list`
39
+ - "创建集合 XX" → `commerce collection create --name "XX" --slug xx`
40
+ - "查看集合详情" → `commerce collection get --id xx`
41
+ - "删除集合 XX" → `commerce collection delete --id xx --yes`
42
+ - "把商品加到集合" → `commerce collection add-products --id xx --product-ids p1,p2`
43
+ - "从集合移除商品" → `commerce collection remove-products --id xx --product-ids p1`
44
+ - "查看集合里有哪些商品" → `commerce collection list-products --id xx`
45
+ - "设置集合封面" / "给集合加封面图" → `commerce collection set-cover --id xx --path ./cover.jpg`
46
+
47
+ ## 命令参考
48
+
49
+ ### 集合 CRUD
50
+ - `commerce collection list` - 列出所有集合
51
+ - `commerce collection create --name <name> --slug <slug>` - 创建集合
52
+ - `commerce collection get --id <id>` - 查看集合详情
53
+ - `commerce collection update --id <id>` - 更新集合(支持 --name, --slug, --description 等)
54
+ - `commerce collection delete --id <id> --yes` - 删除集合
55
+ - `commerce collection set-cover --id <id>` - 设置封面图(支持 --media-id, --url, --path)
56
+
57
+ ### 商品管理
58
+ - `commerce collection add-products --id <id> --product-ids <ids>` - 添加商品
59
+ - `commerce collection remove-products --id <id> --product-ids <ids>` - 移除商品
60
+ - `commerce collection list-products --id <id>` - 列出集合中的商品
61
+
62
+ ## 创建集合示例
63
+
64
+ ```bash
65
+ # 创建促销集合(返回 id,用于后续操作)
66
+ commerce collection create \
67
+ --name "Summer Sale 2024" \
68
+ --slug summer-sale-2024 \
69
+ --description "Hot deals for summer"
70
+ # 输出: { "id": "coll_xxx", ... }
71
+
72
+ # 添加商品到集合(使用返回的 id)
73
+ commerce collection add-products \
74
+ --id coll_xxx \
75
+ --product-ids prod_123,prod_456,prod_789
76
+
77
+ # 设置封面图
78
+ commerce collection set-cover \
79
+ --id coll_xxx \
80
+ --path ./summer-sale-cover.jpg
81
+ ```
82
+
83
+ ## 注意事项
84
+
85
+ - **slug 规范**:使用英文、数字、连字符,避免中文和特殊字符(影响 SEO 和 URL)
86
+ - **删除确认**:删除操作需要 `--yes` 参数确认
87
+ - **商品数量**:建议每个集合包含 5-30 个商品,过少显得空,过多难以浏览
88
+ - **层级深度**:支持父子集合,但建议层级不超过 2 层