import assert from "node:assert/strict"; import { readFileSync } from "node:fs"; import { join } from "node:path"; import { test } from "node:test"; const root = new URL("..", import.meta.url); const files = [ "SKILL.md", "references/system.md", "references/config.md", "references/troubleshooting.md", "references/software.md", ]; const docs = files.map((file) => [file, readFileSync(join(root.pathname, file), "utf8")]); const all = docs.map(([, text]) => text).join("\n"); test("Arch skill points at current sources before volatile advice", () => { assert.match(all, /https:\/\/archlinux\.org\/news\//); assert.match(all, /https:\/\/wiki\.archlinux\.org\/title\//); assert.match(all, /https:\/\/man\.archlinux\.org\/man\//); assert.match(all, /man pacman/); }); test("partial-upgrade hazard is only documented as a warning", () => { for (const [file, text] of docs) { for (const [index, line] of text.split("\n").entries()) { if (!/pacman -Sy(\s|$|<)/.test(line)) continue; assert.match( line, /Avoid|Never|Do not|No partial|happened/, `${file}:${index + 1} must warn about pacman -Sy`, ); } } }); test("AUR and dangerous pacman flags keep safety warnings", () => { assert.match(all, /AUR = untrusted|AUR is unsupported\/untrusted/); assert.match(all, /Inspect `PKGBUILD`|inspect before build\/install/); assert.match(all, /Avoid .*--overwrite/); assert.match(all, /Do not symlink libs|Do not symlink libraries/); }); test("root mutation guidance delegates instead of auto-running", () => { assert.match(all, /Do not run root\/admin mutations yourself\./); assert.match(all, /\.\.\/linux\/SKILL\.md/); assert.match(all, /sudoedit \/etc\/file/); });