comfy-ts 2.18.0 → 2.19.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 (39) hide show
  1. package/README.md +140 -95
  2. package/claude-code/.claude-plugin/plugin.json +9 -0
  3. package/claude-code/skills/convert/SKILL.md +25 -0
  4. package/claude-code/skills/guide/SKILL.md +21 -0
  5. package/claude-code/skills/run/SKILL.md +12 -0
  6. package/claude-code/skills/setup/SKILL.md +15 -0
  7. package/claude-code/skills/workflow/SKILL.md +19 -0
  8. package/dist/cli.js +219 -6
  9. package/dist/cli.js.map +1 -1
  10. package/dist/{state-DgwWhZWb.js → exampleAssets-CE4PUy3n.js} +206 -58
  11. package/dist/exampleAssets-CE4PUy3n.js.map +1 -0
  12. package/dist/index.cjs +173 -59
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.cts +37 -8
  15. package/dist/index.d.ts +37 -8
  16. package/dist/index.js +173 -59
  17. package/dist/index.js.map +1 -1
  18. package/dist/{run-run-Wn7H72Zg.js → run-run-C_yXY0vl.js} +2 -3
  19. package/dist/{run-run-Wn7H72Zg.js.map → run-run-C_yXY0vl.js.map} +1 -1
  20. package/dist/{run-tui-VWSj1D_j.js → run-tui-B3dsftdB.js} +2 -3
  21. package/dist/{run-tui-VWSj1D_j.js.map → run-tui-B3dsftdB.js.map} +1 -1
  22. package/dist/web.d.ts +55 -26
  23. package/dist/web.js +164 -55
  24. package/dist/web.js.map +1 -1
  25. package/examples/README.md +17 -11
  26. package/guide-for-agents.md +4 -1
  27. package/package.json +3 -2
  28. package/src/cli/comfy-ts-cli.ts +8 -0
  29. package/src/cli/skill.ts +207 -0
  30. package/src/exampleAssets.ts +10 -4
  31. package/src/host/ComfyHost.ts +6 -36
  32. package/src/host/ComfyManager.ts +168 -42
  33. package/src/litegraph/expandSubgraphs.ts +58 -4
  34. package/src/litegraph/normalizeWorkflow.ts +6 -1
  35. package/src/manager/installedView.ts +2 -0
  36. package/src/sdk-generator/litegraphToApiRequestPayload.ts +25 -11
  37. package/dist/exampleAssets-BfWzygoM.js +0 -38
  38. package/dist/exampleAssets-BfWzygoM.js.map +0 -1
  39. package/dist/state-DgwWhZWb.js.map +0 -1
package/README.md CHANGED
@@ -1,23 +1,22 @@
1
1
  # comfy-ts
2
2
 
3
- _the ultimate ComfyUI toolkit for TypeScript: `SDK` + `CLI` + `TUI` + `web panel` + agent guide_
3
+ **Write ComfyUI workflows in TypeScript, then run them from code, one command, a terminal, a browser or an agent.**
4
4
 
5
5
  [![CI](https://github.com/rvion/comfy-ts/actions/workflows/ci.yml/badge.svg)](https://github.com/rvion/comfy-ts/actions/workflows/ci.yml) [![npm version](https://img.shields.io/npm/v/comfy-ts.svg)](https://www.npmjs.com/package/comfy-ts) [![npm downloads](https://img.shields.io/npm/dm/comfy-ts.svg)](https://www.npmjs.com/package/comfy-ts) [![GitHub release](https://img.shields.io/github/v/release/rvion/comfy-ts)](https://github.com/rvion/comfy-ts/releases) [![types](https://img.shields.io/npm/types/comfy-ts)](https://www.npmjs.com/package/comfy-ts) [![license](https://img.shields.io/npm/l/comfy-ts.svg)](https://github.com/rvion/comfy-ts/blob/main/LICENSE) [![sponsor](https://img.shields.io/github/sponsors/rvion?label=sponsor&logo=githubsponsors)](https://github.com/sponsors/rvion)
6
6
 
7
- **Everything ComfyUI, from TypeScript.** Build workflows in code with autocomplete on every node and model of your exact install. Run them on any host, from the box under your desk to a cloud GPU, and get the images straight back into your code. Drive them from a terminal UI with live latent previews, or from a browser panel that turns every workflow into a form — on your desk or on your phone. Let scripts and agents discover and install whatever the ecosystem offers. Import and export both ComfyUI JSON formats. One library, the whole pipeline.
7
+ Types come from your own ComfyUI: every node and model it has autocompletes, and a wrong graph is a compile error. Run on your GPU, another machine or Comfy Cloud, and get the images, audio and video back in your code or as files. 73 ready workflows cover 43 model families, from SDXL to Wan video and ACE-Step songs.
8
8
 
9
- **Jump to:** [⚡ 60 second start](#-60-second-start) · [🧩 SDK](#-the-sdk-workflows-as-code) · [🧬 Codegen](#-the-codegen-nothing-else-comes-close) · [🎛️ App mode & vars](#-app-mode--vars-knobs-on-everything) · [🖥️ TUI](#-the-tui) · [🌐 Web panel](#-the-web-panel) · [⌨️ CLI](#-the-cli) · [🌍 Comfy Cloud & hosts](#-hosts-local-lan-comfy-cloud-any-provider) · [🔌 Ecosystem](#-ecosystem-discovery-and-install) · [🤖 Agents](#-for-ai-agents) · [📚 Examples](#-examples) · [🧱 Trust](#-a-lib-you-can-trust-made-to-last)
10
-
11
- ## What's inside
12
-
13
- | piece | what it gives you |
14
- | ---------------- | ---------------------------------------------------------------------------------------- |
15
- | 🧩 **the SDK** | build and run workflows in code, typed down to the model names of your exact machine |
16
- | ⌨️ **the CLI** | one command codegens a full typed SDK for any host, local or remote cloud |
17
- | 🖥️ **the TUI** | drive every workflow from the terminal: knobs, drafts, queue, live latent previews |
18
- | 🌐 **the web panel** | the same workflows as a browser form, phone included, with an LLM prompt refiner built in |
19
- | 🤖 **agent tools** | typed discovery and install across the whole custom node ecosystem, built for automation |
20
- | 🔁 **JSON, both ways** | import and export `api.json` and `workflow.json`, drag your code onto the Comfy canvas |
9
+ | you want to | start here |
10
+ | --- | --- |
11
+ | build and run workflows in code, typed down to the model names of your exact machine | [the SDK](#-the-sdk-workflows-as-code), [the codegen](#-the-codegen-an-sdk-for-your-own-install) |
12
+ | tune a workflow with knobs, drafts, a queue and live latent previews in the terminal | [the TUI](#%EF%B8%8F-the-tui) |
13
+ | get the same workflows as a form in a browser, a phone included, with an LLM prompt refiner | [the web panel](#-the-web-panel) |
14
+ | generate from the command line, or let an AI agent generate for you | [the CLI](#%EF%B8%8F-the-cli), [for AI agents](#-for-ai-agents) |
15
+ | call your workflows over HTTP from a frontend, curl or n8n | [serve](#-serve-drafts-as-an-http-api) |
16
+ | run on Comfy Cloud or a rented GPU, with ready workflows for 43 model families | [hosts](#-hosts-local-lan-comfy-cloud-any-provider), [the model zoo](#the-model-zoo-73-cloud-workflows-43-model-families) |
17
+ | find and install the custom nodes and models a workflow needs, with typed names | [ComfyUI-Manager](#-custom-nodes-and-models-comfyui-manager) |
18
+ | keep client images off the server disk | [ephemeral outputs](#%EF%B8%8F-ephemeral-outputs-leave-no-traces) |
19
+ | move a graph between your code and the ComfyUI canvas, `api.json` and `workflow.json` | [JSON both ways](#-json-both-ways) |
21
20
 
22
21
  ## ⚡ 60 second start
23
22
 
@@ -47,7 +46,7 @@ const txt2img = host.defineWorkflow({
47
46
  seed: 42, steps: 20, cfg: 7,
48
47
  sampler_name: 'euler', scheduler: 'normal', denoise: 1,
49
48
  })
50
- // streams the image back over the websocket — nothing saved on the server
49
+ // streams the image back over the websocket: nothing saved on the server
51
50
  b.SaveImageWebsocket({ images: b.VAEDecode({ samples, vae: ckpt }) })
52
51
  },
53
52
  })
@@ -63,7 +62,7 @@ $ bun myFirstWorkflow.ts
63
62
  .comfy-ts/outputs/txt2img_20260731-142012.png
64
63
  ```
65
64
 
66
- Drop `save: true` and the outputs never touch a disk at all — `img.buffer` holds the bytes in memory ("Ephemeral outputs" below).
65
+ Drop `save: true` and the outputs never touch a disk at all: `img.buffer` holds the bytes in memory ([ephemeral outputs](#%EF%B8%8F-ephemeral-outputs-leave-no-traces)).
67
66
 
68
67
  One tsconfig line activates the generated types:
69
68
 
@@ -71,11 +70,11 @@ One tsconfig line activates the generated types:
71
70
  { "include": ["src", ".comfy-ts/hosts/**/sdk.d.ts"] }
72
71
  ```
73
72
 
74
- No codegen yet? Everything still compiles on permissive base types, and sharpens the moment the generated sdk lands. Runs under Bun and node ≥ 20, dual ESM/CJS.
73
+ No codegen yet? Everything still runs, and compiles on permissive base types (with `noUncheckedIndexedAccess` off), then sharpens the moment the generated sdk lands. Runs under Bun and node ≥ 20, dual ESM/CJS.
75
74
 
76
75
  ## 🧩 The SDK: workflows as code
77
76
 
78
- The best embedded DSL we know how to build, distilled from years of writing typed DSLs in TypeScript. Fast inference, clever tricks, zero ceremony. Wrong workflow? Compile error, before ComfyUI ever sees the graph. Writing workflows in code gets so comfortable you may catch yourself experimenting here rather than in the visual editor. The tricks this section showcases:
77
+ A wrong workflow is a compile error, before ComfyUI ever sees the graph. The builder keeps type inference fast and asks for no ceremony, so a graph in code is quick to write and quick to change. The tricks:
79
78
 
80
79
  - [Pass the node, skip the slot](#pass-the-node-skip-the-slot)
81
80
  - [Nested or flat, your call](#nested-or-flat-your-call)
@@ -84,7 +83,7 @@ The best embedded DSL we know how to build, distilled from years of writing type
84
83
  - [Content-addressed uploads](#content-addressed-uploads)
85
84
  - [Problems, not crashes](#problems-not-crashes)
86
85
 
87
- Wondering how any of this can exist? It all rests on [the codegen](#-the-codegen-nothing-else-comes-close) below.
86
+ All of it rests on [the codegen](#-the-codegen-an-sdk-for-your-own-install) below.
88
87
 
89
88
  ### Pass the node, skip the slot
90
89
 
@@ -100,7 +99,7 @@ b.VAEDecode({ samples, vae: ckpt }) // same ckpt node, VAE outpu
100
99
 
101
100
  ### Nested or flat, your call
102
101
 
103
- The same graph writes flat (a const per node) or nested (the code shaped like the graph). Mix freely; nested is often the practical form for small branches:
102
+ The same graph writes flat (a const per node) or nested (the code shaped like the graph). Mix them freely. Nested is often the practical form for small branches:
104
103
 
105
104
  ```ts
106
105
  // flat
@@ -142,7 +141,7 @@ import { auto } from 'comfy-ts'
142
141
  const samples = b.KSampler({ latent_image: auto() /* picks the latest LATENT producer */ })
143
142
  ```
144
143
 
145
- Handy in quick scripts; prefer explicit wiring in code meant to be read.
144
+ Handy in quick scripts. Prefer explicit wiring in code meant to be read.
146
145
 
147
146
  ### Content-addressed uploads
148
147
 
@@ -160,9 +159,9 @@ build: async (b, vars, wf) => {
160
159
 
161
160
  Invalid graphs accumulate precise messages in `workflow.problems` before ComfyUI ever sees them: missing required inputs, type mismatches, each named with the node and field.
162
161
 
163
- ## 🧬 The codegen: nothing else comes close
162
+ ## 🧬 The codegen: an SDK for your own install
164
163
 
165
- Not "a ComfyUI type package" someone published once. One command reads YOUR host and writes a full SDK for it:
164
+ This is not a ComfyUI type package that someone published once. One command reads YOUR host and writes a full SDK for it:
166
165
 
167
166
  ```bash
168
167
  bunx comfy-ts gen --id my-gpu --host http://127.0.0.1:8188
@@ -180,16 +179,17 @@ declare global {
180
179
  }
181
180
  ```
182
181
 
183
- - **Literal types from the actual install.** `ckpt_name` only accepts checkpoints that machine really has; samplers, schedulers, loras and embeddings are unions of the real values.
182
+ - **Literal types from the actual install.** `ckpt_name` only accepts checkpoints that machine really has. Samplers, schedulers, loras and embeddings are unions of the real values.
184
183
  - **Custom nodes are first-class.** Every installed pack lands in the builder: `b['rmbg.RMBG']` autocompletes like any core node.
184
+ - **New input kinds are typed.** A dynamic group input (ComfyUI 0.45, for example `LoadLoraModel.loras`) is a list of at least one row: `b.LoadLoraModel({ model, loras: [{ lora_name, strength }] })`.
185
185
  - **One namespace per host, many hosts per codebase.** A workflow written against `my-gpu` cannot silently reference a model that only exists on `my-laptop`.
186
- - **Never blocking.** Before the first codegen everything compiles on permissive base types, and sharpens the moment the generated sdk lands.
187
- - **Browsable.** The generated file is real TypeScript; `bunx comfy-ts outline` shows it section by section.
188
- - **See it for real: the Comfy Cloud catalog.** [`examples/comfy-cloud/sdk.d.ts`](examples/comfy-cloud/sdk.d.ts) is a full generated SDK for [Comfy Cloud](https://cloud.comfy.org) (5.9MB, 3574 nodes), committed so you can browse it and typecheck graphs against it without any host. [`examples/rvion/05-comfy-cloud.cflow.ts`](examples/rvion/05-comfy-cloud.cflow.ts) runs against it live: `url` + `apiKey` host config, one env var, images back in seconds.
186
+ - **Never blocking.** Before the first codegen everything runs, and compiles on permissive base types (with `noUncheckedIndexedAccess` off), then sharpens the moment the generated sdk lands.
187
+ - **Browsable.** The generated file is real TypeScript. `bunx comfy-ts outline` shows it section by section.
188
+ - **See it for real: the Comfy Cloud catalog.** [`examples/comfy-cloud/sdk.d.ts`](examples/comfy-cloud/sdk.d.ts) is a full generated SDK for [Comfy Cloud](https://cloud.comfy.org) (7.4 MB, 3893 node types), committed so you can browse it and typecheck graphs against it without any host. [`examples/rvion/05-comfy-cloud.cflow.ts`](examples/rvion/05-comfy-cloud.cflow.ts) runs against it live: `url` + `apiKey` host config, one env var, images back in seconds.
189
189
 
190
190
  ## 🎛️ App mode & vars: knobs on everything
191
191
 
192
- Vars turn a workflow module into a small APP: declare the tweakable parts once (`import { v } from 'comfy-ts'`) and `build` re-executes with current values on every `run()`. The TUI renders vars as its UI, scripts set them programmatically, drafts snapshot them. One module, many setups, re-runnable forever instead of a one-shot script.
192
+ Vars turn a workflow module into a small APP. Declare the tweakable parts once (`import { v } from 'comfy-ts'`), and `build` runs again with the current values on every `run()`. The TUI and the web panel render vars as their UI, scripts set them in code, drafts snapshot them. One module gives many setups, and you can run it again at any time, where a script runs once.
193
193
 
194
194
  ```ts
195
195
  export const txt2img = host.defineWorkflow({
@@ -208,17 +208,18 @@ txt2img.vars.seed.randomize()
208
208
  await txt2img.run({ log: true }) // fresh graph, fresh image
209
209
  ```
210
210
 
211
- | var kind | superpower |
211
+ | var kind | what it does |
212
212
  | ----------------------- | --------------------------------------------------------------------------------- |
213
213
  | `v.seed` | mode + number (`+ N` `- N` `= N` `? N`), advances itself: queued runs differ. `v.seed(42, { mode: '+' })` declares the mode |
214
214
  | `v.prompt` | structured text: `//` comments stripped, `- ` lines become the negative prompt |
215
215
  | `v.loras` | RegExp resolved against the host's REAL lora list, fully typed, multi-select |
216
- | `v.image` | local image path, TUI picker attached; `exampleImagePath('bear_1024x1024.jpg')` defaults to a bundled sample |
217
- | `v.audio` `v.video` | local audio or video path, same picker; `await myVar.loadInWorkflow(wf)` uploads it and returns the `LoadAudio` / `LoadVideo` node |
216
+ | `v.model` | `v.model('UNETLoader.unet_name', { default, filter })`: a choice over the host's own file list for that loader input, typed as that slot's union |
217
+ | `v.image` | local image path, TUI picker attached. `exampleImagePath('bear_1024x1024.jpg')` defaults to a bundled sample |
218
+ | `v.audio` `v.video` | local audio or video path, same picker. `await myVar.loadInWorkflow(wf)` uploads it and returns the `LoadAudio` / `LoadVideo` node |
218
219
  | `v.text` `v.int` `v.float` `v.toggle` `v.choice` `v.size` | the everyday knobs, ranges included |
219
220
  | `presets` on `v.text` / `v.prompt` | named starting texts (`{ 'terse tags': '…' }`): a presets button in the web panel, `P` in the TUI. Picking one replaces the field. `promptEnhancerPresets()` offers your `.comfy-ts/prompt-enhancers/*.md` library as presets too |
220
221
 
221
- `vars` can be a lambda receiving `v` so vars reference each other: `v.prompt('a cozy house', { loraKeywordsFrom: loras })` prefixes the active loras' trigger keywords. Name the file `*.cflow.ts` and the TUI finds it.
222
+ `vars` can be a lambda that receives `v`, so vars can reference each other: `v.prompt('a cozy house', { loraKeywordsFrom: loras })` prefixes the active loras' trigger keywords. `v.model` is available only in that lambda form. Name the file `*.cflow.ts` and the TUI finds it.
222
223
 
223
224
  ## 👀 Live previews: watch the image form
224
225
 
@@ -243,15 +244,15 @@ await host.fetchPreviewMethod() // 'auto' · 'none' = relaunch with --preview-me
243
244
 
244
245
  ## 🕶️ Ephemeral outputs: leave no traces
245
246
 
246
- Some images should not outlive the run — client work, private subjects, anything you would not leave in a shared server's `output/` folder. ComfyUI has three image savers, and they differ exactly there:
247
+ Some images must not outlive the run: client work, private subjects, anything you would not leave in a shared server's `output/` folder. ComfyUI has three image savers, and they differ exactly there:
247
248
 
248
249
  | saver | where the image lands server-side | how long it stays |
249
250
  | -------------------- | -------------------------------------------------- | ------------------------------ |
250
251
  | `SaveImage` | `output/` dir, workflow JSON embedded in the PNG | forever (no delete API) |
251
252
  | `PreviewImage` | `temp/` dir | until the server restarts |
252
- | `SaveImageWebsocket` | nowhere — streamed back as binary ws frames | never touches the server disk |
253
+ | `SaveImageWebsocket` | nowhere: streamed back as binary ws frames | never touches the server disk |
253
254
 
254
- comfy-ts treats `SaveImageWebsocket` as a first-class output: its frames land in `execution.images` like any other output, and **local saving is opt-in** — without `save`, the images exist only in memory (`img.buffer`, `img.getAsBlob()`, `img.getBase64Url()`; `img.absPath` is null):
255
+ comfy-ts treats `SaveImageWebsocket` as a first-class output: its frames land in `execution.images` like any other output, and **local saving is opt-in**. Without `save`, the images exist only in memory (`img.buffer`, `img.getAsBlob()`, `img.getBase64Url()`; `img.absPath` is null):
255
256
 
256
257
  ```ts
257
258
  // zero disk, end to end: nothing on the server, nothing locally
@@ -262,7 +263,7 @@ const bytes = execution.images[0]?.buffer
262
263
  await txt2img.run({ log: true, save: { prefix: 'my-project' } })
263
264
  ```
264
265
 
265
- Every combination is a valid choice — you pick where the image lives. `execution.images` works in all four (the bytes always stream to memory):
266
+ Every combination is a valid choice: you pick where the image lives. `execution.images` works in all four (the bytes always stream to memory):
266
267
 
267
268
  | graph saver | `save` option | server disk | local disk |
268
269
  | -------------------- | ------------- | ----------- | ---------- |
@@ -271,9 +272,9 @@ Every combination is a valid choice — you pick where the image lives. `executi
271
272
  | `SaveImageWebsocket` | none | no | no |
272
273
  | `SaveImageWebsocket` | `save: …` | no | yes |
273
274
 
274
- Running comfy-ts on the same machine as ComfyUI? Then row one is the best of both worlds: `SaveImage` with no `save:` writes the file exactly once, by the server, and it is already local — read it straight from ComfyUI's own `output/` folder.
275
+ Running comfy-ts on the same machine as ComfyUI? Then row one is the best of both worlds: `SaveImage` with no `save:` writes the file exactly once, by the server, and it is already local. Read it straight from ComfyUI's own `output/` folder.
275
276
 
276
- Running an imported workflow or template that uses `SaveImage`? `ephemeral: true` rewrites its save nodes to `SaveImageWebsocket` in the sent prompt (the graph you authored stays untouched) and deletes the run's server history entry afterwards — the history holds your full workflow, prompts included:
277
+ Running an imported workflow or template that uses `SaveImage`? `ephemeral: true` rewrites its save nodes to `SaveImageWebsocket` in the sent prompt (the graph you authored stays untouched) and deletes the run's server history entry afterwards, because the history holds your full workflow, prompts included:
277
278
 
278
279
  ```ts
279
280
  await workflow.run({ ephemeral: true }) // implies scrubHistory: true
@@ -282,9 +283,9 @@ await host.clearHistory() // or wipe the server's whole history
282
283
 
283
284
  Honest limits, so you can decide what to trust:
284
285
 
285
- - **uploaded inputs persist**: `/upload/image` files stay in the server's `input/` dir (ComfyUI has no delete API). If the host has a base64 loader node installed (`ETN_LoadImageBase64` from comfyui-tooling-nodes, or ComfyUI-Easy-Use's `easy loadImageBase64`), `mediaImage.loadInWorkflow_viaBase64Node(wf)` inlines the image into the prompt instead — no server file, and `scrubHistory` erases the prompt after. Comfy Cloud ships neither, so cloud inputs currently must ride uploads.
286
- - **video/audio have no websocket saver** upstream: `SaveVideo` / `SaveAudio*` outputs persist on the host.
287
- - **out of our reach**: server logs, RAM, crash dumps, reverse proxies, and a cloud provider's own retention policy. Ephemeral mode controls what the ComfyUI API persists — nothing more, and we won't pretend otherwise.
286
+ - **uploaded inputs persist**: `/upload/image` files stay in the server's `input/` dir (ComfyUI has no delete API). If the host has a base64 loader node installed (`ETN_LoadImageBase64` from comfyui-tooling-nodes, or ComfyUI-Easy-Use's `easy loadImageBase64`), `mediaImage.loadInWorkflow_viaBase64Node(wf)` puts the image inside the prompt instead: no server file, and `scrubHistory` erases the prompt after. Comfy Cloud ships neither, so cloud inputs currently must ride uploads.
287
+ - **video and audio have no websocket saver** upstream: `SaveVideo` / `SaveAudio*` outputs persist on the host.
288
+ - **out of our reach**: server logs, RAM, crash dumps, reverse proxies, and a cloud provider's own retention policy. Ephemeral mode controls what the ComfyUI API persists, nothing more, and we will not pretend otherwise.
288
289
 
289
290
  Every image example in `examples/` uses `SaveImageWebsocket`.
290
291
 
@@ -296,7 +297,7 @@ Every image example in `examples/` uses `SaveImageWebsocket`.
296
297
  bunx comfy-ts tui
297
298
  ```
298
299
 
299
- No argument needed: it finds every `*.cflow.ts` under your project AND the examples bundled with the package, so the first launch is never empty. Pass a folder or a module to scan just that. Keyboard-first, a persistent keybar showing every available key.
300
+ No argument needed: it finds every `*.cflow.ts` under your project AND the examples bundled with the package, so the first launch is never empty. Pass a folder or a module to scan just that. Keyboard-first, with a persistent keybar that shows every available key.
300
301
 
301
302
  | panel | what it does |
302
303
  | ------------ | -------------------------------------------------------------------------------- |
@@ -313,16 +314,18 @@ No argument needed: it finds every `*.cflow.ts` under your project AND the examp
313
314
  bunx comfy-ts gen --id my-gpu --host http://127.0.0.1:8188
314
315
  # → .comfy-ts/hosts/my-gpu/{object_info.json, embeddings.json, sdk.d.ts}
315
316
 
316
- bunx comfy-ts outline # what's inside that 2MB sdk.d.ts?
317
+ bunx comfy-ts outline # what is inside that 2MB sdk.d.ts?
317
318
  bunx comfy-ts loras # mirror your loras' names + trigger words (below)
318
319
  bunx comfy-ts tui # your *.cflow.ts + bundled examples
319
320
  bunx comfy-ts tui [dir | module] # scan just that
320
321
  bunx comfy-ts serve [dir | module] # drafts as a local HTTP API (below)
321
- bunx comfy-ts run anima-t2i --prompt "a knight in the rain" --out knight.png
322
+ bunx comfy-ts run 10-anima-t2i --prompt "a knight in the rain" --out knight.png
322
323
  # one generation, headless: every var a flag
323
324
  ```
324
325
 
325
- Any reachable host: the box under your desk or a GPU machine across the network, same command, same output.
326
+ Any reachable host works the same: the box under your desk or a GPU machine across the network, same command, same output.
327
+
328
+ `comfy-ts run` finds the module in your folder, then in the bundled examples, by its key or a unique part of it (`rvion/anima` narrows by folder). `--<var>-file` reads a text var from a file, `--draft <name>` starts from a saved draft, `--json` prints one line with every output path, and `comfy-ts run <name> --help` lists the vars.
326
329
 
327
330
  ### Loras with names, not file names
328
331
 
@@ -334,11 +337,11 @@ bunx comfy-ts loras --id my-gpu --host http://127.0.0.1:8188
334
337
  bunx comfy-ts loras # refresh later: id and url are remembered
335
338
  ```
336
339
 
337
- After that, in the TUI's loras overlay you can type `aurora ink` to find `styles\aurora-ink-v3.safetensors`, and a lora's civitai trigger words are prefixed onto your `v.prompt` automatically when it is active (⌃K still overrides any lora's keyword by hand). No extension, or no sync yet? Everything behaves as before — file names and hand-typed keywords.
340
+ After that, in the TUI's loras overlay you can type `aurora ink` to find `styles\aurora-ink-v3.safetensors`, and a lora's civitai trigger words are prefixed onto your `v.prompt` automatically when it is active (⌃K still overrides any lora's keyword by hand). No extension, or no sync yet? Everything behaves as before: file names and hand-typed keywords.
338
341
 
339
- ## 🌐 Serve: drafts as an HTTP API
342
+ ## 🔗 Serve: drafts as an HTTP API
340
343
 
341
- Hand-tune a draft in the TUI, then make it callable by anything that speaks HTTP — a web frontend, curl, n8n, another service:
344
+ Tune a draft in the TUI, then make it callable by anything that speaks HTTP: a web frontend, curl, n8n, another service:
342
345
 
343
346
  ```bash
344
347
  bunx comfy-ts serve # every *.cflow.ts under cwd, port 8288
@@ -347,9 +350,9 @@ bunx comfy-ts serve txt2img.cflow.ts # one workflow (routes shorten to /gener
347
350
  bunx comfy-ts serve --port 9000 --host 0.0.0.0 # pick port / reach it from your phone or tailnet
348
351
  ```
349
352
 
350
- Bound beyond localhost, the startup print lists every URL the box answers on (LAN and tailnet), so the web UI is one tap away on another device. There is no auth: only do this on a network you trust. A browser page on any origin may call it, which is what lets `comfy-ts/web` use serve as its bridge; with no auth, that also means a page you visit can reach the API on your own machine. The launch screen says so every time.
353
+ Bound beyond localhost, the startup print lists every URL the box answers on (LAN and tailnet), so the web UI is one tap away on another device. There is no auth: do this only on a network you trust. A browser page on any origin can call it, which is what lets `comfy-ts/web` use serve as its bridge. With no auth, that also means a page you visit can reach the API on your own machine. The launch screen says so every time.
351
354
 
352
- Discover what's being served — same info the startup print shows, as JSON:
355
+ Discover what is served, the same info the startup print shows, as JSON:
353
356
 
354
357
  ```bash
355
358
  curl http://127.0.0.1:8288/drafts # all workflows, their drafts, every var described
@@ -368,24 +371,24 @@ curl -X POST http://127.0.0.1:8288/generate/txt2img/moody \
368
371
  -H 'accept: image/*' -d '{"seed": 42}' -o out.png # raw image bytes
369
372
  ```
370
373
 
371
- Draft values are the defaults, the JSON body overrides per request, and every value is validated before anything is queued (wrong choice? the 400 lists the allowed ones). `GET /drafts` self-describes every workflow, draft and var — enough for a frontend to render a form. `Accept: image/*` returns the image bytes directly (`curl … -H 'accept: image/*' -o out.png`). Drafts are re-read on every request: keep the TUI open, tweak, next call uses the new values. Binds to localhost only unless you say otherwise (`--host`, `--port`).
374
+ Draft values are the defaults, the JSON body overrides them per request, and every value is validated before anything is queued (wrong choice? the 400 lists the allowed ones). `GET /drafts` describes every workflow, draft and var, enough for a frontend to render a form. `Accept: image/*` returns the image bytes directly. Drafts are read again on every request: keep the TUI open, tweak, and the next call uses the new values. Serve binds to localhost only unless you say otherwise (`--host`, `--port`).
372
375
 
373
376
  ## 🌐 The web panel
374
377
 
375
- Open that same url in a **browser** and you get a full control panel — no frontend to write, nothing to build, no extra dependency:
378
+ Open that same url in a **browser** and you get a full control panel: no frontend to write, nothing to build, no extra dependency.
376
379
 
377
- - every var as its real control: prompt textarea (`//` comments, `- ` negative lines), sliders, seed mode buttons (`=` `+` `?`) with 🎲, size presets, image upload with preview, and a lora palette — a switch on each card pauses or resumes that lora in place, and clicking the card opens what it is, with per-lora model/clip strengths, and browse the rest as a gallery of preview cards carrying human model names and trigger words from the [lora mirror](#loras)
378
- - edits **autosave into the selected draft**, exactly like the TUI (the two stay in sync live); duplicate or delete a draft from the header
379
- - every click on generate **queues** another prompt; the queue lists them and drops any pending one
380
- - live progress bar and latent preview while it runs, results in a gallery — click any image for the lightbox (copy to clipboard / open / delete)
381
- - **works on a phone**: collapsible menu, everything touch-sized. `--host 0.0.0.0` and the startup print hands you the LAN and tailnet urls
382
- - ✨ **prompt refiner** on every prompt var: rewrite the prompt with a thinking model, streaming both the answer and the model's reasoning, then apply it — or not, nothing touches your prompt until you say so. Cloud through **OpenRouter**, or a local model through **Open WebUI** (a local model's `<think>` block is routed to the reasoning pane, never into your prompt). Your key stays in the browser and never reaches the serve process. The master prompts are markdown files in `.comfy-ts/prompt-enhancers/`, one per image model, editable from the panel or from your editor
380
+ - every var as its real control: prompt textarea (`//` comments, `- ` negative lines), sliders, seed mode buttons (`=` `+` `?`) with 🎲, size presets, image upload with preview, and a lora palette. A switch on each lora card pauses or resumes that lora in place, a click on the card opens what it is with per-lora model and clip strengths, and the rest of your loras show as a gallery of preview cards with human model names and trigger words from the [lora mirror](#loras-with-names-not-file-names)
381
+ - edits **autosave into the selected draft**, exactly like the TUI (the two stay in sync live). Duplicate or delete a draft from the header
382
+ - every click on generate **queues** another prompt. The queue lists them and drops any pending one
383
+ - live progress bar and latent preview while it runs, results in a gallery. Click any image for the lightbox (copy to clipboard, open, delete)
384
+ - **works on a phone**: collapsible menu, everything touch-sized. With `--host 0.0.0.0`, the startup print gives you the LAN and tailnet urls
385
+ - ✨ **prompt refiner** on every prompt var: rewrite the prompt with a thinking model, with the answer and the model's reasoning streamed, then apply it or not. Nothing touches your prompt until you say so. Cloud through **OpenRouter**, or a local model through **Open WebUI** (a local model's `<think>` block goes to the reasoning pane, never into your prompt). Your key stays in the browser and never reaches the serve process. The master prompts are markdown files in `.comfy-ts/prompt-enhancers/`, one per image model, editable from the panel or from your editor
383
386
 
384
- The JSON api above is unchanged — the panel is just another client of it.
387
+ The JSON api above is unchanged: the panel is one more client of it.
385
388
 
386
389
  ## 🕸️ In the browser: `comfy-ts/web`
387
390
 
388
- The same library runs in a browser bundle — define workflows, connect to a host, run, get bytes back, no server in between:
391
+ The same library runs in a browser bundle: define workflows, connect to a host, run, get bytes back, no server in between:
389
392
 
390
393
  ```ts
391
394
  import { ComfyTS } from 'comfy-ts/web'
@@ -397,13 +400,13 @@ const wf = host.workflow()
397
400
  // …build with wf.builder, run, then execution.images[0].getAsBlob()
398
401
  ```
399
402
 
400
- Nothing touches disk: schema caches and outputs live in an in-memory store (pass `ComfyTS.create({ storage })` for your own backend). Types work the same as everywhere else — include a generated `sdk.d.ts` in your tsconfig and every node autocompletes.
403
+ Nothing touches disk: schema caches and outputs live in an in-memory store (pass `ComfyTS.create({ storage })` for your own backend). Types work the same as everywhere else: include a generated `sdk.d.ts` in your tsconfig and every node autocompletes.
401
404
 
402
- The honest support matrix: **local/LAN hosts connect directly** when ComfyUI is started with `--enable-cors-header '*'` (browser websocket auth rides `?token=<api-key>` since browsers cannot set upgrade headers). **Comfy Cloud sends no CORS headers today**, so cloud from a browser goes through `comfy-ts serve` as the bridge. Runnable page: `bun examples/web/serve.ts`.
405
+ The honest support matrix: **local and LAN hosts connect directly** when ComfyUI is started with `--enable-cors-header '*'` (browser websocket auth rides `?token=<api-key>`, because browsers cannot set upgrade headers). **Comfy Cloud sends no CORS headers today**, so cloud from a browser goes through `comfy-ts serve` as the bridge. Runnable page: `bun examples/web/serve.ts`.
403
406
 
404
407
  ## 🌍 Hosts: local, LAN, Comfy Cloud, any provider
405
408
 
406
- Every Comfy is supported, through one identical API. Same mechanism, same codegen, same typed SDK, same TUI, whatever answers the protocol:
409
+ Every Comfy works through one identical API: same mechanism, same codegen, same typed SDK, same TUI, whatever answers the protocol:
407
410
 
408
411
  ```ts
409
412
  // the box you are on
@@ -420,48 +423,83 @@ comfy.host({ id: 'runpod', url: 'https://xxxx-8188.proxy.runpod.net' })
420
423
  comfy.host({ id: 'modal', url: 'https://you--comfy.modal.run', headers: { 'Modal-Key': '…', 'Modal-Secret': '…' } })
421
424
  ```
422
425
 
423
- [Comfy Cloud](https://cloud.comfy.org) is first-class: the key rides `X-API-Key` on every request and the websocket, outputs download through the signed-url redirect, live latent previews stream into the TUI, and the whole cloud catalog ships as a committed, browsable SDK ([`examples/comfy-cloud/sdk.d.ts`](examples/comfy-cloud/sdk.d.ts)) with a whole [model zoo of 46 ready workflows](#the-model-zoo-46-cloud-workflows-32-model-families) built against it.
426
+ [Comfy Cloud](https://cloud.comfy.org) is first-class: the key rides `X-API-Key` on every request and on the websocket, outputs download through the signed-url redirect, live latent previews stream into the TUI, and the whole cloud catalog ships as a committed, browsable SDK ([`examples/comfy-cloud/sdk.d.ts`](examples/comfy-cloud/sdk.d.ts)) with a [model zoo of 73 ready workflows](#the-model-zoo-73-cloud-workflows-43-model-families) built against it. Cloud runs bill your own Comfy Cloud account.
424
427
 
425
- Reaching a Comfy running on another one of your machines:
428
+ Reaching a Comfy that runs on another one of your machines:
426
429
 
427
- - **ssh tunnel**: `ssh -N -L 8188:127.0.0.1:8188 you@gpu-box`, then `host: '127.0.0.1', port: 8188` as if it were local (`ssh -R` does the reverse: expose YOUR Comfy to the remote box).
428
- - **tailscale**: `tailscale serve 8188` on the box gives a stable https url for `url:`; plain tailnet hostnames work with `host:` too.
429
- - **cloudflared**: `cloudflared tunnel --url http://127.0.0.1:8188` prints a temporary public https url, paste it into `url:`.
430
+ - **ssh tunnel**: `ssh -N -L 8188:127.0.0.1:8188 you@gpu-box`, then `host: '127.0.0.1', port: 8188` as if it were local (`ssh -R` does the reverse: it exposes YOUR Comfy to the remote box).
431
+ - **tailscale**: `tailscale serve 8188` on the box gives a stable https url for `url:`. Plain tailnet hostnames work with `host:` too.
432
+ - **cloudflared**: `cloudflared tunnel --url http://127.0.0.1:8188` prints a temporary public https url. Paste it into `url:`.
430
433
 
431
- ## 🔌 Ecosystem discovery and install
434
+ ## 🔌 Custom nodes and models: ComfyUI-Manager
432
435
 
433
- The whole ComfyUI-Manager registry, mirrored into generated types: every known custom node pack, plugin title and model is a typed union. The generated files are committed, browsable TypeScript:
436
+ The whole ComfyUI-Manager registry is mirrored into generated types: every known custom node pack, plugin title and model is a typed union. The generated files are committed, browsable TypeScript:
434
437
 
435
438
  - [`KnownComfyCustomNodeName`](src/manager/generated/KnownComfyCustomNodeName.ts): every node name of every known pack
436
439
  - [`KnownComfyPluginTitle`](src/manager/generated/KnownComfyPluginTitle.ts) / [`KnownComfyPluginURL`](src/manager/generated/KnownComfyPluginURL.ts): the whole custom-node ecosystem as literal types
437
440
  - [`KnownModel_Name`](src/manager/generated/KnownModel_Name.ts) and its [`Base` / `Type` / `FileName` / `SavePath`](src/manager/generated/) siblings: every model the registry knows, down to where it installs
438
441
 
442
+ A script (or an agent) can read what a workflow needs, see what the host is missing, and install it by name, with the compiler checking the spelling:
443
+
439
444
  ```ts
440
- await host.installCustomNodeByTitle('ComfyUI Impact Pack') // autocompletes across the ecosystem
441
- await host.manager.installModel(modelInfo)
445
+ import type { Requirements } from 'comfy-ts'
446
+
447
+ const needs: Requirements[] = [
448
+ { type: 'customNodesByTitle', title: 'ComfyUI Impact Pack' }, // autocompletes across the ecosystem
449
+ { type: 'modelInManager', modelName: 'TAEF1 Decoder' },
450
+ ]
451
+ await host.manager.fetchPluginsAndModels() // what the host has installed
452
+ const { missing, undecided } = host.checkRequirements(needs)
453
+
454
+ await host.installCustomNodeByTitle('ComfyUI Impact Pack') // true only for a verified install
455
+ const model = host.manager.registry.knownModels.get('TAEF1 Decoder')
456
+ if (model) await host.manager.installModelOutcome(model) // 'installed' | 'failed' | 'unknown'
442
457
  ```
443
458
 
444
- A script (or an agent) can look at a workflow, see what is missing, and install it by name with the compiler checking the spelling. Install endpoints currently target the Manager v2 API; v3 moved them behind a queue API and support is being ground down (see the feature table).
459
+ - **Every Manager generation.** Installs go through the Manager's install queue on the legacy custom node Manager (V3.x) and on the pip Manager 4.x, with its default UI or its legacy UI. `await host.manager.api()` says which one the host runs: `{ generation: 'v3' | 'v4-legacy-ui' | 'v4', version }`.
460
+ - **An install returns when it is done.** It resolves after the Manager ran the install and the result is checked, so a large model can take minutes. `timing.installTimeoutMs` (default 1 hour) bounds the wait. A failed status request does not end it: the wait goes on until the host has not answered for `timing.pollGraceMs` (default 2 minutes).
461
+ - **Three outcomes.** `installModel` and `installPlugin` return `true` only for a verified install. `installModelOutcome` and `installPluginOutcome` also say `unknown` when the client lost sight of the task while the Manager can still be installing: fetch the lists again and read the status before you install again.
462
+ - **Missing or undecided.** `checkRequirements` returns `{ missing, undecided }`: queue installs for `missing` only. A pack or a model the host cannot decide has the status `unknown` in `getPluginStatus` and `getModelStatus`, and `isPluginInstalled` / `isModelInstalled` are `true` only for a known install. `host.matchRequirements` is `false` only when a requirement is known to be missing.
463
+ - **The Manager 4.x default UI serves no lists.** There the plugin and model view is built from what the host has installed and the bundled registry, and `update-available` is never reported.
464
+ - **A refusal says why.** A refused install logs the route and what the host said. A refusal by the Manager 4.x security policy names the settings it wants.
445
465
 
446
466
  ## 🤖 For AI agents
447
467
 
448
- comfy-ts is built to be driven by agents as much as by people. After installing, one line in your `CLAUDE.md` teaches your agent the whole library:
468
+ comfy-ts is built to be driven by agents as much as by people. After you install it, one line in your `CLAUDE.md` teaches your agent the whole library:
449
469
 
450
470
  ```
451
471
  @./node_modules/comfy-ts/guide-for-agents.md
452
472
  ```
453
473
 
474
+ An agent then generates with one command and reads the output paths from one line of JSON: `bunx comfy-ts run <module> --<var> <value> --out <path> --json` ([the CLI](#%EF%B8%8F-the-cli)).
475
+
476
+ For Claude Code, comfy-ts also ships slash commands: set up a host, write a workflow, convert a ComfyUI JSON, run a generation. Install them into your project from the package:
477
+
478
+ ```bash
479
+ bunx comfy-ts skill install # /comfy-ts-setup, /comfy-ts-workflow, /comfy-ts-convert, /comfy-ts-run, /comfy-ts-guide
480
+ ```
481
+
482
+ Or, with no npm install, as a Claude Code plugin (in a Claude Code session):
483
+
484
+ ```
485
+ /plugin marketplace add rvion/comfy-ts
486
+ /plugin install comfy-ts@comfy-ts
487
+ ```
488
+
489
+ Both carry the same skills, which read the guide above from the installed package. A rerun of `skill install` after an upgrade updates them and never overwrites a skill file you edited (`--force` does).
490
+
454
491
  ## 🔁 JSON, both ways
455
492
 
456
493
  - `workflow.toApiJson()`: the executable prompt format.
457
- - `await workflow.toWorkflowJson()`: an AUTOLAYOUTED litegraph file. Drop it on the ComfyUI canvas and see the graph you wrote in code, readably laid out.
458
- - `host.importApiJson` / `host.importWorkflowJson`: both directions, covered by round-trip tests. Newer editor features (subgraphs) are the current compat frontier: we sweep every official Comfy-Org template against our schemas to grind that gap down.
494
+ - `await workflow.toWorkflowJson()`: an AUTOLAYOUTED litegraph file. Drop it on the ComfyUI canvas and see the graph you wrote in code, readably laid out. Dynamic combos, dynamic group inputs, autogrow inputs and widgets fed by a link export the way the editor saves them.
495
+ - `host.importApiJson` / `host.importWorkflowJson`: both directions, covered by round-trip tests. Subgraphs are expanded into plain nodes on import, so a re-export is flat. A subgraph that contains itself fails with a `subgraph-cycle` error, and nested subgraphs that expand past 100,000 nodes fail with `subgraph-too-large`.
496
+ - Newer editor features are the compat frontier: every official Comfy-Org template and blueprint (about 1,000 files) is swept against our schemas to find the gaps.
459
497
 
460
498
  ## 📚 Examples
461
499
 
462
- Every example is a runnable `*.cflow.ts` module: run it with bun, or just `bunx comfy-ts tui` — the TUI finds them all.
500
+ Every example is a runnable `*.cflow.ts` module: run it with bun, with `bunx comfy-ts run <name>`, or browse them all with `bunx comfy-ts tui`.
463
501
 
464
- Start with the didactic sequence in [`examples/rvion/`](examples/rvion/):
502
+ Start with the didactic sequence in [`examples/rvion/`](examples/rvion/). These run against a local host: edit its `comfy.host({...})` line to point at yours, and the models each one names must be on that host.
465
503
 
466
504
  | example | shows |
467
505
  | ---------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
@@ -471,28 +509,34 @@ Start with the didactic sequence in [`examples/rvion/`](examples/rvion/):
471
509
  | [`04-krea2-turbo-t2i`](examples/rvion/04-krea2-turbo-t2i.cflow.ts) | a real pipeline: krea2 turbo, lora stack, RMBG cutout → transparent png |
472
510
  | [`05-comfy-cloud`](examples/rvion/05-comfy-cloud.cflow.ts) | the same code on Comfy Cloud: `url` + `apiKey` host, typechecked against the committed catalog SDK |
473
511
  | [`06-qwen-image-edit`](examples/rvion/06-qwen-image-edit.cflow.ts) | Qwen Image Edit 2511, lightning 4-step lora toggle |
474
- | [`07-local-llm-text-gen`](examples/rvion/07-local-llm-text-gen.cflow.ts) | a local LLM through core `TextGenerate`, text back in `execution.text`; `--sweep` probes every text encoder on the host |
512
+ | [`07-local-llm-text-gen`](examples/rvion/07-local-llm-text-gen.cflow.ts) | a local LLM through core `TextGenerate`, text back in `execution.text`. `--sweep` probes every text encoder on the host |
475
513
  | [`08-qwen-image-21-t2i`](examples/rvion/08-qwen-image-21-t2i.cflow.ts) | Qwen Image 2.1 text to image: int8 model, Qwen3-VL 8b encoder |
476
514
  | [`09-qwen-image-21-edit`](examples/rvion/09-qwen-image-21-edit.cflow.ts) | Qwen Image 2.1 edit: the reference image feeds an autogrow slot, output keeps its size; a remove-background preset |
477
515
  | [`10-anima-t2i`](examples/rvion/10-anima-t2i.cflow.ts) | Anima text to image: turbo, aesthetic, base or base + turbo lora as one click, anima lora stack, optional RMBG cutout |
516
+ | [`11-yue2-t2a`](examples/rvion/11-yue2-t2a.cflow.ts) | YuE2 text to music: the first prompt line is the style, the rest the lyrics; ABC planning shows as a text result |
517
+ | [`12-stable-audio-3-t2a`](examples/rvion/12-stable-audio-3-t2a.cflow.ts) | Stable Audio 3 Medium: music, instruments, sound effects or one-shots from one description, an optional local LLM rewrite |
518
+ | [`13-ace-step-15-xl-t2a`](examples/rvion/13-ace-step-15-xl-t2a.cflow.ts) | ACE-Step 1.5 XL: a song with vocals from a caption and lyrics, turbo, sft or base model |
519
+ | [`14-video-soundtrack`](examples/rvion/14-video-soundtrack.cflow.ts) | a new soundtrack on a video: the frames of one file, the audio of another, core nodes only |
520
+ | [`15-tts-voice-clone`](examples/rvion/15-tts-voice-clone.cflow.ts) | text to speech in a cloned voice (TTS-Audio-Suite pack): five engines, a language, `execution.audios` |
521
+ | [`16-tts-voice-design`](examples/rvion/16-tts-voice-design.cflow.ts) | a new voice from a written description: the clip and its line are what example 15 takes |
478
522
 
479
- ### The model zoo: 49 cloud workflows, 34 model families
523
+ ### The model zoo: 73 cloud workflows, 43 model families
480
524
 
481
- [`examples/comfy-cloud/`](examples/comfy-cloud/) holds one runnable example per family × mode (`<family>-<mode>.cflow.ts`), each transcribed from the official ComfyUI template of that model, typechecked against the committed cloud catalog, and runnable on [Comfy Cloud](https://cloud.comfy.org) with one env var (`COMFY_CLOUD_API_KEY`). Image, video and audio:
525
+ [`examples/comfy-cloud/`](examples/comfy-cloud/) holds one runnable example per family × mode (`<family>-<mode>.cflow.ts`), each transcribed from the official ComfyUI template of that model, typechecked against the committed cloud catalog, and runnable on [Comfy Cloud](https://cloud.comfy.org) with one env var (`COMFY_CLOUD_API_KEY`). Image, video and audio. `(+ name)` marks a variant file of the same family (`flux2-t2i-dev.cflow.ts`):
482
526
 
483
527
  | mode | families |
484
528
  | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
485
- | **t2i** text→image | sd15 (= example 05), sdxl, sd35, flux1, flux2, qwen-image, z-image, chroma, hidream, omnigen2, kandinsky5, capybara, krea2, lens, ernie, longcat, ovis, pixeldit, anima, newbie, ideogram4 |
486
- | **i2i** image edit | flux1, flux2, qwen-image, hidream, omnigen2, capybara, longcat, boogu, firered |
487
- | **t2v** text→video | wan21, wan22, wan22-5b, ltxv, ltx25 (with sound), hunyuan-video, kandinsky5 |
488
- | **i2v** image→video | wan21, wan22, ltxv, ltx25 (with sound), hunyuan-video, kandinsky5, capybara, svd |
489
- | **t2a** text→audio | ace-step (song), minimax-music3 (song), stable-audio (sfx/music), chatterbox (tts) |
529
+ | **t2i** text→image | sd15 (= example 05), sdxl, sd35, flux1 (+ krea), flux2 (+ dev), qwen-image (+ 2512), z-image (+ base), chroma, hidream, hidream-o1, omnigen2, kandinsky5, capybara, krea2, lens, ernie (+ base), longcat, ovis, pixeldit, anima (+ base), newbie, ideogram4, boogu, mage-flow (+ turbo), minimax-h3, netayume |
530
+ | **i2i** image edit | flux1, flux2 (+ dev), qwen-image (+ 2509), hidream, hidream-o1, omnigen2, capybara, longcat, boogu, firered, chronoedit, krea2 (style reference), mage-flow (+ turbo) |
531
+ | **t2v** text→video | wan21, wan22, wan22-5b, ltxv, ltx2, ltx23, ltx25 (with sound), hunyuan-video, kandinsky5 |
532
+ | **i2v** image→video | wan21, wan22, ltxv, ltx2, ltx23, ltx25 (with sound), hunyuan-video, kandinsky5, capybara, svd |
533
+ | **t2a** text→audio | ace-step (song), ace-step15 (song), minimax-music3 (song), stable-audio (sfx/music), stable-audio3 (sfx/music), chatterbox (tts) |
490
534
 
491
- Every zoo file imports offline and headless (no key, no cache needed — CI proves it), builds a validated graph, and doubles as a TUI app with typed knobs: prompt, seed, steps, size, input image, …
535
+ Every zoo file imports offline and headless (no key, no cache needed: CI proves it), builds a validated graph, and doubles as a TUI app with typed knobs: prompt, seed, steps, size, input image, …
492
536
 
493
537
  ## 🗂️ The `.comfy-ts/` folder
494
538
 
495
- One folder of local state per consumer repo: `hosts/` (schema dumps + the generated sdk per host), `outputs/`, `drafts/`, TUI settings, lora keywords. Gitignore all of it. `hosts/` is a full dump of that machine's models and paths (~10MB), so committing it publishes your setup; in a PRIVATE repo, committing it is what buys you typed CI.
539
+ One folder of local state per consumer repo: `hosts/` (schema dumps + the generated sdk per host), `outputs/`, `drafts/`, TUI settings, lora keywords. Gitignore all of it. `hosts/` is a full dump of that machine's models and paths (~10MB), so a commit of it publishes your setup. In a PRIVATE repo, a commit of it is what buys you typed CI.
496
540
 
497
541
  ## ✅ Feature status
498
542
 
@@ -510,25 +554,26 @@ One folder of local state per consumer repo: `hosts/` (schema dumps + the genera
510
554
  | export api.json + autolayouted workflow.json | ✅ |
511
555
  | import api.json into a live workflow | ✅ |
512
556
  | import workflow.json (litegraph → api conversion) | ✅ |
513
- | sidekick CLI (`gen`, `outline`, `tui`, `serve`) | ✅ |
557
+ | sidekick CLI (`gen`, `outline`, `loras`, `tui`, `serve`) | ✅ |
558
+ | `comfy-ts run`: one headless generation, every var a flag | 🔶 |
514
559
  | serve web panel: every var as a control, queue, gallery, phone | ✅ |
515
560
  | prompt refiner in the panel (OpenRouter or local Open WebUI) | ✅ |
516
561
  | cloud hosts: `url` + `X-API-Key` auth, Comfy Cloud ran live | ✅ |
517
562
  | ComfyUI-Manager registry mirror + Known\* ecosystem unions | ✅ |
518
- | install custom nodes / models via ComfyUI-Manager (v2 API) | 🔶 |
563
+ | install custom nodes / models through the ComfyUI-Manager queue (V3.x, 4.x) | 🔶 |
519
564
  | content-addressed local asset cache | 🔶 |
520
565
 
521
566
  ✅ working and exercised · 🔶 partial / in progress
522
567
 
523
- ## 🧱 A lib you can trust, made to last
568
+ ## 🧱 A library you can trust, made to last
524
569
 
525
- The glitter above sits on boring foundations:
570
+ The features above sit on boring foundations:
526
571
 
527
572
  - **Strict TypeScript everywhere.** `strict` + `noUncheckedIndexedAccess`, no `any`, every remaining cast individually justified in a reviewed whitelist.
528
573
  - **A hard CI gate on every commit.** Typecheck, zero-warning lint (a warning is fixed or the rule is disabled on purpose, never ignored), format check, import hygiene, the full headless test suite.
529
574
  - **Runtime validation with arktype.** Wire messages and JSON formats are schema-validated. When ComfyUI drifts faster than the schemas, failures are logged loud, never swallowed.
530
575
  - **Codegen you can regenerate, never hand-edit.** The SDK, the manager unions and the snapshot tests around them all rebuild from source data with one command each.
531
- - **A compat grind loop, not compat hope.** The full official template corpus (~780 workflows from Comfy-Org) is mirrored locally and swept against our schemas on demand, so upstream format changes surface as a failing report line, not as your broken pipeline.
576
+ - **A compat grind loop, not compat hope.** The full official corpus from Comfy-Org (about 1,000 templates and blueprints) is mirrored locally and swept against our schemas on demand, so an upstream format change surfaces as a failing report line, not as your broken pipeline.
532
577
  - **Boring packaging.** Dual ESM/CJS, Bun and node ≥ 20, `src/` shipped in the tarball for go-to-definition.
533
578
 
534
579
  ## Related projects
@@ -539,8 +584,8 @@ The glitter above sits on boring foundations:
539
584
 
540
585
  ## Support
541
586
 
542
- comfy-ts is free, MIT, and maintained for the long run. If it saves you time or powers something you sell, consider [sponsoring](https://github.com/sponsors/rvion), it keeps the grind loops grinding.
587
+ comfy-ts is free, MIT, and maintained for the long run. If it saves you time or powers something you sell, consider [sponsoring](https://github.com/sponsors/rvion): it keeps the grind loops grinding.
543
588
 
544
589
  ## License
545
590
 
546
- MIT © [Rémi Vion](https://github.com/rvion)
591
+ MIT © [rvion](https://github.com/rvion)
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "comfy-ts",
3
+ "description": "Claude Code skills for comfy-ts, the typed TypeScript SDK for ComfyUI: set up a host, write a workflow, convert a ComfyUI JSON, run a generation",
4
+ "author": { "name": "rvion", "url": "https://github.com/rvion" },
5
+ "homepage": "https://github.com/rvion/comfy-ts",
6
+ "repository": "https://github.com/rvion/comfy-ts",
7
+ "license": "MIT",
8
+ "keywords": ["comfyui", "typescript", "sdk", "workflow", "generative-ai"]
9
+ }
@@ -0,0 +1,25 @@
1
+ ---
2
+ description: Convert a ComfyUI workflow JSON (a saved workflow.json, an exported api.json, an official template) into a typed comfy-ts workflow module (*.cflow.ts). Use when the user has a ComfyUI JSON and wants it as TypeScript.
3
+ argument-hint: "[workflow.json] [module-name]"
4
+ ---
5
+
6
+ Convert this ComfyUI JSON into a comfy-ts module: $ARGUMENTS
7
+
8
+ 1. Read `node_modules/comfy-ts/guide-for-agents.md`: the module pattern, the var kinds, import and export. The conversion needs a host whose `.comfy-ts/hosts/<id>/sdk.d.ts` exists and whose nodes cover the JSON; without one, set the project up first.
9
+ 2. Let comfy-ts read the JSON offline and print it in the prompt format. A JSON with a `nodes` array is a workflow.json; an object of `{ class_type, inputs }` entries is an api.json. Save this as a scratch `.ts` file in the project and run it with `bun`:
10
+
11
+ ```ts
12
+ import { ComfyTS } from 'comfy-ts'
13
+ const host = ComfyTS.create().host({ id: '<host-id>', url: '<host-url>' })
14
+ await host.loadSchemaFromCache()
15
+ const json = JSON.parse(await Bun.file('<input.json>').text())
16
+ const wf = 'nodes' in json ? host.importWorkflowJson(json) : host.importApiJson(json)
17
+ console.log(JSON.stringify(wf.toApiJson(), null, 1))
18
+ ```
19
+
20
+ An error that names a node or a model the host lacks is the answer: report it, never guess around it.
21
+ 3. Write `<module-name>.cflow.ts` from that prompt: one `b.<class_type>({ … })` call per node, producers first. A link `["<id>", <slot>]` becomes the producing node's output, `node.outputs.<name>` with the output name from the `OUT` block of `sdk.d.ts`. A literal input stays a value. Make vars of what a user tunes: prompt text, seed, size, steps, input media, the model files.
22
+ 4. Check it as a new workflow is checked: the project typechecks, `bunx comfy-ts run ./<module-name>.cflow.ts --help` lists the vars, a dry build has empty `problems`. Then compare `(await m.default.build({ dry: true })).toApiJson()` with the converted prompt: every loader, encoder, sampler and saver node of the prompt is there.
23
+ 5. Delete the scratch file.
24
+
25
+ Report the module path, its vars, and every node the conversion dropped, with the reason.
@@ -0,0 +1,21 @@
1
+ ---
2
+ description: Background for projects that use comfy-ts, the typed TypeScript SDK for ComfyUI. Use when code imports comfy-ts, touches a *.cflow.ts module or a .comfy-ts/ folder, or builds, runs, converts or debugs ComfyUI workflows from TypeScript.
3
+ argument-hint: "[question about comfy-ts]"
4
+ ---
5
+
6
+ # comfy-ts
7
+
8
+ comfy-ts generates one typed SDK per ComfyUI host and builds workflows in TypeScript with autocomplete on every node, then runs them over the host's websocket.
9
+
10
+ Before you write or change comfy-ts code, read the guide of the installed version: `node_modules/comfy-ts/guide-for-agents.md` (in a workspace it can sit in a parent `node_modules`). It holds the workflow pattern, the var kinds, running, import and export, and the gotchas. No such file means comfy-ts is not installed yet: set it up first.
11
+
12
+ Where things are:
13
+
14
+ - `.comfy-ts/hosts/<id>/sdk.d.ts`: the generated types of host `<id>`. Grep it, never read it whole: the first ` <NodeName>: {` block lists that node's inputs, the next one its outputs. `bunx comfy-ts outline` lists its sections.
15
+ - `.comfy-ts/hosts/<id>/object_info.json`: the raw schema those types come from.
16
+ - `node_modules/comfy-ts/examples/`: working `*.cflow.ts` modules to copy patterns from.
17
+ - `bunx comfy-ts help`: every CLI command.
18
+
19
+ Model files, loras and enum values are literal unions of the real host: take them from `sdk.d.ts`, never invent one.
20
+
21
+ When the user typed a question with this command, answer it from the guide, the sdk and the examples.