peppa/packages/testkit/test/forge-name.test.ts
peppa-bot 10363f8592 PEP-270: задачи агентов — предложения, не больше 5 в сутки на проект
- MCP create_task агента: origin agent + «Предложено» (раньше — задача человека, диспетчер брал её сам)
- AgentLimits.perDay (5, скользящие 24 ч), proposalRoom/proposalsToday; сверх — отказ агенту,
  находки приёмки — в недельную сводку; событие proposal_limited
- CLI agent-limits perDay=N, правило агентам в template/RULES.md, тест proposal-daily-limit

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 17:02:04 +00:00

51 lines
2.9 KiB
TypeScript
Raw 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/);
});
});