Skip to content

Add npm READMEs, Pro quick-start guide, and llms.txt for LLM discoverability#2466

Merged
AbanoubGhadban merged 6 commits intomasterfrom
abanoub/improve-llm-discoverability
Feb 28, 2026
Merged

Add npm READMEs, Pro quick-start guide, and llms.txt for LLM discoverability#2466
AbanoubGhadban merged 6 commits intomasterfrom
abanoub/improve-llm-discoverability

Conversation

@AbanoubGhadban
Copy link
Collaborator

@AbanoubGhadban AbanoubGhadban commented Feb 21, 2026

Summary

LLMs consistently fail to generate correct React on Rails Pro setup code. After deep analysis (#2465), the root causes are:

  1. npm packages have no READMEs — npm READMEs are the TODO for first version #1 training signal for LLMs
  2. No single quick-start page — correct setup is spread across 4+ doc pages
  3. Incorrect example in Pro gem README — uses old @shakacode-tools/ scoped name and deprecated bundlePath

This PR addresses the low-effort, high-impact recommendations from #2465.

Changes

  • Add README.md to all 3 npm packages (react-on-rails, react-on-rails-pro, react-on-rails-pro-node-renderer) with correct API examples, config option tables, and package relationship docs
  • Fix incorrect example in Pro gem README — old scoped package name @shakacode-tools/react-on-rails-pro-node-rendererreact-on-rails-pro-node-renderer, deprecated bundlePathserverBundleCachePath
  • Add docs/getting-started/pro-quick-start.md — single self-contained guide for Pro setup from scratch using the --pro generator
  • Add llms.txt at repo root — follows the llms.txt convention providing LLMs with correct package relationships, API names, and config keys

What this does NOT include

Test plan

  • Verify npm README content is accurate against current API (TypeScript types in packages/react-on-rails-pro-node-renderer/lib/)
  • Verify Pro quick-start guide steps work with a fresh rails new + rails generate react_on_rails:install --pro
  • Verify llms.txt config examples match the generator templates in lib/generators/react_on_rails/templates/pro/
  • Confirm READMEs will be included in npm publish (no files field excluding them, or files field includes README.md)

Closes #2465

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • Added a Pro quick-start guide with step‑by‑step setup, SSR verification, Server Components, configuration examples, troubleshooting, and next steps.
    • Added/expanded package READMEs and Node renderer documentation covering installation, configuration, usage, customization, and links.
    • Replaced private-repo and private-publishing references with public equivalents and clarified onboarding wording.
  • Chores
    • Included READMEs in the published file lists for two packages.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 21, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds comprehensive documentation and READMEs for React on Rails Pro (npm packages and a pro quick-start guide), an llms reference file, minor gem README example tweaks, link updates across pro docs, removal of private-package publishing instructions, and inclusion of README files in two npm package publish lists.

Changes

Cohort / File(s) Summary
Package READMEs
packages/react-on-rails/README.md, packages/react-on-rails-pro/README.md, packages/react-on-rails-pro-node-renderer/README.md
New README files added with installation, quick-start examples, Node renderer instructions, config options, and integration notes. Verify example imports, configuration keys, and package names match runtime APIs.
Quick Start Guide
docs/getting-started/pro-quick-start.md
New end-to-end "React on Rails Pro: Quick Start from Scratch" guide with commands, scaffolded files, Pro installer steps, multi-process dev startup, SSR/hydration verification, RSC notes, and troubleshooting. Check command accuracy and provided code blocks.
LLM Reference
llms.txt
New LLM-focused reference consolidating package relationships, correct package pairings/version cautions, Node Renderer API examples, Rails config keys, Webpack server notes, and client/server snippets. Review for factual correctness and API name accuracy.
Gem README edit
react_on_rails_pro/README.md
Updated Node renderer example: added const path = require('path'), switched require to react-on-rails-pro-node-renderer, renamed example file to node-renderer.js, and changed bundlePathserverBundleCachePath with new path. Confirm option names match library.
Contributor docs
docs/contributor-info/releasing.md
Removed private-publishing instructions for GitHub Packages and RubyGems (auth token/local auth lines deleted). Ensure public publishing instructions remain intact.
Documentation link fixes
react_on_rails_pro/docs/...
Replaced private-repo links and removed private-access notes across code-splitting, ruby-api, and updating docs; updated links to public repository paths. Validate updated links resolve correctly.
Package publish lists
packages/react-on-rails/package.json, packages/react-on-rails-pro/package.json
Added "README.md" to each package's files array so READMEs are included in published packages. Confirm published tarballs contain intended files.
Misc docs
packages/.../README.md, react_on_rails_pro/docs/...
Various wording/link adjustments and minor content edits across pro docs to improve public visibility and examples. Review for consistency and correctness.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

🐇 I nibbled docs beneath the moon's soft light,

node-renderer hums and examples gleam bright.
READMEs planted where confusion grew,
a quick-start path to chase bugs askew.
Hop on—SSR dreams now take flight!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 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 changes: adding npm READMEs, a Pro quick-start guide, and llms.txt for LLM discoverability.
Linked Issues check ✅ Passed The PR implements all P0 priority objectives from #2465: adds npm package READMEs with API details, creates the Pro quick-start doc, and includes llms.txt for LLM training data visibility.
Out of Scope Changes check ✅ Passed All changes are directly aligned with the objectives in #2465; documentation updates, example corrections, and package metadata adjustments are all in scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch abanoub/improve-llm-discoverability

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.

@greptile-apps
Copy link

greptile-apps bot commented Feb 21, 2026

Greptile Summary

Adds npm READMEs, Pro quick-start guide, and llms.txt to improve LLM discoverability and correct setup guidance.

Key improvements:

  • Adds comprehensive READMEs to all 3 npm packages with correct API examples and config tables
  • Fixes Pro gem README example (deprecated @shakacode-tools/ scoped name → react-on-rails-pro-node-renderer, bundlePathserverBundleCachePath)
  • Adds single-page Pro quick-start guide matching --pro generator output
  • Adds llms.txt with accurate package relationships and config examples

Critical issue:

  • READMEs for react-on-rails and react-on-rails-pro packages won't be published to npm due to missing README.md entry in their package.json files field, defeating the primary goal of this PR

Confidence Score: 3/5

  • Safe to merge after fixing critical npm publish configuration that prevents READMEs from being included
  • Documentation is accurate and well-written, but the primary objective (adding npm READMEs for LLM training) will fail because two of the three packages exclude README.md from their npm publish files
  • Check packages/react-on-rails/package.json and packages/react-on-rails-pro/package.json - both need README.md added to files array

Important Files Changed

Filename Overview
packages/react-on-rails/README.md Added comprehensive README for base npm package with API docs and usage examples; missing from files field in package.json
packages/react-on-rails-pro/README.md Added Pro npm package README with RSC exports and package relationship docs; missing from files field in package.json
packages/react-on-rails-pro-node-renderer/README.md Added Node Renderer README with correct API examples, config options table, and advanced usage; no files field so README will publish by default
react_on_rails_pro/README.md Fixed deprecated package name and config key in example (old scoped name → unscoped, bundlePathserverBundleCachePath)
docs/getting-started/pro-quick-start.md Added comprehensive Pro quick-start guide matching generator template output with accurate config examples
llms.txt Added llms.txt with correct package relationships, API names, and config matching generator templates

Last reviewed commit: fdd60ac

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

6 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

@@ -0,0 +1,106 @@
# react-on-rails
Copy link

Choose a reason for hiding this comment

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

README.md won't be published to npm. The "files" field in package.json only includes lib/** files, which excludes README.md. Add "README.md" to the files array in packages/react-on-rails/package.json:

Suggested change
# react-on-rails
"files": [
"README.md",
"lib/**/*.js",

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed — added "README.md" to the files array in both packages/react-on-rails/package.json and packages/react-on-rails-pro/package.json.

@@ -0,0 +1,97 @@
# react-on-rails-pro
Copy link

Choose a reason for hiding this comment

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

README.md won't be published to npm. The "files" field in package.json only includes lib/** files. Add "README.md" to the files array in packages/react-on-rails-pro/package.json:

Suggested change
# react-on-rails-pro
"files": [
"README.md",
"lib/**/*.js",

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in the same commit — see reply above.

@claude
Copy link

claude bot commented Feb 21, 2026

PR Review: Add npm READMEs, Pro quick-start guide, and llms.txt

Overall this is a well-structured PR that addresses a real problem (LLMs generating incorrect setup code). The content is largely accurate and the motivation is sound. I found a few issues worth addressing before merge.

Critical: serverBundleCachePath path is wrong in pro-quick-start.md

The "What the generator configured" section (Node-side example) shows:

serverBundleCachePath: path.resolve(__dirname, './.node-renderer-bundles'),

But the actual generator template (lib/generators/react_on_rails/templates/pro/base/client/node-renderer.js) uses:

serverBundleCachePath: path.resolve(__dirname, '../.node-renderer-bundles'),

Because the generator places the file at client/node-renderer.js, __dirname resolves to the client/ directory. The '../' prefix is needed to put the cache at the project root (not inside client/.node-renderer-bundles). The quick-start's "What the generator configured" section claims to show what the generator produces, but it shows the wrong path.

Minor: Quick-start node config diverges from actual generator template

The "Node-side" code in pro-quick-start.md omits several options that the real template includes: logLevel, additionalContext: { URL, AbortController }, stubTimers: false, and replayServerAsyncOperationLogs: true. Also, the template uses password: env.RENDERER_PASSWORD || 'devPassword' for a development fallback, while the quick-start omits the fallback. The llms.txt and node-renderer README examples are fine since they show simplified API-reference examples, but the quick-start explicitly frames its code as "what the generator configured", so it should be accurate.

Minor: Confusing sentence about gem rejection in react-on-rails-pro/README.md

"The base gem will reject react-on-rails if the Pro gem is detected."

"The base gem" here is ambiguous — readers may not know which gem is doing the rejecting. A clearer phrasing would be something like: "If the react_on_rails_pro gem is present, the runtime will raise an error if the base react-on-rails npm package is used instead of react-on-rails-pro."\n\n### Minor: Unused import in error reporting example

The advanced error reporting example in react-on-rails-pro-node-renderer/README.md imports setupTracing but never uses it, which may confuse readers copying the snippet.

Minor: Version pins in quick-start will go stale

Pinning gem "react_on_rails", "~> 16.3" and gem "react_on_rails_pro", "~> 16.3" is fine today (current is 16.4.0.rc.3), but these explicit minor-version pins in a guide will need updating with every minor release. Consider using a floor constraint (">= 16.4") or no pin at all — similar to how the gemspec itself only requires shakapacker >= 6.0.

### Node-side (client/node-renderer.js)

```js
const { reactOnRailsProNodeRenderer } = require('react-on-rails-pro-node-renderer');
Copy link

Choose a reason for hiding this comment

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

The generator places node-renderer.js at client/node-renderer.js (as shown in the table above), so __dirname resolves to client/. The correct path to put the cache at the project root (matching the actual template) is '../.node-renderer-bundles', not './.node-renderer-bundles'.

Suggested change
const { reactOnRailsProNodeRenderer } = require('react-on-rails-pro-node-renderer');
serverBundleCachePath: path.resolve(__dirname, '../.node-renderer-bundles'),

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed — path updated to '../.node-renderer-bundles' and added missing require('path').

**Important:** When using the `react_on_rails_pro` Ruby gem, you **must** use this package (`react-on-rails-pro`) instead of `react-on-rails`. The base gem will reject `react-on-rails` if the Pro gem is detected.

## Usage

Copy link

Choose a reason for hiding this comment

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

The sentence "The base gem will reject react-on-rails if the Pro gem is detected" is confusing — "the base gem" is ambiguous and it's the Pro gem that enforces this requirement, not the base gem. Suggested rewrite:

Suggested change
**Important:** When using the `react_on_rails_pro` Ruby gem, you **must** use this package (`react-on-rails-pro`) instead of `react-on-rails`. If the Pro gem detects the base `react-on-rails` npm package at runtime, it will raise an error.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed — reworded to: "If the Pro gem detects the base react-on-rails npm package at runtime, it will raise an error."


- [Node Renderer Basics](https://www.shakacode.com/react-on-rails-pro/docs/node-renderer/basics/)
- [JavaScript Configuration](https://www.shakacode.com/react-on-rails-pro/docs/node-renderer/js-configuration/)
- [Rails Configuration](https://www.shakacode.com/react-on-rails-pro/docs/configuration/)
Copy link

Choose a reason for hiding this comment

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

setupTracing is imported here but never used in the example. Either add an example usage or remove it from the import to avoid confusing copy-paste.

Suggested change
- [Rails Configuration](https://www.shakacode.com/react-on-rails-pro/docs/configuration/)
import { addNotifier } from 'react-on-rails-pro-node-renderer/integrations/api';

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in commit 71b1345.

Copy link
Contributor

@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.

Actionable comments posted: 4

🧹 Nitpick comments (2)
packages/react-on-rails-pro/README.md (1)

33-39: RSC example imports RSCRoute and wrapServerComponentRenderer but never uses them

The imports on lines 34–36 include RSCRoute and wrapServerComponentRenderer, but only registerServerComponent is exercised. Consider either removing the unused imports from the snippet or expanding the example to show RSCRoute rendering.

✨ Option A – trim to what the example actually demonstrates
-import { RSCRoute } from 'react-on-rails-pro/RSCRoute';
-import registerServerComponent from 'react-on-rails-pro/registerServerComponent/client';
-import { wrapServerComponentRenderer } from 'react-on-rails-pro/wrapServerComponentRenderer/client';
-
-// Register a server component for client-side hydration
-registerServerComponent({ MyServerComponent });
+import registerServerComponent from 'react-on-rails-pro/registerServerComponent/client';
+
+// Register a server component for client-side hydration
+registerServerComponent({ MyServerComponent });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/react-on-rails-pro/README.md` around lines 33 - 39, The README
snippet imports RSCRoute and wrapServerComponentRenderer but only uses
registerServerComponent; either remove the unused imports (delete RSCRoute and
wrapServerComponentRenderer from the import lines) or expand the example to
demonstrate their usage by showing RSCRoute rendering and invoking
wrapServerComponentRenderer (e.g., reference RSCRoute and
wrapServerComponentRenderer in the snippet so all imported symbols are exercised
alongside registerServerComponent).
packages/react-on-rails-pro-node-renderer/README.md (1)

138-144: setupTracing is imported but not used in the error-reporting example

Either use setupTracing in the snippet or remove it from the import.

✨ Proposed fix
-import { addNotifier, setupTracing } from 'react-on-rails-pro-node-renderer/integrations/api';
+import { addNotifier } from 'react-on-rails-pro-node-renderer/integrations/api';
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/react-on-rails-pro-node-renderer/README.md` around lines 138 - 144,
The example imports setupTracing but never uses it; update the snippet to either
use setupTracing or remove it—simplest fix: change the import to only bring
addNotifier (remove setupTracing) so the sample shows a used import (refer to
addNotifier and setupTracing in the README example).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/getting-started/pro-quick-start.md`:
- Line 149: The markdown entry for the Code Splitting link currently points to a
404 URL; locate the line containing the link text "[Code
Splitting](https://www.shakacode.com/react-on-rails-pro/docs/code-splitting/)"
in pro-quick-start.md and either replace the broken URL with the correct working
URL for the Code Splitting docs or remove the entire bullet (the "[Code
Splitting](...)" link) until the target page is restored, ensuring the
surrounding list formatting remains valid.
- Around line 107-115: The example calling reactOnRailsProNodeRenderer uses
path.resolve but never imports path and uses the wrong env var name for
workersCount; add a require('path') at top so path is defined, and change the
workersCount expression from reading process.env.NODE_RENDERER_CONCURRENCY to
process.env.RENDERER_WORKERS_COUNT (fallback to 3 unchanged) so
serverBundleCachePath and workersCount are correct and consistent with the
README.

In `@packages/react-on-rails-pro-node-renderer/README.md`:
- Around line 114-131: Add a brief note above the Advanced example explaining it
uses ESM syntax so users must either use .mjs or set "type":"module" in
package.json or convert the imports to CommonJS; reference the example's symbols
(masterRun, run, configureFastify, cluster) so readers know the note applies to
that snippet.
- Around line 79-81: The README's fenced code block for the Procfile entry lacks
a language specifier which triggers MD040; update the Procfile code block
surrounding the line "node-renderer: node node-renderer.js" to include a
language identifier (for example use "text" or "procfile") so the block becomes
```text ... ``` (or ```procfile ... ```) to silence the markdownlint warning.

---

Nitpick comments:
In `@packages/react-on-rails-pro-node-renderer/README.md`:
- Around line 138-144: The example imports setupTracing but never uses it;
update the snippet to either use setupTracing or remove it—simplest fix: change
the import to only bring addNotifier (remove setupTracing) so the sample shows a
used import (refer to addNotifier and setupTracing in the README example).

In `@packages/react-on-rails-pro/README.md`:
- Around line 33-39: The README snippet imports RSCRoute and
wrapServerComponentRenderer but only uses registerServerComponent; either remove
the unused imports (delete RSCRoute and wrapServerComponentRenderer from the
import lines) or expand the example to demonstrate their usage by showing
RSCRoute rendering and invoking wrapServerComponentRenderer (e.g., reference
RSCRoute and wrapServerComponentRenderer in the snippet so all imported symbols
are exercised alongside registerServerComponent).

@AbanoubGhadban AbanoubGhadban force-pushed the abanoub/improve-llm-discoverability branch from fdd60ac to ec95e93 Compare February 23, 2026 11:06
@claude
Copy link

claude bot commented Feb 23, 2026

Review Summary

The goal of this PR (improving LLM discoverability by adding npm READMEs) is well-motivated and the content is generally accurate. However, there is one critical defect that completely undermines the main purpose, plus a few inconsistencies worth fixing before merge.

Critical: README files will not be published to npm

Both react-on-rails and react-on-rails-pro packages have explicit files arrays in their package.json that restrict what gets included in the npm tarball:

  • packages/react-on-rails/package.jsonfiles includes only lib/**/*.js, lib/**/*.cjs, lib/**/*.mjs, lib/**/*.d.ts
  • packages/react-on-rails-pro/package.jsonfiles includes only lib/**/*.js, lib/**/*.d.ts

Neither README.md matches these patterns, so the READMEs will be silently excluded from both npm packages. The react-on-rails-pro-node-renderer package has no files field at all, so its README will be included correctly.

Fix: Add "README.md" to the files arrays in both package.json files.

Inconsistency: RENDERER_URL vs REACT_RENDERER_URL

The two new docs disagree on the environment variable name for renderer_url:

File Env var used
docs/getting-started/pro-quick-start.md REACT_RENDERER_URL (matches the generator template)
packages/react-on-rails-pro-node-renderer/README.md RENDERER_URL

The generator template (lib/generators/react_on_rails/templates/pro/base/config/initializers/react_on_rails_pro.rb.tt) uses REACT_RENDERER_URL, so the node-renderer README should be updated to match.

Clarification needed: workersCount env variable

The node-renderer README config table says the env variable for workersCount is RENDERER_WORKERS_COUNT. But the generator template (client/node-renderer.js) reads NODE_RENDERER_CONCURRENCY and passes it manually as workersCount. These are different things — the renderer supports both (via its internal env and via the JS config object), but someone following the node-renderer README while also using the generator-created file will be confused about which env var to set. The table footnote or a note in the README should clarify this.

@@ -0,0 +1,106 @@
# react-on-rails
Copy link

Choose a reason for hiding this comment

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

This README will not be included in the npm publish. packages/react-on-rails/package.json has a files field that only matches lib/**/*.js, lib/**/*.cjs, lib/**/*.mjs, and lib/**/*.d.tsREADME.md does not match any of these patterns.

Fix: add "README.md" to the files array in packages/react-on-rails/package.json:

Suggested change
# react-on-rails
# react-on-rails

(The README content is fine; the change needed is in package.json, not here.)

"files": [
  "lib/**/*.js",
  "lib/**/*.cjs",
  "lib/**/*.mjs",
  "lib/**/*.d.ts",
  "README.md"
]

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed — added "README.md" to files array in packages/react-on-rails/package.json.

@@ -0,0 +1,97 @@
# react-on-rails-pro
Copy link

Choose a reason for hiding this comment

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

Same issue as the base package: packages/react-on-rails-pro/package.json has:

"files": [
  "lib/**/*.js",
  "lib/**/*.d.ts"
]

README.md is excluded. Add "README.md" to that files array to ensure it gets published to npm.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed — added "README.md" to files array in packages/react-on-rails-pro/package.json.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 23, 2026

size-limit report 📦

Path Size
react-on-rails/client bundled (gzip) 62.5 KB (0%)
react-on-rails/client bundled (gzip) (time) 62.5 KB (0%)
react-on-rails/client bundled (brotli) 53.71 KB (0%)
react-on-rails/client bundled (brotli) (time) 53.71 KB (0%)
react-on-rails-pro/client bundled (gzip) 63.5 KB (0%)
react-on-rails-pro/client bundled (gzip) (time) 63.5 KB (0%)
react-on-rails-pro/client bundled (brotli) 54.67 KB (0%)
react-on-rails-pro/client bundled (brotli) (time) 54.67 KB (0%)
registerServerComponent/client bundled (gzip) 127.16 KB (0%)
registerServerComponent/client bundled (gzip) (time) 127.16 KB (0%)
registerServerComponent/client bundled (brotli) 61.54 KB (0%)
registerServerComponent/client bundled (brotli) (time) 61.54 KB (0%)
wrapServerComponentRenderer/client bundled (gzip) 121.69 KB (0%)
wrapServerComponentRenderer/client bundled (gzip) (time) 121.69 KB (0%)
wrapServerComponentRenderer/client bundled (brotli) 56.63 KB (0%)
wrapServerComponentRenderer/client bundled (brotli) (time) 56.63 KB (0%)

Copy link
Contributor

@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.

Actionable comments posted: 1

♻️ Duplicate comments (2)
docs/getting-started/pro-quick-start.md (2)

149-149: Broken link (404) confirmed by CI pipeline — already noted

This was flagged in a previous review round and confirmed by the GitHub Actions "Check Markdown Links" pipeline failure.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/getting-started/pro-quick-start.md` at line 149, The markdown contains a
broken external link for "Code Splitting" pointing to
https://www.shakacode.com/react-on-rails-pro/docs/code-splitting/; replace the
dead URL with a working target (either the current ShakaCode page for
code-splitting or an alternative authoritative resource) or remove the link if
no replacement exists, ensuring the link text "Code Splitting" remains accurate;
update the link in the pro-quick-start document so the CI "Check Markdown Links"
pipeline no longer reports a 404.

107-115: require('path') is missing and env var name is inconsistent — already noted

This was flagged in a previous review round.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/getting-started/pro-quick-start.md` around lines 107 - 115, Add the
missing require('path') at the top and make the environment variable names
consistent: import path (e.g., const path = require('path')) and ensure you use
the same naming scheme for port and concurrency (either both RENDERER_* or both
NODE_RENDERER_*); update the reactOnRailsProNodeRenderer call
(reactOnRailsProNodeRenderer, serverBundleCachePath, port, workersCount) to
reference the chosen env vars (e.g., process.env.RENDERER_PORT and
process.env.RENDERER_CONCURRENCY or process.env.NODE_RENDERER_PORT and
process.env.NODE_RENDERER_CONCURRENCY) so names are no longer inconsistent.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/react-on-rails-pro/README.md`:
- Around line 44-47: Update the unlabeled code fence in the README diagram to
include a language specifier (e.g., change the opening ``` to ```text or
```ascii) so the ASCII-art block in the README.md is labeled and satisfies
MD040; ensure the opening fence is updated and the closing ``` remains present
around the block containing "react-on-rails-pro (this package) └──
react-on-rails (base package, automatically installed as dependency)".

---

Duplicate comments:
In `@docs/getting-started/pro-quick-start.md`:
- Line 149: The markdown contains a broken external link for "Code Splitting"
pointing to https://www.shakacode.com/react-on-rails-pro/docs/code-splitting/;
replace the dead URL with a working target (either the current ShakaCode page
for code-splitting or an alternative authoritative resource) or remove the link
if no replacement exists, ensuring the link text "Code Splitting" remains
accurate; update the link in the pro-quick-start document so the CI "Check
Markdown Links" pipeline no longer reports a 404.
- Around line 107-115: Add the missing require('path') at the top and make the
environment variable names consistent: import path (e.g., const path =
require('path')) and ensure you use the same naming scheme for port and
concurrency (either both RENDERER_* or both NODE_RENDERER_*); update the
reactOnRailsProNodeRenderer call (reactOnRailsProNodeRenderer,
serverBundleCachePath, port, workersCount) to reference the chosen env vars
(e.g., process.env.RENDERER_PORT and process.env.RENDERER_CONCURRENCY or
process.env.NODE_RENDERER_PORT and process.env.NODE_RENDERER_CONCURRENCY) so
names are no longer inconsistent.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fdd60ac and ec95e93.

📒 Files selected for processing (6)
  • docs/getting-started/pro-quick-start.md
  • llms.txt
  • packages/react-on-rails-pro-node-renderer/README.md
  • packages/react-on-rails-pro/README.md
  • packages/react-on-rails/README.md
  • react_on_rails_pro/README.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/react-on-rails-pro-node-renderer/README.md
  • llms.txt

@claude
Copy link

claude bot commented Feb 23, 2026

Review: Documentation Accuracy Issues

Good effort on centralizing the LLM-discoverability content — the motivation is sound and most of the changes are accurate. However, I found several factual inconsistencies across the new docs that could mislead developers more than the current state of affairs. These should be fixed before merging.

Critical: Wrong env variable name in node-renderer README

In packages/react-on-rails-pro-node-renderer/README.md, the Rails config example uses:

config.renderer_url = ENV["RENDERER_URL"] || "http://localhost:3800"

But the actual generator template (react_on_rails/lib/generators/react_on_rails/templates/pro/base/config/initializers/react_on_rails_pro.rb.tt) uses REACT_RENDERER_URL, not RENDERER_URL. The pro-quick-start.md and llms.txt both correctly use REACT_RENDERER_URL. This inconsistency means a developer following the node-renderer README will configure the wrong env var and the connection will silently use the default URL.

Incorrect serverBundleCachePath in pro-quick-start.md

The "What the generator configured" section shows:

serverBundleCachePath: path.resolve(__dirname, './.node-renderer-bundles'),

But the generator creates the file at client/node-renderer.js, and the actual template uses:

serverBundleCachePath: path.resolve(__dirname, '../.node-renderer-bundles'),

The ../ is required to place the cache at the project root rather than inside client/. The simplified example in the quick-start will cache bundles in the wrong directory.

Inconsistent env var for workersCount

The README configuration table documents RENDERER_WORKERS_COUNT as the env var for workersCount, but the actual generator template reads NODE_RENDERER_CONCURRENCY. Developers who rely on the README table to configure workers via env var will find it doesn't work.

"What the generator configured" is misleading

The quick-start guide section titled "What the generator configured" shows a 5-option simplified snippet, but the actual generator template produces a much richer file including ssr_timeout, renderer_request_retry_limit, renderer_use_fallback_exec_js, tracing, CI-specific workersCount override, additionalContext, replayServerAsyncOperationLogs, and stubTimers. A developer will see their generated file and find it doesn't match the docs. Consider labeling this as a "minimal example" or linking directly to the template source.

Mixed module syntax in Advanced section (minor)

The Advanced section uses ESM import statements, while the entire Quick Start and the generator template use CommonJS require(). There's no note explaining this switch or whether the package ships ESM. Needs a clarifying sentence.

Files field does not block README from npm publish

The test plan item about confirming README.md inclusion is correct in outcome but the reasoning is unnecessary: npm always includes README.md in published packages regardless of the files field. This is fine — the READMEs will be published.

Comment on lines 54 to 55
config.renderer_url = ENV["RENDERER_URL"] || "http://localhost:3800"
config.renderer_password = ENV["RENDERER_PASSWORD"]
Copy link

Choose a reason for hiding this comment

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

Wrong env variable name — RENDERER_URL should be REACT_RENDERER_URL. The generator template (lib/generators/react_on_rails/templates/pro/base/config/initializers/react_on_rails_pro.rb.tt) and all other docs (pro-quick-start.md, llms.txt) consistently use REACT_RENDERER_URL. Using RENDERER_URL here will silently fall back to the hardcoded default and the env var will have no effect.

Also note the missing default for renderer_password — the generator template uses ENV.fetch("RENDERER_PASSWORD", "devPassword") for development parity.

Suggested change
config.renderer_url = ENV["RENDERER_URL"] || "http://localhost:3800"
config.renderer_password = ENV["RENDERER_PASSWORD"]
config.renderer_url = ENV.fetch("REACT_RENDERER_URL", "http://localhost:3800")
config.renderer_password = ENV.fetch("RENDERER_PASSWORD", "devPassword")

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in commit 71b1345.

const { reactOnRailsProNodeRenderer } = require('react-on-rails-pro-node-renderer');

reactOnRailsProNodeRenderer({
serverBundleCachePath: path.resolve(__dirname, './.node-renderer-bundles'),
Copy link

Choose a reason for hiding this comment

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

Wrong relative path. Since the generator places this file at client/node-renderer.js, __dirname is the client/ directory. Using './.node-renderer-bundles' puts the cache inside client/, not the project root. The actual generator template uses '../.node-renderer-bundles' to resolve to the project root.

Also missing the const path = require('path'); import at the top of this snippet.

Suggested change
serverBundleCachePath: path.resolve(__dirname, './.node-renderer-bundles'),
serverBundleCachePath: path.resolve(__dirname, '../.node-renderer-bundles'),

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in commit 71b1345.

Comment on lines 92 to 103
## What the generator configured

### Rails-side (config/initializers/react_on_rails_pro.rb)

```ruby
ReactOnRailsPro.configure do |config|
config.server_renderer = "NodeRenderer"
config.renderer_url = ENV.fetch("REACT_RENDERER_URL", "http://localhost:3800")
config.renderer_password = ENV.fetch("RENDERER_PASSWORD", "devPassword")
config.prerender_caching = true
end
```
Copy link

Choose a reason for hiding this comment

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

The section title "What the generator configured" sets the expectation of accuracy, but the snippet is significantly simplified compared to the actual generated file. The real generator template also includes ssr_timeout, renderer_request_retry_limit, renderer_use_fallback_exec_js, tracing, etc. A developer who looks at their generated file will find it doesn't match.

Consider either:

  1. Renaming this to "Minimal configuration example" and noting the generator produces a fuller version
  2. Showing the complete output that matches the actual template

Otherwise developers opening their generated initializer will be confused by options not shown here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in commit 71b1345.

Comment on lines +114 to +117
```js
import masterRun from 'react-on-rails-pro-node-renderer/master';
import run, { configureFastify } from 'react-on-rails-pro-node-renderer/worker';
import cluster from 'cluster';
Copy link

Choose a reason for hiding this comment

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

The Advanced section switches to ESM import syntax without any note about it, while the entire Quick Start and the actual generator template use CommonJS require(). The package doesn't declare "type": "module" in its package.json, so CJS is the default.

Consider adding a note clarifying this is the ESM usage pattern, or converting to require() to be consistent with the Quick Start above.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in commit 71b1345.

| `logHttpLevel` | `RENDERER_LOG_HTTP_LEVEL` | `'error'` | HTTP server log level |
| `serverBundleCachePath` | `RENDERER_SERVER_BUNDLE_CACHE_PATH` | Auto-detected or `/tmp/...` | Directory for cached server bundles |
| `supportModules` | `RENDERER_SUPPORT_MODULES` | `false` | Enable Node.js globals in VM context (`Buffer`, `process`, `setTimeout`, etc.) |
| `workersCount` | `RENDERER_WORKERS_COUNT` | CPU count - 1 | Number of worker processes |
Copy link

Choose a reason for hiding this comment

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

The env variable name here (RENDERER_WORKERS_COUNT) doesn't match what the generator template uses. The actual generator template (lib/generators/react_on_rails/templates/pro/base/client/node-renderer.js) reads NODE_RENDERER_CONCURRENCY:

workersCount: env.NODE_RENDERER_CONCURRENCY != null ? Number(env.NODE_RENDERER_CONCURRENCY) : 3,

If the package itself reads RENDERER_WORKERS_COUNT internally (separate from the generator config), this needs a clarifying note. If not, this documents a non-functional env var name for the most common use case (following the generator).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in commit 71b1345.

AbanoubGhadban and others added 3 commits February 28, 2026 13:08
…ability

LLMs consistently fail to generate correct React on Rails Pro setup code because
the npm packages have no READMEs, there's no single quick-start page, and the
correct API names are not discoverable from training data.

Changes:
- Add README.md to all 3 npm packages (react-on-rails, react-on-rails-pro,
  react-on-rails-pro-node-renderer) with correct API examples, config options,
  and package relationship documentation
- Fix incorrect example in Pro gem README (wrong scoped package name
  @shakacode-tools/... and deprecated bundlePath config key)
- Add docs/getting-started/pro-quick-start.md — a single self-contained guide
  for setting up a Pro app from scratch using the --pro generator
- Add llms.txt at repo root following the llms.txt convention, providing
  LLMs with correct package relationships, API names, and config keys

Addresses #2465

Co-Authored-By: Claude Opus 4.6 <[email protected]>
All React on Rails Pro gems and npm packages are now in the public
monorepo. Remove "you will need access to our private repository"
notes, update GitHub links from the old shakacode/react_on_rails_pro
repo to shakacode/react_on_rails monorepo paths, remove obsolete
GitHub Packages publishing instructions from releasing guide, and
fix tense in the upgrade guide.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
…and npm publish

- Fix broken code-splitting link (404) with correct URL
- Add missing require('path') and fix serverBundleCachePath in quick-start
- Fix RENDERER_URL -> REACT_RENDERER_URL to match generator template
- Add password field and devPassword default in examples
- Add README.md to files array in react-on-rails and react-on-rails-pro
  package.json so READMEs are included in npm publish
- Add language specifiers to code blocks (MD040)
- Add ESM note for advanced section in node-renderer README
- Remove unused setupTracing import from error reporting example
- Clarify NODE_RENDERER_CONCURRENCY vs RENDERER_WORKERS_COUNT env vars
- Fix confusing "base gem will reject" sentence

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@AbanoubGhadban AbanoubGhadban force-pushed the abanoub/improve-llm-discoverability branch from dd8f302 to 71b1345 Compare February 28, 2026 11:11

### Correct usage:
```js
const { reactOnRailsProNodeRenderer } = require('react-on-rails-pro-node-renderer');
Copy link

Choose a reason for hiding this comment

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

The code example uses path.resolve(__dirname, ...) on line 48 but never imports the path module. Since llms.txt is specifically designed to train LLMs to write correct code, this bug directly undermines the file's purpose.

Suggested change
const { reactOnRailsProNodeRenderer } = require('react-on-rails-pro-node-renderer');
const path = require('path');
const { reactOnRailsProNodeRenderer } = require('react-on-rails-pro-node-renderer');

## Step 1: Create a new Rails app

```bash
rails new my-pro-app --skip-javascript --skip-docker
Copy link

Choose a reason for hiding this comment

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

The --skip-docker flag was added in Rails 7.1. The prerequisites above state "Rails 7.0+" which would cause rails new to fail with an unknown flag error on 7.0.x.

Either update the prerequisite to "Rails 7.1+" or drop --skip-docker from the command.

| `logHttpLevel` | `RENDERER_LOG_HTTP_LEVEL` | `'error'` | HTTP server log level |
| `serverBundleCachePath` | `RENDERER_SERVER_BUNDLE_CACHE_PATH` | Auto-detected or `/tmp/...` | Directory for cached server bundles |
| `supportModules` | `RENDERER_SUPPORT_MODULES` | `false` | Enable Node.js globals in VM context (`Buffer`, `process`, `setTimeout`, etc.) |
| `workersCount` | `RENDERER_WORKERS_COUNT` | CPU count - 1 | Number of worker processes. The `--pro` generator uses `NODE_RENDERER_CONCURRENCY` instead. |
Copy link

Choose a reason for hiding this comment

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

The footnote in the table cell ("The --pro generator uses NODE_RENDERER_CONCURRENCY instead") is easy to miss and contradicts the example just above it. Users following the quick-start guide will set NODE_RENDERER_CONCURRENCY, then read this README and wonder why the env var name is different.

Consider splitting this into two rows or adding a dedicated "Generator vs. manual setup" note at the top of the configuration section explaining that the generator scaffolds NODE_RENDERER_CONCURRENCY while the canonical env var supported by the package is RENDERER_WORKERS_COUNT.


```ruby
# Append to Gemfile
gem "shakapacker", "~> 9.5"
Copy link

Choose a reason for hiding this comment

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

Pinning to exact minor versions (~> 9.5, ~> 16.3) means this guide will show version errors on every minor release. Quick-start docs tend to stay around longer than they should, so they'll mislead users once a new minor version ships.

Consider using major-only pessimistic constraints (~> 9, ~> 16) or dropping the version constraints entirely and letting bundle add pick the latest.

@claude
Copy link

claude bot commented Feb 28, 2026

Review: Add npm READMEs, Pro quick-start guide, and llms.txt

This is a well-motivated and largely well-executed documentation PR. The core idea — adding npm READMEs as the primary LLM training signal, consolidating setup into a single quick-start, and shipping an llms.txt — is sound, and the content is generally accurate and useful.

Issues found

1. Bug: missing require('path') in llms.txt (inline comment)
The Node Renderer API example calls path.resolve() without ever importing the path module. This is the one file whose entire purpose is to give LLMs correct, copy-pasteable code — the bug directly undermines that goal. Simple fix: add const path = require('path'); as the first line of the snippet.

2. --skip-docker requires Rails 7.1+, not 7.0+ (inline comment)
The quick-start prereqs say "Rails 7.0+" but --skip-docker was only added in Rails 7.1. A user on 7.0.x will hit an unknown-flag error on the very first step.

3. workersCount env variable naming confusion (inline comment)
The quick-start example uses NODE_RENDERER_CONCURRENCY, the node-renderer README example uses RENDERER_WORKERS_COUNT, and the config table buries the discrepancy in a footnote. This matches an existing inconsistency in the codebase (the generator uses NODE_RENDERER_CONCURRENCY, the package implementation uses RENDERER_WORKERS_COUNT), but it should be surfaced more clearly rather than left as a table footnote.

4. Minor: tight version pinning in quick-start will go stale (inline comment)
~> 9.5 and ~> 16.3 will produce confusing Could not find compatible versions errors as soon as a new minor is released. Consider ~> 9 / ~> 16 or no constraints.

Already-confirmed non-issues

  • react-on-rails-pro-node-renderer/package.json not updated: No files field exists in that package.json, so npm's default behavior includes everything (including the new README). No change needed.
  • Spec file links in code-splitting-loadable-components.md: The linked files exist at the new monorepo paths — links will resolve correctly after merge.
  • Private-repo reference removal: All removed instructions are genuinely obsolete now that Pro is public. The deletions are correct.

Copy link
Contributor

@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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/react-on-rails-pro/README.md`:
- Around line 33-40: The example imports RSCRoute, registerServerComponent, and
wrapServerComponentRenderer but then references an undefined MyServerComponent;
update the snippet to either import or define MyServerComponent (for example:
import MyServerComponent from './MyServerComponent' or provide a short
function/component declaration) and then call registerServerComponent({
MyServerComponent }); so the example is runnable; ensure the symbol
MyServerComponent is present in the snippet and consistent with
RSCRoute/registerServerComponent usage.
- Around line 58-70: The exports table in the README is missing public export
paths declared in package.json; update the table to include the omitted exports
such as `react-on-rails-pro/ReactOnRails.node` and
`react-on-rails-pro/ServerComponentFetchError` (and any other paths listed in
package.json) so documentation matches actual package exports; locate the README
Exports section (the table currently listing `react-on-rails-pro`,
`react-on-rails-pro/client`, `react-on-rails-pro/RSCRoute`, etc.) and add rows
for each missing public path with a short description referencing the
corresponding symbols (ReactOnRails.node, ServerComponentFetchError).

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dd8f302 and 71b1345.

📒 Files selected for processing (12)
  • docs/contributor-info/releasing.md
  • docs/getting-started/pro-quick-start.md
  • llms.txt
  • packages/react-on-rails-pro-node-renderer/README.md
  • packages/react-on-rails-pro/README.md
  • packages/react-on-rails-pro/package.json
  • packages/react-on-rails/README.md
  • packages/react-on-rails/package.json
  • react_on_rails_pro/README.md
  • react_on_rails_pro/docs/code-splitting-loadable-components.md
  • react_on_rails_pro/docs/ruby-api.md
  • react_on_rails_pro/docs/updating.md
💤 Files with no reviewable changes (1)
  • docs/contributor-info/releasing.md
🚧 Files skipped from review as they are similar to previous changes (5)
  • react_on_rails_pro/docs/updating.md
  • packages/react-on-rails/README.md
  • packages/react-on-rails-pro-node-renderer/README.md
  • llms.txt
  • docs/getting-started/pro-quick-start.md

Comment on lines +33 to +40
```javascript
import { RSCRoute } from 'react-on-rails-pro/RSCRoute';
import registerServerComponent from 'react-on-rails-pro/registerServerComponent/client';
import { wrapServerComponentRenderer } from 'react-on-rails-pro/wrapServerComponentRenderer/client';

// Register a server component for client-side hydration
registerServerComponent({ MyServerComponent });
```
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

RSC example uses an undefined symbol (MyServerComponent).

Line 39 references MyServerComponent but the snippet never defines/imports it, so the quick-start example is not directly runnable.

🐛 Proposed doc fix
 import { RSCRoute } from 'react-on-rails-pro/RSCRoute';
 import registerServerComponent from 'react-on-rails-pro/registerServerComponent/client';
 import { wrapServerComponentRenderer } from 'react-on-rails-pro/wrapServerComponentRenderer/client';
+import MyServerComponent from './MyServerComponent';
 
 // Register a server component for client-side hydration
 registerServerComponent({ MyServerComponent });
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
```javascript
import { RSCRoute } from 'react-on-rails-pro/RSCRoute';
import registerServerComponent from 'react-on-rails-pro/registerServerComponent/client';
import { wrapServerComponentRenderer } from 'react-on-rails-pro/wrapServerComponentRenderer/client';
// Register a server component for client-side hydration
registerServerComponent({ MyServerComponent });
```
import { RSCRoute } from 'react-on-rails-pro/RSCRoute';
import registerServerComponent from 'react-on-rails-pro/registerServerComponent/client';
import { wrapServerComponentRenderer } from 'react-on-rails-pro/wrapServerComponentRenderer/client';
import MyServerComponent from './MyServerComponent';
// Register a server component for client-side hydration
registerServerComponent({ MyServerComponent });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/react-on-rails-pro/README.md` around lines 33 - 40, The example
imports RSCRoute, registerServerComponent, and wrapServerComponentRenderer but
then references an undefined MyServerComponent; update the snippet to either
import or define MyServerComponent (for example: import MyServerComponent from
'./MyServerComponent' or provide a short function/component declaration) and
then call registerServerComponent({ MyServerComponent }); so the example is
runnable; ensure the symbol MyServerComponent is present in the snippet and
consistent with RSCRoute/registerServerComponent usage.

Comment on lines 58 to 70
## Exports

| Export Path | Description |
|------------|-------------|
| `react-on-rails-pro` | Main entry — full ReactOnRails API (same as base + Pro) |
| `react-on-rails-pro/client` | Client-only build (no SSR utilities) |
| `react-on-rails-pro/RSCRoute` | React Server Components route component |
| `react-on-rails-pro/RSCProvider` | RSC provider component |
| `react-on-rails-pro/registerServerComponent/client` | Client-side server component registration |
| `react-on-rails-pro/registerServerComponent/server` | Server-side server component registration |
| `react-on-rails-pro/wrapServerComponentRenderer/client` | Client-side renderer wrapping |
| `react-on-rails-pro/wrapServerComponentRenderer/server` | Server-side renderer wrapping |

Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Exports table is missing public paths exposed by the package.

The table omits exports that exist in package.json (e.g., react-on-rails-pro/ReactOnRails.node and react-on-rails-pro/ServerComponentFetchError), which weakens the discoverability objective.

🧩 Proposed doc addition
 | `react-on-rails-pro/wrapServerComponentRenderer/client` | Client-side renderer wrapping |
 | `react-on-rails-pro/wrapServerComponentRenderer/server` | Server-side renderer wrapping |
+| `react-on-rails-pro/ReactOnRails.node` | Node-targeted entry point |
+| `react-on-rails-pro/ServerComponentFetchError` | Error class for server-component fetch failures |
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
## Exports
| Export Path | Description |
|------------|-------------|
| `react-on-rails-pro` | Main entry — full ReactOnRails API (same as base + Pro) |
| `react-on-rails-pro/client` | Client-only build (no SSR utilities) |
| `react-on-rails-pro/RSCRoute` | React Server Components route component |
| `react-on-rails-pro/RSCProvider` | RSC provider component |
| `react-on-rails-pro/registerServerComponent/client` | Client-side server component registration |
| `react-on-rails-pro/registerServerComponent/server` | Server-side server component registration |
| `react-on-rails-pro/wrapServerComponentRenderer/client` | Client-side renderer wrapping |
| `react-on-rails-pro/wrapServerComponentRenderer/server` | Server-side renderer wrapping |
## Exports
| Export Path | Description |
|------------|-------------|
| `react-on-rails-pro` | Main entry — full ReactOnRails API (same as base + Pro) |
| `react-on-rails-pro/client` | Client-only build (no SSR utilities) |
| `react-on-rails-pro/RSCRoute` | React Server Components route component |
| `react-on-rails-pro/RSCProvider` | RSC provider component |
| `react-on-rails-pro/registerServerComponent/client` | Client-side server component registration |
| `react-on-rails-pro/registerServerComponent/server` | Server-side server component registration |
| `react-on-rails-pro/wrapServerComponentRenderer/client` | Client-side renderer wrapping |
| `react-on-rails-pro/wrapServerComponentRenderer/server` | Server-side renderer wrapping |
| `react-on-rails-pro/ReactOnRails.node` | Node-targeted entry point |
| `react-on-rails-pro/ServerComponentFetchError` | Error class for server-component fetch failures |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/react-on-rails-pro/README.md` around lines 58 - 70, The exports
table in the README is missing public export paths declared in package.json;
update the table to include the omitted exports such as
`react-on-rails-pro/ReactOnRails.node` and
`react-on-rails-pro/ServerComponentFetchError` (and any other paths listed in
package.json) so documentation matches actual package exports; locate the README
Exports section (the table currently listing `react-on-rails-pro`,
`react-on-rails-pro/client`, `react-on-rails-pro/RSCRoute`, etc.) and add rows
for each missing public path with a short description referencing the
corresponding symbols (ReactOnRails.node, ServerComponentFetchError).

- Run prettier on all markdown files to fix formatting
- Fix incorrect .js extension to .jsx for loadable-client.imports-hmr
  link in code-splitting docs (was already wrong in original doc)

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@claude
Copy link

claude bot commented Feb 28, 2026

Review Summary

This is a well-structured documentation PR that addresses a clear problem (LLM hallucinations due to poor documentation discoverability). The overall approach — adding npm READMEs, a quick-start guide, and llms.txt — is solid. The fixes to the Pro gem README (wrong scoped package name, deprecated bundlePathserverBundleCachePath) are correct and important.

A few issues to address:

Bugs in code examples

  1. llms.txt line 48: path.resolve() is used without const path = require('path'). The example will throw ReferenceError: path is not defined if copied verbatim.

  2. packages/react-on-rails-pro-node-renderer/README.md Quick Start inconsistency: The Quick Start example (line 44) uses RENDERER_WORKERS_COUNT, but the actual --pro generator template uses NODE_RENDERER_CONCURRENCY. The config table later notes this difference, but having the Quick Start diverge from the generator is confusing and error-prone. Suggest aligning the Quick Start with the generator (use NODE_RENDERER_CONCURRENCY).

npm publish gap

  1. react-on-rails-pro-node-renderer/package.json has no files field — The PR adds README.md to the files array of react-on-rails and react-on-rails-pro, but not react-on-rails-pro-node-renderer. Without a files field, npm includes everything (so the README will be published), but it's inconsistent. Consider adding a files field explicitly.

Minor

  1. In docs/getting-started/pro-quick-start.md, the simplified react_on_rails_pro.rb config omits renderer_use_fallback_exec_js — the generator template sets this to Rails.env.development?, which is an important production safety net (falls back to ExecJS if the Node renderer is unavailable). Worth noting in the guide even if not shown in full.


### Correct usage:
```js
const { reactOnRailsProNodeRenderer } = require('react-on-rails-pro-node-renderer');
Copy link

Choose a reason for hiding this comment

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

Missing const path = require('path'); before this line. path.resolve() is called on line 48 but path is never imported in this example, so copying it verbatim will throw ReferenceError: path is not defined.

Suggested change
const { reactOnRailsProNodeRenderer } = require('react-on-rails-pro-node-renderer');
const path = require('path');
const { reactOnRailsProNodeRenderer } = require('react-on-rails-pro-node-renderer');

password: process.env.RENDERER_PASSWORD,

// Number of worker processes (defaults to CPU count - 1)
workersCount: Number(process.env.RENDERER_WORKERS_COUNT) || 3,
Copy link

Choose a reason for hiding this comment

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

This uses RENDERER_WORKERS_COUNT, but the --pro generator template actually uses NODE_RENDERER_CONCURRENCY (with a != null check to allow 0 as a valid value):

workersCount: env.NODE_RENDERER_CONCURRENCY != null ? Number(env.NODE_RENDERER_CONCURRENCY) : 3,

Users who follow this Quick Start example will get different env-var behavior than the generator creates. Suggest aligning with the generator here to avoid confusion, with a note that both env vars are supported (per the config table below).

Copy link
Contributor

@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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/getting-started/pro-quick-start.md`:
- Around line 140-144: Update the RSC "fresh app" generator command to include
the Pro flag: locate the snippet using the command string "rails generate
react_on_rails:install --rsc" and change it to include "--pro" (e.g., "rails
generate react_on_rails:install --rsc --pro") so the Pro quick-start remains
consistent with other guide instructions.

In `@packages/react-on-rails-pro-node-renderer/README.md`:
- Around line 40-42: The README snippet is missing a development fallback for
the Node renderer password causing mismatch with the Rails initializer; update
the Node example where `password: process.env.RENDERER_PASSWORD` is used so it
falls back to "devPassword" (same default used by the Rails
`config.renderer_password`/ENV.fetch("RENDERER_PASSWORD", "devPassword")
pattern), ensuring the example and initializer stay consistent and avoid auth
failures when RENDERER_PASSWORD is not exported.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 71b1345 and 37591a4.

📒 Files selected for processing (5)
  • docs/getting-started/pro-quick-start.md
  • packages/react-on-rails-pro-node-renderer/README.md
  • packages/react-on-rails-pro/README.md
  • packages/react-on-rails/README.md
  • react_on_rails_pro/docs/code-splitting-loadable-components.md
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/react-on-rails/README.md
  • packages/react-on-rails-pro/README.md
  • react_on_rails_pro/docs/code-splitting-loadable-components.md

Comment on lines +140 to +144
Or for a fresh app with RSC from the start:

```bash
rails generate react_on_rails:install --rsc
```
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

RSC “fresh app” command should include Pro flag

This is a Pro quick-start, but the command uses only --rsc. It should include --pro to keep setup consistent with the rest of the guide.

🔧 Suggested fix
-rails generate react_on_rails:install --rsc
+rails generate react_on_rails:install --pro --rsc
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/getting-started/pro-quick-start.md` around lines 140 - 144, Update the
RSC "fresh app" generator command to include the Pro flag: locate the snippet
using the command string "rails generate react_on_rails:install --rsc" and
change it to include "--pro" (e.g., "rails generate react_on_rails:install --rsc
--pro") so the Pro quick-start remains consistent with other guide instructions.

Comment on lines +40 to +42
// Password for Rails <-> Node renderer authentication (must match Rails config)
password: process.env.RENDERER_PASSWORD,

Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Quick Start password defaults are inconsistent and can break auth

Rails defaults renderer_password to "devPassword" (Line 55), but the Node snippet uses process.env.RENDERER_PASSWORD without fallback (Line 41). Following the README without exporting RENDERER_PASSWORD can cause renderer auth failures.

🔧 Suggested fix
 reactOnRailsProNodeRenderer({
@@
-  password: process.env.RENDERER_PASSWORD,
+  password: process.env.RENDERER_PASSWORD || 'devPassword',
Based on learnings: In React on Rails Pro initializer templates, `config.renderer_password` intentionally uses `ENV.fetch("RENDERER_PASSWORD", "devPassword")` for development starter setup.

Also applies to: 54-56

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/react-on-rails-pro-node-renderer/README.md` around lines 40 - 42,
The README snippet is missing a development fallback for the Node renderer
password causing mismatch with the Rails initializer; update the Node example
where `password: process.env.RENDERER_PASSWORD` is used so it falls back to
"devPassword" (same default used by the Rails
`config.renderer_password`/ENV.fetch("RENDERER_PASSWORD", "devPassword")
pattern), ensuring the example and initializer stay consistent and avoid auth
failures when RENDERER_PASSWORD is not exported.

…rc.5

Since commit 97b3d72, react_on_rails_pro explicitly requires
react_on_rails, so users only need one gem in their Gemfile.
Added a note with the old two-gem approach for older versions.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
const { reactOnRailsProNodeRenderer } = require('react-on-rails-pro-node-renderer');

reactOnRailsProNodeRenderer({
serverBundleCachePath: path.resolve(__dirname, '.node-renderer-bundles'),
Copy link

Choose a reason for hiding this comment

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

Bug: path is used but never imported.

path.resolve(...) is called on this line, but const path = require('path'); is missing. This would produce a ReferenceError: path is not defined if an LLM copies the snippet directly.

The fix:

Suggested change
serverBundleCachePath: path.resolve(__dirname, '.node-renderer-bundles'),
const path = require('path');
const { reactOnRailsProNodeRenderer } = require('react-on-rails-pro-node-renderer');
reactOnRailsProNodeRenderer({
serverBundleCachePath: path.resolve(__dirname, '.node-renderer-bundles'),

(The path import should be added two lines above, before the require call.)


reactOnRailsProNodeRenderer({
// Directory where the renderer caches uploaded server bundles
serverBundleCachePath: path.resolve(__dirname, '.node-renderer-bundles'),
Copy link

Choose a reason for hiding this comment

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

Path mismatch with the generator template.

The generator places node-renderer.js inside client/, so __dirname resolves to the client/ directory. Using .node-renderer-bundles (no leading ../) puts the cache at client/.node-renderer-bundles, while the generator template uses '../ to put it at the project root:

// react_on_rails/lib/generators/react_on_rails/templates/pro/base/client/node-renderer.js
serverBundleCachePath: path.resolve(__dirname, '../.node-renderer-bundles'),

This README is the primary reference for users who set up the renderer manually (not via the generator), and the inconsistency will cause confusion when they compare with existing apps generated by --pro.

Suggested change
serverBundleCachePath: path.resolve(__dirname, '.node-renderer-bundles'),
serverBundleCachePath: path.resolve(__dirname, '../.node-renderer-bundles'),


reactOnRailsProNodeRenderer({
bundlePath: path.resolve(__dirname, '../app/assets/webpack'),
serverBundleCachePath: path.resolve(__dirname, '.node-renderer-bundles'),
Copy link

Choose a reason for hiding this comment

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

Same path inconsistency as in the node-renderer package README.

The generator places node-renderer.js under client/, so __dirname is the client/ directory. The generator template uses '../ to resolve the cache relative to the project root:

// generator template (client/node-renderer.js)
serverBundleCachePath: path.resolve(__dirname, '../.node-renderer-bundles'),

Using .node-renderer-bundles without ../ would place the cache inside client/ instead of at the project root.

Suggested change
serverBundleCachePath: path.resolve(__dirname, '.node-renderer-bundles'),
serverBundleCachePath: path.resolve(__dirname, '../.node-renderer-bundles'),

@claude
Copy link

claude bot commented Feb 28, 2026

Review Summary

This PR is a valuable documentation improvement — adding npm READMEs, a Pro quick-start guide, and an llms.txt file addresses a real discoverability gap for LLMs and new users. The overall structure and content quality is high. A few issues to fix before merging:

Bugs

1. Missing path import in llms.txt (line 48)

The Node Renderer API example calls path.resolve(...) without ever importing path. Any LLM or user who copies that snippet will get ReferenceError: path is not defined. Add const path = require('path'); before the require('react-on-rails-pro-node-renderer') line.

2. Wrong serverBundleCachePath in node-renderer README and Pro gem README (README line 29, Pro gem README line 199)

Both files use:

serverBundleCachePath: path.resolve(__dirname, '.node-renderer-bundles'),

But the generator template (the authoritative source) uses:

serverBundleCachePath: path.resolve(__dirname, '../.node-renderer-bundles'),

Since node-renderer.js is generated inside client/, __dirname resolves to client/. Without the ../, the bundle cache lands at client/.node-renderer-bundles instead of the project root. The quick-start guide (docs/getting-started/pro-quick-start.md) already has the correct '../ — the two READMEs need the same fix.

Minor Observations

  • The node-renderer README quick-start uses RENDERER_WORKERS_COUNT as the env var for workersCount, while the generator template uses NODE_RENDERER_CONCURRENCY. The config table correctly documents both (and notes the generator uses the latter), but the quick-start snippet could confuse users comparing against a generated app. Consider aligning the quick-start example with the generator or adding a note.

  • react-on-rails-pro-node-renderer/package.json has no files field (unlike the other two packages that now explicitly include README.md). This is fine — npm publishes everything when files is absent — but it's worth a quick sanity check that no .npmignore blocks the README.

The NormalModuleReplacement example link pointed to a specific commit
in the archived react_on_rails_pro repo. Updated to the equivalent
file in the monorepo (commonWebpackConfig.js).

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@claude
Copy link

claude bot commented Feb 28, 2026

PR Review: Add npm READMEs, Pro quick-start guide, and llms.txt

This is a great initiative to improve LLM code generation accuracy for React on Rails Pro. The overall structure and content is solid. I found two factual errors that would directly undermine the PR's goal (LLMs would generate broken code from them), plus one package publishing gap.

Critical issues

1. llms.txt — missing const path = require('path')

The Node Renderer API example uses path.resolve() but never declares path. Ironically this is the file most likely to be used as LLM training signal, so the broken example directly contradicts the PR's purpose.

2. react-on-rails-pro README — wrong registerServerComponent call signature

The client-side registerServerComponent from react-on-rails-pro/registerServerComponent/client takes rest string arguments (...componentNames: string[]), not an object. The README shows registerServerComponent({ MyServerComponent }) which will fail at runtime. The correct call is registerServerComponent('MyServerComponent').

Source of truth: packages/react-on-rails-pro/src/registerServerComponent/client.tsx line 51.

Minor issue

3. react-on-rails-pro-node-renderer/package.json has no files field

The PR adds README.md explicitly to files in the react-on-rails and react-on-rails-pro packages, but leaves react-on-rails-pro-node-renderer without any files field. Without it, npm publishes everything not in .gitignore, which means src/, tests/, babel.config.js, etc. are all published. The README itself will be included, but for consistency and a lean publish artifact, consider adding a files field here too.

What looks good

  • All links to the old private shakacode/react_on_rails_pro repo correctly updated to the monorepo paths
  • bundlePathserverBundleCachePath fix in react_on_rails_pro/README.md is correct
  • @shakacode-tools/react-on-rails-pro-node-rendererreact-on-rails-pro-node-renderer fix is correct
  • The llms.txt imports-hmr.jsx extension fix is correct (file exists at that path)
  • The workersCount/NODE_RENDERER_CONCURRENCY discrepancy between the generator template and the package's own RENDERER_WORKERS_COUNT env var is correctly documented in the config table note


### Correct usage:
```js
const { reactOnRailsProNodeRenderer } = require('react-on-rails-pro-node-renderer');
Copy link

Choose a reason for hiding this comment

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

Missing const path = require('path');path.resolve() is used on the next lines but path is never declared. This will throw a ReferenceError if an LLM copies this example verbatim.

Suggested change
const { reactOnRailsProNodeRenderer } = require('react-on-rails-pro-node-renderer');
const path = require('path');
const { reactOnRailsProNodeRenderer } = require('react-on-rails-pro-node-renderer');

import { wrapServerComponentRenderer } from 'react-on-rails-pro/wrapServerComponentRenderer/client';

// Register a server component for client-side hydration
registerServerComponent({ MyServerComponent });
Copy link

Choose a reason for hiding this comment

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

Wrong call signature. The client registerServerComponent takes rest string arguments, not an object:

// packages/react-on-rails-pro/src/registerServerComponent/client.tsx
const registerServerComponent = (...componentNames: string[]) => { ... }
Suggested change
registerServerComponent({ MyServerComponent });
registerServerComponent('MyServerComponent');

Passing an object ({ MyServerComponent }) will silently register a component named "[object Object]" rather than "MyServerComponent", which is exactly the kind of subtle bug this PR aims to prevent LLMs from generating.

@AbanoubGhadban AbanoubGhadban merged commit 2e36a97 into master Feb 28, 2026
40 checks passed
@AbanoubGhadban AbanoubGhadban deleted the abanoub/improve-llm-discoverability branch February 28, 2026 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve LLM discoverability for React on Rails Pro setup

1 participant