From eadf039f766c1e2813da2f2882695fcf4f51aa18 Mon Sep 17 00:00:00 2001 From: Chojan Shang Date: Tue, 20 Oct 2026 02:22:23 +0800 Subject: [PATCH 1/5] feat(catalog): sync Bub contrib plugins weekly as draft PRs --- .github/bub-contrib-sync.json | 74 +++++++++ .github/workflows/check.yml | 18 +++ .github/workflows/sync-bub-contrib.yml | 71 ++++++++ README.md | 19 +++ data.yml | 60 +++++++ pyproject.toml | 1 + scripts/sync_bub_contrib.py | 215 +++++++++++++++++++++++++ tests/test_sync_bub_contrib.py | 174 ++++++++++++++++++++ uv.lock | 52 ++++++ 9 files changed, 684 insertions(+) create mode 100644 .github/bub-contrib-sync.json create mode 100644 .github/workflows/check.yml create mode 100644 .github/workflows/sync-bub-contrib.yml create mode 100644 scripts/sync_bub_contrib.py create mode 100644 tests/test_sync_bub_contrib.py diff --git a/.github/bub-contrib-sync.json b/.github/bub-contrib-sync.json new file mode 100644 index 0000000..b47b7df --- /dev/null +++ b/.github/bub-contrib-sync.json @@ -0,0 +1,74 @@ +{ + "bub-agent-plugins": { + "author": "Bub contributors", + "builtin": false, + "description": "Load portable Agent Plugins into Bub", + "homepage_url": "https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-agent-plugins", + "install": "bub install bub-agent-plugins@main", + "kind": "plugin", + "logo": "/plugin.svg", + "name": "bub-agent-plugins", + "repo_url": "https://github.com/bubbuild/bub-contrib", + "source_path": "packages/bub-agent-plugins" + }, + "bub-docker-env": { + "author": "wzhongyun", + "builtin": false, + "description": "Run Bub sessions' bash, fs and code-mode tools in Docker containers", + "homepage_url": "https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-docker-env", + "install": "bub install bub-docker-env@main", + "kind": "plugin", + "logo": "/plugin.svg", + "name": "bub-docker-env", + "repo_url": "https://github.com/bubbuild/bub-contrib", + "source_path": "packages/bub-docker-env" + }, + "bub-env": { + "author": "wzhongyun", + "builtin": false, + "description": "Inject environment variables from the Bub config file at startup", + "homepage_url": "https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-env", + "install": "bub install bub-env@main", + "kind": "plugin", + "logo": "/plugin.svg", + "name": "bub-env", + "repo_url": "https://github.com/bubbuild/bub-contrib", + "source_path": "packages/bub-env" + }, + "bub-monty-env": { + "author": "Frost Ming", + "builtin": false, + "description": "Run Bub's code-mode run_code in Monty, a sandboxed Python interpreter, on top of any Bub environment", + "homepage_url": "https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-monty-env", + "install": "bub install bub-monty-env@main", + "kind": "plugin", + "logo": "/plugin.svg", + "name": "bub-monty-env", + "repo_url": "https://github.com/bubbuild/bub-contrib", + "source_path": "packages/bub-monty-env" + }, + "bub-sandbox-env": { + "author": "Frost Ming", + "builtin": false, + "description": "Run Bub sessions' bash, fs and code-mode tools in a lightweight local sandbox (macOS Seatbelt, Linux bubblewrap)", + "homepage_url": "https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-sandbox-env", + "install": "bub install bub-sandbox-env@main", + "kind": "plugin", + "logo": "/plugin.svg", + "name": "bub-sandbox-env", + "repo_url": "https://github.com/bubbuild/bub-contrib", + "source_path": "packages/bub-sandbox-env" + }, + "bub-tapestore-otel": { + "author": "Chojan Shang", + "builtin": false, + "description": "OpenTelemetry projection layer for Bub tape stores", + "homepage_url": "https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-tapestore-otel", + "install": "bub install bub-tapestore-otel@main", + "kind": "plugin", + "logo": "/plugin.svg", + "name": "bub-tapestore-otel", + "repo_url": "https://github.com/bubbuild/bub-contrib", + "source_path": "packages/bub-tapestore-otel" + } +} diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 0000000..72660c1 --- /dev/null +++ b/.github/workflows/check.yml @@ -0,0 +1,18 @@ +name: Catalog checks + +on: + pull_request: + workflow_dispatch: + +permissions: + contents: read + +jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: astral-sh/setup-uv@v6 + - run: uv sync --frozen + - run: uv run --frozen python -m unittest discover -s tests + - run: uv run --frozen python build.py diff --git a/.github/workflows/sync-bub-contrib.yml b/.github/workflows/sync-bub-contrib.yml new file mode 100644 index 0000000..944b234 --- /dev/null +++ b/.github/workflows/sync-bub-contrib.yml @@ -0,0 +1,71 @@ +name: Sync Bub contrib + +on: + schedule: + - cron: '41 3 * * 1' + workflow_dispatch: + inputs: + publish: + description: Open a draft PR (default branch only) + type: boolean + default: true + +permissions: + contents: write + pull-requests: write + +concurrency: + group: sync-bub-contrib + cancel-in-progress: false + +jobs: + sync: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Check for pending sync + id: pending + env: + GH_TOKEN: ${{ github.token }} + run: | + count=$(gh pr list --repo "$GITHUB_REPOSITORY" --state open --head catalog/bub-contrib --json number --jq length) + echo "count=$count" >> "$GITHUB_OUTPUT" + - uses: actions/checkout@v4 + if: steps.pending.outputs.count == '0' + with: + repository: bubbuild/bub-contrib + ref: main + path: .sync-source + persist-credentials: false + - uses: astral-sh/setup-uv@v6 + if: steps.pending.outputs.count == '0' + - name: Sync and validate + if: steps.pending.outputs.count == '0' + id: sync + run: | + echo "source=$(git -C .sync-source rev-parse HEAD)" >> "$GITHUB_OUTPUT" + uv sync --frozen + uv run --frozen python -m unittest discover -s tests + uv run --frozen python scripts/sync_bub_contrib.py .sync-source + uv run --frozen python build.py + if ! git diff --quiet -- data.yml .github/bub-contrib-sync.json; then + echo 'changed=true' >> "$GITHUB_OUTPUT" + fi + - name: Open draft catalog update + if: >- + steps.sync.outputs.changed == 'true' && github.ref == 'refs/heads/main' && + (github.event_name == 'schedule' || inputs.publish) + uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8 + with: + branch: catalog/bub-contrib + base: main + draft: always-true + add-paths: | + data.yml + .github/bub-contrib-sync.json + commit-message: 'chore(catalog): sync Bub contrib plugins' + title: 'chore(catalog): sync Bub contrib plugins' + body: | + Sync plugin metadata from bubbuild/bub-contrib@${{ steps.sync.outputs.source }} using `scripts/sync_bub_contrib.py`. + + Validation: sync behavior tests and site build pass. Existing curated entries and manual field overrides remain authoritative. Maintainers review and merge this draft. diff --git a/README.md b/README.md index 56b3eb6..4dcec13 100644 --- a/README.md +++ b/README.md @@ -72,3 +72,22 @@ categories: | `bundled_plugins` | list | | `[{name, url}]` for distributions (max 3 shown) | Build validates required fields, `kind` enum, and rejects unknown fields. + +## Bub contrib updates + +[Sync Bub contrib](.github/workflows/sync-bub-contrib.yml) reads `packages/*/pyproject.toml` from `bubbuild/bub-contrib` main each Monday at 03:41 UTC, or on manual dispatch. It imports packages declaring a `bub` entry point into the existing Plugins groups. It reads metadata without executing upstream code. Package descriptions, authors, SPDX license strings, source links, and `bub install NAME@main` commands supply new entries; missing descriptions get a package-name fallback. New entries use the existing `logos/plugin.svg` until a maintainer selects a project logo. Skills, third-party entries, existing logos, and existing curated package entries stay under manual maintenance. + +The sync deduplicates package names (including case, hyphen, underscore, and dot variants) and contrib source paths across groups. It records only newly imported entries in `.github/bub-contrib-sync.json`. Later runs update fields that still match their last generated values; manual overrides and deleted entries stay untouched. Missing upstream packages remain in the catalog for manual retirement. Keep the state file when editing or moving generated entries. + +Changed data passes sync tests and the site build before the workflow opens a draft PR on `catalog/bub-contrib`. An open sync PR pauses further updates so reviewer edits survive. Unchanged runs create no commit, PR, or comment. Maintainers merge updates manually. The repository must allow GitHub Actions to create pull requests in **Settings > Actions > General > Workflow permissions**; the workflow uses `GITHUB_TOKEN` with contents and pull request write permissions and requires no model secrets. Token-created PRs do not trigger ordinary PR workflows, so the sync runs validation before publication. Schedules become active after this workflow reaches the default branch. + +To reproduce locally with a separate contrib checkout: + +```bash +uv sync --frozen +uv run --frozen python scripts/sync_bub_contrib.py ../bub-contrib +uv run --frozen python -m unittest discover -s tests +uv run --frozen python build.py +``` + +For a workflow dry run, manually dispatch **Sync Bub contrib** with `publish` disabled. Publication also requires running on `main`. diff --git a/data.yml b/data.yml index e143010..2169fbb 100644 --- a/data.yml +++ b/data.yml @@ -196,6 +196,56 @@ categories: install: bub install bub-dsh@main builtin: false source_path: packages/bub-dsh + - name: bub-agent-plugins + description: Load portable Agent Plugins into Bub + kind: plugin + logo: /plugin.svg + homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-agent-plugins + repo_url: https://github.com/bubbuild/bub-contrib + install: bub install bub-agent-plugins@main + builtin: false + source_path: packages/bub-agent-plugins + author: Bub contributors + - name: bub-docker-env + description: Run Bub sessions' bash, fs and code-mode tools in Docker containers + kind: plugin + logo: /plugin.svg + homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-docker-env + repo_url: https://github.com/bubbuild/bub-contrib + install: bub install bub-docker-env@main + builtin: false + source_path: packages/bub-docker-env + author: wzhongyun + - name: bub-env + description: Inject environment variables from the Bub config file at startup + kind: plugin + logo: /plugin.svg + homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-env + repo_url: https://github.com/bubbuild/bub-contrib + install: bub install bub-env@main + builtin: false + source_path: packages/bub-env + author: wzhongyun + - name: bub-monty-env + description: Run Bub's code-mode run_code in Monty, a sandboxed Python interpreter, on top of any Bub environment + kind: plugin + logo: /plugin.svg + homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-monty-env + repo_url: https://github.com/bubbuild/bub-contrib + install: bub install bub-monty-env@main + builtin: false + source_path: packages/bub-monty-env + author: Frost Ming + - name: bub-sandbox-env + description: Run Bub sessions' bash, fs and code-mode tools in a lightweight local sandbox (macOS Seatbelt, Linux bubblewrap) + kind: plugin + logo: /plugin.svg + homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-sandbox-env + repo_url: https://github.com/bubbuild/bub-contrib + install: bub install bub-sandbox-env@main + builtin: false + source_path: packages/bub-sandbox-env + author: Frost Ming - name: Tools items: - name: bub-mcp @@ -285,6 +335,16 @@ categories: author: yibie install: bub install bub-semantic-memory builtin: false + - name: bub-tapestore-otel + description: OpenTelemetry projection layer for Bub tape stores + kind: plugin + logo: /plugin.svg + homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-tapestore-otel + repo_url: https://github.com/bubbuild/bub-contrib + install: bub install bub-tapestore-otel@main + builtin: false + source_path: packages/bub-tapestore-otel + author: Chojan Shang - name: Skills subcategories: - name: Built-in diff --git a/pyproject.toml b/pyproject.toml index 1af0cfd..f6ded41 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,6 +6,7 @@ requires-python = ">=3.12" dependencies = [ "jinja2>=3.1.6", "pyyaml>=6.0.3", + "ruamel-yaml>=0.18.10,<0.19", ] [dependency-groups] diff --git a/scripts/sync_bub_contrib.py b/scripts/sync_bub_contrib.py new file mode 100644 index 0000000..1738cca --- /dev/null +++ b/scripts/sync_bub_contrib.py @@ -0,0 +1,215 @@ +"""Import Bub contrib plugins while preserving curated catalog fields.""" + +import argparse +import copy +import io +import json +import re +import tomllib +from pathlib import Path + +import yaml as pyyaml +from ruamel.yaml import YAML + +REPOSITORY = "https://github.com/bubbuild/bub-contrib" + + +def package_name(value): + return re.sub(r"[-_.]+", "-", value).lower() + + +def source_items(source): + """Read metadata only; never import or install upstream packages.""" + items = {} + for manifest in sorted((source / "packages").glob("*/pyproject.toml")): + project = tomllib.loads(manifest.read_text(encoding="utf-8"))["project"] + if not project.get("entry-points", {}).get("bub"): + continue + name = project["name"] + key = package_name(name) + if key in items: + raise ValueError(f"Duplicate source package: {name}") + description = project.get("description", "").strip() + if not description or description == "Add your description here": + description = f"Bub plugin: {name}." + path = manifest.parent.relative_to(source).as_posix() + item = { + "name": name, + "description": " ".join(description.split()), + "kind": "plugin", + "logo": "/plugin.svg", + "homepage_url": f"{REPOSITORY}/tree/main/{path}", + "repo_url": REPOSITORY, + "install": f"bub install {name}@main", + "builtin": False, + "source_path": path, + } + authors = [ + author["name"] + for author in project.get("authors", []) + if author.get("name") + ] + if authors: + item["author"] = ", ".join(authors) + license_name = project.get("license") + if isinstance(license_name, str): + item["license"] = license_name + items[key] = item + if not items: + raise ValueError("Source contains no Bub plugin packages") + return items + + +def write_catalog(catalog, before, after, yaml): + """Rewrite changed items only, retaining surrounding curated YAML verbatim.""" + text = catalog.read_text(encoding="utf-8") + lines = text.splitlines(keepends=True) + root = pyyaml.compose(text) + categories_node = next( + value for key, value in root.value if key.value == "categories" + ) + edits = [] + for old_category, category, category_node in zip( + before["categories"], after["categories"], categories_node.value + ): + groups_node = next( + value for key, value in category_node.value if key.value == "subcategories" + ) + for old_group, group, group_node in zip( + old_category["subcategories"], category["subcategories"], groups_node.value + ): + items_node = next( + value for key, value in group_node.value if key.value == "items" + ) + old_items = old_group.get("items", []) + items = group.get("items", []) + for index, (old_item, item) in enumerate(zip(old_items, items)): + if old_item != item: + start = items_node.value[index].start_mark.line + end = ( + items_node.value[index + 1].start_mark.line + if index + 1 < len(old_items) + else items_node.end_mark.line + ) + output = io.StringIO() + yaml.dump([item], output) + edits.append((start, end, output.getvalue())) + if len(items) > len(old_items): + output = io.StringIO() + yaml.dump(items[len(old_items) :], output) + if not old_items: + edits.append( + ( + items_node.start_mark.line, + items_node.end_mark.line + 1, + "items:\n" + output.getvalue(), + ) + ) + else: + edits.append( + ( + items_node.end_mark.line, + items_node.end_mark.line, + output.getvalue(), + ) + ) + for start, end, replacement in sorted(edits, reverse=True): + lines[start:end] = [ + " " + line for line in replacement.splitlines(keepends=True) + ] + catalog.write_text("".join(lines), encoding="utf-8") + + +def sync(source, catalog, state_path): + upstream = source_items(source) + yaml = YAML() + yaml.preserve_quotes = True + yaml.width = 1000 + yaml.indent(mapping=2, sequence=4, offset=2) + data = yaml.load(catalog.read_text(encoding="utf-8")) + state = ( + json.loads(state_path.read_text(encoding="utf-8")) + if state_path.exists() + else {} + ) + previous_data = copy.deepcopy(data) + previous_state = copy.deepcopy(state) + categories = data["categories"] + plugins = next(category for category in categories if category["name"] == "Plugins") + by_name = {} + by_path = {} + for category in categories: + for group in category.get("subcategories", []): + for item in group.get("items", []): + if item.get("kind") != "plugin": + continue + by_name.setdefault(package_name(item["name"]), []).append(item) + repository = ( + item.get("repo_url", "").rstrip("/").removesuffix(".git").lower() + ) + if repository == REPOSITORY.lower(): + by_path.setdefault(item.get("source_path"), []).append(item) + + for key, generated in upstream.items(): + matches = by_name.get(key, []).copy() + for item in by_path.get(generated["source_path"], []): + if all(item is not match for match in matches): + matches.append(item) + if matches: + # Never choose between existing duplicates or claim curated data. + if len(matches) != 1 or key not in state: + continue + item = matches[0] + baseline = state[key] + if ( + item.get("repo_url") != REPOSITORY + or item.get("source_path") != baseline["source_path"] + ): + continue + for field, value in generated.items(): + if ( + field in baseline + and item.get(field) == baseline[field] + or field not in baseline + and field not in item + ): + item[field] = value + baseline[field] = value + elif key not in state: + # State also remembers deliberate catalog deletions; do not recreate them. + group_name = ( + "Storage & Memory" + if "tapestore" in key or "tape-dataset" in key + else "Runtime & Workflow" + ) + group = next( + group + for group in plugins["subcategories"] + if group["name"] == group_name + ) + group.setdefault("items", []).append(generated) + state[key] = generated.copy() + if data != previous_data: + write_catalog(catalog, previous_data, data, yaml) + if state != previous_state: + state_path.parent.mkdir(parents=True, exist_ok=True) + state_path.write_text( + json.dumps(state, indent=2, sort_keys=True) + "\n", encoding="utf-8" + ) + return data != previous_data or state != previous_state + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("source", type=Path, help="Local bub-contrib checkout") + parser.add_argument("--catalog", type=Path, default=Path("data.yml")) + parser.add_argument( + "--state", type=Path, default=Path(".github/bub-contrib-sync.json") + ) + args = parser.parse_args() + if sync(args.source, args.catalog, args.state): + print("Updated Bub contrib catalog data.") + + +if __name__ == "__main__": + main() diff --git a/tests/test_sync_bub_contrib.py b/tests/test_sync_bub_contrib.py new file mode 100644 index 0000000..2e1d519 --- /dev/null +++ b/tests/test_sync_bub_contrib.py @@ -0,0 +1,174 @@ +import json +import subprocess +import sys +import tempfile +import unittest +from pathlib import Path + +import yaml + +from scripts.sync_bub_contrib import REPOSITORY, sync + +ROOT = Path(__file__).resolve().parents[1] + + +class SyncTests(unittest.TestCase): + def setUp(self): + self.directory = tempfile.TemporaryDirectory() + self.addCleanup(self.directory.cleanup) + self.root = Path(self.directory.name) + self.source = self.root / "source" + self.catalog = self.root / "data.yml" + self.state = self.root / "state.json" + self.catalog.write_text( + "# Curated catalog\ncategories:\n" + " - name: Plugins\n subcategories:\n" + " - name: Runtime & Workflow\n items: []\n" + " - name: Storage & Memory\n items: []\n", + encoding="utf-8", + ) + self.package() + + def package( + self, description="Example plugin", name="bub-example", entry_point=True + ): + package = self.source / "packages" / name + package.mkdir(parents=True, exist_ok=True) + manifest = ( + f'[project]\nname = "{name}"\ndescription = "{description}"\n' + 'authors = [{name = "A contributor"}]\nlicense = "MIT"\n' + ) + if entry_point: + manifest += '[project.entry-points.bub]\nexample = "example.plugin"\n' + (package / "pyproject.toml").write_text(manifest, encoding="utf-8") + + def run_sync(self): + return sync(self.source, self.catalog, self.state) + + def items(self): + data = yaml.safe_load(self.catalog.read_text(encoding="utf-8")) + return [ + item + for category in data["categories"] + for group in category["subcategories"] + for item in group["items"] + ] + + def test_initial_import_and_quiet_byte_identical_repeat(self): + self.assertTrue(self.run_sync()) + item = self.items()[0] + self.assertEqual(item["source_path"], "packages/bub-example") + self.assertEqual(item["repo_url"], REPOSITORY) + self.assertEqual(item["install"], "bub install bub-example@main") + self.assertEqual(item["author"], "A contributor") + self.assertEqual(item["license"], "MIT") + self.assertTrue((ROOT / "logos" / item["logo"].lstrip("/")).is_file()) + before = self.catalog.read_bytes(), self.state.read_bytes() + result = subprocess.run( + [ + sys.executable, + str(ROOT / "scripts/sync_bub_contrib.py"), + str(self.source), + "--catalog", + str(self.catalog), + "--state", + str(self.state), + ], + capture_output=True, + text=True, + check=True, + ) + self.assertEqual(result.stdout, "") + self.assertEqual(result.stderr, "") + self.assertEqual(before, (self.catalog.read_bytes(), self.state.read_bytes())) + + def test_updates_generated_fields_and_preserves_overrides(self): + self.run_sync() + text = self.catalog.read_text(encoding="utf-8") + self.catalog.write_text( + text.replace("/plugin.svg", "/mcp.svg # Maintainer-selected logo"), + encoding="utf-8", + ) + self.package("Changed upstream summary") + self.assertTrue(self.run_sync()) + item = self.items()[0] + self.assertEqual(item["description"], "Changed upstream summary") + self.assertEqual(item["logo"], "/mcp.svg") + self.assertIn("# Maintainer-selected logo", self.catalog.read_text()) + text = self.catalog.read_text(encoding="utf-8") + self.catalog.write_text( + text.replace("Changed upstream summary", "Curated summary"), + encoding="utf-8", + ) + self.package("Another upstream summary") + self.assertFalse(self.run_sync()) + self.assertEqual(self.items()[0]["description"], "Curated summary") + + def test_curated_entries_and_comments_remain_verbatim(self): + curated = ( + " # Keep this comment and formatting\n" + " - name: BUB_Example\n description: 'Curated summary'\n" + " kind: plugin\n logo: /mcp.svg\n" + ) + self.catalog.write_text( + self.catalog.read_text().replace( + " items: []", " items:\n" + curated, 1 + ) + ) + before = self.catalog.read_bytes() + self.assertFalse(self.run_sync()) + self.assertEqual(self.catalog.read_bytes(), before) + self.package(name="bub-other") + self.assertTrue(self.run_sync()) + self.assertIn(curated, self.catalog.read_text()) + self.assertEqual(len(self.items()), 2) + self.assertNotIn("bub-example", json.loads(self.state.read_text())) + + def test_source_path_deduplicates_renamed_curated_entry(self): + self.run_sync() + self.catalog.write_text( + self.catalog.read_text().replace("name: bub-example", "name: Friendly name") + ) + self.state.unlink() + self.assertFalse(self.run_sync()) + self.assertEqual(len(self.items()), 1) + + def test_removed_package_is_retained_and_manual_deletion_is_respected(self): + self.run_sync() + self.package(name="bub-other") + self.run_sync() + (self.source / "packages/bub-example/pyproject.toml").unlink() + self.assertFalse(self.run_sync()) + self.assertEqual(len(self.items()), 2) + # Restore source, then deliberately remove the corresponding catalog item. + self.package() + text = self.catalog.read_text() + start = text.index(" - name: bub-example") + end = text.index(" - name: bub-other") + self.catalog.write_text(text[:start] + text[end:]) + self.assertFalse(self.run_sync()) + self.assertEqual([item["name"] for item in self.items()], ["bub-other"]) + + def test_ignores_non_plugins_and_groups_storage(self): + self.package(name="utility", entry_point=False) + self.package(name="bub-tapestore-example") + self.run_sync() + groups = yaml.safe_load(self.catalog.read_text())["categories"][0][ + "subcategories" + ] + self.assertEqual( + [item["name"] for item in groups[1]["items"]], ["bub-tapestore-example"] + ) + self.assertEqual(len(self.items()), 2) + + def test_invalid_or_duplicate_source_fails_before_writing(self): + self.package(name="BUB_Example") + before = self.catalog.read_bytes() + with self.assertRaisesRegex(ValueError, "Duplicate source package"): + self.run_sync() + self.assertEqual(self.catalog.read_bytes(), before) + self.assertFalse(self.state.exists()) + + +if __name__ == "__main__": + unittest.main() diff --git a/uv.lock b/uv.lock index b6ce3db..be99e4b 100644 --- a/uv.lock +++ b/uv.lock @@ -9,12 +9,14 @@ source = { virtual = "." } dependencies = [ { name = "jinja2" }, { name = "pyyaml" }, + { name = "ruamel-yaml" }, ] [package.metadata] requires-dist = [ { name = "jinja2", specifier = ">=3.1.6" }, { name = "pyyaml", specifier = ">=6.0.3" }, + { name = "ruamel-yaml", specifier = ">=0.18.10,<0.19" }, ] [package.metadata.requires-dev] @@ -140,3 +142,53 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/f0/7a/1c7270340330e575b92f397352af856a8c06f230aa3e76f86b39d01b416a/pyyaml-6.0.3-cp314-cp314t-win_amd64.whl", hash = "sha256:4ad1906908f2f5ae4e5a8ddfce73c320c2a1429ec52eafd27138b7f1cbe341c9", size = 174062, upload-time = "2025-09-25T21:32:55.767Z" }, { url = "https://files.pythonhosted.org/packages/f1/12/de94a39c2ef588c7e6455cfbe7343d3b2dc9d6b6b2f40c4c6565744c873d/pyyaml-6.0.3-cp314-cp314t-win_arm64.whl", hash = "sha256:ebc55a14a21cb14062aa4162f906cd962b28e2e9ea38f9b4391244cd8de4ae0b", size = 149341, upload-time = "2025-09-25T21:32:56.828Z" }, ] + +[[package]] +name = "ruamel-yaml" +version = "0.18.17" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "ruamel-yaml-clib", marker = "python_full_version < '3.15' and platform_python_implementation == 'CPython'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/3a/2b/7a1f1ebcd6b3f14febdc003e658778d81e76b40df2267904ee6b13f0c5c6/ruamel_yaml-0.18.17.tar.gz", hash = "sha256:9091cd6e2d93a3a4b157ddb8fabf348c3de7f1fb1381346d985b6b247dcd8d3c", size = 149602, upload-time = "2025-12-17T20:02:55.757Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/af/fe/b6045c782f1fd1ae317d2a6ca1884857ce5c20f59befe6ab25a8603c43a7/ruamel_yaml-0.18.17-py3-none-any.whl", hash = "sha256:9c8ba9eb3e793efdf924b60d521820869d5bf0cb9c6f1b82d82de8295e290b9d", size = 121594, upload-time = "2025-12-17T20:02:07.657Z" }, +] + +[[package]] +name = "ruamel-yaml-clib" +version = "0.2.15" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/ea/97/60fda20e2fb54b83a61ae14648b0817c8f5d84a3821e40bfbdae1437026a/ruamel_yaml_clib-0.2.15.tar.gz", hash = "sha256:46e4cc8c43ef6a94885f72512094e482114a8a706d3c555a34ed4b0d20200600", size = 225794, upload-time = "2025-11-16T16:12:59.761Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/72/4b/5fde11a0722d676e469d3d6f78c6a17591b9c7e0072ca359801c4bd17eee/ruamel_yaml_clib-0.2.15-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:cb15a2e2a90c8475df45c0949793af1ff413acfb0a716b8b94e488ea95ce7cff", size = 149088, upload-time = "2025-11-16T16:13:22.836Z" }, + { url = "https://files.pythonhosted.org/packages/85/82/4d08ac65ecf0ef3b046421985e66301a242804eb9a62c93ca3437dc94ee0/ruamel_yaml_clib-0.2.15-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:64da03cbe93c1e91af133f5bec37fd24d0d4ba2418eaf970d7166b0a26a148a2", size = 134553, upload-time = "2025-11-16T16:13:24.151Z" }, + { url = "https://files.pythonhosted.org/packages/b9/cb/22366d68b280e281a932403b76da7a988108287adff2bfa5ce881200107a/ruamel_yaml_clib-0.2.15-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:f6d3655e95a80325b84c4e14c080b2470fe4f33b6846f288379ce36154993fb1", size = 737468, upload-time = "2025-11-16T20:22:47.335Z" }, + { url = "https://files.pythonhosted.org/packages/71/73/81230babf8c9e33770d43ed9056f603f6f5f9665aea4177a2c30ae48e3f3/ruamel_yaml_clib-0.2.15-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:71845d377c7a47afc6592aacfea738cc8a7e876d586dfba814501d8c53c1ba60", size = 753349, upload-time = "2025-11-16T16:13:26.269Z" }, + { url = "https://files.pythonhosted.org/packages/61/62/150c841f24cda9e30f588ef396ed83f64cfdc13b92d2f925bb96df337ba9/ruamel_yaml_clib-0.2.15-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:11e5499db1ccbc7f4b41f0565e4f799d863ea720e01d3e99fa0b7b5fcd7802c9", size = 788211, upload-time = "2025-11-16T16:13:27.441Z" }, + { url = "https://files.pythonhosted.org/packages/30/93/e79bd9cbecc3267499d9ead919bd61f7ddf55d793fb5ef2b1d7d92444f35/ruamel_yaml_clib-0.2.15-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:4b293a37dc97e2b1e8a1aec62792d1e52027087c8eea4fc7b5abd2bdafdd6642", size = 743203, upload-time = "2025-11-16T16:13:28.671Z" }, + { url = "https://files.pythonhosted.org/packages/8d/06/1eb640065c3a27ce92d76157f8efddb184bd484ed2639b712396a20d6dce/ruamel_yaml_clib-0.2.15-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:512571ad41bba04eac7268fe33f7f4742210ca26a81fe0c75357fa682636c690", size = 747292, upload-time = "2025-11-16T20:22:48.584Z" }, + { url = "https://files.pythonhosted.org/packages/a5/21/ee353e882350beab65fcc47a91b6bdc512cace4358ee327af2962892ff16/ruamel_yaml_clib-0.2.15-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:e5e9f630c73a490b758bf14d859a39f375e6999aea5ddd2e2e9da89b9953486a", size = 771624, upload-time = "2025-11-16T16:13:29.853Z" }, + { url = "https://files.pythonhosted.org/packages/57/34/cc1b94057aa867c963ecf9ea92ac59198ec2ee3a8d22a126af0b4d4be712/ruamel_yaml_clib-0.2.15-cp312-cp312-win32.whl", hash = "sha256:f4421ab780c37210a07d138e56dd4b51f8642187cdfb433eb687fe8c11de0144", size = 100342, upload-time = "2025-11-16T16:13:31.067Z" }, + { url = "https://files.pythonhosted.org/packages/b3/e5/8925a4208f131b218f9a7e459c0d6fcac8324ae35da269cb437894576366/ruamel_yaml_clib-0.2.15-cp312-cp312-win_amd64.whl", hash = "sha256:2b216904750889133d9222b7b873c199d48ecbb12912aca78970f84a5aa1a4bc", size = 119013, upload-time = "2025-11-16T16:13:32.164Z" }, + { url = "https://files.pythonhosted.org/packages/17/5e/2f970ce4c573dc30c2f95825f2691c96d55560268ddc67603dc6ea2dd08e/ruamel_yaml_clib-0.2.15-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:4dcec721fddbb62e60c2801ba08c87010bd6b700054a09998c4d09c08147b8fb", size = 147450, upload-time = "2025-11-16T16:13:33.542Z" }, + { url = "https://files.pythonhosted.org/packages/d6/03/a1baa5b94f71383913f21b96172fb3a2eb5576a4637729adbf7cd9f797f8/ruamel_yaml_clib-0.2.15-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:65f48245279f9bb301d1276f9679b82e4c080a1ae25e679f682ac62446fac471", size = 133139, upload-time = "2025-11-16T16:13:34.587Z" }, + { url = "https://files.pythonhosted.org/packages/dc/19/40d676802390f85784235a05788fd28940923382e3f8b943d25febbb98b7/ruamel_yaml_clib-0.2.15-cp313-cp313-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:46895c17ead5e22bea5e576f1db7e41cb273e8d062c04a6a49013d9f60996c25", size = 731474, upload-time = "2025-11-16T20:22:49.934Z" }, + { url = "https://files.pythonhosted.org/packages/ce/bb/6ef5abfa43b48dd55c30d53e997f8f978722f02add61efba31380d73e42e/ruamel_yaml_clib-0.2.15-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:3eb199178b08956e5be6288ee0b05b2fb0b5c1f309725ad25d9c6ea7e27f962a", size = 748047, upload-time = "2025-11-16T16:13:35.633Z" }, + { url = "https://files.pythonhosted.org/packages/ff/5d/e4f84c9c448613e12bd62e90b23aa127ea4c46b697f3d760acc32cb94f25/ruamel_yaml_clib-0.2.15-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:4d1032919280ebc04a80e4fb1e93f7a738129857eaec9448310e638c8bccefcf", size = 782129, upload-time = "2025-11-16T16:13:36.781Z" }, + { url = "https://files.pythonhosted.org/packages/de/4b/e98086e88f76c00c88a6bcf15eae27a1454f661a9eb72b111e6bbb69024d/ruamel_yaml_clib-0.2.15-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:ab0df0648d86a7ecbd9c632e8f8d6b21bb21b5fc9d9e095c796cacf32a728d2d", size = 736848, upload-time = "2025-11-16T16:13:37.952Z" }, + { url = "https://files.pythonhosted.org/packages/0c/5c/5964fcd1fd9acc53b7a3a5d9a05ea4f95ead9495d980003a557deb9769c7/ruamel_yaml_clib-0.2.15-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:331fb180858dd8534f0e61aa243b944f25e73a4dae9962bd44c46d1761126bbf", size = 741630, upload-time = "2025-11-16T20:22:51.718Z" }, + { url = "https://files.pythonhosted.org/packages/07/1e/99660f5a30fceb58494598e7d15df883a07292346ef5696f0c0ae5dee8c6/ruamel_yaml_clib-0.2.15-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:fd4c928ddf6bce586285daa6d90680b9c291cfd045fc40aad34e445d57b1bf51", size = 766619, upload-time = "2025-11-16T16:13:39.178Z" }, + { url = "https://files.pythonhosted.org/packages/36/2f/fa0344a9327b58b54970e56a27b32416ffbcfe4dcc0700605516708579b2/ruamel_yaml_clib-0.2.15-cp313-cp313-win32.whl", hash = "sha256:bf0846d629e160223805db9fe8cc7aec16aaa11a07310c50c8c7164efa440aec", size = 100171, upload-time = "2025-11-16T16:13:40.456Z" }, + { url = "https://files.pythonhosted.org/packages/06/c4/c124fbcef0684fcf3c9b72374c2a8c35c94464d8694c50f37eef27f5a145/ruamel_yaml_clib-0.2.15-cp313-cp313-win_amd64.whl", hash = "sha256:45702dfbea1420ba3450bb3dd9a80b33f0badd57539c6aac09f42584303e0db6", size = 118845, upload-time = "2025-11-16T16:13:41.481Z" }, + { url = "https://files.pythonhosted.org/packages/3e/bd/ab8459c8bb759c14a146990bf07f632c1cbec0910d4853feeee4be2ab8bb/ruamel_yaml_clib-0.2.15-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:753faf20b3a5906faf1fc50e4ddb8c074cb9b251e00b14c18b28492f933ac8ef", size = 147248, upload-time = "2025-11-16T16:13:42.872Z" }, + { url = "https://files.pythonhosted.org/packages/69/f2/c4cec0a30f1955510fde498aac451d2e52b24afdbcb00204d3a951b772c3/ruamel_yaml_clib-0.2.15-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:480894aee0b29752560a9de46c0e5f84a82602f2bc5c6cde8db9a345319acfdf", size = 133764, upload-time = "2025-11-16T16:13:43.932Z" }, + { url = "https://files.pythonhosted.org/packages/82/c7/2480d062281385a2ea4f7cc9476712446e0c548cd74090bff92b4b49e898/ruamel_yaml_clib-0.2.15-cp314-cp314-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:4d3b58ab2454b4747442ac76fab66739c72b1e2bb9bd173d7694b9f9dbc9c000", size = 730537, upload-time = "2025-11-16T20:22:52.918Z" }, + { url = "https://files.pythonhosted.org/packages/75/08/e365ee305367559f57ba6179d836ecc3d31c7d3fdff2a40ebf6c32823a1f/ruamel_yaml_clib-0.2.15-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:bfd309b316228acecfa30670c3887dcedf9b7a44ea39e2101e75d2654522acd4", size = 746944, upload-time = "2025-11-16T16:13:45.338Z" }, + { url = "https://files.pythonhosted.org/packages/a1/5c/8b56b08db91e569d0a4fbfa3e492ed2026081bdd7e892f63ba1c88a2f548/ruamel_yaml_clib-0.2.15-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:2812ff359ec1f30129b62372e5f22a52936fac13d5d21e70373dbca5d64bb97c", size = 778249, upload-time = "2025-11-16T16:13:46.871Z" }, + { url = "https://files.pythonhosted.org/packages/6a/1d/70dbda370bd0e1a92942754c873bd28f513da6198127d1736fa98bb2a16f/ruamel_yaml_clib-0.2.15-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:7e74ea87307303ba91073b63e67f2c667e93f05a8c63079ee5b7a5c8d0d7b043", size = 737140, upload-time = "2025-11-16T16:13:48.349Z" }, + { url = "https://files.pythonhosted.org/packages/5b/87/822d95874216922e1120afb9d3fafa795a18fdd0c444f5c4c382f6dac761/ruamel_yaml_clib-0.2.15-cp314-cp314-musllinux_1_2_i686.whl", hash = "sha256:713cd68af9dfbe0bb588e144a61aad8dcc00ef92a82d2e87183ca662d242f524", size = 741070, upload-time = "2025-11-16T20:22:54.151Z" }, + { url = "https://files.pythonhosted.org/packages/b9/17/4e01a602693b572149f92c983c1f25bd608df02c3f5cf50fd1f94e124a59/ruamel_yaml_clib-0.2.15-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:542d77b72786a35563f97069b9379ce762944e67055bea293480f7734b2c7e5e", size = 765882, upload-time = "2025-11-16T16:13:49.526Z" }, + { url = "https://files.pythonhosted.org/packages/9f/17/7999399081d39ebb79e807314de6b611e1d1374458924eb2a489c01fc5ad/ruamel_yaml_clib-0.2.15-cp314-cp314-win32.whl", hash = "sha256:424ead8cef3939d690c4b5c85ef5b52155a231ff8b252961b6516ed7cf05f6aa", size = 102567, upload-time = "2025-11-16T16:13:50.78Z" }, + { url = "https://files.pythonhosted.org/packages/d2/67/be582a7370fdc9e6846c5be4888a530dcadd055eef5b932e0e85c33c7d73/ruamel_yaml_clib-0.2.15-cp314-cp314-win_amd64.whl", hash = "sha256:ac9b8d5fa4bb7fd2917ab5027f60d4234345fd366fe39aa711d5dca090aa1467", size = 122847, upload-time = "2025-11-16T16:13:51.807Z" }, +] From 662a5c46ecad9feb7c120e429992324ebdfd9b3f Mon Sep 17 00:00:00 2001 From: Chojan Shang Date: Tue, 20 Oct 2026 02:24:24 +0800 Subject: [PATCH 2/5] fix(ci): reuse standard Landing publishing credentials --- .github/workflows/sync-bub-contrib.yml | 7 +++++-- README.md | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/sync-bub-contrib.yml b/.github/workflows/sync-bub-contrib.yml index 944b234..d5b10a7 100644 --- a/.github/workflows/sync-bub-contrib.yml +++ b/.github/workflows/sync-bub-contrib.yml @@ -21,12 +21,14 @@ concurrency: jobs: sync: runs-on: ubuntu-latest + env: + GH_TOKEN: ${{ secrets.LANDING_GITHUB_TOKEN || github.token }} steps: - uses: actions/checkout@v4 + with: + token: ${{ env.GH_TOKEN }} - name: Check for pending sync id: pending - env: - GH_TOKEN: ${{ github.token }} run: | count=$(gh pr list --repo "$GITHUB_REPOSITORY" --state open --head catalog/bub-contrib --json number --jq length) echo "count=$count" >> "$GITHUB_OUTPUT" @@ -57,6 +59,7 @@ jobs: (github.event_name == 'schedule' || inputs.publish) uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8 with: + token: ${{ env.GH_TOKEN }} branch: catalog/bub-contrib base: main draft: always-true diff --git a/README.md b/README.md index 4dcec13..a01f2f0 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,7 @@ Build validates required fields, `kind` enum, and rejects unknown fields. The sync deduplicates package names (including case, hyphen, underscore, and dot variants) and contrib source paths across groups. It records only newly imported entries in `.github/bub-contrib-sync.json`. Later runs update fields that still match their last generated values; manual overrides and deleted entries stay untouched. Missing upstream packages remain in the catalog for manual retirement. Keep the state file when editing or moving generated entries. -Changed data passes sync tests and the site build before the workflow opens a draft PR on `catalog/bub-contrib`. An open sync PR pauses further updates so reviewer edits survive. Unchanged runs create no commit, PR, or comment. Maintainers merge updates manually. The repository must allow GitHub Actions to create pull requests in **Settings > Actions > General > Workflow permissions**; the workflow uses `GITHUB_TOKEN` with contents and pull request write permissions and requires no model secrets. Token-created PRs do not trigger ordinary PR workflows, so the sync runs validation before publication. Schedules become active after this workflow reaches the default branch. +Changed data passes sync tests and the site build before the workflow opens a draft PR on `catalog/bub-contrib`. An open sync PR pauses further updates so reviewer edits survive. Unchanged runs create no commit, PR, or comment. Maintainers merge updates manually. The repository must allow GitHub Actions to create pull requests in **Settings > Actions > General > Workflow permissions**; the workflow uses `LANDING_GITHUB_TOKEN` when configured, otherwise `github.token`, with contents and pull request write permissions. This matches Landing and Republic publishing conventions. PRs created with `github.token` do not trigger ordinary PR workflows, so the sync runs validation before publication. Schedules become active after this workflow reaches the default branch. To reproduce locally with a separate contrib checkout: @@ -91,3 +91,5 @@ uv run --frozen python build.py ``` For a workflow dry run, manually dispatch **Sync Bub contrib** with `publish` disabled. Publication also requires running on `main`. + +The deterministic sync requires no model or admission credentials. If a Landing runtime is added, reuse secret `LANDING_API_KEY` and variables `LANDING_MODEL`, `LANDING_API_BASE`, and `LANDING_COMPLETION_ARGS`, plus optional secret `LANDING_ADMISSION_TOKEN` for separate admission credentials. Keep these names consistent with Landing and Republic; GitHub secret metadata cannot supply secret values for copying between repositories. From d34767d41431542e8e802395a8bfcc64bc46d691 Mon Sep 17 00:00:00 2001 From: Chojan Shang Date: Tue, 20 Oct 2026 02:32:52 +0800 Subject: [PATCH 3/5] refactor(catalog): simplify sync and use project SVG logos --- .github/bub-contrib-sync.json | 74 ------ .github/workflows/sync-bub-contrib.yml | 48 +--- README.md | 21 +- data.yml | 103 +++++---- logos/docker.svg | 26 +++ logos/opentelemetry.svg | 2 + pyproject.toml | 1 - scripts/sync_bub_contrib.py | 298 +++++++++---------------- tests/test_sync_bub_contrib.py | 235 ++++++------------- uv.lock | 52 ----- 10 files changed, 280 insertions(+), 580 deletions(-) delete mode 100644 .github/bub-contrib-sync.json create mode 100644 logos/docker.svg create mode 100644 logos/opentelemetry.svg diff --git a/.github/bub-contrib-sync.json b/.github/bub-contrib-sync.json deleted file mode 100644 index b47b7df..0000000 --- a/.github/bub-contrib-sync.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "bub-agent-plugins": { - "author": "Bub contributors", - "builtin": false, - "description": "Load portable Agent Plugins into Bub", - "homepage_url": "https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-agent-plugins", - "install": "bub install bub-agent-plugins@main", - "kind": "plugin", - "logo": "/plugin.svg", - "name": "bub-agent-plugins", - "repo_url": "https://github.com/bubbuild/bub-contrib", - "source_path": "packages/bub-agent-plugins" - }, - "bub-docker-env": { - "author": "wzhongyun", - "builtin": false, - "description": "Run Bub sessions' bash, fs and code-mode tools in Docker containers", - "homepage_url": "https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-docker-env", - "install": "bub install bub-docker-env@main", - "kind": "plugin", - "logo": "/plugin.svg", - "name": "bub-docker-env", - "repo_url": "https://github.com/bubbuild/bub-contrib", - "source_path": "packages/bub-docker-env" - }, - "bub-env": { - "author": "wzhongyun", - "builtin": false, - "description": "Inject environment variables from the Bub config file at startup", - "homepage_url": "https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-env", - "install": "bub install bub-env@main", - "kind": "plugin", - "logo": "/plugin.svg", - "name": "bub-env", - "repo_url": "https://github.com/bubbuild/bub-contrib", - "source_path": "packages/bub-env" - }, - "bub-monty-env": { - "author": "Frost Ming", - "builtin": false, - "description": "Run Bub's code-mode run_code in Monty, a sandboxed Python interpreter, on top of any Bub environment", - "homepage_url": "https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-monty-env", - "install": "bub install bub-monty-env@main", - "kind": "plugin", - "logo": "/plugin.svg", - "name": "bub-monty-env", - "repo_url": "https://github.com/bubbuild/bub-contrib", - "source_path": "packages/bub-monty-env" - }, - "bub-sandbox-env": { - "author": "Frost Ming", - "builtin": false, - "description": "Run Bub sessions' bash, fs and code-mode tools in a lightweight local sandbox (macOS Seatbelt, Linux bubblewrap)", - "homepage_url": "https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-sandbox-env", - "install": "bub install bub-sandbox-env@main", - "kind": "plugin", - "logo": "/plugin.svg", - "name": "bub-sandbox-env", - "repo_url": "https://github.com/bubbuild/bub-contrib", - "source_path": "packages/bub-sandbox-env" - }, - "bub-tapestore-otel": { - "author": "Chojan Shang", - "builtin": false, - "description": "OpenTelemetry projection layer for Bub tape stores", - "homepage_url": "https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-tapestore-otel", - "install": "bub install bub-tapestore-otel@main", - "kind": "plugin", - "logo": "/plugin.svg", - "name": "bub-tapestore-otel", - "repo_url": "https://github.com/bubbuild/bub-contrib", - "source_path": "packages/bub-tapestore-otel" - } -} diff --git a/.github/workflows/sync-bub-contrib.yml b/.github/workflows/sync-bub-contrib.yml index d5b10a7..0e6e24e 100644 --- a/.github/workflows/sync-bub-contrib.yml +++ b/.github/workflows/sync-bub-contrib.yml @@ -1,23 +1,19 @@ name: Sync Bub contrib - on: schedule: - cron: '41 3 * * 1' workflow_dispatch: inputs: publish: - description: Open a draft PR (default branch only) + description: Open a draft PR (main only) type: boolean default: true - permissions: contents: write pull-requests: write - concurrency: group: sync-bub-contrib cancel-in-progress: false - jobs: sync: runs-on: ubuntu-latest @@ -27,48 +23,26 @@ jobs: - uses: actions/checkout@v4 with: token: ${{ env.GH_TOKEN }} - - name: Check for pending sync - id: pending - run: | - count=$(gh pr list --repo "$GITHUB_REPOSITORY" --state open --head catalog/bub-contrib --json number --jq length) - echo "count=$count" >> "$GITHUB_OUTPUT" - - uses: actions/checkout@v4 - if: steps.pending.outputs.count == '0' - with: - repository: bubbuild/bub-contrib - ref: main - path: .sync-source - persist-credentials: false - uses: astral-sh/setup-uv@v6 - if: steps.pending.outputs.count == '0' - name: Sync and validate - if: steps.pending.outputs.count == '0' id: sync run: | - echo "source=$(git -C .sync-source rev-parse HEAD)" >> "$GITHUB_OUTPUT" - uv sync --frozen + if [ "$(gh pr list --repo "$GITHUB_REPOSITORY" --state open --head catalog/bub-contrib --json number --jq length)" != 0 ]; then exit 0; fi + git clone --depth 1 --branch main https://github.com/bubbuild/bub-contrib.git "$RUNNER_TEMP/contrib" + echo "source=$(git -C "$RUNNER_TEMP/contrib" rev-parse HEAD)" >> "$GITHUB_OUTPUT" + uv run --frozen python scripts/sync_bub_contrib.py "$RUNNER_TEMP/contrib" + if git diff --quiet -- data.yml; then exit 0; fi uv run --frozen python -m unittest discover -s tests - uv run --frozen python scripts/sync_bub_contrib.py .sync-source uv run --frozen python build.py - if ! git diff --quiet -- data.yml .github/bub-contrib-sync.json; then - echo 'changed=true' >> "$GITHUB_OUTPUT" - fi - - name: Open draft catalog update - if: >- - steps.sync.outputs.changed == 'true' && github.ref == 'refs/heads/main' && - (github.event_name == 'schedule' || inputs.publish) - uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8 + echo 'changed=true' >> "$GITHUB_OUTPUT" + - uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8 + if: steps.sync.outputs.changed == 'true' && github.ref == 'refs/heads/main' && (github.event_name == 'schedule' || inputs.publish) with: token: ${{ env.GH_TOKEN }} branch: catalog/bub-contrib base: main draft: always-true - add-paths: | - data.yml - .github/bub-contrib-sync.json + add-paths: data.yml commit-message: 'chore(catalog): sync Bub contrib plugins' title: 'chore(catalog): sync Bub contrib plugins' - body: | - Sync plugin metadata from bubbuild/bub-contrib@${{ steps.sync.outputs.source }} using `scripts/sync_bub_contrib.py`. - - Validation: sync behavior tests and site build pass. Existing curated entries and manual field overrides remain authoritative. Maintainers review and merge this draft. + body: 'Update catalog metadata from bubbuild/bub-contrib@${{ steps.sync.outputs.source }}. Validation: sync tests and site build pass.' diff --git a/README.md b/README.md index a01f2f0..1a55a63 100644 --- a/README.md +++ b/README.md @@ -73,23 +73,4 @@ categories: Build validates required fields, `kind` enum, and rejects unknown fields. -## Bub contrib updates - -[Sync Bub contrib](.github/workflows/sync-bub-contrib.yml) reads `packages/*/pyproject.toml` from `bubbuild/bub-contrib` main each Monday at 03:41 UTC, or on manual dispatch. It imports packages declaring a `bub` entry point into the existing Plugins groups. It reads metadata without executing upstream code. Package descriptions, authors, SPDX license strings, source links, and `bub install NAME@main` commands supply new entries; missing descriptions get a package-name fallback. New entries use the existing `logos/plugin.svg` until a maintainer selects a project logo. Skills, third-party entries, existing logos, and existing curated package entries stay under manual maintenance. - -The sync deduplicates package names (including case, hyphen, underscore, and dot variants) and contrib source paths across groups. It records only newly imported entries in `.github/bub-contrib-sync.json`. Later runs update fields that still match their last generated values; manual overrides and deleted entries stay untouched. Missing upstream packages remain in the catalog for manual retirement. Keep the state file when editing or moving generated entries. - -Changed data passes sync tests and the site build before the workflow opens a draft PR on `catalog/bub-contrib`. An open sync PR pauses further updates so reviewer edits survive. Unchanged runs create no commit, PR, or comment. Maintainers merge updates manually. The repository must allow GitHub Actions to create pull requests in **Settings > Actions > General > Workflow permissions**; the workflow uses `LANDING_GITHUB_TOKEN` when configured, otherwise `github.token`, with contents and pull request write permissions. This matches Landing and Republic publishing conventions. PRs created with `github.token` do not trigger ordinary PR workflows, so the sync runs validation before publication. Schedules become active after this workflow reaches the default branch. - -To reproduce locally with a separate contrib checkout: - -```bash -uv sync --frozen -uv run --frozen python scripts/sync_bub_contrib.py ../bub-contrib -uv run --frozen python -m unittest discover -s tests -uv run --frozen python build.py -``` - -For a workflow dry run, manually dispatch **Sync Bub contrib** with `publish` disabled. Publication also requires running on `main`. - -The deterministic sync requires no model or admission credentials. If a Landing runtime is added, reuse secret `LANDING_API_KEY` and variables `LANDING_MODEL`, `LANDING_API_BASE`, and `LANDING_COMPLETION_ARGS`, plus optional secret `LANDING_ADMISSION_TOKEN` for separate admission credentials. Keep these names consistent with Landing and Republic; GitHub secret metadata cannot supply secret values for copying between repositories. +The catalog checks bub-contrib every Monday at 03:41 UTC and proposes metadata updates and new plugins in draft PRs. Existing presentation choices stay curated; unchanged runs stay quiet, and an open sync PR pauses further updates. GitHub Actions must be allowed to create PRs. diff --git a/data.yml b/data.yml index 2169fbb..abdc43e 100644 --- a/data.yml +++ b/data.yml @@ -4,7 +4,7 @@ categories: - name: Channels items: - name: bub-discord - description: Discord channel adapter for Bub message IO. + description: Discord channel for Bub kind: plugin logo: /discord.svg homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-discord @@ -12,8 +12,9 @@ categories: install: bub install bub-discord builtin: false source_path: packages/bub-discord + author: Frost Ming - name: bub-dingtalk - description: DingTalk Stream Mode channel adapter for Bub message IO. + description: DingTalk channel for Bub kind: plugin logo: /dingtalk-site.png homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-dingtalk @@ -21,8 +22,9 @@ categories: install: bub install bub-dingtalk@main builtin: false source_path: packages/bub-dingtalk + author: Chojan Shang - name: bub-feishu - description: Feishu channel adapter for Bub message IO. + description: Feishu channel for Bub kind: plugin logo: /lark-suite.png homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-feishu @@ -30,8 +32,9 @@ categories: install: bub install bub-feishu builtin: false source_path: packages/bub-feishu + author: Kyle Liu - name: bub-qq - description: QQ Open Platform channel adapter for Bub. + description: QQ Open Platform channel for Bub kind: plugin logo: /qq.svg homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-qq @@ -39,8 +42,9 @@ categories: install: bub install bub-qq@main builtin: false source_path: packages/bub-qq + author: wzhongyun - name: bub-wechat - description: WeChat channel adapter for Bub message IO. + description: Wechat Agent channel for Bub kind: plugin logo: /wechat.svg homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-wechat @@ -48,8 +52,9 @@ categories: install: bub install bub-wechat@main builtin: false source_path: packages/bub-wechat + author: Frost Ming - name: bub-wecom - description: WeCom channel adapter for Bub message IO. + description: WeCom channel for Bub kind: plugin logo: /wecom.png homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-wecom @@ -57,6 +62,7 @@ categories: install: bub install bub-wecom@main builtin: false source_path: packages/bub-wecom + author: Ruter - name: bub-xiaoai description: Xiaomi XiaoAi speaker channel plugin with message polling and device TTS replies. @@ -76,7 +82,7 @@ categories: install: bub install bubbuild/bub-folotoy builtin: false - name: bub-mcp-server - description: Expose Bub as an MCP server + description: Expose Bub as an SSE MCP server kind: plugin logo: /mcp.svg homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-mcp-server @@ -84,9 +90,9 @@ categories: install: bub install bub-mcp-server builtin: false source_path: packages/bub-mcp-server + author: Frost Ming - name: bub-acp-server - description: Expose Bub as an Agent Client Protocol agent for ACP-compatible - editors. + description: Expose Bub as an ACP agent kind: plugin logo: /acp.svg homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-acp-server @@ -94,6 +100,7 @@ categories: install: bub install bub-acp-server builtin: false source_path: packages/bub-acp-server + author: Frost Ming - name: bub-slack description: Slack channel for Bub kind: plugin @@ -125,9 +132,9 @@ categories: install: bub install bub-codex@main builtin: false source_path: packages/bub-codex + author: Frost Ming - name: bub-cursor - description: Cursor CLI-backed run_model plugin with login and session resume - support. + description: Cursor-backed run_model plugin for Bub kind: plugin logo: /cursor.svg homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-cursor @@ -135,9 +142,9 @@ categories: install: bub install bub-cursor@main builtin: false source_path: packages/bub-cursor + author: tssujt - name: bub-extism - description: Extism WebAssembly bridge plugin for running Bub hooks from wasm - modules. + description: Extism WebAssembly bridge plugin for Bub kind: plugin logo: /extism.svg homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-extism @@ -145,9 +152,9 @@ categories: install: bub install bub-extism@main builtin: false source_path: packages/bub-extism + author: Bub Build contributors - name: bub-github-copilot - description: GitHub Copilot SDK-backed run_model plugin plus GitHub device-flow - login support. + description: GitHub Copilot SDK-backed run_model plugin for Bub kind: plugin logo: /github-copilot.svg homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-github-copilot @@ -155,8 +162,9 @@ categories: install: bub install bub-github-copilot@main builtin: false source_path: packages/bub-github-copilot + author: PsiACE - name: bub-kimi - description: Kimi CLI-backed run_model plugin with session resume support. + description: Kimi CLI model plugin for bub kind: plugin logo: /kimi.svg homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-kimi @@ -164,9 +172,9 @@ categories: install: bub install bub-kimi@main builtin: false source_path: packages/bub-kimi + author: Mengxin Liu - name: bub-session-prompt - description: Session-specific system prompt plugin sourced from local Bub - session state. + description: Bub plugin to support session-specific system prompt kind: plugin logo: /bub-light.png homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-session-prompt @@ -174,8 +182,9 @@ categories: install: bub install bub-session-prompt@main builtin: false source_path: packages/bub-session-prompt + author: Frost Ming - name: bub-context-budget - description: Proactive context-budget guard for Bub's builtin agent loop. + description: Proactive context-budget guard for Bub LLM calls kind: plugin logo: /context.png homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-context-budget @@ -186,7 +195,7 @@ categories: builtin: false source_path: packages/bub-context-budget - name: bub-dsh - description: DeepSeek Harness runner for Bub + description: DeepSeek Harness SDK-backed streaming model plugin for Bub kind: plugin logo: /dsh.svg homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-dsh @@ -197,60 +206,61 @@ categories: builtin: false source_path: packages/bub-dsh - name: bub-agent-plugins - description: Load portable Agent Plugins into Bub kind: plugin logo: /plugin.svg homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-agent-plugins repo_url: https://github.com/bubbuild/bub-contrib + source_path: packages/bub-agent-plugins install: bub install bub-agent-plugins@main builtin: false - source_path: packages/bub-agent-plugins + description: Load portable Agent Plugins into Bub author: Bub contributors - name: bub-docker-env - description: Run Bub sessions' bash, fs and code-mode tools in Docker containers kind: plugin - logo: /plugin.svg + logo: /docker.svg homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-docker-env repo_url: https://github.com/bubbuild/bub-contrib + source_path: packages/bub-docker-env install: bub install bub-docker-env@main builtin: false - source_path: packages/bub-docker-env + description: Run Bub sessions' bash, fs and code-mode tools in Docker containers author: wzhongyun - name: bub-env - description: Inject environment variables from the Bub config file at startup kind: plugin logo: /plugin.svg homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-env repo_url: https://github.com/bubbuild/bub-contrib + source_path: packages/bub-env install: bub install bub-env@main builtin: false - source_path: packages/bub-env + description: Inject environment variables from the Bub config file at startup author: wzhongyun - name: bub-monty-env - description: Run Bub's code-mode run_code in Monty, a sandboxed Python interpreter, on top of any Bub environment kind: plugin logo: /plugin.svg homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-monty-env repo_url: https://github.com/bubbuild/bub-contrib + source_path: packages/bub-monty-env install: bub install bub-monty-env@main builtin: false - source_path: packages/bub-monty-env + description: Run Bub's code-mode run_code in Monty, a sandboxed Python interpreter, + on top of any Bub environment author: Frost Ming - name: bub-sandbox-env - description: Run Bub sessions' bash, fs and code-mode tools in a lightweight local sandbox (macOS Seatbelt, Linux bubblewrap) kind: plugin logo: /plugin.svg homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-sandbox-env repo_url: https://github.com/bubbuild/bub-contrib + source_path: packages/bub-sandbox-env install: bub install bub-sandbox-env@main builtin: false - source_path: packages/bub-sandbox-env + description: Run Bub sessions' bash, fs and code-mode tools in a lightweight local + sandbox (macOS Seatbelt, Linux bubblewrap) author: Frost Ming - name: Tools items: - name: bub-mcp - description: Exposes configured MCP servers as Bub tools, with `bub mcp` - commands to list, add, and remove server configs. + description: Expose configured MCP servers as Bub tools kind: plugin logo: /mcp.svg homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-mcp @@ -258,8 +268,9 @@ categories: install: bub install bub-mcp builtin: false source_path: packages/bub-mcp + author: Frost Ming - name: bub-schedule - description: Scheduling channel and tools backed by APScheduler. + description: Scheduling tools for Bub kind: plugin logo: /calendar.svg homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-schedule @@ -267,8 +278,9 @@ categories: install: bub install bub-schedule builtin: false source_path: packages/bub-schedule + author: Frost Ming - name: bub-web-search - description: Web search tool package for Bub. + description: Web search tools for Bub kind: plugin logo: /search.svg homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-web-search @@ -276,11 +288,12 @@ categories: install: bub install bub-web-search builtin: false source_path: packages/bub-web-search + author: Frost Ming - name: Storage & Memory items: - name: tape-dataset-opendal - description: Exports Bub and Republic tapes to backend-agnostic dataset - artifacts through OpenDAL. + description: Backend-agnostic tape dataset export over the standard Bub tape store + interface kind: plugin logo: /bub-light.png homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/tape-dataset-opendal @@ -288,8 +301,9 @@ categories: install: bub install tape-dataset-opendal@main builtin: false source_path: packages/tape-dataset-opendal + author: Chojan Shang - name: bub-tapestore-redis - description: Redis-backed tape store plugin for Bub conversation history. + description: Redis tape store plugin for Bub kind: plugin logo: /redis.svg homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-tapestore-redis @@ -297,8 +311,9 @@ categories: install: bub install bub-tapestore-redis@main builtin: false source_path: packages/bub-tapestore-redis + author: Johnson Lee - name: bub-tapestore-sqlalchemy - description: SQLAlchemy-backed tape store plugin for Bub conversation history. + description: SQLAlchemy tape store plugin for Bub kind: plugin logo: /sqlalchemy.svg homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-tapestore-sqlalchemy @@ -306,8 +321,9 @@ categories: install: bub install bub-tapestore-sqlalchemy@main builtin: false source_path: packages/bub-tapestore-sqlalchemy + author: Chojan Shang - name: bub-tapestore-sqlite - description: SQLite-backed tape store plugin for Bub conversation history. + description: SQLite tape store plugin for Bub kind: plugin logo: /sqlite.svg homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-tapestore-sqlite @@ -315,6 +331,7 @@ categories: install: bub install bub-tapestore-sqlite@main builtin: false source_path: packages/bub-tapestore-sqlite + author: Chojan Shang - name: nowledge-mem-bub description: Bring your cross-tool knowledge into Bub, and share what you learn in Bub with every other tool. @@ -336,14 +353,14 @@ categories: install: bub install bub-semantic-memory builtin: false - name: bub-tapestore-otel - description: OpenTelemetry projection layer for Bub tape stores kind: plugin - logo: /plugin.svg + logo: /opentelemetry.svg homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-tapestore-otel repo_url: https://github.com/bubbuild/bub-contrib + source_path: packages/bub-tapestore-otel install: bub install bub-tapestore-otel@main builtin: false - source_path: packages/bub-tapestore-otel + description: OpenTelemetry projection layer for Bub tape stores author: Chojan Shang - name: Skills subcategories: diff --git a/logos/docker.svg b/logos/docker.svg new file mode 100644 index 0000000..d27a4aa --- /dev/null +++ b/logos/docker.svg @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/logos/opentelemetry.svg b/logos/opentelemetry.svg new file mode 100644 index 0000000..d423d7f --- /dev/null +++ b/logos/opentelemetry.svg @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index f6ded41..1af0cfd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,6 @@ requires-python = ">=3.12" dependencies = [ "jinja2>=3.1.6", "pyyaml>=6.0.3", - "ruamel-yaml>=0.18.10,<0.19", ] [dependency-groups] diff --git a/scripts/sync_bub_contrib.py b/scripts/sync_bub_contrib.py index 1738cca..f0bd9b7 100644 --- a/scripts/sync_bub_contrib.py +++ b/scripts/sync_bub_contrib.py @@ -1,215 +1,135 @@ -"""Import Bub contrib plugins while preserving curated catalog fields.""" +"""Sync contrib metadata; preserve catalog placement, links, logos, and install choices.""" import argparse -import copy -import io -import json import re import tomllib from pathlib import Path -import yaml as pyyaml -from ruamel.yaml import YAML - -REPOSITORY = "https://github.com/bubbuild/bub-contrib" - - -def package_name(value): - return re.sub(r"[-_.]+", "-", value).lower() - - -def source_items(source): - """Read metadata only; never import or install upstream packages.""" - items = {} +import yaml + +REPO = "https://github.com/bubbuild/bub-contrib" +LOGOS = {"bub-docker-env": "/docker.svg", "bub-tapestore-otel": "/opentelemetry.svg"} +GROUPS = { + "Channels": { + "bub-discord", + "bub-dingtalk", + "bub-feishu", + "bub-qq", + "bub-wechat", + "bub-wecom", + "bub-slack", + "bub-acp-server", + "bub-mcp-server", + }, + "Tools": {"bub-mcp", "bub-schedule", "bub-web-search"}, +} +OVERRIDES = {} # Package name -> explicitly curated field values, applied after source metadata. + + +class CatalogDumper(yaml.SafeDumper): + def increase_indent(self, flow=False, indentless=False): + return super().increase_indent(flow, False) + + +def normalized(name): + return re.sub(r"[-_.]+", "-", name).lower() + + +def sync(source, catalog): + original = catalog.read_text(encoding="utf-8") + data = yaml.safe_load(original) + groups = next(c for c in data["categories"] if c["name"] == "Plugins")[ + "subcategories" + ] + existing = [ + item + for c in data["categories"] + for g in c["subcategories"] + for item in g["items"] + if item["kind"] == "plugin" + ] + changed = False for manifest in sorted((source / "packages").glob("*/pyproject.toml")): project = tomllib.loads(manifest.read_text(encoding="utf-8"))["project"] if not project.get("entry-points", {}).get("bub"): continue - name = project["name"] - key = package_name(name) - if key in items: - raise ValueError(f"Duplicate source package: {name}") - description = project.get("description", "").strip() - if not description or description == "Add your description here": - description = f"Bub plugin: {name}." - path = manifest.parent.relative_to(source).as_posix() - item = { - "name": name, - "description": " ".join(description.split()), - "kind": "plugin", - "logo": "/plugin.svg", - "homepage_url": f"{REPOSITORY}/tree/main/{path}", - "repo_url": REPOSITORY, - "install": f"bub install {name}@main", - "builtin": False, - "source_path": path, - } - authors = [ - author["name"] - for author in project.get("authors", []) - if author.get("name") - ] - if authors: - item["author"] = ", ".join(authors) - license_name = project.get("license") - if isinstance(license_name, str): - item["license"] = license_name - items[key] = item - if not items: - raise ValueError("Source contains no Bub plugin packages") - return items - - -def write_catalog(catalog, before, after, yaml): - """Rewrite changed items only, retaining surrounding curated YAML verbatim.""" - text = catalog.read_text(encoding="utf-8") - lines = text.splitlines(keepends=True) - root = pyyaml.compose(text) - categories_node = next( - value for key, value in root.value if key.value == "categories" - ) - edits = [] - for old_category, category, category_node in zip( - before["categories"], after["categories"], categories_node.value - ): - groups_node = next( - value for key, value in category_node.value if key.value == "subcategories" - ) - for old_group, group, group_node in zip( - old_category["subcategories"], category["subcategories"], groups_node.value - ): - items_node = next( - value for key, value in group_node.value if key.value == "items" + name, path = project["name"], manifest.parent.relative_to(source).as_posix() + key = normalized(name) + matches = [ + item + for item in existing + if normalized(item["name"]) == key + or ( + item.get("repo_url", "").rstrip("/").removesuffix(".git").lower() + == REPO.lower() + and item.get("source_path") == path ) - old_items = old_group.get("items", []) - items = group.get("items", []) - for index, (old_item, item) in enumerate(zip(old_items, items)): - if old_item != item: - start = items_node.value[index].start_mark.line - end = ( - items_node.value[index + 1].start_mark.line - if index + 1 < len(old_items) - else items_node.end_mark.line - ) - output = io.StringIO() - yaml.dump([item], output) - edits.append((start, end, output.getvalue())) - if len(items) > len(old_items): - output = io.StringIO() - yaml.dump(items[len(old_items) :], output) - if not old_items: - edits.append( - ( - items_node.start_mark.line, - items_node.end_mark.line + 1, - "items:\n" + output.getvalue(), - ) - ) - else: - edits.append( - ( - items_node.end_mark.line, - items_node.end_mark.line, - output.getvalue(), - ) - ) - for start, end, replacement in sorted(edits, reverse=True): - lines[start:end] = [ - " " + line for line in replacement.splitlines(keepends=True) ] - catalog.write_text("".join(lines), encoding="utf-8") - - -def sync(source, catalog, state_path): - upstream = source_items(source) - yaml = YAML() - yaml.preserve_quotes = True - yaml.width = 1000 - yaml.indent(mapping=2, sequence=4, offset=2) - data = yaml.load(catalog.read_text(encoding="utf-8")) - state = ( - json.loads(state_path.read_text(encoding="utf-8")) - if state_path.exists() - else {} - ) - previous_data = copy.deepcopy(data) - previous_state = copy.deepcopy(state) - categories = data["categories"] - plugins = next(category for category in categories if category["name"] == "Plugins") - by_name = {} - by_path = {} - for category in categories: - for group in category.get("subcategories", []): - for item in group.get("items", []): - if item.get("kind") != "plugin": - continue - by_name.setdefault(package_name(item["name"]), []).append(item) - repository = ( - item.get("repo_url", "").rstrip("/").removesuffix(".git").lower() - ) - if repository == REPOSITORY.lower(): - by_path.setdefault(item.get("source_path"), []).append(item) - - for key, generated in upstream.items(): - matches = by_name.get(key, []).copy() - for item in by_path.get(generated["source_path"], []): - if all(item is not match for match in matches): - matches.append(item) + if len(matches) > 1: + continue if matches: - # Never choose between existing duplicates or claim curated data. - if len(matches) != 1 or key not in state: - continue item = matches[0] - baseline = state[key] if ( - item.get("repo_url") != REPOSITORY - or item.get("source_path") != baseline["source_path"] + item.get("repo_url", "").rstrip("/").removesuffix(".git").lower() + != REPO.lower() ): continue - for field, value in generated.items(): - if ( - field in baseline - and item.get(field) == baseline[field] - or field not in baseline - and field not in item - ): - item[field] = value - baseline[field] = value - elif key not in state: - # State also remembers deliberate catalog deletions; do not recreate them. - group_name = ( + else: + group = next( + (g for g in GROUPS if key in GROUPS[g]), "Storage & Memory" if "tapestore" in key or "tape-dataset" in key - else "Runtime & Workflow" + else "Runtime & Workflow", ) - group = next( - group - for group in plugins["subcategories"] - if group["name"] == group_name - ) - group.setdefault("items", []).append(generated) - state[key] = generated.copy() - if data != previous_data: - write_catalog(catalog, previous_data, data, yaml) - if state != previous_state: - state_path.parent.mkdir(parents=True, exist_ok=True) - state_path.write_text( - json.dumps(state, indent=2, sort_keys=True) + "\n", encoding="utf-8" + item = { + "name": name, + "kind": "plugin", + "logo": LOGOS.get(key, "/plugin.svg"), + "homepage_url": f"{REPO}/tree/main/{path}", + "repo_url": REPO, + "source_path": path, + "install": f"bub install {name}@main", + "builtin": False, + } + next(g for g in groups if g["name"] == group)["items"].append(item) + existing.append(item) + changed = True + metadata = {} + description = project.get("description", "").strip() + if description and description != "Add your description here": + metadata["description"] = " ".join(description.split()) + elif "description" not in item: + metadata["description"] = f"Bub plugin: {name}." + authors = [ + author["name"] + for author in project.get("authors", []) + if author.get("name") + ] + if authors: + metadata["author"] = ", ".join(authors) + if isinstance(project.get("license"), str): + metadata["license"] = project["license"] + metadata.update(OVERRIDES.get(key, {})) + changed |= any(item.get(field) != value for field, value in metadata.items()) + item.update(metadata) + if changed: + catalog.write_text( + yaml.dump( + data, + Dumper=CatalogDumper, + sort_keys=False, + allow_unicode=True, + width=88, + ), + encoding="utf-8", ) - return data != previous_data or state != previous_state + return changed -def main(): +if __name__ == "__main__": parser = argparse.ArgumentParser(description=__doc__) - parser.add_argument("source", type=Path, help="Local bub-contrib checkout") + parser.add_argument("source", type=Path) parser.add_argument("--catalog", type=Path, default=Path("data.yml")) - parser.add_argument( - "--state", type=Path, default=Path(".github/bub-contrib-sync.json") - ) args = parser.parse_args() - if sync(args.source, args.catalog, args.state): - print("Updated Bub contrib catalog data.") - - -if __name__ == "__main__": - main() + if sync(args.source, args.catalog): + print("Updated contrib catalog.") diff --git a/tests/test_sync_bub_contrib.py b/tests/test_sync_bub_contrib.py index 2e1d519..8d857a8 100644 --- a/tests/test_sync_bub_contrib.py +++ b/tests/test_sync_bub_contrib.py @@ -1,174 +1,81 @@ -import json -import subprocess -import sys import tempfile import unittest from pathlib import Path import yaml -from scripts.sync_bub_contrib import REPOSITORY, sync - -ROOT = Path(__file__).resolve().parents[1] +from scripts.sync_bub_contrib import REPO, sync class SyncTests(unittest.TestCase): - def setUp(self): - self.directory = tempfile.TemporaryDirectory() - self.addCleanup(self.directory.cleanup) - self.root = Path(self.directory.name) - self.source = self.root / "source" - self.catalog = self.root / "data.yml" - self.state = self.root / "state.json" - self.catalog.write_text( - "# Curated catalog\ncategories:\n" - " - name: Plugins\n subcategories:\n" - " - name: Runtime & Workflow\n items: []\n" - " - name: Storage & Memory\n items: []\n", - encoding="utf-8", - ) - self.package() - - def package( - self, description="Example plugin", name="bub-example", entry_point=True - ): - package = self.source / "packages" / name - package.mkdir(parents=True, exist_ok=True) - manifest = ( - f'[project]\nname = "{name}"\ndescription = "{description}"\n' - 'authors = [{name = "A contributor"}]\nlicense = "MIT"\n' - ) - if entry_point: - manifest += '[project.entry-points.bub]\nexample = "example.plugin"\n' - (package / "pyproject.toml").write_text(manifest, encoding="utf-8") - - def run_sync(self): - return sync(self.source, self.catalog, self.state) - - def items(self): - data = yaml.safe_load(self.catalog.read_text(encoding="utf-8")) - return [ - item - for category in data["categories"] - for group in category["subcategories"] - for item in group["items"] - ] - - def test_initial_import_and_quiet_byte_identical_repeat(self): - self.assertTrue(self.run_sync()) - item = self.items()[0] - self.assertEqual(item["source_path"], "packages/bub-example") - self.assertEqual(item["repo_url"], REPOSITORY) - self.assertEqual(item["install"], "bub install bub-example@main") - self.assertEqual(item["author"], "A contributor") - self.assertEqual(item["license"], "MIT") - self.assertTrue((ROOT / "logos" / item["logo"].lstrip("/")).is_file()) - before = self.catalog.read_bytes(), self.state.read_bytes() - result = subprocess.run( - [ - sys.executable, - str(ROOT / "scripts/sync_bub_contrib.py"), - str(self.source), - "--catalog", - str(self.catalog), - "--state", - str(self.state), - ], - capture_output=True, - text=True, - check=True, - ) - self.assertEqual(result.stdout, "") - self.assertEqual(result.stderr, "") - self.assertEqual(before, (self.catalog.read_bytes(), self.state.read_bytes())) - - def test_updates_generated_fields_and_preserves_overrides(self): - self.run_sync() - text = self.catalog.read_text(encoding="utf-8") - self.catalog.write_text( - text.replace("/plugin.svg", "/mcp.svg # Maintainer-selected logo"), - encoding="utf-8", - ) - self.package("Changed upstream summary") - self.assertTrue(self.run_sync()) - item = self.items()[0] - self.assertEqual(item["description"], "Changed upstream summary") - self.assertEqual(item["logo"], "/mcp.svg") - self.assertIn("# Maintainer-selected logo", self.catalog.read_text()) - text = self.catalog.read_text(encoding="utf-8") - self.catalog.write_text( - text.replace("Changed upstream summary", "Curated summary"), - encoding="utf-8", - ) - self.package("Another upstream summary") - self.assertFalse(self.run_sync()) - self.assertEqual(self.items()[0]["description"], "Curated summary") - - def test_curated_entries_and_comments_remain_verbatim(self): - curated = ( - " # Keep this comment and formatting\n" - " - name: BUB_Example\n description: 'Curated summary'\n" - " kind: plugin\n logo: /mcp.svg\n" - ) - self.catalog.write_text( - self.catalog.read_text().replace( - " items: []", " items:\n" + curated, 1 + def test_update_add_deduplicate_and_repeat(self): + with tempfile.TemporaryDirectory() as directory: + root = Path(directory) + catalog = root / "data.yml" + curated = { + "name": "BUB_Example", + "kind": "plugin", + "description": "Old", + "repo_url": REPO, + "source_path": "packages/bub-example", + "logo": "/mcp.svg", + "install": "curated install", + } + unrelated = {"name": "friend", "kind": "friend", "description": "Keep me"} + groups = [ + {"name": name, "items": [curated, unrelated] if name == "Tools" else []} + for name in ( + "Channels", + "Tools", + "Runtime & Workflow", + "Storage & Memory", + ) + ] + catalog.write_text( + yaml.safe_dump( + {"categories": [{"name": "Plugins", "subcategories": groups}]} + ) ) - ) - before = self.catalog.read_bytes() - self.assertFalse(self.run_sync()) - self.assertEqual(self.catalog.read_bytes(), before) - self.package(name="bub-other") - self.assertTrue(self.run_sync()) - self.assertIn(curated, self.catalog.read_text()) - self.assertEqual(len(self.items()), 2) - self.assertNotIn("bub-example", json.loads(self.state.read_text())) - - def test_source_path_deduplicates_renamed_curated_entry(self): - self.run_sync() - self.catalog.write_text( - self.catalog.read_text().replace("name: bub-example", "name: Friendly name") - ) - self.state.unlink() - self.assertFalse(self.run_sync()) - self.assertEqual(len(self.items()), 1) - - def test_removed_package_is_retained_and_manual_deletion_is_respected(self): - self.run_sync() - self.package(name="bub-other") - self.run_sync() - (self.source / "packages/bub-example/pyproject.toml").unlink() - self.assertFalse(self.run_sync()) - self.assertEqual(len(self.items()), 2) - # Restore source, then deliberately remove the corresponding catalog item. - self.package() - text = self.catalog.read_text() - start = text.index(" - name: bub-example") - end = text.index(" - name: bub-other") - self.catalog.write_text(text[:start] + text[end:]) - self.assertFalse(self.run_sync()) - self.assertEqual([item["name"] for item in self.items()], ["bub-other"]) - - def test_ignores_non_plugins_and_groups_storage(self): - self.package(name="utility", entry_point=False) - self.package(name="bub-tapestore-example") - self.run_sync() - groups = yaml.safe_load(self.catalog.read_text())["categories"][0][ - "subcategories" - ] - self.assertEqual( - [item["name"] for item in groups[1]["items"]], ["bub-tapestore-example"] - ) - self.assertEqual(len(self.items()), 2) - - def test_invalid_or_duplicate_source_fails_before_writing(self): - self.package(name="BUB_Example") - before = self.catalog.read_bytes() - with self.assertRaisesRegex(ValueError, "Duplicate source package"): - self.run_sync() - self.assertEqual(self.catalog.read_bytes(), before) - self.assertFalse(self.state.exists()) - - -if __name__ == "__main__": - unittest.main() + for name in ( + "bub-example", + "bub-docker-env", + "bub-tapestore-otel", + "bub-slack", + ): + package = root / "packages" / name + package.mkdir(parents=True) + (package / "pyproject.toml").write_text( + f'[project]\nname = "{name}"\ndescription = "Updated summary"\nauthors = [{{name = "Author"}}]\n[project.entry-points.bub]\nplugin = "plugin"\n' + ) + self.assertTrue(sync(root, catalog)) + groups = yaml.safe_load(catalog.read_text())["categories"][0][ + "subcategories" + ] + items = {item["name"]: item for group in groups for item in group["items"]} + self.assertEqual(len(items), 5) + self.assertEqual(items["BUB_Example"]["description"], "Updated summary") + self.assertEqual(items["BUB_Example"]["author"], "Author") + self.assertEqual(items["BUB_Example"]["logo"], "/mcp.svg") + self.assertEqual(items["BUB_Example"]["install"], "curated install") + self.assertEqual(items["friend"], unrelated) + self.assertEqual(items["bub-docker-env"]["logo"], "/docker.svg") + self.assertEqual(items["bub-tapestore-otel"]["logo"], "/opentelemetry.svg") + self.assertEqual(groups[0]["items"][0]["name"], "bub-slack") + before = catalog.read_bytes() + self.assertFalse(sync(root, catalog)) + self.assertEqual(catalog.read_bytes(), before) + catalog.write_text( + catalog.read_text().replace("BUB_Example", "Display name") + ) + self.assertFalse(sync(root, catalog)) + + def test_no_plugins_is_quiet(self): + with tempfile.TemporaryDirectory() as directory: + root = Path(directory) + catalog = root / "data.yml" + catalog.write_text( + "categories:\n - name: Plugins\n subcategories: []\n" + ) + before = catalog.read_bytes() + self.assertFalse(sync(root, catalog)) + self.assertEqual(catalog.read_bytes(), before) diff --git a/uv.lock b/uv.lock index be99e4b..b6ce3db 100644 --- a/uv.lock +++ b/uv.lock @@ -9,14 +9,12 @@ source = { virtual = "." } dependencies = [ { name = "jinja2" }, { name = "pyyaml" }, - { name = "ruamel-yaml" }, ] [package.metadata] requires-dist = [ { name = "jinja2", specifier = ">=3.1.6" }, { name = "pyyaml", specifier = ">=6.0.3" }, - { name = "ruamel-yaml", specifier = ">=0.18.10,<0.19" }, ] [package.metadata.requires-dev] @@ -142,53 +140,3 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/f0/7a/1c7270340330e575b92f397352af856a8c06f230aa3e76f86b39d01b416a/pyyaml-6.0.3-cp314-cp314t-win_amd64.whl", hash = "sha256:4ad1906908f2f5ae4e5a8ddfce73c320c2a1429ec52eafd27138b7f1cbe341c9", size = 174062, upload-time = "2025-09-25T21:32:55.767Z" }, { url = "https://files.pythonhosted.org/packages/f1/12/de94a39c2ef588c7e6455cfbe7343d3b2dc9d6b6b2f40c4c6565744c873d/pyyaml-6.0.3-cp314-cp314t-win_arm64.whl", hash = "sha256:ebc55a14a21cb14062aa4162f906cd962b28e2e9ea38f9b4391244cd8de4ae0b", size = 149341, upload-time = "2025-09-25T21:32:56.828Z" }, ] - -[[package]] -name = "ruamel-yaml" -version = "0.18.17" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "ruamel-yaml-clib", marker = "python_full_version < '3.15' and platform_python_implementation == 'CPython'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/3a/2b/7a1f1ebcd6b3f14febdc003e658778d81e76b40df2267904ee6b13f0c5c6/ruamel_yaml-0.18.17.tar.gz", hash = "sha256:9091cd6e2d93a3a4b157ddb8fabf348c3de7f1fb1381346d985b6b247dcd8d3c", size = 149602, upload-time = "2025-12-17T20:02:55.757Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/af/fe/b6045c782f1fd1ae317d2a6ca1884857ce5c20f59befe6ab25a8603c43a7/ruamel_yaml-0.18.17-py3-none-any.whl", hash = "sha256:9c8ba9eb3e793efdf924b60d521820869d5bf0cb9c6f1b82d82de8295e290b9d", size = 121594, upload-time = "2025-12-17T20:02:07.657Z" }, -] - -[[package]] -name = "ruamel-yaml-clib" -version = "0.2.15" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/ea/97/60fda20e2fb54b83a61ae14648b0817c8f5d84a3821e40bfbdae1437026a/ruamel_yaml_clib-0.2.15.tar.gz", hash = "sha256:46e4cc8c43ef6a94885f72512094e482114a8a706d3c555a34ed4b0d20200600", size = 225794, upload-time = "2025-11-16T16:12:59.761Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/72/4b/5fde11a0722d676e469d3d6f78c6a17591b9c7e0072ca359801c4bd17eee/ruamel_yaml_clib-0.2.15-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:cb15a2e2a90c8475df45c0949793af1ff413acfb0a716b8b94e488ea95ce7cff", size = 149088, upload-time = "2025-11-16T16:13:22.836Z" }, - { url = "https://files.pythonhosted.org/packages/85/82/4d08ac65ecf0ef3b046421985e66301a242804eb9a62c93ca3437dc94ee0/ruamel_yaml_clib-0.2.15-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:64da03cbe93c1e91af133f5bec37fd24d0d4ba2418eaf970d7166b0a26a148a2", size = 134553, upload-time = "2025-11-16T16:13:24.151Z" }, - { url = "https://files.pythonhosted.org/packages/b9/cb/22366d68b280e281a932403b76da7a988108287adff2bfa5ce881200107a/ruamel_yaml_clib-0.2.15-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:f6d3655e95a80325b84c4e14c080b2470fe4f33b6846f288379ce36154993fb1", size = 737468, upload-time = "2025-11-16T20:22:47.335Z" }, - { url = "https://files.pythonhosted.org/packages/71/73/81230babf8c9e33770d43ed9056f603f6f5f9665aea4177a2c30ae48e3f3/ruamel_yaml_clib-0.2.15-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:71845d377c7a47afc6592aacfea738cc8a7e876d586dfba814501d8c53c1ba60", size = 753349, upload-time = "2025-11-16T16:13:26.269Z" }, - { url = "https://files.pythonhosted.org/packages/61/62/150c841f24cda9e30f588ef396ed83f64cfdc13b92d2f925bb96df337ba9/ruamel_yaml_clib-0.2.15-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:11e5499db1ccbc7f4b41f0565e4f799d863ea720e01d3e99fa0b7b5fcd7802c9", size = 788211, upload-time = "2025-11-16T16:13:27.441Z" }, - { url = "https://files.pythonhosted.org/packages/30/93/e79bd9cbecc3267499d9ead919bd61f7ddf55d793fb5ef2b1d7d92444f35/ruamel_yaml_clib-0.2.15-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:4b293a37dc97e2b1e8a1aec62792d1e52027087c8eea4fc7b5abd2bdafdd6642", size = 743203, upload-time = "2025-11-16T16:13:28.671Z" }, - { url = "https://files.pythonhosted.org/packages/8d/06/1eb640065c3a27ce92d76157f8efddb184bd484ed2639b712396a20d6dce/ruamel_yaml_clib-0.2.15-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:512571ad41bba04eac7268fe33f7f4742210ca26a81fe0c75357fa682636c690", size = 747292, upload-time = "2025-11-16T20:22:48.584Z" }, - { url = "https://files.pythonhosted.org/packages/a5/21/ee353e882350beab65fcc47a91b6bdc512cace4358ee327af2962892ff16/ruamel_yaml_clib-0.2.15-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:e5e9f630c73a490b758bf14d859a39f375e6999aea5ddd2e2e9da89b9953486a", size = 771624, upload-time = "2025-11-16T16:13:29.853Z" }, - { url = "https://files.pythonhosted.org/packages/57/34/cc1b94057aa867c963ecf9ea92ac59198ec2ee3a8d22a126af0b4d4be712/ruamel_yaml_clib-0.2.15-cp312-cp312-win32.whl", hash = "sha256:f4421ab780c37210a07d138e56dd4b51f8642187cdfb433eb687fe8c11de0144", size = 100342, upload-time = "2025-11-16T16:13:31.067Z" }, - { url = "https://files.pythonhosted.org/packages/b3/e5/8925a4208f131b218f9a7e459c0d6fcac8324ae35da269cb437894576366/ruamel_yaml_clib-0.2.15-cp312-cp312-win_amd64.whl", hash = "sha256:2b216904750889133d9222b7b873c199d48ecbb12912aca78970f84a5aa1a4bc", size = 119013, upload-time = "2025-11-16T16:13:32.164Z" }, - { url = "https://files.pythonhosted.org/packages/17/5e/2f970ce4c573dc30c2f95825f2691c96d55560268ddc67603dc6ea2dd08e/ruamel_yaml_clib-0.2.15-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:4dcec721fddbb62e60c2801ba08c87010bd6b700054a09998c4d09c08147b8fb", size = 147450, upload-time = "2025-11-16T16:13:33.542Z" }, - { url = "https://files.pythonhosted.org/packages/d6/03/a1baa5b94f71383913f21b96172fb3a2eb5576a4637729adbf7cd9f797f8/ruamel_yaml_clib-0.2.15-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:65f48245279f9bb301d1276f9679b82e4c080a1ae25e679f682ac62446fac471", size = 133139, upload-time = "2025-11-16T16:13:34.587Z" }, - { url = "https://files.pythonhosted.org/packages/dc/19/40d676802390f85784235a05788fd28940923382e3f8b943d25febbb98b7/ruamel_yaml_clib-0.2.15-cp313-cp313-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:46895c17ead5e22bea5e576f1db7e41cb273e8d062c04a6a49013d9f60996c25", size = 731474, upload-time = "2025-11-16T20:22:49.934Z" }, - { url = "https://files.pythonhosted.org/packages/ce/bb/6ef5abfa43b48dd55c30d53e997f8f978722f02add61efba31380d73e42e/ruamel_yaml_clib-0.2.15-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:3eb199178b08956e5be6288ee0b05b2fb0b5c1f309725ad25d9c6ea7e27f962a", size = 748047, upload-time = "2025-11-16T16:13:35.633Z" }, - { url = "https://files.pythonhosted.org/packages/ff/5d/e4f84c9c448613e12bd62e90b23aa127ea4c46b697f3d760acc32cb94f25/ruamel_yaml_clib-0.2.15-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:4d1032919280ebc04a80e4fb1e93f7a738129857eaec9448310e638c8bccefcf", size = 782129, upload-time = "2025-11-16T16:13:36.781Z" }, - { url = "https://files.pythonhosted.org/packages/de/4b/e98086e88f76c00c88a6bcf15eae27a1454f661a9eb72b111e6bbb69024d/ruamel_yaml_clib-0.2.15-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:ab0df0648d86a7ecbd9c632e8f8d6b21bb21b5fc9d9e095c796cacf32a728d2d", size = 736848, upload-time = "2025-11-16T16:13:37.952Z" }, - { url = "https://files.pythonhosted.org/packages/0c/5c/5964fcd1fd9acc53b7a3a5d9a05ea4f95ead9495d980003a557deb9769c7/ruamel_yaml_clib-0.2.15-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:331fb180858dd8534f0e61aa243b944f25e73a4dae9962bd44c46d1761126bbf", size = 741630, upload-time = "2025-11-16T20:22:51.718Z" }, - { url = "https://files.pythonhosted.org/packages/07/1e/99660f5a30fceb58494598e7d15df883a07292346ef5696f0c0ae5dee8c6/ruamel_yaml_clib-0.2.15-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:fd4c928ddf6bce586285daa6d90680b9c291cfd045fc40aad34e445d57b1bf51", size = 766619, upload-time = "2025-11-16T16:13:39.178Z" }, - { url = "https://files.pythonhosted.org/packages/36/2f/fa0344a9327b58b54970e56a27b32416ffbcfe4dcc0700605516708579b2/ruamel_yaml_clib-0.2.15-cp313-cp313-win32.whl", hash = "sha256:bf0846d629e160223805db9fe8cc7aec16aaa11a07310c50c8c7164efa440aec", size = 100171, upload-time = "2025-11-16T16:13:40.456Z" }, - { url = "https://files.pythonhosted.org/packages/06/c4/c124fbcef0684fcf3c9b72374c2a8c35c94464d8694c50f37eef27f5a145/ruamel_yaml_clib-0.2.15-cp313-cp313-win_amd64.whl", hash = "sha256:45702dfbea1420ba3450bb3dd9a80b33f0badd57539c6aac09f42584303e0db6", size = 118845, upload-time = "2025-11-16T16:13:41.481Z" }, - { url = "https://files.pythonhosted.org/packages/3e/bd/ab8459c8bb759c14a146990bf07f632c1cbec0910d4853feeee4be2ab8bb/ruamel_yaml_clib-0.2.15-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:753faf20b3a5906faf1fc50e4ddb8c074cb9b251e00b14c18b28492f933ac8ef", size = 147248, upload-time = "2025-11-16T16:13:42.872Z" }, - { url = "https://files.pythonhosted.org/packages/69/f2/c4cec0a30f1955510fde498aac451d2e52b24afdbcb00204d3a951b772c3/ruamel_yaml_clib-0.2.15-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:480894aee0b29752560a9de46c0e5f84a82602f2bc5c6cde8db9a345319acfdf", size = 133764, upload-time = "2025-11-16T16:13:43.932Z" }, - { url = "https://files.pythonhosted.org/packages/82/c7/2480d062281385a2ea4f7cc9476712446e0c548cd74090bff92b4b49e898/ruamel_yaml_clib-0.2.15-cp314-cp314-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:4d3b58ab2454b4747442ac76fab66739c72b1e2bb9bd173d7694b9f9dbc9c000", size = 730537, upload-time = "2025-11-16T20:22:52.918Z" }, - { url = "https://files.pythonhosted.org/packages/75/08/e365ee305367559f57ba6179d836ecc3d31c7d3fdff2a40ebf6c32823a1f/ruamel_yaml_clib-0.2.15-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:bfd309b316228acecfa30670c3887dcedf9b7a44ea39e2101e75d2654522acd4", size = 746944, upload-time = "2025-11-16T16:13:45.338Z" }, - { url = "https://files.pythonhosted.org/packages/a1/5c/8b56b08db91e569d0a4fbfa3e492ed2026081bdd7e892f63ba1c88a2f548/ruamel_yaml_clib-0.2.15-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:2812ff359ec1f30129b62372e5f22a52936fac13d5d21e70373dbca5d64bb97c", size = 778249, upload-time = "2025-11-16T16:13:46.871Z" }, - { url = "https://files.pythonhosted.org/packages/6a/1d/70dbda370bd0e1a92942754c873bd28f513da6198127d1736fa98bb2a16f/ruamel_yaml_clib-0.2.15-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:7e74ea87307303ba91073b63e67f2c667e93f05a8c63079ee5b7a5c8d0d7b043", size = 737140, upload-time = "2025-11-16T16:13:48.349Z" }, - { url = "https://files.pythonhosted.org/packages/5b/87/822d95874216922e1120afb9d3fafa795a18fdd0c444f5c4c382f6dac761/ruamel_yaml_clib-0.2.15-cp314-cp314-musllinux_1_2_i686.whl", hash = "sha256:713cd68af9dfbe0bb588e144a61aad8dcc00ef92a82d2e87183ca662d242f524", size = 741070, upload-time = "2025-11-16T20:22:54.151Z" }, - { url = "https://files.pythonhosted.org/packages/b9/17/4e01a602693b572149f92c983c1f25bd608df02c3f5cf50fd1f94e124a59/ruamel_yaml_clib-0.2.15-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:542d77b72786a35563f97069b9379ce762944e67055bea293480f7734b2c7e5e", size = 765882, upload-time = "2025-11-16T16:13:49.526Z" }, - { url = "https://files.pythonhosted.org/packages/9f/17/7999399081d39ebb79e807314de6b611e1d1374458924eb2a489c01fc5ad/ruamel_yaml_clib-0.2.15-cp314-cp314-win32.whl", hash = "sha256:424ead8cef3939d690c4b5c85ef5b52155a231ff8b252961b6516ed7cf05f6aa", size = 102567, upload-time = "2025-11-16T16:13:50.78Z" }, - { url = "https://files.pythonhosted.org/packages/d2/67/be582a7370fdc9e6846c5be4888a530dcadd055eef5b932e0e85c33c7d73/ruamel_yaml_clib-0.2.15-cp314-cp314-win_amd64.whl", hash = "sha256:ac9b8d5fa4bb7fd2917ab5027f60d4234345fd366fe39aa711d5dca090aa1467", size = 122847, upload-time = "2025-11-16T16:13:51.807Z" }, -] From 9520c04148a9b8fbe1ae2b50bc49578fbfeff40f Mon Sep 17 00:00:00 2001 From: Chojan Shang Date: Tue, 20 Oct 2026 02:34:38 +0800 Subject: [PATCH 4/5] refactor(ci): delegate weekly catalog sync to Landing --- .github/workflows/check.yml | 18 ---- .github/workflows/sync-bub-contrib.yml | 59 ++++++----- README.md | 2 +- data.yml | 135 ++++++------------------- logos/docker.svg | 26 ----- logos/opentelemetry.svg | 2 - scripts/sync_bub_contrib.py | 135 ------------------------- tests/test_sync_bub_contrib.py | 81 --------------- 8 files changed, 63 insertions(+), 395 deletions(-) delete mode 100644 .github/workflows/check.yml delete mode 100644 logos/docker.svg delete mode 100644 logos/opentelemetry.svg delete mode 100644 scripts/sync_bub_contrib.py delete mode 100644 tests/test_sync_bub_contrib.py diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml deleted file mode 100644 index 72660c1..0000000 --- a/.github/workflows/check.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Catalog checks - -on: - pull_request: - workflow_dispatch: - -permissions: - contents: read - -jobs: - check: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: astral-sh/setup-uv@v6 - - run: uv sync --frozen - - run: uv run --frozen python -m unittest discover -s tests - - run: uv run --frozen python build.py diff --git a/.github/workflows/sync-bub-contrib.yml b/.github/workflows/sync-bub-contrib.yml index 0e6e24e..c872727 100644 --- a/.github/workflows/sync-bub-contrib.yml +++ b/.github/workflows/sync-bub-contrib.yml @@ -1,48 +1,55 @@ name: Sync Bub contrib + on: schedule: - cron: '41 3 * * 1' workflow_dispatch: - inputs: - publish: - description: Open a draft PR (main only) - type: boolean - default: true + permissions: contents: write pull-requests: write + concurrency: group: sync-bub-contrib cancel-in-progress: false + jobs: sync: runs-on: ubuntu-latest + timeout-minutes: 20 env: GH_TOKEN: ${{ secrets.LANDING_GITHUB_TOKEN || github.token }} + GH_ADMISSION_TOKEN: ${{ secrets.LANDING_ADMISSION_TOKEN || github.token }} + GIT_AUTHOR_NAME: ${{ vars.LANDING_GIT_NAME || 'github-actions[bot]' }} + GIT_AUTHOR_EMAIL: ${{ vars.LANDING_GIT_EMAIL || '41898282+github-actions[bot]@users.noreply.github.com' }} + GIT_COMMITTER_NAME: ${{ vars.LANDING_GIT_NAME || 'github-actions[bot]' }} + GIT_COMMITTER_EMAIL: ${{ vars.LANDING_GIT_EMAIL || '41898282+github-actions[bot]@users.noreply.github.com' }} steps: - uses: actions/checkout@v4 with: - token: ${{ env.GH_TOKEN }} + ref: ${{ github.event.repository.default_branch }} + fetch-depth: 0 + persist-credentials: false - uses: astral-sh/setup-uv@v6 - - name: Sync and validate - id: sync + - name: Prepare project and Git publishing run: | - if [ "$(gh pr list --repo "$GITHUB_REPOSITORY" --state open --head catalog/bub-contrib --json number --jq length)" != 0 ]; then exit 0; fi - git clone --depth 1 --branch main https://github.com/bubbuild/bub-contrib.git "$RUNNER_TEMP/contrib" - echo "source=$(git -C "$RUNNER_TEMP/contrib" rev-parse HEAD)" >> "$GITHUB_OUTPUT" - uv run --frozen python scripts/sync_bub_contrib.py "$RUNNER_TEMP/contrib" - if git diff --quiet -- data.yml; then exit 0; fi - uv run --frozen python -m unittest discover -s tests - uv run --frozen python build.py - echo 'changed=true' >> "$GITHUB_OUTPUT" - - uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8 - if: steps.sync.outputs.changed == 'true' && github.ref == 'refs/heads/main' && (github.event_name == 'schedule' || inputs.publish) + uv sync --frozen + git var GIT_AUTHOR_IDENT + git var GIT_COMMITTER_IDENT + gh auth setup-git + - uses: bubbuild/landing@9014baa64f82893dc194a3f1e31391737f68c426 + env: + LANDING_MODEL: ${{ vars.LANDING_MODEL }} + LANDING_API_KEY: ${{ secrets.LANDING_API_KEY }} + LANDING_API_BASE: ${{ vars.LANDING_API_BASE }} + LANDING_COMPLETION_ARGS: ${{ vars.LANDING_COMPLETION_ARGS || '{}' }} + LANDING_MODEL_TIMEOUT_SECONDS: '120' with: - token: ${{ env.GH_TOKEN }} - branch: catalog/bub-contrib - base: main - draft: always-true - add-paths: data.yml - commit-message: 'chore(catalog): sync Bub contrib plugins' - title: 'chore(catalog): sync Bub contrib plugins' - body: 'Update catalog metadata from bubbuild/bub-contrib@${{ steps.sync.outputs.source }}. Validation: sync tests and site build pass.' + command: fix + checks: uv run python build.py + instruction: >- + Read bubbuild/bub-contrib package and skill metadata. Update Buildscape's existing + categories and schema, preserving hand-maintained data and deduplicating without unrelated churn. + Use appropriate official or existing SVG logos, never raster wrappers or invented brand logos. + Reuse an existing sync draft or create a draft only when data or logos change; unchanged runs stay quiet. + Run uv run python build.py before publishing. Do not merge. diff --git a/README.md b/README.md index 1a55a63..8d44522 100644 --- a/README.md +++ b/README.md @@ -73,4 +73,4 @@ categories: Build validates required fields, `kind` enum, and rejects unknown fields. -The catalog checks bub-contrib every Monday at 03:41 UTC and proposes metadata updates and new plugins in draft PRs. Existing presentation choices stay curated; unchanged runs stay quiet, and an open sync PR pauses further updates. GitHub Actions must be allowed to create PRs. +The catalog sync runs weekly on Mondays at 03:41 UTC or manually, proposing relevant bub-contrib updates as draft PRs and staying quiet when nothing changes. diff --git a/data.yml b/data.yml index abdc43e..e143010 100644 --- a/data.yml +++ b/data.yml @@ -4,7 +4,7 @@ categories: - name: Channels items: - name: bub-discord - description: Discord channel for Bub + description: Discord channel adapter for Bub message IO. kind: plugin logo: /discord.svg homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-discord @@ -12,9 +12,8 @@ categories: install: bub install bub-discord builtin: false source_path: packages/bub-discord - author: Frost Ming - name: bub-dingtalk - description: DingTalk channel for Bub + description: DingTalk Stream Mode channel adapter for Bub message IO. kind: plugin logo: /dingtalk-site.png homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-dingtalk @@ -22,9 +21,8 @@ categories: install: bub install bub-dingtalk@main builtin: false source_path: packages/bub-dingtalk - author: Chojan Shang - name: bub-feishu - description: Feishu channel for Bub + description: Feishu channel adapter for Bub message IO. kind: plugin logo: /lark-suite.png homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-feishu @@ -32,9 +30,8 @@ categories: install: bub install bub-feishu builtin: false source_path: packages/bub-feishu - author: Kyle Liu - name: bub-qq - description: QQ Open Platform channel for Bub + description: QQ Open Platform channel adapter for Bub. kind: plugin logo: /qq.svg homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-qq @@ -42,9 +39,8 @@ categories: install: bub install bub-qq@main builtin: false source_path: packages/bub-qq - author: wzhongyun - name: bub-wechat - description: Wechat Agent channel for Bub + description: WeChat channel adapter for Bub message IO. kind: plugin logo: /wechat.svg homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-wechat @@ -52,9 +48,8 @@ categories: install: bub install bub-wechat@main builtin: false source_path: packages/bub-wechat - author: Frost Ming - name: bub-wecom - description: WeCom channel for Bub + description: WeCom channel adapter for Bub message IO. kind: plugin logo: /wecom.png homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-wecom @@ -62,7 +57,6 @@ categories: install: bub install bub-wecom@main builtin: false source_path: packages/bub-wecom - author: Ruter - name: bub-xiaoai description: Xiaomi XiaoAi speaker channel plugin with message polling and device TTS replies. @@ -82,7 +76,7 @@ categories: install: bub install bubbuild/bub-folotoy builtin: false - name: bub-mcp-server - description: Expose Bub as an SSE MCP server + description: Expose Bub as an MCP server kind: plugin logo: /mcp.svg homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-mcp-server @@ -90,9 +84,9 @@ categories: install: bub install bub-mcp-server builtin: false source_path: packages/bub-mcp-server - author: Frost Ming - name: bub-acp-server - description: Expose Bub as an ACP agent + description: Expose Bub as an Agent Client Protocol agent for ACP-compatible + editors. kind: plugin logo: /acp.svg homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-acp-server @@ -100,7 +94,6 @@ categories: install: bub install bub-acp-server builtin: false source_path: packages/bub-acp-server - author: Frost Ming - name: bub-slack description: Slack channel for Bub kind: plugin @@ -132,9 +125,9 @@ categories: install: bub install bub-codex@main builtin: false source_path: packages/bub-codex - author: Frost Ming - name: bub-cursor - description: Cursor-backed run_model plugin for Bub + description: Cursor CLI-backed run_model plugin with login and session resume + support. kind: plugin logo: /cursor.svg homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-cursor @@ -142,9 +135,9 @@ categories: install: bub install bub-cursor@main builtin: false source_path: packages/bub-cursor - author: tssujt - name: bub-extism - description: Extism WebAssembly bridge plugin for Bub + description: Extism WebAssembly bridge plugin for running Bub hooks from wasm + modules. kind: plugin logo: /extism.svg homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-extism @@ -152,9 +145,9 @@ categories: install: bub install bub-extism@main builtin: false source_path: packages/bub-extism - author: Bub Build contributors - name: bub-github-copilot - description: GitHub Copilot SDK-backed run_model plugin for Bub + description: GitHub Copilot SDK-backed run_model plugin plus GitHub device-flow + login support. kind: plugin logo: /github-copilot.svg homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-github-copilot @@ -162,9 +155,8 @@ categories: install: bub install bub-github-copilot@main builtin: false source_path: packages/bub-github-copilot - author: PsiACE - name: bub-kimi - description: Kimi CLI model plugin for bub + description: Kimi CLI-backed run_model plugin with session resume support. kind: plugin logo: /kimi.svg homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-kimi @@ -172,9 +164,9 @@ categories: install: bub install bub-kimi@main builtin: false source_path: packages/bub-kimi - author: Mengxin Liu - name: bub-session-prompt - description: Bub plugin to support session-specific system prompt + description: Session-specific system prompt plugin sourced from local Bub + session state. kind: plugin logo: /bub-light.png homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-session-prompt @@ -182,9 +174,8 @@ categories: install: bub install bub-session-prompt@main builtin: false source_path: packages/bub-session-prompt - author: Frost Ming - name: bub-context-budget - description: Proactive context-budget guard for Bub LLM calls + description: Proactive context-budget guard for Bub's builtin agent loop. kind: plugin logo: /context.png homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-context-budget @@ -195,7 +186,7 @@ categories: builtin: false source_path: packages/bub-context-budget - name: bub-dsh - description: DeepSeek Harness SDK-backed streaming model plugin for Bub + description: DeepSeek Harness runner for Bub kind: plugin logo: /dsh.svg homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-dsh @@ -205,62 +196,11 @@ categories: install: bub install bub-dsh@main builtin: false source_path: packages/bub-dsh - - name: bub-agent-plugins - kind: plugin - logo: /plugin.svg - homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-agent-plugins - repo_url: https://github.com/bubbuild/bub-contrib - source_path: packages/bub-agent-plugins - install: bub install bub-agent-plugins@main - builtin: false - description: Load portable Agent Plugins into Bub - author: Bub contributors - - name: bub-docker-env - kind: plugin - logo: /docker.svg - homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-docker-env - repo_url: https://github.com/bubbuild/bub-contrib - source_path: packages/bub-docker-env - install: bub install bub-docker-env@main - builtin: false - description: Run Bub sessions' bash, fs and code-mode tools in Docker containers - author: wzhongyun - - name: bub-env - kind: plugin - logo: /plugin.svg - homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-env - repo_url: https://github.com/bubbuild/bub-contrib - source_path: packages/bub-env - install: bub install bub-env@main - builtin: false - description: Inject environment variables from the Bub config file at startup - author: wzhongyun - - name: bub-monty-env - kind: plugin - logo: /plugin.svg - homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-monty-env - repo_url: https://github.com/bubbuild/bub-contrib - source_path: packages/bub-monty-env - install: bub install bub-monty-env@main - builtin: false - description: Run Bub's code-mode run_code in Monty, a sandboxed Python interpreter, - on top of any Bub environment - author: Frost Ming - - name: bub-sandbox-env - kind: plugin - logo: /plugin.svg - homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-sandbox-env - repo_url: https://github.com/bubbuild/bub-contrib - source_path: packages/bub-sandbox-env - install: bub install bub-sandbox-env@main - builtin: false - description: Run Bub sessions' bash, fs and code-mode tools in a lightweight local - sandbox (macOS Seatbelt, Linux bubblewrap) - author: Frost Ming - name: Tools items: - name: bub-mcp - description: Expose configured MCP servers as Bub tools + description: Exposes configured MCP servers as Bub tools, with `bub mcp` + commands to list, add, and remove server configs. kind: plugin logo: /mcp.svg homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-mcp @@ -268,9 +208,8 @@ categories: install: bub install bub-mcp builtin: false source_path: packages/bub-mcp - author: Frost Ming - name: bub-schedule - description: Scheduling tools for Bub + description: Scheduling channel and tools backed by APScheduler. kind: plugin logo: /calendar.svg homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-schedule @@ -278,9 +217,8 @@ categories: install: bub install bub-schedule builtin: false source_path: packages/bub-schedule - author: Frost Ming - name: bub-web-search - description: Web search tools for Bub + description: Web search tool package for Bub. kind: plugin logo: /search.svg homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-web-search @@ -288,12 +226,11 @@ categories: install: bub install bub-web-search builtin: false source_path: packages/bub-web-search - author: Frost Ming - name: Storage & Memory items: - name: tape-dataset-opendal - description: Backend-agnostic tape dataset export over the standard Bub tape store - interface + description: Exports Bub and Republic tapes to backend-agnostic dataset + artifacts through OpenDAL. kind: plugin logo: /bub-light.png homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/tape-dataset-opendal @@ -301,9 +238,8 @@ categories: install: bub install tape-dataset-opendal@main builtin: false source_path: packages/tape-dataset-opendal - author: Chojan Shang - name: bub-tapestore-redis - description: Redis tape store plugin for Bub + description: Redis-backed tape store plugin for Bub conversation history. kind: plugin logo: /redis.svg homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-tapestore-redis @@ -311,9 +247,8 @@ categories: install: bub install bub-tapestore-redis@main builtin: false source_path: packages/bub-tapestore-redis - author: Johnson Lee - name: bub-tapestore-sqlalchemy - description: SQLAlchemy tape store plugin for Bub + description: SQLAlchemy-backed tape store plugin for Bub conversation history. kind: plugin logo: /sqlalchemy.svg homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-tapestore-sqlalchemy @@ -321,9 +256,8 @@ categories: install: bub install bub-tapestore-sqlalchemy@main builtin: false source_path: packages/bub-tapestore-sqlalchemy - author: Chojan Shang - name: bub-tapestore-sqlite - description: SQLite tape store plugin for Bub + description: SQLite-backed tape store plugin for Bub conversation history. kind: plugin logo: /sqlite.svg homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-tapestore-sqlite @@ -331,7 +265,6 @@ categories: install: bub install bub-tapestore-sqlite@main builtin: false source_path: packages/bub-tapestore-sqlite - author: Chojan Shang - name: nowledge-mem-bub description: Bring your cross-tool knowledge into Bub, and share what you learn in Bub with every other tool. @@ -352,16 +285,6 @@ categories: author: yibie install: bub install bub-semantic-memory builtin: false - - name: bub-tapestore-otel - kind: plugin - logo: /opentelemetry.svg - homepage_url: https://github.com/bubbuild/bub-contrib/tree/main/packages/bub-tapestore-otel - repo_url: https://github.com/bubbuild/bub-contrib - source_path: packages/bub-tapestore-otel - install: bub install bub-tapestore-otel@main - builtin: false - description: OpenTelemetry projection layer for Bub tape stores - author: Chojan Shang - name: Skills subcategories: - name: Built-in diff --git a/logos/docker.svg b/logos/docker.svg deleted file mode 100644 index d27a4aa..0000000 --- a/logos/docker.svg +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/logos/opentelemetry.svg b/logos/opentelemetry.svg deleted file mode 100644 index d423d7f..0000000 --- a/logos/opentelemetry.svg +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/scripts/sync_bub_contrib.py b/scripts/sync_bub_contrib.py deleted file mode 100644 index f0bd9b7..0000000 --- a/scripts/sync_bub_contrib.py +++ /dev/null @@ -1,135 +0,0 @@ -"""Sync contrib metadata; preserve catalog placement, links, logos, and install choices.""" - -import argparse -import re -import tomllib -from pathlib import Path - -import yaml - -REPO = "https://github.com/bubbuild/bub-contrib" -LOGOS = {"bub-docker-env": "/docker.svg", "bub-tapestore-otel": "/opentelemetry.svg"} -GROUPS = { - "Channels": { - "bub-discord", - "bub-dingtalk", - "bub-feishu", - "bub-qq", - "bub-wechat", - "bub-wecom", - "bub-slack", - "bub-acp-server", - "bub-mcp-server", - }, - "Tools": {"bub-mcp", "bub-schedule", "bub-web-search"}, -} -OVERRIDES = {} # Package name -> explicitly curated field values, applied after source metadata. - - -class CatalogDumper(yaml.SafeDumper): - def increase_indent(self, flow=False, indentless=False): - return super().increase_indent(flow, False) - - -def normalized(name): - return re.sub(r"[-_.]+", "-", name).lower() - - -def sync(source, catalog): - original = catalog.read_text(encoding="utf-8") - data = yaml.safe_load(original) - groups = next(c for c in data["categories"] if c["name"] == "Plugins")[ - "subcategories" - ] - existing = [ - item - for c in data["categories"] - for g in c["subcategories"] - for item in g["items"] - if item["kind"] == "plugin" - ] - changed = False - for manifest in sorted((source / "packages").glob("*/pyproject.toml")): - project = tomllib.loads(manifest.read_text(encoding="utf-8"))["project"] - if not project.get("entry-points", {}).get("bub"): - continue - name, path = project["name"], manifest.parent.relative_to(source).as_posix() - key = normalized(name) - matches = [ - item - for item in existing - if normalized(item["name"]) == key - or ( - item.get("repo_url", "").rstrip("/").removesuffix(".git").lower() - == REPO.lower() - and item.get("source_path") == path - ) - ] - if len(matches) > 1: - continue - if matches: - item = matches[0] - if ( - item.get("repo_url", "").rstrip("/").removesuffix(".git").lower() - != REPO.lower() - ): - continue - else: - group = next( - (g for g in GROUPS if key in GROUPS[g]), - "Storage & Memory" - if "tapestore" in key or "tape-dataset" in key - else "Runtime & Workflow", - ) - item = { - "name": name, - "kind": "plugin", - "logo": LOGOS.get(key, "/plugin.svg"), - "homepage_url": f"{REPO}/tree/main/{path}", - "repo_url": REPO, - "source_path": path, - "install": f"bub install {name}@main", - "builtin": False, - } - next(g for g in groups if g["name"] == group)["items"].append(item) - existing.append(item) - changed = True - metadata = {} - description = project.get("description", "").strip() - if description and description != "Add your description here": - metadata["description"] = " ".join(description.split()) - elif "description" not in item: - metadata["description"] = f"Bub plugin: {name}." - authors = [ - author["name"] - for author in project.get("authors", []) - if author.get("name") - ] - if authors: - metadata["author"] = ", ".join(authors) - if isinstance(project.get("license"), str): - metadata["license"] = project["license"] - metadata.update(OVERRIDES.get(key, {})) - changed |= any(item.get(field) != value for field, value in metadata.items()) - item.update(metadata) - if changed: - catalog.write_text( - yaml.dump( - data, - Dumper=CatalogDumper, - sort_keys=False, - allow_unicode=True, - width=88, - ), - encoding="utf-8", - ) - return changed - - -if __name__ == "__main__": - parser = argparse.ArgumentParser(description=__doc__) - parser.add_argument("source", type=Path) - parser.add_argument("--catalog", type=Path, default=Path("data.yml")) - args = parser.parse_args() - if sync(args.source, args.catalog): - print("Updated contrib catalog.") diff --git a/tests/test_sync_bub_contrib.py b/tests/test_sync_bub_contrib.py deleted file mode 100644 index 8d857a8..0000000 --- a/tests/test_sync_bub_contrib.py +++ /dev/null @@ -1,81 +0,0 @@ -import tempfile -import unittest -from pathlib import Path - -import yaml - -from scripts.sync_bub_contrib import REPO, sync - - -class SyncTests(unittest.TestCase): - def test_update_add_deduplicate_and_repeat(self): - with tempfile.TemporaryDirectory() as directory: - root = Path(directory) - catalog = root / "data.yml" - curated = { - "name": "BUB_Example", - "kind": "plugin", - "description": "Old", - "repo_url": REPO, - "source_path": "packages/bub-example", - "logo": "/mcp.svg", - "install": "curated install", - } - unrelated = {"name": "friend", "kind": "friend", "description": "Keep me"} - groups = [ - {"name": name, "items": [curated, unrelated] if name == "Tools" else []} - for name in ( - "Channels", - "Tools", - "Runtime & Workflow", - "Storage & Memory", - ) - ] - catalog.write_text( - yaml.safe_dump( - {"categories": [{"name": "Plugins", "subcategories": groups}]} - ) - ) - for name in ( - "bub-example", - "bub-docker-env", - "bub-tapestore-otel", - "bub-slack", - ): - package = root / "packages" / name - package.mkdir(parents=True) - (package / "pyproject.toml").write_text( - f'[project]\nname = "{name}"\ndescription = "Updated summary"\nauthors = [{{name = "Author"}}]\n[project.entry-points.bub]\nplugin = "plugin"\n' - ) - self.assertTrue(sync(root, catalog)) - groups = yaml.safe_load(catalog.read_text())["categories"][0][ - "subcategories" - ] - items = {item["name"]: item for group in groups for item in group["items"]} - self.assertEqual(len(items), 5) - self.assertEqual(items["BUB_Example"]["description"], "Updated summary") - self.assertEqual(items["BUB_Example"]["author"], "Author") - self.assertEqual(items["BUB_Example"]["logo"], "/mcp.svg") - self.assertEqual(items["BUB_Example"]["install"], "curated install") - self.assertEqual(items["friend"], unrelated) - self.assertEqual(items["bub-docker-env"]["logo"], "/docker.svg") - self.assertEqual(items["bub-tapestore-otel"]["logo"], "/opentelemetry.svg") - self.assertEqual(groups[0]["items"][0]["name"], "bub-slack") - before = catalog.read_bytes() - self.assertFalse(sync(root, catalog)) - self.assertEqual(catalog.read_bytes(), before) - catalog.write_text( - catalog.read_text().replace("BUB_Example", "Display name") - ) - self.assertFalse(sync(root, catalog)) - - def test_no_plugins_is_quiet(self): - with tempfile.TemporaryDirectory() as directory: - root = Path(directory) - catalog = root / "data.yml" - catalog.write_text( - "categories:\n - name: Plugins\n subcategories: []\n" - ) - before = catalog.read_bytes() - self.assertFalse(sync(root, catalog)) - self.assertEqual(catalog.read_bytes(), before) From 91644bf0fd3535ebba7102e95b9df680cdb61658 Mon Sep 17 00:00:00 2001 From: Chojan Shang Date: Tue, 20 Oct 2026 02:48:23 +0800 Subject: [PATCH 5/5] ci: follow latest Landing for catalog sync --- .github/workflows/sync-bub-contrib.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sync-bub-contrib.yml b/.github/workflows/sync-bub-contrib.yml index c872727..17a0ec6 100644 --- a/.github/workflows/sync-bub-contrib.yml +++ b/.github/workflows/sync-bub-contrib.yml @@ -37,7 +37,7 @@ jobs: git var GIT_AUTHOR_IDENT git var GIT_COMMITTER_IDENT gh auth setup-git - - uses: bubbuild/landing@9014baa64f82893dc194a3f1e31391737f68c426 + - uses: bubbuild/landing@main env: LANDING_MODEL: ${{ vars.LANDING_MODEL }} LANDING_API_KEY: ${{ secrets.LANDING_API_KEY }}