// PEP-243: the platform is called FORGE in everything a person reads; the old names stay only in // internal identifiers (CLI, env, MCP server). A second address serves the same web. import assert from "node:assert/strict"; import { readdirSync, readFileSync } from "node:fs"; import { describe, test } from "node:test"; import { PRODUCT_NAME, productName, t } from "@peppa/shared/i18n"; const root = new URL("../../../", import.meta.url).pathname; const read = (p: string) => readFileSync(root + p, "utf8"); describe("PEP-243: платформа называется FORGE", () => { test("Сценарий: название на всех языках — FORGE", () => { assert.equal(PRODUCT_NAME, "FORGE"); for (const locale of ["ru", "en", "kk"] as const) assert.equal(productName(locale), "FORGE"); assert.match(t("en", "Подписка FORGE"), /FORGE/); }); test("Сценарий: прежнего названия нет в словарях, логотипе, шаблоне и правилах агентов", () => { const files = [ ...["en", "kk"].flatMap((l) => readdirSync(`${root}packages/shared/src/i18n/${l}`).map((f) => `packages/shared/src/i18n/${l}/${f}`)), "packages/shared/src/i18n/index.ts", "apps/web/components/Brand.tsx", "apps/web/app/manifest.ts", "template/RULES.md", "template/AGENTS.md", "template/README.md", "packages/core/src/help-texts.ts", ]; // «Peppa» остаётся только именем приложения OAuth2 в Gitea (внешний объект) в подсказке суперадмину. for (const f of files) assert.doesNotMatch(read(f).replaceAll("OAuth2 «Peppa»", ""), /Peppa FACTORY|Пепп[аыеу]|\bPeppa\b(?!Error)/, `${f} still has the old name`); assert.match(read("apps/web/components/Brand.tsx"), /FORGE/); }); test("Сценарий: прежнее название в новом тексте — проверка словаря его запрещает", () => { for (const f of ["docs/glossary.md", "template/docs/glossary.md"]) { const row = read(f).split("\n").find((l) => l.startsWith("| Название продукта |"))!; const [, , write, never] = row.split("|").map((c) => c.trim()); assert.equal(write, "FORGE"); for (const w of ["Пеппа", "Peppa", "Peppa FACTORY"]) assert.ok(never.split(", ").includes(w), `${f}: «${w}» must be forbidden`); assert.ok(!never.split(", ").includes("FORGE")); } }); test("Сценарий: новый адрес рядом со старым — оба ведут на сервер", () => { const route = read("scripts/server-move/mac-route.sh"); assert.match(route, /Host\(`peppa\.telecom\.quest`\) \|\| Host\(`forge\.telecom\.quest`\)/); // The web takes its origin from the request, so login and /mcp work on either address. assert.match(read("apps/web/lib/auth.ts"), /x-forwarded-host/); }); });