peppa/packages/testkit/test/live-checkout.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

28 lines
1.3 KiB
TypeScript

// PEP-172: no agent works in the directory FORGE itself runs from (the live copy).
import assert from "node:assert/strict";
import { mkdtempSync, rmSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { describe, test } from "node:test";
import { runner } from "./helpers.ts";
describe("PEP-172: копия живого сайта — не для агентов", () => {
test("каталог, из которого работает FORGE, узнаётся (PEPPA_ROOT, через символьные ссылки тоже)", () => {
const live = mkdtempSync(join(tmpdir(), "mock-live-"));
const other = mkdtempSync(join(tmpdir(), "mock-ws-"));
const prev = process.env.PEPPA_ROOT;
process.env.PEPPA_ROOT = live;
try {
assert.equal(runner.isLiveCheckout(live), true);
assert.equal(runner.isLiveCheckout(`${live}/`), true);
assert.equal(runner.isLiveCheckout(other), false);
assert.equal(runner.isLiveCheckout(join(other, "missing")), false);
} finally {
if (prev === undefined) delete process.env.PEPPA_ROOT;
else process.env.PEPPA_ROOT = prev;
rmSync(live, { recursive: true, force: true });
rmSync(other, { recursive: true, force: true });
}
});
});