Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ history.

### Added

- `comfy workflow check <file> --where cloud` says whether Comfy Cloud runs a
workflow with no custom build. Signed in, it reads Cloud's node list and your
uploaded models, and answers `covered`, `covered_with_remaps` (a model sits in
another folder on Cloud), `covered_needs_check` (a model is not proven the
same file) or `needs_build`, with each blocking node type or model, its models
folder and any local copy. `--models-dir` hashes local copies against Cloud's;
`--apply-remaps --out <file>` writes a remapped copy and leaves the original
alone.
- `comfy workflow save` on Comfy Cloud, when the workspace's
`cli_cloud_save_enabled` flag is on, writes an editor-format workflow into a
new folder in the Cloud Workflows sidebar (`<name>`, then `<name> (2)` and so
Expand Down
8 changes: 8 additions & 0 deletions comfy_cli/command/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -2763,3 +2763,11 @@ def validate_cmd(
app.command("foreach", help="Instantiate a recipe over N param-sets → N workflows (bulk generation).")(
_wedit.foreach_cmd
)

# `comfy workflow check --where cloud`: can Comfy Cloud run this workflow as it is?
from comfy_cli.command import workflow_check as _wcheck # noqa: E402

app.command(
"check",
help="Check whether Comfy Cloud runs a workflow as it is, with model remaps, or only with a build.",
)(_wcheck.check_cmd)
402 changes: 402 additions & 0 deletions comfy_cli/command/workflow_check.py

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions comfy_cli/discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@
"comfy workflow fragment ls": "workflow",
"comfy workflow fragment show": "workflow",
"comfy workflow fragment validate": "workflow",
# Comfy Cloud coverage: its own payload (verdict, blocking[], models[]).
"comfy workflow check": "workflow_check",
# the local comfy agent's approvals
"comfy agent permissions": "agent",
"comfy agent allow": "agent",
Expand Down
21 changes: 17 additions & 4 deletions comfy_cli/error_codes.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,23 @@ class ErrorCode:
),
ErrorCode(
"workflow_write_error",
"`workflow get --out` could not write the fetched workflow to disk (OSError: permissions, "
"missing parent dir, full disk, invalid path).",
"`workflow get --out` could not write the fetched workflow to disk, or `workflow check --apply-remaps "
"--out` could not write the remapped copy (OSError: permissions, missing parent dir, full disk, "
"invalid path).",
"check the --out path is writable and the disk has space",
),
ErrorCode(
"workflow_format_unknown",
"`workflow check` read valid JSON that is neither a ComfyUI save (an object with `nodes[]`) nor an "
"API export (an object of nodes, each with a `class_type`). `details.path` carries the file.",
"pass a workflow saved from ComfyUI or its API export",
),
ErrorCode(
"workflow_out_is_input",
"`workflow check --apply-remaps --out` named the workflow being checked; the check never changes "
"its input, so nothing was written. `details.path` carries the file.",
"pass a new file name to --out",
),
ErrorCode(
"workflow_too_large",
"A local ComfyUI `/userdata` response exceeded the in-memory read cap, so the CLI refused to "
Expand Down Expand Up @@ -912,8 +925,8 @@ class ErrorCode:
),
ErrorCode(
"workflow_conversion_failed",
"`comfy workflow decompose` could not flatten a frontend-format workflow to "
"API format (malformed graph, or object_info that doesn't match the nodes).",
"`comfy workflow decompose` or `comfy workflow check` could not flatten a frontend-format workflow "
"to API format (malformed graph, or object_info that doesn't match the nodes).",
"re-export from ComfyUI, or pass a matching --input object_info.json",
),
ErrorCode(
Expand Down
155 changes: 155 additions & 0 deletions comfy_cli/schemas/workflow_check.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://comfy.org/schemas/workflow_check.json",
"title": "comfy workflow check --json data payload",
"description": "Whether Comfy Cloud runs a workflow as it is. verdict: covered (every node type and model is on Cloud, each model proven the same file), covered_with_remaps (runs once each remap in models[] is applied), covered_needs_check (nothing missing, but a model is not proven the same file as Cloud's copy), needs_build (blocking[] lists what is missing).",
"type": "object",
"required": [
"workflow",
"format",
"verdict",
"stale",
"blocking",
"models",
"nodes",
"skipped",
"out",
"remaps_applied",
"warnings"
],
"additionalProperties": true,
"$defs": {
"filename": {"type": "string", "description": "The model's file name, without folders."},
"folder": {
"type": ["string", "null"],
"description": "The ComfyUI models folder the file belongs in (e.g. checkpoints, loras), from the workflow's download notes or the stock loader; null when unknown."
},
"url": {"type": ["string", "null"], "description": "Download URL from the workflow's own download notes, if any."},
"local_paths": {
"type": "array",
"items": {"type": "string"},
"description": "Files of this name under --models-dir; empty without --models-dir."
}
},
"properties": {
"workflow": {"type": "string", "description": "Absolute path of the checked file; never changed."},
"format": {"enum": ["ui", "api"]},
"verdict": {"enum": ["covered", "covered_with_remaps", "covered_needs_check", "needs_build"]},
"stale": {
"type": "boolean",
"description": "true when Cloud's node list could not be refreshed and a cached copy answered (warning object_info_stale): a node type removed since may read as on Cloud."
},
"blocking": {
"type": "array",
"items": {
"oneOf": [
{
"type": "object",
"required": ["kind", "class_type", "node_ids", "reason"],
"properties": {
"kind": {"const": "node"},
"class_type": {"type": "string"},
"node_ids": {"type": "array", "items": {"type": "string"}},
"reason": {"const": "not_on_cloud"}
}
},
{
"type": "object",
"required": ["kind", "value", "node_id", "class_type", "reason", "filename", "folder", "url", "local_paths"],
"properties": {
"kind": {"const": "model"},
"value": {"type": "string"},
"node_id": {"type": "string"},
"class_type": {"type": "string"},
"reason": {"enum": ["not_on_cloud", "ambiguous", "different_file"]},
"filename": {"$ref": "#/$defs/filename"},
"folder": {"$ref": "#/$defs/folder"},
"url": {"$ref": "#/$defs/url"},
"local_paths": {"$ref": "#/$defs/local_paths"}
}
}
]
}
},
"models": {
"type": "array",
"items": {
"type": "object",
"required": [
"node_id",
"class_type",
"widget",
"value",
"status",
"source",
"cloud_value",
"identity",
"filename",
"folder",
"url",
"local_paths"
],
"properties": {
"node_id": {"type": "string", "description": "Node id; inside a subgraph, <instance id>:<inner id>, one row per instance."},
"class_type": {"type": "string"},
"widget": {"type": ["string", "null"], "description": "Input name; null when the node type is not on Cloud and its saved values carry no names."},
"value": {"type": "string", "description": "The value saved in the workflow."},
"status": {"enum": ["present", "remap", "missing", "not_checked"]},
"source": {"enum": ["cloud", "yours", null]},
"cloud_value": {"type": ["string", "null"], "description": "The value Cloud runs; differs from value on a remap."},
"identity": {"enum": ["same", "different", "unverified", null]},
"candidates": {
"type": "array",
"items": {"type": "string"},
"description": "The names that fit when several do; the model is then missing and blocking says ambiguous."
},
"filename": {"$ref": "#/$defs/filename"},
"folder": {"$ref": "#/$defs/folder"},
"url": {"$ref": "#/$defs/url"},
"local_paths": {"$ref": "#/$defs/local_paths"}
}
}
},
"nodes": {
"type": "array",
"items": {
"type": "object",
"required": ["class_type", "node_ids", "on_cloud"],
"properties": {
"class_type": {"type": "string"},
"node_ids": {"type": "array", "items": {"type": "string"}},
"on_cloud": {"type": "boolean"}
}
}
},
"skipped": {
"type": "array",
"items": {
"type": "object",
"required": ["node_id", "class_type", "why"],
"properties": {
"node_id": {"type": "string"},
"class_type": {"type": ["string", "null"]},
"why": {"enum": ["muted", "bypassed"]}
}
}
},
"out": {"type": ["string", "null"], "description": "Where --apply-remaps wrote the copy; null without it."},
"remaps_applied": {"type": "integer", "minimum": 0},
"warnings": {
"type": "array",
"items": {
"type": "object",
"required": ["code", "message"],
"properties": {
"code": {
"type": "string",
"description": "object_info_stale, models_dir_not_found, local_model_unreadable, cloud_model_lookup_failed or remap_not_applied (the --out copy keeps that remap's saved value; details names the row)."
},
"message": {"type": "string"},
"details": {"type": "object"}
}
}
}
}
}
4 changes: 4 additions & 0 deletions comfy_cli/tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ def _resolve_posthog_token() -> str:
# `workflow add-node --text`: a note body is verbatim user content, like
# `--prompt` — analytics only learns that the option was supplied.
"text",
# `--models-dir` (repeatable, so a list: the whole list is redacted) and
# `--out` are local paths, typed `str` like `--workflow`.
"models_dir",
"out",
}
)

Expand Down
Loading
Loading