From 58ef33b0bef3e8f31debeeddf555e7687c53bfd3 Mon Sep 17 00:00:00 2001 From: Lawrence Chen <54008264+lawrencecchen@users.noreply.github.com> Date: Sun, 16 Aug 2026 22:47:17 -0700 Subject: [PATCH 1/2] test(tui): enforce frontend protocol docs contract --- cmux-tui/scripts/test_frontend_docs.py | 62 ++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 cmux-tui/scripts/test_frontend_docs.py diff --git a/cmux-tui/scripts/test_frontend_docs.py b/cmux-tui/scripts/test_frontend_docs.py new file mode 100644 index 000000000000..3f4b970aa145 --- /dev/null +++ b/cmux-tui/scripts/test_frontend_docs.py @@ -0,0 +1,62 @@ +#!/usr/bin/env python3 +"""Keep frontend README protocol claims aligned with the supported wire API.""" + +from __future__ import annotations + +import re +import unittest +from pathlib import Path + + +TUI = Path(__file__).resolve().parents[1] +README_PATHS = ( + TUI / "frontends" / "README.md", + TUI / "frontends" / "README.ja.md", + TUI / "frontends" / "web" / "README.md", + TUI / "frontends" / "web" / "README.ja.md", +) + + +def supported_protocol() -> int: + source = (TUI / "frontends" / "web" / "src" / "lib" / "protocol.ts").read_text( + encoding="utf-8" + ) + match = re.search(r"SUPPORTED_PROTOCOL\s*=\s*(\d+)", source) + if match is None: + raise AssertionError("web frontend has no supported protocol constant") + return int(match.group(1)) + + +def documented_protocol() -> int: + source = (TUI / "docs" / "protocol.md").read_text(encoding="utf-8") + match = re.search(r"^# Raw control protocol v(\d+)\s*$", source, re.MULTILINE) + if match is None: + raise AssertionError("raw protocol guide has no version heading") + return int(match.group(1)) + + +class FrontendReadmeProtocolTests(unittest.TestCase): + def test_readmes_match_the_supported_websocket_protocol(self) -> None: + expected = supported_protocol() + self.assertEqual(expected, documented_protocol()) + + for path in README_PATHS: + text = path.read_text(encoding="utf-8") + websocket_lines = [ + line for line in text.splitlines() if "websocket" in line.lower() + ] + self.assertTrue(websocket_lines, path) + versions = { + int(version) + for line in websocket_lines + for version in re.findall( + r"(?:protocol|プロトコル)[-\s]?v?(\d+)", + line, + re.IGNORECASE, + ) + } + self.assertEqual(versions, {expected}, path) + + +if __name__ == "__main__": + unittest.main() From e13626d717a45b1c0401bbc6ca0629f09d915498 Mon Sep 17 00:00:00 2001 From: Lawrence Chen <54008264+lawrencecchen@users.noreply.github.com> Date: Sun, 16 Aug 2026 22:47:54 -0700 Subject: [PATCH 2/2] docs(tui): align frontend protocol references --- .github/workflows/cmux-tui-spec.yml | 3 +++ cmux-tui/frontends/README.ja.md | 2 +- cmux-tui/frontends/README.md | 2 +- cmux-tui/frontends/web/README.ja.md | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cmux-tui-spec.yml b/.github/workflows/cmux-tui-spec.yml index 73f1974387d3..5b11f65a044c 100644 --- a/.github/workflows/cmux-tui-spec.yml +++ b/.github/workflows/cmux-tui-spec.yml @@ -32,6 +32,9 @@ jobs: - name: Test inventory checker run: python3 cmux-tui/scripts/test_check_spec_inventory.py + - name: Test frontend documentation protocol + run: python3 cmux-tui/scripts/test_frontend_docs.py + - name: Check protocol and TUI action inventory run: python3 cmux-tui/scripts/check-spec-inventory.py diff --git a/cmux-tui/frontends/README.ja.md b/cmux-tui/frontends/README.ja.md index ba2d7f125de1..d9f03a152c98 100644 --- a/cmux-tui/frontends/README.ja.md +++ b/cmux-tui/frontends/README.ja.md @@ -3,7 +3,7 @@ [English](README.md) リポジトリ内のリファレンス実装は[ウェブフロントエンド](web)です。 -プロトコルv7のWebSocket APIとTypeScript SDKのブラウザ向けエントリポイントを +プロトコルv12のWebSocket APIとTypeScript SDKのブラウザ向けエントリポイントを 使用した実装例です。 macOSネイティブフロントエンドは、非公開の diff --git a/cmux-tui/frontends/README.md b/cmux-tui/frontends/README.md index 525e319a2200..329896944158 100644 --- a/cmux-tui/frontends/README.md +++ b/cmux-tui/frontends/README.md @@ -3,7 +3,7 @@ [日本語](README.ja.md) The in-tree reference frontend is the [web frontend](web). It demonstrates the -protocol-v7 WebSocket API and the browser entry point of the TypeScript SDK. +protocol-v12 WebSocket API and the browser entry point of the TypeScript SDK. The native macOS frontend is maintained separately in the private [`manaflow-ai/cmux-lite`](https://github.com/manaflow-ai/cmux-lite) repository. diff --git a/cmux-tui/frontends/web/README.ja.md b/cmux-tui/frontends/web/README.ja.md index 623cd12d675c..4c1a3f8a0834 100644 --- a/cmux-tui/frontends/web/README.ja.md +++ b/cmux-tui/frontends/web/README.ja.md @@ -2,7 +2,7 @@ [English](README.md) -プロトコルv10のWebSocket APIとTypeScript SDKのブラウザ向けエントリだけで、 +プロトコルv12のWebSocket APIとTypeScript SDKのブラウザ向けエントリだけで、 自然なcmuxクライアントを構築できることを示す小規模なサードパーティー形式の フロントエンドです。信頼できるワークスペースツリーの表示、アクティブなPTY サーフェスへのxterm.jsの接続、キーボード入力の転送、ターミナルセル単位の