Skip to content

[quality] sync-org-docs.mjs: Org-wide doc aggregation script has no unit tests #32

Description

@hanthor-hive-agent

Finding

The scripts/sync-org-docs.mjs script (~200 lines) is responsible for aggregating READMEs and documentation from every active repo in the tuna-os GitHub org into the Docusaurus docs site. This script handles:

  • Git operations: Cloning repos with execSync
  • Content transformation: Markdown sanitization, relative link rewriting, frontmatter injection
  • HTML sanitization: Stripping <picture> tags, HTML comments, MDX-confusing angle brackets
  • Status banner injection: Adding alpha/beta/stable banners based on project metadata
  • Selective doc syncing: Per-repo file filters and docs/ subdirectory handling

None of this logic has unit tests. The HTML sanitization and link rewriting are particularly fragile — a regression could silently break the docs site.

Recommendation

Add scripts/__tests__/sync-org-docs.test.mjs (or similar) with unit tests for the pure functions:

  1. sanitizeHtml() — Test all sanitization cases (picture tags, HTML comments, email angles)
  2. fixRelativeLinks() — Test link rewriting for .md, .rst, .png files
  3. frontmatter() / subFrontmatter() — Test frontmatter generation
  4. getStatusBanner() — Test all status levels
  5. slugify() — Test name-to-slug conversion

Priority

  • Impact: medium
  • Effort: medium

Filed by quality agent (ACMM L4/L6 — full mode)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions