fix(ai-services): Prevent TTY errors during AI streaming output

The  function used terminal manipulation functions
(like , ) for the CLI
streaming progress indicator. This caused errors when Task Master commands
involving AI streaming were run in non-interactive terminals (e.g., via
output redirection, some CI environments, or integrated terminals).

This commit adds a check for  to the condition
that controls the display of the CLI progress indicator, ensuring these
functions are only called when standard output is a fully interactive TTY.
This commit is contained in:
Eyal Toledano
2025-04-14 17:56:10 -04:00
parent 44ad248c6b
commit dd049d57d7
5 changed files with 118 additions and 85 deletions

View File

@@ -1038,8 +1038,8 @@ async function _handleAnthropicStream(
const isSilent =
silentMode || (typeof silentMode === 'undefined' && isSilentMode());
// Only show CLI indicators if in cliMode AND not in silent mode
const showCLIOutput = cliMode && !isSilent;
// Only show CLI indicators if in cliMode AND not in silent mode AND stdout is a TTY
const showCLIOutput = cliMode && !isSilent && process.stdout.isTTY;
if (showCLIOutput) {
loadingIndicator = startLoadingIndicator(