Skip to content

chore(content): add check:library-content audit for content posts - #8526

Merged
waleedlatif1 merged 2 commits into
stagingfrom
chore/library-content-check
Oct 1, 2026
Merged

waleedlatif1 merged 2 commits into
stagingfrom
chore/library-content-check

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Adds check:library-content (scripts/check-library-content.ts), picked up automatically by bun run check:audits. It validates every apps/sim/content/{blog,library,customers}/<slug>/index.mdx, or a single post with --slug <section>/<slug> / --slug <slug> / a bare <slug> for local agent runs. Each rule is exact, so nothing needs an override:
    • frontmatter: gray-matter parses it and it passes the real strict ContentFrontmatterSchema (imported, not duplicated), so canonical and other unknown keys fail; every author id has a profile in content/authors.
    • slug: slug equals the folder name.
    • og-image: ogImage is a local path to a file under apps/sim/public.
    • mdx: the body compiles with @mdx-js/mdx + remark-gfm (the compiler next-mdx-remote runs for the registry). The error line maps back to the line in the file.
    • faq: no FAQ/FAQs heading in the body, and no Markdown link syntax inside a frontmatter FAQ question or answer (it renders as literal text).
    • internal-link: every https://www.sim.ai/<section>/<slug> link, and every relative /<section>/<slug> link target, resolves to an existing post folder. A retired library slug fails and names the surviving slug; a blog slug that moved to /library fails and names its new path. Asset paths (/library/<slug>/cover.jpg), static sub-routes (tags, authors, rss.xml, read from the app router tree), and fenced code are skipped. Apex https://sim.ai links stay with check:site-urls.
    • On a full run, it also checks that every LIBRARY_MERGED_SLUGS target still exists.
  • Moves LIBRARY_MOVED_BLOG_SLUGS and LIBRARY_MERGED_SLUGS from next.config.ts into apps/sim/lib/library/retired-slugs.ts, so the redirects and the audit read the same map.
  • Fixes the only findings on current content: two FAQ answers in library/ai-agent-vs-chatbot showed [Sim](...) and [Chat interface](...) as literal Markdown. They now use plain text.
  • Adds @mdx-js/mdx@3.1.1 to the root devDependencies. It is the version already in the lockfile, so the script no longer depends on a hoisted transitive package.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Other: CI audit

Testing

  • bun run check:library-content passes on 80 posts in about 1s, and about 328 internal post links are validated.
  • scripts/check-library-content.test.ts writes fixture posts to a temp dir and covers one failure mode per rule, with exact file lines. I removed each guard in turn (12 mutations) and every one turned the suite red.
  • I copied a real post into the tree and corrupted it (canonical key, slug mismatch, missing ogImage, FAQ link, ## FAQ heading, retired/moved/typo links, an unclosed tag). The CLI reported all 9 problems with file:line and a fix hint, then the copy was removed.
  • bun run lint, bun run check:audits (54 audits), and apps/sim bun run type-check all pass.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

🤖 Generated with Claude Code

…d customer posts

Validates frontmatter against the strict ContentFrontmatterSchema, slug/folder parity, local ogImage existence, MDX compilation with remark-gfm, FAQ placement, and internal post links (including retired and moved slugs). Moves the library slug redirect maps into lib/library/retired-slugs.ts so next.config.ts and the audit share one source. Fixes two FAQ answers that rendered Markdown links as literal text.
@waleedlatif1
waleedlatif1 requested a review from a team as a code owner October 1, 2026 17:57
@vercel

vercel Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
docs Ready Ready Preview Oct 1, 2026 6:09pm UTC

Request Review

@greptile-apps

greptile-apps Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium risk] Adds content validation script and refactors slug configuration.

The PR appears safe to merge; no outstanding findings remain.

Summary

The PR adds a content audit for frontmatter, MDX, assets, FAQs, links, and redirect targets.

  • It shares retired-slug maps with the Next.js redirects and adds focused audit tests.
  • The latest changes align draft, customer-story, author-profile, and reserved-route checks with the serving routes.

Reviews (2) · Last reviewed commit: "fix(content): tighten check:library-cont..."

Comment thread scripts/check-library-content.ts Outdated
Comment thread scripts/check-library-content.ts Outdated
Comment thread scripts/check-library-content.ts Outdated
Comment thread scripts/check-library-content.ts Outdated
Comment thread scripts/check-library-content.ts Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 7 files

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread scripts/check-library-content.ts Outdated
Comment thread scripts/check-library-content.ts Outdated
… rules

Treat draft blog/library posts and customer stories missing from CUSTOMER_STORIES as unserved link targets, reserve only sibling folders that define a page or route, validate author profiles with AuthorSchema, check moved blog slug destinations, and reject ogImage paths that resolve outside public.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 7 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

@waleedlatif1
waleedlatif1 merged commit a7c71cc into staging Oct 1, 2026
28 of 29 checks passed
@waleedlatif1
waleedlatif1 deleted the chore/library-content-check branch October 1, 2026 18:10

This branch was successfully deployed

1 active deployment
Preview — c632938d Deployed Oct 1, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant