mirror of
https://github.com/morluto/rea.git
synced 2026-11-10 00:36:35 +00:00
* docs: organize canonical documentation layout (URGENTE) Group all existing authored guides by domain and ownership, expose complete navigation, and preserve their public routes. Update physical path consumers and release configuration while retaining historical records. Document domain-based specs and ADR slugs without global numbering. Co-Authored-By: Codex <noreply@openai.com> * fix(docs): honor home layout in all-page route verification * style: format reviewed source changes * fix(docs): preserve routes and navigation cache inputs * fix: repair the static-check failures on the default branch (#2895) * fix: repair the static-check failures on the default branch The default branch fails its own required `Static checks` job three ways, so every pull request reports that job as failed regardless of its own change. - `npm run format:check` reports `src/domain/functionComparison.test.ts` and `src/ida/IdaOperationRunner.ts`. - `npm run lint` reports a duplicate `import { join } from "node:path"` in `tests/boundary/mcp/ghidraInventoryMcp.test.ts` (lines 4 and 17). - `npm run typecheck` reports `format: "devin"` missing from the client format union in `src/application/SupportedClients.ts`, and an unchecked index in `tests/boundary/cli/clientProfileLifecycle.test.ts`, whose pair array is inferred as `string[][]`. Apply the pinned formatter, drop the duplicate import, list the `"devin"` format that its own definition already uses, and mark the pair array `as const`. Validation: `npm run check:fast` and `npm run format:check` pass. * fix(setup): keep Devin on the JSON configuration dialect --------- Co-authored-by: 吴佳浩 <wujiahao@supremind.com> Co-authored-by: morluto <76467478+morluto@users.noreply.github.com> * fix(docs): update links after guide relocation * docs: correct verified documentation route counts * fix(docs): update browser capture guide link after move (#2820) Refresh gettext protected-link comments alongside the authored href. Co-authored-by: Codex <noreply@openai.com> * fix(docs): include http3 lab in stable routes * fix(docs): preserve historical release evidence and links * fix(ghidra): restore Windows verifier identity import * docs(wakaru): preserve pinned upstream policy link * docs(index): retain recently added guide links * docs(mcp): preserve parent retention clarification * fix(cli): preserve standalone import guidance * fix(test): preserve translated guide link drift coverage --------- Co-authored-by: Matheus Breguêz <matbrgz@gmail.com> Co-authored-by: Codex <noreply@openai.com> Co-authored-by: morluto <17176810+morluto@users.noreply.github.com> Co-authored-by: 吴佳浩Alben <35291372+XiaoBinGan@users.noreply.github.com> Co-authored-by: 吴佳浩 <wujiahao@supremind.com>
167 lines
5.9 KiB
TypeScript
167 lines
5.9 KiB
TypeScript
import { readFile, readdir, writeFile } from "node:fs/promises";
|
|
import { resolve } from "node:path";
|
|
|
|
import { describe, expect, it } from "vitest";
|
|
import { createTestTempDirectory } from "../fixtures/temporaryDirectory.js";
|
|
import { processTest } from "../support/process/processFixture.js";
|
|
|
|
const jsonExamples = (content: string): unknown[] =>
|
|
[...content.matchAll(/```json\s*([\s\S]*?)```/gu)].map((match): unknown =>
|
|
JSON.parse(match[1] ?? ""),
|
|
);
|
|
|
|
const shellExamples = (content: string): string[] =>
|
|
[...content.matchAll(/```bash\s*([\s\S]*?)```/gu)].map((match) =>
|
|
(match[1] ?? "").trim(),
|
|
);
|
|
|
|
describe("onboarding documentation product facts", () => {
|
|
it.each([
|
|
[
|
|
"docs/guides/native/native-investigation.md",
|
|
"../../providers/raw-binary.md#nmos-6502",
|
|
],
|
|
["docs/providers/ghidra-riscv.md", "raw-binary.md"],
|
|
])(
|
|
"routes raw admission guidance in %s to the owning guide",
|
|
async (path, target) => {
|
|
const content = await readFile(resolve(path), "utf8");
|
|
const links = [...content.matchAll(/\]\(([^)\s]+)\)/gu)].map(
|
|
(match) => match[1],
|
|
);
|
|
expect(links, path).toContain(target);
|
|
},
|
|
);
|
|
|
|
it("documents manual MCP registration with an absolute runtime and entry script", async () => {
|
|
const content = await readFile(
|
|
resolve("docs/getting-started/installation.md"),
|
|
"utf8",
|
|
);
|
|
expect(jsonExamples(content)).toContainEqual(
|
|
expect.objectContaining({
|
|
mcpServers: expect.objectContaining({
|
|
rea: expect.objectContaining({
|
|
command: "/absolute/path/to/node",
|
|
args: ["/absolute/path/to/rea/scripts/rea.mjs", "mcp"],
|
|
}),
|
|
}),
|
|
}),
|
|
);
|
|
});
|
|
|
|
it("keeps translated onboarding commands aligned with the English examples", async () => {
|
|
const inventory = JSON.parse(
|
|
await readFile(resolve("website/locales/languages.json"), "utf8"),
|
|
) as { code: string; readme: string }[];
|
|
const translatedReadmes = inventory
|
|
.filter((language) => language.code !== "en")
|
|
.map((language) => language.readme);
|
|
expect(translatedReadmes).toContain("docs/readme/README_it.md");
|
|
expect(translatedReadmes).toContain("docs/readme/README_el.md");
|
|
const editions = (await readdir(resolve("docs/readme")))
|
|
.filter((name) => /^README_[A-Za-z0-9-]+\.md$/u.test(name))
|
|
.map((name) => `docs/readme/${name}`);
|
|
expect([...translatedReadmes].sort()).toEqual(editions.sort());
|
|
const english = shellExamples(await readFile(resolve("README.md"), "utf8"));
|
|
for (const path of translatedReadmes)
|
|
expect(
|
|
shellExamples(await readFile(resolve(path), "utf8")),
|
|
path,
|
|
).toEqual(english);
|
|
});
|
|
|
|
it("preserves Persian joiners in links to GitHub-rendered headings", async () => {
|
|
const persian = await readFile(resolve("docs/readme/README_fa.md"), "utf8");
|
|
// Confirmed against GitHub's rendered README, which retains U+200C.
|
|
for (const heading of [
|
|
"REA چگونه کار میکند",
|
|
"چه چیزهایی را میتوان تحلیل کرد",
|
|
"نمونههای عملی",
|
|
"پرسشهای متداول",
|
|
"بهروزرسانی REA",
|
|
]) {
|
|
expect(persian).toContain(`## ${heading}`);
|
|
expect(persian).toContain(
|
|
`](#${heading.toLowerCase().replaceAll(" ", "-")})`,
|
|
);
|
|
}
|
|
});
|
|
});
|
|
|
|
describe("published performance evidence", () => {
|
|
const script = resolve(
|
|
"tests/support/analysis-efficiency/mcp-integer-report.mjs",
|
|
);
|
|
const report = resolve(
|
|
"docs/verification/analysis-efficiency/mcp-integer-allocation.md",
|
|
);
|
|
processTest(
|
|
"keeps generated report facts aligned with committed receipts",
|
|
async ({ processes }) => {
|
|
const result = await processes.run(process.execPath, [script, "--check"]);
|
|
expect(result.exitCode, result.stdout + result.stderr).toBe(0);
|
|
},
|
|
);
|
|
for (const section of ["normal", "heap"]) {
|
|
processTest(
|
|
`rejects stale ${section} measurements without rewriting the report`,
|
|
async ({ processes }) => {
|
|
const source = await readFile(report, "utf8");
|
|
const begin = `<!-- BEGIN:allocation-report:${section} -->`;
|
|
const end = `<!-- END:allocation-report:${section} -->`;
|
|
const start = source.indexOf(begin) + begin.length;
|
|
const finish = source.indexOf(end);
|
|
const block = source.slice(start, finish);
|
|
const stale = block.replace(/\d+\.\d{3}/u, (value) =>
|
|
(Number(value) + 1).toFixed(3),
|
|
);
|
|
expect(stale).not.toBe(block);
|
|
const path = resolve(
|
|
await createTestTempDirectory("rea-report-stale-"),
|
|
"report.md",
|
|
);
|
|
const content = source.slice(0, start) + stale + source.slice(finish);
|
|
await writeFile(path, content);
|
|
const result = await processes.run(process.execPath, [
|
|
script,
|
|
"--check",
|
|
"--markdown",
|
|
path,
|
|
]);
|
|
expect(result.exitCode).not.toBe(0);
|
|
expect(result.stderr).toContain(
|
|
`Generated allocation report differs: ${section}`,
|
|
);
|
|
expect(await readFile(path, "utf8")).toBe(content);
|
|
},
|
|
);
|
|
}
|
|
processTest(
|
|
"refuses missing producer markers before writing",
|
|
async ({ processes }) => {
|
|
const source = await readFile(report, "utf8");
|
|
const content = source.replace(
|
|
"<!-- BEGIN:allocation-report:normal -->",
|
|
"",
|
|
);
|
|
expect(content).not.toBe(source);
|
|
const path = resolve(
|
|
await createTestTempDirectory("rea-report-marker-"),
|
|
"report.md",
|
|
);
|
|
await writeFile(path, content);
|
|
const result = await processes.run(process.execPath, [
|
|
script,
|
|
"--markdown",
|
|
path,
|
|
]);
|
|
expect(result.exitCode).not.toBe(0);
|
|
expect(result.stderr).toContain(
|
|
"Expected one opening report marker: normal",
|
|
);
|
|
expect(await readFile(path, "utf8")).toBe(content);
|
|
},
|
|
);
|
|
});
|