Skip to content

Sync sidebar navigation from source repo#68

Merged
justin808 merged 3 commits into
mainfrom
jg/toc-from-source-repo
Mar 29, 2026
Merged

Sync sidebar navigation from source repo#68
justin808 merged 3 commits into
mainfrom
jg/toc-from-source-repo

Conversation

@justin808
Copy link
Copy Markdown
Member

@justin808 justin808 commented Mar 29, 2026

Summary

  • Removes the manually-maintained sidebars.ts from this repo
  • sync-docs.mjs now also copies docs/sidebars.ts from the source repo to content/upstream/sidebars.ts
  • prepare-docs.mjs reads the synced sidebar, injects the Historical Reference/archive section (site-specific), and writes the final sidebars.ts to prototypes/docusaurus/
  • Both generated files are gitignored

Requires: A corresponding PR in react_on_rails to add docs/sidebars.ts (the sidebar definition, without the archive section which is site-specific).

Why

When new docs are added upstream (e.g. shakacode/react_on_rails#2876), they don't appear in the site navigation because sidebars.ts was maintained separately here. There are already ~12 docs in the source repo missing from the sidebar. This change makes docs authors own both content and navigation in one repo.

Test plan

  • Add docs/sidebars.ts to react_on_rails (prompt provided)
  • Run npm run prepare and verify prototypes/docusaurus/sidebars.ts is generated correctly with the archive section appended
  • Run npm run build:full and verify site builds and sidebar renders correctly

🤖 Generated with Claude Code


Note

Medium Risk
Moderate risk because it changes the docs build pipeline and relies on copying and regex-editing an upstream sidebars.ts, which could break navigation or builds if the upstream format changes.

Overview
Docs sidebar navigation is now sourced from the upstream docs repo instead of being maintained locally.

scripts/sync-docs.mjs additionally copies docs/sidebars.ts into content/upstream/sidebars.ts, and scripts/prepare-docs.mjs generates prototypes/docusaurus/sidebars.ts from that upstream file, optionally appending a site-specific Historical Reference archive section when legacy docs are archived.

Both the synced upstream sidebar and generated Docusaurus sidebar are now gitignored to avoid committing derived artifacts.

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

Summary by CodeRabbit

  • New Features

    • Documentation now supports automatic legacy archive organization with a dedicated "Historical Reference" section.
    • Sidebar configuration automatically synchronizes from upstream documentation sources.
  • Chores

    • Updated ignore rules and documentation build processes.

The sidebar TOC (sidebars.ts) was manually maintained in this site repo,
causing it to drift when new docs were added upstream. Now sync-docs.mjs
pulls docs/sidebars.ts from the source repo, and prepare-docs.mjs injects
the Historical Reference archive section before writing the final file.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 29, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5968892f-8ccd-4d07-a0d5-e4320753484d

📥 Commits

Reviewing files that changed from the base of the PR and between 7a3903e and bd5ed56.

📒 Files selected for processing (2)
  • .gitignore
  • scripts/prepare-docs.mjs
✅ Files skipped from review due to trivial changes (1)
  • scripts/prepare-docs.mjs
🚧 Files skipped from review as they are similar to previous changes (1)
  • .gitignore

Walkthrough

The changes introduce sidebar management functionality to the documentation build system. The code now syncs sidebars.ts from upstream sources, generates archive categories for legacy documentation, and injects them into Docusaurus sidebar configuration while ignoring the generated upstream sidebar file in version control.

Changes

Cohort / File(s) Summary
Version Control
.gitignore
Added ignore pattern for generated content/upstream/sidebars.ts file.
Sidebar Management
scripts/prepare-docs.mjs
Introduced archiveSidebarCategory() and prepareSidebars() functions to generate a "Historical Reference" category with legacy archive docs and inject it into the Docusaurus sidebar configuration via regex-based text replacement. Updated prepareDocusaurus() to call sidebar preparation after generating docs.
Upstream Synchronization
scripts/sync-docs.mjs
Added logic to copy sidebars.ts from source documentation repository to content/upstream/ after syncing the main docs tree, with logging and warning messages for success and missing files.

Sequence Diagram

sequenceDiagram
    participant Source as Upstream Docs<br/>Repository
    participant Sync as sync-docs.mjs
    participant Upstream as content/upstream/<br/>sidebars.ts
    participant Prepare as prepare-docs.mjs
    participant Output as prototypes/docusaurus/<br/>sidebars.ts

    Source->>Sync: Provides sidebars.ts
    Sync->>Upstream: Copy sidebars.ts<br/>(fs.copyFile)
    Upstream->>Prepare: Read configuration
    Prepare->>Prepare: Generate archive<br/>category (if needed)
    Prepare->>Prepare: Inject into docsSidebar<br/>(regex replacement)
    Prepare->>Output: Write modified<br/>sidebar config
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 Hops through docs with care,
Sidebars synced with flair,
Archive tucked away so neat,
Legacy docs—archival treat! 📚✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main objective of the PR: syncing sidebar navigation from the source repo, which is reflected across all three modified files (.gitignore, scripts/prepare-docs.mjs, and scripts/sync-docs.mjs).

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jg/toc-from-source-repo

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.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7a3903e24f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/prepare-docs.mjs Outdated
Comment on lines +589 to +591
if (!(await exists(upstreamSidebars))) {
console.warn("Warning: upstream sidebars.ts not found — keeping existing sidebars.ts");
return;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Fail prepare when upstream sidebars.ts is missing

This early return leaves the site without any generated sidebar file when content/upstream/sidebars.ts is absent, but this commit also deleted the checked-in prototypes/docusaurus/sidebars.ts fallback and gitignores it. On a fresh checkout (or any REACT_ON_RAILS_REF that does not yet include docs/sidebars.ts), npm run prepare:docs only warns and npm run build then fails because docusaurus.config.ts still requires sidebarPath: './sidebars.ts'. Please fail fast here or generate a deterministic fallback sidebar file.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
scripts/prepare-docs.mjs (1)

596-603: Consider warning when regex injection fails.

The regex /(\n \],\n\};\n)/ is sensitive to exact whitespace formatting. If the upstream sidebars.ts uses different indentation (e.g., tabs, 4 spaces, or trailing newline variations), the archive category won't be injected, and there's no warning to indicate this.

🛡️ Suggested defensive check
   if (hasArchive) {
     // Insert archive category as the last item in docsSidebar before the closing ];
     const archiveCategory = archiveSidebarCategory();
-    content = content.replace(
+    const updatedContent = content.replace(
       /(\n  \],\n\};\n)/,
       `\n${archiveCategory}\n  ],\n};\n`
     );
+    if (updatedContent === content) {
+      console.warn("Warning: Could not inject archive category — sidebar format may have changed");
+    }
+    content = updatedContent;
   }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/prepare-docs.mjs` around lines 596 - 603, The current injection using
content.replace with the strict regex /(\n  \],\n\};\n)/ can silently fail if
sidebar formatting differs; update the logic around hasArchive and
archiveSidebarCategory to first try a more permissive, whitespace-tolerant regex
(e.g., allow variable indentation and optional trailing newline) when calling
content.replace, then check the return value to see if replacement occurred (or
use a boolean/length check) and if it did not, emit a clear warning/log message
indicating the archive injection failed and include context (e.g., show a
snippet or the end of content) so the user can fix upstream sidebars.ts; ensure
the code path still provides a safe fallback (for example appending the archive
category at the end) if injection cannot be found.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@scripts/prepare-docs.mjs`:
- Around line 596-603: The current injection using content.replace with the
strict regex /(\n  \],\n\};\n)/ can silently fail if sidebar formatting differs;
update the logic around hasArchive and archiveSidebarCategory to first try a
more permissive, whitespace-tolerant regex (e.g., allow variable indentation and
optional trailing newline) when calling content.replace, then check the return
value to see if replacement occurred (or use a boolean/length check) and if it
did not, emit a clear warning/log message indicating the archive injection
failed and include context (e.g., show a snippet or the end of content) so the
user can fix upstream sidebars.ts; ensure the code path still provides a safe
fallback (for example appending the archive category at the end) if injection
cannot be found.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 77d9e171-af3f-418b-b808-d4ba0e704aa9

📥 Commits

Reviewing files that changed from the base of the PR and between 746501b and 7a3903e.

📒 Files selected for processing (4)
  • .gitignore
  • prototypes/docusaurus/sidebars.ts
  • scripts/prepare-docs.mjs
  • scripts/sync-docs.mjs
💤 Files with no reviewable changes (1)
  • prototypes/docusaurus/sidebars.ts

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 2 potential issues.

Autofix Details

Bugbot Autofix prepared fixes for both issues found in the latest run.

  • ✅ Fixed: Silent failure when regex doesn't match upstream sidebar format
    • The sidebar injection now uses a more tolerant closing-pattern regex and throws an explicit error when replacement does not occur.
  • ✅ Fixed: Fallback warning misleads when no sidebar file exists
    • When upstream sidebars are missing, the script now only warns if a target sidebar already exists and otherwise throws a clear missing-file error.

Create PR

Or push these changes by commenting:

@cursor push 527a182c7e
Preview (527a182c7e)
diff --git a/scripts/prepare-docs.mjs b/scripts/prepare-docs.mjs
--- a/scripts/prepare-docs.mjs
+++ b/scripts/prepare-docs.mjs
@@ -587,8 +587,13 @@
   const targetSidebars = path.join(siteRoot, "sidebars.ts");
 
   if (!(await exists(upstreamSidebars))) {
-    console.warn("Warning: upstream sidebars.ts not found — keeping existing sidebars.ts");
-    return;
+    if (await exists(targetSidebars)) {
+      console.warn("Warning: upstream sidebars.ts not found — keeping existing sidebars.ts");
+      return;
+    }
+    throw new Error(
+      `Could not prepare sidebars: missing upstream ${upstreamSidebars} and existing ${targetSidebars}`
+    );
   }
 
   let content = await fs.readFile(upstreamSidebars, "utf8");
@@ -596,10 +601,14 @@
   if (hasArchive) {
     // Insert archive category as the last item in docsSidebar before the closing ];
     const archiveCategory = archiveSidebarCategory();
-    content = content.replace(
-      /(\n  \],\n\};\n)/,
-      `\n${archiveCategory}\n  ],\n};\n`
+    const updatedContent = content.replace(
+      /(\r?\n\s*\],\r?\n\s*\};?\r?\n?)/,
+      `\n${archiveCategory}$1`
     );
+    if (updatedContent === content) {
+      throw new Error("Could not inject Historical Reference sidebar category into upstream sidebars.ts");
+    }
+    content = updatedContent;
   }
 
   await fs.writeFile(targetSidebars, content, "utf8");

You can send follow-ups to this agent here.

Comment thread scripts/prepare-docs.mjs Outdated
content = content.replace(
/(\n \],\n\};\n)/,
`\n${archiveCategory}\n ],\n};\n`
);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Silent failure when regex doesn't match upstream sidebar format

Medium Severity

The regex /(\n \],\n\};\n)/ used to inject the archive category into the upstream sidebar is brittle and fails silently. If the upstream sidebars.ts has any formatting difference (e.g., tabs, 4-space indent, no trailing semicolon, different newlines), String.prototype.replace returns the content unchanged with no warning. The Historical Reference section would silently disappear from the site navigation. Since the upstream file doesn't exist yet (per the PR description), there's no way to validate the format assumption upfront.

Fix in Cursor Fix in Web

Comment thread scripts/prepare-docs.mjs Outdated
justin808 and others added 2 commits March 28, 2026 19:44
The upstream docs/sidebars.ts doesn't exist yet, so the generated file
was missing and Docusaurus failed. Keep the committed copy as a fallback
that gets overwritten when the upstream file becomes available.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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 2 potential issues.

There are 3 total unresolved issues (including 1 from previous review).

Fix All in Cursor

Bugbot Autofix prepared fixes for both issues found in the latest run.

  • ✅ Fixed: Generated sidebars.ts not added to .gitignore
    • Added prototypes/docusaurus/sidebars.ts to .gitignore and removed the tracked generated file from git so prepare runs no longer dirty the repo.
  • ✅ Fixed: Stale sidebar persists when upstream removes file
    • Updated sync logic to delete content/upstream/sidebars.ts before conditional copy so stale sidebar files are cleared when upstream omits them.

Create PR

Or push these changes by commenting:

@cursor push c835105df6
Preview (c835105df6)
diff --git a/.gitignore b/.gitignore
--- a/.gitignore
+++ b/.gitignore
@@ -7,6 +7,7 @@
 content/upstream/docs-subset/
 content/upstream/sidebars.ts
 prototypes/docusaurus/docs/
+prototypes/docusaurus/sidebars.ts
 
 .DS_Store
 npm-debug.log*

diff --git a/prototypes/docusaurus/sidebars.ts b/prototypes/docusaurus/sidebars.ts
deleted file mode 100644
--- a/prototypes/docusaurus/sidebars.ts
+++ /dev/null
@@ -1,260 +1,0 @@
-import type {SidebarsConfig} from '@docusaurus/plugin-content-docs';
-
-// Intentionally excluded from sidebar (legacy stubs that redirect to archive):
-// - building-features/hmr-and-hot-reloading-with-the-webpack-dev-server
-// - building-features/rails-webpacker-react-integration-options
-// - deployment/troubleshooting-when-using-webpacker
-// - misc/asset-pipeline
-
-const sidebars: SidebarsConfig = {
-  docsSidebar: [
-    'README',
-    {
-      type: 'category',
-      label: 'Choose a Path',
-      collapsed: false,
-      items: [
-        'getting-started/create-react-on-rails-app',
-        'getting-started/installation-into-an-existing-rails-app',
-        'getting-started/oss-vs-pro',
-        'pro/upgrading-to-pro',
-        'migrating/migrating-from-react-rails',
-      ],
-    },
-    'introduction',
-    {
-      type: 'category',
-      label: 'Getting Started',
-      link: {type: 'generated-index', title: 'Getting Started'},
-      collapsed: false,
-      items: [
-        'getting-started/quick-start',
-        'getting-started/create-react-on-rails-app',
-        'getting-started/tutorial',
-        'getting-started/installation-into-an-existing-rails-app',
-        'getting-started/project-structure',
-        'getting-started/using-react-on-rails',
-        'getting-started/oss-vs-pro',
-        'getting-started/pro-quick-start',
-        'getting-started/comparison-with-alternatives',
-        'getting-started/common-issues',
-      ],
-    },
-    {
-      type: 'category',
-      label: 'Core Concepts',
-      link: {type: 'generated-index', title: 'Core Concepts'},
-      items: [
-        'core-concepts/how-react-on-rails-works',
-        'core-concepts/client-vs-server-rendering',
-        'core-concepts/react-server-rendering',
-        'core-concepts/render-functions-and-railscontext',
-        'core-concepts/render-functions',
-        'core-concepts/auto-bundling-file-system-based-automated-bundle-generation',
-        'core-concepts/webpack-configuration',
-        'pro/react-on-rails-pro',
-      ],
-    },
-    {
-      type: 'category',
-      label: 'Building Features',
-      link: {type: 'generated-index', title: 'Building Features'},
-      items: [
-        'building-features/react-and-redux',
-        'building-features/react-router',
-        'building-features/tanstack-router',
-        'building-features/code-splitting',
-        'building-features/i18n',
-        'building-features/images',
-        'building-features/react-helmet',
-        'building-features/react-19-native-metadata',
-        'building-features/streaming-server-rendering',
-        'building-features/how-to-conditionally-server-render-based-on-device-type',
-        'building-features/how-to-use-different-files-for-client-and-server-rendering',
-        'building-features/caching',
-        'building-features/bundle-caching',
-        'building-features/process-managers',
-        'building-features/dev-server-and-testing',
-        'building-features/testing-configuration',
-        'building-features/extensible-precompile-pattern',
-        'building-features/rails-engine-integration',
-        'building-features/turbolinks',
-        {
-          type: 'category',
-          label: 'Node Renderer (Pro)',
-          items: [
-            'building-features/node-renderer/basics',
-            'building-features/node-renderer/js-configuration',
-            'building-features/node-renderer/debugging',
-            'building-features/node-renderer/error-reporting-and-tracing',
-            'building-features/node-renderer/heroku',
-            'building-features/node-renderer/troubleshooting',
-          ],
-        },
-      ],
-    },
-    {
-      type: 'category',
-      label: 'Configuration',
-      items: [
-        'configuration/README',
-        'configuration/configuration-pro',
-        'configuration/configuration-deprecated',
-      ],
-    },
-    {
-      type: 'category',
-      label: 'API Reference',
-      items: [
-        'api-reference/view-helpers-api',
-        'api-reference/javascript-api',
-        'api-reference/redux-store-api',
-        'api-reference/ruby-api-pro',
-        'api-reference/generator-details',
-        'api-reference/rails-view-rendering-from-inline-javascript',
-      ],
-    },
-    {
-      type: 'category',
-      label: 'React Server Components',
-      items: [
-        'pro/react-server-components/purpose-and-benefits',
-        'pro/react-server-components/how-react-server-components-work',
-        'pro/react-server-components/rendering-flow',
-        'pro/react-server-components/tutorial',
-        'pro/react-server-components/server-side-rendering',
-        'pro/react-server-components/add-streaming-and-interactivity',
-        'pro/react-server-components/create-without-ssr',
-        'pro/react-server-components/inside-client-components',
-        'pro/react-server-components/selective-hydration-in-streamed-components',
-        'pro/react-server-components/flight-protocol-syntax',
-        'pro/react-server-components/glossary',
-        {
-          type: 'category',
-          label: 'Migrating to RSC',
-          items: [
-            'migrating/migrating-to-rsc',
-            'migrating/rsc-preparing-app',
-            'migrating/rsc-component-patterns',
-            'migrating/rsc-data-fetching',
-            'migrating/rsc-context-and-state',
-            'migrating/rsc-third-party-libs',
-            'migrating/rsc-troubleshooting',
-          ],
-        },
-      ],
-    },
-    {
-      type: 'category',
-      label: 'Deployment',
-      items: [
-        'deployment/README',
-        'deployment/heroku-deployment',
-        'deployment/elastic-beanstalk',
-        'deployment/capistrano-deployment',
-        'deployment/server-rendering-tips',
-        'deployment/troubleshooting',
-        'deployment/troubleshooting-build-errors',
-        'deployment/troubleshooting-when-using-shakapacker',
-      ],
-    },
-    {
-      type: 'category',
-      label: 'Upgrading',
-      items: [
-        'upgrading/upgrading-react-on-rails',
-        {
-          type: 'link',
-          label: 'Full Changelog (GitHub)',
-          href: 'https://github.com/shakacode/react_on_rails/blob/main/CHANGELOG.md',
-        },
-        {
-          type: 'category',
-          label: 'Release Notes',
-          items: [
-            'upgrading/release-notes/16.4.0',
-            'upgrading/release-notes/16.3.0',
-            'upgrading/release-notes/16.2.0',
-            'upgrading/release-notes/16.1.0',
-            'upgrading/release-notes/16.0.0',
-            'upgrading/release-notes/15.0.0',
-          ],
-        },
-        'pro/updating',
-        'pro/major-performance-breakthroughs-upgrade-guide',
-        {
-          type: 'category',
-          label: 'Pro Release Notes',
-          items: [
-            'pro/release-notes/v4-react-server-components',
-            'pro/release-notes/4.0',
-          ],
-        },
-      ],
-    },
-    {
-      type: 'category',
-      label: 'Migrating',
-      items: [
-        'migrating/migrating-from-react-rails',
-        'migrating/migrating-from-vite-rails',
-        'migrating/migrating-from-webpack-to-rspack',
-        'migrating/babel-to-swc-migration',
-        'migrating/convert-rails-5-api-only-app',
-        'migrating/angular-js-integration-migration',
-      ],
-    },
-    {
-      type: 'category',
-      label: 'React on Rails Pro',
-      link: {type: 'doc', id: 'pro/react-on-rails-pro'},
-      items: [
-        'pro/home-pro',
-        'pro/installation',
-        'pro/upgrading-to-pro',
-        'pro/js-memory-leaks',
-        'pro/profiling-server-side-rendering-code',
-        'pro/troubleshooting',
-      ],
-    },
-    {
-      type: 'category',
-      label: 'Contributor Guide',
-      items: [
-        'misc/doctrine',
-        'misc/style',
-        'misc/credits',
-        'misc/updating-dependencies',
-      ],
-    },
-    {
-      type: 'category',
-      label: 'Resources',
-      items: [
-        'misc/articles',
-        'misc/tips',
-      ],
-    },
-    {
-      type: 'category',
-      label: 'Historical Reference',
-      link: {type: 'generated-index', title: 'Historical Reference'},
-      items: [
-        'archive/README',
-        {
-          type: 'category',
-          label: 'Legacy Archive',
-          items: [
-            'archive/legacy/README',
-            'archive/legacy/building-features/hmr-and-hot-reloading-with-the-webpack-dev-server',
-            'archive/legacy/building-features/rails-webpacker-react-integration-options',
-            'archive/legacy/deployment/troubleshooting-when-using-webpacker',
-            'archive/legacy/misc/asset-pipeline',
-          ],
-        },
-      ],
-    },
-  ],
-};
-
-export default sidebars;
\ No newline at end of file

diff --git a/scripts/sync-docs.mjs b/scripts/sync-docs.mjs
--- a/scripts/sync-docs.mjs
+++ b/scripts/sync-docs.mjs
@@ -130,6 +130,7 @@
   // Sync sidebars.ts from upstream (source of truth for sidebar navigation)
   const upstreamSidebars = path.join(sourceDocsRoot, "sidebars.ts");
   const sidebarTarget = path.join(upstreamRoot, "sidebars.ts");
+  await fs.rm(sidebarTarget, { force: true });
   if (await exists(upstreamSidebars)) {
     await fs.copyFile(upstreamSidebars, sidebarTarget);
     console.log(`Synced sidebars.ts to ${sidebarTarget}`);

You can send follow-ups to this agent here.

Comment thread .gitignore

content/upstream/docs/
content/upstream/docs-subset/
content/upstream/sidebars.ts
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Generated sidebars.ts not added to .gitignore

Medium Severity

The PR description states "Both generated files are gitignored," but only content/upstream/sidebars.ts is added to .gitignore. The second generated file, prototypes/docusaurus/sidebars.ts (written by prepareSidebars), is not gitignored. Since this file is currently committed and tracked, every npm run prepare will cause git to show it as modified, risking accidental commits of generated content.

Additional Locations (1)
Fix in Cursor Fix in Web

Comment thread scripts/sync-docs.mjs
console.log(`Synced sidebars.ts to ${sidebarTarget}`);
} else {
console.warn("Warning: docs/sidebars.ts not found in source repo");
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale sidebar persists when upstream removes file

Low Severity

The docs directory is cleaned with fs.rm before syncing (line 126), but content/upstream/sidebars.ts is never removed before the conditional copy. If a previous sync copied a sidebars.ts and the upstream source no longer provides one, the stale file persists. prepare-docs.mjs then finds and uses this outdated sidebar, potentially referencing docs that no longer exist, causing build failures without any indication the sidebar is stale.

Fix in Cursor Fix in Web

@github-actions
Copy link
Copy Markdown

Cloudflare preview deployed.

@justin808 justin808 merged commit 3faacd6 into main Mar 29, 2026
5 checks passed
justin808 added a commit to shakacode/react_on_rails that referenced this pull request Mar 29, 2026
## Summary

- Adds `docs/sidebars.ts` — the Docusaurus sidebar definition — so docs
authors own both content and navigation in one repo
- Includes all 12 docs that were missing from the site's sidebar
navigation:
  - `building-features/debugging`
  - `building-features/node-renderer/container-deployment`
  - `core-concepts/execjs-limitations`
  - `core-concepts/performance-benchmarks`
  - `getting-started/comparing-react-on-rails-to-alternatives`
  - `getting-started/nextjs-with-separate-rails-backend`
  - `migrating/rsc-flight-payload`
  - `pro/fragment-caching`
  - `pro/node-renderer`
  - `pro/streaming-ssr`
  - `pro/react-server-components/index`
  - `pro/react-server-components/upgrading-existing-pro-app`
- The Historical Reference/Archive section is excluded — the site repo
injects it during build

Companion PR: shakacode/reactonrails.com#68

## How it works

1. Site repo's `sync-docs.mjs` copies `docs/sidebars.ts` alongside the
docs content
2. Site repo's `prepare-docs.mjs` reads it, injects the archive section,
writes final `sidebars.ts`
3. When docs authors add a new file, they also add it to this sidebar in
the same PR

## Test plan

- [ ] Merge companion PR (reactonrails.com#68) first or in parallel
- [ ] Run `npm run prepare && npm run build:full` on site repo to verify
sidebar generates correctly
- [ ] Verify all 12 newly-added docs appear in navigation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Low risk documentation-only change; main risk is broken/incorrect doc
navigation if sidebar ids/paths don’t match generated docs.
> 
> **Overview**
> Adds a first-class Docusaurus sidebar definition (`docs/sidebars.ts`)
so this repo owns docs navigation/TOC structure, including explicit
category organization and a documented exclusion list for legacy archive
stubs.
> 
> Updates the two “compare alternatives” docs to include Docusaurus
frontmatter (`sidebar_label`/`description`) so they render with clearer
titles in the new sidebar navigation.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
90c74d1. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Documentation**
* Redesigned site sidebar with a clear top-level overview and organized
sections (Getting Started, Core Concepts, Building Features,
Configuration, API, RSC, Deployment, Upgrading/Migrating, Pro topics,
Contributor Guide, Resources).
* Added generated-index pages and nested categories for advanced topics
(including Pro sections and migration guidance).
* Updated sidebar labels for comparison pages to "Decision Guide" and
"Feature Matrix & Benchmarks".
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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