4.0 KiB
4.0 KiB
ComfyUI Integration Audit
Date: 2026-05-26
Upstream Sources Checked
Comfy-Org/ComfyUI- Custom node example confirms
WEB_DIRECTORYis still the runtime contract for frontend extension assets. - The current core repository hosts compiled frontend assets under
web/, while frontend sources live separately.
- Custom node example confirms
Comfy-Org/ComfyUI_frontend- The official frontend is TypeScript/Vue-based.
- Extension APIs include
app.registerExtension, sidebar tabs, commands, keybindings, settings, toast, and desktop-safe dialogs. - Settings should prefer
app.registerExtension({ settings: [...] })plusapp.extensionManager.setting.get(...), with legacyapp.ui.settingsonly as fallback.
Comfy-Org/ComfyUI-Manager- Custom node packages should not assume their folder name.
- Manager and registry workflows expect reproducible package metadata and install-time scripts from the package root.
Comfy-Org/desktop- Desktop runs ComfyUI in an Electron environment, so browser-only APIs need ComfyUI dialog/toast fallbacks.
Current Repository Findings
- The extension intentionally exposes no ComfyUI nodes.
__init__.pykeepsWEB_DIRECTORY = "./web/js", matching the current ComfyUI custom-node docs.- The frontend was previously maintained directly as browser JavaScript in legacy
js/. - UI code already uses ComfyUI sidebar registration when available and a floating fallback for older versions.
- Dialog helpers already prefer
app.extensionManager.dialogbefore browser prompt/confirm, which is aligned with desktop guidance. - Toast helpers already prefer
app.extensionManager.toast. - Settings registration used the legacy
app.ui.settings.addSettingpath only.
Changes Made
- Added TypeScript source tree under
src/. - Kept generated runtime modules under
web/js/so ComfyUI loading remains aligned with current custom-node docs. - Added
package.json,package-lock.json, andtsconfig.json. - Added local ComfyUI module declarations in
src/types/comfyui.d.ts. - Added build scripts:
npm run buildnpm run typecheck
- Migrated all previous legacy
js/**/*.jssource files tosrc/**/*.ts. - Rebuilt
web/js/**/*.jsfrom TypeScript. - Added modern ComfyUI settings integration through
app.registerExtension({ settings: [...] }). - Kept a legacy
app.ui.settings.addSettingfallback for older ComfyUI versions. - Updated setting reads to prefer
app.extensionManager.setting.get(...).
Vue Decision
Vue was not introduced in this pass.
Reason: ComfyUI frontend itself uses Vue internally, but custom node frontend assets are still loaded through WEB_DIRECTORY as extension modules. This repository already has a large DOM-built UI and no existing bundler. Introducing Vue would require bundling, dependency packaging, and lifecycle glue without improving compatibility immediately.
Recommended next step if Vue is desired:
- Split the Project Settings panel into small UI domains first.
- Add a Vite/Vue build only after confirming the generated bundle loads cleanly from
WEB_DIRECTORY. - Keep the ComfyUI extension entry as a thin adapter around
app.registerExtension.
Remaining Risks
- TypeScript currently builds with
noCheck: truebecause the old JavaScript is highly dynamic and depends on untyped ComfyUI internals. - Generated
.d.tsfiles are emitted for future typing work but are not consumed by ComfyUI. - Full browser verification inside ComfyUI is still required after this migration.
- The UI is still large and imperative; future refactors should target typed API payloads and smaller panel modules before changing framework.
Recommended Next Refactors
- Add shared TypeScript types for project state, API responses, missing-model scan results, and graph widget shapes.
- Tighten
tsconfig.jsongradually by removingnoCheckmodule by module. - Move repeated DOM helpers out of
ui_components.ts. - Consider registering commands/keybindings through ComfyUI's command/keybinding API instead of a raw capture-phase
keydownlistener forCtrl+S. - Add Manager/registry metadata once package publishing is planned.