3.8 KiB
3.8 KiB
Adding a polished node
New public nodes are admitted deliberately. Start with the workflow problem and contract, not a prototype file.
Contract first
Record the following before writing code:
- Purpose and repeated workflow it replaces
- Permanent
AUSBOSS_NODES_<Purpose>mapping key - Display name and
🆎 AusBoss/<Group>category - Required/optional input IDs in serialization order, types, defaults, limits, and tooltips
- Output names, types, and order
- Tensor shapes, batch behavior, caching, errors, side effects, and API-mode behavior
- Compatibility or migration behavior
Every visible field and output must earn its place. Published IDs, input order, widget meaning, and output order are API.
Implement narrowly
- Put independently testable processing in an underscore-prefixed helper under
nodes/. - Add one V1 wrapper in
nodes/node_<purpose>.pywithINPUT_TYPES,RETURN_TYPES,FUNCTION,CATEGORY, and both mapping dictionaries — keys as string literals, never aNODE_IDvariable, or registry scanners cannot see the node. - Add the module to
NODE_MODULESin__init__.pyand the key toPUBLIC_NODE_IDSinscripts/validate_nodes.py; the validator fails on a registered key it does not know. A key kept only so old workflows load goes inLEGACY_NODE_IDSinstead. - Give the node its face. Any INT, FLOAT, BOOLEAN, COMBO or STRING widget on a public node is shown through a widget card entry in
js/widget_cards/index.js(see AGENTS.md §Conventions: numbers scrub, booleans are off | on pills, one linkable widget per row,top: trueorforceInputfor values people wire). Write more frontend JavaScript only when the card grammar cannot provide the interaction (a stage, a player, an editor). - Namespace every route, extension, event, DOM marker, CSS class, cache, and browser state with
ausboss. - Chain lifecycle hooks through
chainCallback; never replace core or third-party prototypes directly. - Keep normal workflow and API execution independent from the custom frontend.
- Ship user-facing toggles as ComfyUI settings under the
AusBoss.*namespace. Node coloring is automatic forAUSBOSS_NODES_*classes viajs/appearance/— no per-node work.
Document and prove
- Add rich help at
js/docs/<exact-mapping-key>.md(the validator checks it exists) and a section inREADME.md. Name card controls the way the node face shows them, with the widget name alongside: Tone match (color_match). - Show the node in an example under
example_workflows/, a new one or an existing one it fits: a Workflow Note, numbered groups holding every node, no overlaps, and a matching.jpgof a real output. AGENTS.md § Example workflows lists the rest. - A DOM panel goes into
tests/panel_guards.test.mjsasmustGroworfixedByDesign. - At the next release, name the node in the pyproject
description: Registry and Manager search read it. - Extend
scripts/validate_nodes.pywhen the new contract needs a permanent assertion. - Add the node to the API snapshot:
AUSBOSS_COMFY_ROOT=<ComfyUI> python tests/test_node_api.py --updatewith ComfyUI's Python. From then on its inputs and outputs may only be appended. - Add pure Python and dependency-free JavaScript tests.
- Compile with ComfyUI's embedded Python.
- Verify
/object_info/<mapping-key>, ownership, served assets, routes, API execution, and queued dimensions/masks. - Test the actual canvas in Classic and Nodes 2.0, including save/reload, duplication, graph zoom, source replacement, and teardown. Drag a real link onto every card row and socket and look at where it lands (
docs/live_testing.md). - Scan the diff for paths, hosts, secrets, placeholders and non-ASCII import output.
Do not release a node that only works in the editor, only works for one source, or returns debugging outputs users do not need.