Skip to content

feat(cli): add load timings to page-weight - #873

Merged
Kikobeats merged 2 commits into
masterfrom
feat/page-weight-timings
Aug 6, 2026
Merged

feat(cli): add load timings to page-weight#873
Kikobeats merged 2 commits into
masterfrom
feat/page-weight-timings

Conversation

@Kikobeats

@Kikobeats Kikobeats commented Aug 6, 2026

Copy link
Copy Markdown
Member

Note

Low Risk
CLI-only output change using standard Performance APIs; no security, auth, or data-handling impact.

Overview
Extends the CLI page-weight command 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 timing helper omits milestones that are still 0 (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

    • Enhanced the page-weight command to report key page load timings, including time to first byte, first contentful paint, DOM content loaded, and full load completion.
    • Timing values are displayed in milliseconds alongside network request and resource size details.
  • Documentation

    • Updated command documentation to describe the new load timing metrics.

Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The page-weight command now collects resource sizes and browser timing metrics in one evaluation. It reports available TTFB, FCP, DOMContentLoaded, and load timings. The CLI documentation reflects the added timing output.

Changes

Page weight timing metrics

Layer / File(s) Summary
Collect resource and timing metrics
packages/cli/src/commands/page-weight.js
The browser evaluation returns resource sizes, navigation timings, and paint timing metrics. Timing values use millisecond formatting.
Format and document timing output
packages/cli/src/commands/page-weight.js, packages/cli/README.md
The command filters available metrics into output lines for resource totals, TTFB, FCP, DOMContentLoaded, and load timings. The documentation describes the added timings.

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
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding load timings to the page-weight CLI command.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/page-weight-timings

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.

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

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

Comment thread packages/cli/src/commands/page-weight.js Outdated
@coveralls

coveralls commented Aug 6, 2026

Copy link
Copy Markdown

Coverage Status

Coverage is 80.629%feat/page-weight-timings into master. No base build found for master.

Co-authored-by: Cursor <cursoragent@cursor.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 1120e2c and a5f9880.

📒 Files selected for processing (2)
  • packages/cli/README.md
  • packages/cli/src/commands/page-weight.js

Comment thread packages/cli/src/commands/page-weight.js
@Kikobeats
Kikobeats merged commit 3ac7973 into master Aug 6, 2026
22 checks passed
@Kikobeats
Kikobeats deleted the feat/page-weight-timings branch August 6, 2026 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants