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
+4
View File
@@ -1,5 +1,9 @@
import type { ProductCatalog } from "./product-catalog.mjs";
export function skillReferenceIssues(
skillRoot: string,
): Promise<readonly string[]>;
export function documentationFactIssues(
root: string,
catalog: ProductCatalog,
+43 -3
View File
@@ -1,5 +1,5 @@
import { readFile } from "node:fs/promises";
import { join } from "node:path";
import { readFile, readdir, stat } from "node:fs/promises";
import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
const README_PATHS = [
"README.md",
@@ -28,9 +28,49 @@ const requireText = (issues, path, content, expected) => {
if (!content.includes(expected)) issues.push(`${path}: missing ${expected}`);
};
/** Check that local Markdown references travel with an installed skill bundle. */
export const skillReferenceIssues = async (skillRoot) => {
const issues = [];
const paths = (await readdir(skillRoot, { recursive: true }))
.filter((path) => path.endsWith(".md"))
.sort();
for (const path of paths) {
const content = await readFile(join(skillRoot, path), "utf8");
for (const match of content.matchAll(/\[[^\]\n]*\]\(([^)\s]+)\)/gu)) {
const destination = match[1];
if (/^(?:https?:\/\/|mailto:|#)/u.test(destination)) continue;
const target = resolve(
dirname(join(skillRoot, path)),
destination.split("#")[0],
);
const withinBundle = relative(resolve(skillRoot), target);
if (
withinBundle === ".." ||
withinBundle.startsWith(`..${sep}`) ||
isAbsolute(withinBundle)
) {
issues.push(
`${path}: reference escapes installed skill bundle: ${destination}`,
);
continue;
}
try {
if (!(await stat(target)).isFile())
issues.push(`${path}: reference is not a file: ${destination}`);
} catch (cause) {
if (cause?.code !== "ENOENT") throw cause;
issues.push(`${path}: missing skill reference: ${destination}`);
}
}
}
return issues;
};
/** Return every caller-visible documentation mismatch against canonical facts. */
export const documentationFactIssues = async (root, catalog) => {
const issues = [];
const issues = await skillReferenceIssues(
join(root, "skills/reverse-engineer-anything"),
);
const expectedCounts = catalog.tools.families.map(({ count }) => count);
for (const path of README_PATHS) {
const content = await readFile(join(root, path), "utf8");