comfy-ts 1.0.0 → 1.2.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 (147) hide show
  1. package/README.md +60 -11
  2. package/dist/cli.js +4 -4439
  3. package/dist/cli.js.map +1 -1
  4. package/dist/index.cjs +445 -172
  5. package/dist/index.cjs.map +1 -1
  6. package/dist/index.d.cts +7439 -340
  7. package/dist/index.d.ts +7457 -358
  8. package/dist/index.js +444 -172
  9. package/dist/index.js.map +1 -1
  10. package/dist/{run-tui-BFhba_oG.js → run-tui-BAdizWsO.js} +1244 -201
  11. package/dist/run-tui-BAdizWsO.js.map +1 -0
  12. package/dist/state-BYbxDgfr.js +5258 -0
  13. package/dist/state-BYbxDgfr.js.map +1 -0
  14. package/examples/README.md +32 -0
  15. package/examples/comfy-cloud/ace-step-t2a.cflow.ts +79 -0
  16. package/examples/comfy-cloud/anima-t2i.cflow.ts +57 -0
  17. package/examples/comfy-cloud/boogu-i2i.cflow.ts +76 -0
  18. package/examples/comfy-cloud/capybara-i2i.cflow.ts +85 -0
  19. package/examples/comfy-cloud/capybara-i2v.cflow.ts +90 -0
  20. package/examples/comfy-cloud/capybara-t2i.cflow.ts +67 -0
  21. package/examples/comfy-cloud/chatterbox-t2a.cflow.ts +79 -0
  22. package/examples/comfy-cloud/chroma-t2i.cflow.ts +62 -0
  23. package/examples/comfy-cloud/cloudHost.ts +41 -0
  24. package/examples/comfy-cloud/ernie-t2i.cflow.ts +59 -0
  25. package/examples/comfy-cloud/firered-i2i.cflow.ts +74 -0
  26. package/examples/comfy-cloud/flux1-i2i.cflow.ts +76 -0
  27. package/examples/comfy-cloud/flux1-t2i.cflow.ts +63 -0
  28. package/examples/comfy-cloud/flux2-i2i.cflow.ts +80 -0
  29. package/examples/comfy-cloud/flux2-t2i.cflow.ts +57 -0
  30. package/examples/comfy-cloud/hidream-i2i.cflow.ts +89 -0
  31. package/examples/comfy-cloud/hidream-t2i.cflow.ts +65 -0
  32. package/examples/comfy-cloud/hunyuan-video-i2v.cflow.ts +93 -0
  33. package/examples/comfy-cloud/hunyuan-video-t2v.cflow.ts +74 -0
  34. package/examples/comfy-cloud/ideogram4-t2i.cflow.ts +80 -0
  35. package/examples/comfy-cloud/kandinsky5-i2v.cflow.ts +95 -0
  36. package/examples/comfy-cloud/kandinsky5-t2i.cflow.ts +60 -0
  37. package/examples/comfy-cloud/kandinsky5-t2v.cflow.ts +78 -0
  38. package/examples/comfy-cloud/krea2-t2i.cflow.ts +59 -0
  39. package/examples/comfy-cloud/lens-t2i.cflow.ts +62 -0
  40. package/examples/comfy-cloud/longcat-i2i.cflow.ts +74 -0
  41. package/examples/comfy-cloud/longcat-t2i.cflow.ts +65 -0
  42. package/examples/comfy-cloud/ltxv-i2v.cflow.ts +92 -0
  43. package/examples/comfy-cloud/ltxv-t2v.cflow.ts +78 -0
  44. package/examples/comfy-cloud/newbie-t2i.cflow.ts +67 -0
  45. package/examples/comfy-cloud/omnigen2-i2i.cflow.ts +86 -0
  46. package/examples/comfy-cloud/omnigen2-t2i.cflow.ts +62 -0
  47. package/examples/comfy-cloud/ovis-t2i.cflow.ts +56 -0
  48. package/examples/comfy-cloud/pixeldit-t2i.cflow.ts +63 -0
  49. package/examples/comfy-cloud/qwen-image-i2i.cflow.ts +69 -0
  50. package/examples/comfy-cloud/qwen-image-t2i.cflow.ts +55 -0
  51. package/examples/comfy-cloud/sd35-t2i.cflow.ts +48 -0
  52. package/examples/comfy-cloud/sdk.d.ts +445 -57
  53. package/examples/comfy-cloud/sdxl-t2i.cflow.ts +69 -0
  54. package/examples/comfy-cloud/stable-audio-t2a.cflow.ts +53 -0
  55. package/examples/comfy-cloud/svd-i2v.cflow.ts +75 -0
  56. package/examples/comfy-cloud/wan21-i2v.cflow.ts +83 -0
  57. package/examples/comfy-cloud/wan21-t2v.cflow.ts +64 -0
  58. package/examples/comfy-cloud/wan22-5b-t2v.cflow.ts +69 -0
  59. package/examples/comfy-cloud/wan22-i2v.cflow.ts +107 -0
  60. package/examples/comfy-cloud/wan22-t2v.cflow.ts +98 -0
  61. package/examples/comfy-cloud/z-image-t2i.cflow.ts +62 -0
  62. package/examples/images/README.md +18 -0
  63. package/examples/images/bear_1024x1024.jpg +0 -0
  64. package/examples/images/deer_768x1344.jpg +0 -0
  65. package/examples/images/dog_512x512.jpg +0 -0
  66. package/examples/images/lioness_768x768.jpg +0 -0
  67. package/examples/images/pug_200x300.jpg +0 -0
  68. package/examples/images/walrus_1344x768.jpg +0 -0
  69. package/examples/{01-txt2img.cflow.ts → rvion/01-txt2img.cflow.ts} +1 -1
  70. package/examples/{02-img2img-upload.cflow.ts → rvion/02-img2img-upload.cflow.ts} +7 -18
  71. package/examples/{03-export-workflow-json.cflow.ts → rvion/03-export-workflow-json.cflow.ts} +1 -1
  72. package/examples/{04-krea2-turbo-t2i.cflow.ts → rvion/04-krea2-turbo-t2i.cflow.ts} +2 -2
  73. package/examples/rvion/05-comfy-cloud.cflow.ts +51 -0
  74. package/examples/rvion/06-qwen-image-edit.cflow.ts +89 -0
  75. package/guide-for-agents.md +7 -1
  76. package/package.json +18 -4
  77. package/src/cli/tui/components/CopyOverlay.tsx +25 -0
  78. package/src/cli/tui/components/Header.tsx +9 -4
  79. package/src/cli/tui/components/HostPanel.tsx +3 -2
  80. package/src/cli/tui/components/HostsOverlay.tsx +33 -0
  81. package/src/cli/tui/components/PreviewPanel.tsx +9 -8
  82. package/src/cli/tui/components/StatusBar.tsx +39 -9
  83. package/src/cli/tui/components/TreePanel.tsx +17 -7
  84. package/src/cli/tui/components/TuiApp.tsx +65 -5
  85. package/src/cli/tui/discoverWorkflows.ts +7 -41
  86. package/src/cli/tui/imagePicker/ImagePickerOverlay.tsx +72 -0
  87. package/src/cli/tui/imagePicker/ImagePickerSt.ts +288 -0
  88. package/src/cli/tui/imagePicker/fsListing.ts +48 -0
  89. package/src/cli/tui/imagePicker/pickerPrefs.ts +78 -0
  90. package/src/cli/tui/run-tui.tsx +49 -8
  91. package/src/cli/tui/state/DraftsSt.ts +3 -2
  92. package/src/cli/tui/state/ExecSt.ts +108 -12
  93. package/src/cli/tui/state/HostSt.ts +94 -10
  94. package/src/cli/tui/state/LorasSt.ts +14 -36
  95. package/src/cli/tui/state/PickerSt.ts +8 -2
  96. package/src/cli/tui/state/PreviewSt.ts +28 -2
  97. package/src/cli/tui/state/QueueSt.ts +2 -2
  98. package/src/cli/tui/state/SettingsSt.ts +25 -7
  99. package/src/cli/tui/state/TreeSt.ts +139 -36
  100. package/src/cli/tui/state/TuiSt.ts +53 -6
  101. package/src/cli/tui/state/WorkflowsSt.ts +14 -2
  102. package/src/cli/tui/treeRows.ts +165 -0
  103. package/src/exampleAssets.ts +56 -0
  104. package/src/graph/ComfyNode.ts +4 -1
  105. package/src/host/ComfyHost.ts +7 -0
  106. package/src/index.ts +7 -0
  107. package/src/manager/ComfyRegistry.ts +37 -9
  108. package/src/manager/generated/KnownComfyCustomNodeName.ts +23852 -1926
  109. package/src/manager/generated/KnownComfyPluginTitle.ts +6854 -236
  110. package/src/manager/generated/KnownComfyPluginURL.ts +3425 -111
  111. package/src/manager/generated/KnownModel_Base.ts +23 -7
  112. package/src/manager/generated/KnownModel_FileName.ts +421 -0
  113. package/src/manager/generated/KnownModel_Name.ts +421 -0
  114. package/src/manager/generated/KnownModel_SavePath.ts +34 -8
  115. package/src/manager/generated/KnownModel_Type.ts +18 -14
  116. package/src/manager/json/alter-list.json +221 -221
  117. package/src/manager/json/custom-node-list.json +61020 -21946
  118. package/src/manager/json/extension-node-map.json +81077 -31176
  119. package/src/manager/json/github-stats.json +29321 -12601
  120. package/src/manager/json/model-list.json +5935 -4997
  121. package/src/manager/loaders/parseReport.ts +55 -0
  122. package/src/manager/loaders/step1_downloadComfyManagerJSONs.ts +15 -49
  123. package/src/manager/loaders/step2_custom-node-list-loader.ts +38 -83
  124. package/src/manager/loaders/step3_extension-node-map-loader.ts +36 -142
  125. package/src/manager/loaders/step4_model-list-loader.ts +25 -36
  126. package/src/manager/loaders/step5_alter-list-loader.ts +29 -0
  127. package/src/manager/loaders/step6_github-stats-loader.ts +23 -0
  128. package/src/manager/script-update-manager.bun.ts +9 -1
  129. package/src/manager/types/ComfyManagerAlterInfo.ts +13 -0
  130. package/src/manager/types/ComfyManagerFileModelInfo.ts +7 -3
  131. package/src/manager/types/ComfyManagerFilePluginContent.ts +6 -9
  132. package/src/manager/types/ComfyManagerFilePluginList.ts +3 -3
  133. package/src/manager/types/ComfyManagerGithubStats.ts +9 -0
  134. package/src/manager/types/ComfyManagerPluginContentMetadata.ts +2 -3
  135. package/src/manager/types/ComfyManagerPluginInfo.ts +48 -34
  136. package/src/runner/ComfyWorkflowLayout.ts +6 -4
  137. package/src/sdk-generator/ComfySchema.ts +14 -1
  138. package/src/sdk-generator/comfyui-sdk-codegen.ts +15 -0
  139. package/src/sdk-generator/inputWidgetKind.ts +17 -0
  140. package/src/state.ts +7 -1
  141. package/src/vars/ComfyVars.ts +106 -5
  142. package/src/vars/DefinedWorkflow.ts +28 -10
  143. package/dist/DefinedWorkflow-O3ynII3Y.js +0 -598
  144. package/dist/DefinedWorkflow-O3ynII3Y.js.map +0 -1
  145. package/dist/run-tui-BFhba_oG.js.map +0 -1
  146. package/examples/05-comfy-cloud.cflow.ts +0 -67
  147. package/src/utils/tryExtracting.ts +0 -41
package/README.md CHANGED
@@ -4,6 +4,11 @@ _the ultimate ComfyUI toolkit for TypeScript: `SDK` + `CLI` + `TUI` + agent guid
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)
6
6
  [![npm version](https://img.shields.io/npm/v/comfy-ts.svg)](https://www.npmjs.com/package/comfy-ts)
7
+ [![npm downloads](https://img.shields.io/npm/dm/comfy-ts.svg)](https://www.npmjs.com/package/comfy-ts)
8
+ [![GitHub release](https://img.shields.io/github/v/release/rvion/comfy-ts)](https://github.com/rvion/comfy-ts/releases)
9
+ [![types](https://img.shields.io/npm/types/comfy-ts)](https://www.npmjs.com/package/comfy-ts)
10
+ [![license](https://img.shields.io/npm/l/comfy-ts.svg)](https://github.com/rvion/comfy-ts/blob/main/LICENSE)
11
+ [![sponsor](https://img.shields.io/github/sponsors/rvion?label=sponsor&logo=githubsponsors)](https://github.com/sponsors/rvion)
7
12
 
8
13
  **Everything ComfyUI, from TypeScript.** Build workflows in code with
9
14
  autocomplete on every node and model of your exact install. Run them on any
@@ -228,7 +233,7 @@ declare global {
228
233
  generated SDK for [Comfy Cloud](https://cloud.comfy.org) (5.9MB, 3574
229
234
  nodes), committed so you can browse it and typecheck graphs against it
230
235
  without any host.
231
- [`examples/05-comfy-cloud.cflow.ts`](examples/05-comfy-cloud.cflow.ts)
236
+ [`examples/rvion/05-comfy-cloud.cflow.ts`](examples/rvion/05-comfy-cloud.cflow.ts)
232
237
  runs against it live: `url` + `apiKey` host config, one env var, images
233
238
  back in seconds.
234
239
 
@@ -262,6 +267,7 @@ await txt2img.run({ log: true }) // fresh graph, fresh image
262
267
  | `v.seed` | mode + number (`+ N` `- N` `= N` `? N`), advances itself: queued runs differ |
263
268
  | `v.prompt` | structured text: `//` comments stripped, `- ` lines become the negative prompt |
264
269
  | `v.loras` | RegExp resolved against the host's REAL lora list, fully typed, multi-select |
270
+ | `v.image` | local image path, TUI picker attached; `exampleImagePath('bear_1024x1024.jpg')` defaults to a bundled sample |
265
271
  | `v.text` `v.int` `v.float` `v.toggle` `v.choice` `v.size` | the everyday knobs, ranges included |
266
272
 
267
273
  `vars` can be a lambda receiving `v` so vars reference each other:
@@ -291,6 +297,8 @@ showing every available key.
291
297
  `r` runs, `s` rerolls the seed and runs, `o` opens the output, `c`/`C` copy
292
298
  workflow.json / api.json. Press `r` mid-run and it QUEUES with the values as
293
299
  they are right now. Drafts autosave: reopening lands you where you left off.
300
+ Image vars open a full picker: browse the disk, favorite folders, recent
301
+ picks, live preview of the highlighted image in the preview panel.
294
302
 
295
303
  ## ⌨️ The CLI
296
304
 
@@ -330,8 +338,9 @@ comfy.host({ id: 'modal', url: 'https://you--comfy.modal.run', headers: { 'Modal
330
338
  `X-API-Key` on every request and the websocket, outputs download through the
331
339
  signed-url redirect, live latent previews stream into the TUI, and the whole
332
340
  cloud catalog ships as a committed, browsable SDK
333
- ([`examples/comfy-cloud/sdk.d.ts`](examples/comfy-cloud/sdk.d.ts), run it
334
- with [example 05](examples/05-comfy-cloud.cflow.ts)).
341
+ ([`examples/comfy-cloud/sdk.d.ts`](examples/comfy-cloud/sdk.d.ts)) with a
342
+ whole [model zoo of 46 ready workflows](#the-model-zoo-46-cloud-workflows-32-model-families)
343
+ built against it.
335
344
 
336
345
  Reaching a Comfy running on another one of your machines:
337
346
 
@@ -346,7 +355,17 @@ Reaching a Comfy running on another one of your machines:
346
355
  ## 🔌 Ecosystem discovery and install
347
356
 
348
357
  The whole ComfyUI-Manager registry, mirrored into generated types: every
349
- known custom node pack, plugin title and model is a typed union.
358
+ known custom node pack, plugin title and model is a typed union. The
359
+ generated files are committed, browsable TypeScript:
360
+
361
+ - [`KnownComfyCustomNodeName`](src/manager/generated/KnownComfyCustomNodeName.ts):
362
+ every node name of every known pack
363
+ - [`KnownComfyPluginTitle`](src/manager/generated/KnownComfyPluginTitle.ts) /
364
+ [`KnownComfyPluginURL`](src/manager/generated/KnownComfyPluginURL.ts):
365
+ the whole custom-node ecosystem as literal types
366
+ - [`KnownModel_Name`](src/manager/generated/KnownModel_Name.ts) and its
367
+ [`Base` / `Type` / `FileName` / `SavePath`](src/manager/generated/)
368
+ siblings: every model the registry knows, down to where it installs
350
369
 
351
370
  ```ts
352
371
  await host.installCustomNodeByTitle('ComfyUI Impact Pack') // autocompletes across the ecosystem
@@ -381,16 +400,39 @@ library:
381
400
 
382
401
  ## 📚 Examples
383
402
 
384
- Every example is a runnable `*.cflow.ts` module: run it with bun, or point
385
- the TUI at `examples/`.
403
+ Every example is a runnable `*.cflow.ts` module: run it with bun, or just
404
+ `bunx comfy-ts tui` — the TUI finds them all.
405
+
406
+ Start with the didactic sequence in [`examples/rvion/`](examples/rvion/):
386
407
 
387
408
  | example | shows |
388
409
  | ---------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
389
- | [`01-txt2img`](examples/01-txt2img.cflow.ts) | typed builder, vars, execution, downloaded outputs |
390
- | [`02-img2img-upload`](examples/02-img2img-upload.cflow.ts) | hash-named deduped upload, img2img, async build |
391
- | [`03-export-workflow-json`](examples/03-export-workflow-json.cflow.ts) | OFFLINE graph building, export api.json + readable workflow.json |
392
- | [`04-krea2-turbo-t2i`](examples/04-krea2-turbo-t2i.cflow.ts) | a real pipeline: krea2 turbo, lora stack, RMBG cutout → transparent png |
393
- | [`05-comfy-cloud`](examples/05-comfy-cloud.cflow.ts) | the same code on Comfy Cloud: `url` + `apiKey` host, typechecked against the committed catalog SDK |
410
+ | [`01-txt2img`](examples/rvion/01-txt2img.cflow.ts) | typed builder, vars, execution, downloaded outputs |
411
+ | [`02-img2img-upload`](examples/rvion/02-img2img-upload.cflow.ts) | hash-named deduped upload, img2img, async build |
412
+ | [`03-export-workflow-json`](examples/rvion/03-export-workflow-json.cflow.ts) | OFFLINE graph building, export api.json + readable workflow.json |
413
+ | [`04-krea2-turbo-t2i`](examples/rvion/04-krea2-turbo-t2i.cflow.ts) | a real pipeline: krea2 turbo, lora stack, RMBG cutout → transparent png |
414
+ | [`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 |
415
+ | [`06-qwen-image-edit`](examples/rvion/06-qwen-image-edit.cflow.ts) | Qwen Image Edit 2511, lightning 4-step lora toggle |
416
+
417
+ ### The model zoo: 46 cloud workflows, 32 model families
418
+
419
+ [`examples/comfy-cloud/`](examples/comfy-cloud/) holds one runnable example
420
+ per family × mode (`<family>-<mode>.cflow.ts`), each transcribed from the
421
+ official ComfyUI template of that model, typechecked against the committed
422
+ cloud catalog, and runnable on [Comfy Cloud](https://cloud.comfy.org) with
423
+ one env var (`COMFY_CLOUD_API_KEY`). Image, video and audio:
424
+
425
+ | mode | families |
426
+ | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
427
+ | **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 |
428
+ | **i2i** image edit | flux1, flux2, qwen-image, hidream, omnigen2, capybara, longcat, boogu, firered |
429
+ | **t2v** text→video | wan21, wan22, wan22-5b, ltxv, hunyuan-video, kandinsky5 |
430
+ | **i2v** image→video | wan21, wan22, ltxv, hunyuan-video, kandinsky5, capybara, svd |
431
+ | **t2a** text→audio | ace-step (song), stable-audio (sfx/music), chatterbox (tts) |
432
+
433
+ Every zoo file imports offline and headless (no key, no cache needed — CI
434
+ proves it), builds a validated graph, and doubles as a TUI app with typed
435
+ knobs: prompt, seed, steps, size, input image, …
394
436
 
395
437
  ## 🗂️ The `.comfy-ts/` folder
396
438
 
@@ -452,6 +494,13 @@ The glitter above sits on boring foundations:
452
494
  - [@saintno/comfyui-sdk](https://www.npmjs.com/package/@saintno/comfyui-sdk), polished API, but unsafe workflow building, no typed registry.
453
495
  - [comfyui-bun-client](https://github.com/KaruroChori/comfyui-bun-client), similar spirit, less codegen, not on npm.
454
496
 
497
+ ## Support
498
+
499
+ comfy-ts is free, MIT, and maintained for the long run. If it saves you
500
+ time or powers something you sell, consider
501
+ [sponsoring](https://github.com/sponsors/rvion), it keeps the grind loops
502
+ grinding.
503
+
455
504
  ## License
456
505
 
457
506
  MIT © [Rémi Vion](https://github.com/rvion)