Skip to content

Support split and consolidated upstream docs layouts#62

Open
justin808 wants to merge 1 commit intomainfrom
jg-codex/issue-14-docs-layout-compat
Open

Support split and consolidated upstream docs layouts#62
justin808 wants to merge 1 commit intomainfrom
jg-codex/issue-14-docs-layout-compat

Conversation

@justin808
Copy link
Copy Markdown
Member

@justin808 justin808 commented Mar 26, 2026

Closes #14

Summary

  • add a shared docs-layout helper used by both sync and prepare scripts
  • auto-detect split (docs/oss + docs/pro) vs consolidated (docs/* + docs/pro/*) layouts
  • adapt subset sync paths to the detected layout instead of hardcoding oss/
  • add Node tests and fixtures covering both layouts

Verification

  • npm run test:docs-layout
  • npm run prepare:subset
  • npm run build:full
    • still succeeds on the current split layout
    • existing non-blocking Docusaurus broken link/anchor warnings remain unchanged

Note

Medium Risk
Moderate risk because it changes the docs sync/prepare file-copy logic and path assumptions; a wrong layout detection or exclusion set could lead to missing or mislocated docs in the generated Docusaurus site.

Overview
Adds a shared scripts/docs-layout.mjs helper that auto-detects upstream docs structure ("split" oss/ + pro/ vs "consolidated" single tree + pro/) and centralizes subset path mapping.

Updates scripts/sync-docs.mjs and scripts/prepare-docs.mjs to use the detected layout for copying docs/assets and for building the docs subset (instead of hardcoded oss/ paths), including excluding pro/, images/, and assets/ when copying a consolidated root.

Introduces node --test coverage (scripts/docs-layout.test.mjs) with fixtures and wires it via a new npm run test:docs-layout script.

Written by Cursor Bugbot for commit e892de2. This will update automatically on new commits. Configure here.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 26, 2026

Warning

Rate limit exceeded

@justin808 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 3 minutes and 54 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 56b2b14d-5385-454a-8d98-3fc382dc734d

📥 Commits

Reviewing files that changed from the base of the PR and between b02fe8f and e892de2.

📒 Files selected for processing (11)
  • package.json
  • scripts/__fixtures__/docs-layout/consolidated/README.md
  • scripts/__fixtures__/docs-layout/consolidated/introduction.md
  • scripts/__fixtures__/docs-layout/consolidated/pro/react-on-rails-pro.md
  • scripts/__fixtures__/docs-layout/split/README.md
  • scripts/__fixtures__/docs-layout/split/oss/introduction.md
  • scripts/__fixtures__/docs-layout/split/pro/react-on-rails-pro.md
  • scripts/docs-layout.mjs
  • scripts/docs-layout.test.mjs
  • scripts/prepare-docs.mjs
  • scripts/sync-docs.mjs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jg-codex/issue-14-docs-layout-compat

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@github-actions
Copy link
Copy Markdown

Cloudflare preview deployed.

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Split-only link rewriting applied unconditionally breaks consolidated layout
    • The flattened OSS link rewrite now runs only when a split docs layout is detected, preventing incorrect path shortening in consolidated docs.

Create PR

Or push these changes by commenting:

@cursor push fa2cf87809
Preview (fa2cf87809)
diff --git a/scripts/prepare-docs.mjs b/scripts/prepare-docs.mjs
--- a/scripts/prepare-docs.mjs
+++ b/scripts/prepare-docs.mjs
@@ -591,7 +591,9 @@
   }
 
   await rewriteProLinks(path.join(docsRoot, "pro"));
-  await rewriteFlattenedOssLinks(docsRoot);
+  if (layout === "split") {
+    await rewriteFlattenedOssLinks(docsRoot);
+  }
   await injectProFriendlyNotice(docsRoot);
   await fixKnownDocsIssues(docsRoot);
   await normalizeCodeFences(docsRoot);

if (await exists(sourceAssetsRoot)) {
await fs.cp(sourceAssetsRoot, path.join(docsRoot, "assets"), { recursive: true });
if (await exists(layoutPaths.assetsRoot)) {
await fs.cp(layoutPaths.assetsRoot, path.join(docsRoot, "assets"), { recursive: true });
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Split-only link rewriting applied unconditionally breaks consolidated layout

Medium Severity

rewriteFlattenedOssLinks is called unconditionally regardless of the detected layout, but its regex transformations (../../pro/../pro/, ../../images/../images/) are only correct for the split layout where the oss/ directory level has been removed. For the consolidated layout, two-level-deep docs like building-features/node-renderer/basics.md and upgrading/release-notes/*.md (confirmed in the sidebar) legitimately use ../../pro/ to reach the docs root — this function would incorrectly shorten those to ../pro/, producing broken links.

Fix in Cursor Fix in Web

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.

Sync pipeline: support both split and consolidated upstream docs layouts

1 participant