docs: clarify onboarding and align provider guidance (#745)

This commit is contained in:
N0zoM1z0
2026-10-06 22:57:36 +08:00
committed by GitHub
parent d3f498ceec
commit 5af1699103
32 changed files with 667 additions and 148 deletions
+54 -1
View File
@@ -1,5 +1,6 @@
import { rm, writeFile } from "node:fs/promises";
import { readFile, rm, writeFile } from "node:fs/promises";
import { join } from "node:path";
import { fileURLToPath } from "node:url";
import { execFile } from "node:child_process";
import { promisify } from "node:util";
@@ -32,6 +33,58 @@ const fixture = async (): Promise<string> => {
return root;
};
describe("documented process CLI workflow", () => {
it(
"feeds the documented JSON capture into the comparison CLI",
async () => {
const root = await fixture();
const guide = await readFile(
new URL("../../../docs/process-capture.md", import.meta.url),
"utf8",
);
const recipe = /```sh\nrea capture-process ([^\n]+)\n```/u.exec(
guide,
)?.[1];
if (recipe === undefined)
throw new Error("Missing process capture recipe");
const [argumentsText, output] = recipe.split(" > ");
if (argumentsText === undefined || output === undefined)
throw new Error("Missing process capture redirection");
const args = argumentsText.split(/\s+/u);
const input = args[0];
if (input === undefined) throw new Error("Missing scenario path");
await writeFile(
join(root, input),
JSON.stringify({
executable: process.execPath,
arguments: ["-e", "process.stdout.write('documented-capture')"],
}),
);
const cli = fileURLToPath(
new URL("../../../scripts/rea.mjs", import.meta.url),
);
const capture = await execFileAsync(
process.execPath,
[cli, "capture-process", ...args],
{ cwd: root },
);
expect(JSON.parse(capture.stdout)).toMatchObject({
operation: "capture_process_scenario",
});
await writeFile(join(root, output), capture.stdout);
const comparison = await execFileAsync(
process.execPath,
[cli, "compare-process-captures", output, output, "--json"],
{ cwd: root },
);
expect(JSON.parse(comparison.stdout)).toMatchObject({
operation: "compare_process_captures",
});
},
CLI_INTEGRATION_TIMEOUT_MS,
);
});
describe("process CLI errors", () => {
it(
"exits unsuccessfully without writing failure-shaped evidence",
+41 -1
View File
@@ -1,4 +1,4 @@
import { readFile, rm, writeFile } from "node:fs/promises";
import { mkdir, readFile, rm, writeFile } from "node:fs/promises";
import { join } from "node:path";
import { fileURLToPath } from "node:url";
@@ -40,6 +40,7 @@ import { NATIVE_MACOS_PROVIDER_IDENTITY } from "../../../src/native/NativeMacOSP
import {
assertDocumentationFacts,
documentationFactIssues,
skillReferenceIssues,
} from "../../../scripts/lib/docs-facts.mjs";
import { ensureGeneratedFile } from "../../../scripts/lib/generated-file.mjs";
import {
@@ -63,6 +64,24 @@ afterEach(async () => {
});
describe("canonical product catalog", () => {
it("admits the documented minimal browser scenario through the named contract", async () => {
const guide = await readFile(
join(root, "docs/browser-scenario-contract.md"),
"utf8",
);
const example = /```json\n([\s\S]*?)\n```/u.exec(guide)?.[1];
if (example === undefined)
throw new Error("Missing browser scenario example");
const contract = TOOL_CONTRACTS.find(
({ name }) => name === "capture_browser_scenario",
);
if (contract === undefined)
throw new Error("Missing browser scenario contract");
expect(contract.inputSchema.safeParse(JSON.parse(example)).success).toBe(
true,
);
});
it("matches every source-derived checked-in product fact", async () => {
const catalog = await createProductCatalog(root);
expect(catalog.tools.total).toBe(TOOL_CONTRACTS.length);
@@ -198,6 +217,27 @@ describe("canonical CLI catalog", () => {
});
describe("canonical product catalog drift", () => {
it("rejects missing and repository-only links in an independently installed skill", async () => {
const directory = await createTestTempDirectory("rea-skill-references-");
const bundle = join(directory, "skill");
await mkdir(bundle);
await writeFile(join(directory, "repo-only.md"), "Repository-only guide");
await writeFile(join(bundle, "local.md"), "Bundled guide");
await writeFile(
join(bundle, "SKILL.md"),
[
"[bundled](local.md#guide)",
"[missing](missing.md)",
"[repository-only](../repo-only.md)",
"[public](https://example.test/guide)",
].join("\n"),
);
expect(await skillReferenceIssues(bundle)).toEqual([
"SKILL.md: missing skill reference: missing.md",
"SKILL.md: reference escapes installed skill bundle: ../repo-only.md",
]);
});
it("reports tool-family and setup-client fact drift", async () => {
const catalog = await createProductCatalog(root);
const firstFamily = catalog.tools.families[0];