@optima-chat/optima-agent 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 (84) hide show
  1. package/.claude/settings.local.json +13 -0
  2. package/.claude/skills/bi-cli/SKILL.md +87 -0
  3. package/.claude/skills/comfy-cli/SKILL.md +234 -0
  4. package/.claude/skills/commerce-i18n/SKILL.md +460 -0
  5. package/.claude/skills/commerce-inventory/SKILL.md +291 -0
  6. package/.claude/skills/commerce-order/SKILL.md +201 -0
  7. package/.claude/skills/commerce-product/SKILL.md +307 -0
  8. package/.claude/skills/commerce-storefront/SKILL.md +560 -0
  9. package/.claude/skills/google-ads-cli/SKILL.md +101 -0
  10. package/.claude/skills/optima-scout/SKILL.md +480 -0
  11. package/README.md +66 -0
  12. package/dist/bin/optima.d.ts +3 -0
  13. package/dist/bin/optima.d.ts.map +1 -0
  14. package/dist/bin/optima.js +115 -0
  15. package/dist/bin/optima.js.map +1 -0
  16. package/dist/bin/serve.d.ts +3 -0
  17. package/dist/bin/serve.d.ts.map +1 -0
  18. package/dist/bin/serve.js +53 -0
  19. package/dist/bin/serve.js.map +1 -0
  20. package/dist/src/agent.d.ts +24 -0
  21. package/dist/src/agent.d.ts.map +1 -0
  22. package/dist/src/agent.js +97 -0
  23. package/dist/src/agent.js.map +1 -0
  24. package/dist/src/config.d.ts +22 -0
  25. package/dist/src/config.d.ts.map +1 -0
  26. package/dist/src/config.js +60 -0
  27. package/dist/src/config.js.map +1 -0
  28. package/dist/src/index.d.ts +3 -0
  29. package/dist/src/index.d.ts.map +1 -0
  30. package/dist/src/index.js +2 -0
  31. package/dist/src/index.js.map +1 -0
  32. package/dist/src/server/index.d.ts +4 -0
  33. package/dist/src/server/index.d.ts.map +1 -0
  34. package/dist/src/server/index.js +150 -0
  35. package/dist/src/server/index.js.map +1 -0
  36. package/dist/src/server/types.d.ts +60 -0
  37. package/dist/src/server/types.d.ts.map +1 -0
  38. package/dist/src/server/types.js +2 -0
  39. package/dist/src/server/types.js.map +1 -0
  40. package/dist/src/system-prompt.d.ts +2 -0
  41. package/dist/src/system-prompt.d.ts.map +1 -0
  42. package/dist/src/system-prompt.js +71 -0
  43. package/dist/src/system-prompt.js.map +1 -0
  44. package/dist/src/types.d.ts +37 -0
  45. package/dist/src/types.d.ts.map +1 -0
  46. package/dist/src/types.js +2 -0
  47. package/dist/src/types.js.map +1 -0
  48. package/dist/src/ui/App.d.ts +6 -0
  49. package/dist/src/ui/App.d.ts.map +1 -0
  50. package/dist/src/ui/App.js +139 -0
  51. package/dist/src/ui/App.js.map +1 -0
  52. package/dist/src/ui/components/Composer.d.ts +9 -0
  53. package/dist/src/ui/components/Composer.d.ts.map +1 -0
  54. package/dist/src/ui/components/Composer.js +12 -0
  55. package/dist/src/ui/components/Composer.js.map +1 -0
  56. package/dist/src/ui/components/Header.d.ts +6 -0
  57. package/dist/src/ui/components/Header.d.ts.map +1 -0
  58. package/dist/src/ui/components/Header.js +6 -0
  59. package/dist/src/ui/components/Header.js.map +1 -0
  60. package/dist/src/ui/components/Message.d.ts +11 -0
  61. package/dist/src/ui/components/Message.d.ts.map +1 -0
  62. package/dist/src/ui/components/Message.js +17 -0
  63. package/dist/src/ui/components/Message.js.map +1 -0
  64. package/dist/src/ui/components/MessageList.d.ts +7 -0
  65. package/dist/src/ui/components/MessageList.d.ts.map +1 -0
  66. package/dist/src/ui/components/MessageList.js +7 -0
  67. package/dist/src/ui/components/MessageList.js.map +1 -0
  68. package/dist/src/ui/components/Spinner.d.ts +6 -0
  69. package/dist/src/ui/components/Spinner.d.ts.map +1 -0
  70. package/dist/src/ui/components/Spinner.js +7 -0
  71. package/dist/src/ui/components/Spinner.js.map +1 -0
  72. package/dist/src/ui/components/StatusBar.d.ts +10 -0
  73. package/dist/src/ui/components/StatusBar.d.ts.map +1 -0
  74. package/dist/src/ui/components/StatusBar.js +6 -0
  75. package/dist/src/ui/components/StatusBar.js.map +1 -0
  76. package/dist/src/ui/components/index.d.ts +7 -0
  77. package/dist/src/ui/components/index.d.ts.map +1 -0
  78. package/dist/src/ui/components/index.js +7 -0
  79. package/dist/src/ui/components/index.js.map +1 -0
  80. package/dist/src/ui/index.d.ts +2 -0
  81. package/dist/src/ui/index.d.ts.map +1 -0
  82. package/dist/src/ui/index.js +7 -0
  83. package/dist/src/ui/index.js.map +1 -0
  84. package/package.json +59 -0
@@ -0,0 +1,13 @@
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
+ ],
10
+ "deny": [],
11
+ "ask": []
12
+ }
13
+ }
@@ -0,0 +1,87 @@
1
+ ---
2
+ name: bi-cli
3
+ description: 业务数据分析工具。查看销售数据、产品表现、趋势分析。当用户需要分析销售业绩、查看数据报表、了解业务趋势时使用此技能。
4
+ ---
5
+
6
+ # BI CLI 使用指南
7
+
8
+ ## 前置条件
9
+
10
+ ```bash
11
+ npm install -g @optima-chat/bi-cli@latest
12
+ bi auth login
13
+ ```
14
+
15
+ ## 核心命令
16
+
17
+ ### 销售分析
18
+
19
+ ```bash
20
+ # 销售概览
21
+ bi sales overview
22
+
23
+ # 指定时间范围
24
+ bi sales overview --start 2024-01-01 --end 2024-01-31
25
+
26
+ # 按天/周/月汇总
27
+ bi sales summary --group-by day
28
+ bi sales summary --group-by week
29
+ bi sales summary --group-by month
30
+ ```
31
+
32
+ ### 产品分析
33
+
34
+ ```bash
35
+ # 产品表现排行
36
+ bi product ranking --limit 10
37
+
38
+ # 单个产品分析
39
+ bi product analyze <product-id>
40
+
41
+ # 产品销售趋势
42
+ bi product trend <product-id> --days 30
43
+ ```
44
+
45
+ ### 趋势分析
46
+
47
+ ```bash
48
+ # 整体趋势
49
+ bi trends overview --days 30
50
+
51
+ # 同比/环比分析
52
+ bi trends compare --period week
53
+ bi trends compare --period month
54
+ ```
55
+
56
+ ### 综合分析
57
+
58
+ ```bash
59
+ # 仪表盘数据
60
+ bi analytics dashboard
61
+
62
+ # 自定义查询
63
+ bi analytics query --metric revenue --group-by product --days 7
64
+ ```
65
+
66
+ ## 典型场景
67
+
68
+ ### 查看本周销售情况
69
+
70
+ ```bash
71
+ bi sales overview --days 7
72
+ bi product ranking --days 7 --limit 5
73
+ ```
74
+
75
+ ### 月度业绩报告
76
+
77
+ ```bash
78
+ bi sales summary --group-by month --months 3
79
+ bi trends compare --period month
80
+ bi product ranking --days 30
81
+ ```
82
+
83
+ ## 注意事项
84
+
85
+ - 所有命令默认 JSON 输出
86
+ - 时间范围默认最近 7 天
87
+ - 金额单位与商户配置一致
@@ -0,0 +1,234 @@
1
+ ---
2
+ name: comfy-cli
3
+ description: "ComfyUI CLI tool for AI agents. ALWAYS use when user wants to: generate images (生成图片/画图/图像/生成画), edit images (编辑图片/修改图片/图生图/改图), create videos (生成视频/图生视频/制作视频), manage ComfyUI workflows (工作流/ComfyUI). Uses 'comfy generate', 'comfy edit', 'comfy video' commands."
4
+ ---
5
+
6
+ # ComfyUI CLI
7
+
8
+ ## 典型场景
9
+
10
+ ### 场景 1:快速生成单张图片
11
+ **用户需求**:"帮我生成一张猫的图片"
12
+ **执行步骤**:
13
+ 1. `comfy generate "a cute cat sitting on a couch"`
14
+ 2. 等待完成(默认行为,显示进度)
15
+ 3. 使用返回的 prompt_id 下载:`comfy download <prompt_id>`
16
+
17
+ ### 场景 2:图片迭代优化
18
+ **用户需求**:"这张图片不够好,帮我优化"
19
+ **执行步骤**:
20
+ 1. 分析用户不满意的点(光线、风格、细节)
21
+ 2. 使用 `comfy edit` 添加优化描述
22
+ 3. 如需多次尝试,生成多个变体供用户选择
23
+
24
+ ### 场景 3:图片生成视频
25
+ **用户需求**:"把这张人物照片做成动态视频"
26
+ **执行步骤**:
27
+ 1. `comfy video portrait.png --prompt "natural head movement"`
28
+ 2. 注意视频推荐使用 512x512 分辨率
29
+ 3. 下载后检查效果
30
+
31
+ ## 质量标准
32
+
33
+ ### 好的生成结果
34
+ - **图像清晰**:无模糊、无伪影
35
+ - **主体突出**:构图合理,主体居中或符合构图原则
36
+ - **光影自然**:避免过曝、过暗、不自然的阴影
37
+ - **提示词匹配**:生成内容符合用户描述
38
+
39
+ ### 何时需要重新生成
40
+ - 用户明确表示不满意
41
+ - 生成结果与提示词严重不符
42
+ - 图像质量问题(模糊、伪影、扭曲)
43
+ - 需要尝试不同风格或角度
44
+
45
+ ### 提示词建议
46
+ - **具体清晰**:`a golden retriever puppy` 优于 `a dog`
47
+ - **风格描述**:加入 `photorealistic`, `anime style`, `oil painting` 等
48
+ - **细节描述**:材质、光线、背景、氛围
49
+ - **英文提示词**:FLUX 模型对英文效果最好
50
+
51
+ ## 常见问题
52
+
53
+ ### 问题 1:生成任务提交后无法立即使用
54
+ **原因**:生成需要时间,默认会等待完成
55
+ **解决**:
56
+ - 默认行为会等待并显示进度
57
+ - 如使用 `--no-wait`,需用 `comfy workflow get <prompt_id>` 检查状态
58
+ - status 为 "completed" 后才能下载
59
+
60
+ ### 问题 2:视频生成失败或超时
61
+ **原因**:分辨率过大或提示词复杂
62
+ **解决**:
63
+ - 视频推荐使用 512x512 分辨率
64
+ - 避免过长或复杂的提示词
65
+ - 检查服务器状态:`comfy system stats`
66
+
67
+ ### 问题 3:生成结果不符合预期
68
+ **原因**:提示词不够具体或缺少细节
69
+ **解决**:
70
+ - 增加具体描述(颜色、材质、风格、光线)
71
+ - 使用参考风格词(如 "product photography", "cinematic")
72
+ - 尝试生成多个变体(调整提示词细节)
73
+
74
+ ### 问题 4:无法连接到 ComfyUI 服务器
75
+ **原因**:服务器未启动或地址配置错误
76
+ **解决**:
77
+ - 检查服务器状态:`comfy system stats`
78
+ - 查看配置:`comfy config list`
79
+ - 如使用本地服务器:`comfy config set server http://localhost:8188`
80
+
81
+ ### 问题 5:下载的文件找不到
82
+ **原因**:未指定输出目录或忘记下载路径
83
+ **解决**:
84
+ - 默认保存到 `./output` 目录
85
+ - 使用 `-o` 指定输出路径
86
+ - 检查命令输出的文件路径
87
+
88
+ ## Instructions
89
+
90
+ ### 核心命令
91
+
92
+ **生成图像:**
93
+ ```bash
94
+ comfy generate "提示词" [--width 1024] [--height 1024] [--no-wait] [--pretty]
95
+ ```
96
+ - 从文本提示词生成图像
97
+ - 默认等待完成并显示实时进度,返回 JSON
98
+ - `--no-wait`: 提交后立即返回
99
+ - `--pretty`: 人类可读的表格格式
100
+
101
+ **编辑图像:**
102
+ ```bash
103
+ comfy edit <图像路径> "提示词" [--no-wait] [--pretty]
104
+ ```
105
+ - 使用文本提示词编辑或转换现有图像
106
+ - 支持风格转换、细节增强等
107
+
108
+ **生成视频:**
109
+ ```bash
110
+ comfy video <图像路径> [-p "运动描述"] [-n "负面提示"] [--width 512] [--height 512] [--no-wait] [--pretty]
111
+ ```
112
+ - 从图像生成视频(图生视频)
113
+ - 可选运动描述和负面提示
114
+
115
+ **下载结果:**
116
+ ```bash
117
+ comfy download <PROMPT_ID> [-o ./output] [--pretty]
118
+ ```
119
+ - 下载生成的图像/视频到本地目录(默认:./output)
120
+
121
+ ### 工作流管理
122
+
123
+ ```bash
124
+ comfy workflow list [--limit 10] [--pretty] # 列出历史
125
+ comfy workflow get <PROMPT_ID> [--pretty] # 获取结果
126
+ comfy workflow submit <工作流文件> [--pretty] # 提交自定义工作流
127
+ ```
128
+
129
+ ### 队列管理
130
+
131
+ ```bash
132
+ comfy queue status [--pretty] # 查看队列状态
133
+ comfy queue clear --confirm [--pretty] # 清空队列
134
+ comfy queue delete <项目ID> [--pretty] # 删除队列项
135
+ comfy interrupt [--pretty] # 中断当前执行
136
+ ```
137
+
138
+ ### 模型管理
139
+
140
+ ```bash
141
+ comfy model list [--type checkpoints|loras|vae|controlnet|upscale_models] [--pretty]
142
+ ```
143
+
144
+ ### 系统信息
145
+
146
+ ```bash
147
+ comfy system stats [--pretty] # GPU/CPU/内存状态
148
+ ```
149
+
150
+ ### 配置
151
+
152
+ ```bash
153
+ comfy config list [--pretty] # 查看当前配置
154
+ comfy config set server http://localhost:8188 # 更改服务器地址(可选,默认 http://dev.optima.chat:8188)
155
+ ```
156
+
157
+ ### 输出格式
158
+
159
+ - **默认**:JSON 格式(AI 友好,减少 token)
160
+ - **--pretty**:带颜色的表格格式(人类可读)
161
+
162
+ ## Examples
163
+
164
+ ### 示例 1:生成图像
165
+ ```bash
166
+ comfy generate "a cute cat"
167
+ ```
168
+ 返回包含 `prompt_id` 和状态的 JSON,等待完成后使用 `comfy download <prompt_id>` 下载
169
+
170
+ ### 示例 2:高分辨率图像
171
+ ```bash
172
+ comfy generate "beautiful landscape with mountains" --width 1920 --height 1080
173
+ ```
174
+
175
+ ### 示例 3:图像风格转换
176
+ ```bash
177
+ comfy edit photo.jpg "anime style"
178
+ ```
179
+
180
+ ### 示例 4:视频生成
181
+ ```bash
182
+ comfy video portrait.png --prompt "smooth motion, natural movement"
183
+ ```
184
+
185
+ ### 示例 5:批量生成(非阻塞)
186
+ ```bash
187
+ comfy generate "a cat sitting" --no-wait
188
+ comfy generate "a cat playing" --no-wait
189
+ comfy generate "a cat sleeping" --no-wait
190
+ comfy queue status
191
+ ```
192
+
193
+ ### 示例 6:完整工作流
194
+ ```bash
195
+ # 1. 生成图像
196
+ comfy generate "a portrait of a woman"
197
+ # 返回 prompt_id,等待完成后使用 comfy download 下载
198
+
199
+ # 2. 下载第一张图像
200
+ comfy download <prompt_id_1>
201
+ # 输出:./output/comfy-cli_00001_.png
202
+
203
+ # 3. 编辑图像
204
+ comfy edit ./output/comfy-cli_00001_.png "add cinematic lighting"
205
+ # 返回 prompt_id,等待完成后下载
206
+
207
+ # 4. 下载编辑后的图像
208
+ comfy download <prompt_id_2>
209
+ # 输出:./output/comfy-cli_00002_.png
210
+
211
+ # 5. 生成视频
212
+ comfy video ./output/comfy-cli_00002_.png --prompt "slow motion"
213
+ # 返回 prompt_id,等待完成后下载
214
+ ```
215
+
216
+ ### 示例 7:检查状态和下载
217
+ ```bash
218
+ # 非阻塞提交
219
+ comfy generate "sunset" --no-wait
220
+ # 返回:{ "prompt_id": "abc123" }
221
+
222
+ # 稍后检查状态
223
+ comfy workflow get abc123
224
+
225
+ # 下载结果
226
+ comfy download abc123
227
+ ```
228
+
229
+ ## 重要提示
230
+
231
+ - 默认连接到 `http://dev.optima.chat:8188`
232
+ - 默认输出 JSON 格式,适合 AI 解析
233
+ - 使用 `--pretty` 获取人类可读输出
234
+ - 默认等待完成并显示实时进度