From 0316ccf464835e9b24bbc33816d74a664e182a90 Mon Sep 17 00:00:00 2001 From: nomadoor <124905471+nomadoor@users.noreply.github.com> Date: Sun, 8 Nov 2026 08:39:38 +0900 Subject: [PATCH 1/6] Next release: rails lower next to their target across columns; one-move check leaves sources columns alone --- CHANGELOG.md | 6 +++ .../comfyui-readable-node/scripts/canvas.py | 44 ++++++++++++++----- tests/test_canvas.py | 24 ++++++++++ 3 files changed, 63 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 802bbc8..932ead6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## Unreleased (the version number is set when it is published) + +- A rail with one target lowers through a Reroute next to the target whenever another column stands between; the canvas no longer wires it straight from the raising Reroute, which its own check called Bad. +- "A slanted wire one move makes horizontal" no longer counts a move that takes a sampler's column of sources along (a stage's chain on the row below stays there). +- LATENT_UPSCALE_MODEL counts as a tool wire, not one a node works on. + ## 0.0.5 (2026-11-08) Layout came out worse in 0.0.4: rules lost while untangling sentences, and the canvas telling the agent fixes it could not make. This puts them back and makes the canvas and the rules agree. diff --git a/skills/comfyui-readable-node/scripts/canvas.py b/skills/comfyui-readable-node/scripts/canvas.py index 71b88c8..80fa1f2 100644 --- a/skills/comfyui-readable-node/scripts/canvas.py +++ b/skills/comfyui-readable-node/scripts/canvas.py @@ -1734,12 +1734,23 @@ def _quick_bad(cv): {x for x in _chk_backward(cv, c) if x.startswith("backward wire (cannot be kept")} +def takes_a_sources_column(cv, ids): + """Whether ids hold two or more nodes wired straight into one sampler: moving them moves that sampler's column of + sources, which its form places (readable-form.md, section 1), not one node at the end of a wire.""" + fed = {} + for l in cv.s["links"]: + t = cv.node(l["target_id"]) + if l["origin_id"] in ids and t and is_sampler(t): + fed.setdefault(t["id"], set()).add(l["origin_id"]) + return any(len(v) >= 2 for v in fed.values()) + + def one_move_levels(cv): """readable-form.md, Wires, Bad: "a slanted wire that becomes horizontal by moving the node at one end, without slanting another wire". Counted exactly: that node moves (with the nodes wired level to it, so no horizontal wire is slanted), lands on no node or Reroute. A Save or Preview stepped down below the wire passing on (a staircase), - the side inputs of SamplerCustomAdvanced, a loader's wires, a node in a sources column and a move that would take a - sampler along are left out. [(wire, ids that move, dy, node moved first)].""" + the side inputs of SamplerCustomAdvanced, a loader's wires, a node in a sources column, a move that would take a + sampler along and one that would take a sampler's column of sources along are left out. [(wire, ids that move, dy, node moved first)].""" nodes = cv.nodes solid = [m for m in cv.s["nodes"] if cv.placed(m) and m.get("type") != "Reroute" and m.get("type") not in NOTE_TYPES] pairs = horizontal_pairs(cv) @@ -1766,7 +1777,8 @@ def one_move_levels(cv): # a node stacked with another source of a node it feeds stands in that node's sources column (`inputs`): # moving it alone breaks the column mv = move_closure(cv, solid, {start}, d, {other}, pairs) - if mv and not any(is_sampler(nodes[i]) for i in mv) and not lands_on_reroute(cv, mv, d): + if mv and not any(is_sampler(nodes[i]) for i in mv) and not lands_on_reroute(cv, mv, d) \ + and not takes_a_sources_column(cv, mv): # the sampler fixes the band: it does not move for a side wire; and the move makes no other Bad form bad = _quick_bad(cv) if _try_move(cv, mv, d, lambda: _quick_bad(cv) <= bad): @@ -2541,7 +2553,10 @@ def _chk_consecutive_reroute(cv, c): direct = all(cv.placed(nodes.get(e, {})) and not any( G.wire_hits(G.spline(a0, cv.in_xy(e, ei)), G.rect(m)) for m in cv.s["nodes"] if cv.placed(m) and m["id"] != e and m.get("type") != "Reroute") for e, ei in ends) - if direct and not any(rect_overlap(G.rect(m), band) for m in cv.s["nodes"] if cv.placed(m) and m["id"] not in (n["id"], t["id"])): + # across other columns the rail lowers next to its target (rail targets off the rail): both are needed + across = any(nodes.get(e) and columns_between(cv, G.rect(n), nodes[e]) for e, _ in ends) + if direct and not across and not any(rect_overlap(G.rect(m), band) for m in cv.s["nodes"] + if cv.placed(m) and m["id"] not in (n["id"], t["id"])): out.append(f"consecutive Reroutes ({n['id']} leads straight into {t['id']}; one is enough): {n['id']} → {t['id']}") return out @@ -2770,6 +2785,14 @@ def _chk_idle_reroute(cv, c): return out +def columns_between(cv, r, t): + """Whether a node (not a Reroute or a Note) stands between rect r (a rail Reroute) and target t: then the rail lowers + into t through a Reroute in the column just left of it (readable-form.md, Wires), not with one long slanted wire.""" + rt = G.rect(t) + return any(cv.placed(m) and m.get("type") not in {"Reroute"} | NOTE_TYPES and m is not t + and G.rect(m)[0] >= r[2] and G.rect(m)[2] <= rt[0] for m in cv.s["nodes"]) + + @check_rule("rail targets off the rail") def _chk_rail_target_off_rail(cv, c): # a rail target wired straight from a rail Reroute far to its left, at another height: the rail ends in a long slanted @@ -2782,11 +2805,8 @@ def _chk_rail_target_off_rail(cv, c): if not o or not t or o.get("type") != "Reroute" or t.get("type") == "Reroute" or not cv.placed(o) or not cv.placed(t): continue a, b = cv.out_xy(o["id"], 0), cv.in_xy(t["id"], l["target_input"]) - ro, rt = G.rect(o), G.rect(t) - # a lowering Reroute stands in the column just left of its target: no node stands between them - between = any(cv.placed(m) and m.get("type") not in {"Reroute"} | NOTE_TYPES and m is not t - and G.rect(m)[0] >= ro[2] and G.rect(m)[2] <= rt[0] for m in cv.s["nodes"]) - if abs(a[1] - b[1]) >= 1 and between: + ro = G.rect(o) + if abs(a[1] - b[1]) >= 1 and columns_between(cv, ro, t): out.append(f"rail target without a lowering Reroute ({round(b[0] - a[0])}px across, {round(b[1] - a[1])}px down): " f"{o['id']} → {lname(cv, l)}") return out @@ -3300,7 +3320,7 @@ def _behind_save_into_output(cv, line): return bool(t and b) and is_output_node(cv, t) and "Preview" not in (b.get("type") or "") -REFERENCE_TYPES = {"MODEL", "CLIP", "VAE", "CLIP_VISION", "CONTROL_NET", "UPSCALE_MODEL", "STYLE_MODEL", "GLIGEN", +REFERENCE_TYPES = {"MODEL", "CLIP", "VAE", "CLIP_VISION", "CONTROL_NET", "UPSCALE_MODEL", "LATENT_UPSCALE_MODEL", "STYLE_MODEL", "GLIGEN", "MODEL_PATCH", "INTERP_MODEL", "BBOX_DETECTOR", "SEGM_DETECTOR", "SAM_MODEL", "NOISE", "SAMPLER", "SIGMAS", "GUIDER", "INT", "FLOAT", "STRING", "BOOLEAN", "MASK"} @@ -7643,8 +7663,10 @@ def direct_ok(tid, tin, src=None): continue # a rail into one target after its raising Reroute: when a wire from that Reroute reaches the target passing behind # no node, a lowering Reroute would follow it straight, which the rules call Bad (consecutive Reroutes: one is enough) + # Only when no column stands between that Reroute and the target: across columns the rail lowers next to it if (prev[0] != oid and not lowered and (x0, tid, tin) == tg[-1] and direct_ok(tid, tin, prev[0]) - and not any(t2 == tid for _, t2, _ in tg[:-1])): + and not any(t2 == tid for _, t2, _ in tg[:-1]) + and not columns_between(cv, G.rect(cv.node(prev[0])), cv.node(tid))): cv.add_link(prev[0], prev[1], tid, tin) continue # the lowering Reroute stays in the column left of the target (same column), also below a node that grows: it is diff --git a/tests/test_canvas.py b/tests/test_canvas.py index abc1b2a..4feeb10 100644 --- a/tests/test_canvas.py +++ b/tests/test_canvas.py @@ -1129,6 +1129,30 @@ def test_a_curve_bulging_into_the_node_above_its_target_is_not_a_wire_behind(sel self.assertIn((l["id"], "9"), [(x["id"], nid) for x, nid in C.hidden_wires(cv)]) self.assertFalse([x for x in C.full_check(cv)[0] if "passes behind 9" in x]) + def test_a_one_target_rail_across_columns_lowers_next_to_its_target(self): + # a rail with one target and another column between its raising Reroute and the target: the rail lowers through + # a Reroute next to the target (not one long slanted wire), and the two Reroutes are not "consecutive" + # (FluxGuidance stands low between them, so a wire from the raising Reroute would pass behind nothing) + plan = ["put 13 origin", "put 26 right 13 top", "move 26 0 700", "put 8 right 26 top", "align top 13 8 move 8", + "put 10 left 13", "rail 10.0 above 13 to 8.vae"] + self.do(f"layout {self.write_plan(chr(10).join(plan))}") + cv = self.cv() + self.assertEqual(len([n for n in cv.s["nodes"] if n.get("type") == "Reroute"]), 2) + lines = C.full_check(cv)[0] + self.assertFalse([x for x in lines if "rail target without a lowering Reroute" in x or "consecutive Reroutes" in x]) + + def test_a_move_taking_a_sampler_s_sources_column_is_not_one_move(self): + # a wire into a node stacked with the guider and the sigmas of a SamplerCustomAdvanced (they stand level to it): + # making it horizontal would move the sampler's column of sources, so the check does not name it + self.do("copy 16 17 25") + self.do("link 25.0 13.noise 16.0 13.sampler 17.0 13.sigmas") + plan = ["put 13 origin", "inputs 13", "put 26 left 22 wire", "put 8 right 13 wire"] + self.do(f"layout {self.write_plan(chr(10).join(plan))}") + cv = self.cv() + for l, mv, d, start in C.one_move_levels(cv): + self.assertFalse(C.takes_a_sources_column(cv, mv)) + self.assertTrue(C.takes_a_sources_column(cv, {"22", "17"})) + def test_widening_a_column_keeps_a_wide_gap(self): # as above, with `gap wide` between the columns: the gap stays wide plan = ["put 22 origin", "put 26 below 22 left", "put 13 right 22 gap wide"] From ac373ba8695415c9885633a311c5fa51c4d9dbf0 Mon Sep 17 00:00:00 2001 From: nomadoor <124905471+nomadoor@users.noreply.github.com> Date: Sun, 8 Nov 2026 09:16:18 +0900 Subject: [PATCH 2/6] Next release: left-aligned columns are Bad; rails keep V_GAP from nodes --- .../comfyui-readable-node/scripts/canvas.py | 64 ++++++++++++++++++- tests/test_canvas.py | 11 ++++ tests/test_check_fixes.py | 11 ++++ 3 files changed, 83 insertions(+), 3 deletions(-) diff --git a/skills/comfyui-readable-node/scripts/canvas.py b/skills/comfyui-readable-node/scripts/canvas.py index 80fa1f2..578e2b1 100644 --- a/skills/comfyui-readable-node/scripts/canvas.py +++ b/skills/comfyui-readable-node/scripts/canvas.py @@ -1997,7 +1997,13 @@ def _chk_width_and_value_tops(cv, c): # rows that merely stand one above the other are not a column aligned = abs(ra[2] - rb[2]) < 1 or abs(ra[0] - rb[0]) < 1 if 0 <= gap_v <= V_GAP + 1 and not (cv.is_model_loader(a) and cv.is_model_loader(b)): - if aligned and 1 <= dw < SAME_WIDTH_UNDER: + if abs(ra[0] - rb[0]) < 1 and abs(ra[2] - rb[2]) >= 1 and not any( + cv.is_loader(x) and is_sampler(y) for x, y in ((a, b), (b, a))): + # written with `left`: a column aligns its right edges. A loader above a sampler keeps the + # sampler's left edge (Load VAE above the sampler) + out.append(f"stacked nodes aligned on their left edges, not their right ({round(abs(ra[2] - rb[2]))}px): " + f"{a['id']} and {b['id']} (place the lower one with put … below the other, right edges aligned)") + elif aligned and 1 <= dw < SAME_WIDTH_UNDER: out.append(f"stacked nodes differ in width by {round(dw)}px: the canvas gives a column one width, but a node " f"next to one is in the way of widening it: {a['id']} and {b['id']}") elif not aligned: @@ -2793,6 +2799,36 @@ def columns_between(cv, r, t): and G.rect(m)[0] >= r[2] and G.rect(m)[2] <= rt[0] for m in cv.s["nodes"]) +@check_rule("rails too close to a node") +def _chk_rail_near_node(cv, c): + """A rail's line running over or under a node closer than V_GAP: as far as a rail written above or below a unit + stands from it (readable-form.md, Wires show and nothing is packed). Its Reroutes sit on the line, so the line is + what is measured.""" + out, seen = [], set() + spans = list(rail_spans(cv)) + # the piece from a source at the rail's height into its first Reroute is the rail too + for l in cv.s["links"]: + o, t = cv.node(l["origin_id"]), cv.node(l["target_id"]) + if o and t and o.get("type") != "Reroute" and t.get("type") == "Reroute" and cv.placed(o) and cv.placed(t): + a, b = cv.out_xy(o["id"], l["origin_slot"]), cv.in_xy(t["id"], "") + if a and b and abs(a[1] - b[1]) < 1: + spans.append((a[1], a[0], b[0], (o["id"], l["origin_slot"]))) + for y, x0, x1, (root, _slot) in spans: + for m in cv.s["nodes"]: + if not cv.placed(m) or m.get("type") in {"Reroute"} | NOTE_TYPES or m["id"] == root: + continue + r = G.rect(m) + if min(r[2], x1) <= max(r[0], x0): + continue + d = r[1] - y if y <= r[1] else y - r[3] if y >= r[3] else None + if d is not None and d < V_GAP - 0.5 and (root, m["id"]) not in seen: + seen.add((root, m["id"])) + out.append(f"rail too close to a node ({round(d)}px {'above' if y <= r[1] else 'below'} it, min {V_GAP}): " + f"the rail of {root} and {m['id']} (write the rail's height so it clears the node, or place " + f"the node off the rail)") + return out + + @check_rule("rail targets off the rail") def _chk_rail_target_off_rail(cv, c): # a rail target wired straight from a rail Reroute far to its left, at another height: the rail ends in a long slanted @@ -3501,9 +3537,11 @@ def _chk_one_line_text(cv, c): # audio latents: a liking, not the form to write "main flow off its line": lambda cv, l: True, "rail targets off the rail": lambda cv, l: True, + "rails too close to a node": lambda cv, l: True, "crossings in a gap between columns": lambda cv, l: True, "rail heads away from their rail": lambda cv, l: True, "output nodes stepped where the flow ends": lambda cv, l: True, + "width differences and value node tops": lambda cv, l: l.startswith("stacked nodes aligned on their left edges"), "core nodes the replacement list replaces": lambda cv, l: True, "custom nodes the replacement list turns into core": lambda cv, l: True, } @@ -6912,14 +6950,15 @@ def violations(lines, how="fix them in the plan"): (("groups overlap", "wire over the title", "node over the title", "node overlapping group"), "A group holds one large function"), (("loader is above the model loader",), "A loader stands in the column left"), - (("stacked nodes differ in width", "stacked nodes with right edges"), "Nodes stacked in one column"), + (("stacked nodes differ in width", "stacked nodes with right edges", "stacked nodes aligned on their left"), + "Nodes stacked in one column"), (("rail order differs", "rail runs above the", "loader rail runs below", "stacked loaders differ"), "A wire is drawn directly"), # its rail line holds the order (("loader away from its first user", "vae loader"), "A loader stands in the column left"), (("model chain end",), "The model chain ends in the column"), (("right edges of the sources",), "The sources wired straight into a sampler"), (("overlap:", "is directly below"), "No node is hidden"), - (("narrow gap", "empty band", "gap inside a column", "wide gap to a wired neighbour", "uneven spacing", + (("narrow gap", "rail too close to a node", "empty band", "gap inside a column", "wide gap to a wired neighbour", "uneven spacing", "times in the gap"), "Wires show and nothing is packed"), (("output node stepped down",), "An output node (Save, Preview"), (("wire behind a node", "Reroute", "single value carried", "rail needs no raising", "rails too close", @@ -7093,6 +7132,10 @@ def overlap(i, j): for j in seq[a + 1:]: if overlap(i, j) and rank[i] < rank[j]: y = min(y, lanes[j][0] - gap) + # the node heading rail j at its height: rail i clears its top by V_GAP (as `rail … above `) + h = G.rect(cv.node(lanes[j][1])) + if abs(cv.out_xy(lanes[j][1], lanes[j][2])[1] - lanes[j][0]) < 1 and min(h[2], ext[i][1]) > max(h[0], ext[i][0]): + y = min(y, h[1] - V_GAP) moved = abs(y - before[i]) >= 1 for j in seq[a + 1:]: if overlap(i, j) and rank[i] == rank[j] and (moved or abs(lanes[j][0] - before[j]) >= 1) and y > lanes[j][0] - gap: @@ -7433,6 +7476,16 @@ def span(i): x0 = min(x0, u[3][0]) return x0, x1 + def head_box(i): + """The box of the node heading rail i where it stands at the rail's height (moved with it, or never lifted).""" + u = unit_of.get(i) + if u is not None: + b, sh = u[3], shift(u) + return (b[0], b[1] + sh, b[2], b[3] + sh) + if abs(lanes[i][0] - out_y0[i]) < 1: + return G.rect(cv.node(lanes[i][1])) + return None + def raise_by(i, d): u = unit_of.get(i) for m in (u[2] if u else [i]): @@ -7460,6 +7513,11 @@ def raise_by(i, d): d = lanes[lo][0] - P["RAIL_GAP"] - (u[3][3] + shift(u)) else: d = lanes[lo][0] - gap - lanes[up][0] + # the node heading the rail below stands at that rail's height: the rail above clears its top as a + # rail written above a unit does (V_GAP), not only that rail's line + hd = head_box(lo) + if hd is not None and min(hd[2], a1) > max(hd[0], a0): + d = min(d, hd[1] - V_GAP - lanes[up][0]) if d >= -0.5: continue _, oid, slot, _t = lanes[up] diff --git a/tests/test_canvas.py b/tests/test_canvas.py index 4feeb10..9c4b609 100644 --- a/tests/test_canvas.py +++ b/tests/test_canvas.py @@ -328,6 +328,17 @@ def test_layout_rail_move_keeps_the_rail_order(self): self.assertLess(cv.out_xy("12", 0)[1] + C.P["RAIL_GAP"] - 0.5, cv.out_xy("10", 0)[1]) self.assertFalse([x for x in C.full_check(cv)[0] if "runs above the MODEL rail" in x or "raising Reroute right of a loader" in x and ": 10" in x]) + def test_a_rail_pushed_above_a_loader_heading_the_rail_below_clears_its_top(self): + # Load VAE above the sampler heads the vae rail at its height; the model rail, pushed above the vae rail by the + # type order, also clears Load VAE's top by V_GAP (as a rail written above a unit), not only the vae rail's line + plan = ("put 13 origin\nput 8 right 13 wire\nput 22 right 8\nput 30 left 13\nput 12 left 30\n" + "put 10 above 13 left\nrail 10.VAE move 10 to 8.vae\nrail 30.MODEL above 13 to 22.model\n") + self.do(f"layout {self.write_plan(plan)}") + cv = self.cv() + model = min(r[0] for r in C.rail_spans(cv) if r[3][0] == "30") + self.assertLessEqual(model, G.rect(cv.node("10"))[1] - C.V_GAP + 0.5) + self.assertFalse([x for x in C.full_check(cv)[0] if "rail too close to a node" in x]) + def test_layout_rail_move_twice_on_one_unit_stops(self): plan = ("row 13 8 9 42 30\nput 10 left 13 above 13\n" "rail 10.VAE above 13 move 10 to 8.vae\nrail 10.VAE above 42 move 10 to 9.images\n") diff --git a/tests/test_check_fixes.py b/tests/test_check_fixes.py index 67a7fca..c897aa9 100644 --- a/tests/test_check_fixes.py +++ b/tests/test_check_fixes.py @@ -90,5 +90,16 @@ def test_write_rail_move_for_a_raised_loader(self): self.assertFalse(self.check_lines("raising Reroute right of a loader")) + def test_write_below_right_for_a_left_aligned_column(self): + # "stacked nodes aligned on their left edges, not their right: … (place the lower one with put … below the other)" + self.do("copy 42 26 22") + self.do("link 42.0 26.conditioning 26.0 22.conditioning") + out = self.layout(["put 42 origin", "put 26 below 42 left"]) + self.assertTrue(self.check_lines("stacked nodes aligned on their left edges"), "the check names the pair") + self.assertTrue([x for x in out if x.startswith("left to fix") and "aligned on their left" in x], "a rule's violation") + self.layout(["put 42 origin", "put 26 below 42"]) + self.assertFalse(self.check_lines("stacked nodes aligned on their left edges")) + + if __name__ == "__main__": unittest.main() From ee9aba1706d45a97f550c5ef015a8abc3b27f663 Mon Sep 17 00:00:00 2001 From: nomadoor <124905471+nomadoor@users.noreply.github.com> Date: Sun, 8 Nov 2026 10:13:47 +0900 Subject: [PATCH 3/6] Next release: tests without development notes or skipped tests --- tests/test_canvas.py | 154 +++++-------------------------------------- tests/test_finish.py | 2 +- 2 files changed, 16 insertions(+), 140 deletions(-) diff --git a/tests/test_canvas.py b/tests/test_canvas.py index 9c4b609..45f6429 100644 --- a/tests/test_canvas.py +++ b/tests/test_canvas.py @@ -74,7 +74,7 @@ def _layout_one(self): return self.do(f"layout {plan}") def test_a_clip_loader_feeding_text_encoders_stays_yellow(self): - # correction 1014: the fixed yellow stays when the CLIP reaches a text encoder, also through a node passing it on + # the fixed yellow stays when the CLIP reaches a text encoder, also through a node passing it on self._layout_one() yellow = list(C.COLORS["yellow"]) self.assertEqual([self.cv().node("11").get("color"), self.cv().node("11").get("bgcolor")], yellow) @@ -274,7 +274,7 @@ def test_rail_is_horizontal_between_reroutes(self): def test_rail_reroute_below_a_sampler_stays_in_its_column(self): # the lowering Reroute stands on the right edge of the column left of its target: it is not moved sideways - # (correction 1204); a rail written below a sampler runs below the room it grows into, so nothing is hidden + # a rail written below a sampler runs below the room it grows into, so nothing is hidden self.do("row 10 13 8 9") self.do("put 12 above 10") self.do("rail 10.VAE below 13 to 8.vae") @@ -306,7 +306,7 @@ def test_layout_rail_move_puts_the_source_at_the_rail_height(self): def test_layout_rail_move_keeps_the_unit_off_the_rail_below(self): # a loader moved to its rail's height does not stand on the rail below it: its rail goes up until the loader - # clears that rail by the rail gap (correction 1205) + # clears that rail by the rail gap plan = "row 13 8 9 42\nput 11 left 13 below 13\nput 10 left 13 above 13\n" \ "rail 10.VAE above 13 move 10 to 8.vae\nrail 11.CLIP above 13 to 42.clip\n" self.do(f"layout {self.write_plan(plan)}") @@ -320,7 +320,7 @@ def test_layout_rail_move_keeps_the_unit_off_the_rail_below(self): def test_layout_rail_move_keeps_the_rail_order(self): # a rail pushed up by a moved loader does not pass the rail of an earlier type above it: that rail goes up too, - # with its loader's block (Fable review of correction 1205) + # with its loader's block plan = ("row 13 8 9 42 30\nput 11 left 13 below 13\nblock L 12 10\nput 12 left 13 above 13\nput 10 below 12\n" "rail 12.MODEL to 30.model\nrail 10.VAE above 13 move 10 to 8.vae\nrail 11.CLIP above 13 to 42.clip\n") self.do(f"layout {self.write_plan(plan)}") @@ -542,7 +542,7 @@ def test_image_wire_behind_a_save_node_is_a_violation(self): self.assertFalse([x for x in C.hard_problems(self.cv()) if x.startswith("wire behind a node")]) def test_wires_behind_a_node_are_said_only_when_they_cross_there(self): - # grill 2026-11-06 (U2): wires behind a node that come out in the order they went in are Fine + # wires behind a node that come out in the order they went in are Fine def place(pos): for nid, (x, y) in pos.items(): self.do(f"put {nid} origin") @@ -632,21 +632,6 @@ def test_layout_is_repeatable_and_keeps_links(self): rail 10.VAE to 8.vae """ - @unittest.skip("the canvas no longer chooses rail heights, moves nodes after the plan, or holds backward wires as unkeepable (correction 1001)") - def test_layout_rail_opens_a_lane_in_a_packed_column(self): - # a column stands across the vae rail's run, with no clear height near the output: the column opens at the rail - out = self.do(f"layout {self.write_plan(self.PACKED)}") - self.assertTrue([x for x in out if "opening a lane" in x or "opened a lane" in x], out) - self.assertTrue([x for x in out if "to open the lane" in x], out) - cv = self.cv() - rr = [n for n in cv.s["nodes"] if n["type"] == "Reroute"] - y = cv.out_xy(rr[0]["id"] if rr else "10", 0)[1] - x0, x1, last = C.rail_extent(cv, "10", ["8"]) - self.assertEqual(C.lane_blockers(cv, y, x0, x1, {"10"} | last), []) - self.assertEqual(self.rect("30")[1] <= 0, True) # the top of the column moved up or stayed - lines, _ = C.full_check(cv) - self.assertFalse([x for x in lines if x.startswith("overlap")], lines) - def test_layout_loader_rail_has_no_raising_reroute(self): # a loader heads its rail: the lane opens at its output height, no Reroute lifts or lowers its output self.do(f"layout {self.write_plan(self.PACKED)}") @@ -658,37 +643,6 @@ def test_layout_loader_rail_has_no_raising_reroute(self): self.assertTrue(C.wire_clear(cv, cv.out_xy("10", 0), cv.in_xy("8", "vae"), {"10", "8"})) self.assertFalse([x for x in C.full_check(cv)[0] if x.startswith("raising Reroute right of a loader")]) - @unittest.skip("the canvas no longer chooses rail heights, moves nodes after the plan, or holds backward wires as unkeepable (correction 1001)") - def test_layout_rail_moves_the_source_rather_than_a_column(self): - # the run is blocked at the output height of VAE Decode by a stack of three; moving the source (and the sampler - # wired level into it) moves two nodes, opening a lane would move three: the source moves, nothing lifts the rail - self.do("add PreviewImage p") - self.do("link 8.IMAGE p.images") - plan = """put 13 origin -put 8 right 13 -block b 27 30 42 -stack 27 30 42 -put b right 8 top -put 9 right b -move 9 0 120 -put p below 9 -rail 8.IMAGE to 9.images p.images -""" - C.AUTO_LEVEL = False # this test is about the rail's choice alone (the layout would level 27 → 13 first) - try: - out = self.do(f"layout {self.write_plan(plan)}") - finally: - C.AUTO_LEVEL = True - self.assertTrue([x for x in out if "moving the source" in x], out) - cv = self.cv() - self.assertEqual(self.rect("27")[1], 0) # the stack stayed - a, b = cv.out_xy("13", 0), cv.in_xy("8", "samples") - self.assertLess(abs(a[1] - b[1]), 1) # the sampler moved with it: still horizontal - y = cv.out_xy("8", 0)[1] - for n in cv.s["nodes"]: - if n["type"] == "Reroute": - self.assertLess(abs(cv.out_xy(n["id"], 0)[1] - y), 1) - def test_move_closure_keeps_a_stack(self): self.do("block s 12 11 10") self.do("stack 12 11 10") @@ -734,7 +688,7 @@ def test_a_lowering_reroute_stands_on_the_right_edge_of_a_column_two_frames_away def test_rail_into_one_target_further_down_runs_at_its_input_height(self): # rail written below a unit, its one target further down: the rail runs at the target's input height, so the wire - # from its Reroute into the target is horizontal (correction 1041: a Reroute stopped halfway) + # from its Reroute into the target is horizontal plan = """put 13 origin put 8 right 13 put 9 right 8 @@ -782,7 +736,7 @@ def _ksampler(self): self.do("link 30.0 k.model 42.0 k.positive 6.0 k.negative 27.0 k.latent_image") def test_model_chain_end_off_the_input_column_weighs_less(self): - # the model chain ends at the right edge of the sampler's column of sources (correction 1044); off it is a soft line + # the model chain ends at the right edge of the sampler's column of sources; off it is a soft line self._ksampler() self.do("add ModelSamplingFlux ms") self.do("link 30.0 ms.model ms.0 k.model") @@ -818,7 +772,7 @@ def test_model_chain_into_the_column_of_sources_ends_in_the_column_left(self): self.assertTrue([x for x in C.soft_problems(self.cv()) if x.startswith("model chain end 30")]) def test_merging_node_with_no_wire_level_weighs_less(self): - # two conditionings into one node, the node set midway so neither wire is level (correction 1044) + # two conditionings into one node, the node set midway so neither wire is level self.do("add ConditioningCombine m") self.do("link 42.0 m.conditioning_1 6.0 m.conditioning_2") plan = "put 42 origin" + chr(10) + "put 6 below 42" + chr(10) + "put m right 42" + chr(10) + "move m 0 120" + chr(10) @@ -840,7 +794,7 @@ def test_image_wire_into_vae_encode_slanted_weighs_less(self): def test_gap_crossings_are_counted_in_each_row_sharing_its_span(self): # two rows ending and starting at the same x: the gap keeps the crossings of the row where they are, not 0 from - # the first wire found (correction 1044: a model row ending at the column hid a crossed gap) + # the first wire found (a model row ending at the column hid a crossed gap) self._ksampler() plan = """put k origin put 42 left k gap 60 @@ -860,7 +814,7 @@ def test_gap_crossings_are_counted_in_each_row_sharing_its_span(self): self.assertGreaterEqual(spans[0][2], 1) def test_widening_a_gap_takes_a_node_right_aligned_with_the_opened_column(self): - # a node above the gap whose right edge is the opened column's right edge moves with that column (correction 1044) + # a node above the gap whose right edge is the opened column's right edge moves with that column self._ksampler() self.do("add ConditioningCombine m") self.do("link 42.0 m.conditioning_1 6.0 m.conditioning_2 m.0 k.positive") @@ -891,7 +845,6 @@ def test_widening_a_gap_takes_a_node_right_aligned_with_the_opened_column(self): def test_widening_a_gap_moves_the_rows_below_it_too(self): # a node right of the line far below the crossing wires moves too, so a column aligned across rows stays aligned - # (corrections 1041, 1044) self._ksampler() self.do("add ConditioningCombine m") self.do("link 42.0 m.conditioning_1 6.0 m.conditioning_2 m.0 k.positive") @@ -973,49 +926,6 @@ def test_layout_rails_do_not_depend_on_plan_order(self): {k: v for k, v in p1.items() if not k.startswith("r1")}) self.assertEqual(r1, r2) - @unittest.skip("the canvas no longer chooses rail heights, moves nodes after the plan, or holds backward wires as unkeepable (correction 1001)") - def test_layout_output_node_steps_down_for_a_wire_through(self): - # Save Image stands level with VAE Decode, in the way of the image going on to a Preview farther right: - # Save steps down (a staircase) and the wire through stays at the output height, with no Reroute - self.do("add PreviewImage p") - self.do("link 8.IMAGE p.images") - plan = """put 8 origin -put 9 right 8 -put 27 right 9 gap 300 -put p right 27 -rail 8.IMAGE to 9.images p.images -""" - out = self.do(f"layout {self.write_plan(plan)}") - cv = self.cv() - self.assertTrue([x for x in out if "opening a lane" in x], out) - self.assertGreater(self.rect("9")[1], self.rect("8")[1]) - self.assertFalse([n for n in cv.s["nodes"] if n["type"] == "Reroute"]) - self.assertTrue(C.wire_clear(cv, cv.out_xy("8", 0), cv.in_xy("p", "images"), {"8", "p"})) - - @unittest.skip("the canvas no longer chooses rail heights, moves nodes after the plan, or holds backward wires as unkeepable (correction 1001)") - def test_layout_rails_go_model_vae_clip(self): - def plan(stack): - return f"""block load {stack} -stack {stack} -put 6 right load gap 600 -put 42 below 6 -put 8 right 6 gap 300 -move 8 0 400 -put 30 right 8 -rail 12.MODEL to 30.model -rail 10.VAE to 8.vae -rail 11.CLIP to 6.clip 42.clip -""" - with self.assertRaises(C.Stop) as e: - self.do(f"layout {self.write_plan(plan('12 11 10'))}") - self.assertIn("model, vae, clip from the top", str(e.exception)) - self.do(f"layout {self.write_plan(plan('12 10 11'))}") - cv = self.cv() - ys = {C.rail_type(cv, r, s): y for y, _, _, (r, s) in C.rail_spans(cv)} - self.assertLess(ys["MODEL"], ys["VAE"]) - lines = C.full_check(cv)[0] - self.assertFalse([x for x in lines if "rail runs above the" in x or "clip loader" in x], lines) - def test_clip_loader_above_vae_loader_is_not_reported(self): # vae and clip take either order (Load VAE may stand below the text encoders, below Load CLIP); only a loader # above the model loader is out of order @@ -1033,23 +943,6 @@ def test_loader_order_is_checked_only_within_a_stacked_column(self): lines = C.full_check(self.cv())[0] self.assertTrue([x for x in lines if x.startswith("vae loader 10 is above the model loader 12")], lines) - @unittest.skip("the canvas no longer chooses rail heights, moves nodes after the plan, or holds backward wires as unkeepable (correction 1001)") - def test_layout_conditioning_rail_runs_above_the_samplers(self): - # the text encoder stands below the sampler; its conditioning still runs above the sampler to the guider beyond it - plan = """put 13 origin -put 6 left 13 gap 300 -move 6 0 400 -put 26 right 13 gap 300 -put 22 right 26 gap 300 -rail 6.CONDITIONING to 26.conditioning 22.conditioning -""" - self.do("unlink 26.conditioning") - self.do("link 6.CONDITIONING 26.conditioning 6.CONDITIONING 22.conditioning") - out = self.do(f"layout {self.write_plan(plan)}") - h = [float(re.search(r"rail height (-?[\d.]+)", x).group(1)) for x in out if "line 6: rail height" in x] - self.assertTrue(h, out) - self.assertLess(h[0], self.rect("13")[1]) - def test_loader_is_not_widened_past_the_node_below_it(self): # Load VAE stacked right above the sampler is not widened to the loader minimum width past the sampler self.do("put 13 origin") @@ -1310,7 +1203,7 @@ def test_notes_are_placed_last_and_all_leaves_them_out(self): self.do(f"layout {self.write_plan(plan)}") self.assertEqual(self.rect("note_top")[2], self.rect("30")[2]) self.assertEqual(self.rect("note_top")[3], self.rect("30")[1] - C.V_GAP) - # the overview Note aligns with the workflow's top, not with a Note placed above it (correction 913) + # the overview Note aligns with the workflow's top, not with a Note placed above it self.assertEqual(self.rect("note_models")[1], min(self.rect("12")[1], self.rect("30")[1])) self.assertNotIn("model Note top edge", "\n".join(self.do("check"))) @@ -1340,14 +1233,6 @@ def test_a_note_away_is_allowed_only_when_no_place_next_to_its_node_is_clear(sel self.assertTrue([x for x in C.full_check(self.cv())[0] if x.startswith("Note note_b explains 12 from away")]) self.assertFalse(C.note_trouble(self.cv(), "note_b")) - @unittest.skip("a Note goes where the plan writes it; the canvas no longer tries other sides (correction 1005)") - def test_a_note_below_a_node_that_grows_goes_above_it(self): - md = self.dir / "note_g.md" - md.write_text("### a\n\nb\n", encoding="utf-8") - out = self.do(f"layout {self.write_plan(f'put 13 origin' + chr(10) + f'note {md} below 13' + chr(10))}") - self.assertLess(self.rect("note_g")[3], self.rect("13")[1]) - self.assertTrue(any("goes above it" in l for l in out), out) - def test_a_note_on_a_node_of_a_group_is_placed_with_the_group_inside_its_frame(self): # the Note line written with the group runs then, the frame takes it in, and the next group keeps clear of it md = self.dir / "note_in.md" @@ -1417,15 +1302,6 @@ def test_a_note_widening_its_group_while_there_is_room_inside_is_told_where(self self.do(f"layout {self.write_plan(plan.replace('left s', hint))}") self.assertFalse([x for x in C.hard_problems(self.cv()) if "widens the frame" in x]) - @unittest.skip("a Note goes where the plan writes it; the canvas no longer tries other sides (correction 1005)") - def test_a_note_that_would_land_on_a_node_goes_to_another_side(self): - md = self.dir / "note_o.md" - md.write_text("### a\n\nb\n", encoding="utf-8") - # right of 30 is where 12 stands: the canvas tries the other sides of 30 instead of putting it on 12 - out = self.do(f"layout {self.write_plan('put 30 origin' + chr(10) + 'put 12 right 30 top' + chr(10) + f'note {md} right 30' + chr(10))}") - self.assertFalse([x for x in out if "overlap" in x and "note_o" in x], out) - self.assertTrue(any("note_o: placed" in l for l in out), out) - def test_a_title_written_after_the_lines_that_place_takes_its_width_before_them(self): # a long title widens its node: written at the end of the plan, the node beside it still keeps its gap self.do(f"layout {self.write_plan('put 12 origin' + chr(10) + 'put 30 right 12 top' + chr(10) + 'title 12 ' + 'W' * 60 + chr(10))}") @@ -1846,7 +1722,7 @@ def test_width_and_value_top_checks(self): self.assertTrue([x for x in lines if x.startswith("value nodes side by side have unaligned tops")]) def test_inputs_centres_sampler_custom_on_its_column(self): - # corrections 1025 and 1114: the sampler stays on the eye line and its column moves to it, so that the sampler + # the sampler stays on the eye line and its column moves to it, so that the sampler # is at the column's vertical middle (its conditioning enters the guider, whose wire into the sampler slants) self.do("copy 25 16 17") self.do("link 25.NOISE 13.noise 16.SAMPLER 13.sampler 17.SIGMAS 13.sigmas 30.MODEL 17.model") @@ -1860,7 +1736,7 @@ def test_inputs_centres_sampler_custom_on_its_column(self): self.assertLess(abs((before[1] + before[3]) / 2 - (col[1] + col[3]) / 2), 1) def test_inputs_levels_a_wire_of_a_node_that_is_not_sampler_custom(self): - # grill 2026-11-06 (K-102, correction 1044): not set midway between its sources; one wire is horizontal + # not set midway between its sources; one wire is horizontal self.do("put 8 origin") self.do("move 8 2000 600") self.do("inputs 8") @@ -2187,7 +2063,7 @@ def test_raising_reroute_right_of_loader(self): self.assertFalse([x for x in lines if x.startswith("raising Reroute right of a loader")]) def test_export_stops_on_a_raising_reroute_right_of_a_loader_only(self): - # grill 2026-11-06 (Q8a): a loader of a model, clip or vae stands at its rail's height; the export stops on its + # a loader of a model, clip or vae stands at its rail's height; the export stops on its # raising Reroute. The last node of a model chain heading a rail is only said self._two_loader_rails("above 12", "below 10") stops = [x for x in C.export_stops(self.cv()) if x.startswith("raising Reroute right of a loader")] @@ -2477,7 +2353,7 @@ def test_report_page_in_japanese(self): self.assertIn("の下に", steps[1]["s"]) def test_layout_does_not_echo_what_lines_did(self): - # correction 1020: the reply is an error log; what the plan's lines did is kept for the report page only + # the reply is an error log; what the plan's lines did is kept for the report page only plan = self.dir / "plan.txt" plan.write_text("put 12 origin\nput 30 right 12 wire\n", encoding="utf-8") out = self.do(f"layout {plan}") diff --git a/tests/test_finish.py b/tests/test_finish.py index fc5c82d..2883d90 100644 --- a/tests/test_finish.py +++ b/tests/test_finish.py @@ -171,7 +171,7 @@ def test_order_sets_the_report_tabs(self): self.assertEqual(C.Work(self.w).cfg["tab_group"], {"u": "m", "t": "m"}) def test_bad_forms_are_reported_and_stop_nothing(self): - # the rules' Bad forms are listed first by layout, and export still writes the workflow (correction 980) + # the rules' Bad forms are listed first by layout, and export still writes the workflow self.do(f"layout {self.w / 'layout.txt'}") (self.w / "bad.txt").write_text("put 12 origin\nput 30 origin\n", encoding="utf-8") out = self.do(f"layout {self.w / 'bad.txt'}") From e2df5aef560d891cc09b3c41c67658c1f8cff6d3 Mon Sep 17 00:00:00 2001 From: nomadoor <124905471+nomadoor@users.noreply.github.com> Date: Sun, 8 Nov 2026 10:16:39 +0900 Subject: [PATCH 4/6] Next release: American spelling throughout --- CHANGELOG.md | 6 +- README.md | 2 +- skills/comfyui-readable-node/SKILL.md | 16 ++-- .../references/content.md | 2 +- .../references/examples.md | 12 +-- .../references/glossary.md | 4 +- .../comfyui-readable-node/references/notes.md | 6 +- .../references/readable-form.md | 12 +-- .../references/replacements.md | 2 +- .../references/techniques.md | 2 +- .../scripts/api_format.py | 2 +- .../comfyui-readable-node/scripts/canvas.py | 80 +++++++++---------- .../scripts/comfy_schema.py | 2 +- .../comfyui-readable-node/scripts/flatten.py | 14 ++-- .../comfyui-readable-node/scripts/geometry.py | 2 +- .../scripts/legacy_groups.py | 2 +- .../scripts/read_workflow.py | 2 +- .../comfyui-readable-node/scripts/render.py | 6 +- .../comfyui-readable-node/scripts/replace.py | 4 +- .../comfyui-readable-node/scripts/report.py | 38 ++++----- skills/comfyui-readable-node/scripts/ue.py | 18 ++--- tests/test_canvas.py | 22 ++--- 22 files changed, 128 insertions(+), 128 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 932ead6..cef551c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -76,10 +76,10 @@ The rules were untangled into one set: sentences that contradicted each other we - The places the canvas offers for a Note no longer put another node between the Note and the node it explains. A raising Reroute is no longer called unneeded when the rail drawn at the output height would run too close to another rail. - Export keeps node numbers from one export to the next; a Reroute the canvas made gets a number of its own. - Fixed: a link from a broadcaster (Anything Everywhere) saved with the type `*` now takes the type of the output it comes from. -- A Load CLIP whose CLIP reaches no text encoder (one that only feeds an LLM) gets no fixed colour. +- A Load CLIP whose CLIP reaches no text encoder (one that only feeds an LLM) gets no fixed color. - A wire may go back one node's width only into Conditioning Zero Out, or from an empty latent into a scheduler. -- Report page: bypassed nodes are drawn in ComfyUI's bypass colour; the Walkthrough's first page lists the parts, the review and the widened gaps. -- References: readable-form.md rewritten as eight numbered rules with Why, Bad, Fine and Undecided (the usual form, nodes, wires, flow and position, loaders, value nodes, groups and colour, names); content.md rewritten as two decisions (split; keep, fix, replace or remove); examples.md ordered by those sections; glossary.md defines chain wire, raising and lowering Reroute, gaps, step and more; notes.md: link the Comfy-Org copy of a model, suggest a smaller form of the same model when memory runs short; techniques.md: what becomes of the author's negative text at cfg 1 depends on whether raising cfg is an ordinary choice; replacements.md: `canvas open` replaces Image Comparer, braces in Format Text are doubled. +- Report page: bypassed nodes are drawn in ComfyUI's bypass color; the Walkthrough's first page lists the parts, the review and the widened gaps. +- References: readable-form.md rewritten as eight numbered rules with Why, Bad, Fine and Undecided (the usual form, nodes, wires, flow and position, loaders, value nodes, groups and color, names); content.md rewritten as two decisions (split; keep, fix, replace or remove); examples.md ordered by those sections; glossary.md defines chain wire, raising and lowering Reroute, gaps, step and more; notes.md: link the Comfy-Org copy of a model, suggest a smaller form of the same model when memory runs short; techniques.md: what becomes of the author's negative text at cfg 1 depends on whether raising cfg is an ordinary choice; replacements.md: `canvas open` replaces Image Comparer, braces in Format Text are doubled. ## 0.0.2 (2026-10-21) diff --git a/README.md b/README.md index 0d56ab8..cbefb07 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ An agent skill that rebuilds ComfyUI workflows into a form people can read: **Re 3. **Left to right.** Flow from left to right in processing order. 4. **1 task = 1 workflow.** One workflow is one thing the user wants to do. 5. **Remove custom nodes as far as possible.** What can be built with core nodes is built with core. -6. **Colour appropriately.** Colour shows which function a node belongs to. +6. **Color appropriately.** Color shows which function a node belongs to. ## Install diff --git a/skills/comfyui-readable-node/SKILL.md b/skills/comfyui-readable-node/SKILL.md index c45c9eb..9b830a1 100644 --- a/skills/comfyui-readable-node/SKILL.md +++ b/skills/comfyui-readable-node/SKILL.md @@ -1,6 +1,6 @@ --- name: comfyui-readable-node -description: Builds a ComfyUI workflow (JSON) into a form people can read easily (Readable Node). Use it when the user mentions Readable Node, asks to make a ComfyUI workflow readable or tidy, takes an existing workflow apart to rebuild it, or builds a new workflow. Do not hide nodes, do not hide wires (turn wireless links back into wires), left to right, 1 task per workflow, fewer custom nodes, appropriate colouring. +description: Builds a ComfyUI workflow (JSON) into a form people can read easily (Readable Node). Use it when the user mentions Readable Node, asks to make a ComfyUI workflow readable or tidy, takes an existing workflow apart to rebuild it, or builds a new workflow. Do not hide nodes, do not hide wires (turn wireless links back into wires), left to right, 1 task per workflow, fewer custom nodes, appropriate coloring. license: MIT metadata: version: "0.0.5" @@ -20,10 +20,10 @@ The items are ordered by how much they matter when a person reads a workflow. Wh 1. **Do not hide nodes.** Expand subgraphs, open collapsed nodes, and do not overlap nodes. 2. **Do not hide wires.** Turn wireless links (Set/Get, Anything Everywhere, hidden links, and the like) back into wires. -3. **Left to right.** Flow from left to right in processing order. Do not stretch too far towards the lower right. +3. **Left to right.** Flow from left to right in processing order. Do not stretch too far toward the lower right. 4. **1 task = 1 workflow.** One workflow is one thing the user wants to do. 5. **Remove custom nodes as far as possible.** What can be built with core nodes is built with core. -6. **Colour appropriately.** Colour shows which function a node belongs to. +6. **Color appropriately.** Color shows which function a node belongs to. There are three goals. - The reader can follow the processing along a single line (can trace the details). @@ -42,9 +42,9 @@ The rules in the references serve these principles and goals; how to read a rule ## Division of work -**What you decide (judgement)**: understanding, how to split, what to keep, remove or replace, rebuilding custom nodes, what goes where, what to align, rails, groups, colours for added functions, Notes. +**What you decide (judgment)**: understanding, how to split, what to keep, remove or replace, rebuilding custom nodes, what goes where, what to align, rails, groups, colors for added functions, Notes. -**What the canvas does (things with exactly one answer)**: node sizes, calculating positions, the default colours of loaders, LoRAs and Notes, group padding, checks (check), export. When reading the original (`canvas open`), it fixes what has exactly one way of fixing, such as turning wireless links back into wires, and applying the official node-replacement list and replacements that give the same calculation. It returns everything it did. +**What the canvas does (things with exactly one answer)**: node sizes, calculating positions, the default colors of loaders, LoRAs and Notes, group padding, checks (check), export. When reading the original (`canvas open`), it fixes what has exactly one way of fixing, such as turning wireless links back into wires, and applying the official node-replacement list and replacements that give the same calculation. It returns everything it did. **How to use the canvas** - Do not write coordinate numbers. Point at things: "put it to the right of A", "make the wire horizontal", "align the top edges". The canvas does the calculation. Only what you point at moves. @@ -60,7 +60,7 @@ The rules in the references serve these principles and goals; how to read a rule ## Steps -`S` is the path of scripts/. Choose one working folder `W` inside the folder where the results go (the one the user named; otherwise next to the original), and type every canvas move as `python3 $S/canvas.py --dir $W `. Below, this is written `canvas`. The list of moves, their syntax and the detailed behaviour (undo, placements calculated only once, block, and so on) are at the top of canvas.py (`python3 $S/canvas.py` prints them): read it once before step 4. +`S` is the path of scripts/. Choose one working folder `W` inside the folder where the results go (the one the user named; otherwise next to the original), and type every canvas move as `python3 $S/canvas.py --dir $W `. Below, this is written `canvas`. The list of moves, their syntax and the detailed behavior (undo, placements calculated only once, block, and so on) are at the top of canvas.py (`python3 $S/canvas.py` prints them): read it once before step 4. - Put every file you make while working inside `W`: plan files (build.txt for building, layout.txt for arranging: "the plan" is layout.txt), Note files, workflows or object_info you fetch to read, notes. Only the exported workflows and the report page go outside `W`. `canvas finish` deletes the files of `W` it knows (what it wrote, the plan and Note files, understanding.md) and names the others it left: delete only those, one by one. Do not delete `W` with a recursive delete. Moves marked "(when there is an original)" are only for rebuilding a given workflow. When building a new one, skip them. @@ -100,7 +100,7 @@ When the user asks for it fast, skip steps 9 and 10 (the review and the report p 2. Read references/readable-form.md, references/glossary.md and the "Layout" part of references/examples.md, again here if you read them before. Then paste the lines of `canvas core ` at the top of layout.txt. They are a draft of the core's block: adjust them to this workflow (a part the usual form lacks is named in a comment, to be placed by relations). 3. For each grouping of the understanding document, write `block …` and the arrangement inside it. 4. Run `canvas between layout.txt` to see the wires between blocks and the outputs handed out to several blocks. Whether a value handed out to several stages needs a `rail`: readable-form.md, "Wires". - 5. Write the arrangement between blocks: each block against the block it is wired to (`put left|right wire`). Groups, colours and the titles of value nodes and of nodes loading an image go in the same file (readable-form.md, "Groups and colour", "Names"); the canvas reads every group line before it places anything, so where in the file a group line stands does not change the layout. + 5. Write the arrangement between blocks: each block against the block it is wired to (`put left|right wire`). Groups, colors and the titles of value nodes and of nodes loading an image go in the same file (readable-form.md, "Groups and color", "Names"); the canvas reads every group line before it places anything, so where in the file a group line stands does not change the layout. 6. Run `canvas layout layout.txt`. How to place: @@ -145,7 +145,7 @@ When the user asks for it fast, skip steps 9 and 10 (the review and the report p - references/content.md: the rules about content (splitting, replacing, keeping, removing). - references/techniques.md: building techniques (hard-to-read forms, and forms rebuilt to be readable). - references/replacements.md: the replacement dictionary (custom nodes and deprecated nodes, things that may be removed, things to keep) and how to find the source. -- references/readable-form.md: the layout rules (nodes, wires, flow and position, groups and colour, names). +- references/readable-form.md: the layout rules (nodes, wires, flow and position, groups and color, names). - references/notes.md: how to write Notes and the Walkthrough, and where to place Notes. - references/examples.md: examples (how the rules applied in real workflows). - references/review.md: the review after export (what you do, and the brief for the agent that reviews). diff --git a/skills/comfyui-readable-node/references/content.md b/skills/comfyui-readable-node/references/content.md index 29ec12a..9653c7b 100644 --- a/skills/comfyui-readable-node/references/content.md +++ b/skills/comfyui-readable-node/references/content.md @@ -10,7 +10,7 @@ Two decisions for each part of the original: which workflow it goes into (Split) ## Split **One workflow is one thing the user wants to do.** Many workflows are fine: the aim is the principles of SKILL.md, not fewer workflows. Why: 1 task = 1 workflow. -- One workflow: a generation whose stages pass conditioning or a latent on (base → refiner → Hires.fix; t2i → a redraw at a larger size with the same model). Effects on the finished image (film grain, colour matching, frame interpolation, a 1x deblur) stay in it. +- One workflow: a generation whose stages pass conditioning or a latent on (base → refiner → Hires.fix; t2i → a redraw at a larger size with the same model). Effects on the finished image (film grain, color matching, frame interpolation, a 1x deblur) stay in it. - Split: what changes what can be done (t2i, i2i and edit; T2V and I2V); what changes the sampling setup (steps, sigmas, cfg, the sampler): models each with their own settings, a speed-up that changes steps or cfg. Tasks that are not connected (outputs sharing no upstream). - A bypassed branch in the one workflow: a speed-up that only may make it faster, an addition that only may make it a little better (CFGZeroStar, a guidance adjustment). - An added function the user may want or not (a ControlNet, a guide image) is split: with it and without it. A few nodes that must be switched together can stay in the one workflow as a group switched with bypass. diff --git a/skills/comfyui-readable-node/references/examples.md b/skills/comfyui-readable-node/references/examples.md index 07ade33..50f64aa 100644 --- a/skills/comfyui-readable-node/references/examples.md +++ b/skills/comfyui-readable-node/references/examples.md @@ -1,6 +1,6 @@ # Examples -How the rules applied in real workflows: "Layout" under the section headings of readable-form.md, then "Content" and "Notes" by topic. "Before" is a form an agent built, "After" the corrected form, "Layout" a layout arranged by hand. In the same situation, lean towards this form. +How the rules applied in real workflows: "Layout" under the section headings of readable-form.md, then "Content" and "Notes" by topic. "Before" is a form an agent built, "After" the corrected form, "Layout" a layout arranged by hand. In the same situation, lean toward this form. An example marked **Exception ()** is a correct counter-example: there that rule gives way. Every other example is a rule applied as written. ## Layout @@ -134,7 +134,7 @@ Layout: the image Switches of all stages, the loader and the saver at one height **Spacing** ``` Before: 150px between Load LoRA and KSampler -After: no wider space to a wired neighbour without a reason +After: no wider space to a wired neighbor without a reason ``` ### 5. Loaders @@ -166,11 +166,11 @@ Layout: a single stage: Load Checkpoint just left of the text encoders (its CLIP - The cfg 1.0 of a distilled model is not changed, so it stays in each KSampler; no cfg value node. - Sizes typed by hand once are not handed out; a size the author measures from an image comes from Get Image Size. -### 7. Groups and colour +### 7. Groups and color - A two-stage LTX workflow has three groups (stage 1, stage 2, decode). A t2i with IPAdapter has no group. -- A Detail pass whose every node was coloured green inside its group: the group already guides the eye. -- Colour split finely (SCAIL 2): the core green; taking the person in the input video pale_blue; taking the person in the reference image cyan; CLIP Vision brown. +- A Detail pass whose every node was colored green inside its group: the group already guides the eye. +- Color split finely (SCAIL 2): the core green; taking the person in the input video pale_blue; taking the person in the reference image cyan; CLIP Vision brown. - In that two-stage LTX workflow, when the Stage 1 result is decoded too, that decode belongs to the stage 1 group; only the decode after upscaling is in the decode group. ### 8. Names @@ -187,7 +187,7 @@ After: ComfyUI's display name ### Split ``` -One: base → refiner → Hires.fix (conditioning passes on), with the film grain and colour correction on the finished image +One: base → refiner → Hires.fix (conditioning passes on), with the film grain and color correction on the finished image Split: nine models with their own sampler settings × t2i and i2i = eighteen workflows Split: a prompt written by hand or by an MLLM from an image, one side bypassed in the author's workflow: two text-to-image workflows, one with the MLLM and one without Before: an Anima LLLite guide, its nodes in no group, switched on and off with bypass in one workflow diff --git a/skills/comfyui-readable-node/references/glossary.md b/skills/comfyui-readable-node/references/glossary.md index 44ddc69..35428b1 100644 --- a/skills/comfyui-readable-node/references/glossary.md +++ b/skills/comfyui-readable-node/references/glossary.md @@ -12,7 +12,7 @@ The meaning of the words used in the skill's documents. Each is defined here onc ## Kinds of nodes -- **sampler**: KSampler, KSampler (Advanced), SamplerCustom, SamplerCustomAdvanced, and custom nodes that add processing these core nodes cannot realise. +- **sampler**: KSampler, KSampler (Advanced), SamplerCustom, SamplerCustomAdvanced, and custom nodes that add processing these core nodes cannot realize. - **loader**: a node that reads a model file (Load Checkpoint, Load Diffusion Model, Load CLIP, Load VAE, Load LoRA, and so on). - **value node**: a node that only outputs one value (Int, Float, String, and so on). - **core node**: a node that comes with ComfyUI from the start. A **custom node** is a node installed afterwards. @@ -35,7 +35,7 @@ The meaning of the words used in the skill's documents. Each is defined here onc - **row**: a horizontal band of nodes lined up side by side. Rows are separated top to bottom by role, like the model row, the conditioning row, the image row. - **column**: a vertical band of nodes stacked up and down. The column of sources to the left of a sampler, and so on. - **eye line (band)**: the height every stage's sampler (KSampler, SamplerCustomAdvanced) stands at; a band with width through which the main flow passes. -- **main flow**: the flow from the sampler towards the final output (sampler → decode → … → save). +- **main flow**: the flow from the sampler toward the final output (sampler → decode → … → save). - **output node**: a node that takes a result and passes nothing on (Save, Preview, Compare). - **rail**: a value, or several side by side, carried far or to several places with Reroutes (`rail`). - **Reroute**: a small node that relays a wire. Used for rails. diff --git a/skills/comfyui-readable-node/references/notes.md b/skills/comfyui-readable-node/references/notes.md index fbf188c..68dc408 100644 --- a/skills/comfyui-readable-node/references/notes.md +++ b/skills/comfyui-readable-node/references/notes.md @@ -19,7 +19,7 @@ The text of the Notes on part of the processing, and the one or two sentences at **At the very top, what this workflow does, in one or two sentences: what goes in and what comes out. Below it, the list of models.** - The first heading says that in the user's language. The models heading is always `## models`, in every language (the canvas finds the model Note by it). -- It has no title: its place at the upper left and its colour say what it is, and its headings divide it. +- It has no title: its place at the upper left and its color say what it is, and its headings divide it. - The list of models is in exactly this form (the canvas `models` gives a draft): ````markdown @@ -63,8 +63,8 @@ Generates an image from a text prompt with Qwen Image 2.1. - One Note per place the user looks at (one node, or a cluster looked at together). Several topics there become several headings in that one Note. One thing is said once in the whole workflow: the same point (larger is slower) is not written again in the Note of another node. - Each topic has a `###` heading that says in one plain phrase what the topic wants to say (a warning calls for attention). Under it, one or two phrases. Indent at most one level. A polite register. - Point at nodes by their names; to have a value changed, write the node name and the widget name ("set sage_attention on Patch Sage Attention KJ to disabled"). -- Text to be copied exactly is in quotation marks, not inline code (`), which breaks in the legacy renderer and on coloured Notes. -- Bad: pointing at nodes by their colour (a bypassed node loses its colour). +- Text to be copied exactly is in quotation marks, not inline code (`), which breaks in the legacy renderer and on colored Notes. +- Bad: pointing at nodes by their color (a bypassed node loses its color). ## Where to place diff --git a/skills/comfyui-readable-node/references/readable-form.md b/skills/comfyui-readable-node/references/readable-form.md index 7e6986c..a731d59 100644 --- a/skills/comfyui-readable-node/references/readable-form.md +++ b/skills/comfyui-readable-node/references/readable-form.md @@ -1,6 +1,6 @@ # The Readable Node form -What you decide when arranging a workflow, and what a finished workflow is checked against. The canvas does the rest (node sizes and widths, the fixed colours, rail heights, Reroute positions); its moves and checks are at the top of canvas.py. +What you decide when arranging a workflow, and what a finished workflow is checked against. The canvas does the rest (node sizes and widths, the fixed colors, rail heights, Reroute positions); its moves and checks are at the top of canvas.py. How to read a rule: the bold line says what to do. **Why** names the principle or goal of SKILL.md it serves; when a case is not covered, decide by it. **Bad** is the form that breaks the rule, as seen in a finished workflow. **Fine** is a form that looks like Bad but is not; a rule without Fine has no exception. Cases are in examples.md, "Layout", under the same section headings. @@ -32,7 +32,7 @@ How to read a rule: the bold line says what to do. **Why** names the principle o - Fine: back by at most the target's width plus one column gap, into Conditioning Zero Out or from an empty latent into a scheduler. **A wire is drawn directly. Reroutes are used only when, without them, one could not see where the wire goes (a value carried far or to several places: a rail). When a direct wire would be hidden behind a node, move its source or its target so it shows, before bending it with Reroutes.** Why: Reroutes cut one wire into pieces, and the reader must trace them to see where a value comes from. -- A rail is one value, or several side by side, carried with Reroutes. Write a `rail` line; it runs at the height the line writes (`above `, `below `, `level .`) or, with none written, at its source's output height, and gives every target after its first lowering Reroute the value from the rail. Rails of model, vae, clip and conditioning run in that order from the top wherever their runs overlap. Place the source and the targets so the rail runs where it should. The source that heads a rail (a loader, a value node) stands at its rail's height, loaders in that order; do not raise or lower it with a Reroute. The one exception: a source whose wire into the node right of it is level (from this output or another: Load Checkpoint with a Load LoRA on its model, a Load Image whose image goes level into its neighbour and also on a rail below) cannot stand at the rail's height, so the rail goes up or down with a Reroute right after the source. When the stages stand apart in groups of their own, the loaders' model and vae go to the later stages on rails; samplers that only stand next to each other (Wan 2.2 high and low noise) take them by direct wires. A conditioning rail runs above the samplers; the positive and the negative carried to a later stage run side by side, the positive on top, the negative just below it (not at two heights that cross); other rails are ordered so fewer wires cross. A rail for a side use (an image carried only to be shown or stitched for reference) runs below, written `below `: a rail above stands out on its own. +- A rail is one value, or several side by side, carried with Reroutes. Write a `rail` line; it runs at the height the line writes (`above `, `below `, `level .`) or, with none written, at its source's output height, and gives every target after its first lowering Reroute the value from the rail. Rails of model, vae, clip and conditioning run in that order from the top wherever their runs overlap. Place the source and the targets so the rail runs where it should. The source that heads a rail (a loader, a value node) stands at its rail's height, loaders in that order; do not raise or lower it with a Reroute. The one exception: a source whose wire into the node right of it is level (from this output or another: Load Checkpoint with a Load LoRA on its model, a Load Image whose image goes level into its neighbor and also on a rail below) cannot stand at the rail's height, so the rail goes up or down with a Reroute right after the source. When the stages stand apart in groups of their own, the loaders' model and vae go to the later stages on rails; samplers that only stand next to each other (Wan 2.2 high and low noise) take them by direct wires. A conditioning rail runs above the samplers; the positive and the negative carried to a later stage run side by side, the positive on top, the negative just below it (not at two heights that cross); other rails are ordered so fewer wires cross. A rail for a side use (an image carried only to be shown or stitched for reference) runs below, written `below `: a rail above stands out on its own. - Bad: a wire bent with Reroutes while neither its source nor its target was moved. One of a pair (positive and negative) on a rail and the other not. The same loader placed again for each stage. A rail that goes up and down. Two rails closer than the rail gap (a conditioning rail written just under the vae rail): the loaders heading the upper rails go up together, so the gap opens. A rail lifted off its source's output height by a Reroute where a line at that height would pass behind nothing (two values of Get Image Size raised to a height written in the rail line): the source stands at the height the rail runs, or the rail runs at the output height. - Fine: a rail inside or outside a group, off the group's title band. A rail of values (fps and so on) below the main flow. - Fine: wires passing behind a node that do not cross each other behind it (they come out in the order they went in). @@ -61,7 +61,7 @@ How to read a rule: the bold line says what to do. **Why** names the principle o - Fine: a node that takes conditioning as well as the image (InpaintModelConditioning, an image-taking text encoder) stands where its conditioning enters level; the image wire into it slants. **The sources wired straight into a sampler stand in one column, right edges aligned (`inputs`).** Why: follow along a single line. -- A side value (a size) wired into a node of the column is made level with `level`: the gap above that node takes the room the wire needs, the other gaps stay, and SamplerCustomAdvanced is centred on the column last. The room shows where the wire needs it. +- A side value (a size) wired into a node of the column is made level with `level`: the gap above that node takes the room the wire needs, the other gaps stay, and SamplerCustomAdvanced is centered on the column last. The room shows where the wire needs it. - Bad: those sources spread over several columns, or not right-aligned. **The model chain ends in the column just left of the leftmost node its last node feeds; its last node's right edge is that column's right edge.** Why: left to right; follow along a single line (a node stands right before the node that next uses it, and no wire goes back). The model goes to the node that takes it to sample (glossary, model chain): with a KSampler that column is the column of the sampler's sources; when a scheduler or guider in that column takes the model (SamplerCustomAdvanced), it is the column left of them. When the last node also gives the text encoders their CLIP (Load Checkpoint, a LoRA), the text encoders are further left: it stands in the column just left of them, and its model wire slants. @@ -90,14 +90,14 @@ How to read a rule: the bold line says what to do. **Why** names the principle o - Fine: a value the author put on a custom slider node: the slider goes; the value follows this rule (back into the widget, or into a core Int or Float when it is changed for each generation and reaches several nodes). A node that computes values (Resolution Selector) is not a value node: it stays even with a single target. Candidates wired into a Branch or a Create List. - Fine: a value node titled "display name: what the value is" (`Float: fps`, `Int: pixel count for 720p`); the display name follows "Language" in SKILL.md. -## 7. Groups and colour +## 7. Groups and color **A group holds one large function: a clearly separate stage, one of parallel stages of the same form, or a function switched with bypass. A workflow that does one simple thing has none. Decide by function, not by counting samplers or nodes.** Why: the whole picture at a glance (a group guides the eye). The title is in the user's language, as a Note's title is: a common name stays as it is (Hires.fix, Upscale); otherwise a short noun phrase for what the group does (Mask for IPAdapter), not a sentence explaining it. A group holds its function's loaders; shared loaders go into the group of the first stage that uses them; values shared by parallel stages go into no group. - Bad: stages that are clearly separate with no group. A group for each small piece of a stage: the stage's group holds them, and the frames of small groups leave the layout full of gaps. A group removed because a wire crossed its title band (move the wire or the group instead). A function switched with bypass whose nodes are not all in its group. Groups of stages operated in order not sharing their top and bottom edges (`group-align`). A wire over a group's title band. - Fine: no group for a bypass that switches what is in effect one node (a Canny with only a Preview of it, a VAE Decode Audio): the node itself is what is switched. -**Colour shows which function a node belongs to, on the few nodes that do one job.** Why: colour appropriately. Loaders, LoRAs and Notes have fixed colours (the canvas applies them; a Load CLIP whose CLIP reaches no text encoder, one that feeds only an LLM, has none). Five colours are left: brown, green, blue, pale_blue, cyan. The basic t2i / t2v form stays uncoloured; green is the part that makes this workflow differ from the basic form (the basic form is always the plain t2i / t2v of its model: in an edit, an i2i or an inpaint, the nodes that take the image in, and those that mask and stitch it, are green); ControlNet kinds are pale_blue; each other added function gets one colour. A group already guides the eye: nodes inside a group get no colour but the fixed ones. -- Bad: a sixth colour. A node only for looking (a Preview) coloured. Every node of a group coloured the same. One node of a function coloured while the nodes that do that function with it stay uncoloured (Generate Text green, its Text (Multiline) and its Load CLIP not). A node that only makes the run faster (a cache, an attention backend) coloured: it belongs to the basic form. +**Color shows which function a node belongs to, on the few nodes that do one job.** Why: color appropriately. Loaders, LoRAs and Notes have fixed colors (the canvas applies them; a Load CLIP whose CLIP reaches no text encoder, one that feeds only an LLM, has none). Five colors are left: brown, green, blue, pale_blue, cyan. The basic t2i / t2v form stays uncolored; green is the part that makes this workflow differ from the basic form (the basic form is always the plain t2i / t2v of its model: in an edit, an i2i or an inpaint, the nodes that take the image in, and those that mask and stitch it, are green); ControlNet kinds are pale_blue; each other added function gets one color. A group already guides the eye: nodes inside a group get no color but the fixed ones. +- Bad: a sixth color. A node only for looking (a Preview) colored. Every node of a group colored the same. One node of a function colored while the nodes that do that function with it stay uncolored (Generate Text green, its Text (Multiline) and its Load CLIP not). A node that only makes the run faster (a cache, an attention backend) colored: it belongs to the basic form. ## 8. Names diff --git a/skills/comfyui-readable-node/references/replacements.md b/skills/comfyui-readable-node/references/replacements.md index 134cea9..2fe336a 100644 --- a/skills/comfyui-readable-node/references/replacements.md +++ b/skills/comfyui-readable-node/references/replacements.md @@ -49,7 +49,7 @@ Each row's "Where verified" is which source it was verified in. When the node's |---|---|---|---| | Apply ControlNet (DEPRECATED) (ControlNetApply) | Apply ControlNet (ControlNetApplyAdvanced) | The old one receives one conditioning and also acts on the negative side. The new one receives positive and negative, so connect negative too | ControlNetApply and ControlNetApplyAdvanced in nodes.py (control_apply_to_uncond) | | Apply Controlnet with VAE (ControlNetApplySD3) | Apply ControlNet (ControlNetApplyAdvanced). `canvas open` replaces it when reading the original | Inputs and outputs have the same names. The calculation is the same (no successor is named) | comfy_extras/nodes_sd3.py and ControlNetApplyAdvanced in nodes.py | -| Painter (not deprecated, but not used: its drawing area shows only in Nodes 2.0) | Load Image, painted in its mask editor: the mask pen for the mask, the paint pen for colour. IMAGE is the image with the paint, MASK the masked area | Painter's image input becomes the image loaded in Load Image; whatever resized it before Painter now resizes Load Image's IMAGE and MASK both. Tell the user in the Note where to paint (right-click Load Image → Open in Mask Editor) | comfy_extras/nodes_painter.py; the mask editor of the frontend (paint layer, saves the painted image with the mask) | +| Painter (not deprecated, but not used: its drawing area shows only in Nodes 2.0) | Load Image, painted in its mask editor: the mask pen for the mask, the paint pen for color. IMAGE is the image with the paint, MASK the masked area | Painter's image input becomes the image loaded in Load Image; whatever resized it before Painter now resizes Load Image's IMAGE and MASK both. Tell the user in the Note where to paint (right-click Load Image → Open in Mask Editor) | comfy_extras/nodes_painter.py; the mask editor of the frontend (paint layer, saves the painted image with the mask) | ## May be removed (no effect on the result) diff --git a/skills/comfyui-readable-node/references/techniques.md b/skills/comfyui-readable-node/references/techniques.md index 87d8374..c7db69d 100644 --- a/skills/comfyui-readable-node/references/techniques.md +++ b/skills/comfyui-readable-node/references/techniques.md @@ -139,7 +139,7 @@ After: instruction → Generate Text.system_prompt (optional) body text → Generate Text.prompt ``` -- The behaviour changes slightly (it is passed as system). Write it in the report. +- The behavior changes slightly (it is passed as system). Write it in the report. - Where verified: TextGenerate in object_info. ## Display nodes diff --git a/skills/comfyui-readable-node/scripts/api_format.py b/skills/comfyui-readable-node/scripts/api_format.py index bb0d586..9756b2d 100644 --- a/skills/comfyui-readable-node/scripts/api_format.py +++ b/skills/comfyui-readable-node/scripts/api_format.py @@ -5,7 +5,7 @@ An API-format workflow has no positions, sizes, groups, Notes or bypassed nodes. The positions made here are the ones ComfyUI gives when it opens the file, so the original view shows what the user sees there. -Behaviour matched to the frontend (loadApiJson, then graph.arrange() and computeExecutionOrder): +Behavior matched to the frontend (loadApiJson, then graph.arrange() and computeExecutionOrder): - Nodes are created in the order of Object.keys: integer-like ids in ascending order first, then the others in file order. An id with ":" (a node from inside a subgraph) becomes the same id with "_". - The title is _meta.title (written only when it differs from the display name, as the frontend saves it). diff --git a/skills/comfyui-readable-node/scripts/canvas.py b/skills/comfyui-readable-node/scripts/canvas.py index 578e2b1..7c46df8 100644 --- a/skills/comfyui-readable-node/scripts/canvas.py +++ b/skills/comfyui-readable-node/scripts/canvas.py @@ -39,7 +39,7 @@ A text of several lines: write it in a file and give =@, the path from the current folder (\\n in a line stays two characters) link . . [. . ...] connects (in pairs, any number of pairs). Output by name or index, input by name. If B. already has a wire, it is replaced. Connecting to an autogrow input (values.c etc.) adds the slot - A Branch's input is named for what it carries: link .0 . (the next input, labelled); set + A Branch's input is named for what it carries: link .0 . (the next input, labeled); set branch= chooses it (the first by default) unlink . ... rm ... removes nodes (and their wires) @@ -64,7 +64,7 @@ may be all: every placed node but Notes (rail Reroutes too, not the unit being placed) with the group frames (note left all; align top all ) row ... [right ] [top|wire] one row from left to right (the first goes right of ref, or stays where it is). - Default: wire between neighbours that are wired, top between those that are not + Default: wire between neighbors that are wired, top between those that are not stack ... [below ] [left|right] one column from top to bottom align ... aligns to the first unit (the first does not move) align move aligns B to the first unit, moving the unit that holds B with it (a later @@ -78,13 +78,13 @@ node on the current canvas, by node type. Run it once, after the nodes are built and before writing the plan inputs puts the sources wired directly into that node in one right-aligned column on its left (in input order, top to bottom). Only the sources move; a source an earlier stage's sampler also takes stays with that stage. Column height: the source that carries the conditioning enters at the node's height (KSampler: the positive wire - horizontal); SamplerCustomAdvanced is centred on the column; any other node has its chain wire (else its first wired input) horizontal + horizontal); SamplerCustomAdvanced is centered on the column; any other node has its chain wire (else its first wired input) horizontal shape [right|below|left|above ] places the nodes of the second block in the same shape as the first (nodes of the same type are matched in order). For laying out similar stages, or giving split workflows the same layout level . . [move ] moves so that this wire is horizontal (default: moves B) B in an `inputs` column (a side value made level into it): the gap above B takes the room - (the other gaps stay), the side value is set level, a centred sampler is centred last + (the other gaps stay), the side value is set level, a centered sampler is centered last block ... makes a block (making it again replaces it). unblock group <unit> ... [color <color>] makes a group. The frame is recomputed from its nodes every time (padding measured from hand-made layouts) ungroup <title> @@ -148,7 +148,7 @@ node <id> a node's inputs/outputs, values and slot positions check the checks (unplaced, overlaps, narrow gaps, wires behind nodes, crossings, non-horizontal wires, backward wires, right edges of sampler inputs, empty band across everything, width differences and value node tops, - Preview above its source, gaps inside a column, gap to a wired neighbour, spacing in a row, + Preview above its source, gaps inside a column, gap to a wired neighbor, spacing in a row, consecutive Reroutes, Reroutes doing nothing, model Note top edge, rails that can run at the output height, single values carried with Reroutes, overlapping rails, rail order against loader order, raising Reroutes right of a loader, loader rails above their targets, wires over group titles, nodes overlapping groups, main flow off its line, Note away from its node, reference wire level and chain wire slanted, no wire level into a merging node, @@ -217,7 +217,7 @@ AUTO_LEVEL = True # the layout levels wires and closes gaps by itself (a test of one placing alone turns it off) # the layout keeps the plan's vertical relations and solves the heights all at once (relations.py); being built, off by default LAYOUT_SOLVE = False -# the layout's own fixes after the plan (levelling, widening and closing gaps, clearing below growing nodes, pulling rails +# the layout's own fixes after the plan (leveling, widening and closing gaps, clearing below growing nodes, pulling rails # together, railing wires along rails, separating groups, clearing frames). Off only to compare AUTO_FIX = False # after the plan's lines the canvas moves nothing by itself; a gap between two columns where wires cross 3 times or more @@ -291,7 +291,7 @@ def display_title(n, oi): def image_kind(t, oi): - """Whether a node type shows an image, recognised from object_info (by type name only for LOADS_WITH_PREVIEW): + """Whether a node type shows an image, recognized from object_info (by type name only for LOADS_WITH_PREVIEW): "save" for an output node that takes an IMAGE or VIDEO input and saves files ("save" in its category or name, or a filename_prefix input), "preview" for another output node that takes an IMAGE input and puts out nothing but IMAGE, "load" for a node with an input carrying image_upload or video_upload. None otherwise (also for a type not in object_info).""" @@ -408,7 +408,7 @@ def __init__(self, work, name, fresh=False): self.out = [] self.changed = set() self.moved = {} - self.in_layout = False # set while `layout` applies a plan (titles and colours it sets are undone on the next layout) + self.in_layout = False # set while `layout` applies a plan (titles and colors it sets are undone on the next layout) self.before = set() # ---- saving and undo @@ -467,7 +467,7 @@ def same_loader_width(self): left = self.placed(n) and any(abs(G.rect(m)[2] - G.rect(n)[2]) < 1 and self.stacked(n, m) for m in self.s["nodes"] if m is not n and self.placed(m) and m.get("type") not in {"Reroute"} | NOTE_TYPES and "Loader" not in (m.get("type") or "") and not self.is_model_loader(m)) - # widest first; if that overlaps a neighbour, at least the minimum width; else leave it as it is. A loader + # widest first; if that overlaps a neighbor, at least the minimum width; else leave it as it is. A loader # not kept on a right edge widens to the right, or to the left when widening to the right would eat the gap # to the node right of it (a loader placed left of a node keeps its gap to that node) before, done = G.rect(n) if self.placed(n) else None, False @@ -762,7 +762,7 @@ def port_in(self, tok): raise Stop(f"{nid} has no input {p} ({', '.join(i['name'] for i in n.get('inputs') or [])})") def branch_input(self, n, label): - """A Branch input named for what it carries: the input with that label, or the next autogrow.branchN, labelled + """A Branch input named for what it carries: the input with that label, or the next autogrow.branchN, labeled (the frontend shows the label and chooses by it).""" for i in n.get("inputs") or []: if i.get("label") == label: @@ -964,8 +964,8 @@ def is_sam3_prompt(self, n): def clip_loader_role_color(self): """A clip loader is yellow only when its CLIP reaches a text encoder (a node that makes conditioning). One that - feeds only something else (an LLM's Generate Text) does another job and takes no fixed colour; one that feeds - both is yellow. Run once the wires are known: the fixed colour is given when a node is copied.""" + feeds only something else (an LLM's Generate Text) does another job and takes no fixed color; one that feeds + both is yellow. Run once the wires are known: the fixed color is given when a node is copied.""" yellow = list(COLORS["yellow"]) for n in self.s["nodes"]: outs = [o.get("type") for o in n.get("outputs") or []] @@ -991,7 +991,7 @@ def clip_loader_role_color(self): if not reaches: n.pop("color", None) n.pop("bgcolor", None) - self.out.append(f"colour {n['id']}: no fixed yellow (its CLIP reaches no text encoder)") + self.out.append(f"color {n['id']}: no fixed yellow (its CLIP reaches no text encoder)") def default_color(self, n): outs = [o.get("type") for o in n.get("outputs") or []] @@ -2418,11 +2418,11 @@ def _chk_column_gap(cv, c): return out -@check_rule("gap to a wired neighbour") +@check_rule("gap to a wired neighbor") def _chk_wide_gap(cv, c): out = [] nodes, ws = c.nodes, c.ws # noqa: F841 - # the gap to a wired neighbour is wider than the standard gap (same row, nothing between them) + # the gap to a wired neighbor is wider than the standard gap (same row, nothing between them) seen_pair = set() for l in cv.s["links"]: o, t = nodes.get(l["origin_id"]), nodes.get(l["target_id"]) @@ -2441,7 +2441,7 @@ def _chk_wide_gap(cv, c): if cv.placed(m) and m["id"] not in (o["id"], t["id"]) and m.get("type") != "Reroute"): continue seen_pair.add((o["id"], t["id"])) - out.append(f"wide gap to a wired neighbour ({round(gap)}px, standard gap {round(std)}): {o['id']} → {t['id']}") + out.append(f"wide gap to a wired neighbor ({round(gap)}px, standard gap {round(std)}): {o['id']} → {t['id']}") return out @@ -4661,7 +4661,7 @@ def close_gaps(cv): if not _try_move_x(cv, unit, dx, lambda: _quick_bad(cv) <= bad and _group_intrusions(cv) <= intr): continue cv.translate(sorted(unit), dx, 0) - done.append(f"moved {round(dx)}px right towards {near['id']} which it feeds: {' '.join(sorted(unit))}") + done.append(f"moved {round(dx)}px right toward {near['id']} which it feeds: {' '.join(sorted(unit))}") moved = True break if not moved: @@ -5381,7 +5381,7 @@ def _op_inputs(cv, work, args): y += h + V_GAP # column height: the node stays (it stands on the eye line) and the column moves to it. The source that carries the # conditioning enters at the node's height: for KSampler etc. the positive wire is horizontal. A node that takes no - # conditioning (SamplerCustomAdvanced: its conditioning enters the guider) is centred on the column; the guider's + # conditioning (SamplerCustomAdvanced: its conditioning enters the guider) is centered on the column; the guider's # wire into it slants pos_l = next((l for l in cv.s["links"] if l["target_id"] == tid and l.get("type") == "CONDITIONING" and l["target_input"] in ("positive", "conditioning") and l["origin_id"] in srcs), None) @@ -5399,9 +5399,9 @@ def _op_inputs(cv, work, args): else: col = cv.bbox(srcs) dy = (rt[1] + rt[3]) / 2 - (col[1] + col[3]) / 2 - how = "node centred on the column" + how = "node centered on the column" cv.translate(srcs, 0, dy) - cv.s.setdefault("inputs_cols", {})[tid] = {"srcs": list(srcs), "centre": how == "node centred on the column"} + cv.s.setdefault("inputs_cols", {})[tid] = {"srcs": list(srcs), "center": how == "node centered on the column"} cv.out.append(f"sources of {tid} in one right-aligned column on its left ({how}): {' '.join(srcs)}") @@ -5481,7 +5481,7 @@ def respace_inputs_column(cv, tid, col): again. A node going down carries what it pushes; a node going up moves with what is level to it and goes no further than it stays clear (the main flow is not pushed for a side value): if it cannot reach, the gap above its target takes the rest (the target and the nodes below it go down), and the others keep the row gap (the skill author: the - room shows where the wire needs it); 3. last, a node centred on its column (SamplerCustomAdvanced) is centred + room shows where the wire needs it); 3. last, a node centered on its column (SamplerCustomAdvanced) is centered again, with what is wired level to it and what is stacked on it.""" srcs = [i for i in col["srcs"] if i in cv.nodes and cv.placed(cv.node(i))] if len(srcs) < 2: @@ -5551,7 +5551,7 @@ def clear_up(ids, u): # the gap above the target takes the rest: the target and what is below it go down k = srcs.index(short[0]) cv.translate(srcs[k:], 0, math.ceil(short[1])) - if col.get("centre"): + if col.get("center"): solid = [m for m in cv.s["nodes"] if cv.placed(m) and m.get("type") != "Reroute" and m.get("type") not in NOTE_TYPES] t, box = cv.node(tid), cv.bbox(srcs) rt = G.rect(t) @@ -5561,7 +5561,7 @@ def clear_up(ids, u): pairs = [(a, b) for a, b in horizontal_pairs(cv) if not ({a, b} & in_col)] mv = move_closure(cv, solid, {tid} | stacked, d, in_col, pairs) cv.translate(sorted(mv) if mv else sorted({tid} | stacked), 0, d) - cv.out.append(f"sources of {tid} given room for the level" + (f", {tid} centred on them again" if col.get("centre") else "")) + cv.out.append(f"sources of {tid} given room for the level" + (f", {tid} centered on them again" if col.get("center") else "")) def _op_width(cv, work, args): @@ -5731,14 +5731,14 @@ def _op_note(cv, work, args): if side != where[0] and not (side == "below" and grow)] # above or below a node with no edge written: the Note (wider than most nodes) sticks out to the side where nothing # stands. A node right of the ref: right edges aligned (it sticks out left); a node left: left edges aligned; none or - # both: centred. The other two are tried after, and the first that is clear is kept (notes.md: a Note touching a node) + # both: centered. The other two are tried after, and the first that is clear is kept (notes.md: a Note touching a node) if where[0] in ("above", "below") and len(where) == 2 and where[1] != "all": try: rb = cv.bbox(cv.unit(where[1])) except Stop: rb = None if rb: - # a neighbour beside the ref or beside where the Note goes + # a neighbor beside the ref or beside where the Note goes y0, y1 = (rb[1], rb[3] + V_GAP + h) if where[0] == "below" else (rb[1] - V_GAP - h, rb[3]) others = [G.rect(o) for o in cv.s["nodes"] if o["id"] != nid and cv.placed(o) and o["id"] not in cv.unit(where[1])] near = [r for r in others if r[1] < y1 and r[3] > y0] @@ -6075,7 +6075,7 @@ def apply_op(cv, work, cmd, args): # ---- layout by relations (LAYOUT_SOLVE): the plan's vertical relations are kept and the heights solved at once ---- # Order in which relations are added: the geometry of the plan's placing (always) -> the plan's level -# wires -> the canvas's levelling (readable-form, Wires, Bad) -> rails at their output heights -> the plan's other relations. Later plan lines +# wires -> the canvas's leveling (readable-form, Wires, Bad) -> rails at their output heights -> the plan's other relations. Later plan lines # first, so a later line wins as it does when the lines are run one by one. A relation that cannot hold with those # added before it is not kept, and is reported with its line. REL_WIRE, REL_LEVEL, REL_OTHER = 2, 3, 4 @@ -6392,15 +6392,15 @@ def add(rels): if o in rect and t in rect and abs(cv.out_xy(o, l["origin_slot"])[1] - cv.in_xy(t, l["target_input"])[1]) < 1: level_now.append((REL_WIRE, "eq", t, o, rect[t][1] - rect[o][1], f"wire {lname(cv, l)} (level where the plan put it)")) add(level_now) - # 3. the canvas's levelling: the wires one move made level before the problem started (solve_vertical), kept level + # 3. the canvas's leveling: the wires one move made level before the problem started (solve_vertical), kept level for l in moves: o, t = l["origin_id"], l["target_id"] if o in v and t in v: off = (cv.out_xy(o, l["origin_slot"])[1] - rect[o][1]) - (cv.in_xy(t, l["target_input"])[1] - rect[t][1]) - if p.try_equal(v[o], v[t], off, f"levelling {lname(cv, l)}")[0]: + if p.try_equal(v[o], v[t], off, f"leveling {lname(cv, l)}")[0]: notes.append(f" made horizontal: {lname(cv, l)}") # 4. rails, one at a time in the rail order: a rail of one target is first tried as a level direct wire. Otherwise - # its run is taken: the nodes along it whose centre is above its cut stay above it, the others below, and it keeps + # its run is taken: the nodes along it whose center is above its cut stay above it, the others below, and it keeps # its order with the rails taken before it. The cut is its output height (written: the unit's edge); when that cannot # hold, the nearest cut that can. Then the rail is put at its output height when that can hold (it moves with its # source), before the plan's other relations: a rail that leaves its output height needs a raising Reroute, a Bad @@ -6463,7 +6463,7 @@ def run_edges(idx, cut): # 5. the plan's other relations add([r for r in plan if r[0] == REL_OTHER]) # 6. no empty band between rails: from the lowest rail up, a rail at its output height - # comes down with its source (the nodes held to it) towards the next rail below, as far as that moves nothing else + # comes down with its source (the nodes held to it) toward the next rail below, as far as that moves nothing else y = p.solve() free = [i for i in taken if geo[i][6] is None and p.find(rv[i])[0] == p.find(v[rails[i][3]])[0]] for i in sorted(free, key=lambda i: -y[rv[i]]): @@ -6476,7 +6476,7 @@ def run_edges(idx, cut): def fits(gap): snap = p.snapshot() try: - if not p.try_edge(rv[j], rv[i], -gap, f"line {rails[i][0]} (towards the rail below)")[0]: + if not p.try_edge(rv[j], rv[i], -gap, f"line {rails[i][0]} (toward the rail below)")[0]: return False y1 = p.solve() moved = {u for u in range(len(y)) if abs(y1[u] - y[u]) >= 1} @@ -6495,9 +6495,9 @@ def fits(gap): lo = mid lo = hi if lo < y[rv[j]] - y[rv[i]] - 1: - p.try_edge(rv[j], rv[i], -lo, f"line {rails[i][0]} (towards the rail below)") + p.try_edge(rv[j], rv[i], -lo, f"line {rails[i][0]} (toward the rail below)") y2 = p.solve() - notes.append(f" line {rails[i][0]}: rail pulled {round(y2[rv[i]] - y[rv[i]])}px down towards the rail of line " + notes.append(f" line {rails[i][0]}: rail pulled {round(y2[rv[i]] - y[rv[i]])}px down toward the rail of line " f"{rails[j][0]}, with its source") y = y2 for i in ids: @@ -6557,7 +6557,7 @@ def do_layout(cv, work, args): n["pos"] = None prev = n.pop("layout_prev", None) if prev: - # titles and colours the previous plan set go back to what they were before it (build-time ones stay) + # titles and colors the previous plan set go back to what they were before it (build-time ones stay) if "title" in prev: if prev["title"] is None: n.pop("title", None) @@ -6790,7 +6790,7 @@ def run_line(k, raw, toks): # rails written at the same place (above X / below X) are stacked in the rules' order whatever order the plan # lists them in: from the top model, vae, clip, then conditioning, then the rest; the outputs of one node in slot # order (positive right above its negative). For above the last in that order is nearest X, for below the first - # (listed as model, vae, vae under `above 1`, they had stacked upwards in reverse) + # (listed as model, vae, vae under `above 1`, they had stacked upward in reverse) def stack_key(i): k, raw, args, oid, slot, targets = rails[i] t = rail_type(cv, oid, slot) @@ -6958,7 +6958,7 @@ def violations(lines, how="fix them in the plan"): (("model chain end",), "The model chain ends in the column"), (("right edges of the sources",), "The sources wired straight into a sampler"), (("overlap:", "is directly below"), "No node is hidden"), - (("narrow gap", "rail too close to a node", "empty band", "gap inside a column", "wide gap to a wired neighbour", "uneven spacing", + (("narrow gap", "rail too close to a node", "empty band", "gap inside a column", "wide gap to a wired neighbor", "uneven spacing", "times in the gap"), "Wires show and nothing is packed"), (("output node stepped down",), "An output node (Save, Preview"), (("wire behind a node", "Reroute", "single value carried", "rail needs no raising", "rails too close", @@ -7353,7 +7353,7 @@ def clear(): cv.translate(sorted(mv), 0, d) for j in mine: lanes[j][0] += d - out.append(f"rail of {oid} pulled {round(d)}px down towards the rail below, with {' '.join(sorted(mv))}") + out.append(f"rail of {oid} pulled {round(d)}px down toward the rail below, with {' '.join(sorted(mv))}") return out @@ -7420,7 +7420,7 @@ def one_target_height(cv, oid, slot, tins, spec, y, notes, k): def settle_rail_moves(cv, rails, lanes, rail_move, notes): """Rails written with `move <unit>`: the unit goes up or down with its rail, so it must not stand on a rail below it. Such a rail goes up until the unit clears the rail below by the rail gap; a rail above it that it then comes too - close to (or passes) goes up too, and so on upwards, so the rails keep their order from the top. A rail pushed up + close to (or passes) goes up too, and so on upward, so the rails keep their order from the top. A rail pushed up that ran at its source's output height, or that a loader heads, takes its source (with its block) along, so no Reroute lifts it. Then the units move, once each, and a rail of a moved source that ran at its output height moves with it. Changes lanes and rail_move; moves nodes.""" @@ -7890,7 +7890,7 @@ def _short(v, limit): def _node_def(n, oi, title=None): - """What does not move: type, title, slots (name, type, wired), widget rows (name, kind, value), colours, mode.""" + """What does not move: type, title, slots (name, type, wired), widget rows (name, kind, value), colors, mode.""" t = n.get("type") or "?" d = {"t": t, "n": title or display_title(n, oi)} for k, src in (("c", "color"), ("bg", "bgcolor")): @@ -7958,7 +7958,7 @@ def wire_key(origin, slot, target, inp): def _view(cv, defs): """One state as the page draws it: placed nodes [id, x, y, w, h, def], wires [x0, y0, x1, y1, type, key], - groups [title, x, y, w, h, colour]. Positions are the body's top-left (the title bar is above, as in ComfyUI).""" + groups [title, x, y, w, h, color]. Positions are the body's top-left (the title bar is above, as in ComfyUI).""" nodes = [[n["id"], round(n["pos"][0]), round(n["pos"][1]), round(n["size"][0]), round(n["size"][1]), defs(_node_def(n, cv.oi))] for n in cv.s["nodes"] if n.get("pos") is not None and n.get("size")] wires = [] diff --git a/skills/comfyui-readable-node/scripts/comfy_schema.py b/skills/comfyui-readable-node/scripts/comfy_schema.py index 66f4dd5..fc93a99 100644 --- a/skills/comfyui-readable-node/scripts/comfy_schema.py +++ b/skills/comfyui-readable-node/scripts/comfy_schema.py @@ -5,7 +5,7 @@ - Whether two types can be connected (same rule as the frontend) - Whether a node is core (decided by python_module) -Rules matched to the frontend's behaviour: +Rules matched to the frontend's behavior: - Inputs are ordered input_order.required -> input_order.optional -> the rest - An input becomes a widget when its type is a widget type and it is not forceInput - INT with control_after_generate, or named seed / noise_seed, is followed by 1 control widget diff --git a/skills/comfyui-readable-node/scripts/flatten.py b/skills/comfyui-readable-node/scripts/flatten.py index 82ed776..9de8e5b 100644 --- a/skills/comfyui-readable-node/scripts/flatten.py +++ b/skills/comfyui-readable-node/scripts/flatten.py @@ -11,9 +11,9 @@ What it does not do: muted and bypassed nodes are kept (whether to split them off is the agent's call). PrimitiveNode is a visible link, so it is kept (replacing it with a typed value node, or moving the value back into a widget, is done by replace.py). -What it drops: positions, sizes, colours, groups, subgraph nesting, and titles the author gave (only the +What it drops: positions, sizes, colors, groups, subgraph nesting, and titles the author gave (only the meaning is taken, so the old layout does not bias the new one). -Anything Everywhere's group and colour restrictions are still computed on the original graph, before +Anything Everywhere's group and color restrictions are still computed on the original graph, before anything is dropped (ue.py). Group names and author titles are not used for layout; they are kept separately in author_words as material for Notes (not attached to nodes). @@ -30,7 +30,7 @@ author_words: the author's words (material for Notes; not used for layout) "titles": [{"id", "type", "title"}] titles the author gave (ones equal to the display name or type are left out) "groups": [{"title", "scope", "nodes": [id, ...]}] groups and the nodes that were in them - (as in the frontend, nodes whose rectangle centre lies in the group; nested groups both count) + (as in the frontend, nodes whose rectangle center lies in the group; nested groups both count) "subgraphs": [{"scope", "title", "nodes": [id, ...]}] subgraph titles (instance title or definition name) and their nodes nodes lists only nodes left after expansion (Reroutes and Set/Get are gone). @@ -558,7 +558,7 @@ def collect_author_words(self): continue members = [] for nid in g["order"]: - c = self._node_centre(g["nodes"][nid]) + c = self._node_center(g["nodes"][nid]) if c and b[0] <= c[0] <= b[0] + b[2] and b[1] <= c[1] <= b[1] + b[3]: members.append(self.eid(path, nid)) groups.append({"title": grp.get("title") or "", "scope": scope, "members": members}) @@ -575,8 +575,8 @@ def _xy(v): return [v.get("0", 0), v.get("1", 0)] return list(v) if isinstance(v, (list, tuple)) and len(v) >= 2 else None - def _node_centre(self, node): - """Centre of a node's rectangle (including the title bar), the way the frontend decides which nodes are in a group. + def _node_center(self, node): + """Center of a node's rectangle (including the title bar), the way the frontend decides which nodes are in a group. A collapsed node's width depends on its title's text width, which cannot be measured here, so the frontend's default collapsed width (80) is used.""" pos, size = self._xy(node.get("pos")), self._xy(node.get("size")) @@ -624,7 +624,7 @@ def run(self): n["widgets"], n["widgets_exact"] = self.widget_map(n) # The size of a custom node that is not installed in ComfyUI cannot be computed. Keep only the size # it had when the author opened it with the node installed (saved in the original workflow), so the - # layout never makes it smaller than that (position and colour are still dropped) + # layout never makes it smaller than that (position and color are still dropped) size = self._xy(n.get("size")) if size and n.get("type") not in self.oi and n.get("type") not in REROUTE_TYPES \ and not (n.get("flags") or {}).get("collapsed"): diff --git a/skills/comfyui-readable-node/scripts/geometry.py b/skills/comfyui-readable-node/scripts/geometry.py index 6f8fd97..300bc22 100644 --- a/skills/comfyui-readable-node/scripts/geometry.py +++ b/skills/comfyui-readable-node/scripts/geometry.py @@ -1,7 +1,7 @@ """Node shapes, slot positions and wire shapes, computed the same way the frontend (litegraph) does. Python standard library only. -Behaviour checked against positions the frontend produces: +Behavior checked against positions the frontend produces: - The title bar is 30px above pos. The rectangle a node occupies is [x, y - 30, w, h + 30]. - Slots of inputs without a widget, and outputs, sit at y = pos.y + (k + 0.7) x 20 (k is the index among inputs without a widget, or among outputs). Inputs are at x = pos.x + 10, outputs at x = pos.x + w + 1 - 10. diff --git a/skills/comfyui-readable-node/scripts/legacy_groups.py b/skills/comfyui-readable-node/scripts/legacy_groups.py index ca526a2..3ab0d89 100644 --- a/skills/comfyui-readable-node/scripts/legacy_groups.py +++ b/skills/comfyui-readable-node/scripts/legacy_groups.py @@ -4,7 +4,7 @@ into its inner nodes. This module produces the same graph at the top level, so the reader can then treat the workflow like any other. -How a group instance maps onto its inner nodes (the behaviour this module reproduces): +How a group instance maps onto its inner nodes (the behavior this module reproduces): * The group exposes, in order: first every *socket* input of the inner nodes that is not fed from inside the group (inner nodes taken in index order), then every *widget* of the inner nodes that is diff --git a/skills/comfyui-readable-node/scripts/read_workflow.py b/skills/comfyui-readable-node/scripts/read_workflow.py index 5e097ad..338aa23 100644 --- a/skills/comfyui-readable-node/scripts/read_workflow.py +++ b/skills/comfyui-readable-node/scripts/read_workflow.py @@ -10,7 +10,7 @@ "extra": {...}, } -Pitfalls when reading (behaviour matched to the frontend): +Pitfalls when reading (behavior matched to the frontend): - Top-level links are 6-element arrays; links inside subgraphs are objects. In version 1 workflows the top-level links are objects too. - A subgraph's input node is -10, its output node -20. diff --git a/skills/comfyui-readable-node/scripts/render.py b/skills/comfyui-readable-node/scripts/render.py index ea7a1d6..ff6220f 100644 --- a/skills/comfyui-readable-node/scripts/render.py +++ b/skills/comfyui-readable-node/scripts/render.py @@ -1,7 +1,7 @@ """Draw a preview picture (PNG) so the agent can look at the layout and correct its decisions. Python standard library only. -Draws groups, nodes (colour, title bar, id and title) and wires (the same spline as the frontend, coloured by type). +Draws groups, nodes (color, title bar, id and title) and wires (the same spline as the frontend, colored by type). Wires passing behind a node are drawn as thick white lines, so the check result can be seen. Text uses a 5x7 bitmap font (capital letters, digits, symbols). Lower case is drawn as capitals; characters outside the font (CJK, etc.) are left out of titles, and anything else unknown becomes "?". @@ -24,8 +24,8 @@ NODE_TITLE = (51, 51, 51) BORDER = (90, 90, 90) TEXT = (230, 230, 230) -HIT = (255, 255, 255) # marks a wire passing behind a node: white, unlike any type colour (to tell it from VAE red) -# wire colours of the frontend's dark palette +HIT = (255, 255, 255) # marks a wire passing behind a node: white, unlike any type color (to tell it from VAE red) +# wire colors of the frontend's dark palette LINK_COLORS = { "MODEL": "#B39DDB", "CLIP": "#FFD500", "VAE": "#FF6E6E", "CONDITIONING": "#FFA931", "LATENT": "#FF9CF9", "IMAGE": "#64B5F6", "MASK": "#81C784", "CONTROL_NET": "#6EE7B7", "CLIP_VISION": "#A8DADC", diff --git a/skills/comfyui-readable-node/scripts/replace.py b/skills/comfyui-readable-node/scripts/replace.py index 5602fb1..481478b 100644 --- a/skills/comfyui-readable-node/scripts/replace.py +++ b/skills/comfyui-readable-node/scripts/replace.py @@ -11,7 +11,7 @@ 2b. Replacement of a custom node by a core node that does the same job (CORE_REPLACEMENTS: Image Comparer (rgthree) by ImageCompare). Recorded with by "core_node". -How list entries are read (behaviour matched to ComfyUI's server and frontend): +How list entries are read (behavior matched to ComfyUI's server and frontend): - input_mapping: {"new_id", "old_id"} copies an old input (a link or a widget value) to a new input. {"new_id", "set_value"} sets a value. Inputs not listed are not copied (the new node's default is used and the link is cut). @@ -34,7 +34,7 @@ After replacing, the types of links into and out of replaced nodes are checked with validate.py; failures become warnings. -3. The frontend's PrimitiveNode (an untyped value node; deprecated). Its behaviour, matched to the frontend: +3. The frontend's PrimitiveNode (an untyped value node; deprecated). Its behavior, matched to the frontend: it writes its value into the widget it is connected to. Numbers and combos get a control widget ("fixed" by default when the target input has no control_after_generate; seed-like inputs use that input's control). widgets_values is [value, control, (filter for combos)]. diff --git a/skills/comfyui-readable-node/scripts/report.py b/skills/comfyui-readable-node/scripts/report.py index 0c344ed..af1c3a2 100644 --- a/skills/comfyui-readable-node/scripts/report.py +++ b/skills/comfyui-readable-node/scripts/report.py @@ -20,7 +20,7 @@ LANGS = ("en", "ja") # the languages the page's own sentences are written in; any other code gets English -# wire colours of the frontend's dark palette (the same as render.py) +# wire colors of the frontend's dark palette (the same as render.py) LINK_COLORS = { "MODEL": "#B39DDB", "CLIP": "#FFD500", "VAE": "#FF6E6E", "CONDITIONING": "#FFA931", "LATENT": "#FF9CF9", "IMAGE": "#64B5F6", "MASK": "#81C784", "CONTROL_NET": "#6EE7B7", "CLIP_VISION": "#A8DADC", @@ -198,9 +198,9 @@ def _x_put(S, a, x, d): u, r = S.unit(unit), S.unit(ref) where_en = {"right": "to the right of", "left": "to the left of", "below": "below", "above": "above"}[how] where_ja = {"right": "の右", "left": "の左", "below": "の下", "above": "の上"}[how] - al_en = {"top": ", tops aligned", "bottom": ", bottoms aligned", "middle": ", centred vertically", + al_en = {"top": ", tops aligned", "bottom": ", bottoms aligned", "middle": ", centered vertically", "wire": " and made the wire between them horizontal", "left": ", left edges aligned", - "right": ", right edges aligned", "center": ", centred horizontally"} + "right": ", right edges aligned", "center": ", centered horizontally"} al_ja = {"top": "上端をそろえて", "bottom": "下端をそろえて", "middle": "上下の真ん中をそろえて", "wire": "間の線が水平になる高さで", "left": "左端をそろえて", "right": "右端をそろえて", "center": "左右の真ん中をそろえて"} if align is None: @@ -215,7 +215,7 @@ def _x_put(S, a, x, d): def _x_row(S, a, x, d): pos, opt = _opts(a, keyed=("right", "gap")) units = [p for p in pos if p not in ("top", "wire")] - # without top or wire, the canvas makes the wire horizontal between wired neighbours and aligns the tops of the others + # without top or wire, the canvas makes the wire horizontal between wired neighbors and aligns the tops of the others w = x.get("wired") wire = "wire" in pos or (isinstance(w, list) and w and all(w)) some = "top" not in pos and not wire and isinstance(w, list) and any(w) @@ -223,7 +223,7 @@ def _x_row(S, a, x, d): if S.ja: tail = "。線は水平にしました" if wire else ("。線でつながる隣どうしは線を水平に、ほかは上端をそろえました" if some else "") return f"{S.many(units, 4, d=d)} を左から右へ一列に並べました{start}{tail}" - tail = ", with horizontal wires" if wire else (", wires horizontal between wired neighbours and tops aligned elsewhere" if some else "") + tail = ", with horizontal wires" if wire else (", wires horizontal between wired neighbors and tops aligned elsewhere" if some else "") return f"Lined up {S.many(units, 4, d=d)} in one row from left to right{start}{tail}" @@ -240,7 +240,7 @@ def _x_stack(S, a, x, d): def _x_align(S, a, x, d): edge, units = a[0], a[1:] en = {"top": "top edges", "bottom": "bottom edges", "left": "left edges", "right": "right edges", - "middle": "vertical centres", "center": "horizontal centres"} + "middle": "vertical centers", "center": "horizontal centers"} ja = {"top": "上端", "bottom": "下端", "left": "左端", "right": "右端", "middle": "上下の真ん中", "center": "左右の真ん中"} if S.ja: return f"{S.many(units[1:])} の{ja[edge]}を {S.unit(units[0])} にそろえました" @@ -313,8 +313,8 @@ def _x_group_align(S, a, x, d): def _x_color(S, a, x, d): c, ids = a[0], a[1:] if c == "none": - return S.L(f"Removed the colour of {S.many(ids)}", f"{S.many(ids)} の色を外しました") - return S.L(f"Coloured {S.many(ids)} {c.replace('_', ' ')}", f"{S.many(ids)} を{COLOR_JA.get(c, c)}にしました") + return S.L(f"Removed the color of {S.many(ids)}", f"{S.many(ids)} の色を外しました") + return S.L(f"Colored {S.many(ids)} {c.replace('_', ' ')}", f"{S.many(ids)} を{COLOR_JA.get(c, c)}にしました") def _x_rail(S, a, x, d): @@ -523,8 +523,8 @@ def _ids(S, s, limit=6): ("space", r"^gap inside a column \((\d+)px tall, min (\d+)\): nothing between (\S+) and (\S+)$", lambda S, m: S.L(f"An empty {m.group(1)} px gap inside a column, between {S.node(m.group(3))} and {S.node(m.group(4))}", f"列の中で {S.node(m.group(3))} と {S.node(m.group(4))} の間が {m.group(1)} px 空いています")), - ("space", r"^wide gap to a wired neighbour \((\d+)px, standard gap (\d+)\): (\S+) → (\S+)$", - lambda S, m: S.L(f"{S.node(m.group(3))} and its wired neighbour {S.node(m.group(4))} are {m.group(1)} px apart (standard {m.group(2)})", + ("space", r"^wide gap to a wired neighbor \((\d+)px, standard gap (\d+)\): (\S+) → (\S+)$", + lambda S, m: S.L(f"{S.node(m.group(3))} and its wired neighbor {S.node(m.group(4))} are {m.group(1)} px apart (standard {m.group(2)})", f"つながった隣どうしの {S.node(m.group(3))} と {S.node(m.group(4))} が {m.group(1)} px 離れています(標準 {m.group(2)} px)")), ("reroute", r"^consecutive Reroutes .*: (\S+) → (\S+)$", lambda S, m: S.L(f"Two Reroutes in a row ({S.node(m.group(1))} → {S.node(m.group(2))}); one is enough", @@ -600,7 +600,7 @@ def problem_text(p, lang): f"{S.unit(m.group(1))} はまだ置かれていなかったので、左上 (0, 0) に置きました")), (r"^sources of (\S+) in one right-aligned column on its left \((.*)\): (.*)$", lambda S, m: S.L(f"put the nodes feeding {S.node(m.group(1))} ({_ids(S, m.group(3), 4)}) in a column on its left" - + (", positive wire horizontal" if "positive" in m.group(2) else ", centred on the column"), + + (", positive wire horizontal" if "positive" in m.group(2) else ", centered on the column"), f"{S.node(m.group(1))} につながる {_ids(S, m.group(3), 4)} を左に一列で置きました" + ("(positive の線を水平に)" if "positive" in m.group(2) else "(列の真ん中に合わせて)"))), (r"^(\S+) in the same shape as (\S+): ", lambda S, m: S.L(f"laid out {S.unit(m.group(1))} in the same shape as {S.unit(m.group(2))}", @@ -620,7 +620,7 @@ def problem_text(p, lang): (r'^group "(.*)": (.*?) frame', lambda S, m: S.L(f"group “{m.group(1)}” around {len(m.group(2).split())} nodes", f"グループ「{m.group(1)}」: ノード {len(m.group(2).split())} 個を囲む")), (r"^aligned top and bottom edges: ", lambda S, m: S.L("aligned the top and bottom edges of the groups", "グループの上端と下端をそろえました")), - (r"^color (\S+): (\S+)$", lambda S, m: S.L(f"coloured {S.node(m.group(1))} {m.group(2).replace('_', ' ')}", + (r"^color (\S+): (\S+)$", lambda S, m: S.L(f"colored {S.node(m.group(1))} {m.group(2).replace('_', ' ')}", f"{S.node(m.group(1))} を{COLOR_JA.get(m.group(2), m.group(2))}にしました")), (r"^title (\S+): (.*)$", lambda S, m: S.L(f"titled {S.node(m.group(1))} “{m.group(2)}”", f"{S.node(m.group(1))} の題名を「{m.group(2)}」にしました")), (r"^Note (\S+): width (\d+), height (\d+)$", lambda S, m: S.L(f"placed the Note {S.node(m.group(1))} ({m.group(2)} × {m.group(3)})", @@ -776,7 +776,7 @@ def _icon(name): return f'<svg class="icon" viewBox="0 0 24 24" aria-hidden="true">{ICONS[name]}</svg>' -ACCENT = "#ff5a1f" # the one colour that marks "now" (the needle, the current step, the moved nodes); the logo's wire +ACCENT = "#ff5a1f" # the one color that marks "now" (the needle, the current step, the moved nodes); the logo's wire LOGO_FILE = Path(__file__).with_name("logo.svg") REPO = "https://github.com/nomadoor/comfyui-readable-node" # the browser tab's icon: the logo's wire on a dark rounded square @@ -789,7 +789,7 @@ def _logo(): return LOGO_FILE.read_text(encoding="utf-8").strip() if LOGO_FILE.is_file() else '<span class="name">ComfyUI Readable Node</span>' -# Colour only where it means something: the accent for "now", green for solved or added, red for problems, yellow for +# Color only where it means something: the accent for "now", green for solved or added, red for problems, yellow for # changed. A button's name floats just above it (or below, at the top of the page); nothing moves when the system asks # for less motion. STYLE = """ @@ -844,7 +844,7 @@ def _logo(): .seg button .icon{width:16px;height:16px} .seg button[aria-pressed=true] .draw{animation:rn-draw .45s cubic-bezier(.65,0,.35,1) backwards} .seg button[aria-pressed=true] .dot2{animation:rn-fade .22s .36s ease-out backwards} -/* workflow tabs, like a browser's: the chosen tab has the canvas colour and runs into the canvas below */ +/* workflow tabs, like a browser's: the chosen tab has the canvas color and runs into the canvas below */ .tabs{display:flex;align-items:flex-end;gap:2px;min-width:0;padding:0 10px;overflow-x:auto;overflow-y:hidden;scrollbar-width:none} .tabs::-webkit-scrollbar{display:none} .tabs button{position:relative;flex:none;height:40px;padding:0 16px 8px;border-radius:9px 9px 0 0;font-size:14px;font-weight:600;color:var(--muted);white-space:nowrap;transition:color var(--t-hover) ease} @@ -1065,7 +1065,7 @@ def _logo(): function el(tag, cls, text){ const e = document.createElement(tag); if (cls) e.className = cls; if (text !== undefined) e.textContent = text; return e; } function sum(text, n){ const e = el('summary', null, text); e.appendChild(el('span', 'n', String(n))); return e; } // a fold's heading with its count -// ---------- colours (read from the CSS variables, so the drawing follows the light and dark themes) +// ---------- colors (read from the CSS variables, so the drawing follows the light and dark themes) const TH = {}; const probe = document.createElement('canvas').getContext('2d'), rgbCache = new Map(), mixCache = new Map(); function rgb(c){ @@ -1198,7 +1198,7 @@ def _logo(): if (lod > 0){ rr(x + 2, y - TITLE + 4, w, h + TITLE, 9); ctx.fillStyle = TH.shadow; ctx.fill(); } rr(x, y - TITLE, w, h + TITLE, 8); ctx.fillStyle = body; ctx.fill(); rr(x, y - TITLE, w, TITLE, [8, 8, 0, 0]); ctx.fillStyle = head; ctx.fill(); - // bypass: the whole node in the frontend's bypass colour (NODE_BYPASS_BGCOLOR #FF00FF), as ComfyUI shows it + // bypass: the whole node in the frontend's bypass color (NODE_BYPASS_BGCOLOR #FF00FF), as ComfyUI shows it if (def.m === 4){ rr(x, y - TITLE, w, h + TITLE, 8); ctx.fillStyle = 'rgba(255,0,255,.5)'; ctx.fill(); } if (lod < 1) return; ctx.beginPath(); ctx.arc(x + 15, y - TITLE / 2, 4.5, 0, 6.2832); ctx.fillStyle = TH['slot-text']; ctx.globalAlpha *= .55; ctx.fill(); ctx.globalAlpha /= .55; @@ -1487,7 +1487,7 @@ def _logo(): const ic = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); ic.setAttribute('viewBox', '0 0 24 24'); ic.innerHTML = MICON[key]; t.append(txt, ic); grid.appendChild(t); T.m[key] = {now, was}; } - // what the coloured outlines on the canvas mean; pointing at one lights up those nodes of this step + // what the colored outlines on the canvas mean; pointing at one lights up those nodes of this step const keys = $('keys'); keys.innerHTML = ''; for (const key of ['moved', 'added', 'changed', 'removed', 'behind']){ const sw = el('span', 'sw ' + key), k1 = el('span', 'k', U.units[key]), d1 = el('span', 'd', U.keys_note[key]); @@ -1548,7 +1548,7 @@ def _logo(): } // ---------- the timeline: the whole run from the first step to the last, and a line where we are now. -// The grey area is the number of the four problems at each step, so the steps that made or solved problems show. +// The gray area is the number of the four problems at each step, so the steps that made or solved problems show. // ---------- the walkthrough: the finished workflow, part by part in processing order (written by the agent that rebuilt it) function inline(parent, text){ // `code` and **bold** inside a line; everything else is plain text (the split puts the marked pieces at the odd places) diff --git a/skills/comfyui-readable-node/scripts/ue.py b/skills/comfyui-readable-node/scripts/ue.py index 0e9fdb7..749390e 100644 --- a/skills/comfyui-readable-node/scripts/ue.py +++ b/skills/comfyui-readable-node/scripts/ue.py @@ -3,7 +3,7 @@ Called by flatten.py on each saved graph before subgraphs are expanded. The saved ``extra.ue_links`` is not trusted (it is not refreshed on save), so the links are recomputed from the nodes. -Behaviour reproduced (matching version 7.8 of the pack): +Behavior reproduced (matching version 7.8 of the pack): * Broadcasters are active (mode 0) nodes whose type starts with "Anything Everywhere", plus "Seed Everywhere", "Prompts Everywhere", and ordinary nodes marked ``properties.ue_convert`` (they @@ -15,7 +15,7 @@ by a bypass also counts). A widget input is a receiver only when ``widget_ue_connectable`` enables it (or, for saves older than 7.0, when the widget had been converted to a socket). * A receiver takes the offer with the highest priority among those whose type matches and whose - restrictions (group, colour, title / input / group regexes, repeated-type rules) allow it. A tie is + restrictions (group, color, title / input / group regexes, repeated-type rules) allow it. A tie is left unconnected and reported. * Seed Everywhere is replaced by a PrimitiveInt; flatten.py removes the other broadcasters afterwards. """ @@ -123,7 +123,7 @@ def through_bypass(self, link): link = self.links.get(lid) return None - def centre_in(self, node, bounding): + def center_in(self, node, bounding): pos, size = node.get("pos"), node.get("size") if not pos or not size: return False @@ -132,7 +132,7 @@ def centre_in(self, node, bounding): return x <= cx <= x + w and y <= cy <= y + h def members(self, group): - return [n for n in self.order if self.centre_in(self.nodes[n], group["bounding"])] + return [n for n in self.order if self.center_in(self.nodes[n], group["bounding"])] def sends_to_disabled(self): """The pack's "connect to bypassed" option is not saved; infer it from the saved links.""" @@ -190,7 +190,7 @@ def _paired(pairing, node, inp): def _scope(gv, nid, node, s): - """Node ids this broadcaster may reach, from its group / colour / group-regex restrictions.""" + """Node ids this broadcaster may reach, from its group / color / group-regex restrictions.""" allowed = None by_group = s.get("group_restricted") or 0 if by_group: @@ -200,10 +200,10 @@ def _scope(gv, nid, node, s): if nid in m: mine.update(m) allowed = list(mine) if by_group == 1 else [n for n in gv.order if n not in mine] - by_colour = s.get("color_restricted") or 0 - if by_colour: + by_color = s.get("color_restricted") or 0 + if by_color: pool = allowed if allowed is not None else gv.order - allowed = [n for n in pool if (gv.nodes[n].get("color") == node.get("color")) == (by_colour == 1)] + allowed = [n for n in pool if (gv.nodes[n].get("color") == node.get("color")) == (by_color == 1)] grx = _compiled(s, "group") if grx: inside = set() @@ -234,7 +234,7 @@ def _offers(gv, nid, node): scope = _scope(gv, nid, node, s) if s.get("seed_inputs"): return [_Offer(nid, "INT", (nid, 0), _priority(node, s, set()), s, scope, seed=True)] - sources = [] # (the slot it is labelled by, the link it comes from) + sources = [] # (the slot it is labeled by, the link it comes from) if (node.get("properties") or {}).get("ue_convert"): off = s.get("output_not_broadcasting") or {} for i, o in enumerate(node.get("outputs") or []): diff --git a/tests/test_canvas.py b/tests/test_canvas.py index 45f6429..1273e52 100644 --- a/tests/test_canvas.py +++ b/tests/test_canvas.py @@ -139,7 +139,7 @@ def test_put_side_by_side_without_a_wire_aligns_tops(self): self.do("put 26 right 12") self.assertEqual(self.rect("26")[1], self.rect("12")[1]) - def test_row_levels_wired_neighbours_by_default(self): + def test_row_levels_wired_neighbors_by_default(self): self.do("put 27 origin") self.do("row 27 13") cv = self.cv() @@ -1264,11 +1264,11 @@ def test_a_note_placed_inside_a_block_moves_with_the_block(self): """ self.do(f"layout {self.write_plan(plan)}") n, r = self.rect("note_blk"), self.rect("30") - # nothing stands beside 30: the Note is centred under it, and moved with the block + # nothing stands beside 30: the Note is centered under it, and moved with the block self.assertLess(abs((n[0] + n[2]) / 2 - (r[0] + r[2]) / 2), 1, (n, r)) self.assertGreaterEqual(n[1], r[3]) - def test_a_note_below_a_node_sticks_out_away_from_its_neighbour(self): + def test_a_note_below_a_node_sticks_out_away_from_its_neighbor(self): # a Note (wider than the node) below 30 with a node just right of 30: right edges aligned, so it sticks out left md = self.dir / "note_side.md" md.write_text("### a\n\nb\n", encoding="utf-8") @@ -1278,7 +1278,7 @@ def test_a_note_below_a_node_sticks_out_away_from_its_neighbour(self): self.do(f"note {md} below 30") n, r = self.rect("note_side"), self.rect("30") self.assertLess(abs(n[2] - r[2]), 1, (n, r)) - # the neighbour on the left instead: left edges aligned + # the neighbor on the left instead: left edges aligned self.do("put 12 left 30") self.do(f"note {md} below 30") n2 = [G.rect(x) for x in self.cv().s["nodes"] if x["id"].startswith("note_side_")][0] @@ -1376,7 +1376,7 @@ def test_only_branchs_list_of_names_has_no_input_slot(self): self.assertNotIn("branch_names", names("BranchNode")) def test_branch_inputs_are_named_and_its_values_follow_them(self): - # as the frontend saves a Branch: inputs labelled, the chosen name and the names of the connected inputs; no + # as the frontend saves a Branch: inputs labeled, the chosen name and the names of the connected inputs; no # input slot for the list of names self.do("add PrimitiveFloat a") self.do("add PrimitiveFloat b") @@ -1558,9 +1558,9 @@ def test_a_negative_prompt_is_half_as_tall(self): full, neg = self.cv().node("6")["size"][1], self.cv().node("neg")["size"][1] self.assertEqual(neg, round(full / 2)) - def test_a_level_into_a_sources_column_opens_only_the_gap_it_needs_and_centres_the_sampler_last(self): + def test_a_level_into_a_sources_column_opens_only_the_gap_it_needs_and_centers_the_sampler_last(self): # the gap above the node the side value is level into takes the room, the other gaps stay, the sampler is - # centred on the column last + # centered on the column last self.do("add RandomNoise rn") self.do("add KSamplerSelect sel") self.do("add PrimitiveInt w") @@ -1721,7 +1721,7 @@ def test_width_and_value_top_checks(self): lines, _ = C.full_check(self.cv()) self.assertTrue([x for x in lines if x.startswith("value nodes side by side have unaligned tops")]) - def test_inputs_centres_sampler_custom_on_its_column(self): + def test_inputs_centers_sampler_custom_on_its_column(self): # the sampler stays on the eye line and its column moves to it, so that the sampler # is at the column's vertical middle (its conditioning enters the guider, whose wire into the sampler slants) self.do("copy 25 16 17") @@ -1823,7 +1823,7 @@ def test_only_model_loaders_share_width(self): self.assertNotIn("loader_base", cv.node("u")) def test_loader_not_widened_into_neighbor(self): - # a loader that would overlap its neighbour is not widened + # a loader that would overlap its neighbor is not widened self.do("put 11 origin") self.do("put 10 right 11 gap 0") cv = self.cv() @@ -1964,7 +1964,7 @@ def test_a_stage_whose_result_wire_slants_into_its_chain_is_named(self): def test_a_positive_from_the_column_left_of_a_sampler_that_slants_is_fixed_in_the_plan(self): # a conditioning node (as Apply ControlNet) stands in the column just left of the stage's KSampler, far above it: - # its positive is levelled + # its positive is leveled self.do("add KSampler k") self.do("add FluxGuidance a") self.do("link 6.0 a.conditioning a.0 k.positive") @@ -2280,7 +2280,7 @@ def test_wide_gap_to_linked_neighbor(self): self.do("put 12 origin") self.do("put 30 right 12 wire gap 200") lines, _ = C.full_check(self.cv()) - self.assertTrue([x for x in lines if x.startswith("wide gap to a wired neighbour")]) + self.assertTrue([x for x in lines if x.startswith("wide gap to a wired neighbor")]) def test_python_error_becomes_stop_and_keeps_undo(self): before = len(list((self.dir / "canvas" / "t.hist").glob("*.json"))) From dfff2d17dc295dd0091c8019841bbf590a89c48a Mon Sep 17 00:00:00 2001 From: nomadoor <124905471+nomadoor@users.noreply.github.com> Date: Sun, 8 Nov 2026 10:16:45 +0900 Subject: [PATCH 5/6] Next release: NOTICE in American spelling --- NOTICE | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/NOTICE b/NOTICE index f0549bb..881cb60 100644 --- a/NOTICE +++ b/NOTICE @@ -1,13 +1,13 @@ comfyui-readable-node This skill reads ComfyUI workflows the way the ComfyUI frontend loads them, so its reading code -reproduces the frontend's behaviour (subgraph expansion, widget value order, legacy group nodes, -node sizes). That behaviour was checked against prompts produced by the running frontend; no frontend +reproduces the frontend's behavior (subgraph expansion, widget value order, legacy group nodes, +node sizes). That behavior was checked against prompts produced by the running frontend; no frontend source code is included. skills/comfyui-readable-node/scripts/ue.py reproduces the link rules of the Anything Everywhere custom nodes (cg-use-everywhere by chrisgoringe, Apache License 2.0). It was written from a description of -that behaviour; no source code of that project is included. +that behavior; no source code of that project is included. skills/comfyui-readable-node/scripts/fonts/PlusJakartaSans-latin.woff2 is Plus Jakarta Sans (Latin subset), embedded in the replay page. It is licensed under the SIL Open Font License 1.1; see skills/comfyui-readable-node/scripts/fonts/OFL-PlusJakartaSans.txt. From 1744bc9d80d0e42957fd1dc84e88592730e71fd8 Mon Sep 17 00:00:00 2001 From: nomadoor <124905471+nomadoor@users.noreply.github.com> Date: Sun, 8 Nov 2026 16:10:34 +0900 Subject: [PATCH 6/6] Next release: README in English, Japanese and Chinese with the intro video; desktop app install steps and Codex marketplace fields back; remaining American spelling --- .claude-plugin/marketplace.json | 14 +- CHANGELOG.md | 6 + README.ja.md | 136 +++++++++++++---- README.md | 142 +++++++++++++----- README.zh.md | 140 +++++++++++++++++ .../references/glossary.md | 2 +- .../scripts/frontend_min_sizes.json | 2 +- .../comfyui-readable-node/scripts/report.py | 4 +- skills/comfyui-readable-node/scripts/ue.py | 2 +- 9 files changed, 374 insertions(+), 74 deletions(-) create mode 100644 README.zh.md diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index 2127fcc..5818d7d 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -1,11 +1,21 @@ { "name": "comfyui-readable-node", - "owner": { "name": "nomadoor" }, + "interface": { + "displayName": "Readable Node" + }, + "owner": { + "name": "nomadoor" + }, "plugins": [ { "name": "comfyui-readable-node", "source": "./", - "description": "Rebuilds ComfyUI workflows into a form people can read (Readable Node)." + "description": "Rebuilds ComfyUI workflows into a form people can read (Readable Node).", + "policy": { + "installation": "AVAILABLE", + "authentication": "ON_INSTALL" + }, + "category": "Productivity" } ] } diff --git a/CHANGELOG.md b/CHANGELOG.md index cef551c..1fd177a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ - A rail with one target lowers through a Reroute next to the target whenever another column stands between; the canvas no longer wires it straight from the raising Reroute, which its own check called Bad. - "A slanted wire one move makes horizontal" no longer counts a move that takes a sampler's column of sources along (a stage's chain on the row below stays there). - LATENT_UPSCALE_MODEL counts as a tool wire, not one a node works on. +- Two stacked nodes aligned only on their left edges are Bad (columns align their right edges); the check names the fix, `put … below` with the right edges aligned. A loader above a sampler is left alone. +- Rails keep V_GAP from nodes: a rail pushed up in type order stays V_GAP above the node heading the rail below it. New check: a rail closer to a node than V_GAP (the wire from a source to its first Reroute included). +- Tests: removed the skipped tests and the development notes. +- English uses American spelling throughout (color, neighbor, center, afterward, backward). +- README rewritten in English and Japanese, with a Simplified Chinese version (README.zh.md), the intro video, and install steps for the Claude and ChatGPT desktop apps. +- marketplace.json: the display name, install policy and category used by Codex are back. ## 0.0.5 (2026-11-08) diff --git a/README.ja.md b/README.ja.md index 4833b41..224973c 100644 --- a/README.ja.md +++ b/README.ja.md @@ -1,68 +1,140 @@ -# comfyui-readable-node +# ComfyUI Readable Node -[English](README.md) +[![English](https://img.shields.io/badge/lang-English-blue)](README.md) [![日本語](https://img.shields.io/badge/lang-%E6%97%A5%E6%9C%AC%E8%AA%9E-red)](README.ja.md) [![中文](https://img.shields.io/badge/lang-%E4%B8%AD%E6%96%87-green)](README.zh.md) -ComfyUI の workflow を、人が読みやすい形(**Readable Node**)に組み直す、エージェント向けの skill です。 +[![Site](https://img.shields.io/badge/site-comfyui.nomadoor.net-orange)](https://comfyui.nomadoor.net/) [![License: MIT](https://img.shields.io/badge/license-MIT-lightgrey)](LICENSE) -1. **ノードを隠さない。** subgraph は展開し、折りたたみは開き、ノードを重ねない。 -2. **線を隠さない。** 無線(Set/Get、Anything Everywhere、線の非表示など)は、線に戻す。 -3. **左から右へ。** 処理の順に左から右へ流す。 -4. **1 task = 1 workflow。** 1 workflow は、使う人のやりたいこと一つ。 -5. **custom node はできるだけ取り除く。** core のノードで組めるものは core で組む。 -6. **適切に色を付ける。** 色は、どの機能に属するかを示す。 +[![ComfyUI Readable Node](https://img.youtube.com/vi/_Pkw9Mcvkng/maxresdefault.jpg)](https://youtu.be/_Pkw9Mcvkng) + +ComfyUI の workflow を、読みやすい形(**Readable Node**)に組み直す skill です。 + +単にスクリプトでレイアウトを整えるものではありません。 +AI は workflow を一度ばらばらにし、何をしているのかを理解します。その後、タスクがいくつも詰め込まれているものは 1 つずつの workflow に分け、下のルールに従って 0 から組み直します。 + +元の workflow がやっていることはなるべく保ちつつ、custom node を core のノードに置き換えたり、よりシンプルに組める手段があればそちらで組み直したりして、本質を変えないまま堅牢な workflow にしていきます。 + +もちろん、0 から AI に workflow を組んでもらうときにも役立ちます。 + +## Readable Node とは + +ここでは「読みやすい」を、何をしているかがスッと頭に入って、安定して動いて、気軽に組み替えられること、と定義しています。 +そのために必要な 6 つのルールが以下です。 + +1. **ノードを隠さない**<br> + subgraph は展開し、折りたたみは開き、ノードを重ねない。 +2. **ワイヤを隠さない**<br> + 無線(Set/Get、Anything Everywhere、ワイヤの非表示など)は、ワイヤに戻す。ノードをギチギチに詰めた、いわゆる Bento レイアウトも、ワイヤが隠れるのでやめる。 +3. **左から右へ**<br> + 処理の順に左から右へ流す。 +4. **1 つの workflow に、1 つの作業**<br> + 1 workflow は、使う人のやりたいこと一つ。 +5. **カスタムノードは最小限**<br> + core のノードで組めるものは core で組む。 +6. **適切な色付け**<br> + 色は、どの機能に属するかを示す。 ## 導入 -下のどれか一つで入れてください。二つ入れると、skill が二重に並びます。 +使っているアプリに合わせて、下のどれかで入れてください。 -### Claude Code +※ plugin として入れたあとに npx でも入れると、skill が二重に入ってしまうので注意してください。 -Claude Code のセッションの中で、次を実行してください。 +<details> +<summary><b>Claude デスクトップアプリ</b></summary> +1. **プラグイン** の画面で **+追加 → マーケットプレイスを追加 → リポジトリから追加** を選ぶ +2. `nomadoor/comfyui-readable-node` を入力 +3. `comfyui-readable-node` の **+** をクリック + +</details> + +<details> +<summary><b>Claude Code(CLI)</b></summary> + +ターミナルで次を実行してください。 + +```bash +claude plugin install comfyui-readable-node --marketplace nomadoor/comfyui-readable-node ``` -/plugin marketplace add nomadoor/comfyui-readable-node -/plugin install comfyui-readable-node@comfyui-readable-node -``` -自動で更新したいときは、`/plugin` の Marketplaces で `comfyui-readable-node` を選び、Enable auto-update を選んでください。 +</details> + +<details> +<summary><b>ChatGPT デスクトップアプリ(Codex)</b></summary> + +1. **カスタマイズ → プラグイン** で **追加** を押す +2. ソースに `https://github.com/nomadoor/comfyui-readable-node.git` を入力。Git ref とスパースパスは空のまま +3. **個人用** のタブの `comfyui-readable-node` の **+** をクリック + +</details> + +<details> +<summary><b>Codex CLI</b></summary> -### Codex +ターミナルで次を実行してください。 ```bash codex plugin marketplace add nomadoor/comfyui-readable-node codex plugin add comfyui-readable-node@comfyui-readable-node ``` -### そのほかのエージェント(Gemini CLI、Cursor、GitHub Copilot など) +</details> + +<details> +<summary><b>そのほかのエージェント(Gemini CLI、Cursor、GitHub Copilot など)</b></summary> + +ターミナルで次を実行してください。Node.js 22.20 以上が必要です。 ```bash npx skills add nomadoor/comfyui-readable-node -g ``` -Node.js 22.20 以上が必要です。 - -scripts を動かすには Python 3 が必要です(標準ライブラリだけを使います)。 - -## モデル - -長い作業を自分で確かめながら進める skill なので、強いモデルを使ってください。 +</details> -- いちばん良いのは Claude Opus 5.5 です。 -- GPT 6.1 でも使えますが、配置の崩れが残ることがあります。 -- 少なくとも Sonnet 以上のモデルでないと、うまくいかないかもしれません。 +skill の scripts を動かすには、Python 3 が必要です(標準ライブラリだけを使います)。 ## 使い方 -1. ComfyUI を起動しておいてください。skill は、動いている ComfyUI からノードの定義を読みます。 +1. ComfyUI を起動しておいてください。skill は、動いている ComfyUI からノードの情報を読みます。 2. エージェントに頼んでください。たとえば: - 「Readable Node で `my_workflow.json` を読みやすくして。ComfyUI は http://127.0.0.1:8188 で動いています。」 - 「Readable Node で、Flux の Text to Image の workflow を作って。」 確実に呼びたいときは `/comfyui-readable-node` と打ってください(plugin で入れたときは `/comfyui-readable-node:comfyui-readable-node`)。 -3. 組み直した workflow(`.json`)と報告が出てきます。workflow を ComfyUI で開いて確かめてください。 +3. 出来上がった workflow を ComfyUI で開いて、確かめてください。 + +時間は、ノード 25 個ほどの workflow で 10 分前後です。大きな workflow だと 20〜40 分かかることもあります。 + +## できあがるもの + +<!-- before / after image goes here --> + +- **組み直した workflow**: 元のファイル名に `_readable` を付けた `.json` です。元のファイルは上書きしません。 +- **report.html**: ブラウザで開くと、AI が組み直していく様子と、出来上がった workflow の解説が見られます。 + - Original: 元の workflow と見比べられます。 + - Rebuilt: AI がノードを一手ずつ動かしていく様子を、タイムラインで再生できます。 + - Walkthrough: 出来上がった workflow を、部分ごとに解説します。 + +## おすすめの AI モデル + +workflow を読み解いて綺麗に組み直すのは、見た目に反してかなり重い作業なので、できるだけ強いモデルを使ってください。 + +- 開発に使っていて、いちばんおすすめなのは Claude Opus 5.5 です。 +- GPT 6.1 / 6.0 Astra でも使えますが、配置の崩れが残ることがあります。 + +## skill が読みに行くもの + +- お使いの PC で動いている ComfyUI。どんなノードが入っているかを確かめます。 +- [Comfy with ComfyUI](https://comfyui.nomadoor.net/) の workflow。組み方の参考にすることがあります。 + +## うまくいかなかったとき + +組み直した workflow がおかしい、読みにくいときは、[issue](https://github.com/nomadoor/comfyui-readable-node/issues/new/choose) で教えてください。workflow には、プロンプトやフォルダのパスが入っていることがあります。公開したくないものは消してから添付してください。 + +## 作者 -報告のページ `report.html` も出ます。元の workflow、組み直しの手順、出来上がった workflow の説明(Walkthrough)を見られます。 +[nomadoor](https://x.com/noma_door)。ComfyUI の基本を解説するサイト [Comfy with ComfyUI](https://comfyui.nomadoor.net/) を運営しています。この skill は、サイトに載せてきた 400 本を超える workflow を土台に作りました。 ## ライセンス -MIT。[LICENSE](LICENSE) と [NOTICE](NOTICE) を見てください。 +MIT diff --git a/README.md b/README.md index cbefb07..b011aec 100644 --- a/README.md +++ b/README.md @@ -1,68 +1,140 @@ -# comfyui-readable-node +# ComfyUI Readable Node -[日本語](README.ja.md) +[![English](https://img.shields.io/badge/lang-English-blue)](README.md) [![日本語](https://img.shields.io/badge/lang-%E6%97%A5%E6%9C%AC%E8%AA%9E-red)](README.ja.md) [![中文](https://img.shields.io/badge/lang-%E4%B8%AD%E6%96%87-green)](README.zh.md) -An agent skill that rebuilds ComfyUI workflows into a form people can read: **Readable Node**. +[![Site](https://img.shields.io/badge/site-comfyui.nomadoor.net-orange)](https://comfyui.nomadoor.net/) [![License: MIT](https://img.shields.io/badge/license-MIT-lightgrey)](LICENSE) -1. **Do not hide nodes.** Expand subgraphs, open collapsed nodes, and do not overlap nodes. -2. **Do not hide wires.** Turn wireless links (Set/Get, Anything Everywhere, hidden links) back into wires. -3. **Left to right.** Flow from left to right in processing order. -4. **1 task = 1 workflow.** One workflow is one thing the user wants to do. -5. **Remove custom nodes as far as possible.** What can be built with core nodes is built with core. -6. **Color appropriately.** Color shows which function a node belongs to. +[![ComfyUI Readable Node](https://img.youtube.com/vi/_Pkw9Mcvkng/maxresdefault.jpg)](https://youtu.be/_Pkw9Mcvkng) + +A skill that rebuilds ComfyUI workflows so they are easy to read (**Readable Node**). + +It doesn't just tidy up the layout with a script. +The AI takes the workflow apart and works out what it does. A workflow that packs several tasks into a single file is split into separate workflows, one per task, and each is rebuilt from scratch following the rules below. + +It preserves what the original workflow does as much as possible, while replacing custom nodes with core nodes and rebuilding parts more simply where it can, making the workflow more robust without changing its purpose. + +It also works when you ask an AI to build a new workflow from scratch. + +## What Readable Node is + +Here, "easy to read" means you can tell at a glance what the workflow does, it runs reliably, and it is easy to rework. +It follows six rules: + +1. **Don't hide nodes**<br> + Expand subgraphs, open collapsed nodes, and don't overlap nodes. +2. **Don't hide wires**<br> + Turn wireless links (Set/Get, Anything Everywhere, hidden wires, etc.) back into wires. Avoid so-called Bento layouts, which pack nodes tightly together, since they hide the wires too. +3. **Left to right**<br> + Flow from left to right in processing order. +4. **One workflow, one task**<br> + A workflow does one thing the user wants to do. +5. **Keep custom nodes to a minimum**<br> + What can be built with core nodes is built with core. +6. **Color appropriately**<br> + Color shows which function a node belongs to. ## Install -Use one of the ways below. Installing two lists the skill twice. +Choose the method for the app you use. -### Claude Code +Note: don't install it both as a plugin and with npx, or you'll end up with two copies of the skill. -In a Claude Code session, run: +<details> +<summary><b>Claude desktop app</b></summary> +1. In **Settings → Customize → Plugins**, choose **+ Add → Add marketplace → Add from a repository** +2. Enter `nomadoor/comfyui-readable-node` +3. Click **+** on `comfyui-readable-node` + +</details> + +<details> +<summary><b>Claude Code (CLI)</b></summary> + +In a terminal, run: + +```bash +claude plugin install comfyui-readable-node --marketplace nomadoor/comfyui-readable-node ``` -/plugin marketplace add nomadoor/comfyui-readable-node -/plugin install comfyui-readable-node@comfyui-readable-node -``` -To get updates automatically, open `/plugin`, go to Marketplaces, select `comfyui-readable-node` and choose Enable auto-update. +</details> + +<details> +<summary><b>ChatGPT desktop app (Codex)</b></summary> + +1. Open **Plugins** and click **Add** to open **Add plugin marketplace** +2. Enter `https://github.com/nomadoor/comfyui-readable-node.git` in **Source**. Leave **Git ref** and **Sparse paths** empty +3. On the **Personal** tab, click **+** on `comfyui-readable-node` + +</details> + +<details> +<summary><b>Codex CLI</b></summary> -### Codex +In a terminal, run: ```bash codex plugin marketplace add nomadoor/comfyui-readable-node codex plugin add comfyui-readable-node@comfyui-readable-node ``` -### Other agents (Gemini CLI, Cursor, GitHub Copilot and others) +</details> + +<details> +<summary><b>Other agents (Gemini CLI, Cursor, GitHub Copilot, etc.)</b></summary> + +In a terminal, run the following. Requires Node.js 22.20 or later. ```bash npx skills add nomadoor/comfyui-readable-node -g ``` -This needs Node.js 22.20 or later. - -The scripts need Python 3 (standard library only). - -## Models - -The skill runs a long job and checks its own work as it goes, so it needs a strong model. +</details> -- Claude Opus 5.5 works best. -- GPT 6.1 works, but may leave some layout problems. -- With anything below Sonnet, it may not work well. +The skill's scripts need Python 3 (standard library only). -## Use +## Usage -1. Start ComfyUI. The skill reads the node definitions from the running ComfyUI. +1. Start ComfyUI first. The skill reads the node information from the running ComfyUI. 2. Ask your agent, for example: - "Make `my_workflow.json` readable with Readable Node. ComfyUI is running at http://127.0.0.1:8188." - "Build a Text to Image workflow for Flux with Readable Node." - To call it directly: `/comfyui-readable-node` (`/comfyui-readable-node:comfyui-readable-node` when installed as a plugin). -3. You get the rebuilt workflow (`.json`) and a report. Open the workflow in ComfyUI to check it. + To make sure the skill is invoked, type `/comfyui-readable-node` (`/comfyui-readable-node:comfyui-readable-node` when installed as a plugin). +3. Open the finished workflow in ComfyUI and check it. + +A workflow of about 25 nodes takes around 10 minutes. A large workflow can take 20 to 40 minutes. + +## What you get + +<!-- before / after image goes here --> + +- **The rebuilt workflow**: a `.json` file with `_readable` appended to the original name. The original file is not overwritten. +- **report.html**: open it in a browser to watch the AI rebuild the workflow and read an explanation of the result. + - Original: compare with the original workflow. + - Rebuilt: replay the AI's moves on a timeline, one step at a time. + - Walkthrough: the finished workflow explained part by part. + +## Recommended AI models + +Reading a workflow and rebuilding it cleanly is far more demanding than it looks, so use the strongest model you can. + +- Claude Opus 5.5: the skill was developed with it, and it's my top recommendation. +- GPT 6.1 / 6.0 Astra also work, but the layout may still have a few issues. + +## What the skill reads + +- Your local ComfyUI, to see which nodes are installed. +- Workflows on [Comfy with ComfyUI](https://comfyui.nomadoor.net/), which it may use as a reference for how to build workflows. + +## Reporting problems + +If a rebuilt workflow is wrong or hard to read, let me know in an [issue](https://github.com/nomadoor/comfyui-readable-node/issues/new/choose). A workflow may contain your prompts and folder paths, so remove anything you don't want to share publicly before attaching it. + +## Author -You also get a report page, `report.html`: the original workflow, the rebuild step by step, and a walkthrough of the finished workflow. +[nomadoor](https://x.com/noma_door). I run [Comfy with ComfyUI](https://comfyui.nomadoor.net/), a site that explains the basics of ComfyUI. This skill is built on more than 400 workflows published there. -## Licence +## License -MIT. See [LICENSE](LICENSE) and [NOTICE](NOTICE). +MIT diff --git a/README.zh.md b/README.zh.md new file mode 100644 index 0000000..4b77e3e --- /dev/null +++ b/README.zh.md @@ -0,0 +1,140 @@ +# ComfyUI Readable Node + +[![English](https://img.shields.io/badge/lang-English-blue)](README.md) [![日本語](https://img.shields.io/badge/lang-%E6%97%A5%E6%9C%AC%E8%AA%9E-red)](README.ja.md) [![中文](https://img.shields.io/badge/lang-%E4%B8%AD%E6%96%87-green)](README.zh.md) + +[![Site](https://img.shields.io/badge/site-comfyui.nomadoor.net-orange)](https://comfyui.nomadoor.net/) [![License: MIT](https://img.shields.io/badge/license-MIT-lightgrey)](LICENSE) + +[![ComfyUI Readable Node](https://img.youtube.com/vi/_Pkw9Mcvkng/maxresdefault.jpg)](https://youtu.be/_Pkw9Mcvkng) + +一个把 ComfyUI workflow 重新组织成易读形式(**Readable Node**)的 skill。 + +它不只是用脚本整理布局。 +AI 会先拆解 workflow,弄清楚它在做什么。如果一个 workflow 里塞了好几项任务,就按任务拆成一个个 workflow,再按照下面的规则从零重新搭建。 + +它会尽量保留原 workflow 所做的事情,同时把自定义节点(custom node)换成原生节点(core 节点),或在有更简单的搭建方式时改用更简单的方式,在不改变本质的前提下,让 workflow 更加稳健。 + +当然,让 AI 从零搭建 workflow 时,同样可以使用这个 skill。 + +## 什么是 Readable Node + +这里把"易读"定义为:一眼就能明白它在做什么,运行稳定,并且便于修改和重新组合。 +为此需要以下 6 条规则。 + +1. **不隐藏节点**<br> + 展开 subgraph,展开被折叠的节点,节点之间不重叠。 +2. **不隐藏连线**<br> + 把不走连线的隐式连接(Set/Get、Anything Everywhere、隐藏的连线等)恢复成连线。把节点挤得满满当当的所谓 Bento 布局,也会把连线遮住,同样不要用。 +3. **从左到右**<br> + 按处理顺序从左往右排列。 +4. **一个 workflow,一项任务**<br> + 一个 workflow 只做用户想做的一件事。 +5. **自定义节点尽量少**<br> + 能用原生节点搭的,就用原生节点搭。 +6. **恰当地上色**<br> + 颜色表示节点属于哪项功能。 + +## 安装 + +请根据你使用的应用,选择下面的一种方式安装。 + +注意:以 plugin 方式安装后,如果再用 npx 安装,skill 会被重复安装。 + +<details> +<summary><b>Claude 桌面应用</b></summary> + +1. 在 **Settings → Customize → Plugins** 中,选择 **+ Add → Add marketplace → Add from a repository** +2. 输入 `nomadoor/comfyui-readable-node` +3. 点击 `comfyui-readable-node` 旁边的 **+** + +</details> + +<details> +<summary><b>Claude Code(CLI)</b></summary> + +在终端中运行: + +```bash +claude plugin install comfyui-readable-node --marketplace nomadoor/comfyui-readable-node +``` + +</details> + +<details> +<summary><b>ChatGPT 桌面应用(Codex)</b></summary> + +1. 打开 **Plugins**,点击 **Add**,选择 **Add plugin marketplace** +2. 在 **Source** 中输入 `https://github.com/nomadoor/comfyui-readable-node.git`。**Git ref** 和 **Sparse paths** 留空 +3. 在 **Personal** 标签页中,点击 `comfyui-readable-node` 旁边的 **+** + +</details> + +<details> +<summary><b>Codex CLI</b></summary> + +在终端中运行: + +```bash +codex plugin marketplace add nomadoor/comfyui-readable-node +codex plugin add comfyui-readable-node@comfyui-readable-node +``` + +</details> + +<details> +<summary><b>其他 agent(Gemini CLI、Cursor、GitHub Copilot 等)</b></summary> + +在终端中运行以下命令。需要 Node.js 22.20 或更高版本。 + +```bash +npx skills add nomadoor/comfyui-readable-node -g +``` + +</details> + +skill 中的脚本需要 Python 3(只使用标准库)。 + +## 使用方法 + +1. 请先启动 ComfyUI。skill 会从正在运行的 ComfyUI 读取节点信息。 +2. 向 agent 提出请求,例如: + - "用 Readable Node 把 `my_workflow.json` 整理得易读一些。ComfyUI 运行在 http://127.0.0.1:8188。" + - "用 Readable Node 搭一个 Flux 的 Text to Image workflow。" + + 如果想确保调用这个 skill,请输入 `/comfyui-readable-node`(如果以 plugin 方式安装,则输入 `/comfyui-readable-node:comfyui-readable-node`)。 +3. 在 ComfyUI 中打开完成的 workflow,检查一下。 + +25 个节点左右的 workflow 大约需要 10 分钟。较大的 workflow 可能需要 20 到 40 分钟。 + +## 输出内容 + +<!-- before / after image goes here --> + +- **重新搭建的 workflow**:文件名为原文件名加 `_readable` 的 `.json` 文件,不会覆盖原文件。 +- **report.html**:在浏览器中打开,可以看到 AI 重新搭建的过程,以及对完成的 workflow 的讲解。 + - Original:与原 workflow 对照。 + - Rebuilt:在时间轴上回放 AI 一步一步移动节点的过程。 + - Walkthrough:分部分讲解完成的 workflow。 + +## 推荐的 AI 模型 + +读懂 workflow 并整齐地重新搭建,远比看起来繁重,请尽量使用能力最强的模型。 + +- 开发时使用的是 Claude Opus 5.5,也最推荐使用它。 +- GPT 6.1 / 6.0 Astra 也可以使用,但可能会留下一些布局上的问题。 + +## skill 会读取的内容 + +- 你电脑上正在运行的 ComfyUI,用来确认装了哪些节点。 +- [Comfy with ComfyUI](https://comfyui.nomadoor.net/) 上的 workflow,有时会用作搭建方法的参考。 + +## 遇到问题时 + +如果重新搭建的 workflow 有问题或不好读,请通过 [issue](https://github.com/nomadoor/comfyui-readable-node/issues/new/choose) 告诉我。issue 请用英文或日文撰写。workflow 中可能包含提示词和文件夹路径,附上之前请删除不想公开的内容。 + +## 作者 + +[nomadoor](https://x.com/noma_door)。运营着一个讲解 ComfyUI 基础知识的网站 [Comfy with ComfyUI](https://comfyui.nomadoor.net/)。这个 skill 以该网站上发布的 400 多个 workflow 为基础制作。 + +## 许可证 + +MIT diff --git a/skills/comfyui-readable-node/references/glossary.md b/skills/comfyui-readable-node/references/glossary.md index 35428b1..043e7b8 100644 --- a/skills/comfyui-readable-node/references/glossary.md +++ b/skills/comfyui-readable-node/references/glossary.md @@ -15,7 +15,7 @@ The meaning of the words used in the skill's documents. Each is defined here onc - **sampler**: KSampler, KSampler (Advanced), SamplerCustom, SamplerCustomAdvanced, and custom nodes that add processing these core nodes cannot realize. - **loader**: a node that reads a model file (Load Checkpoint, Load Diffusion Model, Load CLIP, Load VAE, Load LoRA, and so on). - **value node**: a node that only outputs one value (Int, Float, String, and so on). -- **core node**: a node that comes with ComfyUI from the start. A **custom node** is a node installed afterwards. +- **core node**: a node that comes with ComfyUI from the start. A **custom node** is a node installed afterward. - **deprecated node**: a core node that has been superseded by a newer one ((DEPRECATED) is in its name). - **source**: an upstream node that connects into an input of a node. - **chain**: nodes connected in a line by wires. diff --git a/skills/comfyui-readable-node/scripts/frontend_min_sizes.json b/skills/comfyui-readable-node/scripts/frontend_min_sizes.json index 1048507..45c7761 100644 --- a/skills/comfyui-readable-node/scripts/frontend_min_sizes.json +++ b/skills/comfyui-readable-node/scripts/frontend_min_sizes.json @@ -1,5 +1,5 @@ { - "_about": "Sizes of nodes newly created in the frontend (measured from the frontend) that are larger than what nodesize computes: nodes the frontend adds fields to afterwards (PreviewAny's preview_text, etc.) and nodes whose contents change with a selection. The canvas never makes these nodes smaller than this.", + "_about": "Sizes of nodes newly created in the frontend (measured from the frontend) that are larger than what nodesize computes: nodes the frontend adds fields to afterward (PreviewAny's preview_text, etc.) and nodes whose contents change with a selection. The canvas never makes these nodes smaller than this.", "sizes": { "CreateBoundingBoxes": [ 420, diff --git a/skills/comfyui-readable-node/scripts/report.py b/skills/comfyui-readable-node/scripts/report.py index af1c3a2..ca4c6bb 100644 --- a/skills/comfyui-readable-node/scripts/report.py +++ b/skills/comfyui-readable-node/scripts/report.py @@ -491,9 +491,9 @@ def _ids(S, s, limit=6): lambda S, m: S.L(f"The {m.group(1)} wire {_wire_m(S, m, 3)} is not horizontal (the input is {m.group(2)} the output)", f"{m.group(1)} の線 {_wire_m(S, m, 3)} が水平ではありません(入力が出力より{'下' if m.group(2) == 'below' else '上'})")), ("back", r"^backward wire that may be allowed .*: " + _W + "$", - lambda S, m: S.L(f"The wire {_wire_m(S, m)} runs backwards (may be allowed)", f"線 {_wire_m(S, m)} が逆向きです(許される場合があります)")), + lambda S, m: S.L(f"The wire {_wire_m(S, m)} runs backward (may be allowed)", f"線 {_wire_m(S, m)} が逆向きです(許される場合があります)")), ("back", r"^backward wire \(cannot be kept.*\): " + _W + "$", - lambda S, m: S.L(f"The wire {_wire_m(S, m)} runs backwards (must be fixed)", f"線 {_wire_m(S, m)} が逆向きです(直す必要があります)")), + lambda S, m: S.L(f"The wire {_wire_m(S, m)} runs backward (must be fixed)", f"線 {_wire_m(S, m)} が逆向きです(直す必要があります)")), ("align", r"^(\S+) \S+: right edges of the sources wired directly into it are not aligned", lambda S, m: S.L(f"The nodes feeding {S.node(m.group(1))} are not aligned on their right edges", f"{S.node(m.group(1))} につながるノードの右端がそろっていません")), diff --git a/skills/comfyui-readable-node/scripts/ue.py b/skills/comfyui-readable-node/scripts/ue.py index 749390e..786d831 100644 --- a/skills/comfyui-readable-node/scripts/ue.py +++ b/skills/comfyui-readable-node/scripts/ue.py @@ -17,7 +17,7 @@ * A receiver takes the offer with the highest priority among those whose type matches and whose restrictions (group, color, title / input / group regexes, repeated-type rules) allow it. A tie is left unconnected and reported. -* Seed Everywhere is replaced by a PrimitiveInt; flatten.py removes the other broadcasters afterwards. +* Seed Everywhere is replaced by a PrimitiveInt; flatten.py removes the other broadcasters afterward. """ import re