Skip to content

feat: add profile export command#38

Open
kacper-mikolajczak wants to merge 1 commit intopiotrski:mainfrom
kacper-mikolajczak:feat/profile-export
Open

feat: add profile export command#38
kacper-mikolajczak wants to merge 1 commit intopiotrski:mainfrom
kacper-mikolajczak:feat/profile-export

Conversation

@kacper-mikolajczak
Copy link

Summary

  • Adds profile export <file> CLI command that exports profiling data in React DevTools Profiler JSON format (version 5)
  • The exported file can be imported directly into React DevTools browser extension via the Profiler tab's import button
  • Maps internal ProfilingSession data to the ProfilingDataExport schema: commits, fiber durations, change descriptions, and component tree snapshots

Usage

agent-react-devtools profile start
# ... interact with app ...
agent-react-devtools profile stop
agent-react-devtools profile export profiling-data.json

Then open React DevTools Profiler tab and click the import button to load the JSON file.

What's included in the export

Field Source Notes
commitData ProfilingSession.commits Full mapping including durations, change descriptions
snapshots ComponentTree nodes Current tree state at time of export
initialTreeBaseDurations First commit's fiberSelfDurations Approximation - exact base durations not tracked
operations Empty arrays Not captured during profiling; flamegraph/ranked still work
effectDuration / passiveEffectDuration null Not available from the devtools protocol

Test plan

  • 8 new unit tests covering: null cases, version format, commit mapping, change descriptions, snapshots, tree base durations, JSON serialization
  • All 76 tests pass
  • Manual: profile a real app, export, import into React DevTools Profiler tab

Export profiling data in React DevTools Profiler JSON format (version 5)
so it can be imported into the browser extension's Profiler tab.

- New IPC command: profile-export
- New CLI command: profile export <file>
- Maps internal ProfilingSession to ProfilingDataExport schema
- Includes commit data, fiber durations, change descriptions, snapshots

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@changeset-bot
Copy link

changeset-bot bot commented Mar 6, 2026

🦋 Changeset detected

Latest commit: a4f339b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
agent-react-devtools Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@kacper-mikolajczak
Copy link
Author

CC @piotrski

@kacper-mikolajczak kacper-mikolajczak marked this pull request as ready for review March 6, 2026 14:27
@piotrski
Copy link
Owner

piotrski commented Mar 8, 2026

@codex review

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