From 6bedcf1f36c747cf9ac464c41eb67a1c5d402529 Mon Sep 17 00:00:00 2001 From: Manfred Riem <15701806+mnriem@users.noreply.github.com> Date: Tue, 1 Dec 2026 14:59:16 -0600 Subject: [PATCH 1/2] feat(docs): generate community integrations directory Render an honest empty state and catalog-derived adapter pages, reuse existing documentation deployment and weekly star refresh, and cover populated fixtures without changing the catalog or runtime. Assisted-by: GitHub Copilot (model: GPT-6.1 Sol, autonomous) Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .github/workflows/docs.yml | 6 + docs/.gitignore | 1 + docs/README.md | 22 +- docs/assets/integration-catalog.js | 60 ++++ docs/community/integrations.md | 9 +- docs/docfx.json | 1 + docs/generate_integrations.py | 262 ++++++++++++++++ docs/integrations/contributing.md | 7 + tests/test_integration_documentation.py | 390 ++++++++++++++++++++++++ 9 files changed, 746 insertions(+), 12 deletions(-) create mode 100644 docs/assets/integration-catalog.js create mode 100644 docs/generate_integrations.py create mode 100644 tests/test_integration_documentation.py diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 25e2e2ff39..6c1f3e4b43 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -8,6 +8,7 @@ on: paths: - 'docs/**' - 'extensions/catalog.community.json' + - 'integrations/catalog.community.json' - 'presets/catalog.community.json' - 'bundles/catalog.community.json' - 'workflows/catalog.community.json' @@ -56,6 +57,11 @@ jobs: env: GH_TOKEN: ${{ github.token }} + - name: Generate community integration documentation + run: python3 docs/generate_integrations.py --fetch-stars + env: + GH_TOKEN: ${{ github.token }} + - name: Generate community preset documentation run: python3 docs/generate_presets.py --fetch-stars env: diff --git a/docs/.gitignore b/docs/.gitignore index 44aa499e96..025f5bdf7d 100644 --- a/docs/.gitignore +++ b/docs/.gitignore @@ -5,6 +5,7 @@ obj/ _generated/ community/presets/ community/extensions/ +community/integrations/ community/bundles/ community/workflows/ community/workflow-steps/ diff --git a/docs/README.md b/docs/README.md index 7e127b6a65..a8286e7080 100644 --- a/docs/README.md +++ b/docs/README.md @@ -12,10 +12,11 @@ To build the documentation locally: dotnet tool install -g docfx ``` -2. Generate the community extension, preset, bundle, workflow, and workflow step directories from the local catalogs: +2. Generate the community extension, integration, preset, bundle, workflow, and workflow step directories from the local catalogs: ```bash python3 docs/generate_extensions.py --fetch-stars + python3 docs/generate_integrations.py --fetch-stars python3 docs/generate_presets.py --fetch-stars python3 docs/generate_bundles.py --fetch-stars python3 docs/generate_workflows.py --fetch-stars @@ -31,17 +32,17 @@ To build the documentation locally: 4. Open your browser to `http://localhost:8080` to view the documentation. -Run the corresponding generator again after editing `extensions/catalog.community.json`, `presets/catalog.community.json`, +Run the corresponding generator again after editing `extensions/catalog.community.json`, `integrations/catalog.community.json`, `presets/catalog.community.json`, `bundles/catalog.community.json`, `workflows/catalog.community.json`, or `workflows/step-catalog.community.json`. They create -the ignored `_generated/extension-directory.md`, `_generated/preset-directory.md`, `_generated/bundle-directory.md`, +the ignored `_generated/extension-directory.md`, `_generated/integration-directory.md`, `_generated/preset-directory.md`, `_generated/bundle-directory.md`, `_generated/workflow-directory.md`, and `_generated/workflow-step-directory.md` -includes and `community/extensions/*.md`, `community/presets/*.md`, `community/bundles/*.md`, +includes and `community/extensions/*.md`, `community/integrations/*.md`, `community/presets/*.md`, `community/bundles/*.md`, `community/workflows/*.md`, and `community/workflow-steps/*.md` detail pages, removing pages for deleted entries. Do not edit these generated files. The directory uses only catalog metadata: -building it does not fetch or execute third-party extension, preset, bundle, workflow, or -executable step-package content. Extension and step pages reuse the workflow directory's +building it does not fetch or execute third-party extension, integration, preset, bundle, workflow, or +executable step-package content. Extension, integration, and step pages reuse the workflow directory's stylesheet and build-time star lookup; only workflows have integration filters. With `--fetch-stars`, it reads star counts from the GitHub API once per repository. Set `GH_TOKEN` or `GITHUB_TOKEN` for authenticated API limits; the deployment @@ -51,6 +52,9 @@ and show "Stars unavailable", never an invented zero. Omit `--fetch-stars` for an offline build with unavailable counts. Search, tag, role/team (bundles), category/effect (extensions), declared integration (workflows), and sort controls enhance complete static listings, which remain readable without JavaScript. +An empty integration catalog shows contribution and built-in integration links +instead of search/filter controls; adding the first entry generates the listing +and detail page automatically. ## Structure @@ -123,7 +127,7 @@ the site homepage. Process command references and authentication remain under - `bundles/catalogs.md` - Bundle catalogs, policies, and release history - `bundles/publishing.md` - Bundle publishing and catalog submission guide - `community/extensions.md` - Catalog-generated community extension directory -- `community/integrations.md` - Community integration discovery and contribution +- `community/integrations.md` - Catalog-generated community integration directory - `community/workflows.md` - Community workflow listing and contribution - `community/workflow-steps.md` - Catalog-generated community step directory - `workflow-steps/decision.md` - Version-specific Decision 0.9.0 dependency notes @@ -138,9 +142,9 @@ the site homepage. Process command references and authentication remain under ## Deployment -Documentation, community preset, bundle, workflow, or workflow step catalog, and docs workflow changes on the +Documentation, community extension, integration, preset, bundle, workflow, or workflow step catalog, and docs workflow changes on the upstream `main` branch trigger the normal GitHub Pages deployment. Each build -generates the preset, bundle, workflow, and workflow step directories and detail pages and refreshes repository star +generates the extension, integration, preset, bundle, workflow, and workflow step directories and detail pages and refreshes repository star counts before running DocFX. A weekly run on Mondays at 04:17 UTC refreshes the site and its build-time star counts, using the same path as manual runs. It does not write star counts back to the catalogs. diff --git a/docs/assets/integration-catalog.js b/docs/assets/integration-catalog.js new file mode 100644 index 0000000000..131ec01c8d --- /dev/null +++ b/docs/assets/integration-catalog.js @@ -0,0 +1,60 @@ +(() => { + const catalog = document.querySelector("[data-integration-catalog]"); + if (!catalog) return; + + const form = catalog.querySelector("[data-integration-controls]"); + const query = form.elements.namedItem("q"); + const tag = form.elements.namedItem("tag"); + const sort = form.elements.namedItem("sort"); + const list = catalog.querySelector(".workflow-results"); + const entries = Array.from(list.children); + const status = catalog.querySelector("[data-integration-status]"); + const empty = catalog.querySelector("[data-integration-empty]"); + const searchable = entries.map((entry) => ({ + entry, + text: entry.dataset.integrationSearch.toLocaleLowerCase(), + tags: JSON.parse(entry.dataset.integrationTags), + })); + const params = new URLSearchParams(window.location.search); + query.value = params.get("q") || ""; + tag.value = params.get("tag") || ""; + if (!tag.value) tag.value = ""; + sort.value = params.get("sort") === "za" ? "za" : "az"; + + function update() { + const words = query.value.trim().toLocaleLowerCase().split(/\s+/).filter(Boolean); + let visible = 0; + for (const item of searchable) { + const matches = words.every((word) => item.text.includes(word)) + && (!tag.value || item.tags.includes(tag.value)); + item.entry.hidden = !matches; + if (matches) visible += 1; + } + const ordered = sort.value === "za" ? [...entries].reverse() : entries; + for (const entry of ordered) list.append(entry); + status.textContent = `${visible} of ${entries.length} integrations`; + empty.hidden = visible !== 0; + + const next = new URL(window.location.href); + for (const [key, value] of [["q", query.value], ["tag", tag.value], ["sort", sort.value === "za" ? "za" : ""]]) { + if (value) next.searchParams.set(key, value); + else next.searchParams.delete(key); + } + window.history.replaceState(null, "", next); + } + + form.addEventListener("input", update); + form.addEventListener("change", update); + form.addEventListener("submit", (event) => { + event.preventDefault(); + update(); + }); + form.addEventListener("reset", () => { + query.value = ""; + tag.value = ""; + sort.value = "az"; + update(); + }); + update(); + form.hidden = false; +})(); diff --git a/docs/community/integrations.md b/docs/community/integrations.md index 26345ebd4c..4db408c069 100644 --- a/docs/community/integrations.md +++ b/docs/community/integrations.md @@ -11,9 +11,12 @@ independently maintained external adapters. ## Available integrations -The [community integration catalog](https://github.com/github/spec-kit/blob/main/integrations/catalog.community.json) -currently contains no entries. Built-in integrations ship with the CLI and are -listed separately in the integration directory. +[!INCLUDE [Community integration directory](../_generated/integration-directory.md)] + +This directory is generated from the +[community integration catalog](https://github.com/github/spec-kit/blob/main/integrations/catalog.community.json). +Built-in integrations ship with the CLI and are listed separately in the +[integration directory](../integrations/index.md). Inspect the sources active in your project and search their metadata: diff --git a/docs/docfx.json b/docs/docfx.json index f72b07a638..e768798fc4 100644 --- a/docs/docfx.json +++ b/docs/docfx.json @@ -8,6 +8,7 @@ "community/*.md", "community/presets/*.md", "community/extensions/*.md", + "community/integrations/*.md", "community/bundles/*.md", "community/workflows/*.md", "community/workflow-steps/*.md", diff --git a/docs/generate_integrations.py b/docs/generate_integrations.py new file mode 100644 index 0000000000..5f5a794a1e --- /dev/null +++ b/docs/generate_integrations.py @@ -0,0 +1,262 @@ +"""Generate the community integration directory and external adapter detail pages.""" + +import argparse +import json +import re +from ipaddress import ip_address +from pathlib import Path +from urllib.parse import urlsplit + +if __package__: + from . import generate_workflows as shared +else: + import generate_workflows as shared + + +ROOT = Path(__file__).resolve().parent.parent +escape = shared.escape_metadata + + +def tools(entry: dict) -> list[str]: + values = entry.get("requires", {}).get("tools", []) + if values is None: + return [] + if not isinstance(values, list): + raise ValueError(f"{entry['id']}.requires.tools must be a list") + result = [] + for tool in values: + if not isinstance(tool, dict): + raise ValueError(f"{entry['id']}: tool requirement must be an object") + name = shared.text(tool.get("name"), "tool name") + if "version" in tool: + if not isinstance(tool["version"], str): + raise ValueError("tool version must be a string") + if tool["version"]: + name += " " + tool["version"] + if "required" in tool and not isinstance(tool["required"], bool): + raise ValueError("tool required must be a boolean") + if not tool.get("required", True): + name += " (optional)" + result.append(name) + return result + + +def archive_url(value: object, context: str) -> None: + parsed = urlsplit(shared.text(value, context)) + if parsed.scheme == "http": + host = parsed.hostname + loopback = host == "localhost" + if host and not loopback: + try: + loopback = ip_address(host).is_loopback + except ValueError: + loopback = False + if loopback: + shared.url(parsed._replace(scheme="https").geturl(), context) + return + shared.url(value, context) + + +def load_integrations(catalog_path: Path) -> list[dict]: + catalog = json.loads(catalog_path.read_text(encoding="utf-8"), object_pairs_hook=shared.unique_keys) + if not isinstance(catalog, dict) or catalog.get("schema_version") != "1.0": + raise ValueError("integration catalog must be an object with schema_version 1.0") + entries = catalog.get("integrations") + if not isinstance(entries, dict): + raise ValueError("integration catalog must contain an integrations object") + result = [] + for key, metadata in entries.items(): + if ( + not re.fullmatch(r"[a-z0-9][a-z0-9-]*", key) + or key in {"con", "prn", "aux", "nul"} + or re.fullmatch(r"(com|lpt)[1-9]", key) + ): + raise ValueError(f"invalid external integration ID: {key}") + if not isinstance(metadata, dict) or metadata.get("id", key) != key: + raise ValueError(f"{key}: entry ID must match its catalog key") + entry = {**metadata, "id": key} + for field in ("name", "description", "version"): + shared.text(entry.get(field), f"{key}.{field}") + for field in ("author", "license"): + if field in entry: + shared.text(entry[field], f"{key}.{field}") + if "repository" in entry: + shared.url(entry["repository"], f"{key}.repository") + if "download_url" in entry: + archive_url(entry["download_url"], f"{key}.download_url") + requires = entry.get("requires", {}) + if not isinstance(requires, dict): + raise ValueError(f"{key}.requires must be an object") + if "speckit_version" in requires: + shared.text(requires["speckit_version"], f"{key}.requires.speckit_version") + tools(entry) + tags = entry.get("tags", []) + if not isinstance(tags, list): + raise ValueError(f"{key}.tags must be a list") + for tag in tags: + shared.text(tag, f"{key}.tags") + if "sha256" in entry and ( + not isinstance(entry["sha256"], str) + or not re.fullmatch(r"[a-fA-F0-9]{64}", entry["sha256"]) + ): + raise ValueError(f"{key}.sha256 must contain 64 hexadecimal digits") + result.append(entry) + return sorted(result, key=lambda entry: (entry["name"].casefold(), entry["name"], entry["id"])) + + +def directory(entries: list[dict], stars: dict[str, int | None]) -> str: + header = "\n" + if not entries: + return header + """
External adapters added to the community catalog will appear here. +For agents that ship with the CLI, browse the built-in integrations. +To contribute an external adapter, follow the catalog submission guide.
+""" + tags = sorted({tag for entry in entries for tag in entry.get("tags", [])}, + key=lambda tag: (tag.casefold(), tag)) + options = "".join(f'' for tag in tags) + rows = [] + for entry in entries: + search = " ".join( + [entry[field] for field in ("id", "name", "description")] + + [entry.get("author", "")] + entry.get("tags", []) + tools(entry) + ) + badges = "".join(f'{escape(tag)}' for tag in entry.get("tags", [])) + rows.append( + f'{escape(entry["description"])}
' + f'' + f'{len(entries)} integrations
+No integrations match these filters. Try another search or clear the filters.
+Review the catalog-listed package archive ' + f'for version {escape(entry["version"])} before installation.
' + if entry.get("download_url") else + "No package archive URL is listed. External installation requires a reachable " + "package archive in an install-allowed catalog; a repository link is not enough.
" + ) + checksum = ( + f'Catalog SHA-256: {escape(entry["sha256"])}. '
+ "The installer checks this digest when supplied by the selected catalog.
No SHA-256 digest is listed. Obtain and verify an integrity digest from " + "a source you trust before installation.
" + ) + return f""" + + +Back to community integrations
+{escape(entry["description"])}
+{repository}
+Requirements and tags are author-declared metadata, not enforced permissions or +a sandbox. Missing metadata does not imply compatibility or absence of side effects. +Repository stars reflect the last documentation build, not a safety assessment.
+This adapter is independently maintained. Maintainers check catalog metadata only; +they do not review, audit, endorse, or support adapter implementations. +You must vet the exact release, Python code, dependencies, credentials, network access, +generated files, commands, hooks, and side effects before installation and use.
+External adapters adapt the host's commands and extension/preset contributions;
+they do not redistribute a core command inventory. A package needs root
+integration.yml and __init__.py exporting an
+IntegrationBase subclass. Adapter Python executes with your user permissions.
The default community catalog is discovery-only. A listing is not installation
+permission. Inspect specify integration catalog list and project configuration:
+search and info use the active catalog stack, not exclusively this source.
+Install only through a separately vetted, explicitly install-allowed catalog.
+Neither --force nor --trust-integration bypasses source policy.
A digest checks archive integrity, not code safety. There is no direct-URL or local
+installation route. After reviewing the source and selected catalog's current release,
+follow the external adapter installation guide.
+Installation prompts before downloading/importing Python; do not pre-authorize
+execution with --trust-integration before reviewing the code.
Historical catalog releases are metadata only, not installable versions. +Test unfamiliar adapters in a disposable project.
+