@optima-chat/optima-agent 0.5.0 → 0.5.1

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 (179) hide show
  1. package/.claude/settings.local.json +83 -0
  2. package/.claude/skills/ads/SKILL.md +0 -0
  3. package/.claude/skills/bi/SKILL.md +71 -42
  4. package/.claude/skills/collection/SKILL.md +88 -0
  5. package/.claude/skills/comfy/SKILL.md +138 -122
  6. package/.claude/skills/ffmpeg/SKILL.md +164 -0
  7. package/.claude/skills/homepage/SKILL.md +324 -0
  8. package/.claude/skills/i18n/SKILL.md +0 -0
  9. package/.claude/skills/inventory/SKILL.md +90 -79
  10. package/.claude/skills/markdown-pdf/SKILL.md +72 -0
  11. package/.claude/skills/merchant/SKILL.md +71 -68
  12. package/.claude/skills/order/SKILL.md +193 -21
  13. package/.claude/skills/product/SKILL.md +51 -6
  14. package/.claude/skills/product-page/SKILL.md +200 -0
  15. package/.claude/skills/review/SKILL.md +234 -0
  16. package/.claude/skills/scout/SKILL.md +116 -1
  17. package/.claude/skills/shipping/SKILL.md +193 -0
  18. package/README.md +5 -1
  19. package/dist/bin/bi-cli.d.ts +0 -0
  20. package/dist/bin/bi-cli.d.ts.map +0 -0
  21. package/dist/bin/bi-cli.js.map +0 -0
  22. package/dist/bin/comfy.d.ts +0 -0
  23. package/dist/bin/comfy.d.ts.map +0 -0
  24. package/dist/bin/comfy.js.map +0 -0
  25. package/dist/bin/commerce.d.ts +0 -0
  26. package/dist/bin/commerce.d.ts.map +0 -0
  27. package/dist/bin/commerce.js.map +0 -0
  28. package/dist/bin/google-ads.d.ts +0 -0
  29. package/dist/bin/google-ads.d.ts.map +0 -0
  30. package/dist/bin/google-ads.js.map +0 -0
  31. package/dist/bin/optima.d.ts +0 -0
  32. package/dist/bin/optima.d.ts.map +0 -0
  33. package/dist/bin/optima.js +3 -3
  34. package/dist/bin/optima.js.map +1 -1
  35. package/dist/bin/scout.d.ts +0 -0
  36. package/dist/bin/scout.d.ts.map +0 -0
  37. package/dist/bin/scout.js.map +0 -0
  38. package/dist/bin/serve.d.ts +0 -0
  39. package/dist/bin/serve.d.ts.map +0 -0
  40. package/dist/bin/serve.js +0 -0
  41. package/dist/bin/serve.js.map +0 -0
  42. package/dist/src/agent.d.ts +0 -48
  43. package/dist/src/agent.d.ts.map +1 -1
  44. package/dist/src/agent.js +3 -98
  45. package/dist/src/agent.js.map +1 -1
  46. package/dist/src/auth/device-flow.d.ts +0 -0
  47. package/dist/src/auth/device-flow.d.ts.map +0 -0
  48. package/dist/src/auth/device-flow.js +0 -0
  49. package/dist/src/auth/device-flow.js.map +0 -0
  50. package/dist/src/auth/index.d.ts +0 -0
  51. package/dist/src/auth/index.d.ts.map +0 -0
  52. package/dist/src/auth/index.js +0 -0
  53. package/dist/src/auth/index.js.map +0 -0
  54. package/dist/src/auth/token.d.ts +0 -0
  55. package/dist/src/auth/token.d.ts.map +0 -0
  56. package/dist/src/auth/token.js +0 -0
  57. package/dist/src/auth/token.js.map +0 -0
  58. package/dist/src/auth/types.d.ts +0 -0
  59. package/dist/src/auth/types.d.ts.map +0 -0
  60. package/dist/src/auth/types.js +0 -0
  61. package/dist/src/auth/types.js.map +0 -0
  62. package/dist/src/config.d.ts +0 -0
  63. package/dist/src/config.d.ts.map +0 -0
  64. package/dist/src/config.js +0 -0
  65. package/dist/src/config.js.map +0 -0
  66. package/dist/src/hooks-loader.d.ts +6 -0
  67. package/dist/src/hooks-loader.d.ts.map +1 -0
  68. package/dist/src/hooks-loader.js +215 -0
  69. package/dist/src/hooks-loader.js.map +1 -0
  70. package/dist/src/index.d.ts +3 -3
  71. package/dist/src/index.d.ts.map +1 -1
  72. package/dist/src/index.js +1 -1
  73. package/dist/src/index.js.map +1 -1
  74. package/dist/src/server/index.d.ts +0 -0
  75. package/dist/src/server/index.d.ts.map +0 -0
  76. package/dist/src/server/index.js +1 -1
  77. package/dist/src/server/index.js.map +1 -1
  78. package/dist/src/server/types.d.ts +0 -0
  79. package/dist/src/server/types.d.ts.map +0 -0
  80. package/dist/src/server/types.js +0 -0
  81. package/dist/src/server/types.js.map +0 -0
  82. package/dist/src/system-prompt.d.ts +0 -0
  83. package/dist/src/system-prompt.d.ts.map +1 -1
  84. package/dist/src/system-prompt.js +10 -3
  85. package/dist/src/system-prompt.js.map +1 -1
  86. package/dist/src/tools/memory.d.ts +0 -0
  87. package/dist/src/tools/memory.d.ts.map +0 -0
  88. package/dist/src/tools/memory.js +0 -0
  89. package/dist/src/tools/memory.js.map +0 -0
  90. package/dist/src/types.d.ts +1 -11
  91. package/dist/src/types.d.ts.map +1 -1
  92. package/dist/src/types.js +0 -0
  93. package/dist/src/types.js.map +0 -0
  94. package/dist/src/ui/App.d.ts +6 -0
  95. package/dist/src/ui/App.d.ts.map +1 -0
  96. package/dist/src/ui/App.js +164 -0
  97. package/dist/src/ui/App.js.map +1 -0
  98. package/dist/src/ui/components/Composer.d.ts +10 -0
  99. package/dist/src/ui/components/Composer.d.ts.map +1 -0
  100. package/dist/src/ui/components/Composer.js +13 -0
  101. package/dist/src/ui/components/Composer.js.map +1 -0
  102. package/dist/src/ui/components/Header.d.ts +7 -0
  103. package/dist/src/ui/components/Header.d.ts.map +1 -0
  104. package/dist/src/ui/components/Header.js +7 -0
  105. package/dist/src/ui/components/Header.js.map +1 -0
  106. package/dist/src/ui/components/Message.d.ts +12 -0
  107. package/dist/src/ui/components/Message.d.ts.map +1 -0
  108. package/dist/src/ui/components/Message.js +21 -0
  109. package/dist/src/ui/components/Message.js.map +1 -0
  110. package/dist/src/ui/components/MessageList.d.ts +9 -0
  111. package/dist/src/ui/components/MessageList.d.ts.map +1 -0
  112. package/dist/src/ui/components/MessageList.js +18 -0
  113. package/dist/src/ui/components/MessageList.js.map +1 -0
  114. package/dist/src/ui/components/Spinner.d.ts +6 -0
  115. package/dist/src/ui/components/Spinner.d.ts.map +1 -0
  116. package/dist/src/ui/components/Spinner.js +7 -0
  117. package/dist/src/ui/components/Spinner.js.map +1 -0
  118. package/dist/src/ui/components/StatusBar.d.ts +11 -0
  119. package/dist/src/ui/components/StatusBar.d.ts.map +1 -0
  120. package/dist/src/ui/components/StatusBar.js +7 -0
  121. package/dist/src/ui/components/StatusBar.js.map +1 -0
  122. package/dist/src/ui/components/index.d.ts +7 -0
  123. package/dist/src/ui/components/index.d.ts.map +1 -0
  124. package/dist/src/ui/components/index.js +7 -0
  125. package/dist/src/ui/components/index.js.map +1 -0
  126. package/dist/src/ui/conversation-manager.d.ts +10 -9
  127. package/dist/src/ui/conversation-manager.d.ts.map +1 -1
  128. package/dist/src/ui/conversation-manager.js +35 -2
  129. package/dist/src/ui/conversation-manager.js.map +1 -1
  130. package/dist/src/ui/headless-types.d.ts +85 -4
  131. package/dist/src/ui/headless-types.d.ts.map +1 -1
  132. package/dist/src/ui/headless-types.js +0 -0
  133. package/dist/src/ui/headless-types.js.map +0 -0
  134. package/dist/src/ui/headless.d.ts +14 -4
  135. package/dist/src/ui/headless.d.ts.map +1 -1
  136. package/dist/src/ui/headless.js +311 -139
  137. package/dist/src/ui/headless.js.map +1 -1
  138. package/dist/src/ui/index.d.ts +0 -0
  139. package/dist/src/ui/index.d.ts.map +0 -0
  140. package/dist/src/ui/index.js +0 -0
  141. package/dist/src/ui/index.js.map +0 -0
  142. package/dist/src/ui/stream.d.ts +0 -0
  143. package/dist/src/ui/stream.d.ts.map +1 -1
  144. package/dist/src/ui/stream.js +27 -5
  145. package/dist/src/ui/stream.js.map +1 -1
  146. package/dist/src/validation/error-formatter.d.ts +21 -0
  147. package/dist/src/validation/error-formatter.d.ts.map +1 -0
  148. package/dist/src/validation/error-formatter.js +98 -0
  149. package/dist/src/validation/error-formatter.js.map +1 -0
  150. package/dist/src/validation/index.d.ts +10 -0
  151. package/dist/src/validation/index.d.ts.map +1 -0
  152. package/dist/src/validation/index.js +10 -0
  153. package/dist/src/validation/index.js.map +1 -0
  154. package/dist/src/validation/json-validator.d.ts +25 -0
  155. package/dist/src/validation/json-validator.d.ts.map +1 -0
  156. package/dist/src/validation/json-validator.js +173 -0
  157. package/dist/src/validation/json-validator.js.map +1 -0
  158. package/dist/src/validation/schema.d.ts +353 -0
  159. package/dist/src/validation/schema.d.ts.map +1 -0
  160. package/dist/src/validation/schema.js +57 -0
  161. package/dist/src/validation/schema.js.map +1 -0
  162. package/dist/src/validation/suggestions.d.ts +25 -0
  163. package/dist/src/validation/suggestions.d.ts.map +1 -0
  164. package/dist/src/validation/suggestions.js +144 -0
  165. package/dist/src/validation/suggestions.js.map +1 -0
  166. package/dist/src/validation/types.d.ts +40 -0
  167. package/dist/src/validation/types.d.ts.map +1 -0
  168. package/dist/src/validation/types.js +5 -0
  169. package/dist/src/validation/types.js.map +1 -0
  170. package/dist/src/validation/yaml-validator.d.ts +25 -0
  171. package/dist/src/validation/yaml-validator.d.ts.map +1 -0
  172. package/dist/src/validation/yaml-validator.js +177 -0
  173. package/dist/src/validation/yaml-validator.js.map +1 -0
  174. package/dist/src/version.d.ts +0 -0
  175. package/dist/src/version.d.ts.map +0 -0
  176. package/dist/src/version.js +0 -0
  177. package/dist/src/version.js.map +0 -0
  178. package/package.json +1 -1
  179. package/.claude/skills/storefront/SKILL.md +0 -532
@@ -0,0 +1,83 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(gh api:*)",
5
+ "WebFetch(domain:platform.claude.com)",
6
+ "Bash(git init:*)",
7
+ "Bash(mkdir:*)",
8
+ "Bash(npm run typecheck:*)",
9
+ "Bash(npm view:*)",
10
+ "WebSearch",
11
+ "Bash(commerce --help)",
12
+ "Bash(done)",
13
+ "Bash(commerce product:*)",
14
+ "Bash(commerce order:*)",
15
+ "Bash(commerce i18n:*)",
16
+ "Bash(google-ads:*)",
17
+ "Bash(scout --help:*)",
18
+ "Bash(tree:*)",
19
+ "Bash(cloc:*)",
20
+ "Bash(npm run build:*)",
21
+ "Bash(git restore:*)",
22
+ "Bash(gh repo view:*)",
23
+ "Bash(mv:*)",
24
+ "Bash(rmdir:*)",
25
+ "Bash(git add:*)",
26
+ "Bash(git commit:*)",
27
+ "Bash(git push)",
28
+ "Bash(timeout 5 npm run optima:*)",
29
+ "Bash(npm install:*)",
30
+ "Bash(cat:*)",
31
+ "Bash(gh issue create:*)",
32
+ "Bash(npx tsx:*)",
33
+ "Bash(timeout 30 npx tsx:*)",
34
+ "Bash(git push origin feature/ask-user-question)",
35
+ "Bash(node:*)",
36
+ "Bash(npm version:*)",
37
+ "Bash(git push:*)",
38
+ "Bash(npm publish:*)",
39
+ "Bash(pkill:*)",
40
+ "Bash(git -C /Users/verypro/optima-agent log --oneline --all -- \".claude/\")",
41
+ "Bash(wc:*)",
42
+ "Bash(grep:*)",
43
+ "Bash(find:*)",
44
+ "Bash(commerce collection --help:*)",
45
+ "Bash(commerce collection update --help:*)",
46
+ "Bash(commerce collection set-cover:*)",
47
+ "Bash(commerce collection get --help:*)",
48
+ "Bash(commerce collection list --help:*)",
49
+ "Bash(commerce collection create --help:*)",
50
+ "Bash(commerce collection remove-products:*)",
51
+ "Bash(commerce collection list-products:*)",
52
+ "Bash(commerce --version:*)",
53
+ "Bash(bi-cli --version:*)",
54
+ "Bash(commerce homepage create --help:*)",
55
+ "Bash(commerce homepage reorder --help:*)",
56
+ "Bash(commerce homepage delete --help:*)",
57
+ "Bash(commerce homepage update-images:*)",
58
+ "Bash(commerce homepage update-collections:*)",
59
+ "Bash(commerce homepage update-target:*)",
60
+ "Bash(commerce homepage switch-template:*)",
61
+ "Bash(commerce inventory:*)",
62
+ "Bash(commerce merchant:*)",
63
+ "Bash(commerce review:*)",
64
+ "Bash(commerce product-page:*)",
65
+ "Bash(bi-cli:*)",
66
+ "Bash(comfy:*)",
67
+ "Bash(scout search:*)",
68
+ "Bash(scout product:*)",
69
+ "Bash(commerce homepage create-collections:*)",
70
+ "Bash(commerce homepage create-featured:*)",
71
+ "Bash(commerce homepage create-collection-products:*)",
72
+ "Bash(commerce homepage create-banner:*)",
73
+ "Bash(xargs -I {} sh -c 'echo \"\"\"\"=== {} ===\"\"\"\"; head -3 /Users/verypro/optima-agent/.claude/skills/{}/SKILL.md | grep \"\"\"\"name:\"\"\"\"')",
74
+ "Bash(ls:*)",
75
+ "Bash(gh issue view:*)",
76
+ "Bash(npx markdownlint-cli:*)",
77
+ "Bash(chmod:*)",
78
+ "Bash(npm whoami:*)"
79
+ ],
80
+ "deny": [],
81
+ "ask": []
82
+ }
83
+ }
File without changes
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: bi
3
- description: "业务数据分析工具。使用场景:查看销售数据(sales/销售)、产品表现分析(product/产品)、趋势分析(trends/趋势)、综合分析(analytics/分析)。使用 bi-cli 命令。"
3
+ description: "业务数据分析工具。使用场景:查看销售数据(sales/销售)、产品表现分析(product/产品)、趋势分析(trends/趋势)、高级分析(analytics/分析)、流量分析(traffic/流量)。使用 bi-cli 命令。"
4
4
  ---
5
5
 
6
6
  # BI 数据分析工具
@@ -9,54 +9,81 @@ description: "业务数据分析工具。使用场景:查看销售数据(sales
9
9
 
10
10
  **命令名称是 `bi-cli`,不是 `bi`**
11
11
 
12
- ## 标准操作
12
+ ## 命令参考
13
+
14
+ ### 销售分析 (sales)
13
15
 
14
- ### 查看销售数据
15
16
  ```bash
16
17
  bi-cli sales get [--days 7] [--pretty]
17
18
  ```
18
- 返回销售汇总和每日明细:
19
- - 总收入、订单数、客单价、客户数
20
- - 每日销售分解
21
19
 
22
- ### 产品表现分析
23
- ```bash
24
- bi-cli product best-sellers [--limit 10] [--pretty]
25
- ```
26
- 返回畅销商品排行
20
+ 返回:总收入、订单数、客单价、客户数、每日明细
27
21
 
28
- ### 趋势分析
29
- ```bash
30
- bi-cli trends revenue --days 30 [--pretty]
31
- ```
32
- 返回收入趋势数据
22
+ ### 产品分析 (product)
33
23
 
34
- ### 综合分析
35
24
  ```bash
36
- bi-cli analytics dashboard [--pretty]
37
- ```
38
- 返回仪表盘数据
25
+ # 畅销商品
26
+ bi-cli product best-sellers [--limit 10] [--sort revenue|quantity] [--pretty]
39
27
 
40
- ## 完整命令列表
28
+ # ABC 库存分析(帕累托)
29
+ bi-cli product abc-analysis [--pretty]
41
30
 
42
- ### 销售分析
43
- ```bash
44
- bi-cli sales get [--days 7] [--pretty]
31
+ # 价格区间分析
32
+ bi-cli product price-analysis [--pretty]
33
+
34
+ # 商品表现
35
+ bi-cli product performance [--days 30] [--limit 20] [--pretty]
45
36
  ```
46
37
 
47
- ### 产品分析
38
+ ### 趋势分析 (trends)
39
+
48
40
  ```bash
49
- bi-cli product best-sellers [--limit 10] [--pretty]
41
+ # 收入趋势(含移动平均)
42
+ bi-cli trends revenue [--days 30] [--granularity daily|hourly|weekly] [--pretty]
43
+
44
+ # 订单热力图(按日/小时)
45
+ bi-cli trends heatmap [--pretty]
46
+
47
+ # 季节性模式
48
+ bi-cli trends seasonality [--pretty]
49
+
50
+ # 收入预测
51
+ bi-cli trends forecast [--days 7] [--pretty]
50
52
  ```
51
53
 
52
- ### 趋势分析
54
+ ### 高级分析 (analytics)
55
+
53
56
  ```bash
54
- bi-cli trends revenue --days 30 [--pretty]
57
+ # 周期对比
58
+ bi-cli analytics compare [--days 30] [--compare-to previous_period|previous_year] [--pretty]
59
+
60
+ # 增长趋势
61
+ bi-cli analytics growth [--period daily|weekly|monthly] [--pretty]
62
+
63
+ # 客户群分析(LTV)
64
+ bi-cli analytics cohort [--pretty]
65
+
66
+ # 订单状态漏斗
67
+ bi-cli analytics funnel [--days 30] [--pretty]
55
68
  ```
56
69
 
57
- ### 综合分析
70
+ ### 流量分析 (traffic)
71
+
58
72
  ```bash
59
- bi-cli analytics dashboard [--pretty]
73
+ # 流量概览
74
+ bi-cli traffic overview [--days 30] [--product <uuid>] [--pretty]
75
+
76
+ # 流量来源
77
+ bi-cli traffic sources [--limit 10] [--pretty]
78
+
79
+ # 转化漏斗
80
+ bi-cli traffic funnel [--pretty]
81
+
82
+ # 站内搜索分析
83
+ bi-cli traffic search [--zero-results] [--pretty]
84
+
85
+ # 热门页面
86
+ bi-cli traffic pages [--limit 20] [--pretty]
60
87
  ```
61
88
 
62
89
  ## 工作流示例
@@ -68,10 +95,6 @@ bi-cli analytics dashboard [--pretty]
68
95
  bi-cli sales get --days 7 --pretty
69
96
  ```
70
97
 
71
- 展示:
72
- - 总收入、订单数、客单价、客户数
73
- - 每日销售明细表格
74
-
75
98
  ### 示例 2:查看畅销商品
76
99
  用户:"哪些商品卖得最好"
77
100
 
@@ -79,10 +102,6 @@ bi-cli sales get --days 7 --pretty
79
102
  bi-cli product best-sellers --limit 5 --pretty
80
103
  ```
81
104
 
82
- 展示:
83
- - TOP5 商品排行
84
- - 销售额、销量、订单数
85
-
86
105
  ### 示例 3:收入趋势
87
106
  用户:"收入趋势如何"
88
107
 
@@ -90,13 +109,23 @@ bi-cli product best-sellers --limit 5 --pretty
90
109
  bi-cli trends revenue --days 30 --pretty
91
110
  ```
92
111
 
93
- 展示:
94
- - 30 天收入趋势
95
- - 增长率、环比数据
112
+ ### 示例 4:同比分析
113
+ 用户:"和去年同期比怎么样"
114
+
115
+ ```bash
116
+ bi-cli analytics compare --days 30 --compare-to previous_year --pretty
117
+ ```
118
+
119
+ ### 示例 5:流量来源
120
+ 用户:"流量都从哪来的"
121
+
122
+ ```bash
123
+ bi-cli traffic sources --limit 10 --pretty
124
+ ```
96
125
 
97
126
  ## 注意事项
98
127
 
99
128
  - 命令是 `bi-cli` 不是 `bi`
100
129
  - 默认输出 JSON 格式(AI 友好)
101
130
  - 使用 `--pretty` 获取彩色表格
102
- - 默认时间范围是最近 7
131
+ - 默认时间范围是最近 7 天或 30 天(因命令而异)
@@ -0,0 +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,189 +1,205 @@
1
1
  ---
2
2
  name: comfy
3
- description: "使用 ComfyUI 生成和编辑图片/视频。使用场景:生成图片(generate images/生成图片/画图)、编辑图片(edit images/编辑图片/图生图)、生成视频(create videos/图生视频)。命令自动等待完成。下载时必须指定完整文件路径(包含文件名)。"
3
+ description: "生成和编辑图片/视频。使用场景:生成图片(generate images/生成图片/画图)、编辑图片(edit images/编辑图片/图生图/风格转换)、生成视频(create videos/图生视频)"
4
4
  ---
5
5
 
6
- # ComfyUI 图像视频生成工具
6
+ # 图像视频生成工具
7
7
 
8
- ## 标准工作流程
8
+ ## 图片生成
9
+
10
+ ### 标准工作流程
9
11
 
10
12
  ```bash
11
- # 步骤 1:生成图片(自动等待完成)
12
- comfy generate "提示词" --width 1024 --height 1024
13
+ # 文生图
14
+ comfy image "提示词" -o /home/aiuser/project/result.png
13
15
 
14
- # 步骤 2:下载(必须指定完整文件路径,包含文件名)
15
- comfy download <prompt_id> -o /用户/工作目录/文件名.png
16
+ # 图片编辑/风格转换
17
+ comfy image "转成水彩风格" -i photo.png -o /home/aiuser/project/result.png
16
18
 
17
- # 步骤 3:读取图片并向用户描述生成结果
18
- Read /用户/工作目录/文件名.png
19
+ # 读取并描述结果
20
+ Read /home/aiuser/project/result.png
19
21
  ```
20
22
 
21
- ## 必须遵守的行为规则
22
-
23
- ### 生成图片时
24
- 1. 使用 `comfy generate "提示词"` - 命令会自动等待,不要手动检查状态
25
- 2. 下载结果:`comfy download <prompt_id> -o <完整文件路径含文件名>`
26
- 3. 使用 Read 工具读取下载的图片
27
- 4. 向用户描述图片内容(颜色、风格、构图、元素)
23
+ ### comfy image 命令
28
24
 
29
- ### 下载文件时
30
- - 必须指定完整文件路径,包含文件名
31
- - 必须使用用户的工作目录
32
- - 不能只指定目录(会导致 EISDIR 错误)
25
+ 统一的图像生成/编辑命令。
33
26
 
34
- 示例:
35
27
  ```bash
36
- # 正确
37
- comfy download abc123 -o /Users/john/project/result.png
38
-
39
- # 错误 - 会失败
40
- comfy download abc123 -o /Users/john/project
28
+ comfy image <prompt> [options]
41
29
  ```
42
30
 
43
- ### 下载后
44
- - 始终使用 Read 工具查看生成的图片
45
- - 向用户描述图片内容
46
- - 验证是否符合用户要求
47
- - 如需改进,提供优化建议
31
+ #### 参数
48
32
 
49
- ## 命令说明
33
+ | 参数 | 说明 |
34
+ |------|------|
35
+ | `-i, --input <path>` | 输入图像(可多次使用,最多 8 张) |
36
+ | `-W, --width <px>` | 输出宽度(默认 1024,必须是 16 的倍数) |
37
+ | `-H, --height <px>` | 输出高度(默认 1024,必须是 16 的倍数) |
38
+ | `-o, --output <path>` | 输出目录或完整路径 |
39
+ | `-s, --seed <number>` | 随机种子(可复现结果) |
40
+ | `-f, --format <fmt>` | 输出格式:jpeg \| png |
50
41
 
51
- ### 生成图片
52
- ```bash
53
- comfy generate "提示词" [--width 1024] [--height 1024]
54
- ```
55
- - 从文本提示词生成图片
56
- - 默认尺寸:1024x1024
57
- - 自动等待完成
58
- - 返回 prompt_id 用于下载
42
+ ### 工作流示例
59
43
 
60
- ### 编辑图片
61
- ```bash
62
- comfy edit <图片路径> "编辑描述"
63
- ```
64
- - 根据文本提示词修改现有图片
65
- - 可以改变风格、添加元素、调整光线
66
- - 自动等待完成
44
+ #### 文生图
67
45
 
68
- ### 生成视频
69
46
  ```bash
70
- comfy video <图片路径> --prompt "运动描述" --width 512 --height 512
47
+ comfy image "a cute fluffy cat sitting on a windowsill, natural lighting" -o /home/aiuser/project/cat.png
48
+ Read /home/aiuser/project/cat.png
71
49
  ```
72
- - 从静态图片生成视频
73
- - 推荐分辨率:512x512
74
- - 可选:运动提示词和负向提示词
75
- - 自动等待完成
76
50
 
77
- ### 下载结果
51
+ #### 图片风格转换
52
+
78
53
  ```bash
79
- comfy download <prompt_id> -o <完整文件路径>
54
+ comfy image "watercolor painting style, artistic brushstrokes" -i photo.jpg -o /home/aiuser/project/watercolor.png
55
+ Read /home/aiuser/project/watercolor.png
80
56
  ```
81
- - 下载生成的文件到指定路径
82
- - 路径必须包含文件名和扩展名
83
- - 必须在用户的工作目录下
84
57
 
85
- ## 工作流示例
58
+ #### 多图风格融合
86
59
 
87
- ### 示例 1:生成猫的图片
88
- 用户:"生成一张猫的图片"
60
+ 将第一张图的风格应用到第二张图的内容上:
89
61
 
90
62
  ```bash
91
- comfy generate "a cute fluffy cat sitting on a windowsill, natural lighting, high quality photograph"
92
- comfy download abc123 -o /Users/john/project/cat.png
93
- Read /Users/john/project/cat.png
63
+ comfy image "apply the artistic style from image 1 to the content of image 2" -i style.png -i content.png -o /home/aiuser/project/fusion.png
64
+ Read /home/aiuser/project/fusion.png
94
65
  ```
95
- 然后描述:"我生成了一张猫的图片。图片展示了一只蓬松的小猫坐在窗台上,自然光线下。猫咪有【描述颜色、表情、细节】。"
96
66
 
97
- ### 示例 2:迪士尼风格海报
98
- 用户:"给产品生成一张迪士尼风格的海报"
67
+ #### 多图元素组合
68
+
69
+ 从多张图中提取元素组合成新图:
99
70
 
100
71
  ```bash
101
- comfy generate "Disney Pixar style movie poster, [产品描述], cute 3D character, vibrant gradient background, magical sparkles, professional studio quality, warm lighting" --width 1024 --height 1024
102
- comfy download def456 -o /Users/john/project/poster.png
103
- Read /Users/john/project/poster.png
72
+ comfy image "The person from image 1 is petting the cat from image 2, in a cozy living room" -i person.jpg -i cat.jpg -o /home/aiuser/project/combined.png
104
73
  ```
105
- 然后描述海报的风格、颜色、角色、构图。
106
74
 
107
- ### 示例 3:转换为动漫风格
108
- 用户:"把这张照片转成动漫风格"
75
+ #### 精确颜色控制
76
+
77
+ 使用 hex code 指定精确颜色:
109
78
 
110
79
  ```bash
111
- comfy edit /Users/john/photos/portrait.jpg "anime style, vibrant colors, detailed, high quality"
112
- comfy download ghi789 -o /Users/john/project/portrait-anime.png
113
- Read /Users/john/project/portrait-anime.png
80
+ comfy image "a modern logo with brand color #02eb3c as the primary accent" -o /home/aiuser/project/logo.png
114
81
  ```
115
- 然后描述动漫风格转换的效果。
116
82
 
117
- ### 示例 4:图片生成视频
118
- 用户:"把这张人像做成视频"
83
+ #### 产品海报
119
84
 
120
85
  ```bash
121
- comfy video /Users/john/photos/portrait.png --prompt "natural facial expression, subtle head movement, smooth motion" --width 512 --height 512
122
- comfy download jkl012 -o /Users/john/project/portrait-video.mp4
86
+ comfy image "Disney Pixar style 3D poster, [产品描述], cute character, vibrant gradient background, professional studio lighting" -W 1024 -H 1024 -o /home/aiuser/project/poster.png
123
87
  ```
124
- 视频文件无需读取,直接告知用户文件路径即可。
125
88
 
126
- ## 提示词编写指南
89
+ ### 提示词指南(FLUX.2)
127
90
 
128
- ### 结构
129
- - 具体明确:"a golden retriever puppy playing in a garden" 而非 "a dog"
130
- - 包含风格:"photorealistic"、"anime style"、"oil painting"、"Disney Pixar style"
131
- - 添加细节:材质、光线、背景、氛围
132
- - 使用英文以获得最佳效果(FLUX 模型对英文效果更好)
91
+ #### 结构
92
+
93
+ **Subject + Action + Style + Context**
94
+
95
+ 词序很重要,靠前的元素优先级更高。
96
+
97
+ #### 长度建议
98
+
99
+ | 长度 | 词数 | 适用场景 |
100
+ |------|------|----------|
101
+ | 短 | 10-30 | 快速概念探索 |
102
+ | 中 | 30-80 | 大多数项目(推荐) |
103
+ | 长 | 80+ | 复杂场景 |
104
+
105
+ #### 最佳实践
106
+
107
+ | 技巧 | 说明 | 示例 |
108
+ |------|------|------|
109
+ | 描述想要的 | 不支持负向提示词 | "sharp focus" 而非 "no blur" |
110
+ | 精确颜色 | 使用 hex code | `"brand color #1a1a2e"` |
111
+ | 文字渲染 | 用引号包裹文字 | `"The text 'OPEN' in red neon"` |
112
+ | 摄影风格 | 指定相机/镜头 | `"shot on Fujifilm X-T5, 35mm f/1.4"` |
113
+ | 多语言 | 用原生语言更地道 | 法语描述巴黎场景 |
114
+
115
+ #### 示例对比
133
116
 
134
- ### 示例
135
117
  ```bash
136
- # 简单提示词
137
- comfy generate "a robot"
118
+ # 简单
119
+ comfy image "a robot"
138
120
 
139
- # 添加风格和细节
140
- comfy generate "a friendly AI robot assistant, cute cartoon style, bright colors, 3D render, Pixar quality"
121
+ # 添加风格
122
+ comfy image "a friendly AI robot, cute cartoon style, bright colors, 3D render"
141
123
 
142
- # 完整详细描述
143
- comfy generate "Disney Pixar style 3D animated robot character, friendly cheerful expression, wearing headset, surrounded by floating icons, gradient purple-blue background, professional studio lighting, high quality render, vibrant colors"
124
+ # 完整描述
125
+ comfy image "Disney Pixar style 3D animated robot character, friendly cheerful expression, wearing headset, surrounded by floating icons, gradient purple-blue background, professional studio lighting, vibrant colors"
144
126
  ```
145
127
 
146
- ## 分辨率选择
128
+ ### 分辨率选择
129
+
130
+ 尺寸必须是 **16 的倍数**,最大支持 4MP(推荐 2MP 内)。
147
131
 
148
132
  | 用途 | 分辨率 |
149
133
  |------|--------|
150
- | 社交媒体图片 | 1024x1024 |
151
- | 宽屏壁纸 | 1920x1080 |
134
+ | 社交媒体 | 1024x1024 |
135
+ | 宽屏壁纸 | 1920x1088 |
152
136
  | 竖屏海报 | 768x1280 |
153
- | 视频生成 | 512x512 |
154
137
 
155
- ## 错误预防
138
+ ### 生成规则
139
+
140
+ #### 生成后
141
+ - 使用 Read 工具查看生成的图片
142
+ - 向用户描述图片内容(颜色、风格、构图、元素)
143
+ - 验证是否符合用户要求
144
+
145
+ #### 尺寸要求
146
+ - 宽高必须是 16 的倍数
147
+ - 最大 4MP,推荐 2MP 内
156
148
 
157
- ### 不要做:
158
- - 生成后立即检查状态(还未入队)
159
- - 使用 sleep + 检查状态循环(命令会自动等待)
160
- - 下载时只指定目录(必须包含文件名)
161
- - 跳过读取生成的图片(用户需要看到描述)
149
+ #### 多图参考
150
+ - 最多 8 张输入图
162
151
 
163
- ### 必须做:
164
- - 使用默认等待行为(不要添加 --no-wait)
165
- - 下载时指定完整文件路径
166
- - 读取生成的图片并描述给用户
167
- - 使用英文提示词以获得更好效果
168
- - 生成视频时使用 512x512 分辨率
152
+ ## 视频生成
169
153
 
170
- ## 队列管理(如需要)
154
+ 从静态图片生成视频(wan2.6-i2v),支持 720P/1080P,5-15 秒。
171
155
 
172
156
  ```bash
173
- comfy queue status # 查看队列状态
174
- comfy queue clear --confirm # 清空队列
175
- comfy interrupt # 中断当前任务
157
+ comfy video <图片路径> [options]
176
158
  ```
177
159
 
178
- ## 系统信息(如需要)
160
+ ### 参数
161
+
162
+ | 参数 | 说明 | 默认值 |
163
+ |------|------|--------|
164
+ | `-p, --prompt` | 运动/内容描述(最长 1500 字) | - |
165
+ | `-n, --negative` | 负向提示词(最长 500 字) | - |
166
+ | `-o, --output <path>` | 输出目录或完整路径 | - |
167
+ | `-r, --resolution` | 720P \| 1080P | 1080P |
168
+ | `-d, --duration` | 5 \| 10 \| 15 秒 | 5 |
169
+ | `--shot-type` | single \| multi(多镜头叙事) | single |
170
+ | `--no-audio` | 禁用自动配音 | - |
171
+ | `--audio-url <url>` | 自定义音频 URL(需先用 `commerce upload` 上传) | - |
172
+ | `--no-prompt-extend` | 禁用智能改写 prompt | - |
173
+ | `--watermark` | 添加 AI 生成水印 | - |
174
+ | `--seed <number>` | 随机种子(可复现) | - |
175
+
176
+ ### 示例
179
177
 
180
178
  ```bash
181
- comfy system stats # GPU/CPU/内存状态
182
- comfy config list # 查看配置
179
+ # 基础用法
180
+ comfy video portrait.png --prompt "gentle smile, subtle head movement"
181
+
182
+ # 10 秒 1080P 视频
183
+ comfy video scene.png -d 10 -r 1080P --prompt "cinematic camera pan"
184
+
185
+ # 多镜头叙事(15 秒故事性视频)
186
+ comfy video story.png --shot-type multi -d 15 --prompt "a day in the life"
187
+
188
+ # 静音视频
189
+ comfy video product.png --no-audio --prompt "360 degree rotation"
190
+
191
+ # 自定义音频(需先上传获取 URL)
192
+ commerce upload file --path "/home/aiuser/music.mp3"
193
+ # 返回 URL 后使用
194
+ comfy video scene.png --audio-url "https://..." -o /home/aiuser/project/with-audio.mp4
195
+
196
+ # 指定输出路径
197
+ comfy video scene.png -o /home/aiuser/project/result.mp4 --prompt "camera zoom"
198
+ Read /home/aiuser/project/result.mp4
183
199
  ```
184
200
 
185
- ## 默认配置
201
+ ### 注意事项
186
202
 
187
- - 服务器:http://dev.optima.chat:8188
188
- - 修改服务器:`comfy config set server http://localhost:8188`
189
- - 输出格式:JSON(优化用于 AI 解析)
203
+ - 输入图片:360-2000px,≤10MB,推荐 1080P 比例
204
+ - 输出规格:30fps,MP4 (H.264)
205
+ - 必须用 `-o` 指定输出路径