Generate AI prompts from the upstream catalog#131
Conversation
|
Warning Review limit reached
More reviews will be available in 53 minutes and 24 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (8)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
Cloudflare preview deployed.
|
Greptile SummaryThis PR wires upstream
Confidence Score: 4/5Safe to merge; the generated artifacts are committed and drift-guarded, all existing tests pass, and the two parser edge cases do not affect the current upstream YAML format. The pipeline end-to-end is well-structured and tested. The two custom YAML parser issues (comment stripping before quote detection, and scripts/prepare-prompts.mjs — specifically Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[upstream react_on_rails repo] -->|prompts.yml| B[sync:docs]
B -->|content/upstream/prompts.yml| C[prepare:prompts]
C --> D[parsePromptsYaml + validatePromptCatalog]
D --> E[collectPreparedDocRoutes]
E --> F{validatePromptRoutes}
F -->|fail| G[Error: missing route]
F -->|pass| H[renderPromptArtifacts]
H --> I[prompts.ts]
H --> J[prompts.json]
H --> K[llms.txt]
I & J & K --> L[build: prepare:prompts:check]
L --> M{drift check}
M -->|no| N[Error: out of date]
M -->|yes| O[Docusaurus build]
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A[upstream react_on_rails repo] -->|prompts.yml| B[sync:docs]
B -->|content/upstream/prompts.yml| C[prepare:prompts]
C --> D[parsePromptsYaml + validatePromptCatalog]
D --> E[collectPreparedDocRoutes]
E --> F{validatePromptRoutes}
F -->|fail| G[Error: missing route]
F -->|pass| H[renderPromptArtifacts]
H --> I[prompts.ts]
H --> J[prompts.json]
H --> K[llms.txt]
I & J & K --> L[build: prepare:prompts:check]
L --> M{drift check}
M -->|no| N[Error: out of date]
M -->|yes| O[Docusaurus build]
Reviews (1): Last reviewed commit: "Generate prompts from the upstream catal..." | Re-trigger Greptile |
| function parseScalar(rawValue, context) { | ||
| const value = stripInlineComment(rawValue.trim()); | ||
| if (value === "") { | ||
| return ""; | ||
| } | ||
| if (value.startsWith("\"")) { | ||
| try { | ||
| return JSON.parse(value); | ||
| } catch (error) { | ||
| throw new Error(`Invalid double-quoted YAML scalar at ${context}: ${error.message}`); | ||
| } |
There was a problem hiding this comment.
stripInlineComment runs before the quote-type check
parseScalar strips inline comments from rawValue before determining whether the value is a double-quoted string. If an upstream prompt has a double-quoted YAML scalar containing whitespace-then-# (e.g. title: "Step 1 # verify"), the regex /\s+#/ fires at position 7, truncating the raw string to "Step 1 before JSON.parse runs — producing SyntaxError: Unterminated string instead of the correct value. The fix is to check for a leading " first and hand the full raw value straight to JSON.parse, only stripping inline comments from plain scalars.
| function foldedBlockValue(lines) { | ||
| const paragraphs = []; | ||
| let current = []; | ||
|
|
||
| for (const line of lines) { | ||
| const trimmed = line.trim(); | ||
| if (trimmed === "" || trimmed.startsWith("#")) { | ||
| if (current.length > 0) { | ||
| paragraphs.push(current.join(" ")); | ||
| current = []; | ||
| } | ||
| continue; | ||
| } | ||
| current.push(trimmed); | ||
| } | ||
|
|
||
| if (current.length > 0) { | ||
| paragraphs.push(current.join(" ")); | ||
| } | ||
|
|
||
| return paragraphs.join("\n"); | ||
| } |
There was a problem hiding this comment.
foldedBlockValue silently drops lines that begin with #
In a YAML folded block scalar (>-), a # character is literal content — inline comments are not permitted inside block scalars. The current implementation treats any trimmed line that startsWith("#") as a paragraph separator and discards it. If an upstream prompt text ever uses a markdown heading (# Section) or shell comment line inside a folded block, that line would be silently omitted from the generated artifacts without any error. Because this is a mis-parse rather than a validation failure, the drift guard would only catch it if the committed artifacts were already correct; a fresh generation would silently produce wrong output.
| "prepare:docs": "node scripts/prepare-docs.mjs --target docusaurus", | ||
| "prepare:docs": "node scripts/prepare-docs.mjs --target docusaurus && npm run prepare:prompts", | ||
| "prepare:docs:subset": "node scripts/prepare-docs.mjs --target docusaurus --subset", | ||
| "prepare:prompts": "node scripts/prepare-prompts.mjs", |
There was a problem hiding this comment.
Subset workflow leaves prompt artifacts stale, breaking
build
prepare:docs:subset runs prepare-docs.mjs --subset but does not chain prepare:prompts. The full build script now opens with prepare:prompts:check, so anyone who runs npm run prepare:subset && npm run build will hit a drift-guard failure because the subset prepare never (re)generates the prompt artifacts. Adding && npm run prepare:prompts to prepare:docs:subset — mirroring what was done for prepare:docs — would keep the two paths consistent.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8208d89d1c
ℹ️ 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".
| export function validatePromptRoutes(catalog, preparedDocRoutes) { | ||
| const missingRoutes = []; | ||
| for (const prompt of catalog.prompts) { | ||
| const route = routeWithoutFragment(prompt.doc_route); |
There was a problem hiding this comment.
Validate prompt fragments before publishing
When a prompt doc_route contains a mistyped #fragment, this strips the fragment before validation, so /docs/foo#bad-anchor is accepted as long as /docs/foo exists. The exact URL is then published in prompts.json/llms.txt and embedded in copyable prompts, where the static artifacts are not checked by Docusaurus, allowing broken anchors to ship even though the new route validation reports success.
Useful? React with 👍 / 👎.
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_99118f41-dbcf-46fa-b406-1eb0d9a678d8) |
|
Addressed the Greptile parser edge-case findings in 11bb92c:
Fresh local checks after the change: I left the |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 11bb92c6e9
ℹ️ 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".
| "sync:docs": "node scripts/sync-docs.mjs", | ||
| "sync:docs:subset": "node scripts/sync-docs.mjs --subset", | ||
| "prepare:docs": "node scripts/prepare-docs.mjs --target docusaurus", | ||
| "prepare:docs": "node scripts/prepare-docs.mjs --target docusaurus && npm run prepare:prompts", |
There was a problem hiding this comment.
Don't overwrite generated prompts before checking drift
In the inspected CI workflow (.github/workflows/site-build-deploy.yml), the Prepare docs step runs before Build site; with this change, prepare:docs rewrites prompts.ts, prompts.json, and llms.txt before npm run build reaches prepare:prompts:check. That means a PR with hand-edited or stale generated prompt artifacts passes CI because the files are regenerated in the workspace first, leaving the committed tracked artifacts drifted after merge. If these artifacts are meant to be tracked, keep generation separate from the pre-build check or add a dirty-worktree/drift check before overwriting them.
Useful? React with 👍 / 👎.
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_9c0529fa-ea19-4d42-a7fd-364915df06d4) |
Summary
react_on_rails/prompts.ymlintocontent/upstream/prompts.ymlduringsync:docs.prototypes/docusaurus/src/constants/prompts.ts,static/prompts.json, andstatic/llms.txtfrom the synced catalog.doc_routeagainst prepared Docusaurus doc routes before writing artifacts.prepare:prompts:checkso hand-edited generated prompt artifacts fail the build.Closes #126.
Evidence
6b48ca053d9dc9e67aabf645177f00a95b72a610, merged 2026-06-19T04:49:32Z)./llms.txtand/prompts.jsonare emitted underprototypes/docusaurus/static/and present in the Docusaurus build output./docs/getting-started/existing-rails-app.content/upstream/prompts.ymlbefore copying and fails if the canonical upstream file is missing.Tests
npm run install:site(needed once in the dedicated worktree; npm reported existing audit findings)npm run test:prepare-promptsnpm run build:full(passes; existing Docusaurus broken-link/anchor warnings are still reported by the site build)git diff --check/Users/justin/.agents/skills/autoreview/scripts/autoreview --mode localCoordination / Workflow Notes
UNKNOWN;.agents/skills/pr-batch/SKILL.mdand.agents/workflows/pr-processing.mdare absent both locally and onorigin/main, so this used installed$pr-batchfallback concepts.agent-coord status:UNKNOWN; bounded status timed out for the worker lane. Numeric target claim for Make prompts canonical upstream: sync + codegen prompts.ts and publish llms.txt #126 succeeded ascodex-prompts-126before the worker was stopped.codex-prompts-126produced the initial script patch, then the coordinator moved Make prompts canonical upstream: sync + codegen prompts.ts and publish llms.txt #126 into a dedicated worktree after shared-workspace overlap was detected.Codex Decision Log
.github/workflows/; wireprepare:docsto run prompt generation after docs preparation so the existing CI sequence (sync:docs->prepare:docs->build) consumes synced prompts before the build-time drift check.AGENTS.mdsays to ask before CI workflow edits, and the same behavior can be achieved through package-script wiring required by Make prompts canonical upstream: sync + codegen prompts.ts and publish llms.txt #126.Note
Low Risk
Build/docs tooling and generated marketing content only; no runtime auth or app logic changes beyond keeping prompt doc links aligned with synced docs.
Overview
Moves the site’s AI prompt catalog to a single upstream source (
content/upstream/prompts.yml, synced fromreact_on_rails/prompts.ymlduringsync:docs) and replaces hand-editedprompts.tswith generated output plus new staticprompts.jsonandllms.txtfor agents.Adds
scripts/prepare-prompts.mjs: parses/validates the YAML catalog, resolves{{doc_url}}, checks each prompt’sdoc_routeagainst prepared Docusaurus doc routes (including frontmatter slugs), and writes the three artifacts.prepare:docsruns prompt generation after docs prep;buildrunsprepare:prompts:checkso drift fails CI. Tests cover parsing, route validation, and check mode.Reviewed by Cursor Bugbot for commit 11bb92c. Bugbot is set up for automated code reviews on this repo. Configure here.