mirror of
https://github.com/moltbot/moltbot.git
synced 2026-04-26 16:06:16 +00:00
docs: remove dead security README nav entry (#46675)
Merged via squash.
Prepared head SHA: 63331a54b8
Co-authored-by: velvet-shark <126378+velvet-shark@users.noreply.github.com>
Co-authored-by: velvet-shark <126378+velvet-shark@users.noreply.github.com>
Reviewed-by: @velvet-shark
This commit is contained in:
committed by
GitHub
parent
774b40467b
commit
4c6a7f84a4
@@ -113,6 +113,41 @@ function resolveRoute(route) {
|
||||
return { ok: routes.has(current), terminal: current };
|
||||
}
|
||||
|
||||
/** @param {unknown} node */
|
||||
function collectNavPageEntries(node) {
|
||||
/** @type {string[]} */
|
||||
const entries = [];
|
||||
if (Array.isArray(node)) {
|
||||
for (const item of node) {
|
||||
entries.push(...collectNavPageEntries(item));
|
||||
}
|
||||
return entries;
|
||||
}
|
||||
|
||||
if (!node || typeof node !== "object") {
|
||||
return entries;
|
||||
}
|
||||
|
||||
const record = /** @type {Record<string, unknown>} */ (node);
|
||||
if (Array.isArray(record.pages)) {
|
||||
for (const page of record.pages) {
|
||||
if (typeof page === "string") {
|
||||
entries.push(page);
|
||||
} else {
|
||||
entries.push(...collectNavPageEntries(page));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (const value of Object.values(record)) {
|
||||
if (value !== record.pages) {
|
||||
entries.push(...collectNavPageEntries(value));
|
||||
}
|
||||
}
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
const markdownLinkRegex = /!?\[[^\]]*\]\(([^)]+)\)/g;
|
||||
|
||||
/** @type {{file: string; line: number; link: string; reason: string}[]} */
|
||||
@@ -221,6 +256,22 @@ for (const abs of markdownFiles) {
|
||||
}
|
||||
}
|
||||
|
||||
for (const page of collectNavPageEntries(docsConfig.navigation || [])) {
|
||||
checked++;
|
||||
const route = normalizeRoute(page);
|
||||
const resolvedRoute = resolveRoute(route);
|
||||
if (resolvedRoute.ok) {
|
||||
continue;
|
||||
}
|
||||
|
||||
broken.push({
|
||||
file: "docs.json",
|
||||
line: 0,
|
||||
link: page,
|
||||
reason: `navigation page not published (terminal: ${resolvedRoute.terminal})`,
|
||||
});
|
||||
}
|
||||
|
||||
console.log(`checked_internal_links=${checked}`);
|
||||
console.log(`broken_links=${broken.length}`);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user