Initial commit: StyleRef nodes for ComfyUI

Load, Apply, Facets, Reference Images, and Login nodes for loading StyleRef
creative styles into ComfyUI graphs. Zero runtime dependencies.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Behzad
2026-07-26 21:47:56 +02:00
co-authored by Claude Sonnet 5
parent 88184b8ab2
commit cca9661dd1
34 changed files with 14737 additions and 0 deletions
+78
View File
@@ -0,0 +1,78 @@
name: CI
on:
push:
branches: [main]
pull_request:
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# 3.9 is ComfyUI's floor and the version most likely to break on modern
# syntax; 3.12 is what current desktop builds ship.
python-version: ["3.9", "3.12"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dev dependencies
# Pillow/numpy are test-only: the Reference Images node imports them
# lazily and gets them from the ComfyUI environment at runtime.
run: python -m pip install --upgrade pip pytest ruff pillow numpy
- name: Lint
run: ruff check .
- name: Test
run: pytest tests/ -q
- name: Verify workflow templates are regenerated
# The templates are generated; a hand-edit would be silently overwritten.
run: |
python scripts/build_workflows.py
git diff --exit-code workflows/ || {
echo "::error::workflows/ is stale — run: python scripts/build_workflows.py"
exit 1
}
import-check:
# The pack must import with only the standard library — the Reference
# Images node defers its PIL/numpy imports to execution time. Catches an
# accidental top-level `import requests` before a user's install does.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Import every node module
run: |
python - <<'PY'
import sys
sys.path.insert(0, ".")
from styleref_nodes.apply import StyleRefApply
from styleref_nodes.facets import StyleRefFacets
from styleref_nodes.load import StyleRefLoad
from styleref_nodes.login import StyleRefLogin
from styleref_nodes.reference_images import StyleRefReferenceImages
for node in (
StyleRefLoad,
StyleRefApply,
StyleRefFacets,
StyleRefReferenceImages,
StyleRefLogin,
):
spec = node.INPUT_TYPES()
assert "required" in spec, node
assert node.RETURN_TYPES and node.FUNCTION and node.CATEGORY, node
assert hasattr(node, node.FUNCTION), f"{node} has no {node.FUNCTION}()"
print(f"ok: {node.__name__}")
PY
+58
View File
@@ -0,0 +1,58 @@
name: Publish to Comfy Registry
# Tag-driven so a publish is always a deliberate, reviewable act:
# git tag v0.1.1 && git push origin v0.1.1
#
# The version in pyproject.toml must match the tag — the guard below enforces
# that, because the Registry takes its version from the file, not the tag, and a
# mismatch publishes the wrong number with no way to reuse it.
on:
push:
tags: ["v*"]
workflow_dispatch:
permissions:
contents: read
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Check the tag matches pyproject version
env:
# Via env rather than direct interpolation — the ref is attacker-
# influenced in the general case and must not reach the shell as code.
TAG_REF: ${{ github.ref_name }}
run: |
python - <<'PY'
import os, re, sys, tomllib
tag = os.environ["TAG_REF"].lstrip("v")
with open("pyproject.toml", "rb") as fh:
version = tomllib.load(fh)["project"]["version"]
if not re.fullmatch(r"\d+\.\d+\.\d+", version):
sys.exit(f"pyproject version {version!r} is not semver")
if tag != version:
sys.exit(f"tag v{tag} does not match pyproject version {version}")
print(f"ok: publishing {version}")
PY
- name: Install dev dependencies
run: python -m pip install --upgrade pip pytest ruff pillow numpy
- name: Lint and test before publishing
run: |
ruff check .
pytest tests/ -q
- name: Publish
uses: Comfy-Org/publish-node-action@v1
with:
personal_access_token: ${{ secrets.REGISTRY_ACCESS_TOKEN }}