apply_node_patch
Apply a unified diff to custom node source files with two-phase validation, enabling precise edits to node packs found via search.
Instructions
Apply a unified diff to custom-node source under custom_nodes/. Every touched path is jail-checked BEFORE any git call, then the patch is validated with git apply --check and only applied if the check passes (two-phase; never uses --unsafe-paths). Paths are relative to custom_nodes/ and may carry a/ b/ prefixes; works on non-repo packs too. Ideal for surgical edits located via search_node_packs. LOCAL-ONLY (requires COMFYUI_PATH).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| patch | Yes | A unified diff. File headers (---/+++) are read to determine touched paths, which must resolve inside custom_nodes/ (e.g. 'a/MyPack/nodes.py'). |