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.
- package/README.md +60 -11
- package/dist/cli.js +4 -4439
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +445 -172
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7439 -340
- package/dist/index.d.ts +7457 -358
- package/dist/index.js +444 -172
- package/dist/index.js.map +1 -1
- package/dist/{run-tui-BFhba_oG.js → run-tui-BAdizWsO.js} +1244 -201
- package/dist/run-tui-BAdizWsO.js.map +1 -0
- package/dist/state-BYbxDgfr.js +5258 -0
- package/dist/state-BYbxDgfr.js.map +1 -0
- package/examples/README.md +32 -0
- package/examples/comfy-cloud/ace-step-t2a.cflow.ts +79 -0
- package/examples/comfy-cloud/anima-t2i.cflow.ts +57 -0
- package/examples/comfy-cloud/boogu-i2i.cflow.ts +76 -0
- package/examples/comfy-cloud/capybara-i2i.cflow.ts +85 -0
- package/examples/comfy-cloud/capybara-i2v.cflow.ts +90 -0
- package/examples/comfy-cloud/capybara-t2i.cflow.ts +67 -0
- package/examples/comfy-cloud/chatterbox-t2a.cflow.ts +79 -0
- package/examples/comfy-cloud/chroma-t2i.cflow.ts +62 -0
- package/examples/comfy-cloud/cloudHost.ts +41 -0
- package/examples/comfy-cloud/ernie-t2i.cflow.ts +59 -0
- package/examples/comfy-cloud/firered-i2i.cflow.ts +74 -0
- package/examples/comfy-cloud/flux1-i2i.cflow.ts +76 -0
- package/examples/comfy-cloud/flux1-t2i.cflow.ts +63 -0
- package/examples/comfy-cloud/flux2-i2i.cflow.ts +80 -0
- package/examples/comfy-cloud/flux2-t2i.cflow.ts +57 -0
- package/examples/comfy-cloud/hidream-i2i.cflow.ts +89 -0
- package/examples/comfy-cloud/hidream-t2i.cflow.ts +65 -0
- package/examples/comfy-cloud/hunyuan-video-i2v.cflow.ts +93 -0
- package/examples/comfy-cloud/hunyuan-video-t2v.cflow.ts +74 -0
- package/examples/comfy-cloud/ideogram4-t2i.cflow.ts +80 -0
- package/examples/comfy-cloud/kandinsky5-i2v.cflow.ts +95 -0
- package/examples/comfy-cloud/kandinsky5-t2i.cflow.ts +60 -0
- package/examples/comfy-cloud/kandinsky5-t2v.cflow.ts +78 -0
- package/examples/comfy-cloud/krea2-t2i.cflow.ts +59 -0
- package/examples/comfy-cloud/lens-t2i.cflow.ts +62 -0
- package/examples/comfy-cloud/longcat-i2i.cflow.ts +74 -0
- package/examples/comfy-cloud/longcat-t2i.cflow.ts +65 -0
- package/examples/comfy-cloud/ltxv-i2v.cflow.ts +92 -0
- package/examples/comfy-cloud/ltxv-t2v.cflow.ts +78 -0
- package/examples/comfy-cloud/newbie-t2i.cflow.ts +67 -0
- package/examples/comfy-cloud/omnigen2-i2i.cflow.ts +86 -0
- package/examples/comfy-cloud/omnigen2-t2i.cflow.ts +62 -0
- package/examples/comfy-cloud/ovis-t2i.cflow.ts +56 -0
- package/examples/comfy-cloud/pixeldit-t2i.cflow.ts +63 -0
- package/examples/comfy-cloud/qwen-image-i2i.cflow.ts +69 -0
- package/examples/comfy-cloud/qwen-image-t2i.cflow.ts +55 -0
- package/examples/comfy-cloud/sd35-t2i.cflow.ts +48 -0
- package/examples/comfy-cloud/sdk.d.ts +445 -57
- package/examples/comfy-cloud/sdxl-t2i.cflow.ts +69 -0
- package/examples/comfy-cloud/stable-audio-t2a.cflow.ts +53 -0
- package/examples/comfy-cloud/svd-i2v.cflow.ts +75 -0
- package/examples/comfy-cloud/wan21-i2v.cflow.ts +83 -0
- package/examples/comfy-cloud/wan21-t2v.cflow.ts +64 -0
- package/examples/comfy-cloud/wan22-5b-t2v.cflow.ts +69 -0
- package/examples/comfy-cloud/wan22-i2v.cflow.ts +107 -0
- package/examples/comfy-cloud/wan22-t2v.cflow.ts +98 -0
- package/examples/comfy-cloud/z-image-t2i.cflow.ts +62 -0
- package/examples/images/README.md +18 -0
- package/examples/images/bear_1024x1024.jpg +0 -0
- package/examples/images/deer_768x1344.jpg +0 -0
- package/examples/images/dog_512x512.jpg +0 -0
- package/examples/images/lioness_768x768.jpg +0 -0
- package/examples/images/pug_200x300.jpg +0 -0
- package/examples/images/walrus_1344x768.jpg +0 -0
- package/examples/{01-txt2img.cflow.ts → rvion/01-txt2img.cflow.ts} +1 -1
- package/examples/{02-img2img-upload.cflow.ts → rvion/02-img2img-upload.cflow.ts} +7 -18
- package/examples/{03-export-workflow-json.cflow.ts → rvion/03-export-workflow-json.cflow.ts} +1 -1
- package/examples/{04-krea2-turbo-t2i.cflow.ts → rvion/04-krea2-turbo-t2i.cflow.ts} +2 -2
- package/examples/rvion/05-comfy-cloud.cflow.ts +51 -0
- package/examples/rvion/06-qwen-image-edit.cflow.ts +89 -0
- package/guide-for-agents.md +7 -1
- package/package.json +18 -4
- package/src/cli/tui/components/CopyOverlay.tsx +25 -0
- package/src/cli/tui/components/Header.tsx +9 -4
- package/src/cli/tui/components/HostPanel.tsx +3 -2
- package/src/cli/tui/components/HostsOverlay.tsx +33 -0
- package/src/cli/tui/components/PreviewPanel.tsx +9 -8
- package/src/cli/tui/components/StatusBar.tsx +39 -9
- package/src/cli/tui/components/TreePanel.tsx +17 -7
- package/src/cli/tui/components/TuiApp.tsx +65 -5
- package/src/cli/tui/discoverWorkflows.ts +7 -41
- package/src/cli/tui/imagePicker/ImagePickerOverlay.tsx +72 -0
- package/src/cli/tui/imagePicker/ImagePickerSt.ts +288 -0
- package/src/cli/tui/imagePicker/fsListing.ts +48 -0
- package/src/cli/tui/imagePicker/pickerPrefs.ts +78 -0
- package/src/cli/tui/run-tui.tsx +49 -8
- package/src/cli/tui/state/DraftsSt.ts +3 -2
- package/src/cli/tui/state/ExecSt.ts +108 -12
- package/src/cli/tui/state/HostSt.ts +94 -10
- package/src/cli/tui/state/LorasSt.ts +14 -36
- package/src/cli/tui/state/PickerSt.ts +8 -2
- package/src/cli/tui/state/PreviewSt.ts +28 -2
- package/src/cli/tui/state/QueueSt.ts +2 -2
- package/src/cli/tui/state/SettingsSt.ts +25 -7
- package/src/cli/tui/state/TreeSt.ts +139 -36
- package/src/cli/tui/state/TuiSt.ts +53 -6
- package/src/cli/tui/state/WorkflowsSt.ts +14 -2
- package/src/cli/tui/treeRows.ts +165 -0
- package/src/exampleAssets.ts +56 -0
- package/src/graph/ComfyNode.ts +4 -1
- package/src/host/ComfyHost.ts +7 -0
- package/src/index.ts +7 -0
- package/src/manager/ComfyRegistry.ts +37 -9
- package/src/manager/generated/KnownComfyCustomNodeName.ts +23852 -1926
- package/src/manager/generated/KnownComfyPluginTitle.ts +6854 -236
- package/src/manager/generated/KnownComfyPluginURL.ts +3425 -111
- package/src/manager/generated/KnownModel_Base.ts +23 -7
- package/src/manager/generated/KnownModel_FileName.ts +421 -0
- package/src/manager/generated/KnownModel_Name.ts +421 -0
- package/src/manager/generated/KnownModel_SavePath.ts +34 -8
- package/src/manager/generated/KnownModel_Type.ts +18 -14
- package/src/manager/json/alter-list.json +221 -221
- package/src/manager/json/custom-node-list.json +61020 -21946
- package/src/manager/json/extension-node-map.json +81077 -31176
- package/src/manager/json/github-stats.json +29321 -12601
- package/src/manager/json/model-list.json +5935 -4997
- package/src/manager/loaders/parseReport.ts +55 -0
- package/src/manager/loaders/step1_downloadComfyManagerJSONs.ts +15 -49
- package/src/manager/loaders/step2_custom-node-list-loader.ts +38 -83
- package/src/manager/loaders/step3_extension-node-map-loader.ts +36 -142
- package/src/manager/loaders/step4_model-list-loader.ts +25 -36
- package/src/manager/loaders/step5_alter-list-loader.ts +29 -0
- package/src/manager/loaders/step6_github-stats-loader.ts +23 -0
- package/src/manager/script-update-manager.bun.ts +9 -1
- package/src/manager/types/ComfyManagerAlterInfo.ts +13 -0
- package/src/manager/types/ComfyManagerFileModelInfo.ts +7 -3
- package/src/manager/types/ComfyManagerFilePluginContent.ts +6 -9
- package/src/manager/types/ComfyManagerFilePluginList.ts +3 -3
- package/src/manager/types/ComfyManagerGithubStats.ts +9 -0
- package/src/manager/types/ComfyManagerPluginContentMetadata.ts +2 -3
- package/src/manager/types/ComfyManagerPluginInfo.ts +48 -34
- package/src/runner/ComfyWorkflowLayout.ts +6 -4
- package/src/sdk-generator/ComfySchema.ts +14 -1
- package/src/sdk-generator/comfyui-sdk-codegen.ts +15 -0
- package/src/sdk-generator/inputWidgetKind.ts +17 -0
- package/src/state.ts +7 -1
- package/src/vars/ComfyVars.ts +106 -5
- package/src/vars/DefinedWorkflow.ts +28 -10
- package/dist/DefinedWorkflow-O3ynII3Y.js +0 -598
- package/dist/DefinedWorkflow-O3ynII3Y.js.map +0 -1
- package/dist/run-tui-BFhba_oG.js.map +0 -1
- package/examples/05-comfy-cloud.cflow.ts +0 -67
- package/src/utils/tryExtracting.ts +0 -41
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { ansi as chalk } from 'src/utils/ansi.ts'
|
|
2
|
+
|
|
3
|
+
/** root shape of a manager mirror file is broken: nothing to salvage, fail loud */
|
|
4
|
+
export class ManagerParseError extends Error {
|
|
5
|
+
constructor(
|
|
6
|
+
public file: string,
|
|
7
|
+
public detail: string,
|
|
8
|
+
) {
|
|
9
|
+
super(`🔴 [manager] ${file} root shape invalid: ${detail}`)
|
|
10
|
+
this.name = 'ManagerParseError'
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export class FileParseCounter {
|
|
15
|
+
total = 0
|
|
16
|
+
accepted = 0
|
|
17
|
+
skipped = new Map<string, { count: number; firstError: string }>()
|
|
18
|
+
|
|
19
|
+
constructor(public file: string) {}
|
|
20
|
+
|
|
21
|
+
ok(): void {
|
|
22
|
+
this.total++
|
|
23
|
+
this.accepted++
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
skip(reason: string, firstError: string): void {
|
|
27
|
+
this.total++
|
|
28
|
+
const prev = this.skipped.get(reason)
|
|
29
|
+
if (prev == null) this.skipped.set(reason, { count: 1, firstError })
|
|
30
|
+
else prev.count++
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** per-file row accounting for the manager mirror parse; printed on every registry build so upstream drift stays visible */
|
|
35
|
+
export class ManagerParseReport {
|
|
36
|
+
counters: FileParseCounter[] = []
|
|
37
|
+
|
|
38
|
+
file(name: string): FileParseCounter {
|
|
39
|
+
const counter = new FileParseCounter(name)
|
|
40
|
+
this.counters.push(counter)
|
|
41
|
+
return counter
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
print(): void {
|
|
45
|
+
console.log(chalk.bold(`[📘 registry] parse report:`))
|
|
46
|
+
for (const c of this.counters) {
|
|
47
|
+
const skippedTotal = [...c.skipped.values()].reduce((acc, cur) => acc + cur.count, 0)
|
|
48
|
+
const headline = ` ${c.file}: ${c.total} rows, ${c.accepted} accepted, ${skippedTotal} skipped`
|
|
49
|
+
console.log(skippedTotal === 0 ? headline : chalk.red(headline))
|
|
50
|
+
for (const [reason, info] of c.skipped) {
|
|
51
|
+
console.log(chalk.red(` - ${reason} x${info.count}, first: ${info.firstError}`))
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -1,56 +1,22 @@
|
|
|
1
1
|
import { ansi as chalk } from 'src/utils/ansi.ts'
|
|
2
|
-
|
|
3
2
|
import { downloadFile } from 'src/utils/downloadFile.ts'
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
await SYNC_extensionNodeMap()
|
|
9
|
-
await SYNC_alterList()
|
|
10
|
-
await SYNC_githubStats()
|
|
11
|
-
|
|
12
|
-
async function SYNC_modelList(): Promise<void> {
|
|
13
|
-
await downloadFile(
|
|
14
|
-
'https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/model-list.json',
|
|
15
|
-
'src/manager/json/model-list.json',
|
|
16
|
-
`- downloading ynchronizing model-list.json...`,
|
|
17
|
-
)
|
|
18
|
-
console.log(` saved at ${chalk.blue('src/manager/json/model-list.json')}`)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
async function SYNC_customNodeList(): Promise<void> {
|
|
22
|
-
await downloadFile(
|
|
23
|
-
'https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/custom-node-list.json',
|
|
24
|
-
'src/manager/json/custom-node-list.json',
|
|
25
|
-
`- downloading synchronizing custom-node-list.json...`,
|
|
26
|
-
)
|
|
27
|
-
console.log(` saved at ${chalk.blue('src/manager/json/custom-node-list.json')}`)
|
|
28
|
-
}
|
|
4
|
+
// canonical repo since the ltdrdata → Comfy-Org move; the old ltdrdata raw
|
|
5
|
+
// urls still redirect here but that is goodwill, not contract (2026-07-30)
|
|
6
|
+
const MANAGER_RAW_BASE = 'https://raw.githubusercontent.com/Comfy-Org/ComfyUI-Manager/main'
|
|
29
7
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
8
|
+
const MANAGER_MIRROR_FILES = [
|
|
9
|
+
'custom-node-list.json',
|
|
10
|
+
'model-list.json',
|
|
11
|
+
'extension-node-map.json',
|
|
12
|
+
'alter-list.json',
|
|
13
|
+
'github-stats.json',
|
|
14
|
+
] as const
|
|
38
15
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
)
|
|
45
|
-
console.log(` saved at ${chalk.blue('src/manager/json/alter-list.json')}`)
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
async function SYNC_githubStats(): Promise<void> {
|
|
49
|
-
await downloadFile(
|
|
50
|
-
'https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/refs/heads/main/github-stats.json',
|
|
51
|
-
'src/manager/json/github-stats.json',
|
|
52
|
-
`- downloading ynchronizing githubStats.json...`,
|
|
53
|
-
)
|
|
54
|
-
console.log(` saved at ${chalk.blue('src/manager/json/github-stats.json')}`)
|
|
16
|
+
export async function DownloadComfyManagerJSONs(): Promise<void> {
|
|
17
|
+
for (const file of MANAGER_MIRROR_FILES) {
|
|
18
|
+
const dest = `src/manager/json/${file}`
|
|
19
|
+
await downloadFile(`${MANAGER_RAW_BASE}/${file}`, dest, `- downloading ${file}...`)
|
|
20
|
+
console.log(` saved at ${chalk.blue(dest)}`)
|
|
55
21
|
}
|
|
56
22
|
}
|
|
@@ -1,58 +1,46 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync } from 'node:fs'
|
|
1
2
|
import { type } from 'arktype'
|
|
2
3
|
import { ansi as chalk } from 'src/utils/ansi.ts'
|
|
3
|
-
import { readFileSync, writeFileSync } from 'fs'
|
|
4
|
-
import type { Maybe } from 'src/types/index.ts'
|
|
5
4
|
import { githubRegexpV1 } from 'src/utils/githubRegexes.ts'
|
|
6
|
-
import { printArkResultInConsole } from 'src/utils/printArkResultInConsole.ts'
|
|
7
|
-
import { RecoveryVerbosity, tryRecovering } from 'src/utils/tryExtracting.ts'
|
|
8
5
|
import type { ComfyRegistry } from 'src/manager/ComfyRegistry.ts'
|
|
9
|
-
import type { KnownComfyPluginTitle } from 'src/manager/generated/KnownComfyPluginTitle.ts'
|
|
10
6
|
import { ComfyPluginExtra } from 'src/manager/json/custom-node-list.extra.ts'
|
|
7
|
+
import { ManagerParseError } from 'src/manager/loaders/parseReport.ts'
|
|
8
|
+
import { ComfyManagerFilePluginListRoot_ark } from 'src/manager/types/ComfyManagerFilePluginList.ts'
|
|
11
9
|
import {
|
|
12
|
-
type
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
import type { ComfyManagerPluginInfo } from 'src/manager/types/ComfyManagerPluginInfo.ts'
|
|
17
|
-
|
|
18
|
-
export type GetKnownPluginProps = {
|
|
19
|
-
//
|
|
20
|
-
updateCache?: boolean
|
|
21
|
-
check?: boolean
|
|
22
|
-
genTypes?: boolean
|
|
23
|
-
}
|
|
10
|
+
type ComfyManagerRawPluginInfo,
|
|
11
|
+
ComfyManagerRawPluginInfo_ark,
|
|
12
|
+
type ComfyManagerPluginInfo,
|
|
13
|
+
} from 'src/manager/types/ComfyManagerPluginInfo.ts'
|
|
24
14
|
|
|
25
15
|
export const _getKnownPlugins = (DB: ComfyRegistry): void => {
|
|
16
|
+
const counter = DB.report.file('custom-node-list.json')
|
|
26
17
|
let totalFileSeen = 0
|
|
27
|
-
let totalPluginSeen = 0
|
|
28
|
-
|
|
29
|
-
// load raw json
|
|
30
|
-
const knownPluginFile: ComfyManagerFilePluginList = JSON.parse(
|
|
31
|
-
readFileSync('src/manager/json/custom-node-list.json', 'utf8'),
|
|
32
|
-
)
|
|
33
18
|
|
|
34
|
-
//
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
// please... add validation or CI check or something!
|
|
39
|
-
for (const plugin of knownPluginList) {
|
|
40
|
-
plugin.id ??= tryRecoveringPluginId(plugin, RecoveryVerbosity.info)
|
|
41
|
-
plugin.title ??= tryRecoveringPluginTitle(plugin, RecoveryVerbosity.info)
|
|
42
|
-
}
|
|
19
|
+
// parse rows: loose raw schema per row, skip+report failures, normalize survivors
|
|
20
|
+
const raw: unknown = JSON.parse(readFileSync('src/manager/json/custom-node-list.json', 'utf8'))
|
|
21
|
+
const root = ComfyManagerFilePluginListRoot_ark(raw)
|
|
22
|
+
if (root instanceof type.errors) throw new ManagerParseError('custom-node-list.json', root.summary)
|
|
43
23
|
|
|
44
|
-
|
|
45
|
-
const
|
|
46
|
-
|
|
24
|
+
const canonical: ComfyManagerPluginInfo[] = []
|
|
25
|
+
for (const row of root.custom_nodes) {
|
|
26
|
+
const res = ComfyManagerRawPluginInfo_ark(row)
|
|
47
27
|
if (res instanceof type.errors) {
|
|
48
|
-
|
|
49
|
-
|
|
28
|
+
counter.skip('schema', res.summary)
|
|
29
|
+
continue
|
|
30
|
+
}
|
|
31
|
+
const plugin = normalizePluginInfo(res)
|
|
32
|
+
if (plugin == null) {
|
|
33
|
+
counter.skip('id-unrecoverable', res.reference)
|
|
34
|
+
continue
|
|
50
35
|
}
|
|
36
|
+
canonical.push(plugin)
|
|
37
|
+
counter.ok()
|
|
51
38
|
}
|
|
52
39
|
|
|
40
|
+
// hand-maintained extras are compile-checked canonical rows, not upstream data: no counting
|
|
41
|
+
const knownPluginList: ComfyManagerPluginInfo[] = canonical.concat(ComfyPluginExtra)
|
|
42
|
+
|
|
53
43
|
for (const plugin of knownPluginList) {
|
|
54
|
-
// INITIALIZATION ------------------------------------------------------------
|
|
55
|
-
totalPluginSeen++
|
|
56
44
|
if (DB.opts.check && DB.plugins_byTitle.has(plugin.title))
|
|
57
45
|
console.log(` ❌ plugin.title: "${plugin.title}" is duplicated`)
|
|
58
46
|
DB.plugins_byTitle.set(plugin.title, plugin)
|
|
@@ -70,7 +58,7 @@ export const _getKnownPlugins = (DB: ComfyRegistry): void => {
|
|
|
70
58
|
// TitleType
|
|
71
59
|
const allPlugins = [...DB.plugins_byTitle.values()]
|
|
72
60
|
const allPluginsSortedByTitles = allPlugins.sort((a, b) =>
|
|
73
|
-
|
|
61
|
+
a.title.toLowerCase().localeCompare(b.title.toLowerCase()),
|
|
74
62
|
)
|
|
75
63
|
out1 += '// prettier-ignore\n'
|
|
76
64
|
out1 += 'export type KnownComfyPluginTitle =\n'
|
|
@@ -90,7 +78,6 @@ export const _getKnownPlugins = (DB: ComfyRegistry): void => {
|
|
|
90
78
|
out2 += '// prettier-ignore\n'
|
|
91
79
|
out2 += 'export type KnownComfyPluginURL =\n'
|
|
92
80
|
for (const fileName of sortedFileNames) out2 += ` | ${JSON.stringify(fileName)}\n`
|
|
93
|
-
// out2 += '\n'
|
|
94
81
|
const out2Path = 'src/manager/generated/KnownComfyPluginURL.ts'
|
|
95
82
|
writeFileSync(out2Path, out2, 'utf-8')
|
|
96
83
|
console.log(` > generated: ${chalk.blue.underline(out2Path)}`)
|
|
@@ -98,52 +85,20 @@ export const _getKnownPlugins = (DB: ComfyRegistry): void => {
|
|
|
98
85
|
|
|
99
86
|
// INDEXING CHECKS ------------------------------------------------------------
|
|
100
87
|
if (DB.opts.check) {
|
|
101
|
-
|
|
102
|
-
console.log(` - ${totalPluginSeen} CustomNodes in file`)
|
|
88
|
+
console.log(` - ${knownPluginList.length} CustomNodes in file`)
|
|
103
89
|
console.log(` - ${DB.plugins_byTitle.size} CustomNodes registered in map`)
|
|
104
90
|
console.log(` - ${totalFileSeen} CustomNodes-File Seen`)
|
|
105
91
|
console.log(` - ${DB.plugins_byFile.size} CustomNodes-File registered in map`)
|
|
106
92
|
}
|
|
107
93
|
}
|
|
108
94
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
attempt: 'id',
|
|
119
|
-
fn: (): Maybe<KnownComfyPluginTitle> => plugin.id as KnownComfyPluginTitle,
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
attempt: 'github repo name',
|
|
123
|
-
fn: (): Maybe<KnownComfyPluginTitle> => plugin.reference as KnownComfyPluginTitle,
|
|
124
|
-
},
|
|
125
|
-
],
|
|
126
|
-
})
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
function tryRecoveringPluginId(
|
|
130
|
-
//
|
|
131
|
-
plugin: ComfyManagerPluginInfo,
|
|
132
|
-
verbose = RecoveryVerbosity.Quiet,
|
|
133
|
-
): string {
|
|
134
|
-
return tryRecovering<ComfyManagerPluginID>({
|
|
135
|
-
property: 'plugin.id',
|
|
136
|
-
verbose,
|
|
137
|
-
hacks: [
|
|
138
|
-
{
|
|
139
|
-
level: RecoveryVerbosity.Verbose,
|
|
140
|
-
attempt: 'title',
|
|
141
|
-
fn: (): Maybe<ComfyManagerPluginID> => plugin.title as ComfyManagerPluginInfo['title'],
|
|
142
|
-
},
|
|
143
|
-
{
|
|
144
|
-
attempt: 'github repo name',
|
|
145
|
-
fn: (): Maybe<string> => plugin.reference.match(githubRegexpV1)?.[2],
|
|
146
|
-
},
|
|
147
|
-
],
|
|
148
|
-
})
|
|
95
|
+
/**
|
|
96
|
+
* raw → canonical: recover the missing `id` (absent on ~76% of upstream rows)
|
|
97
|
+
* from the title, else the github repo name. null = unrecoverable, caller
|
|
98
|
+
* reports and skips the row.
|
|
99
|
+
*/
|
|
100
|
+
function normalizePluginInfo(p: ComfyManagerRawPluginInfo): ComfyManagerPluginInfo | null {
|
|
101
|
+
const id = p.id ?? p.title ?? p.reference.match(githubRegexpV1)?.[2]
|
|
102
|
+
if (id == null) return null
|
|
103
|
+
return { ...p, id }
|
|
149
104
|
}
|
|
@@ -1,125 +1,64 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { writeFileSync, readFileSync } from 'node:fs'
|
|
2
2
|
import { type } from 'arktype'
|
|
3
3
|
import { ansi as chalk } from 'src/utils/ansi.ts'
|
|
4
4
|
import { toQualifiedNodeKey } from 'src/sdk-generator/_toQualifiedNodeKey.ts'
|
|
5
|
-
import type { NodeNameInComfy } from 'src/sdk-generator/comfyui-types.ts'
|
|
6
5
|
import { githubRegexpV2 } from 'src/utils/githubRegexes.ts'
|
|
7
|
-
import { printArkResultInConsole } from 'src/utils/printArkResultInConsole.ts'
|
|
8
6
|
import type { ComfyRegistry } from 'src/manager/ComfyRegistry.ts'
|
|
9
7
|
import type { KnownComfyCustomNodeName } from 'src/manager/generated/KnownComfyCustomNodeName.ts'
|
|
10
8
|
import type { KnownComfyPluginURL } from 'src/manager/generated/KnownComfyPluginURL.ts'
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
ComfyManagerFilePluginContent_ark,
|
|
14
|
-
} from 'src/manager/types/ComfyManagerFilePluginContent.ts'
|
|
15
|
-
import type { ComfyManagerPluginContentMetadata } from 'src/manager/types/ComfyManagerPluginContentMetadata.ts'
|
|
9
|
+
import { ManagerParseError } from 'src/manager/loaders/parseReport.ts'
|
|
10
|
+
import { ComfyManagerExtensionNodeMapEntry_ark } from 'src/manager/types/ComfyManagerFilePluginContent.ts'
|
|
16
11
|
import type { ComfyManagerPluginInfo } from 'src/manager/types/ComfyManagerPluginInfo.ts'
|
|
17
12
|
|
|
18
13
|
export const _getCustomNodeRegistry = (DB: ComfyRegistry): void => {
|
|
14
|
+
const counter = DB.report.file('extension-node-map.json')
|
|
19
15
|
let totalCustomNodeSeen: number = 0
|
|
20
16
|
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
)
|
|
17
|
+
const raw: unknown = JSON.parse(readFileSync('src/manager/json/extension-node-map.json', 'utf8'))
|
|
18
|
+
const root = type('Record<string, unknown>')(raw)
|
|
19
|
+
if (root instanceof type.errors) throw new ManagerParseError('extension-node-map.json', root.summary)
|
|
25
20
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if (DB.opts.check) {
|
|
21
|
+
for (const [url, value] of Object.entries(root)) {
|
|
22
|
+
// row shape: [nodeNames, meta]
|
|
23
|
+
const res = ComfyManagerExtensionNodeMapEntry_ark(value)
|
|
30
24
|
if (res instanceof type.errors) {
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
counter.skip('schema', `${url}: ${res.summary}`)
|
|
26
|
+
continue
|
|
33
27
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
/** should be what we will received once the plugin in installed */
|
|
42
|
-
pythonModule: string
|
|
43
|
-
/** plugin that contains this url listed in files */
|
|
44
|
-
plugin: ComfyManagerPluginInfo
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const enmEntries: ComfyManagerFilePluginContent_asObject[] = Object.entries(extensionNodeMapFile).map(
|
|
48
|
-
(
|
|
49
|
-
x: [url: string, infos: [NodeNameInComfy[], ComfyManagerPluginContentMetadata]],
|
|
50
|
-
): ComfyManagerFilePluginContent_asObject => {
|
|
51
|
-
const url = x[0]
|
|
52
|
-
const [comfyNodeNames, meta] = x[1]
|
|
53
|
-
const confyPlugin = DB.plugins_byFile.get(url as KnownComfyPluginURL)
|
|
54
|
-
if (confyPlugin == null) throw new Error(`[❌] plugin not found for ${url}`)
|
|
55
|
-
return {
|
|
56
|
-
url,
|
|
57
|
-
comfyNodeNames,
|
|
58
|
-
meta,
|
|
59
|
-
plugin: confyPlugin,
|
|
60
|
-
pythonModule: reverseEngineerWhatComfyWillSendAsPythonModuleValueOnceInstalled(confyPlugin, url, meta),
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
)
|
|
28
|
+
// cross-reference: the url must be a file of a known plugin (upstream ships a few orphans)
|
|
29
|
+
const plugin = DB.plugins_byFile.get(url as KnownComfyPluginURL)
|
|
30
|
+
if (plugin == null) {
|
|
31
|
+
counter.skip('unknown-plugin-url', url)
|
|
32
|
+
continue
|
|
33
|
+
}
|
|
34
|
+
counter.ok()
|
|
64
35
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
totalCustomNodeSeen +=
|
|
68
|
-
|
|
69
|
-
// if (!hasErrors && DB.opts.check) {
|
|
70
|
-
// const valid = Value.Check(ComfyManagerPluginContentMetadata_typebox, enmEntry.meta)
|
|
71
|
-
// if (!valid) {
|
|
72
|
-
// const errors: ValueError[] = [
|
|
73
|
-
// ...Value.Errors(ComfyManagerPluginContentMetadata_typebox, enmEntry.meta),
|
|
74
|
-
// ]
|
|
75
|
-
// console.error(`❌ extensionNodeMap doesn't match schema:`, enmEntry.meta)
|
|
76
|
-
// // console.error(`❌ errors`, errors)
|
|
77
|
-
// for (const i of errors) console.log(`❌`, JSON.stringify(i))
|
|
78
|
-
// hasErrors = true
|
|
79
|
-
// }
|
|
80
|
-
// }
|
|
36
|
+
// meta (res[1]) is validated so drift stays visible, but consumed by nothing today
|
|
37
|
+
const comfyNodeNames = res[0]
|
|
38
|
+
totalCustomNodeSeen += comfyNodeNames.length
|
|
39
|
+
const pythonModule = reverseEngineerWhatComfyWillSendAsPythonModuleValueOnceInstalled(plugin)
|
|
81
40
|
|
|
82
|
-
//
|
|
83
|
-
const plugin = enmEntry.plugin
|
|
41
|
+
// ensure we have a list of nodes for this plugin
|
|
84
42
|
const nodesInPlugin: KnownComfyCustomNodeName[] = DB.customNodes_byPluginName.get(plugin.title) ?? []
|
|
85
43
|
DB.customNodes_byPluginName.set(plugin.title, nodesInPlugin)
|
|
86
44
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
// if (prevEntry1 == null) DB.plugins_byNodeNameInComfy.set(nodeNameInComfy, [plugin])
|
|
93
|
-
// else prevEntry1.push(plugin)
|
|
94
|
-
|
|
95
|
-
// 4.2 index by nodeKey
|
|
96
|
-
// const nodeKey = convertComfyNodeNameToCushyNodeNameValidInJS(nodeNameInComfy)
|
|
97
|
-
|
|
98
|
-
const nodeKey = toQualifiedNodeKey(enmEntry.pythonModule, nodeNameInComfy)
|
|
99
|
-
// console.log(`[🤠] nodeKey=`, JSON.stringify(nodeKey), enmEntry.pythonModule)
|
|
100
|
-
// process.exit(2)
|
|
101
|
-
const prevEntry2 = DB.plugins_byNodeKey.get(nodeKey)
|
|
102
|
-
if (prevEntry2 == null) DB.plugins_byNodeKey.set(nodeKey, [plugin])
|
|
103
|
-
else prevEntry2.push(plugin)
|
|
104
|
-
|
|
105
|
-
// 4.3. index the node in the plugin (file is only giving index by files...)
|
|
45
|
+
for (const nodeNameInComfy of comfyNodeNames) {
|
|
46
|
+
const nodeKey = toQualifiedNodeKey(pythonModule, nodeNameInComfy)
|
|
47
|
+
const prevEntry = DB.plugins_byNodeKey.get(nodeKey)
|
|
48
|
+
if (prevEntry == null) DB.plugins_byNodeKey.set(nodeKey, [plugin])
|
|
49
|
+
else prevEntry.push(plugin)
|
|
106
50
|
nodesInPlugin.push(nodeKey as KnownComfyCustomNodeName)
|
|
107
51
|
}
|
|
108
52
|
}
|
|
109
53
|
|
|
110
|
-
//
|
|
54
|
+
// CODEGEN ------------------------------------------------------------
|
|
111
55
|
if (DB.opts.genTypes) {
|
|
112
56
|
let out = ''
|
|
113
|
-
|
|
114
|
-
// NameInCushy
|
|
115
57
|
const allNodeKeys = [...DB.plugins_byNodeKey.keys()]
|
|
116
58
|
const sortedNodeKeys = allNodeKeys.sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase()))
|
|
117
59
|
out += '// prettier-ignore\n'
|
|
118
60
|
out += 'export type KnownComfyCustomNodeName =\n'
|
|
119
61
|
for (const nodeName of sortedNodeKeys) {
|
|
120
|
-
if (nodeName === 'sd_perturbed_attention.PerturbedAttention') {
|
|
121
|
-
console.log(`[🤠] 🔴`, DB.plugins_byNodeKey.get(nodeName))
|
|
122
|
-
}
|
|
123
62
|
out += ` | ${JSON.stringify(nodeName)}\n`
|
|
124
63
|
}
|
|
125
64
|
out += '\n'
|
|
@@ -129,61 +68,16 @@ export const _getCustomNodeRegistry = (DB: ComfyRegistry): void => {
|
|
|
129
68
|
console.log(` > generated: ${chalk.blue.underline(outPath)}`)
|
|
130
69
|
}
|
|
131
70
|
|
|
132
|
-
//
|
|
71
|
+
// INDEXING CHECKS ------------------------------------------------------------
|
|
133
72
|
if (DB.opts.check) {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
console.log(` - ${totalCustomNodeSeen} CustomNodes unique names processed`)
|
|
137
|
-
// console.log(`${CustomNodeURL.byNodeNameInComfy.size} CustomNodes registered in map`)
|
|
138
|
-
// if (totalPluginSeen !== CustomNodeURL.byNodeNameInComfy.size)
|
|
139
|
-
// console.log(`❌ some customNodes are either duplicated or have overlapping titles`)
|
|
140
|
-
|
|
141
|
-
// console.log(`${totalCustomNodeSeen} CustomNodes-File Seen`)
|
|
142
|
-
// console.log(`${CustomNodeURL.byNodeNameInCushy.size} CustomNodes-File registered in map`)
|
|
143
|
-
// if (totalCustomNodeSeen !== CustomNodeURL.byNodeNameInCushy.size)
|
|
144
|
-
// console.log(`❌ some customNodes are either duplicated or have overlapping files`)
|
|
145
|
-
|
|
146
|
-
// if (hasErrors) console.log(`❌ some CustomNodes don't match schema`)
|
|
147
|
-
// else console.log(`✅ all CustomNodes match schema`)
|
|
73
|
+
console.log(` - ${totalCustomNodeSeen} CustomNodes names processed`)
|
|
74
|
+
console.log(` - ${DB.plugins_byNodeKey.size} unique node keys registered in map`)
|
|
148
75
|
}
|
|
149
|
-
|
|
150
|
-
// return DB
|
|
151
76
|
}
|
|
152
77
|
|
|
153
|
-
|
|
154
|
-
// type CustomNodeURL_by_NodeNameInComfy = Map<NodeNameInComfy, KnownComfyPluginURL[]>
|
|
155
|
-
// type CustomNodeURL_by_NodeNameInCushy = Map<QualifiedNodeKey, KnownComfyPluginURL[]>
|
|
156
|
-
// type CustomNodes_by_PluginTitle = Map<KnownComfyPluginURL, QualifiedNodeKey[]>
|
|
157
|
-
|
|
158
|
-
// type CustomNodeRegistry = {
|
|
159
|
-
// byNodeNameInComfy: CustomNodeURL_by_NodeNameInComfy
|
|
160
|
-
// byNodeNameInCushy: CustomNodeURL_by_NodeNameInCushy
|
|
161
|
-
// byPluginName: CustomNodes_by_PluginTitle
|
|
162
|
-
// }
|
|
163
|
-
|
|
164
|
-
// let DB: Maybe<CustomNodeRegistry> = null // = knownCustomNodesFile.custom_nodes
|
|
165
|
-
|
|
166
|
-
function reverseEngineerWhatComfyWillSendAsPythonModuleValueOnceInstalled(
|
|
167
|
-
plugin: ComfyManagerPluginInfo,
|
|
168
|
-
_url: string,
|
|
169
|
-
_meta: ComfyManagerPluginContentMetadata,
|
|
170
|
-
): string {
|
|
78
|
+
function reverseEngineerWhatComfyWillSendAsPythonModuleValueOnceInstalled(plugin: ComfyManagerPluginInfo): string {
|
|
171
79
|
if (plugin.id === 'nodes' && plugin.reference === 'https://github.com/comfyanonymous/ComfyUI') return 'nodes'
|
|
172
|
-
|
|
173
|
-
// if (meta.pythonModule) {
|
|
174
|
-
// // console.log(`[🤠] got via pythonModule`, meta.pythonModule)
|
|
175
|
-
// return meta.pythonModule
|
|
176
|
-
// }
|
|
177
80
|
const repoName = plugin.reference.match(githubRegexpV2)?.[2]
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
// console.log(`[🤠] got via repoName`, plugin.reference, `custom_nodes.${repoName}`)
|
|
181
|
-
return `custom_nodes.${repoName}`
|
|
182
|
-
}
|
|
183
|
-
if (plugin.id) {
|
|
184
|
-
// console.log(`[🤠] got via repoName`, plugin.id, `custom_nodes.${plugin.id}`)
|
|
185
|
-
return `custom_nodes.${plugin.id}`
|
|
186
|
-
}
|
|
187
|
-
const pythonModule = '🔴'
|
|
188
|
-
return pythonModule
|
|
81
|
+
if (repoName) return `custom_nodes.${repoName}`
|
|
82
|
+
return `custom_nodes.${plugin.id}`
|
|
189
83
|
}
|
|
@@ -1,40 +1,35 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { readFileSync, writeFileSync } from 'node:fs'
|
|
2
|
+
import { type } from 'arktype'
|
|
2
3
|
import { ansi as chalk } from 'src/utils/ansi.ts'
|
|
3
|
-
// https://github.com/ltdrdata/ComfyUI-Manager/blob/main/model-list.json
|
|
4
|
-
import { readFileSync, writeFileSync } from 'fs'
|
|
5
|
-
import { printArkResultInConsole } from 'src/utils/printArkResultInConsole.ts'
|
|
6
4
|
import type { ComfyRegistry } from 'src/manager/ComfyRegistry.ts'
|
|
7
|
-
import type { KnownModel_Name } from 'src/manager/generated/KnownModel_Name.ts'
|
|
8
5
|
import { extraModels } from 'src/manager/json/model-list.extra.ts'
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
6
|
+
import { ManagerParseError } from 'src/manager/loaders/parseReport.ts'
|
|
7
|
+
import { ComfyManagerFileModelInfoRoot_ark } from 'src/manager/types/ComfyManagerFileModelInfo.ts'
|
|
8
|
+
import { type ComfyManagerModelInfo, ComfyManagerModelInfo_ark } from 'src/manager/types/ComfyManagerModelInfo.ts'
|
|
11
9
|
|
|
12
|
-
export const _getKnownModels = (
|
|
13
|
-
|
|
14
|
-
} */,
|
|
15
|
-
): void => {
|
|
16
|
-
const knownModelsFile: ComfyManagerFileModelInfo = JSON.parse(
|
|
17
|
-
readFileSync('src/manager/json/model-list.json', 'utf8'),
|
|
18
|
-
)
|
|
19
|
-
const knownModelList = knownModelsFile.models.concat(extraModels.models)
|
|
10
|
+
export const _getKnownModels = (DB: ComfyRegistry): void => {
|
|
11
|
+
const counter = DB.report.file('model-list.json')
|
|
20
12
|
|
|
21
|
-
|
|
13
|
+
const raw: unknown = JSON.parse(readFileSync('src/manager/json/model-list.json', 'utf8'))
|
|
14
|
+
const root = ComfyManagerFileModelInfoRoot_ark(raw)
|
|
15
|
+
if (root instanceof type.errors) throw new ManagerParseError('model-list.json', root.summary)
|
|
22
16
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const res = ComfyManagerModelInfo_ark(modelInfo)
|
|
30
|
-
if (res instanceof type.errors) {
|
|
31
|
-
const errors: ArkErrors = res
|
|
32
|
-
console.error(`❌ model doesn't match schema:`, modelInfo)
|
|
33
|
-
printArkResultInConsole(errors)
|
|
34
|
-
hasErrors = true
|
|
35
|
-
// debugger
|
|
36
|
-
}
|
|
17
|
+
const canonical: ComfyManagerModelInfo[] = []
|
|
18
|
+
for (const row of root.models) {
|
|
19
|
+
const res = ComfyManagerModelInfo_ark(row)
|
|
20
|
+
if (res instanceof type.errors) {
|
|
21
|
+
counter.skip('schema', res.summary)
|
|
22
|
+
continue
|
|
37
23
|
}
|
|
24
|
+
canonical.push(res)
|
|
25
|
+
counter.ok()
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// hand-maintained extras are compile-checked canonical rows, not upstream data: no counting
|
|
29
|
+
const knownModelList = canonical.concat(extraModels.models)
|
|
30
|
+
|
|
31
|
+
for (const modelInfo of knownModelList) {
|
|
32
|
+
DB.knownModels.set(modelInfo.name, modelInfo)
|
|
38
33
|
}
|
|
39
34
|
|
|
40
35
|
// CODEGEN ------------------------------------------------------------
|
|
@@ -145,15 +140,9 @@ export const _getKnownModels = (
|
|
|
145
140
|
|
|
146
141
|
// INDEXING CHECKS ------------------------------------------------------------
|
|
147
142
|
if (DB.opts.check) {
|
|
148
|
-
//
|
|
149
143
|
console.log(`${knownModelList.length} models found`)
|
|
150
144
|
console.log(`${DB.knownModels.size} models registered map`)
|
|
151
145
|
if (knownModelList.length !== DB.knownModels.size)
|
|
152
146
|
console.log(`❌ some models are either duplicated or have overlapping indexing keys`)
|
|
153
|
-
//
|
|
154
|
-
if (hasErrors) console.log(`❌ some models don't match schema`)
|
|
155
|
-
else console.log(`✅ all models match schema`)
|
|
156
147
|
}
|
|
157
|
-
|
|
158
|
-
// return DB.knownModels
|
|
159
148
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs'
|
|
2
|
+
import { type } from 'arktype'
|
|
3
|
+
import type { ComfyRegistry } from 'src/manager/ComfyRegistry.ts'
|
|
4
|
+
import { ManagerParseError } from 'src/manager/loaders/parseReport.ts'
|
|
5
|
+
import {
|
|
6
|
+
type ComfyManagerAlterInfo,
|
|
7
|
+
ComfyManagerAlterInfo_ark,
|
|
8
|
+
ComfyManagerFileAlterListRoot_ark,
|
|
9
|
+
} from 'src/manager/types/ComfyManagerAlterInfo.ts'
|
|
10
|
+
|
|
11
|
+
export const _getAlterList = (DB: ComfyRegistry): void => {
|
|
12
|
+
const counter = DB.report.file('alter-list.json')
|
|
13
|
+
|
|
14
|
+
const raw: unknown = JSON.parse(readFileSync('src/manager/json/alter-list.json', 'utf8'))
|
|
15
|
+
const root = ComfyManagerFileAlterListRoot_ark(raw)
|
|
16
|
+
if (root instanceof type.errors) throw new ManagerParseError('alter-list.json', root.summary)
|
|
17
|
+
|
|
18
|
+
const canonical: ComfyManagerAlterInfo[] = []
|
|
19
|
+
for (const row of root.items) {
|
|
20
|
+
const res = ComfyManagerAlterInfo_ark(row)
|
|
21
|
+
if (res instanceof type.errors) {
|
|
22
|
+
counter.skip('schema', res.summary)
|
|
23
|
+
continue
|
|
24
|
+
}
|
|
25
|
+
canonical.push(res)
|
|
26
|
+
counter.ok()
|
|
27
|
+
}
|
|
28
|
+
DB.alterations = canonical
|
|
29
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs'
|
|
2
|
+
import { type } from 'arktype'
|
|
3
|
+
import type { ComfyRegistry } from 'src/manager/ComfyRegistry.ts'
|
|
4
|
+
import { ManagerParseError } from 'src/manager/loaders/parseReport.ts'
|
|
5
|
+
import { ComfyManagerGithubStatEntry_ark } from 'src/manager/types/ComfyManagerGithubStats.ts'
|
|
6
|
+
|
|
7
|
+
export const _getGithubStats = (DB: ComfyRegistry): void => {
|
|
8
|
+
const counter = DB.report.file('github-stats.json')
|
|
9
|
+
|
|
10
|
+
const raw: unknown = JSON.parse(readFileSync('src/manager/json/github-stats.json', 'utf8'))
|
|
11
|
+
const root = type('Record<string, unknown>')(raw)
|
|
12
|
+
if (root instanceof type.errors) throw new ManagerParseError('github-stats.json', root.summary)
|
|
13
|
+
|
|
14
|
+
for (const [url, value] of Object.entries(root)) {
|
|
15
|
+
const res = ComfyManagerGithubStatEntry_ark(value)
|
|
16
|
+
if (res instanceof type.errors) {
|
|
17
|
+
counter.skip('schema', `${url}: ${res.summary}`)
|
|
18
|
+
continue
|
|
19
|
+
}
|
|
20
|
+
DB.githubStats.set(url, res)
|
|
21
|
+
counter.ok()
|
|
22
|
+
}
|
|
23
|
+
}
|