Skip to content

Add an interactive mode for profiler-cli - #6400

Open
mstange wants to merge 4 commits into
firefox-devtools:mainfrom
mstange:push-lpmmxzrorvms
Open

mstange wants to merge 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.

…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.
@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 84.48%. Comparing base (439a940) to head (2dd2ad4).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6400   +/-   ##
=======================================
  Coverage   84.48%   84.48%           
=======================================
  Files         357      357           
  Lines       38675    38675           
  Branches    10957    10957           
=======================================
  Hits        32675    32675           
  Misses       5565     5565           
  Partials      435      435           

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

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.

1 participant