JSPM

  • Created
  • Published
  • Downloads 36
  • Score
    100M100P100Q86951F
  • License MIT

A CLI tool for ComfyUI designed for LLM interactions

Package Exports

  • @optima-chat/comfy-cli
  • @optima-chat/comfy-cli/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@optima-chat/comfy-cli) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

ComfyUI CLI

ComfyUI CLI Banner

面向 ComfyUI 的命令行工具,专为 LLM 交互设计,特别适配 Claude Code。

特性

  • 🚀 简单易用:所有 ComfyUI 操作的简单命令
  • 🤖 LLM 友好:优化自然语言交互体验
  • 📊 实时监控:WebSocket 支持实时进度更新
  • 🎨 图像处理:无缝上传和下载图像
  • 📦 模型管理:列出和查询可用模型
  • 队列控制:管理工作流执行队列

安装

npm install -g @optima-chat/comfy-cli@latest

快速开始

# 检查 ComfyUI 是否运行
comfy system stats

# 提交工作流
comfy workflow submit workflow.json

# 查看队列状态
comfy queue status

# 列出可用模型
comfy model list --type checkpoints

命令

✨ 快捷功能命令

图像生成(文生图)

comfy generate "a beautiful sunset over mountains"
comfy generate "cyberpunk city" --width 1024 --height 768
comfy generate "a cat"  # 默认等待完成并显示实时进度
comfy generate "a cat" --no-wait  # 提交后立即返回

选项

  • --width <number>: 图像宽度(默认:1024)
  • --height <number>: 图像高度(默认:1024)
  • --no-wait: 提交后立即返回(默认等待完成并显示实时进度)
  • --json: 输出 JSON 格式

图像编辑(图生图)

comfy edit input.png "add more details"
comfy edit photo.jpg "make it anime style"
comfy edit image.png "stylize"  # 默认等待完成并显示实时进度
comfy edit image.png "stylize" --no-wait  # 提交后立即返回

选项

  • --no-wait: 提交后立即返回(默认等待完成并显示实时进度)
  • --json: 输出 JSON 格式

视频生成(图生视频)

comfy video portrait.png --prompt "smooth motion"
comfy video scene.jpg --width 512 --height 512
comfy video image.png --prompt "dancing"  # 默认等待完成并显示实时进度
comfy video image.png --prompt "dancing" --no-wait  # 提交后立即返回

选项

  • -p, --prompt <text>: 运动描述提示词
  • -n, --negative <text>: 负向提示词
  • --width <number>: 视频宽度(默认:512)
  • --height <number>: 视频高度(默认:512)
  • --no-wait: 提交后立即返回(默认等待完成并显示实时进度)
  • --json: 输出 JSON 格式

🔧 核心命令

工作流管理

# 提交自定义工作流
comfy workflow submit workflow.json

# 查看历史记录
comfy workflow list --limit 10

# 获取执行结果
comfy workflow get <prompt_id>

队列管理

# 查看队列状态
comfy queue status

# 清空队列
comfy queue clear --confirm

# 删除指定任务
comfy queue delete <item_id>

# 中断当前执行
comfy interrupt

模型管理

# 列出所有模型
comfy model list

# 列出特定类型模型
comfy model list --type checkpoints
comfy model list --type loras --json

节点信息

# 列出所有节点类型
comfy node list

# 过滤节点
comfy node list --filter sampler

# 查看节点详情
comfy node info KSampler --json

系统信息

# 查看系统状态
comfy system stats

# JSON 格式输出
comfy system stats --json

配置管理

# 设置服务器地址
comfy config set server http://localhost:8188

# 查看当前配置
comfy config list

# 重置配置
comfy config reset --confirm

配置

默认配置存储在 ~/.comfy-cli/config.json

{
  "server": "http://dev.optima.chat:8188",
  "timeout": 30000,
  "autoConnect": true,
  "outputDir": "./comfy-output"
}

在 Claude Code 中使用

在你的 ~/.claude/CLAUDE.md 中添加:

## ComfyUI CLI

**常见需求映射**:
- "提交工作流 XX" → `comfy workflow submit XX`
- "查看队列" → `comfy queue status`
- "列出所有 checkpoint 模型" → `comfy model list --type checkpoints`
- "上传图片到 ComfyUI" → `comfy image upload <path>`
- "中断当前任务" → `comfy interrupt`

系统要求

开发

# 安装依赖
npm install

# 开发模式运行
npm run dev

# 构建
npm run build

# 本地测试
npm link
comfy --help

文档

许可证

MIT

贡献

欢迎贡献!请随时提交 Pull Request。

相关链接