diff --git a/.claude/commands/version-bump.md b/.claude/commands/version-bump.md index 5e8ad2a..84b5eb4 100644 --- a/.claude/commands/version-bump.md +++ b/.claude/commands/version-bump.md @@ -1,12 +1,12 @@ --- -description: Bump the package version in pyproject.toml (patch | minor | major) and suggest the matching Conventional Commits release commit message. +description: Bump the package version in pyproject.toml (patch | minor | major), date its CHANGELOG section, and suggest the release commit message and tag. allowed-tools: Read, Edit, Bash(git diff:*) argument-hint: patch | minor | major --- # `/version-bump` — bump pyproject.toml version -Edits a single field — `[project] version` in `pyproject.toml` — using semver. +Edits `[project] version` in `pyproject.toml` using semver, and dates the matching `CHANGELOG.md` section (the publish workflow sends that section to the registry as the version's changelog). ## Workflow @@ -18,18 +18,21 @@ Edits a single field — `[project] version` in `pyproject.toml` — using semve - If missing or invalid: ask once. 3. Edit `pyproject.toml`: - `version = ""` → `version = ""`. -4. `git diff pyproject.toml` — confirm exactly one line changed. -5. Propose a commit message (do not run `git commit`): +4. Edit `CHANGELOG.md`: + - `## [Unreleased]` → `## [] — `. + - If there is no `## [Unreleased]` section, warn the user: the registry will show no changelog for ``. +5. `git diff pyproject.toml CHANGELOG.md` — confirm exactly one line changed in each. +6. Propose the commit message and the tag (do not run `git commit` or `git tag`): ``` chore(release): bump version to ``` - Suggest the user run `/commit` (or `git commit -m '...' pyproject.toml`) when they're ready. + Suggest the user run `/commit` (or `git commit -m '...' pyproject.toml CHANGELOG.md`), then tag that commit with `git tag -a v -m "v"` and push both with `git push --follow-tags`. ## Safety rails -- **Only** modify the `version` field. No description / license / dependency changes. -- Do not touch any other file (no CHANGELOG, no git tag, no push). +- **Only** modify the `version` field and the CHANGELOG heading. No description / license / dependency changes. +- Do not touch any other file (no git tag, no push). - Do not commit. - If `version` is missing or unparseable, stop and ask the user. diff --git a/.github/scripts/registry_changelog.py b/.github/scripts/registry_changelog.py new file mode 100644 index 0000000..4cb2e66 --- /dev/null +++ b/.github/scripts/registry_changelog.py @@ -0,0 +1,54 @@ +"""Print a version's CHANGELOG.md entry as plain text for the Comfy Registry. + +The registry's "Updates" section shows the changelog as one plain-text +paragraph (no Markdown, newlines collapse), so each table is reduced to its +first column: "Added: A; B. Fixed: C. Full changelog: ". + +Usage: registry_changelog.py [version] (defaults to pyproject.toml's version) +""" + +import re +import sys +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[2] + + +def plain(cell): + cell = re.sub(r"\[([^\]]*)\]\([^)]*\)", r"\1", cell) # [text](url) -> text + return cell.replace("\\|", "|").replace("`", "").replace("**", "").strip() + + +def main(): + pyproject = (ROOT / "pyproject.toml").read_text(encoding="utf-8") + version = sys.argv[1] if len(sys.argv) > 1 else re.search(r'^version\s*=\s*"([^"]+)"', pyproject, re.M).group(1) + changelog = (ROOT / "CHANGELOG.md").read_text(encoding="utf-8") + section = re.search(rf"^## \[{re.escape(version)}\][^\n]*\n(.*?)(?=^## \[|\Z)", changelog, re.M | re.S) + if not section: + print( + f"::warning::CHANGELOG.md has no '## [{version}]' section; publishing without a changelog", file=sys.stderr + ) + return + + groups, in_table = [], False # [(heading, [first-column cells])] + for line in section.group(1).splitlines(): + if line.startswith("### "): + groups.append((line[4:].strip(), [])) + in_table = False + elif line.startswith("|"): + if not in_table: + in_table = True # the first row of every table is its header + elif groups and not re.match(r"^\|[\s:|-]+$", line): # skip the |---| separator + groups[-1][1].append(plain(re.split(r"(?> "$GITHUB_ENV" - name: Publish Custom Node uses: Comfy-Org/publish-node-action@v1 with: diff --git a/CLAUDE.md b/CLAUDE.md index 089931a..5596af9 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -92,7 +92,7 @@ This is a **ComfyUI custom-nodes package** that wraps the **Black Forest Labs (B - **Polling**: 5-second interval, max 40 attempts (~200 s ceiling). Already implemented in `BaseFlux.get_result` — do not write a second polling loop in a subclass. - **Config resolution**: every generation node accepts an optional `config` input of type `BFL_CONFIG` (the output of `FluxConfig_BFL`). Pass it through to `super().generate_image(url_path, arguments, config)`; the base class hands it to `get_config_loader(config)` from `nodes/config_node.py:57-67`, which decides whether to use the `config.ini`-backed default loader or build one from the override. **Both paths must work** — `config=None` (use file) and `config=` (override). - **Conventional Commits 1.0.0**: `[scope][!]: `. Types: `feat`, `fix`, `refactor`, `chore`, `docs`, `style`, `perf`, `test`, `build`, `ci`. Scopes: `api`, `finetune`, `config`, `utils`, `web`, `docs`, `release`, `tooling`. Description: lowercase, imperative ("add", not "added"/"adds"), no trailing period, ≤ 72 chars. Body explains *why*, wrapped at 72. Use `!` after type/scope for breaking changes. No Jira prefix. **No `Co-Authored-By: Claude` / "Generated with…" footer.** Do NOT inspect `git log` to derive style — historical commits used `update:` and similar non-standard types; the new standard starts now. -- **Version bumps**: edit `pyproject.toml` `version` field only. Commit message: `chore(release): bump version to X.Y.Z`. +- **Version bumps**: edit `pyproject.toml` `version` field and rename `CHANGELOG.md`'s `## [Unreleased]` heading to `## [X.Y.Z] — YYYY-MM-DD` — the publish workflow turns that section into the registry's changelog (`.github/scripts/registry_changelog.py` keeps the first column of each table row, so keep those entries short and plain). Commit message: `chore(release): bump version to X.Y.Z`. Then tag that commit `git tag -a vX.Y.Z -m "vX.Y.Z"` and push both with `git push --follow-tags`. ### Never do