cli: add progress bar for doc generation#885
Conversation
Adds a cli-progress-based progress bar (src/utils/progress-bar.mjs) that tracks how many of the requested generators have completed while `generate` runs. Rendering is skipped when stdout isn't a TTY so CI logs and piped output stay clean. runGenerators() now accepts an optional onGeneratorComplete callback, invoked once per requested target as its result becomes ready, which the generate command wires up to the progress bar. Refs: nodejs#58
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR SummaryLow Risk Overview A new
Tests cover the progress bar behavior (TTY vs non-TTY) and that Reviewed by Cursor Bugbot for commit 4d7db68. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 4d7db68. Configure here.
| onGeneratorComplete: progressBar.increment, | ||
| }); | ||
|
|
||
| progressBar.stop(); |
There was a problem hiding this comment.
Progress bar not stopped on failure
Medium Severity
When runGenerators rejects, progressBar.stop() is skipped because it runs only after a successful await. The TTY bar is started with hideCursor: true, so a failed generate can leave the terminal cursor hidden until the user resets the shell.
Reviewed by Cursor Bugbot for commit 4d7db68. Configure here.


Summary
Adds a
cli-progress-based progress bar that tracks how many of the requested generators have completed whilegenerateruns, similar to the approach used in nodejs.dev'sgetApiDocsData.jsreferenced in the issue.src/utils/progress-bar.mjswraps acli-progressSingleBar. Rendering is skipped entirely when stdout isn't a TTY, so CI logs, piped output, and tests never receive raw escape codes or bar frames.runGenerators()now accepts an optional{ onGeneratorComplete }callback, invoked once per requested target (not its dependencies) as soon as its result is ready.generatecommand creates the bar, starts it with the target count, and wiresonGeneratorCompletetoincrement.Test plan
progress-bar.mjs(mockscli-progressto verify correctstart/increment/stopcalls, and that it's a no-op off-TTY)generators.test.mjsassertingonGeneratorCompletefires once per requested target, not per dependencyprocess.stdout.isTTY = truemanually and drove a realSingleBarinstance through the exported API to confirm no runtime errorsnpm test— no new failures (3 pre-existing failures on this checkout are unrelated Windows path-separator issues, reproducible onmain)npm run lint— clean (pre-existing unrelated warnings only)Closes #58