fix(docs): validate translated links to canonical product facts
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { EVMOLE_PROVIDER_IDENTITY } from "../../../src/evm/EvmoleRelease.js";
|
||||
import { PWNTOOLS_PROVIDER_IDENTITY } from "../../../src/native/pwntools/PwntoolsRelease.js";
|
||||
import { mkdir, readFile, rm, writeFile } from "node:fs/promises";
|
||||
import { join } from "node:path";
|
||||
import { copyFile, mkdir, readFile, rm, writeFile } from "node:fs/promises";
|
||||
import { dirname, join } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
@@ -273,19 +273,10 @@ describe("canonical product catalog drift", () => {
|
||||
]);
|
||||
});
|
||||
|
||||
it("reports tool-family and setup-client fact drift", async () => {
|
||||
it("requires setup-client facts in the canonical installation guide", async () => {
|
||||
const catalog = await createProductCatalog(root);
|
||||
const firstFamily = catalog.tools.families[0];
|
||||
if (firstFamily === undefined) throw new TypeError("Missing tool family");
|
||||
const drifted = {
|
||||
...catalog,
|
||||
tools: {
|
||||
...catalog.tools,
|
||||
families: [
|
||||
{ ...firstFamily, count: firstFamily.count + 1 },
|
||||
...catalog.tools.families.slice(1),
|
||||
],
|
||||
},
|
||||
setup_clients: [
|
||||
...catalog.setup_clients,
|
||||
{
|
||||
@@ -297,14 +288,51 @@ describe("canonical product catalog drift", () => {
|
||||
],
|
||||
};
|
||||
const issues = await documentationFactIssues(root, drifted);
|
||||
expect(issues.some((issue) => issue.includes("tool family counts"))).toBe(
|
||||
true,
|
||||
);
|
||||
expect(issues.some((issue) => issue.includes("Future Client"))).toBe(true);
|
||||
expect(issues).toContain("docs/installation.md: missing Future Client");
|
||||
expect(issues).not.toContain("README.md: missing Future Client");
|
||||
});
|
||||
|
||||
it("keeps translated readmes linked to canonical setup and tool details", async () => {
|
||||
const directory = await createTestTempDirectory("rea-readme-facts-");
|
||||
temporaryRoots.push(directory);
|
||||
const paths = [
|
||||
"README.md",
|
||||
"README_zh.md",
|
||||
"README_ja.md",
|
||||
"README_ko.md",
|
||||
"README_ar.md",
|
||||
"docs/installation.md",
|
||||
"AGENTS.md",
|
||||
".github/pull_request_template.md",
|
||||
];
|
||||
for (const path of paths) {
|
||||
const destination = join(directory, path);
|
||||
await mkdir(dirname(destination), { recursive: true });
|
||||
await copyFile(join(root, path), destination);
|
||||
}
|
||||
await mkdir(join(directory, "skills/reverse-engineer-anything"), {
|
||||
recursive: true,
|
||||
});
|
||||
const translatedPath = join(directory, "README_zh.md");
|
||||
const translated = await readFile(translatedPath, "utf8");
|
||||
await writeFile(
|
||||
translatedPath,
|
||||
translated.replace(
|
||||
"(docs/installation.md#supported-agents)",
|
||||
"(docs/installation.md#missing-agents)",
|
||||
),
|
||||
"utf8",
|
||||
);
|
||||
|
||||
const issues = await documentationFactIssues(
|
||||
directory,
|
||||
await createProductCatalog(root),
|
||||
);
|
||||
expect(issues).toContain(
|
||||
"README_zh.md: documentation links differ from README.md",
|
||||
);
|
||||
});
|
||||
|
||||
it("changes the provider projection digest when provider facts drift", async () => {
|
||||
const catalog = await createProductCatalog(root);
|
||||
const firstProvider = catalog.providers[0];
|
||||
|
||||
Reference in New Issue
Block a user