diff options
| author | Leitwolf | 2026-11-17 21:27:26 +0300 |
|---|---|---|
| committer | GitHub | 2026-11-17 21:27:26 +0300 |
| commit | 5d1d576171ba94f41d51e722f2f55b8509aff0bb (patch) | |
| tree | c92c801f712a76a9c96aa5cf973b2f809d5f242d | |
| parent | 289bd7665435dabba53f7923791bccabfb8d63d4 (diff) | |
| parent | 5e122d8bd74b96f8e02d23f8662c0b6ebaa564f3 (diff) | |
| download | progmaweb-site/catch3-uk-own-site.tar.gz | |
Merge branch 'main' into site/catch3-uk-own-sitesite/catch3-uk-own-site
| -rw-r--r-- | apps/web/app/llms.txt/route.ts | 27 | ||||
| -rw-r--r-- | apps/web/app/page.tsx | 3 | ||||
| -rw-r--r-- | apps/web/app/products/[slug]/page.tsx | 3 | ||||
| -rw-r--r-- | apps/web/app/products/page.tsx | 3 | ||||
| -rw-r--r-- | apps/web/components/JsonLd.tsx | 22 | ||||
| -rw-r--r-- | apps/web/lib/catalog-messages.ts | 16 | ||||
| -rw-r--r-- | apps/web/lib/llms.ts | 58 | ||||
| -rw-r--r-- | apps/web/lib/products.ts | 12 | ||||
| -rw-r--r-- | apps/web/lib/structured-data.ts | 125 | ||||
| -rw-r--r-- | apps/web/proxy.ts | 2 | ||||
| -rw-r--r-- | apps/web/tests/structured-data.test.mjs | 95 |
11 files changed, 351 insertions, 15 deletions
diff --git a/apps/web/app/llms.txt/route.ts b/apps/web/app/llms.txt/route.ts new file mode 100644 index 0000000..a2ab831 --- /dev/null +++ b/apps/web/app/llms.txt/route.ts @@ -0,0 +1,27 @@ +// SPDX-FileCopyrightText: 2026 Progmasoft <support@progmasoft.com> +// SPDX-License-Identifier: AGPL-3.0-or-later + +import { headers } from "next/headers"; +import { llmsText } from "@/lib/llms"; +import { requestHost } from "@/lib/localization"; + +/** progmasoft.com/llms.txt; the other hosts of Progmaweb have none. */ +export async function GET(): Promise<Response> { + const requestHeaders = await headers(); + const host = requestHost( + requestHeaders.get("x-forwarded-host"), + requestHeaders.get("host"), + ); + if (host !== "progmasoft.com" && host !== "www.progmasoft.com") { + return new Response("Not found\n", { + status: 404, + headers: { "content-type": "text/plain; charset=utf-8" }, + }); + } + return new Response(llmsText(), { + headers: { + "content-type": "text/markdown; charset=utf-8", + "cache-control": "public, max-age=3600", + }, + }); +} diff --git a/apps/web/app/page.tsx b/apps/web/app/page.tsx index 27dcda1..58f6f2d 100644 --- a/apps/web/app/page.tsx +++ b/apps/web/app/page.tsx @@ -3,11 +3,13 @@ import type { Metadata } from "next"; import { Footer } from "@/components/Footer"; +import { JsonLd } from "@/components/JsonLd"; import { SiteHeader } from "@/components/SiteHeader"; import { AreaIcon, areaKinds } from "@/components/site/AreaIcon"; import { getHomeMessages } from "@/lib/home-messages"; import { getLocale } from "@/lib/locale.server"; import { forwardArrow, getMessages } from "@/lib/localization"; +import { organizationData, websiteData } from "@/lib/structured-data"; import "./site.css"; export async function generateMetadata(): Promise<Metadata> { @@ -30,6 +32,7 @@ export default async function Homepage() { const arrow = forwardArrow(locale); return ( <div className="pm-page"> + <JsonLd data={[organizationData(), websiteData(locale)]} /> <SiteHeader locale={locale} /> <main> <section className="pm-hero"> diff --git a/apps/web/app/products/[slug]/page.tsx b/apps/web/app/products/[slug]/page.tsx index 664278b..522d8b1 100644 --- a/apps/web/app/products/[slug]/page.tsx +++ b/apps/web/app/products/[slug]/page.tsx @@ -9,9 +9,11 @@ import { formatDay, StatusBadge, } from "@/components/ProductCatalog"; +import { JsonLd } from "@/components/JsonLd"; import { getLocale } from "@/lib/locale.server"; import { forwardArrow } from "@/lib/localization"; import { getCatalogMessages, isProductSlug, products } from "@/lib/products"; +import { productData } from "@/lib/structured-data"; interface ProductPageProps { params: Promise<{ slug: string }>; @@ -52,6 +54,7 @@ export default async function ProductPage({ params }: ProductPageProps) { title={product.name} description={text.description} > + <JsonLd data={productData(slug, locale)} /> <section className="pm-section"> <div className="pm-shell pm-detail"> <div> diff --git a/apps/web/app/products/page.tsx b/apps/web/app/products/page.tsx index 38cb0a4..1c1aa53 100644 --- a/apps/web/app/products/page.tsx +++ b/apps/web/app/products/page.tsx @@ -1,6 +1,8 @@ // SPDX-FileCopyrightText: 2026 Progmasoft <support@progmasoft.com> // SPDX-License-Identifier: AGPL-3.0-or-later +import { JsonLd } from "@/components/JsonLd"; +import { catalogData } from "@/lib/structured-data"; import type { Metadata } from "next"; import Link from "next/link"; import { @@ -62,6 +64,7 @@ export default async function ProductsPage({ searchParams }: CatalogProps) { title={catalog.title} description={catalog.description} > + <JsonLd data={catalogData(locale)} /> <section className="pm-section"> <div className="pm-shell pm-index"> <dl className="pm-stats"> diff --git a/apps/web/components/JsonLd.tsx b/apps/web/components/JsonLd.tsx new file mode 100644 index 0000000..58ef007 --- /dev/null +++ b/apps/web/components/JsonLd.tsx @@ -0,0 +1,22 @@ +// SPDX-FileCopyrightText: 2026 Progmasoft <support@progmasoft.com> +// SPDX-License-Identifier: AGPL-3.0-or-later + +import { headers } from "next/headers"; +import { nonceHeader } from "@/lib/content-security-policy"; +import { jsonLd } from "@/lib/structured-data"; + +/** + * schema.org data of a page as a JSON-LD script element. Browsers do not run + * it; it carries the nonce of the page all the same, as every script element + * of the site does. + */ +export async function JsonLd({ data }: { data: unknown }) { + const nonce = (await headers()).get(nonceHeader) ?? undefined; + return ( + <script + type="application/ld+json" + nonce={nonce} + dangerouslySetInnerHTML={{ __html: jsonLd(data) }} + /> + ); +} diff --git a/apps/web/lib/catalog-messages.ts b/apps/web/lib/catalog-messages.ts index eaf4572..39f5c89 100644 --- a/apps/web/lib/catalog-messages.ts +++ b/apps/web/lib/catalog-messages.ts @@ -170,12 +170,12 @@ export const catalogMessages: Record<Locale, CatalogMessages> = { catch3: { tagline: "C++ testing beyond assertions.", description: - "Catch3 keeps Catch2 compatibility and adds a native property-testing engine, with more kinds of testing on its roadmap.", + "Catch3 keeps Catch2 compatibility and adds a runner of its own, property tests, mocks, snapshots and structured results.", features: [ "Catch2-compatible tests", "Property, stateful and metamorphic tests with shrinking", "Text snapshots and JUnit-style XML results", - "Planned: own runner, mocking, coverage and mutation testing", + "Its own runner with parallel workers, retries, history and per-test coverage, and mocks", ], }, agenceland: { @@ -300,12 +300,12 @@ export const catalogMessages: Record<Locale, CatalogMessages> = { catch3: { tagline: "C++-Tests jenseits von Assertions.", description: - "Catch3 bleibt Catch2-kompatibel und ergänzt eine native Engine für eigenschaftsbasierte Tests; weitere Testarten stehen auf dem Fahrplan.", + "Catch3 bleibt Catch2-kompatibel und ergänzt einen eigenen Runner, eigenschaftsbasierte Tests, Mocks, Snapshots und strukturierte Ergebnisse.", features: [ "Catch2-kompatible Tests", "Eigenschafts-, zustandsbehaftete und metamorphe Tests mit Verkleinerung", "Text-Snapshots und XML-Ergebnisse im JUnit-Stil", - "Geplant: eigener Runner, Mocking, Abdeckung und Mutationstests", + "Ein eigener Runner mit parallelen Workern, Wiederholungen, Historie und Abdeckung pro Test, dazu Mocks", ], }, agenceland: { @@ -431,12 +431,12 @@ export const catalogMessages: Record<Locale, CatalogMessages> = { catch3: { tagline: "Тестирование C++ за пределами утверждений.", description: - "Catch3 сохраняет совместимость с Catch2 и добавляет собственный движок тестирования на основе свойств; другие виды тестирования — в планах.", + "Catch3 сохраняет совместимость с Catch2 и добавляет собственный запускатель, тесты свойств, моки, снимки и структурированные результаты.", features: [ "Тесты, совместимые с Catch2", "Тесты свойств, с состоянием и метаморфные, с упрощением", "Текстовые снимки и результаты в XML в стиле JUnit", - "В планах: свой запускатель, моки, покрытие и мутационное тестирование", + "Свой запускатель с параллельными процессами, повторами, историей и покрытием по тестам, а также моки", ], }, agenceland: { @@ -561,12 +561,12 @@ export const catalogMessages: Record<Locale, CatalogMessages> = { catch3: { tagline: "בדיקות C++ מעבר לטענות.", description: - "Catch3 שומרת על תאימות ל־Catch2 ומוסיפה מנוע בדיקות מבוססות תכונות משלה; סוגי בדיקות נוספים נמצאים בתוכנית.", + "Catch3 שומרת על תאימות ל־Catch2 ומוסיפה מריץ משלה, בדיקות תכונות, אובייקטים מדומים, תמונות מצב ותוצאות מובנות.", features: [ "בדיקות תואמות Catch2", "בדיקות תכונות, בדיקות עם מצב ובדיקות מטמורפיות, עם צמצום", "תמונות מצב טקסטואליות ותוצאות XML בסגנון JUnit", - "בתוכנית: מריץ משלה, אובייקטים מדומים, כיסוי ובדיקות מוטציה", + "מריץ משלה עם תהליכים מקבילים, ניסיונות חוזרים, היסטוריה וכיסוי לכל בדיקה, ואובייקטים מדומים", ], }, agenceland: { diff --git a/apps/web/lib/llms.ts b/apps/web/lib/llms.ts new file mode 100644 index 0000000..40de69a --- /dev/null +++ b/apps/web/lib/llms.ts @@ -0,0 +1,58 @@ +// SPDX-FileCopyrightText: 2026 Progmasoft <support@progmasoft.com> +// SPDX-License-Identifier: AGPL-3.0-or-later + +import { catalogMessages } from "./catalog-messages.ts"; +import { productSlugs, products } from "./products.ts"; + +/** + * progmasoft.com/llms.txt: what Progmasoft makes, in the Markdown form of + * llmstxt.org, for language models and the tools that read the site for + * them. It is written from the product catalog, so a project's status, its + * latest release and its license are the ones the catalog shows. + */ +export function llmsText(): string { + const english = catalogMessages["en-US"].products; + const projects = productSlugs.map((slug) => { + const product = products[slug]; + const release = product.latestRelease + ? `latest release ${product.latestRelease.version} (${product.latestRelease.date})` + : "in development, no release"; + const site = product.site ? `; site ${product.site}` : ""; + return ( + `- [${product.name}](https://product.progmasoft.com/${slug}): ${english[slug].tagline} ` + + `${english[slug].description} Written in ${product.language}; ${release}; ` + + `license ${product.license}; source ${product.source}${site}.` + ); + }); + return `# Progmasoft + +> Progmasoft makes open-source developer tools and data infrastructure: a build system, a C++ test framework, an +> agentic IDE, and a columnar data format with a data engine for the JVM. Every project is developed in public on +> GitHub under github.com/Progmasoft. + +Progmasoft is not a company. Only the projects listed below are developed. Repositories of the Progmasoft organization +on GitHub that are archived are no longer developed, and so are packages of Progmasoft marked deprecated on a package +registry. + +## Projects + +${projects.join("\n")} + +## Services + +- [Progmasoft Account](https://account.progmasoft.com/): one account for the services of Progmasoft; its name is also + the publisher name on ViGet. +- [ViGet](https://viget.progmasoft.com/): the package registry of Progmasoft, for C, C++ and Objective-C packages and + for the DSL plugins of build systems. +- [Progmasoft Console](https://console.progmasoft.com/): OAuth 2.1 and OpenID Connect clients for applications that + sign people in with their Progmasoft Account. +- [Progmasoft Git](https://git.progmasoft.com/): read-only mirrors of the public repositories; issues and pull + requests are on GitHub. + +## Optional + +- [Product catalog](https://product.progmasoft.com/): every project with its category, language, status and release. +- [Privacy Policy](https://progmasoft.com/privacy) +- [Security Policy](https://progmasoft.com/security) +`; +} diff --git a/apps/web/lib/products.ts b/apps/web/lib/products.ts index 80de402..adb481f 100644 --- a/apps/web/lib/products.ts +++ b/apps/web/lib/products.ts @@ -70,8 +70,6 @@ export interface ProductFacts { accent: "violet" | "blue" | "green" | "orange" | "teal" | "slate"; } -const progmasoftLicense = "MPL-2.0 WITH AdditionRef-Progmasoft-Exception-2.0"; - function github(name: string) { return { source: `https://github.com/Progmasoft/${name}`, @@ -84,7 +82,7 @@ export const products: Record<ProductSlug, ProductFacts> = { name: "Tazel", site: "https://tazel.net/", ...github("tazel"), - license: progmasoftLicense, + license: "MIT", language: "Kotlin", category: "build", status: "development", @@ -95,7 +93,9 @@ export const products: Record<ProductSlug, ProductFacts> = { name: "Catch3", site: "https://catch3.uk/", ...github("catch3"), - license: "BSL-1.0", + // Files from Catch2 keep the Boost licence; Progmasoft's own files are + // LGPL-3.0-or-later from 0.5.0 on. + license: "BSL-1.0 AND LGPL-3.0-or-later", language: "C++", category: "testing", status: "released", @@ -120,7 +120,7 @@ export const products: Record<ProductSlug, ProductFacts> = { archer: { name: "Archer", ...github("archer"), - license: progmasoftLicense, + license: "MIT", language: "Java", category: "data-format", status: "development", @@ -130,7 +130,7 @@ export const products: Record<ProductSlug, ProductFacts> = { etincelle: { name: "Etincelle", ...github("etincelle"), - license: progmasoftLicense, + license: "MIT", language: "Java", category: "data-processing", status: "development", diff --git a/apps/web/lib/structured-data.ts b/apps/web/lib/structured-data.ts new file mode 100644 index 0000000..4f574ee --- /dev/null +++ b/apps/web/lib/structured-data.ts @@ -0,0 +1,125 @@ +// SPDX-FileCopyrightText: 2026 Progmasoft <support@progmasoft.com> +// SPDX-License-Identifier: AGPL-3.0-or-later + +import { catalogMessages } from "./catalog-messages.ts"; +import type { Locale } from "./localization"; +import { productSlugs, products, type ProductSlug } from "./products.ts"; + +/** + * schema.org data that search engines read from the pages, as JSON-LD. + * + * Progmasoft is described as an `Organization`, the general type; the + * projects as `SoftwareSourceCode`, since each is open source with a public + * repository. A project's text comes in the language of the page. + */ + +const organizationId = "https://progmasoft.com/#organization"; + +/** Progmasoft itself, for progmasoft.com. */ +export function organizationData() { + return { + "@context": "https://schema.org", + "@type": "Organization", + "@id": organizationId, + name: "Progmasoft", + url: "https://progmasoft.com/", + logo: "https://progmasoft.com/apple-icon.png", + email: "support@progmasoft.com", + sameAs: ["https://github.com/Progmasoft"], + }; +} + +/** The site progmasoft.com, published by Progmasoft. */ +export function websiteData(locale: Locale) { + return { + "@context": "https://schema.org", + "@type": "WebSite", + name: "Progmasoft", + url: "https://progmasoft.com/", + inLanguage: locale, + publisher: { "@id": organizationId }, + }; +} + +/** + * The URLs of the licenses of an SPDX expression: one per license it names. + * `A AND B` and `A OR B` name two; `A WITH E` names A. + */ +export function licenseUrls(expression: string): string[] { + return expression + .split(/\s+(?:AND|OR)\s+/) + .map((term) => + term + .replace(/[()]/g, "") + .split(/\s+WITH\s+/)[0] + ?.trim(), + ) + .filter((id): id is string => Boolean(id)) + .map((id) => `https://spdx.org/licenses/${id}.html`); +} + +/** One project, for its page on product.progmasoft.com. */ +export function productData(slug: ProductSlug, locale: Locale) { + const product = products[slug]; + const text = catalogMessages[locale].products[slug]; + const licenses = licenseUrls(product.license); + return { + "@context": "https://schema.org", + "@type": "SoftwareSourceCode", + "@id": `https://product.progmasoft.com/${slug}#project`, + name: product.name, + alternateName: `Progmasoft ${product.name}`, + description: text.description, + abstract: text.tagline, + url: `https://product.progmasoft.com/${slug}`, + ...(product.site ? { sameAs: [product.site] } : {}), + codeRepository: product.source, + discussionUrl: product.issues, + programmingLanguage: product.language, + license: licenses.length === 1 ? licenses[0] : licenses, + dateCreated: product.started, + creativeWorkStatus: + product.status === "released" ? "Released" : "In development", + ...(product.latestRelease + ? { + version: product.latestRelease.version, + dateModified: product.latestRelease.date, + } + : {}), + keywords: text.features.join(", "), + inLanguage: locale, + author: { "@id": organizationId }, + publisher: { + "@type": "Organization", + "@id": organizationId, + name: "Progmasoft", + url: "https://progmasoft.com/", + }, + }; +} + +/** The catalog of product.progmasoft.com: every project, in catalog order. */ +export function catalogData(locale: Locale) { + return { + "@context": "https://schema.org", + "@type": "ItemList", + name: "Progmasoft projects", + url: "https://product.progmasoft.com/", + numberOfItems: productSlugs.length, + itemListElement: productSlugs.map((slug, index) => ({ + "@type": "ListItem", + position: index + 1, + url: `https://product.progmasoft.com/${slug}`, + name: products[slug].name, + description: catalogMessages[locale].products[slug].tagline, + })), + }; +} + +/** + * The text of a JSON-LD script element. `<` is escaped so that no string in + * the data can close the element. + */ +export function jsonLd(data: unknown): string { + return JSON.stringify(data).replace(/</g, "\\u003c"); +} diff --git a/apps/web/proxy.ts b/apps/web/proxy.ts index f482240..075c618 100644 --- a/apps/web/proxy.ts +++ b/apps/web/proxy.ts @@ -263,6 +263,6 @@ function internalRoute(request: NextRequest, pathname: string): URL { export const config = { matcher: [ - "/((?!_next/static|_next/image|favicon.ico|icon.svg|apple-icon.png|robots.txt|sitemap.xml).*)", + "/((?!_next/static|_next/image|favicon.ico|icon.svg|apple-icon.png|robots.txt|sitemap.xml|llms.txt).*)", ], }; diff --git a/apps/web/tests/structured-data.test.mjs b/apps/web/tests/structured-data.test.mjs new file mode 100644 index 0000000..a751742 --- /dev/null +++ b/apps/web/tests/structured-data.test.mjs @@ -0,0 +1,95 @@ +// SPDX-FileCopyrightText: 2026 Progmasoft <support@progmasoft.com> +// SPDX-License-Identifier: AGPL-3.0-or-later + +import assert from "node:assert/strict"; +import test from "node:test"; +import { llmsText } from "../lib/llms.ts"; +import { supportedLocales } from "../lib/localization.ts"; +import { productSlugs, products } from "../lib/products.ts"; +import { + catalogData, + jsonLd, + licenseUrls, + organizationData, + productData, + websiteData, +} from "../lib/structured-data.ts"; + +const locales = supportedLocales; + +test("an SPDX expression gives one URL per license it names", () => { + assert.deepEqual(licenseUrls("MIT"), ["https://spdx.org/licenses/MIT.html"]); + assert.deepEqual(licenseUrls("BSL-1.0 AND LGPL-3.0-or-later"), [ + "https://spdx.org/licenses/BSL-1.0.html", + "https://spdx.org/licenses/LGPL-3.0-or-later.html", + ]); + assert.deepEqual(licenseUrls("(MIT OR Apache-2.0)"), [ + "https://spdx.org/licenses/MIT.html", + "https://spdx.org/licenses/Apache-2.0.html", + ]); + assert.deepEqual(licenseUrls("GPL-2.0-only WITH Classpath-exception-2.0"), [ + "https://spdx.org/licenses/GPL-2.0-only.html", + ]); +}); + +test("every project has its data in every language", () => { + for (const slug of productSlugs) { + for (const locale of locales) { + const data = productData(slug, locale); + assert.equal(data["@type"], "SoftwareSourceCode"); + assert.equal(data.name, products[slug].name); + assert.equal(data.codeRepository, products[slug].source); + assert.equal(data.inLanguage, locale); + assert.ok(data.description.length > 20, `${slug} ${locale}`); + assert.ok(data.license, `${slug} has a license`); + assert.equal(data.version, products[slug].latestRelease?.version); + } + } +}); + +test("a released project names its version, one in development does not", () => { + assert.equal(productData("catch3", "en-US").creativeWorkStatus, "Released"); + assert.equal( + productData("tazel", "en-US").creativeWorkStatus, + "In development", + ); + assert.equal(productData("tazel", "en-US").version, undefined); +}); + +test("the catalog lists every project in order", () => { + const data = catalogData("en-US"); + assert.equal(data.numberOfItems, productSlugs.length); + assert.deepEqual( + data.itemListElement.map((item) => item.position), + productSlugs.map((_, index) => index + 1), + ); +}); + +test("the organization and the site point at each other", () => { + assert.equal( + websiteData("en-US").publisher["@id"], + organizationData()["@id"], + ); + assert.equal(organizationData()["@type"], "Organization"); +}); + +test("JSON-LD text cannot close its script element", () => { + const text = jsonLd({ name: "</script><script>alert(1)</script>" }); + assert.ok(!text.includes("</script>")); + assert.deepEqual(JSON.parse(text), { + name: "</script><script>alert(1)</script>", + }); +}); + +test("llms.txt lists every project with its facts and names no former project", () => { + const text = llmsText(); + assert.match(text, /^# Progmasoft\n\n> /); + for (const slug of productSlugs) { + assert.ok(text.includes(`(https://product.progmasoft.com/${slug})`), slug); + assert.ok(text.includes(products[slug].license), `${slug} license`); + } + assert.ok(text.includes("latest release 0.4.0")); + for (const word of ["Tala", "Xide", "Talac", "X#"]) { + assert.ok(!text.includes(word), word); + } +}); |