Skip to content

Commit e68cca7

Browse files
authored
Remove comfyui related prefix from node names. (#220)
1 parent 53ad9c0 commit e68cca7

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

comfy_cli/registry/config_parser.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,30 @@ def create_comfynode_config():
6262
raise Exception("Failed to write 'pyproject.toml'") from e
6363

6464

65+
def sanitize_node_name(name: str) -> str:
66+
"""Remove common ComfyUI-related prefixes from a string.
67+
68+
Args:
69+
name: The string to process
70+
71+
Returns:
72+
The string with any ComfyUI-related prefix removed
73+
"""
74+
name = name.lower()
75+
prefixes = [
76+
"comfyui-",
77+
"comfyui_",
78+
"comfy-",
79+
"comfy_",
80+
"comfy",
81+
"comfyui",
82+
]
83+
84+
for prefix in prefixes:
85+
name = name.removeprefix(prefix)
86+
return name
87+
88+
6589
def initialize_project_config():
6690
create_comfynode_config()
6791

@@ -86,7 +110,7 @@ def initialize_project_config():
86110
urls = project.get("urls", tomlkit.table())
87111
urls["Repository"] = git_remote_url
88112
project["urls"] = urls
89-
project["name"] = repo_name.lower()
113+
project["name"] = sanitize_node_name(repo_name)
90114
project["description"] = ""
91115
project["version"] = "1.0.0"
92116

0 commit comments

Comments
 (0)