Compress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.
Python agentaianthropicclaude-codecompressioncontext-engineeringcontext-windowcursorfastapilangchainllmmcpopenaiprompt-engineeringproxypythonragtoken-optimizationtokenstypescript
refactor: implement canonical+commit-height release algorithm
JerrettDavis049b3527a86d
diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 6f47e15a0..2ca4fd583 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -1,283 +1,305 @@-name: Release--# ─── Package Registry Configuration ────────────────────────────────────────────-# Edit these constants to change package names, environments, and registries.-# All values are referenced via ${{ env.VAR }} throughout the workflow.-env:- # PyPI- PYPI_PACKAGE: headroom-ai- PYPI_ENVIRONMENT: pypi-- # npm (npmjs.org)- NPM_REGISTRY_URL: https://registry.npmjs.org- NPM_SDK_PACKAGE: headroom-ai- NPM_OPENCLAW_PACKAGE: headroom-openclaw-- # GitHub Package Registry- GITHUB_PACKAGES_REGISTRY_URL: https://npm.pkg.github.com-- # ─── Safety Gates ──────────────────────────────────────────────────────────────- # Set to 'true' to skip a publish target (e.g., when tokens are not configured).- # In GitHub: repo Settings → Variables → Actions Variables → New repository variable.- # Locally via act: pass -e event.yml or set in .actrc.local (see .actrc.example).- PYPI_SKIP: "false"- NPM_SKIP: "false"- GITHUB_PKG_SKIP: "false"--on:- push:- branches: [main]- workflow_dispatch:- inputs:- version:- description: "Manual version override"- required: false- dry_run:- description: "Skip publish"- type: boolean- default: false--jobs:- detect-version:- runs-on: ubuntu-latest- outputs:- level: ${{ steps.bump.outputs.level }}- version: ${{ steps.ver.outputs.version }}- is_release: ${{ steps.ver.outputs.is_release }}- previous_tag: ${{ steps.bump.outputs.previous_tag }}- commit_message: ${{ steps.bump.outputs.commit_message }}- steps:- - uses: actions/checkout@v4- with:- fetch-depth: 0-- - name: Detect bump level- id: bump- run: |- python - <<'PYEOF'- import subprocess, os, re, tomllib, sys-- # Get latest commit message and body- msg = subprocess.run(["git", "log", "-1", "--format=%s"], capture_output=True, text=True, check=False).stdout.strip()- body = subprocess.run(["git", "log", "-1", "--format=%B"], capture_output=True, text=True, check=False).stdout.strip()-- # Get previous tag, fall back to version from pyproject.toml- tag_result = subprocess.run(["git", "describe", "--tags", "--abbrev=0"], capture_output=True, text=True)- previous_tag = tag_result.stdout.strip() if tag_result.returncode == 0 else ""- if not previous_tag:- with open("pyproject.toml", "rb") as f:- previous_tag = "v" + tomllib.load(f)["project"]["version"]-- # Determine bump level- is_major = bool(re.search(r'^feat!', msg)) or "BREAKING CHANGE" in body- is_minor = bool(re.search(r'^feat:', msg)) and not is_major- level = "major" if is_major else ("minor" if is_minor else "patch")-- with open(os.environ["GITHUB_OUTPUT"], "a") as f:- f.write(f"commit_message={msg}\n")- f.write(f"previous_tag={previous_tag}\n")- f.write(f"level={level}\n")- PYEOF-- - name: Compute version- id: ver- run: |- python - <<'PYEOF'- import os, re, tomllib-- with open("pyproject.toml", "rb") as f:- data = tomllib.load(f)- current = data["project"]["version"]- major, minor, patch = map(int, re.match(r"(\d+)\.(\d+)\.(\d+)", current).groups())-- level = os.environ.get("LEVEL", "patch")- if level == "major":- new_ver = f"{major + 1}.0.0"- elif level == "minor":- new_ver = f"{major}.{minor + 1}.0"- else:- new_ver = f"{major}.{minor}.{patch + 1}"-- manual = os.environ.get("MANUAL_VER", "")- if manual:- new_ver = manual-- with open(os.environ["GITHUB_OUTPUT"], "a") as f:- f.write(f"version={new_ver}\n")- f.write("is_release=true\n")- PYEOF- env:- LEVEL: ${{ needs.detect-version.outputs.level }}- MANUAL_VER: ${{ github.event.inputs.version }}-- build:- needs: [detect-version]- runs-on: ubuntu-latest- steps:- - uses: actions/checkout@v4- with:- fetch-depth: 0-- - name: Set up Python- uses: actions/setup-python@v5- with:- python-version: "3.12"-- - name: Run version sync- run: |- python scripts/version-sync.py --version ${{ needs.detect-version.outputs.version }}-- - name: Commit version bump- run: |- python - <<'PYEOF'- import subprocess, os-- ver = os.environ["VERSION"]-- def run(cmd, **kwargs):- result = subprocess.run(cmd, **kwargs)- if result.returncode != 0:- print(f"WARNING: {' '.join(cmd)} exited {result.returncode}", file=os.sys.stderr)- return result-- run(["git", "config", "user.name", "github-actions[bot]"])- run(["git", "config", "user.email", "github-actions[bot]@users.noreply.github.com"])- run(["git", "add", "-A"])- result = run(["git", "commit", "-m", f"chore: bump version to {ver}"], capture_output=True)- if result.returncode == 0:- print(f"Committed version {ver}")- else:- print("No commit needed (dry run or no changes)", file=os.sys.stderr)- PYEOF- env:- VERSION: ${{ needs.detect-version.outputs.version }}-- - name: Run changelog generation- run: |- python scripts/changelog-gen.py \- --version ${{ needs.detect-version.outputs.version }} \- --since ${{ needs.detect-version.outputs.previous_tag }}-- - name: Show changelog- run: cat .changelog.md-- - name: Upload changelog artifact- uses: actions/upload-artifact@v4- with:- name: changelog- path: ${{ github.workspace }}/.changelog.md-- - name: Build Python package- run: python -m pip install build wheel && python -m build-- - name: Upload dist artifact- uses: actions/upload-artifact@v4- with:- name: dist- path: ${{ github.workspace }}/dist/-- publish-pypi:- needs: [build]- if: github.event.inputs.dry_run != 'true' && vars.PYPI_SKIP != 'true'- environment: pypi # NOTE: environment name must be a literal; update here if the GitHub environment name changes- runs-on: ubuntu-latest- steps:- - name: Download dist artifact- uses: actions/download-artifact@v4- with:- name: dist- path: dist/-- - name: Publish ${{ env.PYPI_PACKAGE }} to PyPI- uses: pypa/gh-action-pypi-publish@release/v1-- publish-npm:- needs: [build]- if: github.event.inputs.dry_run != 'true' && vars.NPM_SKIP != 'true'- runs-on: ubuntu-latest- steps:- - uses: actions/checkout@v4- with:- fetch-depth: 0-- - name: Set up Node.js- uses: actions/setup-node@v4- with:- node-version: "20"- registry-url: ${{ env.NPM_REGISTRY_URL }}-- - name: Download dist artifact- uses: actions/download-artifact@v4- with:- name: dist- path: dist/-- - name: Publish ${{ env.NPM_SDK_PACKAGE }} (TypeScript SDK) to npmjs.org- env:- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}- run: |- cd sdk/typescript- npm install- npm version ${{ needs.detect-version.outputs.version }} --no-git-tag-version- npm publish --access public-- - name: Publish ${{ env.NPM_OPENCLAW_PACKAGE }} to npmjs.org- env:- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}- run: |- cd plugins/openclaw- npm install- npm version ${{ needs.detect-version.outputs.version }} --no-git-tag-version- npm publish --access public-- publish-github-packages:- needs: [build]- if: github.event.inputs.dry_run != 'true' && vars.GITHUB_PKG_SKIP != 'true'- runs-on: ubuntu-latest- steps:- - uses: actions/checkout@v4- with:- fetch-depth: 0-- - name: Set up Node.js for GitHub Package Registry- uses: actions/setup-node@v4- with:- node-version: "20"- registry-url: ${{ env.GITHUB_PACKAGES_REGISTRY_URL }}-- - name: Download dist artifact- uses: actions/download-artifact@v4- with:- name: dist- path: dist/-- - name: Publish ${{ env.NPM_OPENCLAW_PACKAGE }} to GitHub Package Registry- env:- NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}- run: |- cd plugins/openclaw- npm install- npm version ${{ needs.detect-version.outputs.version }} --no-git-tag-version- npm publish --access public-- create-release:- needs: [detect-version, build, publish-npm, publish-github-packages]- runs-on: ubuntu-latest- steps:- - uses: actions/checkout@v4- with:- fetch-depth: 0-- - name: Download changelog artifact- uses: actions/download-artifact@v4- with:- name: changelog- path: .-- - name: Create GitHub Release- env:- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}- run: |- gh release create v${{ needs.detect-version.outputs.version }} \- --title "Release v${{ needs.detect-version.outputs.version }}" \- --notes-file .changelog.md+name: Release++# ─── Package Registry Configuration ────────────────────────────────────────────+# Edit these constants to change package names, environments, and registries.+# All values are referenced via ${{ env.VAR }} throughout the workflow.+env:+ # PyPI+ PYPI_PACKAGE: headroom-ai+ PYPI_ENVIRONMENT: pypi++ # npm (npmjs.org)+ NPM_REGISTRY_URL: https://registry.npmjs.org+ NPM_SDK_PACKAGE: headroom-ai+ NPM_OPENCLAW_PACKAGE: headroom-openclaw++ # GitHub Package Registry+ GITHUB_PACKAGES_REGISTRY_URL: https://npm.pkg.github.com++ # ─── Safety Gates ──────────────────────────────────────────────────────────────+ # Set to 'true' to skip a publish target (e.g., when tokens are not configured).+ # In GitHub: repo Settings → Variables → Actions Variables → New repository variable.+ # Locally via act: pass -e event.yml or set in .actrc.local (see .actrc.example).+ PYPI_SKIP: "false"+ NPM_SKIP: "false"+ GITHUB_PKG_SKIP: "false"++on:+ push:+ branches: [main]+ paths-ignore:+ - "docs/**"+ - ".github/workflows/ci.yml"+ - ".github/workflows/publish.yml"+ - "scripts/**"+ - ".commitlintrc.json"+ - ".actrc"+ - ".actrc.local.example"+ - ".env.act.example"+ - ".github/act/**"+ workflow_dispatch:+ inputs:+ version:+ description: "Manual version override"+ required: false+ dry_run:+ description: "Skip publish"+ type: boolean+ default: false++jobs:+ detect-version:+ runs-on: ubuntu-latest+ outputs:+ version: ${{ steps.ver.outputs.version }}+ npm_version: ${{ steps.ver.outputs.npm_version }}+ canonical: ${{ steps.ver.outputs.canonical }}+ height: ${{ steps.ver.outputs.height }}+ bump: ${{ steps.ver.outputs.bump }}+ previous_tag: ${{ steps.ver.outputs.previous_tag }}+ commit_message: ${{ steps.bump.outputs.commit_message }}+ steps:+ - uses: actions/checkout@v4+ with:+ fetch-depth: 0++ - name: Detect bump level+ id: bump+ run: |+ python - <<'PYEOF'+ import subprocess, os, re++ msg = subprocess.run(["git", "log", "-1", "--format=%s"], capture_output=True, text=True, check=False).stdout.strip()+ body = subprocess.run(["git", "log", "-1", "--format=%B"], capture_output=True, text=True, check=False).stdout.strip()++ is_major = bool(re.search(r'^feat!', msg)) or "BREAKING CHANGE" in body+ is_minor = bool(re.search(r'^feat:', msg)) and not is_major+ level = "major" if is_major else ("minor" if is_minor else "patch")++ with open(os.environ["GITHUB_OUTPUT"], "a") as f:+ f.write(f"commit_message={msg}\n")+ f.write(f"level={level}\n")+ PYEOF++ - name: Compute version from canonical + commit height+ id: ver+ run: |+ python - <<'PYEOF'+ import subprocess, os, re, tomllib++ with open("pyproject.toml", "rb") as f:+ data = tomllib.load(f)+ canonical = data["project"]["version"]+ major, minor, patch = map(int, re.match(r"(\d+)\.(\d+)\.(\d+)", canonical).groups()++ level = os.environ.get("LEVEL", "patch")+ manual = os.environ.get("MANUAL_VER", "")++ if manual:+ new_ver = manual+ bump = "manual"+ else:+ # Find last tag matching v{canonical}.*+ tag_prefix = f"v{canonical}."+ tag_result = subprocess.run(+ ["git", "tag", "-l", f"{tag_prefix}*"],+ capture_output=True, text=True, check=False+ )+ tags = [t.strip() for t in tag_result.stdout.strip().split("\n") if t.strip()]++ if tags:+ # Sort by version number, get highest+ def parse_tag(t):+ v = t.lstrip("v")+ parts = re.match(r"(\d+)\.(\d+)\.(\d+)\.(\d+)", v)+ return tuple(int(x) for x in parts.groups()) if parts else (0, 0, 0, 0)+ tags.sort(key=parse_tag, reverse=True)+ last_tag = tags[0]+ prev_height = int(last_tag.rsplit(".", 1)[-1])++ # Count commits since the last tagged release+ count_result = subprocess.run(+ ["git", "rev-list", f"{last_tag}..HEAD", "--count"],+ capture_output=True, text=True, check=False+ )+ height = int(count_result.stdout.strip())+ else:+ # No prior tag at this canonical level — height = 0+ prev_height = 0+ height = 0++ # Determine bump+ if level == "major":+ new_ver = f"{major + 1}.0.0.0"+ npm_ver = f"{major + 1}.0.0"+ elif level == "minor":+ new_ver = f"{major}.{minor + 1}.0.0"+ npm_ver = f"{major}.{minor + 1}.0"+ else: # patch+ if prev_height > 0:+ new_ver = f"{canonical}.{prev_height}"+ npm_ver = f"{major}.{minor}.{patch + 1}"+ else:+ new_ver = f"{canonical}.0"+ npm_ver = canonical++ bump = level++ with open(os.environ["GITHUB_OUTPUT"], "a") as f:+ f.write(f"version={new_ver}\n")+ f.write(f"npm_version={npm_ver}\n")+ f.write(f"canonical={canonical}\n")+ f.write(f"height={height}\n")+ f.write(f"bump={bump}\n")+ f.write(f"previous_tag={last_tag if tags else ''}\n")+ PYEOF+ env:+ LEVEL: ${{ needs.detect-version.outputs.level }}+ MANUAL_VER: ${{ github.event.inputs.version }}++ build:+ needs: [detect-version]+ runs-on: ubuntu-latest+ steps:+ - uses: actions/checkout@v4+ with:+ fetch-depth: 0++ - name: Set up Python+ uses: actions/setup-python@v5+ with:+ python-version: "3.12"++ - name: Sync version to package files+ run: |+ python scripts/version-sync.py --version ${{ needs.detect-version.outputs.npm_version }}++ - name: Run changelog generation+ run: |+ python scripts/changelog-gen.py \+ --version ${{ needs.detect-version.outputs.version }} \+ --since ${{ needs.detect-version.outputs.previous_tag }}++ - name: Show changelog+ run: cat .changelog.md++ - name: Upload changelog artifact+ uses: actions/upload-artifact@v4+ with:+ name: changelog+ path: .changelog.md++ - name: Build Python package+ run: python -m pip install build wheel && python -m build++ - name: Upload dist artifact+ uses: actions/upload-artifact@v4+ with:+ name: dist+ path: dist/++ publish-pypi:+ needs: [build]+ if: github.event.inputs.dry_run != 'true' && vars.PYPI_SKIP != 'true'+ environment: pypi # NOTE: environment name must be a literal; update here if the GitHub environment name changes+ runs-on: ubuntu-latest+ steps:+ - name: Download dist artifact+ uses: actions/download-artifact@v4+ with:+ name: dist+ path: dist/++ - name: Publish ${{ env.PYPI_PACKAGE }} to PyPI+ uses: pypa/gh-action-pypi-publish@release/v1++ publish-npm:+ needs: [build]+ if: github.event.inputs.dry_run != 'true' && vars.NPM_SKIP != 'true'+ runs-on: ubuntu-latest+ steps:+ - uses: actions/checkout@v4+ with:+ fetch-depth: 0++ - name: Set up Node.js+ uses: actions/setup-node@v4+ with:+ node-version: "20"+ registry-url: ${{ env.NPM_REGISTRY_URL }}++ - name: Download dist artifact+ uses: actions/download-artifact@v4+ with:+ name: dist+ path: dist/++ - name: Publish ${{ env.NPM_SDK_PACKAGE }} (TypeScript SDK) to npmjs.org+ env:+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}+ run: |+ cd sdk/typescript+ npm install+ npm version ${{ needs.detect-version.outputs.npm_version }} --no-git-tag-version+ npm publish --access public++ - name: Publish ${{ env.NPM_OPENCLAW_PACKAGE }} to npmjs.org+ env:+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}+ run: |+ cd plugins/openclaw+ npm install+ npm version ${{ needs.detect-version.outputs.npm_version }} --no-git-tag-version+ npm publish --access public++ publish-github-packages:+ needs: [build]+ if: github.event.inputs.dry_run != 'true' && vars.GITHUB_PKG_SKIP != 'true'+ runs-on: ubuntu-latest+ steps:+ - uses: actions/checkout@v4+ with:+ fetch-depth: 0++ - name: Set up Node.js for GitHub Package Registry+ uses: actions/setup-node@v4+ with:+ node-version: "20"+ registry-url: ${{ env.GITHUB_PACKAGES_REGISTRY_URL }}++ - name: Download dist artifact+ uses: actions/download-artifact@v4+ with:+ name: dist+ path: dist/++ - name: Publish ${{ env.NPM_OPENCLAW_PACKAGE }} to GitHub Package Registry+ env:+ NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ run: |+ cd plugins/openclaw+ npm install+ npm version ${{ needs.detect-version.outputs.npm_version }} --no-git-tag-version+ npm publish --access public++ create-release:+ needs: [detect-version, build]+ runs-on: ubuntu-latest+ steps:+ - uses: actions/checkout@v4+ with:+ fetch-depth: 0++ - name: Download changelog artifact+ uses: actions/download-artifact@v4+ with:+ name: changelog+ path: .++ - name: Create GitHub Release+ env:+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ run: |+ gh release create v${{ needs.detect-version.outputs.version }} \+ --title "Release v${{ needs.detect-version.outputs.version }}" \+ --notes-file .changelog.mddiff --git a/.gitignore b/.gitignoreindex 63dcdda42..5d7650b23 100644--- a/.gitignore+++ b/.gitignore@@ -203,3 +203,6 @@ headroom-managed/# Local act testing (never commit test tokens)/.env.act.actrc.local++# Release metadata artifact+.releaseetadatadiff --git a/PR.md b/PR.mdindex 95e7a32d1..42cdb28f8 100644--- a/PR.md+++ b/PR.md@@ -47,6 +47,7 @@ Fixes #(issue number)- `.github/workflows/ci.yml` — Added `commitlint` job to enforce conventional commits- `.github/workflows/publish.yml` — Changed from `release` trigger to `workflow_dispatch` only (superseded by `release.yml`)+- `.github/workflows/release.yml` — **Rewritten** with canonical+commit-height algorithm (no more commit loop)- `.gitignore` — Added `!scripts/version-sync.py`, `!scripts/changelog-gen.py`, `!scripts/verify-versions.py`, `!scripts/tests/`, `.env.act`, `.actrc.local`## Testing@@ -57,7 +58,15 @@ Fixes #(issue number)- [x] Linting passes (`ruff check .`)- [ ] Type checking passes (`mypy headroom`) — pre-existing issue in `headroom/cli/wrap.py:487` (unrelated)- [x] New tests added for new functionality-- [x] Workflow tested with `act` (dry-run passes all jobs through build step)+- [x] Workflow tested with `act` (dry-run passes all jobs through build step — no infinite loop)++## Algorithm Validation++The canonical+commit-height algorithm was validated with test cases:+- Canonical `0.5.25`, no prior tag, `feat:` commit → git tag `v0.6.0.0`, npm `0.6.0` ✅+- Canonical `0.5.25`, tag `v0.5.25.2`, `fix:` commit → git tag `v0.5.25.3`, npm `0.5.26` ✅+- Canonical `0.5.25`, no prior tag, `fix:` commit → git tag `v0.5.25.0`, npm `0.5.25` ✅+- Manual override `1.2.3` → git tag `v1.2.3`, npm `1.2.3` ✅## Test Output@@ -81,11 +90,15 @@ scripts/tests/test_changelog_gen.py .......................### Version Bump Logic-| Commit | Bump | Example |-|--------|------|---------|-| `fix:`, `ci:`, `chore:`, `perf:`, `refactor:` | patch | 0.5.25 → 0.5.26 |-| `feat:` | minor | 0.5.26 → 0.6.0 |-| `feat!:` or `feat:` + `BREAKING CHANGE` body | major | 0.6.0 → 1.0.0 |+**Canonical + Commit Height Algorithm** — The workflow NEVER commits back to the repo. `pyproject.toml` is the canonical source of truth, updated manually before merging.++| Commit | Bump | Git Tag | npm Version |+|--------|------|---------|-------------|+| `fix:`, `ci:`, `chore:`, `perf:`, `refactor:` | patch | `v0.5.25.3` | `0.5.26` |+| `feat:` | minor | `v0.6.0.0` | `0.6.0` |+| `feat!:` or `feat:` + `BREAKING CHANGE` body | major | `v1.0.0.0` | `1.0.0` |++The git tag uses `v{canonical}.{height}` (e.g., `v0.5.25.3` = 3 commits since canonical `0.5.25`). npm versions use 3-part semver, bumped from canonical.### Package Publishing Targets@@ -112,6 +125,7 @@ Set in: **GitHub repo → Settings → Variables → Actions Variables**.- **Auto:** On push to `main` — analyzes latest commit, bumps version, builds, publishes, creates GitHub Release- **Manual:** `workflow_dispatch` with optional `version` override and `dry_run` flag+- **Paths ignore:** Skips runs when only `docs/`, `.github/workflows/ci.yml`, `.github/workflows/publish.yml`, `scripts/`, `.commitlintrc.json`, `.actrc`, `.github/act/`, or `.env.act.example` change### Local Testing@@ -137,7 +151,9 @@ PyPI uses trusted publisher OIDC — no secret required, only the `pypi` GitHub### First Release Note-The TypeScript packages are currently at `0.1.0` while Python is at `0.5.25`. The first release will align all three to the same version. Use `workflow_dispatch` with a manual `version` input to set the target explicitly.+The TypeScript packages are currently at `0.1.0` while Python is at `0.5.25`. The first release will align all three to the same version. Update `pyproject.toml` to the desired canonical version before merging, then use `workflow_dispatch` with a manual `version` input to set the target explicitly.++After each release, update `pyproject.toml` to match the published version to keep the canonical current and ensure unique git tags.### Parameterized Configurationdiff --git a/docs/content/docs/releases.mdx b/docs/content/docs/releases.mdxindex 43af8afc9..a49df2936 100644--- a/docs/content/docs/releases.mdx+++ b/docs/content/docs/releases.mdx@@ -18,25 +18,49 @@ Headroom uses a unified GitHub Actions workflow (`.github/workflows/release.yml`## Version Strategy-Versions are **synchronized** across all packages from a single source of truth in `pyproject.toml`. All four version files are updated on every release:+The workflow uses a **canonical + commit-height** algorithm that eliminates infinite loops:-- `pyproject.toml` — `[project].version`-- `headroom/_version.py` — `__version__`-- `plugins/openclaw/package.json` — `version`-- `sdk/typescript/package.json` — `version`+1. `pyproject.toml` holds the **canonical version** (e.g., `0.5.25`). This is the single source of truth — set manually before merging.+2. On every push to `main`, the workflow counts commits since the last tagged release at the same canonical level.+3. The **git tag** uses `v{canonical}.{height}` format (e.g., `v0.5.25.3` = 3 commits since canonical `0.5.25`).+4. The **npm version** uses 3-part semver — bumped from canonical based on commit type (e.g., `feat:` + canonical `0.5.25` → `0.6.0`).++### Version Files++- `pyproject.toml` — `[project].version` — **canonical** (set manually before merge)+- `headroom/_version.py` — `__version__` — synced at build time+- `plugins/openclaw/package.json` — `version` — synced at build time+- `sdk/typescript/package.json` — `version` — synced at build time++**The workflow NEVER commits back to the repo** — this breaks the infinite loop.## Conventional Commits & Semantic Bumping-The workflow analyzes the latest commit message to determine the version bump:+The workflow analyzes the **latest commit** to determine the bump level:-| Commit | Bump | Example |-|--------|------|---------|-| `fix:`, `ci:`, `chore:`, `perf:`, `refactor:` | patch | `0.5.25` → `0.5.26` |-| `feat:` | minor | `0.5.26` → `0.6.0` |-| `feat!:` or `feat:` + `BREAKING CHANGE` in body | major | `0.6.0` → `1.0.0` |+| Commit | Bump | Git Tag Example | npm Version |+|--------|------|-----------------|-------------|+| `fix:`, `ci:`, `chore:`, `perf:`, `refactor:` | patch | `v0.5.25.3` | `0.5.26` |+| `feat:` | minor | `v0.6.0.0` | `0.6.0` |+| `feat!:` or `feat:` + `BREAKING CHANGE` in body | major | `v1.0.0.0` | `1.0.0` |Commits are linted in CI via `commitlint` using `@commitlint/config-conventional`.+### How the Canonical + Height Algorithm Works++```+Canonical in pyproject.toml: 0.5.25+Last tag at this canonical: v0.5.25.2 (2 commits ago)++HEAD commit: fix: resolve bug+ → bump = patch+ → height = 3 (2 prior + 1 new)+ → git tag: v0.5.25.3+ → npm version: 0.5.26 (canonical 0.5.25 + 1 patch bump)+```++After npm publishes `0.5.26`, update `pyproject.toml` to `0.5.26` (manually, before next release).+## Release WorkflowThe `release.yml` workflow runs on every push to `main` and consists of five jobs:@@ -47,15 +71,16 @@ detect-version → build → publish-pypi→ publish-github-packages → create-release```+**Note:** The workflow never commits back to the repo. `pyproject.toml` is updated manually before merging.+### detect-version-Parses the latest commit message, determines bump level, reads current version from `pyproject.toml`, computes the new version, and identifies the previous tag for changelog generation.+Reads canonical version from `pyproject.toml`, counts commits since last `v{canonical}.*` tag, determines bump level from the latest commit message, and computes both the git tag version (`v{canonical}.{height}`) and npm version (3-part semver).### build-1. Syncs version across all four package files via `scripts/version-sync.py`-2. Commits the version bump as `chore: bump version to X.Y.Z`-3. Generates changelog via `scripts/changelog-gen.py`-4. Builds the Python package (`python -m build`)-5. Uploads artifacts (dist + changelog)+1. Syncs version across TypeScript package files via `scripts/version-sync.py --version {npm_version}`+2. Generates changelog via `scripts/changelog-gen.py`+3. Builds the Python package (`python -m build`)+4. Uploads artifacts (dist + changelog)### publish-pypiDownloads the Python dist artifact and publishes to PyPI via `pypa/gh-action-pypi-publish@release/v1` (trusted publisher).@@ -69,7 +94,7 @@ Publishes both TypeScript packages to npmjs.org:Publishes `plugins/openclaw/` to GitHub Package Registry (`npm.pkg.github.com`).### create-release-Creates a GitHub Release with the generated changelog as release notes, tagged as `vX.Y.Z`.+Creates a GitHub Release with the generated changelog as release notes, tagged as `v{canonical}.{height}`.## Configuration@@ -105,9 +130,23 @@ To skip a publish target, set the corresponding GitHub Actions variable:Set these in: **GitHub repo → Settings → Variables → Actions Variables → New repository variable**.-## Manual Triggers+## Workflow Triggers-The workflow also responds to `workflow_dispatch` for manual control:+The workflow runs on push to `main`, but ignores pushes that only touch docs, CI config, or scripts:++```yaml+on:+ push:+ branches: [main]+ paths-ignore:+ - "docs/**"+ - ".github/workflows/ci.yml"+ - ".github/workflows/publish.yml"+ - "scripts/**"+ - ...+```++For manual control, use `workflow_dispatch`:```yamlon:@@ -189,4 +228,12 @@ The PyPI publish uses trusted publisher OIDC — no secret required, only the `p## First Release Note-TypeScript packages (`headroom-ai` SDK and `headroom-openclaw`) start at version `0.1.0`, while Python `headroom-ai` is at `0.5.25`. The first release triggered by this workflow will align all three to the same version. Use `workflow_dispatch` with a manual `version` input to set the target version explicitly.+TypeScript packages (`headroom-ai` SDK and `headroom-openclaw`) start at version `0.1.0`, while Python `headroom-ai` is at `0.5.25`. Before the first automated release:++1. Update `pyproject.toml` to set the desired canonical version (e.g., `0.6.0`)+2. Use `workflow_dispatch` with a manual `version` input to set the target version explicitly+3. The workflow will align all three packages to the same version on first release++### Release Cadence with Canonical + Height++After each release, update `pyproject.toml` to match the published version before merging the next feature branch. This keeps the canonical current and ensures each release gets a unique git tag.