peppa/packages/testkit/test/forge-name.test.ts
peppa-bot f3d10a4c25 PEP-243: платформа называется FORGE — название во всех текстах для людей и подсказках агентам, адрес forge.telecom.quest
«Peppa FACTORY» → «FORGE» в экранах, сообщениях, словарях en/kk, шаблоне и тестах; «Пеппа» → «FORGE» в подсказках
агентам и правилах; логотип, значок, версия кэша service worker; в словаре старые названия — в «Нельзя».
Внутренние имена (CLI peppa, PEPPA_*, MCP-сервер peppa, ключи PEP-N) не меняются. Второй адрес — в mac-route.sh.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-23 11:18:49 +05:00

51 lines
2.9 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// 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/);
});
});