Skip to content

Commit

Permalink
Remove comfyui related prefix from node names. (#220)
Browse files Browse the repository at this point in the history
  • Loading branch information
robinjhuang authored Dec 27, 2024
1 parent 53ad9c0 commit e68cca7
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion comfy_cli/registry/config_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,30 @@ def create_comfynode_config():
raise Exception("Failed to write 'pyproject.toml'") from e


def sanitize_node_name(name: str) -> str:
"""Remove common ComfyUI-related prefixes from a string.
Args:
name: The string to process
Returns:
The string with any ComfyUI-related prefix removed
"""
name = name.lower()
prefixes = [
"comfyui-",
"comfyui_",
"comfy-",
"comfy_",
"comfy",
"comfyui",
]

for prefix in prefixes:
name = name.removeprefix(prefix)
return name


def initialize_project_config():
create_comfynode_config()

Expand All @@ -86,7 +110,7 @@ def initialize_project_config():
urls = project.get("urls", tomlkit.table())
urls["Repository"] = git_remote_url
project["urls"] = urls
project["name"] = repo_name.lower()
project["name"] = sanitize_node_name(repo_name)
project["description"] = ""
project["version"] = "1.0.0"

Expand Down

0 comments on commit e68cca7

Please sign in to comment.