Environment
- OS: All
- Node Version: v24.14.1
- Package:
@clack/prompts
- Package Version: v1.2.0
Describe the bug
taskLog does not correctly handle carriage-return (\r) updates from spinner/progress-style output.
When a tool writes multiple updates to the same terminal line using carriage returns, taskLog does not model those updates as in-place overwrites. As a result, intermediate frames can accumulate in the internal log state and the rendered output/clearing behavior can become inconsistent on completion, especially around error() and showLog.
This seems related to taskLog being a raw prompt with its own rendering logic instead of using the shared rendering path used by other prompts.
To Reproduce
Steps to reproduce the behavior:
- Create a
taskLog instance from @clack/prompts
- Stream spinner-like updates with carriage returns, for example:
import * as prompts from '@clack/prompts';
const log = prompts.taskLog({
title: 'foo',
});
log.message('◒ Cloning repository', { raw: true });
log.message('\r◐ Cloning repository', { raw: true });
log.message('\r◓ Cloning repository', { raw: true });
Expected behavior
taskLog should treat carriage-return updates as overwrites of the current visible line.
That means:
- only the latest spinner/progress frame should be retained
- intermediate frames should not accumulate in the log
- error() / success() rendering should reflect the final visible state
- clearing behavior should match the number of actually rendered lines
Additional Information
See: #509 (comment)
Environment
@clack/promptsDescribe the bug
taskLogdoes not correctly handle carriage-return (\r) updates from spinner/progress-style output.When a tool writes multiple updates to the same terminal line using carriage returns,
taskLogdoes not model those updates as in-place overwrites. As a result, intermediate frames can accumulate in the internal log state and the rendered output/clearing behavior can become inconsistent on completion, especially arounderror()andshowLog.This seems related to
taskLogbeing a raw prompt with its own rendering logic instead of using the shared rendering path used by other prompts.To Reproduce
Steps to reproduce the behavior:
taskLoginstance from@clack/promptsExpected behavior
taskLogshould treat carriage-return updates as overwrites of the current visible line.That means:
Additional Information
See: #509 (comment)