* feat(kb-editor): web KB editor with live validation & atomic saves (#33) Closes #123, #124, #125, #126. - Backend API + transport-independent handlers under /scene-compiler/kb, registered from the package init and guarded so it no-ops without ComfyUI. - Static self-contained web page (list/search/filter/create/edit/delete) with live validation and save blocking on errors. - Validation reuses kb_validation (new validate_entry / validate_cross_entry) as the single source of truth, against the candidate and the whole-KB state. - Atomic (temp+fsync+rename), format-safe saves: only the edited entry changes, key order and trailing newline preserved, curated-vs-generated split respected. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * fix(kb-editor): associate form labels with inputs; await load (SonarCloud a11y) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * fix(kb-editor): label sidebar controls; async IIFE for init (SonarCloud) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: kunail0804 <kunail0804@gmail.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
39 lines
1.6 KiB
Python
39 lines
1.6 KiB
Python
"""ComfyUI Scene Compiler — ComfyUI custom node entry point.
|
|
|
|
ComfyUI loads this module by path and reads ``NODE_CLASS_MAPPINGS`` /
|
|
``NODE_DISPLAY_NAME_MAPPINGS`` to register the compiler's nodes. The mappings are
|
|
aggregated in the ``nodes`` package; the compiler logic lives entirely in the
|
|
``compiler`` package, which never imports ComfyUI.
|
|
|
|
The ``compiler`` and ``schemas`` packages are imported by their top-level names,
|
|
so this entry point puts the repository root on ``sys.path`` when ComfyUI loads it
|
|
by file path. The ``nodes`` package is only ever imported relative to this
|
|
package (never as a top-level ``nodes``), so it does not collide with ComfyUI's
|
|
own core ``nodes`` module.
|
|
"""
|
|
|
|
import os
|
|
import sys
|
|
|
|
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
try:
|
|
# ComfyUI loads this file inside a package, so the relative import resolves.
|
|
from .nodes import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
|
|
except ImportError:
|
|
# Imported standalone (e.g. by the test runner): fall back to the top-level
|
|
# package that is on sys.path.
|
|
from nodes import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
|
|
|
|
# Register the optional Knowledge Base Editor web routes on the ComfyUI server.
|
|
# Guarded so it is a harmless no-op when ComfyUI/PromptServer is absent (tests,
|
|
# standalone imports); the compiler never depends on the editor.
|
|
try:
|
|
from nodes.kb_editor.routes import register_routes
|
|
|
|
register_routes()
|
|
except Exception: # pragma: no cover - defensive: never break node loading
|
|
pass
|
|
|
|
__all__ = ["NODE_CLASS_MAPPINGS", "NODE_DISPLAY_NAME_MAPPINGS"]
|