Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
68910c584b |
@@ -0,0 +1,48 @@
|
||||
# Code Style
|
||||
|
||||
Conventions for this Bria **ComfyUI custom-node** package: **Python** nodes in `nodes/` calling
|
||||
BRIA's API, front-end assets in `web/`.
|
||||
|
||||
## Formatting
|
||||
|
||||
- **Ruff** is the formatter/linter (`ruff format`, `ruff check`). Format with `ruff format <files>`
|
||||
before committing; do not hand-format.
|
||||
- Format the files **you touch** — do not reformat the whole tree in a feature PR. The existing tree
|
||||
predates the formatter and has drift; a repo-wide reformat belongs in its own change. The CI
|
||||
format check is advisory for this reason (see `AGENTS.md`).
|
||||
- There is no committed Ruff config yet; defaults apply. Introduce a `[tool.ruff]` config in its own
|
||||
change if wanted, not in a feature PR.
|
||||
|
||||
## ComfyUI nodes
|
||||
|
||||
- Each node is a class exposing the ComfyUI contract (`INPUT_TYPES`, `RETURN_TYPES`, `FUNCTION`,
|
||||
`CATEGORY`). Register it in **both** `NODE_CLASS_MAPPINGS` and `NODE_DISPLAY_NAME_MAPPINGS` in
|
||||
`__init__.py`.
|
||||
- **No network or heavy work at import time** — the package is imported on every ComfyUI startup.
|
||||
Keep BRIA API calls inside the node's execute method.
|
||||
- `torch`/`comfy`/`folder_paths` etc. are host-provided by the ComfyUI runtime — import them, do not
|
||||
add them as install dependencies in `pyproject.toml`.
|
||||
- Never hardcode a BRIA API token; it is a runtime node input.
|
||||
|
||||
## Versioning
|
||||
|
||||
- The version of record is `pyproject.toml` `[project].version`; it is bumped by release-please and
|
||||
read by the Comfy Registry. Never bump it by hand — releases are cut from Conventional Commits.
|
||||
|
||||
## Commit Messages
|
||||
|
||||
Follow [Conventional Commits](https://www.conventionalcommits.org/). Allowed types: `feat`, `fix`,
|
||||
`docs`, `style`, `refactor`, `perf`, `test`, `build`, `ci`, `chore`, `revert`. PR titles are
|
||||
enforced by the `pr-title` workflow (`amannn/action-semantic-pull-request`), and these types drive
|
||||
release-please's version bumps.
|
||||
|
||||
```
|
||||
feat: add FIBO edit node with structured instruction
|
||||
fix: guard empty selection in Bria Multi Image Select
|
||||
```
|
||||
|
||||
## Before You Commit
|
||||
|
||||
Install the hooks once (`pre-commit install`) so `.pre-commit-config.yaml` runs on every commit:
|
||||
generic file hygiene plus Ruff on the files you touch. The build check
|
||||
(`python -m compileall` + pyproject validation) runs in CI (`.github/workflows/ci.yml`).
|
||||
@@ -0,0 +1,3 @@
|
||||
Canonical rule: [`.agents/rules/code-style.md`](../../.agents/rules/code-style.md).
|
||||
|
||||
This is a stub — do not duplicate content here. Read and apply the canonical rule.
|
||||
@@ -0,0 +1,8 @@
|
||||
---
|
||||
description: Code style for the Bria ComfyUI-BRIA-API custom nodes
|
||||
alwaysApply: true
|
||||
---
|
||||
|
||||
Canonical rule: [`.agents/rules/code-style.md`](../../.agents/rules/code-style.md).
|
||||
|
||||
This is a stub — do not duplicate content here. Read and apply the canonical rule.
|
||||
@@ -0,0 +1,71 @@
|
||||
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
|
||||
|
||||
# SPDX-FileCopyrightText: 2026 Bria AI <support@bria.ai>
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
name: CI
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches: [dev]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build check
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.11"
|
||||
|
||||
# ComfyUI + torch are heavy host deps we don't install in CI; compileall
|
||||
# catches syntax errors across all node modules without importing them.
|
||||
- name: Compile all sources
|
||||
run: python -m compileall -q nodes __init__.py
|
||||
|
||||
# pyproject.toml is the version source of record (release-please bumps it,
|
||||
# and the Comfy Registry reads it) — fail fast if it stops parsing.
|
||||
- name: Validate pyproject.toml
|
||||
run: |
|
||||
python - <<'PY'
|
||||
import tomllib
|
||||
with open("pyproject.toml", "rb") as f:
|
||||
data = tomllib.load(f)
|
||||
assert data["project"]["version"], "pyproject.toml [project].version missing"
|
||||
assert data["tool"]["comfy"]["PublisherId"], "[tool.comfy].PublisherId missing"
|
||||
print("pyproject.toml OK — version", data["project"]["version"])
|
||||
PY
|
||||
|
||||
format:
|
||||
name: Ruff format check (advisory)
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.11"
|
||||
|
||||
- name: Install ruff
|
||||
run: pip install ruff
|
||||
|
||||
# Advisory only: the existing tree predates any formatter and a whole-repo
|
||||
# run would flag pre-existing files, so this never fails the check yet.
|
||||
# Format files you touch with `ruff format <files>`; once the tree is
|
||||
# clean, drop continue-on-error to make it a hard gate.
|
||||
- name: Check formatting
|
||||
continue-on-error: true
|
||||
run: ruff format --check .
|
||||
@@ -0,0 +1,23 @@
|
||||
# SPDX-FileCopyrightText: 2026 Bria AI <support@bria.ai>
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
name: PR Title
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
permissions:
|
||||
pull-requests: read
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
pr-title:
|
||||
name: Validate PR Title
|
||||
if: github.event_name == 'pull_request'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check PR title follows conventional commits
|
||||
uses: amannn/action-semantic-pull-request@v6
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -2,8 +2,12 @@ name: Publish to Comfy registry
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
# dev is the single trunk (§ branch model). Publishing fires when the
|
||||
# pyproject.toml version bump lands on dev — i.e. when release-please's
|
||||
# release PR is merged. The Comfy publish action reads the version from
|
||||
# pyproject.toml, so no tag is involved.
|
||||
branches:
|
||||
- main
|
||||
- dev
|
||||
paths:
|
||||
- "pyproject.toml"
|
||||
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
|
||||
|
||||
# SPDX-FileCopyrightText: 2026 Bria AI <support@bria.ai>
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
name: Release Please
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [dev]
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
release-please:
|
||||
name: Release Please
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
steps:
|
||||
# Plain GITHUB_TOKEN is sufficient here: publishing to the Comfy Registry
|
||||
# is triggered by the pyproject.toml version bump landing on dev (see
|
||||
# publish.yml), NOT by the tag release-please pushes — so we don't need a
|
||||
# PAT to make a tag trigger a downstream workflow. release-please still
|
||||
# cuts the tag + GitHub release for provenance.
|
||||
- uses: googleapis/release-please-action@v4
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
config-file: release-please-config.json
|
||||
manifest-file: .release-please-manifest.json
|
||||
@@ -0,0 +1,38 @@
|
||||
# SPDX-FileCopyrightText: 2026 Bria AI <support@bria.ai>
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# yaml-language-server: $schema=https://json.schemastore.org/pre-commit-config.json
|
||||
|
||||
default_install_hook_types:
|
||||
- pre-commit
|
||||
- commit-msg
|
||||
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v5.0.0
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
- id: end-of-file-fixer
|
||||
- id: check-merge-conflict
|
||||
- id: check-yaml
|
||||
args: [--allow-multiple-documents]
|
||||
- id: check-toml
|
||||
- id: check-added-large-files
|
||||
- id: mixed-line-ending
|
||||
args: [--fix=lf]
|
||||
|
||||
# Ruff runs only on the files you stage (format + lint).
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: v0.7.4
|
||||
hooks:
|
||||
- id: ruff-format
|
||||
- id: ruff
|
||||
args: [--fix]
|
||||
|
||||
- repo: https://github.com/compilerla/conventional-pre-commit
|
||||
rev: v3.4.0
|
||||
hooks:
|
||||
- id: conventional-pre-commit
|
||||
stages: [commit-msg]
|
||||
args: [feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert]
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
".": "2.1.19"
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
# AGENTS.md
|
||||
|
||||
Bria's **ComfyUI custom-node package** — Python nodes that call **BRIA's API** from ComfyUI
|
||||
(`comfyui-bria-api`, published to the **Comfy Registry** as publisher `briaai`). Node
|
||||
implementations live in `nodes/`, are re-exported from `__init__.py` (`NODE_CLASS_MAPPINGS` +
|
||||
`NODE_DISPLAY_NAME_MAPPINGS`), with front-end assets in `web/` (`WEB_DIRECTORY`) and example graphs
|
||||
in `workflows/`.
|
||||
|
||||
Project rules live in `.agents/rules/`. Read and apply each:
|
||||
|
||||
- `.agents/rules/**`
|
||||
|
||||
## Environment
|
||||
|
||||
- **Python 3.11+**. ComfyUI + torch are the host runtime — provided by the ComfyUI install the node
|
||||
runs inside, **not** declared as install deps here.
|
||||
- The **version of record is `pyproject.toml` `[project].version`** — the Comfy Registry reads it,
|
||||
and release-please bumps it. **Do not bump it by hand**; releases are cut from Conventional
|
||||
Commits (see below).
|
||||
- API tokens are supplied by the user at runtime through the node inputs — never hardcode or commit
|
||||
a BRIA API token.
|
||||
|
||||
## Nodes
|
||||
|
||||
- Each node is a class in `nodes/` exposing the ComfyUI contract (`INPUT_TYPES`, `RETURN_TYPES`,
|
||||
`FUNCTION`, `CATEGORY`, an `execute`-style method). Register a new node by adding it to both
|
||||
`NODE_CLASS_MAPPINGS` and `NODE_DISPLAY_NAME_MAPPINGS` in `__init__.py`.
|
||||
- Keep BRIA API calls in the node's method (not at import time) — importing the package must not do
|
||||
network I/O, or ComfyUI startup breaks.
|
||||
- Front-end widgets go under `web/` and are exposed via `WEB_DIRECTORY = "./web"`.
|
||||
|
||||
## Checks — keep them green
|
||||
|
||||
CI (`.github/workflows/ci.yml`, on PRs and pushes to `dev`) gates on:
|
||||
|
||||
| Check | Command |
|
||||
| ----- | ------- |
|
||||
| Build | `python -m compileall nodes __init__.py` + a `pyproject.toml` validity check |
|
||||
| Format | `ruff format --check .` — **advisory** (see below) |
|
||||
|
||||
The Ruff format check is intentionally **advisory** (`continue-on-error: true`) today: the existing
|
||||
tree predates any formatter and a whole-repo run flags pre-existing files. Format the files you
|
||||
touch with `ruff format <files>`; once the tree is clean, drop `continue-on-error` to make it a hard
|
||||
gate. PR titles are validated against Conventional Commits by `pr-title.yml`.
|
||||
|
||||
Locally, `pre-commit` adds generic file hygiene plus Ruff on the files you touch — install it once
|
||||
with `pre-commit install` (config: `.pre-commit-config.yaml`).
|
||||
|
||||
## Agent Configuration
|
||||
|
||||
All agent rules are canonical in `.agents/`. Thin stubs under `.claude/` and `.cursor/` point back
|
||||
here — never duplicate content.
|
||||
|
||||
```
|
||||
.agents/
|
||||
└── rules/ Always-on rules — loaded by all agents on startup
|
||||
```
|
||||
|
||||
| Tool | Rules |
|
||||
| ----------- | ------------------------------------------------------------------------------ |
|
||||
| Claude Code | `.claude/rules/` stubs → `.agents/rules/` (and root `CLAUDE.md` → `AGENTS.md`) |
|
||||
| Cursor | `.cursor/rules/*.mdc` → `.agents/rules/` |
|
||||
|
||||
## Release flow (trunk-based on `dev`)
|
||||
|
||||
- **`dev`** is the single trunk and default branch. Do not use `main`.
|
||||
- **release**: `release-please` (`.github/workflows/release-please.yml`) watches `dev`, opens a
|
||||
release PR from Conventional Commits that bumps `pyproject.toml` + `CHANGELOG.md`; merging it cuts
|
||||
a `vX.Y.Z` tag + GitHub release.
|
||||
- **publish**: merging that release PR lands the version bump on `dev`, which triggers
|
||||
`.github/workflows/publish.yml` (`Comfy-Org/publish-node-action`) to publish the new version to
|
||||
the **Comfy Registry**. Publishing keys off the `pyproject.toml` version, not the tag — so plain
|
||||
`GITHUB_TOKEN` is enough for release-please (no PAT needed to trigger a downstream tag build).
|
||||
|
||||
See `Readme.md` for the user-facing node documentation.
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
|
||||
"release-type": "python",
|
||||
"include-component-in-tag": false,
|
||||
"packages": {
|
||||
".": {
|
||||
"changelog-path": "CHANGELOG.md"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user