diff --git a/comfy_cli/command/custom_nodes/command.py b/comfy_cli/command/custom_nodes/command.py index 3dd712c..64f6400 100644 --- a/comfy_cli/command/custom_nodes/command.py +++ b/comfy_cli/command/custom_nodes/command.py @@ -610,7 +610,7 @@ def display_all_nodes(): @app.command("registry-install", help="Install a node from the registry", hidden=True) @tracking.track_command("node") -def install(node_id: str, version: Optional[str]): +def install(node_id: str, version: Optional[str] = None): """ Install a node from the registry. Args: @@ -637,15 +637,20 @@ def install(node_id: str, version: Optional[str]): return # Download the node archive - local_filename = pathlib.Path( - f"./downloads/{node_id}-{node_version.version}.tar.gz" - ) + custom_nodes_path = pathlib.Path(workspace_manager.workspace_path) / "custom_nodes" + node_specific_path = custom_nodes_path / node_id # Subdirectory for the node + node_specific_path.mkdir(parents=True, exist_ok=True) # Create the directory if it doesn't exist + + local_filename = node_specific_path / f"{node_id}-{node_version.version}.zip" logging.debug(f'Start downloading the node {node_id} version {node_version.version} to {local_filename}') download_file(node_version.download_url, local_filename) # Extract the downloaded archive to the custom_node directory on the workspace. - custom_nodes_path = pathlib.Path(workspace_manager.workspace_path) / "custom_nodes" logging.debug(f'Start extracting the node {node_id} version {node_version.version} to {custom_nodes_path}') - extract_package_as_zip(local_filename, custom_nodes_path) + extract_package_as_zip(local_filename, node_specific_path) + + # Delete the downloaded archive + logging.debug(f'Deleting the downloaded archive {local_filename}') + os.remove(local_filename) logging.info(f'Node {node_id} version {node_version.version} has been successfully installed.')