feat(cli): add load timings to page-weight - #873
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
📝 WalkthroughWalkthroughThe ChangesPage weight timing metrics
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant PageWeightCLI
participant BrowserPage
participant PerformanceAPIs
PageWeightCLI->>BrowserPage: evaluate page metrics
BrowserPage->>PerformanceAPIs: read resource, navigation, and paint timings
PerformanceAPIs-->>BrowserPage: return timing and size data
BrowserPage-->>PageWeightCLI: return combined metrics
PageWeightCLI-->>PageWeightCLI: format available metric lines
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a5f9880. Configure here.
Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/cli/src/commands/page-weight.js`:
- Around line 15-18: Update the performance entry collection in the page-weight
calculation to include the `navigation` entry alongside entries returned by
`performance.getEntriesByType('resource')`. Ensure the resulting `resources`
data includes the main document so request count, transferred bytes, and decoded
resource bytes all include navigation totals.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 442921b3-5eb7-4e4c-9268-b0f4d8c40ff5
📒 Files selected for processing (2)
packages/cli/README.mdpackages/cli/src/commands/page-weight.js

Note
Low Risk
CLI-only output change using standard Performance APIs; no security, auth, or data-handling impact.
Overview
Extends the CLI
page-weightcommand so it reports basic load timings in addition to request counts and byte totals.The in-page evaluation now reads Navigation Timing and Paint entries and returns TTFB, FCP, DOMContentLoaded, and load alongside resource sizes. A small
timinghelper omits milestones that are still0(unrecorded). Output is built as a filtered bullet list with the same⬩formatting.README updates the command description to mention load timings.
Reviewed by Cursor Bugbot for commit 95f9242. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit
New Features
page-weightcommand to report key page load timings, including time to first byte, first contentful paint, DOM content loaded, and full load completion.Documentation