Merge main (security-perf + SEO) into docs; finish English docs and agent guide
- Resolve conflicts in analytics, consent, content, i18n, mcp and stats, keeping the docs fixes and the new code behaviour, verified against src - Translate the remaining 14 module pages, ipal-seo-check skill and script - Integrate the security-perf and SEO agent-guide text: getRobots, isPathVisible, Search & AI (DNS verification first, meta fields optional), sitemap index/cache/503, consentMode basic/advanced, policyVersion, globalOverrides, revalidatePath / buildGlobalRevalidateHook, authAccess, firstUserAdmin, allowCollectionMismatch, unknown-IP rate limit; stale claims fixed across AGENT.md, skills, frontend, developer guide, vibe - docsConsistency: pending list removed (all docs English); relative links now also check #anchors Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -129,8 +129,10 @@ describe('docs ↔ code', () => {
|
||||
test('relative links between docs point at existing files', () => {
|
||||
const broken: string[] = []
|
||||
for (const file of [...docs, 'README.md'].filter((f) => f.endsWith('.md'))) {
|
||||
for (const m of read(file).matchAll(/\]\((?!https?:|mailto:|#)([^)\s#]+)(?:#[^)]*)?\)/g)) {
|
||||
if (!existsSync(path.join(root, path.dirname(file), m[1]))) {broken.push(`${file}: ${m[1]}`)}
|
||||
for (const m of read(file).matchAll(/\]\((?!https?:|mailto:|#)([^)\s#]+)(?:#([^)]*))?\)/g)) {
|
||||
const target = path.join(path.dirname(file), m[1])
|
||||
if (!existsSync(path.join(root, target))) {broken.push(`${file}: ${m[1]}`); continue}
|
||||
if (m[2] && target.endsWith('.md') && !anchorsOf(target).has(decodeURIComponent(m[2]))) {broken.push(`${file}: ${m[1]}#${m[2]}`)}
|
||||
}
|
||||
}
|
||||
expect(broken).toEqual([])
|
||||
@@ -187,18 +189,11 @@ describe('docs ↔ code', () => {
|
||||
* blocks, inline code or quoted strings (e.g. a 'pl' seed value, a slug, a file name).
|
||||
*/
|
||||
describe('docs are in English', () => {
|
||||
// Translated after the code branches that edit them are merged — remove from this list then.
|
||||
const pending = new Set([
|
||||
'docs/access.md', 'docs/agent/skills/ipal-seo-check/SKILL.md', 'docs/analytics.md', 'docs/consent.md', 'docs/construction.md',
|
||||
'docs/content.md', 'docs/forms.md', 'docs/hooks.md', 'docs/mcp.md', 'docs/notifications.md',
|
||||
'docs/richtext.md', 'docs/security.md', 'docs/seo.md', 'docs/stats.md', 'docs/turnstile.md',
|
||||
])
|
||||
|
||||
test('no Polish prose outside code and quoted sample data', () => {
|
||||
// Diacritics, or common Polish words for text written without them.
|
||||
const polish = /[ąćęłńóśźż]|\b(?:albo|czy|dla|gdy|jest|lub|nie|oraz|przez|tylko)\b/i
|
||||
const offending: string[] = []
|
||||
for (const file of [...docs, 'README.md'].filter((f) => f.endsWith('.md') && !pending.has(f))) {
|
||||
for (const file of [...docs, 'README.md'].filter((f) => f.endsWith('.md'))) {
|
||||
const prose = read(file)
|
||||
.replace(/```[\s\S]*?```/g, '')
|
||||
.replace(/`[^`\n]*`/g, '')
|
||||
@@ -274,6 +269,18 @@ function walk(dir: string): string[] {
|
||||
})
|
||||
}
|
||||
|
||||
/** GitHub-style heading anchors of a Markdown file (code blocks skipped, duplicates get -1, -2 …). */
|
||||
function anchorsOf(file: string): Set<string> {
|
||||
const seen = new Map<string, number>()
|
||||
const text = read(file).replace(/```[\s\S]*?```/g, '')
|
||||
return new Set([...text.matchAll(/^#{1,6} (.+)$/gm)].map((m) => {
|
||||
const slug = m[1].trim().toLowerCase().replace(/[^\p{L}\p{N}\s_-]/gu, '').replace(/\s/g, '-')
|
||||
const n = seen.get(slug) ?? 0
|
||||
seen.set(slug, n + 1)
|
||||
return n ? `${slug}-${n}` : slug
|
||||
}))
|
||||
}
|
||||
|
||||
function srcFiles(dir = 'src'): string[] {
|
||||
return readdirSync(path.join(root, dir)).flatMap((name) => {
|
||||
const rel = path.join(dir, name)
|
||||
|
||||
Reference in New Issue
Block a user