feat: replace polling log spam with progress bar#5
Conversation
Consume the new progress field from the /ci/status endpoint and render an in-place terminal progress bar showing completed vs total scan endpoints, instead of printing a new line every poll. Made-with: Cursor
| } | ||
|
|
||
| if (status.status === "paused") { | ||
| if (progressShown) process.stdout.write("\n"); |
There was a problem hiding this comment.
Missing newline when fallback status line was written
Medium Severity
When the scan completes without ever receiving progress data (e.g., goes directly from queued to completed), the fallback status line is written via process.stdout.write with \r but no trailing newline. Since progressShown stays false, no \n is emitted before returning or throwing. The caller (runScan) then calls console.log, which appends to the same line, producing garbled output like my-scan status: completed...Pentest my-scan completed with 0 issues.
Additional Locations (1)
| const percent = Math.round(ratio * 100); | ||
| const filled = Math.round(ratio * barWidth); | ||
| const empty = barWidth - filled; | ||
| const bar = "█".repeat(filled) + "░".repeat(empty); |
There was a problem hiding this comment.
Progress bar crashes when completed exceeds total endpoints
Medium Severity
If the server returns completedEndpoints > totalEndpoints (a plausible race condition or data inconsistency), filled exceeds barWidth, making empty negative. Calling "░".repeat(negative) throws a RangeError, crashing the entire polling loop. Clamping filled to [0, barWidth] would prevent this.
| } | ||
|
|
||
| if (status.status === "paused") { | ||
| if (progressShown) process.stdout.write("\n"); |
There was a problem hiding this comment.
No terminal cleanup when getScanStatus throws mid-polling
Low Severity
If getScanStatus throws on a subsequent loop iteration (e.g., network timeout, HTTP 500), the exception propagates out of pollScanStatus without writing a newline. The previous process.stdout.write with \r left the cursor at the end of a partial line (either the progress bar or the fallback status). The caller's error output then renders on that same line, producing garbled terminal output. A try/finally around the loop body that emits \n when output has been written would handle this.


Summary
progress(optional) field to theScanStatusResponseObjectZod schema to consume new server-side dataconsole.logpolling message with an in-place terminal progress bar (█░) that updates on a single line using\rDepends on: pensarai/console PR adding
progressto/ci/statusresponseTest plan
pensar scanagainst a project and verify progress bar renders and updates in-placeprogressfield yetMade with Cursor
Note
Low Risk
CLI-output-only changes plus an optional response field; low risk aside from minor terminal formatting/compatibility edge cases.
Overview
Adds an optional
progressobject (completedEndpoints/totalEndpoints) to theScanStatusZod schema to consume new/ci/statusresponse data.Updates
pollScanStatusto render an in-place█░progress bar (or a single-line status fallback when progress is unavailable) and ensures a trailing newline is printed before returning or throwing oncompleted/failed/pausedstates.Written by Cursor Bugbot for commit 9e1194a. This will update automatically on new commits. Configure here.