@optima-chat/comfy-cli 0.2.4 → 0.2.6

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/dist/index.js CHANGED
@@ -1,5 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import { Command } from 'commander';
3
+ import { readFileSync } from 'fs';
4
+ import { fileURLToPath } from 'url';
5
+ import { dirname, join } from 'path';
3
6
  import { registerGenerateCommand } from './commands/generate.js';
4
7
  import { registerEditCommand } from './commands/edit.js';
5
8
  import { registerVideoCommand } from './commands/video.js';
@@ -10,11 +13,14 @@ import { registerNodeCommand } from './commands/node.js';
10
13
  import { registerSystemCommand } from './commands/system.js';
11
14
  import { registerConfigCommand } from './commands/config.js';
12
15
  import { registerInterruptCommand } from './commands/interrupt.js';
16
+ const __filename = fileURLToPath(import.meta.url);
17
+ const __dirname = dirname(__filename);
18
+ const packageJson = JSON.parse(readFileSync(join(__dirname, '../package.json'), 'utf-8'));
13
19
  const program = new Command();
14
20
  program
15
21
  .name('comfy')
16
22
  .description('A CLI tool for ComfyUI designed for LLM interactions')
17
- .version('0.2.2');
23
+ .version(packageJson.version);
18
24
  // 注册功能命令
19
25
  registerGenerateCommand(program);
20
26
  registerEditCommand(program);
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAA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wB,CAAC,OAAO,CAAC,CAAC;AAElC,OAAO,CAAC,KAAK,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optima-chat/comfy-cli",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "description": "A CLI tool for ComfyUI designed for LLM interactions",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -35,6 +35,10 @@
35
35
  "bugs": {
36
36
  "url": "https://github.com/Optima-Chat/comfy-cli/issues"
37
37
  },
38
+ "files": [
39
+ "dist",
40
+ "workflows"
41
+ ],
38
42
  "publishConfig": {
39
43
  "access": "public"
40
44
  },
@@ -0,0 +1,86 @@
1
+ # ComfyUI Workflows
2
+
3
+ 本目录包含预定义的 ComfyUI 工作流模板,来自 [comfy-mcp](https://github.com/Optima-Chat/comfy-mcp) 项目。
4
+
5
+ ## 可用工作流
6
+
7
+ ### 1. flux_text_to_image.json
8
+ **文生图工作流**
9
+
10
+ 使用 FLUX 模型从文本提示生成图像。
11
+
12
+ **参数**:
13
+ - `prompt`: 正向提示词
14
+ - 其他 FLUX 模型参数
15
+
16
+ **使用示例**:
17
+ ```bash
18
+ comfy workflow submit workflows/flux_text_to_image.json
19
+ ```
20
+
21
+ ---
22
+
23
+ ### 2. flux_image_to_image.json
24
+ **图生图工作流**
25
+
26
+ 使用 FLUX 模型基于输入图像生成新图像。
27
+
28
+ **参数**:
29
+ - `prompt`: 正向提示词
30
+ - `input_image`: 输入图像路径
31
+ - 其他 FLUX 模型参数
32
+
33
+ **使用示例**:
34
+ ```bash
35
+ comfy workflow submit workflows/flux_image_to_image.json
36
+ ```
37
+
38
+ ---
39
+
40
+ ### 3. wan_image_to_video.json
41
+ **图生视频工作流**
42
+
43
+ 将静态图像转换为视频。
44
+
45
+ **参数**:
46
+ - `input_image`: 输入图像
47
+ - `prompt`: 描述提示词
48
+ - `negative_prompt`: 负向提示词
49
+ - `width`: 视频宽度
50
+ - `height`: 视频高度
51
+ - `frames`: 帧数
52
+ - `fps`: 帧率
53
+ - `seed`: 随机种子
54
+ - `steps`: 采样步数
55
+ - `cfg_scale`: CFG 比例
56
+ - `sampler`: 采样器名称
57
+ - `scheduler`: 调度器
58
+ - `unet_model`: UNet 模型
59
+ - `clip_model`: CLIP 模型
60
+ - `clip_vision_model`: CLIP Vision 模型
61
+ - `vae_model`: VAE 模型
62
+ - `shift`: 采样偏移
63
+ - `filename_prefix`: 输出文件名前缀
64
+
65
+ **使用示例**:
66
+ ```bash
67
+ comfy workflow submit workflows/wan_image_to_video.json
68
+ ```
69
+
70
+ ---
71
+
72
+ ## 工作流模板变量
73
+
74
+ 所有工作流都使用 `{{variable}}` 语法来定义可配置参数。在提交工作流时,CLI 会提示输入这些参数,或者可以通过命令行参数传递。
75
+
76
+ ## 添加自定义工作流
77
+
78
+ 1. 在 ComfyUI 中创建并测试你的工作流
79
+ 2. 导出为 JSON 格式
80
+ 3. 使用 `{{variable}}` 语法替换需要参数化的值
81
+ 4. 将文件保存到此目录
82
+ 5. 更新本 README 文档
83
+
84
+ ## 来源
85
+
86
+ 这些工作流来自 [Optima-Chat/comfy-mcp](https://github.com/Optima-Chat/comfy-mcp/tree/main/src/comfy_mcp/workflows) 项目。
@@ -0,0 +1,218 @@
1
+ {
2
+ "6": {
3
+ "inputs": {
4
+ "text": "{{prompt}}",
5
+ "speak_and_recognation": {
6
+ "__value__": [
7
+ false,
8
+ true
9
+ ]
10
+ },
11
+ "clip": [
12
+ "38",
13
+ 0
14
+ ]
15
+ },
16
+ "class_type": "CLIPTextEncode",
17
+ "_meta": {
18
+ "title": "CLIP Text Encode (Positive Prompt)"
19
+ }
20
+ },
21
+ "8": {
22
+ "inputs": {
23
+ "samples": [
24
+ "31",
25
+ 0
26
+ ],
27
+ "vae": [
28
+ "39",
29
+ 0
30
+ ]
31
+ },
32
+ "class_type": "VAEDecode",
33
+ "_meta": {
34
+ "title": "VAE解码"
35
+ }
36
+ },
37
+ "31": {
38
+ "inputs": {
39
+ "seed": "{{seed}}",
40
+ "steps": "{{steps}}",
41
+ "cfg": "{{cfg_scale}}",
42
+ "sampler_name": "{{sampler}}",
43
+ "scheduler": "{{scheduler}}",
44
+ "denoise": "{{denoise}}",
45
+ "model": [
46
+ "37",
47
+ 0
48
+ ],
49
+ "positive": [
50
+ "35",
51
+ 0
52
+ ],
53
+ "negative": [
54
+ "135",
55
+ 0
56
+ ],
57
+ "latent_image": [
58
+ "124",
59
+ 0
60
+ ]
61
+ },
62
+ "class_type": "KSampler",
63
+ "_meta": {
64
+ "title": "K采样器"
65
+ }
66
+ },
67
+ "35": {
68
+ "inputs": {
69
+ "guidance": "{{guidance}}",
70
+ "conditioning": [
71
+ "177",
72
+ 0
73
+ ]
74
+ },
75
+ "class_type": "FluxGuidance",
76
+ "_meta": {
77
+ "title": "Flux引导"
78
+ }
79
+ },
80
+ "37": {
81
+ "inputs": {
82
+ "unet_name": "{{model}}",
83
+ "weight_dtype": "default"
84
+ },
85
+ "class_type": "UNETLoader",
86
+ "_meta": {
87
+ "title": "UNet加载器"
88
+ }
89
+ },
90
+ "38": {
91
+ "inputs": {
92
+ "clip_name1": "{{clip_l_model}}",
93
+ "clip_name2": "{{clip_t5_model}}",
94
+ "type": "flux",
95
+ "device": "default"
96
+ },
97
+ "class_type": "DualCLIPLoader",
98
+ "_meta": {
99
+ "title": "双CLIP加载器"
100
+ }
101
+ },
102
+ "39": {
103
+ "inputs": {
104
+ "vae_name": "{{vae_model}}"
105
+ },
106
+ "class_type": "VAELoader",
107
+ "_meta": {
108
+ "title": "加载VAE"
109
+ }
110
+ },
111
+ "42": {
112
+ "inputs": {
113
+ "image": [
114
+ "146",
115
+ 0
116
+ ]
117
+ },
118
+ "class_type": "FluxKontextImageScale",
119
+ "_meta": {
120
+ "title": "FluxKontextImageScale"
121
+ }
122
+ },
123
+ "124": {
124
+ "inputs": {
125
+ "pixels": [
126
+ "42",
127
+ 0
128
+ ],
129
+ "vae": [
130
+ "39",
131
+ 0
132
+ ]
133
+ },
134
+ "class_type": "VAEEncode",
135
+ "_meta": {
136
+ "title": "VAE编码"
137
+ }
138
+ },
139
+ "135": {
140
+ "inputs": {
141
+ "conditioning": [
142
+ "6",
143
+ 0
144
+ ]
145
+ },
146
+ "class_type": "ConditioningZeroOut",
147
+ "_meta": {
148
+ "title": "条件零化"
149
+ }
150
+ },
151
+ "136": {
152
+ "inputs": {
153
+ "filename_prefix": "{{filename_prefix}}",
154
+ "images": [
155
+ "8",
156
+ 0
157
+ ]
158
+ },
159
+ "class_type": "SaveImage",
160
+ "_meta": {
161
+ "title": "保存图像"
162
+ }
163
+ },
164
+ "142": {
165
+ "inputs": {
166
+ "image": "{{input_image}}",
167
+ "refresh": "refresh"
168
+ },
169
+ "class_type": "LoadImageOutput",
170
+ "_meta": {
171
+ "title": "加载图像(来自输出)"
172
+ }
173
+ },
174
+ "146": {
175
+ "inputs": {
176
+ "direction": "right",
177
+ "match_image_size": true,
178
+ "spacing_width": 0,
179
+ "spacing_color": "white",
180
+ "image1": [
181
+ "142",
182
+ 0
183
+ ]
184
+ },
185
+ "class_type": "ImageStitch",
186
+ "_meta": {
187
+ "title": "Image Stitch"
188
+ }
189
+ },
190
+ "173": {
191
+ "inputs": {
192
+ "images": [
193
+ "42",
194
+ 0
195
+ ]
196
+ },
197
+ "class_type": "PreviewImage",
198
+ "_meta": {
199
+ "title": "预览图像"
200
+ }
201
+ },
202
+ "177": {
203
+ "inputs": {
204
+ "conditioning": [
205
+ "6",
206
+ 0
207
+ ],
208
+ "latent": [
209
+ "124",
210
+ 0
211
+ ]
212
+ },
213
+ "class_type": "ReferenceLatent",
214
+ "_meta": {
215
+ "title": "ReferenceLatent"
216
+ }
217
+ }
218
+ }
@@ -0,0 +1,90 @@
1
+ {
2
+ "6": {
3
+ "inputs": {
4
+ "text": "{{prompt}}",
5
+ "clip": ["30", 1]
6
+ },
7
+ "class_type": "CLIPTextEncode",
8
+ "_meta": {
9
+ "title": "CLIP Text Encode (Positive Prompt)"
10
+ }
11
+ },
12
+ "8": {
13
+ "inputs": {
14
+ "samples": ["31", 0],
15
+ "vae": ["30", 2]
16
+ },
17
+ "class_type": "VAEDecode",
18
+ "_meta": {
19
+ "title": "VAE解码"
20
+ }
21
+ },
22
+ "9": {
23
+ "inputs": {
24
+ "filename_prefix": "{{filename_prefix}}",
25
+ "images": ["8", 0]
26
+ },
27
+ "class_type": "SaveImage",
28
+ "_meta": {
29
+ "title": "保存图像"
30
+ }
31
+ },
32
+ "27": {
33
+ "inputs": {
34
+ "width": "{{width}}",
35
+ "height": "{{height}}",
36
+ "batch_size": 1
37
+ },
38
+ "class_type": "EmptySD3LatentImage",
39
+ "_meta": {
40
+ "title": "空Latent图像(SD3)"
41
+ }
42
+ },
43
+ "30": {
44
+ "inputs": {
45
+ "ckpt_name": "{{model}}"
46
+ },
47
+ "class_type": "CheckpointLoaderSimple",
48
+ "_meta": {
49
+ "title": "Checkpoint加载器(简易)"
50
+ }
51
+ },
52
+ "31": {
53
+ "inputs": {
54
+ "seed": "{{seed}}",
55
+ "steps": "{{steps}}",
56
+ "cfg": "{{cfg_scale}}",
57
+ "sampler_name": "{{sampler}}",
58
+ "scheduler": "{{scheduler}}",
59
+ "denoise": 1,
60
+ "model": ["30", 0],
61
+ "positive": ["35", 0],
62
+ "negative": ["33", 0],
63
+ "latent_image": ["27", 0]
64
+ },
65
+ "class_type": "KSampler",
66
+ "_meta": {
67
+ "title": "K采样器"
68
+ }
69
+ },
70
+ "33": {
71
+ "inputs": {
72
+ "text": "{{negative_prompt}}",
73
+ "clip": ["30", 1]
74
+ },
75
+ "class_type": "CLIPTextEncode",
76
+ "_meta": {
77
+ "title": "CLIP Text Encode (Negative Prompt)"
78
+ }
79
+ },
80
+ "35": {
81
+ "inputs": {
82
+ "guidance": "{{guidance}}",
83
+ "conditioning": ["6", 0]
84
+ },
85
+ "class_type": "FluxGuidance",
86
+ "_meta": {
87
+ "title": "Flux引导"
88
+ }
89
+ }
90
+ }
@@ -0,0 +1,155 @@
1
+ {
2
+ "3": {
3
+ "inputs": {
4
+ "seed": "{{seed}}",
5
+ "steps": "{{steps}}",
6
+ "cfg": "{{cfg_scale}}",
7
+ "sampler_name": "{{sampler}}",
8
+ "scheduler": "{{scheduler}}",
9
+ "denoise": 1,
10
+ "model": ["54", 0],
11
+ "positive": ["50", 0],
12
+ "negative": ["50", 1],
13
+ "latent_image": ["50", 2]
14
+ },
15
+ "class_type": "KSampler",
16
+ "_meta": {
17
+ "title": "K采样器"
18
+ }
19
+ },
20
+ "6": {
21
+ "inputs": {
22
+ "text": "{{prompt}}",
23
+ "clip": ["38", 0]
24
+ },
25
+ "class_type": "CLIPTextEncode",
26
+ "_meta": {
27
+ "title": "CLIP Text Encode (Positive Prompt)"
28
+ }
29
+ },
30
+ "7": {
31
+ "inputs": {
32
+ "text": "{{negative_prompt}}",
33
+ "clip": ["38", 0]
34
+ },
35
+ "class_type": "CLIPTextEncode",
36
+ "_meta": {
37
+ "title": "CLIP Text Encode (Negative Prompt)"
38
+ }
39
+ },
40
+ "8": {
41
+ "inputs": {
42
+ "samples": ["3", 0],
43
+ "vae": ["39", 0]
44
+ },
45
+ "class_type": "VAEDecode",
46
+ "_meta": {
47
+ "title": "VAE解码"
48
+ }
49
+ },
50
+ "37": {
51
+ "inputs": {
52
+ "unet_name": "{{unet_model}}",
53
+ "weight_dtype": "default"
54
+ },
55
+ "class_type": "UNETLoader",
56
+ "_meta": {
57
+ "title": "UNet加载器"
58
+ }
59
+ },
60
+ "38": {
61
+ "inputs": {
62
+ "clip_name": "{{clip_model}}",
63
+ "type": "wan",
64
+ "device": "default"
65
+ },
66
+ "class_type": "CLIPLoader",
67
+ "_meta": {
68
+ "title": "加载CLIP"
69
+ }
70
+ },
71
+ "39": {
72
+ "inputs": {
73
+ "vae_name": "{{vae_model}}"
74
+ },
75
+ "class_type": "VAELoader",
76
+ "_meta": {
77
+ "title": "加载VAE"
78
+ }
79
+ },
80
+ "49": {
81
+ "inputs": {
82
+ "clip_name": "{{clip_vision_model}}"
83
+ },
84
+ "class_type": "CLIPVisionLoader",
85
+ "_meta": {
86
+ "title": "加载CLIP视觉"
87
+ }
88
+ },
89
+ "50": {
90
+ "inputs": {
91
+ "width": "{{width}}",
92
+ "height": "{{height}}",
93
+ "length": "{{frames}}",
94
+ "batch_size": 1,
95
+ "positive": ["6", 0],
96
+ "negative": ["7", 0],
97
+ "vae": ["39", 0],
98
+ "clip_vision_output": ["51", 0],
99
+ "start_image": ["52", 0]
100
+ },
101
+ "class_type": "WanImageToVideo",
102
+ "_meta": {
103
+ "title": "WanImageToVideo"
104
+ }
105
+ },
106
+ "51": {
107
+ "inputs": {
108
+ "crop": "none",
109
+ "clip_vision": ["49", 0],
110
+ "image": ["52", 0]
111
+ },
112
+ "class_type": "CLIPVisionEncode",
113
+ "_meta": {
114
+ "title": "CLIP视觉编码"
115
+ }
116
+ },
117
+ "52": {
118
+ "inputs": {
119
+ "image": "{{input_image}}"
120
+ },
121
+ "class_type": "LoadImage",
122
+ "_meta": {
123
+ "title": "加载图像"
124
+ }
125
+ },
126
+ "54": {
127
+ "inputs": {
128
+ "shift": "{{shift}}",
129
+ "model": ["37", 0]
130
+ },
131
+ "class_type": "ModelSamplingSD3",
132
+ "_meta": {
133
+ "title": "采样算法(SD3)"
134
+ }
135
+ },
136
+ "55": {
137
+ "inputs": {
138
+ "frame_rate": "{{fps}}",
139
+ "loop_count": 0,
140
+ "filename_prefix": "{{filename_prefix}}",
141
+ "format": "video/h264-mp4",
142
+ "pix_fmt": "yuv420p",
143
+ "crf": 19,
144
+ "save_metadata": true,
145
+ "trim_to_audio": false,
146
+ "pingpong": false,
147
+ "save_output": true,
148
+ "images": ["8", 0]
149
+ },
150
+ "class_type": "VHS_VideoCombine",
151
+ "_meta": {
152
+ "title": "Video Combine 🎥🟢🟢"
153
+ }
154
+ }
155
+ }