Skip to content

Add an interactive mode for profiler-cli - #6400

Merged
mstange merged 4 commits into
firefox-devtools:mainfrom
mstange:push-lpmmxzrorvms
Dec 1, 2026
Merged

mstange merged 4 commits into
firefox-devtools:mainfrom
mstange:push-lpmmxzrorvms

Conversation

@mstange

@mstange mstange commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Main | Deploy preview

This makes it so that profiler-cli -i load https://share.firefox.dev/4dJfrbA gives you a REPL style interface.

@codecov

codecov Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.13%. Comparing base (bd4d572) to head (011edd6).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6400   +/-   ##
=======================================
  Coverage   85.13%   85.13%           
=======================================
  Files         365      365           
  Lines       39944    39944           
  Branches    11398    11383   -15     
=======================================
  Hits        34006    34006           
  Misses       5498     5498           
  Partials      440      440           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@fatadel fatadel 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.

Thanks for the PR! I left some comments, although I think more enhanced handling of double Ctrl+C is the only important one.

Comment thread profiler-cli/src/repl.ts Resolved
Comment thread profiler-cli/src/index.ts Resolved
Comment thread profiler-cli/src/repl.ts Resolved
…nds.

Argument validation printed an error and called process.exit(1) in about
30 places. These now throw, and the existing handler in main() prints
"Error: <message>" and exits with status 1, so the output stays the same.

This makes the commands usable from a long-running process, such as an
interactive prompt, where a typo must not end the process.

An unknown command now prints a one-line error that points to --help,
instead of the error followed by the full help text.
…cess.argv.

wasExplicit() decides whether to print the "Other subcommands" hint. It
searched process.argv for the parent and subcommand names. It now checks
the operands that commander recorded on the parent command, which reflect
the arguments that were actually parsed, wherever they came from.
This prepares for an interactive prompt, which needs a fresh program for
every line it runs. No behavior change.
"profiler-cli -i [<command>]" runs <command>, if given, and then shows a
"> " prompt. Each line is a profiler-cli command without the
"profiler-cli" prefix, parsed by a fresh commander program. Errors are
printed and the prompt continues. "exit", "quit" or Ctrl-D leave it.

The prompt pins the session it loaded, so a "load" in another terminal
does not redirect it. "load" and "session use" at the prompt change the
pinned session. When the prompt exits, it stops the sessions it loaded,
because daemons have no idle timeout and would otherwise keep a profile in
memory indefinitely. Sessions that were already running are left alone.

The separate-commands mode is unchanged and remains the interface for
scripts and AI tools.
@mstange
mstange requested a review from fatadel November 25, 2026 17:18
@mstange
mstange added this pull request to the merge queue Nov 30, 2026
Merged via the queue into firefox-devtools:main with commit 6c07f67 Dec 1, 2026
23 checks passed
@fatadel fatadel mentioned this pull request Dec 1, 2026
fatadel added a commit that referenced this pull request Dec 1, 2026
Changes:

[canova] Add localization guidelines to AGENTS.md (#6487)
[staktrace] Add markers to represent causal flows (#6488)
[zuhairkhalid229] Highlight more languages in the source view (#6475)
[kayaal34] Fix typos in developer docs (#6479)
[fatadel] Remove the search field hint (#6490)
[mstange] Add an interactive mode for profiler-cli (#6400)
[mstange] Make keyboard zooming in chart viewports center on the mouse position. (#6471)
[fatadel] Bump profiler-cli version to 0.16.0 (#6502)

And special thanks to our localizers:

de: Michael Köhler
el: Jim Spentzos
en-GB: Ian Neal
ia: Melo46
it: Francesco Lodolo
nl: Mark Heijl
ru: berry, Valery Ledovskoy
sv-SE: Andreas Pettersson
tr: Grk, Selim Şumlu
zh-TW: Pin-guang Chen
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