Skip to content

Commit c350363

Browse files
authored
Add cookie-cutter template for custom nodes. (#239)
* Remove standalone tests. * Remove. * Fix return code for comfy launch. * Use comfy launch. * Add cookie-cutter template for custom nodes. * Fix mac command.
1 parent c93b1af commit c350363

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

comfy_cli/command/custom_nodes/command.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import typer
1010
from rich import print
11+
from rich.console import Console
1112
from typing_extensions import Annotated, List
1213

1314
from comfy_cli import logging, tracking, ui, utils
@@ -28,6 +29,7 @@
2829
)
2930
from comfy_cli.workspace_manager import WorkspaceManager
3031

32+
console = Console()
3133
app = typer.Typer()
3234
app.add_typer(bisect_app, name="bisect", help="Bisect custom nodes for culprit node.")
3335
manager_app = typer.Typer()
@@ -918,3 +920,20 @@ def pack():
918920
zip_files(zip_filename)
919921
typer.echo(f"Created zip file: {NODE_ZIP_FILENAME}")
920922
logging.info("Node has been packed successfully.")
923+
924+
925+
@app.command("scaffold", help="Create a new ComfyUI custom node project using cookiecutter")
926+
@tracking.track_command("node")
927+
def scaffold_cookiecutter():
928+
"""Create a new ComfyUI custom node project using cookiecutter."""
929+
import cookiecutter.main
930+
931+
try:
932+
cookiecutter.main.cookiecutter(
933+
"https://github.com/Comfy-Org/cookiecutter-comfy-extension.git",
934+
overwrite_if_exists=True,
935+
)
936+
console.print("[bold green]✓ Custom node project created successfully![/bold green]")
937+
except Exception as e:
938+
console.print(f"[bold red]Error creating project: {str(e)}[/bold red]")
939+
raise typer.Exit(code=1)

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ dependencies = [
4343
"websocket-client",
4444
"ruff",
4545
"semver~=3.0.2",
46+
"cookiecutter",
4647
]
4748

4849
[project.optional-dependencies]

0 commit comments

Comments
 (0)