Skip to content

feat(website): migrate to a full Starlight documentation site - #32

Merged
ThePlenkov merged 5 commits into
mainfrom
feat/starlight-docs
Aug 12, 2026
Merged

ThePlenkov merged 5 commits into
mainfrom
feat/starlight-docs

Conversation

@ThePlenkov

@ThePlenkov ThePlenkov commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

User description

Summary

Replaces the minimal 3-page landing site with a full Astro Starlight documentation site that renders the existing engdocs/ and specs/ trees, adds search, navigation, diagrams, and a polished theme.

What changed

  • Switched website/ to @astrojs/starlight and removed the standalone src/pages/* Astro pages.
  • Added website/scripts/sync-docs.ts which copies engdocs/user/, engdocs/architecture/, engdocs/adr/, engdocs/contributing/, and specs/ into src/content/docs/, renames index files (README.md, spec.md → index.md), injects Starlight frontmatter, and rewrites internal .md links to directory-style URLs.
  • New src/content/docs/index.mdx landing page uses Starlights splash template with hero actions and feature cards.
  • astro.config.mjs now configures Starlight (title, social, editLink, lastUpdated, custom CSS), keeps SITE_URL/BASE_PATH env support for GitHub Pages (https://sverka-dev.github.io/sverka/), and injects a small Mermaid script so ```mermaid blocks render as diagrams.
  • Added brand accent colors in src/styles/custom.css.
  • Updated website/.gitignore so generated docs and public/mermaid.min.js are not committed.
  • Updated public/robots.txt sitemap URL to /sverka/sitemap-index.xml.

Validation

  • bun run lint passed
  • bun run typecheck passed
  • bun run test passed
  • bun run build passed
  • bun --cwd=website run check passed
  • bun --cwd=website run build passed with SITE_URL=https://sverka-dev.github.io BASE_PATH=/sverka

Merging this PR will deploy the expanded docs site to GitHub Pages via the existing deploy-website.yml workflow.


CodeAnt-AI Description

Replace the minimal website with a searchable, navigable Sverka documentation portal

What Changed

  • The landing page now guides users to installation, workflow API, CLI reference, engineering documentation, specs, and GitHub.
  • Documentation from engdocs/ and specs/ is published as browsable pages with navigation, search, edit links, and last-updated information.
  • Internal documentation links are converted to working website routes, while titles and descriptions are generated for imported pages.
  • Mermaid architecture diagrams render directly in documentation pages.
  • The site uses a Starlight theme with Sverka accent colors and supports GitHub Pages paths and sitemap generation.

Impact

✅ One searchable home for user, engineering, and specification docs
✅ Working links between published documentation pages
✅ Rendered architecture diagrams

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.


Summary by cubic

Migrates the website to a full Astro Starlight docs site that builds from engdocs/ and specs/, adding search, sidebar navigation, Mermaid diagrams, and a branded theme. Adds a sync-docs build step, per-page editUrl, and correct SITE_URL/BASE_PATH handling for clean GitHub Pages deploys.

  • New Features

    • Switched website/ to @astrojs/starlight; removed custom Astro pages/layouts.
    • Added website/scripts/sync-docs.ts to copy docs (incl. engdocs/runbooks), rename indexes, inject frontmatter with per-page editUrl, and rewrite links; dev|build|check run it automatically.
    • Enabled Mermaid diagrams with mermaid and a lightweight loader.
    • Configured Starlight (title, social, edit link, last updated, custom CSS) and base path for GitHub Pages; sitemap/robots handled by @astrojs/sitemap.
    • Updated deploy workflow to rebuild on engdocs/** and specs/** changes.
  • Bug Fixes

    • Refactored sync-docs.ts for reliability and path handling. Added tests, warn on unresolved links, fixed Mermaid selector, asset URLs under BASE_PATH, and excluded tests from astro check.
    • Updated splash page to use relative links so BASE_PATH is respected.

Written for commit b0e303a. Summary will update on new commits.

Review in cubic

Co-Authored-By: Petr Plenkov <petr.plenkov@gmail.com>
@codeant-ai

codeant-ai Bot commented Aug 12, 2026 •

Copy link
Copy Markdown

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Reviewed your PR 3e5306f Aug 12, 2026 · 12:00 12:04

@baz-reviewer

baz-reviewer Bot commented Aug 12, 2026 •

Copy link
Copy Markdown

Merger

Needs Review

PR exceeds the merge-gate context budget (74495 tokens); escalating to a human reviewer.

Commit b0e303a · Evaluated 2026-08-12 12:27 UTC

Review this PR on Baz | Customize your next review

@codeant-ai codeant-ai Bot added the size:L This PR changes 100-499 lines, ignoring generated files label Aug 12, 2026
@coderabbitai

coderabbitai Bot commented Aug 12, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 1b602224-f636-44ef-a8ba-c56d3ebaed99

📥 Commits

Reviewing files that changed from the base of the PR and between 672262f and 9572605.

📒 Files selected for processing (1)
  • website/src/content/docs/index.mdx
📜 Recent review details
⏰ Context from checks skipped due to timeout. (1)
  • GitHub Check: Codacy Static Code Analysis
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2026-08-11T20:48:21.146Z
Learnt from: ThePlenkov
Repo: sverka-dev/sverka PR: 28
File: skills/sverka/SKILL.md:91-96
Timestamp: 2026-08-11T20:48:21.146Z
Learning: In `skills/sverka/SKILL.md`, CLI command examples are intended as illustrative examples. CLI output format can vary by version.

Applied to files:

  • website/src/content/docs/index.mdx
🔇 Additional comments (1)
website/src/content/docs/index.mdx (1)

10-14: LGTM!

Also applies to: 63-66


📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Introduced a refreshed documentation website with splash-page navigation, product overviews, and links to installation, API, CLI, engineering, and specification guides.
    • Added theme-aware Mermaid architecture diagrams.
    • Added automatic documentation synchronization and generated documentation routes.
    • Added site metadata, edit links, timestamps, sitemap support, and normalized site URLs.
  • Style

    • Added teal accent colors and light-theme styling for the documentation experience.

Walkthrough

The website moves to Astro Starlight. A synchronization script generates documentation content and routes. Mermaid diagrams render in the browser. Legacy pages, layouts, generated declarations, and global styles are removed.

Changes

Website documentation system

Layer / File(s) Summary
Documentation synchronization
website/scripts/sync-docs.ts, website/package.json, website/.gitignore
The website discovers source documents, generates frontmatter and routes, rewrites internal links, removes stale generated files, copies Mermaid assets, and writes robots.txt. Development, build, and check commands run synchronization first.
Starlight site integration
website/astro.config.mjs, website/src/content.config.ts, website/src/content/docs/.gitignore
Astro uses Starlight content configuration, normalized base paths, trailing-slash routes, Mermaid initialization, site metadata, navigation, custom styling, timestamps, and sitemap integration.
Documentation landing content and theme
website/src/content/docs/index.mdx, website/src/styles/custom.css
The new splash page includes product cards, navigation links, an architecture diagram, and teal accent variables.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Developer
  participant SyncDocs
  participant Starlight
  participant Browser
  participant Mermaid
  Developer->>SyncDocs: run dev, build, or check
  SyncDocs->>Starlight: generate documentation content and routes
  Starlight->>Browser: serve or build documentation pages
  Browser->>Mermaid: initialize and render Mermaid blocks
Loading

Possibly related PRs

  • sverka-dev/sverka#17: Overlaps the Astro website configuration, package, sitemap, and page changes.
  • sverka-dev/sverka#27: Overlaps the Starlight content configuration and documentation synchronization changes.
  • sverka-dev/sverka#31: Also modifies deployment-specific site and base-path configuration in website/astro.config.mjs.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes the migration to a full Starlight documentation site.
Description check ✅ Passed The description directly explains the website migration, documentation synchronization, features, deployment support, and validation.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/starlight-docs

Comment @coderabbitai help to get the list of available commands.

@amazon-q-developer amazon-q-developer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review Summary

This PR successfully migrates the website to Astro Starlight with comprehensive documentation rendering. The implementation is well-structured with proper script integration and configuration.

Critical Issues Found

Three empty catch blocks in sync-docs.ts that silently suppress errors:

  1. Directory walking failures (line 69-71)
  2. Docs root cleanup failures (line 179-181)
  3. Mermaid copy failures (line 201-203)

These silent failures could result in incomplete builds or broken diagrams without warning. Adding console.warn statements will provide visibility during the build process.

Validation Status

All CI checks passed (lint, typecheck, test, build) as noted in the PR description, indicating the changes are functionally correct aside from the error handling issues noted above.


You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.

Comment thread website/scripts/sync-docs.ts Outdated
Comment thread website/scripts/sync-docs.ts Outdated
Comment thread website/scripts/sync-docs.ts Outdated
@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Migrate website to Astro Starlight docs with synced engdocs/specs

✨ Enhancement 📝 Documentation ⚙️ Configuration changes 🕐 40+ Minutes

Grey Divider

AI Description

• Replace the landing site with an Astro Starlight documentation site.
• Auto-sync engdocs/specs into Starlight content with frontmatter and link rewrites.
• Add Mermaid diagram rendering, updated styling, and GitHub Pages base-path support.
Diagram

graph TD
  A["Repo docs (engdocs/, specs/)"] --> B["sync-docs.ts"] --> C["Starlight docs content"] --> D["Astro + Starlight build"] --> E["Static site output"] --> F["GitHub Pages"]
  B --> G["public/mermaid.min.js"] --> D
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Use Starlight/Content loader pointed at repo paths
  • ➕ Avoids copying content into website/ and reduces generated files churn
  • ➕ Single source of truth; no frontmatter injection step needed if loader supports metadata
  • ➖ May be constrained by Astro/Starlight content collection expectations and GitHub Pages build environment
  • ➖ Harder to rewrite relative links reliably without a preprocessing step
2. Publish docs directly from engdocs/specs with a docs-only build
  • ➕ Keeps website build minimal; separates docs build/publish from the main website app
  • ➖ Introduces another deploy artifact and workflow complexity
  • ➖ Harder to integrate a unified landing page, nav, and search across both trees
3. Preprocess markdown with a remark/rehype pipeline instead of copying files
  • ➕ Transforms content at build time without generating a mirrored tree in gitignored folders
  • ➕ Centralizes link rewriting/frontmatter generation into a standard markdown pipeline
  • ➖ More complex Astro/MDX integration and potentially slower builds
  • ➖ Still needs deterministic route mapping for rewritten links

Recommendation: The PR’s approach (explicit sync step producing Starlight-ready content) is a pragmatic fit for a static GitHub Pages deployment: it makes routes deterministic (index.md → directory URLs), ensures Starlight frontmatter exists, and allows link rewrites with full knowledge of the source→route mapping. If this grows, consider migrating the link/frontmatter logic into a remark pipeline to reduce the amount of generated content written to disk, but the current solution is straightforward to reason about and troubleshoot.

Files changed (10) +758 / -9

Enhancement (1) +206 / -0
sync-docs.tsSync engdocs/specs into Starlight content with frontmatter and link rewrites +206/-0

Sync engdocs/specs into Starlight content with frontmatter and link rewrites

• Introduces a build-time script that copies selected engdocs and specs trees into src/content/docs with index normalization (README/spec → index.md). Injects Starlight frontmatter (title/description), rewrites internal markdown links to directory-style routes, and vendors mermaid.min.js into public/ when available.

website/scripts/sync-docs.ts

Documentation (1) +66 / -0
index.mdxAdd Starlight splash landing page with hero, cards, and Mermaid example +66/-0

Add Starlight splash landing page with hero, cards, and Mermaid example

• Creates a Starlight splash homepage defining hero actions and feature cards. Includes an embedded Mermaid diagram snippet and links into the synced user docs, engineering docs, and specs sections.

website/src/content/docs/index.mdx

Other (8) +486 / -9
.gitignoreIgnore generated docs content and vendored Mermaid bundle +7/-0

Ignore generated docs content and vendored Mermaid bundle

• Adds ignores for build artifacts and generated docs under src/content/docs. Uses exceptions to keep the Starlight landing page and a local .gitignore committed while avoiding committing generated markdown and public/mermaid.min.js.

website/.gitignore

astro.config.mjsConfigure Starlight integration, base path behavior, and Mermaid injection +53/-4

Configure Starlight integration, base path behavior, and Mermaid injection

• Switches the site from custom pages to @astrojs/starlight and enables trailing slashes for directory-style docs routes. Preserves SITE_URL/BASE_PATH GitHub Pages support, adds custom CSS, enables edit links/last-updated metadata, and injects scripts to load and initialize Mermaid diagrams.

website/astro.config.mjs

bun.lockLock Starlight and Mermaid dependency graph +396/-0

Lock Starlight and Mermaid dependency graph

• Adds @astrojs/starlight and mermaid (plus transitive dependencies like pagefind) to the lockfile to support the new docs site features (navigation/search/MDX/diagrams).

website/bun.lock

package.jsonAdd sync-docs pipeline and Starlight/Mermaid dependencies +7/-4

Add sync-docs pipeline and Starlight/Mermaid dependencies

• Adds @astrojs/starlight and mermaid dependencies. Updates dev/build/check scripts to run a sync-docs step before invoking Astro so docs content is always generated consistently.

website/package.json

robots.txtUpdate sitemap URL for GitHub Pages deployment path +1/-1

Update sitemap URL for GitHub Pages deployment path

• Points robots.txt at the GitHub Pages sitemap location under /sverka to match the configured base path.

website/public/robots.txt

content.config.tsDefine Starlight docs content collection +7/-0

Define Starlight docs content collection

• Configures Astro content collections to use Starlight’s docs loader and schema for the generated docs tree.

website/src/content.config.ts

.gitignorePrevent committing generated docs while keeping the landing page +3/-0

Prevent committing generated docs while keeping the landing page

• Ignores all files under src/content/docs except index.mdx and the folder’s .gitignore, aligning with the sync-docs generation model.

website/src/content/docs/.gitignore

custom.cssSet Sverka brand accent colors for Starlight theme +12/-0

Set Sverka brand accent colors for Starlight theme

• Adds CSS variables to customize Starlight’s accent palette, with theme-specific overrides for light mode.

website/src/styles/custom.css

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

AI Reviewer: first review requested successfully. AI can make mistakes. Always validate suggestions.

Run reviewer

TIP This summary will be updated as you push new changes.

@codacy-production codacy-production Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

The migration to Astro Starlight is structurally complete, but the custom synchronization logic in 'website/scripts/sync-docs.ts' presents significant risks. This script is identified as high-complexity and lacks any unit test coverage. A critical defect was found where the script overwrites existing frontmatter metadata, which will result in the loss of Starlight-specific sidebar and SEO configurations.

Furthermore, the link transformation logic uses non-context-aware regular expressions that risk corrupting Markdown links within code blocks or backticks. There is also a configuration discrepancy in 'robots.txt' where a hardcoded URL conflicts with the dynamic site configuration, potentially impacting SEO. It is recommended to address the frontmatter preservation and link transformation robustness before merging.

About this PR

  • The documentation synchronization script relies heavily on complex regular expressions for link rewriting and frontmatter parsing without any unit tests. This creates a high risk of regressions as documentation structures evolve.

Test suggestions

  • Documentation sync correctly maps source directories (e.g., engdocs/user) to destination routes.
  • Internal link transformation logic correctly resolves relative paths and preserves anchors.
  • Frontmatter injection correctly extracts the first H1 header as the page title.
  • Mermaid initialization script correctly identifies and processes language-mermaid blocks in the DOM.
  • Sitemap generation in robots.txt aligns with the configured SITE_URL.
  • Directory walking handles missing source folders gracefully without silent failures.
Prompt proposal for missing tests
Consider implementing these tests if applicable:
1. Documentation sync correctly maps source directories (e.g., engdocs/user) to destination routes.
2. Internal link transformation logic correctly resolves relative paths and preserves anchors.
3. Frontmatter injection correctly extracts the first H1 header as the page title.
4. Mermaid initialization script correctly identifies and processes language-mermaid blocks in the DOM.
5. Sitemap generation in robots.txt aligns with the configured SITE_URL.
6. Directory walking handles missing source folders gracefully without silent failures.

TIP Improve review quality by adding custom instructions
TIP How was this review? Give us feedback

Comment thread website/scripts/sync-docs.ts Outdated
Comment thread website/public/robots.txt Outdated
Comment thread website/scripts/sync-docs.ts Outdated
Comment thread website/scripts/sync-docs.ts
Comment thread website/scripts/sync-docs.ts Outdated
Comment thread website/src/content/docs/index.mdx Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@website/public/robots.txt`:
- Line 4: The sitemap entry in robots.txt is hardcoded to the GitHub Pages
deployment and conflicts with the SITE_URL default in astro.config.mjs. Update
the robots.txt generation or configuration to derive the sitemap URL from
SITE_URL, ensuring the default build advertises the canonical sverka.dev
deployment while preserving correct behavior for alternate deployments.

In `@website/scripts/sync-docs.ts`:
- Around line 185-194: Update the frontmatter handling in the document sync flow
around parseFrontmatter and the generated frontmatter string to preserve all
existing source metadata. Merge existingFrontmatter with generated title and
description, only supplying those generated fields when they are absent from the
source frontmatter, then write the merged result with newBody.

In `@website/src/content/docs/index.mdx`:
- Around line 10-14: Update the landing-page hero action links, including the
“Read the docs” entry, to use base-path-aware relative URLs or Astro’s
configured base URL instead of root-relative paths. Preserve the existing
destinations and styling while ensuring deployments under BASE_PATH resolve
correctly.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: a4538481-f623-4e01-8c07-9f68b5433f14

📥 Commits

Reviewing files that changed from the base of the PR and between b87ed17 and 3e5306f.

⛔ Files ignored due to path filters (1)
  • website/bun.lock is excluded by !**/*.lock
📒 Files selected for processing (19)
  • website/.astro/content-assets.mjs
  • website/.astro/content-modules.mjs
  • website/.astro/content.d.ts
  • website/.astro/types.d.ts
  • website/.gitignore
  • website/astro.config.mjs
  • website/package.json
  • website/public/robots.txt
  • website/scripts/sync-docs.ts
  • website/src/content.config.ts
  • website/src/content/docs/.gitignore
  • website/src/content/docs/index.mdx
  • website/src/layouts/Base.astro
  • website/src/pages/404.astro
  • website/src/pages/docs.astro
  • website/src/pages/getting-started.astro
  • website/src/pages/index.astro
  • website/src/styles/custom.css
  • website/src/styles/global.css
💤 Files with no reviewable changes (10)
  • website/.astro/types.d.ts
  • website/.astro/content-assets.mjs
  • website/.astro/content-modules.mjs
  • website/src/pages/404.astro
  • website/src/pages/docs.astro
  • website/src/pages/index.astro
  • website/src/pages/getting-started.astro
  • website/src/styles/global.css
  • website/.astro/content.d.ts
  • website/src/layouts/Base.astro
📜 Review details
⏰ Context from checks skipped due to timeout. (1)
  • GitHub Check: Codacy Static Code Analysis
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: - No any: Use unknown and narrow. Strict TypeScript.

  • Error handling: Custom error classes per package.

Files:

  • website/src/content.config.ts
  • website/scripts/sync-docs.ts
🧠 Learnings (1)
📚 Learning: 2026-08-12T07:24:02.495Z
Learnt from: CR
Repo: sverka-dev/sverka PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-08-12T07:24:02.495Z
Learning: Applies to **/src/index.ts : - **Public API:** Everything public is exported from `src/index.ts`.

Applied to files:

  • website/.gitignore
  • website/src/content/docs/.gitignore
🪛 ast-grep (0.45.1)
website/scripts/sync-docs.ts

[warning] 183-183: Filesystem path is not a string literal; a request-/variable-derived path can enable path traversal. Validate and normalize the path before use.
Context: fs.readFile(entry.srcPath, "utf-8")
Note: [CWE-22] Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').

(detect-non-literal-fs-filename-typescript)


[warning] 193-193: Filesystem path is not a string literal; a request-/variable-derived path can enable path traversal. Validate and normalize the path before use.
Context: fs.writeFile(entry.destPath, frontmatter + newBody, "utf-8")
Note: [CWE-22] Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').

(detect-non-literal-fs-filename-typescript)

🪛 GitHub Check: SonarCloud Code Analysis
website/scripts/sync-docs.ts

[warning] 76-76: Prefer .at(…) over [….length - index].

See more on https://sonarcloud.io/project/issues?id=sverka-dev_sverka&issues=AZ_12WAXFROzdhBanWjJ&open=AZ_12WAXFROzdhBanWjJ&pullRequest=32


[warning] 133-133: Simplify this regular expression to reduce its runtime, as it has super-linear performance due to backtracking.

See more on https://sonarcloud.io/project/issues?id=sverka-dev_sverka&issues=AZ_12WAXFROzdhBanWjN&open=AZ_12WAXFROzdhBanWjN&pullRequest=32


[warning] 192-192: Refactor this code to not use nested template literals.

See more on https://sonarcloud.io/project/issues?id=sverka-dev_sverka&issues=AZ_12WAXFROzdhBanWjO&open=AZ_12WAXFROzdhBanWjO&pullRequest=32


[warning] 99-99: Use the "RegExp.exec()" method instead.

See more on https://sonarcloud.io/project/issues?id=sverka-dev_sverka&issues=AZ_12WAXFROzdhBanWjK&open=AZ_12WAXFROzdhBanWjK&pullRequest=32


[warning] 107-107: Use the "RegExp.exec()" method instead.

See more on https://sonarcloud.io/project/issues?id=sverka-dev_sverka&issues=AZ_12WAXFROzdhBanWjL&open=AZ_12WAXFROzdhBanWjL&pullRequest=32


[warning] 107-107: Simplify this regular expression to reduce its runtime, as it has super-linear performance due to backtracking.

See more on https://sonarcloud.io/project/issues?id=sverka-dev_sverka&issues=AZ_12WAXFROzdhBanWjM&open=AZ_12WAXFROzdhBanWjM&pullRequest=32

🔇 Additional comments (7)
website/package.json (1)

7-17: LGTM!

website/.gitignore (1)

1-7: LGTM!

website/astro.config.mjs (1)

38-38: 🎯 Functional Correctness

Verify favicon handling under BASE_PATH.

asset("/mermaid.min.js") includes basePath, but favicon: "/favicon.svg" is root-relative. If Starlight emits this value unchanged, a GitHub Pages deployment at /sverka/ requests /favicon.svg instead of /sverka/favicon.svg.

Inspect the generated HTML with a non-root BASE_PATH. Use asset("/favicon.svg") if the output is not base-prefixed.

website/src/content.config.ts (1)

1-7: LGTM!

website/src/content/docs/.gitignore (1)

1-3: LGTM!

website/src/styles/custom.css (1)

1-12: LGTM!

website/scripts/sync-docs.ts (1)

69-70: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Do not suppress required documentation pipeline failures.

Both catch blocks convert required-input failures into a successful but incomplete website build. Fail with contextual errors instead. Use a package-specific error class.

  • website/scripts/sync-docs.ts#L69-L70: throw a contextual error when a configured documentation root cannot be read.
  • website/scripts/sync-docs.ts#L199-L203: throw a contextual error when Mermaid cannot be copied to website/public/mermaid.min.js.

As per coding guidelines, **/*.{ts,tsx} requires “Error handling: Custom error classes per package.”

⛔ Skipped due to learnings
Learnt from: CR
Repo: sverka-dev/sverka PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-08-12T07:24:02.495Z
Learning: Applies to **/*.{ts,tsx} : - **Error handling:** Custom error classes per package.

Source: Coding guidelines

Comment thread website/public/robots.txt Outdated
Comment thread website/scripts/sync-docs.ts Outdated
Comment thread website/src/content/docs/index.mdx Outdated
Co-Authored-By: Petr Plenkov <petr.plenkov@gmail.com>
…cted

Co-Authored-By: Petr Plenkov <petr.plenkov@gmail.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@website/scripts/sync-docs.ts`:
- Around line 100-121: Replace the line-based frontmatter parsing and field
removal around parseFrontmatter and the metadata update flow with a YAML-aware
transform that parses complete YAML nodes, including block scalars, and
serializes the updated frontmatter while preserving the body. Ensure title and
description values are read and removed as complete YAML fields rather than
deleting only their declaration lines, reusing an available YAML frontmatter
dependency if present.
- Around line 226-230: Normalize the SITE_URL value in writeRobotsTxt before
composing sitemapUrl by removing its trailing slash, while preserving the
existing default URL and basePath handling so the generated URL contains exactly
one separator before sitemap-index.xml.
- Around line 71-72: Define a package-specific DocsSyncError that preserves the
original error as cause, then use it at every synchronization failure boundary:
website/scripts/sync-docs.ts lines 71-72 for source-directory reads, lines
216-222 for generated-docs cleanup, and lines 239-243 for Mermaid bundle
copying. Replace the generic Error throws while retaining the existing
contextual messages.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 2331a031-9613-48c6-976b-f0ca5f22fa92

📥 Commits

Reviewing files that changed from the base of the PR and between 3e5306f and 672262f.

📒 Files selected for processing (3)
  • website/.gitignore
  • website/public/robots.txt
  • website/scripts/sync-docs.ts
💤 Files with no reviewable changes (1)
  • website/public/robots.txt
📜 Review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Analyze (javascript-typescript)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: - No any: Use unknown and narrow. Strict TypeScript.

  • Error handling: Custom error classes per package.

Files:

  • website/scripts/sync-docs.ts
🪛 ast-grep (0.45.1)
website/scripts/sync-docs.ts

[warning] 232-232: Filesystem path is not a string literal; a request-/variable-derived path can enable path traversal. Validate and normalize the path before use.
Context: fs.writeFile(path.resolve(publicDir, "robots.txt"), robots, "utf-8")
Note: [CWE-22] Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').

(detect-non-literal-fs-filename-typescript)


[warning] 257-257: Filesystem path is not a string literal; a request-/variable-derived path can enable path traversal. Validate and normalize the path before use.
Context: fs.readFile(entry.srcPath, "utf-8")
Note: [CWE-22] Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').

(detect-non-literal-fs-filename-typescript)


[warning] 272-272: Filesystem path is not a string literal; a request-/variable-derived path can enable path traversal. Validate and normalize the path before use.
Context: fs.writeFile(entry.destPath, frontmatter + linkedBody, "utf-8")
Note: [CWE-22] Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').

(detect-non-literal-fs-filename-typescript)

🪛 GitHub Check: SonarCloud Code Analysis
website/scripts/sync-docs.ts

[warning] 101-101: Use the "RegExp.exec()" method instead.

See more on https://sonarcloud.io/project/issues?id=sverka-dev_sverka&issues=AZ_12WAXFROzdhBanWjK&open=AZ_12WAXFROzdhBanWjK&pullRequest=32


[warning] 114-114: Prefer .at(…) over [….length - index].

See more on https://sonarcloud.io/project/issues?id=sverka-dev_sverka&issues=AZ_13yAFTMuUxbWgtPMZ&open=AZ_13yAFTMuUxbWgtPMZ&pullRequest=32


[warning] 109-109: Simplify this regular expression to reduce its runtime, as it has super-linear performance due to backtracking.

See more on https://sonarcloud.io/project/issues?id=sverka-dev_sverka&issues=AZ_13yAFTMuUxbWgtPMX&open=AZ_13yAFTMuUxbWgtPMX&pullRequest=32


[warning] 109-109: Use the "RegExp.exec()" method instead.

See more on https://sonarcloud.io/project/issues?id=sverka-dev_sverka&issues=AZ_13yAFTMuUxbWgtPMW&open=AZ_13yAFTMuUxbWgtPMW&pullRequest=32


[warning] 114-114: Use the 'String#endsWith' method instead.

See more on https://sonarcloud.io/project/issues?id=sverka-dev_sverka&issues=AZ_13yAFTMuUxbWgtPMY&open=AZ_13yAFTMuUxbWgtPMY&pullRequest=32

🔇 Additional comments (1)
website/.gitignore (1)

8-8: LGTM!

Comment thread website/scripts/sync-docs.ts Outdated
Comment thread website/scripts/sync-docs.ts Outdated
Comment thread website/scripts/sync-docs.ts
@qodo-code-review

qodo-code-review Bot commented Aug 12, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (1) 📜 Skill insights (0)

Grey Divider


Action required

1. Base path bypassed ✓ Resolved 🐞 Bug ≡ Correctness
Description
The landing page emits root-relative internal URLs, so the /sverka GitHub Pages deployment
navigates to host-root paths such as /user/... and returns 404s. This affects the primary start
links and the engineering/specs links whenever BASE_PATH is non-root.
Code

website/src/content/docs/index.mdx[R63-66]

+- [Install Sverka](/user/getting-started/install/) and set up your first workflow.
+- [Explore the Workflow API](/user/workflow-api/overview/) to compose checks.
+- [Read the CLI reference](/user/cli/overview/) for all commands and flags.
+- [Browse engineering docs](/engineering/) and [specs](/specs/) to understand the design.
Relevance

●●● Strong

Base-path 404s on GitHub Pages are high-impact; link changes are straightforward.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The landing page contains literal root-relative links while the deployment config sets a non-root
base. Astro documents that static URLs must include the configured base prefix rather than relying
on base to rewrite arbitrary literal URLs.

.github/workflows/deploy-website.yml[21-23]
website/src/content/docs/index.mdx[9-15]
website/src/content/docs/index.mdx[63-66]
🌐 Astro’s base reference states that static asset imports and URLs should add the base as a prefix and exposes import.meta.env.BASE_URL for this purpose.

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Landing-page links beginning with `/` bypass Astro’s configured `/sverka` base path and navigate to nonexistent host-root routes.

## Issue Context
The deployment workflow sets `BASE_PATH=/sverka`. Use relative URLs or another Astro/Starlight base-aware mechanism for both Markdown links and hero actions.

## Fix Focus Areas
- website/src/content/docs/index.mdx[9-15]
- website/src/content/docs/index.mdx[63-66]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Doc changes skip deployment ✓ Resolved 🐞 Bug ☼ Reliability
Description
The build now consumes engdocs/ and specs/, but the Pages workflow’s push filter still watches
only website/**. A merge changing only canonical documentation will therefore leave the deployed
site stale until some unrelated watched path triggers another build.
Code

website/scripts/sync-docs.ts[R15-18]

+const roots: RootMapping[] = [
+  { src: "engdocs/user", dest: "user", indexNames: ["README.md"] },
+  { src: "engdocs/architecture", dest: "engineering/architecture", indexNames: ["README.md"] },
+  { src: "engdocs/adr", dest: "engineering/adrs", indexNames: ["README.md"] },
Relevance

●●● Strong

Stale deploy risk from workflow path filters is concrete and easy to fix.

PR-#30

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new sync script establishes engdocs and specs as build inputs, while generated outputs are
ignored and the deployment workflow excludes both source trees from its path filter.

website/scripts/sync-docs.ts[15-25]
website/.gitignore[4-6]
.github/workflows/deploy-website.yml[7-13]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Changes to canonical documentation inputs do not trigger the website deployment workflow.

## Issue Context
Generated content is ignored, so deployment must watch the source trees directly. Add `engdocs/**` and `specs/**` to the workflow path filter.

## Fix Focus Areas
- .github/workflows/deploy-website.yml[7-13]
- website/scripts/sync-docs.ts[15-25]
- website/.gitignore[4-6]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

3. Mermaid blocks remain code ✓ Resolved 🐞 Bug ≡ Correctness
Description
The renderer looks for data-language='mermaid' on <code>, but Astro documents fenced-code
language metadata on the replacement <pre> element. The new Mermaid fence can therefore miss every
selector and remain an unrendered code block.
Code

website/astro.config.mjs[15]

+  const blocks = document.querySelectorAll("pre code.language-mermaid, pre code[data-language='mermaid'], pre.mermaid");
Relevance

●●● Strong

Likely real rendering bug; simple selector fix aligns with Astro fenced-code output.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The selector includes pre code[data-language='mermaid'] but not pre[data-language='mermaid'];
Astro’s fenced-code implementation explicitly exposes the language on <pre>. The landing page
introduces a Mermaid fence that depends on this selector.

website/astro.config.mjs[15-25]
website/src/content/docs/index.mdx[46-59]
🌐 Astro PR 10538 documents that fenced-code language information is exposed as data-language on the replacement &lt;pre&gt; element.

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The client selector omits Astro’s `pre[data-language="mermaid"]` fenced-code markup, preventing Mermaid rendering.

## Issue Context
Add support for the actual generated DOM shape and make the conversion logic handle a matched `<pre>` directly. Verify against the pinned Astro/Starlight versions.

## Fix Focus Areas
- website/astro.config.mjs[15-25]
- website/src/content/docs/index.mdx[46-59]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


4. Specs landing route missing ✓ Resolved 🐞 Bug ≡ Correctness
Description
The landing page links to /specs/, but syncDocs only turns nested files such as
specs/00-overview/spec.md into nested index pages. No specs/index.md is generated, so the
advertised specs entry point returns 404 even on a root deployment.
Code

website/src/content/docs/index.mdx[66]

+- [Browse engineering docs](/engineering/) and [specs](/specs/) to understand the design.
Relevance

●●● Strong

Broken/404 docs links are concrete user-facing bugs; team has accepted website/doc fixes previously.

PR-#30

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The only specs mapping recursively renames each spec.md in its existing directory; representative
source files are nested, and no root specs source or single-file mapping exists to produce
/specs/.

website/scripts/sync-docs.ts[15-25]
specs/00-overview/spec.md[1-4]
specs/01-core/spec.md[374-376]
website/src/content/docs/index.mdx[66-66]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The landing page links to `/specs/`, but the sync process creates no page for that route.

## Issue Context
Current source specs live in numbered subdirectories. Add a generated specs landing page listing those sections, or change the link to an existing route.

## Fix Focus Areas
- website/src/content/docs/index.mdx[66-66]
- website/scripts/sync-docs.ts[15-25]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


5. Silent mermaid.min.js copy failure hides deploy issue ✓ Resolved 🐞 Bug ◔ Observability
Description
The head config in astro.config.mjs unconditionally injects a `<script
src="{base}/mermaid.min.js"> tag, but the file is only produced by sync-docs.ts` copying from
node_modules/mermaid/dist/mermaid.min.js, and that copy is wrapped in a try/catch that silently
swallows any failure (missing/renamed dist path, install issue) with just a code comment. If the
copy ever fails, every page silently ships a 404 script reference and Mermaid diagrams stop
rendering with no build-time signal.
Code

website/scripts/sync-docs.ts[R197-203]

+  const mermaidSrc = path.resolve(repoRoot, "website/node_modules/mermaid/dist/mermaid.min.js");
+  const mermaidDest = path.resolve(publicDir, "mermaid.min.js");
+  try {
+    await fs.copyFile(mermaidSrc, mermaidDest);
+  } catch {
+    // Mermaid may not be installed.
+  }
Relevance

●● Moderate

Silent catch is undesirable but may be tolerated for optional Mermaid dependency.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The copy of mermaid.min.js is guarded by a try/catch that only comments 'Mermaid may not be
installed' without logging or failing the build, while astro.config.mjs unconditionally references
/mermaid.min.js in a head script tag, meaning a failed copy produces a broken script reference
with no error surfaced during bun run build.

website/scripts/sync-docs.ts[197-203]
website/astro.config.mjs[50-59]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The sync-docs script silently swallows any failure copying `mermaid.min.js` from `node_modules` to `public/`, while `astro.config.mjs` unconditionally injects a script tag referencing that file. If the copy fails for any reason (path change in a mermaid version bump, install issue), the site builds successfully but ships a broken script reference, and diagrams silently fail with no build-time warning.

## Issue Context
`mermaid` is a direct dependency (`website/package.json`), and its dist path is hardcoded as `node_modules/mermaid/dist/mermaid.min.js`. The `sync-docs.ts` copy step catches any error without logging.

## Fix Focus Areas
- website/scripts/sync-docs.ts[197-203]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


View review recommended (4)
6. engdocs/runbooks tree excluded from published docs ✓ Resolved 🐞 Bug ≡ Correctness
Description
The roots mapping in sync-docs.ts covers engdocs/user, engdocs/architecture, engdocs/adr,
and engdocs/contributing, but omits engdocs/runbooks (which contains merge-stack-post-merge.md
in the repo), so that content is never copied into src/content/docs and is silently absent from
the deployed Starlight site despite the PR's stated goal of rendering 'the existing engdocs/ tree'.
Code

website/scripts/sync-docs.ts[R15-21]

+const roots: RootMapping[] = [
+  { src: "engdocs/user", dest: "user", indexNames: ["README.md"] },
+  { src: "engdocs/architecture", dest: "engineering/architecture", indexNames: ["README.md"] },
+  { src: "engdocs/adr", dest: "engineering/adrs", indexNames: ["README.md"] },
+  { src: "engdocs/contributing", dest: "engineering/contributing", indexNames: ["README.md"] },
+  { src: "specs", dest: "specs", indexNames: ["spec.md"] },
+];
Relevance

●● Moderate

Omission may be intentional scoping of published docs; unclear if runbooks should be public.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The repository contains engdocs/runbooks/merge-stack-post-merge.md, but the roots array in
sync-docs.ts only lists engdocs/user, engdocs/architecture, engdocs/adr, and engdocs/contributing as
source directories, so collectFiles() never walks engdocs/runbooks and that file is never copied to
the docs site.

engdocs/runbooks/merge-stack-post-merge.md: TBD

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The `roots` array in the docs sync script omits the `engdocs/runbooks` directory, so runbook content (e.g. `engdocs/runbooks/merge-stack-post-merge.md`) is never copied into the Starlight `src/content/docs` tree and is missing from the deployed documentation site.

## Issue Context
The PR migrates the website to Astro Starlight and adds `website/scripts/sync-docs.ts`, which copies specific subdirectories of `engdocs/` (user, architecture, adr, contributing) plus `specs/` into `src/content/docs`. The `engdocs/runbooks/` directory exists in the repo but is not part of any configured root mapping, so it is silently excluded from the generated docs.

## Fix Focus Areas
- website/scripts/sync-docs.ts[15-21]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


7. Edit links target generated files ✓ Resolved 🐞 Bug ≡ Correctness
Description
Starlight’s global edit links are based on content-entry paths under website/src/content/docs, but
those files are ignored and recreated from canonical sources on every sync. Contributors are
directed to nonexistent/disposable paths instead of the corresponding engdocs/ or specs/ file,
so edits can be misplaced or overwritten.
Code

website/astro.config.mjs[R46-48]

+      editLink: {
+        baseUrl: "https://github.com/sverka-dev/sverka/edit/main/",
+      },
Relevance

●● Moderate

Correctness concern but depends on desired contributor workflow; could be intentional despite
generated docs.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The configured edit base applies to content entries, while the sync script writes those entries
beneath an ignored directory after deleting prior generated content. The canonical files instead
reside in the separately mapped source trees.

website/astro.config.mjs[46-48]
website/scripts/sync-docs.ts[15-25]
website/scripts/sync-docs.ts[169-195]
website/.gitignore[4-6]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Global edit links point to generated content instead of canonical documentation sources.

## Issue Context
Disable edit links for generated pages or inject per-page edit metadata that maps each generated entry back to its original `engdocs/` or `specs/` path.

## Fix Focus Areas
- website/astro.config.mjs[46-48]
- website/scripts/sync-docs.ts[183-194]
- website/.gitignore[4-6]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


8. transformLinks params typed any ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
The new transformLinks() uses String.prototype.replace() with a regex callback whose
capture-group parameters are inferred as any, and the code then casts href to string. This
violates the requirement to avoid any in TypeScript and can hide type-safety issues in the
link-rewrite logic.
Code

website/scripts/sync-docs.ts[R133-136]

+  return body.replace(/(!?)\[([^\]]*)\]\(([^)]+)\)/g, (match, bang, text, href) => {
+    if (bang) return match;
+
+    const raw = href as string;
Relevance

●● Moderate

Type-safety nit; may not actually infer any in TS libdefs, so team may ignore.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 2649753 disallows introducing any types in TypeScript and requires using safer
typing/narrowing. The added replace() callback introduces any-typed capture parameters in
transformLinks() (e.g., href), which is then cast to string rather than being properly typed
and narrowed.

Rule 2649753: Disallow any type in TypeScript; prefer unknown with explicit narrowing
website/scripts/sync-docs.ts[133-156]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`transformLinks()` relies on a `String.prototype.replace()` callback where the capture-group parameters are inferred as `any` (due to the lib.d.ts signature), and the implementation compensates with casts like `href as string`. This violates the no-`any` TypeScript compliance rule.

## Issue Context
The link-rewrite logic is core to the doc-sync pipeline, so we should keep it type-safe and avoid `any` by explicitly typing the callback parameters (or using a different parsing approach that preserves types).

## Fix Focus Areas
- website/scripts/sync-docs.ts[122-158]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


9. syncDocs() missing tests 📘 Rule violation ▣ Testability
Description
A new non-trivial implementation (syncDocs()) was added to copy, rewrite, and generate
documentation content, but no automated tests were added to cover its behavior. This increases the
risk of silent regressions in docs generation (e.g., link rewriting and frontmatter injection).
Code

website/scripts/sync-docs.ts[R160-166]

+async function syncDocs() {
+  const entries = await collectFiles();
+  const sourceToRoute = new Map<string, string>();
+  for (const entry of entries) {
+    const srcRel = posix(path.relative(repoRoot, entry.srcPath));
+    const key = srcRel.replace(/\.mdx?$/i, "");
+    sourceToRoute.set(key, entry.route);
Relevance

●● Moderate

Requesting tests for scripts is often deferred; no repo precedent found.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 2649776 requires automated tests for non-trivial implementation changes. The PR
introduces a new syncDocs() pipeline that performs multiple transformations and filesystem
operations, but the change set does not include any test additions that exercise this behavior.

Rule 2649776: Require tests for all non-trivial implementation code changes
website/scripts/sync-docs.ts[160-206]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`website/scripts/sync-docs.ts` introduces substantial new logic (`syncDocs()` and helpers) without corresponding automated tests.

## Issue Context
This script performs recursive file walking, frontmatter generation, and Markdown link rewriting. Without tests, changes to the regex/link logic or path handling may break the docs site in CI/CD without clear early detection.

## Fix Focus Areas
- website/scripts/sync-docs.ts[47-206]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Informational

10. Fragile fallback for unresolved internal links ✓ Resolved 🐞 Bug ☼ Reliability
Description
transformLinks resolves markdown links by re-deriving a route only from files that were collected
into sourceToRoute; any link pointing outside the configured roots/singleFiles (e.g. to
engdocs/runbooks/... or other un-synced paths) silently falls into a fallback branch that just
strips the extension and appends a trailing slash, likely producing a 404 URL on the deployed site
instead of surfacing a build warning.
Code

website/scripts/sync-docs.ts[R143-150]

+    const resolvedSrc = posix(path.resolve(currentSrcDir, clean));
+    const srcRel = posix(path.relative(repoRoot, resolvedSrc)).replace(/\.mdx?$/i, "");
+    const targetRoute = sourceToRoute.get(srcRel) ?? sourceToRoute.get(`${srcRel}.md`) ?? sourceToRoute.get(`${srcRel}.mdx`);
+    if (!targetRoute) {
+      let newHref = clean.replace(/\.mdx?$/i, "");
+      if (!newHref.endsWith("/")) newHref += "/";
+      return `[${text}](${newHref}${anchor})`;
+    }
Relevance

●● Moderate

Behavior choice: warn/fail vs permissive fallback; subjective for docs sync.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
When targetRoute is not found in sourceToRoute (e.g. because the link target lives outside the
configured roots such as engdocs/runbooks), the code falls back to producing newHref from the raw
relative path with no validation or warning, silently generating a broken link in the rendered docs.

website/scripts/sync-docs.ts[143-150]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
When `transformLinks` cannot resolve a relative markdown link to a known synced route, it silently falls back to a best-guess directory-style URL instead of warning the developer, which can produce broken links in the deployed docs with no visibility during the build.

## Issue Context
Links pointing to files outside the configured `roots`/`singleFiles` mappings (for example, files under `engdocs/runbooks/`) are not present in `sourceToRoute`, so the fallback path is taken silently.

## Fix Focus Areas
- website/scripts/sync-docs.ts[143-150]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


11. sync-docs strips existing frontmatter and metadata ✓ Resolved 🐞 Bug ⚙ Maintainability
Description
syncDocs parses out any pre-existing frontmatter from source markdown and regenerates a new block
containing only title and a heuristically-derived description, so any richer Starlight metadata
(sidebar order, badges, template, etc.) later added to source docs in engdocs//specs/ will be
silently discarded on every regeneration. This makes frontmatter customization of synced docs
effectively impossible without modifying the sync script itself.
Code

website/scripts/sync-docs.ts[R189-194]

+    let newBody = existingFrontmatter ? body : content;
+    newBody = transformLinks(newBody, entry.srcPath, sourceToRoute);
+
+    const frontmatter = `---\ntitle: ${JSON.stringify(title)}\n${description ? `description: ${JSON.stringify(description)}\n` : ""}---\n\n`;
+    await fs.mkdir(path.dirname(entry.destPath), { recursive: true });
+    await fs.writeFile(entry.destPath, frontmatter + newBody, "utf-8");
Relevance

●● Moderate

Frontmatter overwrite could be intentional simplification; changing behavior affects authoring
model.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Lines 185-194 of sync-docs.ts explicitly discard existingFrontmatter and only reconstruct
title/description fields, so any additional Starlight-specific frontmatter keys authors might
add to source docs are lost on every sync run, silently limiting per-page customization.

website/scripts/sync-docs.ts[185-194]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The doc sync script discards all pre-existing frontmatter from source markdown files and replaces it with only a `title` and derived `description`, silently dropping any other Starlight frontmatter fields (e.g. `sidebar`, `template`, `badge`) that might be added to source docs later.

## Issue Context
`sync-docs.ts` calls `parseFrontmatter` to split out existing frontmatter, then only re-emits `title` and `description` while discarding the rest of the parsed frontmatter object.

## Fix Focus Areas
- website/scripts/sync-docs.ts[98-104]
- website/scripts/sync-docs.ts[183-194]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Context
✅ Compliance rules (platform): 8 rules
✅ Web pages:
  +17 more
Review mode: 🧠 Deep: This is a broad website migration with substantial new synchronization, URL rewriting, deployment/base-path configuration, Mermaid integration, and many independent behavior changes where multiple subtle defects are plausible.

Grey Divider

Tip of the day
💡 Did you know, you can enable the Remediation agent and Qodo fixes findings in a dedicated fix PR

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment thread website/scripts/sync-docs.ts Outdated
Comment thread website/scripts/sync-docs.ts
Comment thread website/src/content/docs/index.mdx Outdated
Comment thread website/src/content/docs/index.mdx Outdated
Comment thread website/scripts/sync-docs.ts
Comment thread website/astro.config.mjs Outdated
Comment thread website/scripts/sync-docs.ts
Comment thread website/scripts/sync-docs.ts Outdated
Comment thread website/scripts/sync-docs.ts Outdated
Comment thread website/scripts/sync-docs.ts Outdated
devin-ai-integration Bot and others added 2 commits August 12, 2026 12:20
… selector, deploy paths

Co-Authored-By: Petr Plenkov <petr.plenkov@gmail.com>
…tests from astro check

Co-Authored-By: Petr Plenkov <petr.plenkov@gmail.com>
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

baz: needs review size:L This PR changes 100-499 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant