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
@@ -0,0 +1,165 @@
1
+ import { basename, dirname } from 'pathe'
2
+
3
+ /**
4
+ * PURE tree-shaping layer under TreeSt (headless-tested): turns the flat
5
+ * discovered file list into hierarchy rows (directory nodes + files), applies
6
+ * the `/` substring filter, and owns the per-family color assignment.
7
+ */
8
+
9
+ export type FileTreeRow =
10
+ | { kind: 'dir'; path: string; label: string; depth: number; expanded: boolean }
11
+ | { kind: 'file'; file: string; name: string; depth: number }
12
+
13
+ /** module display name — also the drafts folder key (DraftsSt delegates here) */
14
+ export function moduleName(file: string): string {
15
+ return basename(file).replace(/\.cflow\.tsx?$/, '')
16
+ }
17
+
18
+ /** the color word: everything before the first `-` (`flux1-i2i` → `flux1`) */
19
+ export function familyOf(name: string): string {
20
+ const dash = name.indexOf('-')
21
+ return dash === -1 ? name : name.slice(0, dash)
22
+ }
23
+
24
+ /** hue-spread so CONSECUTIVE families land on clearly distinct colors */
25
+ export const FAMILY_PALETTE: string[] = [
26
+ '#61afef', // blue
27
+ '#e5c07b', // amber
28
+ '#c678dd', // magenta
29
+ '#98c379', // green
30
+ '#e06c75', // rose
31
+ '#56b6c2', // teal
32
+ '#d19a66', // orange
33
+ '#a5b4fc', // lavender
34
+ '#a5e075', // lime
35
+ '#f28fad', // pink
36
+ ]
37
+
38
+ /** family → color, palette cycled in first-appearance order over the FULL
39
+ * (unfiltered) file list — stable while filtering/folding */
40
+ export function assignFamilyColors(files: string[]): Map<string, string> {
41
+ const colors = new Map<string, string>()
42
+ for (const file of files) {
43
+ const family = familyOf(moduleName(file))
44
+ if (colors.has(family)) continue
45
+ colors.set(family, FAMILY_PALETTE[colors.size % FAMILY_PALETTE.length] ?? '#61afef')
46
+ }
47
+ return colors
48
+ }
49
+
50
+ type DirNode = {
51
+ /** deepest real directory path of this node (unique row key) */
52
+ path: string
53
+ label: string
54
+ files: string[]
55
+ dirs: Map<string, DirNode>
56
+ }
57
+
58
+ function commonDir(files: string[]): string {
59
+ const first = files[0]
60
+ if (first == null) return ''
61
+ let prefix = dirname(first).split('/')
62
+ for (const f of files.slice(1)) {
63
+ const segs = dirname(f).split('/')
64
+ let i = 0
65
+ while (i < prefix.length && i < segs.length && prefix[i] === segs[i]) i++
66
+ prefix = prefix.slice(0, i)
67
+ }
68
+ return prefix.join('/')
69
+ }
70
+
71
+ function insert(root: DirNode, rootDir: string, file: string): void {
72
+ const rel = dirname(file).slice(rootDir.length).replace(/^\//, '')
73
+ const segs = rel === '' ? [] : rel.split('/')
74
+ let node = root
75
+ for (const seg of segs) {
76
+ let child = node.dirs.get(seg)
77
+ if (child == null) {
78
+ child = { path: `${node.path}/${seg}`, label: seg, files: [], dirs: new Map() }
79
+ node.dirs.set(seg, child)
80
+ }
81
+ node = child
82
+ }
83
+ node.files.push(file)
84
+ }
85
+
86
+ /** a dir holding NOTHING but one subdir shows as one `a/b` row */
87
+ function mergeChains(node: DirNode): void {
88
+ // snapshot: the loop rewrites node.dirs entries while iterating
89
+ const entries = [...node.dirs]
90
+ for (const [key, child] of entries) {
91
+ mergeChains(child)
92
+ if (child.files.length === 0 && child.dirs.size === 1) {
93
+ const only = [...child.dirs.values()][0]!
94
+ const label = `${child.label}/${only.label}`
95
+ node.dirs.delete(key)
96
+ // re-key by the MERGED label: keying by only.label could clobber a
97
+ // real sibling dir of the same name (segments never contain '/')
98
+ node.dirs.set(label, { ...only, label })
99
+ }
100
+ }
101
+ }
102
+
103
+ function matches(file: string, rootDir: string, filter: string): boolean {
104
+ if (filter === '') return true
105
+ // dir path + module name, NOT the raw filename: '.cflow.ts' matching
106
+ // everything would make the filter useless for 'ts', 'flow', '.'
107
+ const haystack = `${dirname(file).slice(rootDir.length)}/${moduleName(file)}`.toLowerCase()
108
+ return haystack.includes(filter.toLowerCase())
109
+ }
110
+
111
+ function emit(p: {
112
+ node: DirNode
113
+ depth: number
114
+ rootDir: string
115
+ collapsedDirs: Set<string>
116
+ filter: string
117
+ out: FileTreeRow[]
118
+ }): void {
119
+ for (const file of p.node.files) {
120
+ if (!matches(file, p.rootDir, p.filter)) continue
121
+ p.out.push({ kind: 'file', file, name: moduleName(file), depth: p.depth })
122
+ }
123
+ for (const dir of [...p.node.dirs.values()].sort((a, b) => a.label.localeCompare(b.label))) {
124
+ const kept: FileTreeRow[] = []
125
+ // a collapsed dir still ignores its fold while a filter narrows the tree
126
+ const expanded = p.filter !== '' || !p.collapsedDirs.has(dir.path)
127
+ emit({ ...p, node: dir, depth: p.depth + 1, out: kept })
128
+ if (p.filter !== '' && kept.length === 0) continue // prune filtered-empty dirs
129
+ p.out.push({ kind: 'dir', path: dir.path, label: dir.label, depth: p.depth, expanded })
130
+ if (expanded) p.out.push(...kept)
131
+ }
132
+ }
133
+
134
+ /**
135
+ * hierarchy rows over the discovered files: user files under their common
136
+ * root, packaged examples LAST under one foldable 'comfy-ts examples' node.
137
+ */
138
+ export function buildFileRows(p: {
139
+ userFiles: string[]
140
+ bundledFiles: string[]
141
+ collapsedDirs: Set<string>
142
+ filter: string
143
+ }): FileTreeRow[] {
144
+ const out: FileTreeRow[] = []
145
+ if (p.userFiles.length > 0) {
146
+ const rootDir = commonDir(p.userFiles)
147
+ const root: DirNode = { path: rootDir, label: '', files: [], dirs: new Map() }
148
+ for (const f of p.userFiles) insert(root, rootDir, f)
149
+ mergeChains(root)
150
+ emit({ node: root, depth: 0, rootDir, collapsedDirs: p.collapsedDirs, filter: p.filter, out })
151
+ }
152
+ if (p.bundledFiles.length > 0) {
153
+ const rootDir = commonDir(p.bundledFiles)
154
+ const root: DirNode = { path: rootDir, label: 'comfy-ts examples', files: [], dirs: new Map() }
155
+ for (const f of p.bundledFiles) insert(root, rootDir, f)
156
+ mergeChains(root)
157
+ const kept: FileTreeRow[] = []
158
+ const expanded = p.filter !== '' || !p.collapsedDirs.has(rootDir)
159
+ emit({ node: root, depth: 1, rootDir, collapsedDirs: p.collapsedDirs, filter: p.filter, out: kept })
160
+ if (p.filter !== '' && kept.length === 0) return out
161
+ out.push({ kind: 'dir', path: rootDir, label: root.label, depth: 0, expanded })
162
+ if (expanded) out.push(...kept)
163
+ }
164
+ return out
165
+ }
@@ -0,0 +1,56 @@
1
+ import { existsSync, readFileSync } from 'node:fs'
2
+ import { fileURLToPath } from 'node:url'
3
+ import { dirname, join } from 'pathe'
4
+
5
+ /**
6
+ * the examples/ folder shipped in the npm tarball, resolved from THIS module's
7
+ * own location (NEVER cwd): walking up to the nearest NAMED package.json finds
8
+ * <pkg>/examples both from a consumer's node_modules/comfy-ts/dist/ and from
9
+ * this repo's src/. Returns null when the examples are absent (a consumer may
10
+ * prune the folder) or when the nearest named package is not comfy-ts (the lib
11
+ * was inlined into someone else's bundle — its examples are not on disk); no
12
+ * package.json all the way up is a broken install and throws.
13
+ */
14
+ export function bundledExamplesDir(moduleUrl: string = import.meta.url): string | null {
15
+ let dir = dirname(fileURLToPath(moduleUrl))
16
+ let prev = ''
17
+ while (dir !== prev) {
18
+ const pkgPath = join(dir, 'package.json')
19
+ if (existsSync(pkgPath)) {
20
+ let pkg: { name?: string } = {}
21
+ try {
22
+ pkg = JSON.parse(readFileSync(pkgPath, 'utf8'))
23
+ } catch {
24
+ // a malformed package.json on the walk (someone's broken fixture
25
+ // dir) must not take the whole TUI down; treat as unnamed
26
+ }
27
+ if (pkg.name === 'comfy-ts') {
28
+ const examples = join(dir, 'examples')
29
+ return existsSync(examples) ? examples : null
30
+ }
31
+ if (pkg.name != null) return null
32
+ }
33
+ prev = dir
34
+ dir = dirname(dir)
35
+ }
36
+ throw new Error(`[comfy-ts] no package.json found walking up from ${fileURLToPath(moduleUrl)}`)
37
+ }
38
+
39
+ /**
40
+ * absolute path of a bundled `examples/images/` input image, e.g.
41
+ * `exampleImagePath('bear_1024x1024.jpg')` — the out-of-the-box default for
42
+ * i2i/i2v example image vars, valid from this repo AND from a consumer's
43
+ * node_modules/comfy-ts/. Loud throw naming the path when the file is missing
44
+ * or the package's examples/ folder was pruned.
45
+ */
46
+ export function exampleImagePath(name: string): string {
47
+ const examples = bundledExamplesDir()
48
+ if (examples == null) {
49
+ throw new Error(
50
+ `[comfy-ts] cannot resolve bundled example image '${name}': the package's examples/ folder is not on disk`,
51
+ )
52
+ }
53
+ const abs = join(examples, 'images', name)
54
+ if (!existsSync(abs)) throw new Error(`[comfy-ts] bundled example image not found: ${abs}`)
55
+ return abs
56
+ }
@@ -179,7 +179,10 @@ export class ComfyNode<
179
179
  for (const i of this.$schema.inputs) {
180
180
  _done.add(i.nameInComfy)
181
181
  const value = this.serializeValue(i.nameInComfy, promptExt.inputs[i.nameInComfy])
182
- inputs[i.nameInComfy] = value
182
+ // absent optionals (autogrow containers included) stay OUT of the
183
+ // prompt: an `undefined` value would already be dropped by JSON
184
+ // serialization, keeping the key would only lie to Object.keys
185
+ if (value !== undefined) inputs[i.nameInComfy] = value
183
186
  }
184
187
  for (const [nameInComfy, rawVal] of Object.entries(promptExt.inputs)) {
185
188
  if (_done.has(nameInComfy)) continue
@@ -720,7 +720,14 @@ export class ComfyHost<ID extends string = string> {
720
720
  /** handy to keep around */
721
721
  status: ComfyStatusData['status'] | null = null
722
722
 
723
+ /** last time ANY ws message arrived — proof-of-life for the TUI probe: a
724
+ * busy single-threaded ComfyUI stalls NEW connects while established
725
+ * sockets keep streaming (a half-open socket receives nothing, so this
726
+ * never revives one) */
727
+ lastWsMessageAt: number | null = null
728
+
723
729
  onMessage(e: MessageEvent): void {
730
+ this.lastWsMessageAt = Date.now()
724
731
  if (this.data.onWsMessageAny) this.data.onWsMessageAny(e)
725
732
  if (e.data instanceof ArrayBuffer) {
726
733
  const frame = parseBinaryWsFrame(e.data)
package/src/index.ts CHANGED
@@ -46,6 +46,9 @@ export { ComfyNodeOutput } from 'src/graph/ComfyNodeOutput.ts'
46
46
  export type { ComfyNodeMetadata, ComfyNodeId } from 'src/graph/ComfyNodeID.ts'
47
47
  export { auto, auto_ } from 'src/graph/autoValue.ts'
48
48
 
49
+ // bundled example assets (ship in the tarball)
50
+ export { exampleImagePath } from 'src/exampleAssets.ts'
51
+
49
52
  // sdk generator (schema parsing + per-host codegen)
50
53
  export { ComfySchema } from 'src/sdk-generator/ComfySchema.ts'
51
54
  export { codegenSDK, hostIdToNamespace, type CodegenOptions } from 'src/sdk-generator/comfyui-sdk-codegen.ts'
@@ -83,7 +86,10 @@ export {
83
86
  ChoiceVar,
84
87
  LorasVar,
85
88
  SizeVar,
89
+ ImageVar,
90
+ ImageVarEmptyError,
86
91
  DEFAULT_SIZE_PRESETS,
92
+ DEFAULT_IMAGE_EXTENSIONS,
87
93
  activeLoras,
88
94
  } from 'src/vars/ComfyVars.ts'
89
95
  export type {
@@ -98,6 +104,7 @@ export type {
98
104
  ActiveLora,
99
105
  SizeValue,
100
106
  SizePreset,
107
+ ImageVarOpts,
101
108
  } from 'src/vars/ComfyVars.ts'
102
109
  export { DefinedWorkflow, type DefineWorkflowSpec, type BoundVars, type LoraNameOf } from 'src/vars/DefinedWorkflow.ts'
103
110
  export { getLoraKeyword, setLoraKeyword } from 'src/vars/loraKeywords.ts'
@@ -8,11 +8,28 @@ import { DownloadComfyManagerJSONs } from 'src/manager/loaders/step1_downloadCom
8
8
  import { _getKnownPlugins } from 'src/manager/loaders/step2_custom-node-list-loader.ts'
9
9
  import { _getCustomNodeRegistry } from 'src/manager/loaders/step3_extension-node-map-loader.ts'
10
10
  import { _getKnownModels } from 'src/manager/loaders/step4_model-list-loader.ts'
11
+ import { _getAlterList } from 'src/manager/loaders/step5_alter-list-loader.ts'
12
+ import { _getGithubStats } from 'src/manager/loaders/step6_github-stats-loader.ts'
13
+ import { ManagerParseReport } from 'src/manager/loaders/parseReport.ts'
14
+ import type { ComfyManagerAlterInfo } from 'src/manager/types/ComfyManagerAlterInfo.ts'
15
+ import type { ComfyManagerGithubStatEntry } from 'src/manager/types/ComfyManagerGithubStats.ts'
11
16
  import type { ComfyManagerModelInfo } from 'src/manager/types/ComfyManagerModelInfo.ts'
12
17
  import type { ComfyManagerPluginInfo } from 'src/manager/types/ComfyManagerPluginInfo.ts'
13
18
 
14
19
  const log = (...args: unknown[]) => console.log(`[📘 registry]`, ...args)
15
20
 
21
+ // core ComfyUI as a pseudo-plugin: extension-node-map keys the builtin nodes under this url
22
+ const BUILTIN_URL: KnownComfyPluginURL = 'https://github.com/comfyanonymous/ComfyUI'
23
+ const BUILTIN_PLUGIN: ComfyManagerPluginInfo = {
24
+ id: 'nodes',
25
+ author: 'comfyanonymous',
26
+ description: 'built-in',
27
+ title: 'built-in',
28
+ files: [BUILTIN_URL],
29
+ reference: 'https://github.com/comfyanonymous/ComfyUI',
30
+ install_type: '',
31
+ }
32
+
16
33
  export class ComfyRegistry {
17
34
  // plugins, indexed
18
35
  plugins_byTitle = new Map<KnownComfyPluginTitle, ComfyManagerPluginInfo>()
@@ -26,6 +43,15 @@ export class ComfyRegistry {
26
43
  // Models
27
44
  knownModels = new Map<KnownModel_Name, ComfyManagerModelInfo>()
28
45
 
46
+ // a1111 → comfy alternatives (alter-list.json)
47
+ alterations: ComfyManagerAlterInfo[] = []
48
+
49
+ // repo url → stars / last_update (github-stats.json)
50
+ githubStats = new Map<string, ComfyManagerGithubStatEntry>()
51
+
52
+ // per-file row accounting of the last load, printed on every build
53
+ report = new ManagerParseReport()
54
+
29
55
  static async DownloadAndUpdate(download: boolean): Promise<ComfyRegistry> {
30
56
  if (download) {
31
57
  log(chalk.bold(`1. Downloading comfy-manager JSONs...`))
@@ -46,15 +72,9 @@ export class ComfyRegistry {
46
72
  genTypes?: boolean
47
73
  } = {},
48
74
  ) {
49
- this.plugins_byFile.set('https://github.com/comfyanonymous/ComfyUI' as any, {
50
- id: 'nodes',
51
- author: 'comfyanonymous',
52
- description: 'built-in',
53
- title: 'built-in' as any,
54
- files: [],
55
- reference: 'https://github.com/comfyanonymous/ComfyUI',
56
- install_type: '',
57
- })
75
+ // seeded BEFORE codegen so 'built-in' and the core repo url are legitimate union members
76
+ this.plugins_byTitle.set(BUILTIN_PLUGIN.title, BUILTIN_PLUGIN)
77
+ this.plugins_byFile.set(BUILTIN_URL, BUILTIN_PLUGIN)
58
78
 
59
79
  log(`loading src/manager/json/${chalk.yellow('custom-node-list.json')}...`)
60
80
  _getKnownPlugins(this)
@@ -64,6 +84,14 @@ export class ComfyRegistry {
64
84
 
65
85
  log(`loading src/manager/json/${chalk.yellow('model-list.json')}...`)
66
86
  _getKnownModels(this)
87
+
88
+ log(`loading src/manager/json/${chalk.yellow('alter-list.json')}...`)
89
+ _getAlterList(this)
90
+
91
+ log(`loading src/manager/json/${chalk.yellow('github-stats.json')}...`)
92
+ _getGithubStats(this)
93
+
94
+ this.report.print()
67
95
  }
68
96
 
69
97
  getKnownCheckpoints = (): ComfyManagerModelInfo[] => {