Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

fix(release): leave the MCP contract version alone when stamping SDK docs (#5803)

ddupontdcb907efbfa7
diff --git a/.github/scripts/sync_sdk_release_docs.py b/.github/scripts/sync_sdk_release_docs.py
index c16b1bbb3f..5fbb9fd594 100644
--- a/.github/scripts/sync_sdk_release_docs.py
+++ b/.github/scripts/sync_sdk_release_docs.py
@@ -2,6 +2,8 @@ import argparse
from pathlib import Path
import re
+CONTRACT_LINE = "Contract version "
+
def main(argv: list[str] | None = None) -> int:
parser = argparse.ArgumentParser(description="Synchronize SDK release documentation.")
@@ -13,7 +15,14 @@ def main(argv: list[str] | None = None) -> int:
for path in (args.root / "docs/content/docs" / folder).rglob("*.mdx")]
for path in [*paths, args.root / "scripts/docs-generators/cli-specs/cua.json"]:
content = path.read_text()
- updated = re.sub(r"(?<![\d.])" + re.escape(args.previous) + r"(?!\.?\d)", version, content)
+ # The MCP contract has its own version (CONTRACT_VERSION in
+ # cua-spaces-contract), which the generated reference prints on a
+ # "Contract version" line; it does not follow the SDK release.
+ updated = "".join(
+ line if line.startswith(CONTRACT_LINE) else
+ re.sub(r"(?<![\d.])" + re.escape(args.previous) + r"(?!\.?\d)", version, line)
+ for line in content.splitlines(keepends=True)
+ )
path.write_text(updated)
return 0
diff --git a/.github/scripts/tests/test_sync_sdk_release_docs.py b/.github/scripts/tests/test_sync_sdk_release_docs.py
index 9cd8cbe78a..9cc649416d 100644
--- a/.github/scripts/tests/test_sync_sdk_release_docs.py
+++ b/.github/scripts/tests/test_sync_sdk_release_docs.py
@@ -31,3 +31,25 @@ def test_sync_sdk_release_docs_updates_standalone_versions(tmp_path: Path):
for path in paths:
assert path.read_text() == expected
assert outside.read_text() == content
+
+
+def test_sync_sdk_release_docs_leaves_the_contract_version(tmp_path: Path):
+ version = tmp_path / "libs/cua/VERSION"
+ version.parent.mkdir(parents=True)
+ version.write_text("0.8.0\n")
+ page = tmp_path / "docs/content/docs/cua-cli/reference/mcp-tools.mdx"
+ page.parent.mkdir(parents=True)
+ page.write_text(
+ " Version: 0.7.0\n"
+ "Contract version 0.7.0; MCP protocol revision 2025-06-18.\n"
+ )
+ spec = tmp_path / "scripts/docs-generators/cli-specs/cua.json"
+ spec.parent.mkdir(parents=True)
+ spec.write_text('{"version": "0.7.0"}\n')
+
+ assert main(["--repo-root", str(tmp_path), "--from", "0.7.0"]) == 0
+
+ assert page.read_text() == (
+ " Version: 0.8.0\n"
+ "Contract version 0.7.0; MCP protocol revision 2025-06-18.\n"
+ )