### Subprocess Command Construction Examples Source: https://github.com/comfy-org/comfy-cli/blob/main/docs/DESIGN-uv-compile.md Demonstrates how `execute_cm_cli` constructs subprocess commands based on `uv_compile` and `fast_deps` flags. `uv_compile=True` adds `--uv-compile`, `fast_deps=True` adds `--no-deps`, and `uv_compile=False` results in a default per-node pip install. ```text execute_cm_cli(["install", "node-a"], uv_compile=True) → [python, -m, cm_cli, install, node-a, --uv-compile] execute_cm_cli(["install", "node-a"], fast_deps=True) → [python, -m, cm_cli, install, node-a, --no-deps] + DependencyCompiler.compile_deps() / install_deps() execute_cm_cli(["install", "node-a"], uv_compile=False) → [python, -m, cm_cli, install, node-a] (no extra flags — default per-node pip install) ``` -------------------------------- ### Configuration File Example Source: https://github.com/comfy-org/comfy-cli/blob/main/docs/DESIGN-uv-compile.md Example of the `config.ini` file showing the `uv_compile_default` setting, which controls the default behavior of the UV compile feature. ```ini # ~/.config/comfy-cli/config.ini [DEFAULT] uv_compile_default = True ``` -------------------------------- ### Install Pre-commit Hook Source: https://github.com/comfy-org/comfy-cli/blob/main/DEV_README.md Install the pre-commit hook to ensure code formatting consistency. ```bash pre-commit install ``` -------------------------------- ### Install a custom Manager fork Source: https://github.com/comfy-org/comfy-cli/blob/main/README.md After installing ComfyUI with `--skip-manager`, you can install a custom Manager fork using an editable install. ```bash pip install -e /path/to/your-manager-fork ``` -------------------------------- ### Example .comfyignore File Source: https://github.com/comfy-org/comfy-cli/blob/main/DEV_README.md An example .comfyignore file to exclude development artifacts from packaged nodes. Syntax matches .gitignore. ```gitignore docs/ frontend/ tests/ *.psd ``` -------------------------------- ### Install Pytest and Coverage Source: https://github.com/comfy-org/comfy-cli/blob/main/DEV_README.md Install pytest and pytest-cov for running unit tests and generating coverage reports. Python 3.9 is recommended. ```bash pip install pytest pytest-cov ``` -------------------------------- ### Live-Install ComfyUI-Manager Fork Source: https://github.com/comfy-org/comfy-cli/blob/main/DEV_README.md Install your forked ComfyUI-Manager in editable mode. Replace '/path/to/ComfyUI-Manager' with the actual path. ```bash pip install -e /path/to/ComfyUI-Manager ``` -------------------------------- ### Install a specific version of ComfyUI-Manager Source: https://github.com/comfy-org/comfy-cli/blob/main/README.md Installs a specific version of ComfyUI-Manager after ComfyUI has been installed with the `--skip-manager` flag. ```bash pip install comfyui-manager==4.1b8 ``` -------------------------------- ### Install ComfyUI to a specific workspace path Source: https://github.com/comfy-org/comfy-cli/blob/main/README.md Installs ComfyUI into a specified directory path. The ComfyUI installation will be located within the 'ComfyUI' subdirectory of the provided path. ```bash comfy --workspace= install ``` -------------------------------- ### Install Comfy CLI in Editable Mode Source: https://github.com/comfy-org/comfy-cli/blob/main/DEV_README.md Install the package in editable mode for development. Ensure Python 3.9+ is used. ```bash pip install -e . ``` -------------------------------- ### Install Package on ComfyUI in Current Directory Source: https://github.com/comfy-org/comfy-cli/blob/main/README.md Installs a specified package onto the ComfyUI instance located in the current directory. Ensure you are in the correct directory before execution. ```bash comfy --here node install comfyui-impact-pack ``` -------------------------------- ### Install ComfyUI with fast dependency resolution using uv Source: https://github.com/comfy-org/comfy-cli/blob/main/README.md Utilizes `uv` for faster dependency resolution during ComfyUI installation. This command compiles all requirements into a single lockfile and handles GPU-specific PyTorch wheel selection. ```bash comfy install --fast-deps ``` -------------------------------- ### Live-Install Comfy CLI Fork Source: https://github.com/comfy-org/comfy-cli/blob/main/DEV_README.md Install your forked comfy-cli in editable mode to test changes. Replace '/path/to/comfy-cli' with the actual path. ```bash pip install -e /path/to/comfy-cli ``` -------------------------------- ### Install ComfyUI using comfy-cli Source: https://github.com/comfy-org/comfy-cli/blob/main/README.md Installs the latest version of ComfyUI and ComfyUI-Manager. If ComfyUI is already set up, this command updates the comfy.yaml file. ```bash comfy install ``` -------------------------------- ### Install Shell Autocomplete for comfy-cli Source: https://github.com/comfy-org/comfy-cli/blob/main/README.md Enable shell completion for the comfy-cli command to get interactive help and command suggestions by pressing the TAB key. ```bash comfy --install-completion ``` -------------------------------- ### Install comfy-cli with pip Source: https://github.com/comfy-org/comfy-cli/blob/main/README.md Install the comfy-cli package using pip. Requires Python 3.10 or higher. It is recommended to activate a virtual environment before installation. ```bash pip install comfy-cli ``` -------------------------------- ### Initiate Async Video Generation Source: https://github.com/comfy-org/comfy-cli/blob/main/README.md Start an asynchronous video generation job and immediately receive a job ID. Use `comfy generate resume` to retrieve the result later. Requires COMFY_API_KEY. ```bash comfy generate luma --prompt "..." --aspect_ratio 16:9 --async ``` -------------------------------- ### Install Custom Node Dependencies Source: https://github.com/comfy-org/comfy-cli/blob/main/README.md Installs dependencies required for custom nodes. Dependencies can be specified via a JSON file or derived from a ComfyUI workflow file (.json or .png). ```bash comfy node install-deps --deps= ``` ```bash comfy node install-deps --workflow= ``` -------------------------------- ### Validate Mutual Exclusivity for Install Command Source: https://github.com/comfy-org/comfy-cli/blob/main/docs/DESIGN-uv-compile.md Ensures that only one of --fast-deps, --no-deps, or --uv-compile flags can be used simultaneously for the install command. ```python exclusive_flags = [ name for name, val in [("--fast-deps", fast_deps), ("--no-deps", no_deps), ("--uv-compile", uv_compile)] if val ] if len(exclusive_flags) > 1: typer.echo(f"Cannot use {' and '.join(exclusive_flags)} together", err=True) raise typer.Exit(code=1) ``` -------------------------------- ### Install and Run ComfyUI with a Specific Pull Request Source: https://github.com/comfy-org/comfy-cli/blob/main/README.md Installs and runs a specified pull request of ComfyUI. This is useful for testing specific changes or using features from a particular branch. Note that `--pr` cannot be used with `--version` or `--commit`. ```bash comfy install --pr "#1234" ``` ```bash comfy install --pr "jtydhr88:load-3d-nodes" ``` ```bash comfy install --pr "https://github.com/comfyanonymous/ComfyUI/pull/1234" ``` -------------------------------- ### Show Custom Nodes Information Source: https://github.com/comfy-org/comfy-cli/blob/main/README.md Displays information about custom nodes, allowing filtering by status (installed, enabled, disabled, etc.) and mode (remote, local, cache). Use `show` for detailed info and `simple-show` for a concise list. ```bash comfy node [show|simple-show] [installed|enabled|not-installed|disabled|all|snapshot|snapshot-list] ?[--channel ] ?[--mode [remote|local|cache]] ``` ```bash comfy node show all --channel recent ``` ```bash comfy node simple-show installed ``` -------------------------------- ### Clear ComfyUI-Manager Startup Action Source: https://github.com/comfy-org/comfy-cli/blob/main/README.md Clear any reserved startup action for ComfyUI-Manager, ensuring a clean start on the next launch. ```bash comfy manager clear ``` -------------------------------- ### Install Custom Node with Unified Resolution Source: https://github.com/comfy-org/comfy-cli/blob/main/README.md Installs a custom node by delegating dependency resolution to ComfyUI-Manager's unified resolver, enabling cross-node conflict detection. Requires ComfyUI-Manager v4.1+. ```bash comfy node install comfyui-impact-pack --uv-compile ``` -------------------------------- ### Run Recently Executed ComfyUI Source: https://github.com/comfy-org/comfy-cli/blob/main/README.md Use this command to launch the ComfyUI instance that was most recently executed or installed. This is a convenient way to resume your work. ```bash comfy --recent launch ``` -------------------------------- ### List Available Comfy Models Source: https://github.com/comfy-org/comfy-cli/blob/main/README.md Use this command to browse the models available through Comfy's partner nodes. No setup is required beyond setting your API key. ```bash export COMFY_API_KEY=comfyui-... ``` ```bash comfy generate list ``` -------------------------------- ### Install Custom Node without Unified Resolution Source: https://github.com/comfy-org/comfy-cli/blob/main/README.md Installs a custom node while explicitly disabling the default unified resolution behavior. Useful for overriding global settings for a single command. ```bash comfy node install comfyui-impact-pack --no-uv-compile ``` -------------------------------- ### Install ComfyUI without ComfyUI-Manager Source: https://github.com/comfy-org/comfy-cli/blob/main/README.md Use this option to install ComfyUI without the default ComfyUI-Manager. This is useful if you want to use a custom Manager fork or a specific version. ```bash comfy install --skip-manager ``` -------------------------------- ### Migrate Legacy ComfyUI-Manager Source: https://github.com/comfy-org/comfy-cli/blob/main/README.md Migrate a ComfyUI-Manager installation that was cloned via git to the pip package format. ```bash comfy manager migrate-legacy ``` -------------------------------- ### Invoke Standalone uv-sync Command Source: https://github.com/comfy-org/comfy-cli/blob/main/docs/PRD-uv-compile.md Directly invokes cm_cli's `uv-sync` subcommand to batch-resolve all installed custom node dependencies. ```bash comfy node uv-sync ``` -------------------------------- ### Launch ComfyUI in Background Source: https://github.com/comfy-org/comfy-cli/blob/main/README.md Starts a ComfyUI instance in the background, allowing you to continue using your terminal. Background instances can be managed using `comfy env` and stopped with `comfy stop`. ```bash comfy launch --background ``` ```bash comfy --workspace=~/comfy launch --background -- --listen 10.0.0.10 --port 8000 ``` -------------------------------- ### Get Comfy Model Schema Source: https://github.com/comfy-org/comfy-cli/blob/main/README.md View the parameters and options for a specific Comfy partner model before generating. Ensure your API key is set. ```bash comfy generate schema flux-pro ``` -------------------------------- ### Start Custom Node Bisect Session Source: https://github.com/comfy-org/comfy-cli/blob/main/README.md Initiates a bisect session to identify custom nodes causing bugs. It marks the current state as 'bad' and uses all enabled nodes as the initial test set. Optional ComfyUI launch arguments can be provided. ```bash comfy node bisect start ``` -------------------------------- ### Node Execution Failure Example Source: https://github.com/comfy-org/comfy-cli/blob/main/docs/json-output.md This JSON log shows a 'node_executing' event followed by a 'failed' event due to an 'execution_error' with an invalid API key. Agents should parse the 'error.kind' and 'error.message' for details. ```json {"event":"prompt_preview","schema_version":1,"prompt":{"1":{"class_type":"GeminiNanoBanana2","inputs":{"prompt":"a banana","width":2048,"height":2048},"_meta":{"title":"Nano Banana 2"}},"2":{"class_type":"SaveImage","inputs":{"filename_prefix":"banana_test","images":["1",0]},"_meta":{"title":"Save Image"}}}} ``` ```json {"event":"queued","schema_version":1,"prompt_id":"9b1c…","client_id":"fe2a…","validation_warnings":[],"nodes":[{"node_id":"1","class_type":"GeminiNanoBanana2","title":"Nano Banana 2"},{"node_id":"2","class_type":"SaveImage","title":"Save Image"}]} ``` ```json {"event":"node_executing","schema_version":1,"node_id":"1","class_type":"GeminiNanoBanana2","title":"Nano Banana 2"} ``` ```json {"event":"failed","schema_version":1,"prompt_id":"9b1c…","client_id":"fe2a…","elapsed_seconds":2.1,"error":{"kind":"execution_error","message":"API key invalid","node_id":"1","class_type":"GeminiNanoBanana2","title":"Nano Banana 2","exception_type":"RuntimeError","traceback":" File \"/path/to/node.py\", line 42, in execute\n raise RuntimeError(\"API key invalid\")\n"}} ``` -------------------------------- ### Update ComfyUI and Custom Nodes Source: https://github.com/comfy-org/comfy-cli/blob/main/README.md Updates all ComfyUI installations and custom nodes based on the defined priority. This command ensures your ComfyUI environment is up-to-date. ```bash comfy node update all ``` -------------------------------- ### Node Executing Event Source: https://github.com/comfy-org/comfy-cli/blob/main/docs/json-output.md Emitted when a node begins execution. It shares fields with node_cached and indicates the start of a node's processing. ```json {"event": "node_executing", "schema_version": 1, "node_id": "2", "class_type": "SaveImage", "title": "Save Image"} ``` -------------------------------- ### Converted Event Example Source: https://github.com/comfy-org/comfy-cli/blob/main/docs/json-output.md This JSON object represents a 'converted' event, emitted when a UI-format workflow is converted to API format client-side. It includes the schema version and the count of nodes in the converted graph. ```json {"event": "converted", "schema_version": 1, "node_count": 2} ``` -------------------------------- ### Websocket Timeout Failure Example Source: https://github.com/comfy-org/comfy-cli/blob/main/docs/json-output.md This JSON log illustrates a 'failed' event caused by a 'timeout' error, indicating that the websocket did not receive a server response within the expected duration. The 'timeout_seconds' field specifies the duration. ```json {"event":"prompt_preview","schema_version":1,"prompt":{"1":{"class_type":"GeminiNanoBanana2","inputs":{"prompt":"a banana","width":2048,"height":2048},"_meta":{"title":"Nano Banana 2"}},"2":{"class_type":"SaveImage","inputs":{"filename_prefix":"banana_test","images":["1",0]},"_meta":{"title":"Save Image"}}}} ``` ```json {"event":"queued","schema_version":1,"prompt_id":"9b1c…","client_id":"fe2a…","validation_warnings":[],"nodes":[{"node_id":"1","class_type":"GeminiNanoBanana2","title":"Nano Banana 2"},{"node_id":"2","class_type":"SaveImage","title":"Save Image"}]} ``` ```json {"event":"node_executing","schema_version":1,"node_id":"1","class_type":"GeminiNanoBanana2","title":"Nano Banana 2"} ``` ```json {"event":"failed","schema_version":1,"prompt_id":"9b1c…","client_id":"fe2a…","elapsed_seconds":30.0,"error":{"kind":"timeout","message":"WebSocket timed out after 30s waiting for server response","timeout_seconds":30.0}} ``` -------------------------------- ### Workflow Interruption Failure Example Source: https://github.com/comfy-org/comfy-cli/blob/main/docs/json-output.md This JSON log demonstrates a 'failed' event with the 'execution_interrupted' error kind, signifying that the workflow's execution was prematurely stopped. This can occur for various reasons external to node execution. ```json {"event":"prompt_preview","schema_version":1,"prompt":{"1":{"class_type":"GeminiNanoBanana2","inputs":{"prompt":"a banana","width":2048,"height":2048},"_meta":{"title":"Nano Banana 2"}},"2":{"class_type":"SaveImage","inputs":{"filename_prefix":"banana_test","images":["1",0]},"_meta":{"title":"Save Image"}}}} ``` ```json {"event":"queued","schema_version":1,"prompt_id":"9b1c…","client_id":"fe2a…","validation_warnings":[],"nodes":[{"node_id":"1","class_type":"GeminiNanoBanana2","title":"Nano Banana 2"},{"node_id":"2","class_type":"SaveImage","title":"Save Image"}]} ``` ```json {"event":"node_executing","schema_version":1,"node_id":"1","class_type":"GeminiNanoBanana2","title":"Nano Banana 2"} ``` ```json {"event":"failed","schema_version":1,"prompt_id":"9b1c…","client_id":"fe2a…","elapsed_seconds":3.2,"error":{"kind":"execution_interrupted","message":"Workflow execution was interrupted"}} ``` -------------------------------- ### Enable ComfyUI-Manager with New GUI Source: https://github.com/comfy-org/comfy-cli/blob/main/README.md Enable ComfyUI-Manager and launch it with the new graphical user interface. ```bash comfy manager enable-gui ``` -------------------------------- ### Enable ComfyUI-Manager with Legacy GUI Source: https://github.com/comfy-org/comfy-cli/blob/main/README.md Enable ComfyUI-Manager and launch it with the legacy graphical user interface. ```bash comfy manager enable-legacy-gui ``` -------------------------------- ### Launch ComfyUI with Default Options Source: https://github.com/comfy-org/comfy-cli/blob/main/README.md Launches ComfyUI using its default configuration. You can append extra arguments after `--` to customize the launch behavior. ```bash comfy launch -- ``` ```bash comfy launch -- --cpu --listen 0.0.0.0 ``` -------------------------------- ### Full Pre-release Run (GPU) Source: https://github.com/comfy-org/comfy-cli/blob/main/docs/TESTING-e2e.md Perform a full E2E test run with a custom ComfyUI URL and empty install/launch flags for GPU testing. Ensure TEST_E2E_COMFY_INSTALL_FLAGS and TEST_E2E_COMFY_LAUNCH_FLAGS_EXTRA are empty to use default GPU-compatible flags. ```bash TEST_E2E=true \ TEST_E2E_COMFY_URL="https://github.com/ltdrdata/ComfyUI.git@dr-bump-manager" \ TEST_E2E_COMFY_INSTALL_FLAGS="" \ TEST_E2E_COMFY_LAUNCH_FLAGS_EXTRA="" \ pytest tests/e2e/ -v ``` -------------------------------- ### Run Unit Tests with Coverage Source: https://github.com/comfy-org/comfy-cli/blob/main/DEV_README.md Execute all unit tests and generate an XML coverage report. This helps in identifying code coverage gaps. ```bash pytest --cov=comfy_cli --cov-report=xml . ``` -------------------------------- ### Generate Video with Seedance Source: https://github.com/comfy-org/comfy-cli/blob/main/README.md Create videos using the Seedance model, specifying resolution, duration, and other parameters. The CLI formats these for Seedance's prompt syntax. Requires COMFY_API_KEY. ```bash comfy generate seedance --prompt "a hummingbird hovering over a flower" \ --resolution 1080p --duration 5 --download bird.mp4 ``` -------------------------------- ### Generate Video from Image with Seedance Source: https://github.com/comfy-org/comfy-cli/blob/main/README.md Create videos from a static image using a Seedance image-to-video variant. Specify the model, prompt, and input image. Requires COMFY_API_KEY. ```bash comfy generate seedance --model seedance-1-0-lite-i2v-250428 \ --prompt "the wave crests and crashes" \ --image ./still.jpg --download wave.mp4 ``` -------------------------------- ### Download Model with URL Source: https://github.com/comfy-org/comfy-cli/blob/main/README.md Downloads a model from a specified URL (e.g., CivitAI page, Hugging Face file URL). Supports optional relative path for storage and setting API tokens for CivitAI and Hugging Face. API tokens can also be provided via environment variables or stored config. ```bash comfy model download --url ?[--relative-path ] ?[--set-civitai-api-token ] ?[--set-hf-api-token ] ``` -------------------------------- ### Generate Image with Reference Image Source: https://github.com/comfy-org/comfy-cli/blob/main/README.md Create an image based on a prompt and a reference image. The CLI handles uploading local images or encoding them. Requires COMFY_API_KEY. ```bash comfy generate flux-kontext --prompt "add a top hat" \ --input_image ./photo.jpg --download out.png ``` -------------------------------- ### Check Comfy CLI Help Source: https://github.com/comfy-org/comfy-cli/blob/main/DEV_README.md Verify the comfy package can be run by checking its help message. ```bash comfy --help ``` -------------------------------- ### Save and Restore Custom Node Snapshots Source: https://github.com/comfy-org/comfy-cli/blob/main/README.md Manage snapshots of your custom node configurations. `save-snapshot` creates a new snapshot, while `restore-snapshot` reverts to a previously saved state identified by its name. ```bash comfy node save-snapshot ``` ```bash comfy node restore-snapshot ``` -------------------------------- ### List Models Source: https://github.com/comfy-org/comfy-cli/blob/main/README.md Lists all available models within the ComfyUI environment. An optional relative path can be provided to list models in a specific directory. ```bash comfy model list ?[--relative-path ] ``` -------------------------------- ### Set Development Environment Variable Source: https://github.com/comfy-org/comfy-cli/blob/main/DEV_README.md Set the ENVIRONMENT variable to 'dev' to enable development mode. ```bash export ENVIRONMENT=dev ``` -------------------------------- ### Test Frontend Pull Request for ComfyUI Source: https://github.com/comfy-org/comfy-cli/blob/main/README.md Allows testing of frontend pull requests by automatically cloning, building, and using the specified frontend PR for the current launch session. Requires Node.js and npm. Builds are cached for faster subsequent uses. ```bash comfy launch --frontend-pr "#456" ``` ```bash comfy launch --frontend-pr "username:branch-name" ``` ```bash comfy launch --frontend-pr "https://github.com/Comfy-Org/ComfyUI_frontend/pull/456" ``` -------------------------------- ### Successful Run (UI-format input) Source: https://github.com/comfy-org/comfy-cli/blob/main/docs/json-output.md This JSON output represents a successful execution of a workflow using UI-format input. It details the conversion, prompt preview, queuing, node execution, and completion events. ```json {"event":"converted","schema_version":1,"node_count":2} {"event":"prompt_preview","schema_version":1,"prompt":{"1":{"class_type":"GeminiNanoBanana2","inputs":{"prompt":"a banana","width":2048,"height":2048},"_meta":{"title":"Nano Banana 2"}},"2":{"class_type":"SaveImage","inputs":{"filename_prefix":"banana_test","images":["1",0]},"_meta":{"title":"Save Image"}}}} {"event":"queued","schema_version":1,"prompt_id":"9b1c…","client_id":"fe2a…","validation_warnings":[],"nodes":[{"node_id":"1","class_type":"GeminiNanoBanana2","title":"Nano Banana 2"},{"node_id":"2","class_type":"SaveImage","title":"Save Image"}]} {"event":"node_executing","schema_version":1,"node_id":"1","class_type":"GeminiNanoBanana2","title":"Nano Banana 2"} {"event":"node_progress","schema_version":1,"node_id":"1","class_type":"GeminiNanoBanana2","title":"Nano Banana 2","value":1,"max":4} {"event":"node_progress","schema_version":1,"node_id":"1","class_type":"GeminiNanoBanana2","title":"Nano Banana 2","value":4,"max":4} {"event":"node_executing","schema_version":1,"node_id":"2","class_type":"SaveImage","title":"Save Image"} {"event":"node_executed","schema_version":1,"node_id":"2","class_type":"SaveImage","title":"Save Image","outputs":[{"category":"images","node_id":"2","class_type":"SaveImage","title":"Save Image","filename":"banana_test_00001_.png","subfolder":"","type":"output","url":"http://127.0.0.1:8188/view?filename=banana_test_00001_.png&subfolder=&type=output"}]} {"event":"completed","schema_version":1,"prompt_id":"9b1c…","client_id":"fe2a…","elapsed_seconds":8.342,"outputs":[{"category":"images","node_id":"2","class_type":"SaveImage","title":"Save Image","filename":"banana_test_00001_.png","subfolder":"","type":"output","url":"http://127.0.0.1:8188/view?filename=banana_test_00001_.png&subfolder=&type=output"}],"cached_node_ids":[],"executed_node_ids":["1","2"]} ``` -------------------------------- ### Enable and Run E2E Tests Source: https://github.com/comfy-org/comfy-cli/blob/main/DEV_README.md Enable end-to-end tests by setting the TEST_E2E environment variable and run pytest. ```bash TEST_E2E=true pytest tests/e2e/ ``` -------------------------------- ### Generate Video with Comfy CLI Source: https://github.com/comfy-org/comfy-cli/blob/main/README.md Generate a video clip using a specified model and parameters like duration. The CLI will poll for completion by default. Requires COMFY_API_KEY. ```bash comfy generate kling --prompt "a paper boat drifting on a river at dusk" \ --duration 5 --download boat.mp4 ``` -------------------------------- ### Run E2E Tests with Alternate ComfyUI Repo Source: https://github.com/comfy-org/comfy-cli/blob/main/DEV_README.md Run E2E tests against a specific ComfyUI repository URL. Useful for testing against different versions or forks. ```bash TEST_E2E=true \ TEST_E2E_COMFY_URL="https://github.com/ltdrdata/ComfyUI.git@dr-bump-manager" \ pytest tests/e2e/ -v ``` -------------------------------- ### Flag Resolution Logic Source: https://github.com/comfy-org/comfy-cli/blob/main/docs/DESIGN-uv-compile.md Illustrates the precedence of flag resolution for `--uv-compile`. CLI input takes precedence over configuration file settings. If no CLI flag is provided, the configuration file is checked. If neither is set, it defaults to False. ```text CLI input │ ├─ --uv-compile → uv_compile = True ├─ --no-uv-compile → uv_compile = False └─ (none) → uv_compile = None │ _resolve_uv_compile() │ ┌──────┴──────┐ │ not None? │ └──────┬──────┘ Yes │ No │ │ return ▼ as-is config.ini │ ┌──────┴──────┐ │ == "True"? │ └──────┬──────┘ Yes │ No │ │ ▼ └→ return False conflicting flags? │ Yes │ No │ │ return return False True ``` -------------------------------- ### Non-blocking API Call (`--no-wait`) Source: https://github.com/comfy-org/comfy-cli/blob/main/docs/json-output.md This JSON output shows the initial events for an API call using the `--no-wait` flag. The server returns immediately after queuing the job, and the client is responsible for polling for completion. ```json {"event":"prompt_preview","schema_version":1,"prompt":{"1":{"class_type":"GeminiNanoBanana2","inputs":{"prompt":"a banana","width":2048,"height":2048},"_meta":{"title":"Nano Banana 2"}},"2":{"class_type":"SaveImage","inputs":{"filename_prefix":"banana_test","images":["1",0]},"_meta":{"title":"Save Image"}}}} {"event":"queued","schema_version":1,"prompt_id":"9b1c…","client_id":"fe2a…","validation_warnings":[],"nodes":[{"node_id":"1","class_type":"GeminiNanoBanana2","title":"Nano Banana 2"},{"node_id":"2","class_type":"SaveImage","title":"Save Image"}]} ``` -------------------------------- ### Enable ComfyUI-Manager without GUI Source: https://github.com/comfy-org/comfy-cli/blob/main/README.md Enable ComfyUI-Manager to run in the background without displaying its user interface. ```bash comfy manager disable-gui ``` -------------------------------- ### Manager Command to Set uv-compile-default Source: https://github.com/comfy-org/comfy-cli/blob/main/docs/DESIGN-uv-compile.md Provides a manager command to enable or disable the default behavior of --uv-compile using a boolean argument. ```python @manager_app.command("uv-compile-default") def uv_compile_default( enabled: Annotated[bool, typer.Argument(help="true to enable, false to disable")], ): config_manager = ConfigManager() config_manager.set(constants.CONFIG_KEY_UV_COMPILE_DEFAULT, str(enabled)) ``` -------------------------------- ### Validate Mutual Exclusivity for Reinstall Command Source: https://github.com/comfy-org/comfy-cli/blob/main/docs/DESIGN-uv-compile.md Checks for mutual exclusivity between --fast-deps and --uv-compile flags specifically for the reinstall command. ```python if fast_deps and uv_compile is True: typer.echo("Cannot use --fast-deps and --uv-compile together", err=True) raise typer.Exit(code=1) ``` -------------------------------- ### Check Target Workspace Path Source: https://github.com/comfy-org/comfy-cli/blob/main/README.md Use the `comfy which` command to determine the path of the ComfyUI instance that will be targeted by subsequent commands. This is useful for verifying your workspace configuration. ```bash comfy --recent which ``` ```bash comfy --here which ``` ```bash comfy which ``` -------------------------------- ### Resolve uv_compile Flag with Configuration Source: https://github.com/comfy-org/comfy-cli/blob/main/docs/DESIGN-uv-compile.md Implements the resolution logic for the uv_compile flag, prioritizing explicit flags over configuration and then checking config defaults. ```python def _resolve_uv_compile( uv_compile: bool | None, fast_deps: bool = False, no_deps: bool = False, ) -> bool: uv_compile is True -> return True (explicit --uv-compile) uv_compile is False -> return False (explicit --no-uv-compile) uv_compile is None -> check config: config == "True" AND (fast_deps or no_deps) -> return False (conflict: explicit flag wins) config == "True" -> return True (config default) otherwise -> return False (no config) ``` -------------------------------- ### Generate Custom Node Dependencies from Workflow Source: https://github.com/comfy-org/comfy-cli/blob/main/README.md Generates a JSON file listing the dependencies required by a ComfyUI workflow. Specify the workflow file and the desired output file path for the generated dependencies. ```bash comfy node deps-in-workflow --workflow= --output= ``` -------------------------------- ### Generate Image with Comfy CLI Source: https://github.com/comfy-org/comfy-cli/blob/main/README.md Generate an image using a specified model, prompt, and dimensions. The output can be directly downloaded to a file. Ensure COMFY_API_KEY is exported. ```bash comfy generate flux-pro --prompt "a cat on the moon" \ --width 1024 --height 1024 --download cat.png ``` -------------------------------- ### Generate Image with Gemini Flash Source: https://github.com/comfy-org/comfy-cli/blob/main/README.md Use the 'nano-banana' alias for Gemini Flash Image to generate images. The output is base64 encoded, so `--download` is required. ```bash comfy generate nano-banana --prompt "a watercolor of a sleeping fox" \ --download fox.png ``` -------------------------------- ### Manage ComfyUI Frontend PR Cache Source: https://github.com/comfy-org/comfy-cli/blob/main/README.md Commands to manage the cache for frontend pull requests. This includes listing cached builds, cleaning all cached builds, or cleaning a specific PR's cache. Cache entries expire after 7 days and a maximum of 10 builds are kept. ```bash comfy pr-cache list ``` ```bash comfy pr-cache clean ``` ```bash comfy pr-cache clean 456 ``` -------------------------------- ### Standalone UV Sync Command Source: https://github.com/comfy-org/comfy-cli/blob/main/docs/DESIGN-uv-compile.md Defines a standalone command `uv-sync` that directly invokes the `cm_cli`'s `uv-sync` subcommand, independent of configuration defaults. ```python import sys from cm_cli.core import execute_cm_cli @app.command("uv-sync") def uv_sync(): execute_cm_cli(["uv-sync"]) ``` -------------------------------- ### Resume Async Video Generation Source: https://github.com/comfy-org/comfy-cli/blob/main/README.md Retrieve the result of an asynchronous video generation job using its job ID. Ensure COMFY_API_KEY is set. ```bash comfy generate resume luma --download out.mp4 ``` -------------------------------- ### Configure uv-compile Default Setting Source: https://github.com/comfy-org/comfy-cli/blob/main/docs/PRD-uv-compile.md Sets the default behavior for the --uv-compile flag. When enabled, --uv-compile is automatically applied to custom node operations. ```bash comfy manager uv-compile-default true ``` ```bash comfy manager uv-compile-default false ``` -------------------------------- ### VSCode Debugger Configuration Source: https://github.com/comfy-org/comfy-cli/blob/main/DEV_README.md Configure VSCode's launch.json to attach the debugger to the comfy_cli module. ```json { "name": "Python Debugger: Run", "type": "debugpy", "request": "launch", "module": "comfy_cli.__main__", "args": [], "console": "integratedTerminal" } ``` -------------------------------- ### JSON Prompt Preview Event Source: https://github.com/comfy-org/comfy-cli/blob/main/docs/json-output.md Emitted when a workflow is successfully loaded and parsed. This event carries the API-format workflow graph that the CLI is about to POST to /prompt. It's useful for debugging conversions and logging. ```json {"event": "prompt_preview", "schema_version": 1, "prompt": {"1": {"class_type": "EmptyLatentImage", "inputs": {"width": 512, "height": 512, "batch_size": 1}}}} ``` -------------------------------- ### Failure: Workflow File Not Found Source: https://github.com/comfy-org/comfy-cli/blob/main/docs/json-output.md This JSON output indicates a failure due to a missing workflow file. The `error.kind` is `workflow_not_found`, and the `error.message` specifies the path to the missing file. ```json {"event":"failed","schema_version":1,"prompt_id":null,"client_id":null,"elapsed_seconds":0.001,"error":{"kind":"workflow_not_found","message":"Workflow file not found: /tmp/missing.json"}} ``` -------------------------------- ### Define Tri-state uv_compile Typer Option Source: https://github.com/comfy-org/comfy-cli/blob/main/docs/DESIGN-uv-compile.md Defines the --uv-compile/--no-uv-compile Typer option for commands, allowing explicit enablement, disablement, or default behavior. ```python uv_compile: Annotated[ bool | None, typer.Option( "--uv-compile/--no-uv-compile", show_default=False, help="After {verb}, batch-resolve all dependencies via uv pip compile ...", ), ] = None, ``` -------------------------------- ### Switch Gemini Flash Model Variants Source: https://github.com/comfy-org/comfy-cli/blob/main/README.md Generate images using a specific variant of the Gemini Flash Image model by specifying the `--model` flag. Ensure COMFY_API_KEY is set. ```bash comfy generate nano-banana --prompt "..." --model gemini-3-pro-image-preview \ --download out.png ``` -------------------------------- ### Define UV Compile Default Config Key Source: https://github.com/comfy-org/comfy-cli/blob/main/docs/DESIGN-uv-compile.md Defines the configuration key used for the uv_compile_default setting in comfy-cli. ```python CONFIG_KEY_UV_COMPILE_DEFAULT = "uv_compile_default" ``` -------------------------------- ### Set Default UV-Compile for Comfy Nodes Source: https://github.com/comfy-org/comfy-cli/blob/main/README.md Configure ComfyUI-Manager to use `--uv-compile` by default for all custom node operations. This can be overridden per command. ```bash comfy manager uv-compile-default true ``` -------------------------------- ### JSON Queued Event Source: https://github.com/comfy-org/comfy-cli/blob/main/docs/json-output.md Emitted after a successful POST to /prompt. This event carries the server's prompt handle, which can be used to correlate against /history/{prompt_id}. It includes validation warnings and a manifest of nodes in the workflow. ```json { "event": "queued", "schema_version": 1, "prompt_id": "9b1c…", "client_id": "fe2a…", "validation_warnings": [], "nodes": [ {"node_id": "1", "class_type": "GeminiNanoBanana2", "title": "Nano Banana 2"}, {"node_id": "2", "class_type": "SaveImage", "title": "Save Image"} ] } ``` -------------------------------- ### Set Default ComfyUI Workspace Path Source: https://github.com/comfy-org/comfy-cli/blob/main/README.md Configures the default ComfyUI workspace path that the CLI will use when no specific workspace is indicated. Optionally, you can specify extra arguments for launching. ```bash comfy set-default ?[--launch-extras=""] ``` -------------------------------- ### Add uv_compile Parameter to execute_cm_cli Source: https://github.com/comfy-org/comfy-cli/blob/main/docs/DESIGN-uv-compile.md Extends the execute_cm_cli function to accept and pass the uv_compile flag to cm_cli. ```python def execute_cm_cli(args, channel=None, fast_deps=False, no_deps=False, uv_compile=False, mode=None, raise_on_error=False): if uv_compile: cmd += ["--uv-compile"] elif fast_deps or no_deps: cmd += ["--no-deps"] ``` -------------------------------- ### Node Progress Event Source: https://github.com/comfy-org/comfy-cli/blob/main/docs/json-output.md Provides per-step progress for nodes like samplers or encoders. It shares the node_id of the most recent node_executing event. ```json {"event": "node_progress", "schema_version": 1, "node_id": "1", "class_type": "GeminiNanoBanana2", "title": "Nano Banana 2", "value": 14, "max": 30} ``` -------------------------------- ### Remove Models by Name Source: https://github.com/comfy-org/comfy-cli/blob/main/README.md Removes specified models from the ComfyUI environment. Requires model names and supports an optional relative path to specify the storage location. ```bash comfy model remove ?[--relative-path ] --model-names ``` -------------------------------- ### Comfy CLI Command Boilerplate Source: https://github.com/comfy-org/comfy-cli/blob/main/DEV_README.md Boilerplate code for adding a new command, including initialization and command registration using Typer. ```python from .command import app ``` ```python import typer app = typer.Typer() @app.command() def option_a(name: str): """Add a new custom node""" print(f"Adding a new custom node: {name}") @app.command() def remove(name: str): """Remove a custom node""" print(f"Removing a custom node: {name}") ``` -------------------------------- ### Edit Image with Gemini Flash Source: https://github.com/comfy-org/comfy-cli/blob/main/README.md Perform image edits using Gemini Flash Image by providing a reference image and a prompt. The reference can be a local path, URL, or data URI. Requires COMFY_API_KEY. ```bash comfy generate nano-banana --prompt "add a top hat" \ --image ./cat.png --download out.png ``` -------------------------------- ### Explicitly Upload Image Source: https://github.com/comfy-org/comfy-cli/blob/main/README.md Upload a local image file to Comfy's storage endpoint. This is useful for pre-staging assets. Ensure COMFY_API_KEY is set. ```bash comfy generate upload ./photo.jpg ``` -------------------------------- ### Disable Default UV-Compile for Comfy Nodes Source: https://github.com/comfy-org/comfy-cli/blob/main/README.md Disable the default behavior of using `--uv-compile` for ComfyUI-Manager custom node operations. ```bash comfy manager uv-compile-default false ``` -------------------------------- ### Mark Bisect Session as Good Source: https://github.com/comfy-org/comfy-cli/blob/main/README.md Marks the current set of custom nodes in an active bisect session as 'good', indicating that the issue is not present within this set. This helps narrow down the problematic node(s). ```bash comfy node bisect good ``` -------------------------------- ### Node Executed Event Structure Source: https://github.com/comfy-org/comfy-cli/blob/main/docs/json-output.md Emitted when a node finishes execution and surfaces output. Not all nodes emit this; intermediate compute nodes may not. Output and preview nodes reliably emit it. A cached output-bearing node also emits this event. ```json { "event": "node_executed", "schema_version": 1, "node_id": "2", "class_type": "SaveImage", "title": "Save Image", "outputs": [ { "category": "images", "node_id": "2", "class_type": "SaveImage", "title": "Save Image", "filename": "banana_test_00001_.png", "subfolder": "", "type": "output", "url": "http://127.0.0.1:8188/view?filename=banana_test_00001_.png&subfolder=&type=output" } ] } ```