Package Exports
- @rsc-xray/cli
Readme
@rsc-xray/cli
Command-line wrapper for the rsc-xray analyzer, report generator, and Flight tap capture workflow.
What it solves
- Produces
model.jsonfrom a Next.js App Router project with one command. - Generates a fully offline HTML report for sharing analyzer findings.
- Streams React Flight chunks so you can understand suspense delivery order and chunk sizes.
Installation
pnpm add -D @rsc-xray/cliStep-by-step usage
Prepare your project
pnpm next buildGenerate the model
pnpm -F @rsc-xray/cli analyze --project ./examples/next-app --out ./model.json
- Validates the analyzer output against the shared JSON schema.
- Overwrites the target file only when validation succeeds.
Create the HTML report
pnpm -F @rsc-xray/cli report --model ./model.json --out ./report.html
- Produces a static report you can open locally or upload as a CI artifact.
(Optional) Capture Flight streaming data
pnpm -C examples/next-app dev & pnpm -F @rsc-xray/cli flight-tap --url http://localhost:3000/products/1 --route /products/[id] --out ./.scx/flight.json --timeout 30000
- The timeout guard aborts hung streams; pass
--timeout 0to disable it when debugging slower routes.
- The timeout guard aborts hung streams; pass
Tests
Command behavior is covered by:
packages/cli/src/commands/__tests__/analyze.test.tspackages/cli/src/commands/__tests__/report.test.tspackages/cli/src/commands/__tests__/flightTap.test.ts
Run the suite with:
pnpm -F @rsc-xray/cli test -- --runRSC X‑Ray Pro
Paid plans available — unlock the full toolkit:
- Overlay UI — live boundary tree, Suspense markers, bundle bytes, hydration timings
- Flight tap & timeline — capture React Flight streaming; visualize chunk order, sizes, labels
- Cache lens — inspect
tags, revalidate policies, and route impact - Waterfall detector — find sequential awaits; guided fixes (preload/parallelize)
- Codemods —
use client, wrap with Suspense, add preload/hydration hook - VS Code extension — analyzer diagnostics + “Open in XRay” deep links
- CI budgets & trends — PR comments, thresholds, and historical deltas
Learn more → https://rsc-xray.dev • Pricing → https://rsc-xray.dev/pricing