The CLI logs through zerolog's ConsoleWriter, which colorized output
unconditionally. Consumers that do not interpret ANSI escape codes (a
Jenkins console without the AnsiColor plugin, piped output, log files)
showed them as raw control sequences.
Color detection now follows the same model as the widely used
supports-color/chalk family: honor the NO_COLOR and CLICOLOR_FORCE /
FORCE_COLOR conventions, enable color on an interactive terminal, and
for non-terminal output enable it only for CI systems known to render
ANSI (GitHub Actions, GitLab CI, CircleCI, Travis, Buildkite, Drone,
AppVeyor). Jenkins is intentionally excluded, so it falls back to the
no-color default and keeps its logs clean.
Closes #3228
Assisted-by: Claude Code
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>
Chainloop-Trace-Sessions: 5dbf672f-418b-459c-b51f-485c213d3c40
What
The CLI logs through zerolog's
ConsoleWriter, which colorized output unconditionally. Consumers that do not interpret ANSI escape codes (a Jenkins console without the AnsiColor plugin, piped output, log files) showed them as raw control sequences (e.g.[31mERR[0m).Color detection now follows the same model as the widely used
supports-color/chalkfamily:NO_COLORopt-out andCLICOLOR_FORCE/FORCE_COLORopt-in conventions (these take precedence).TERM=dumbdisables color.Net effect: interactive terminals, GitHub Actions and GitLab keep colored output; Jenkins (without the AnsiColor plugin), pipes and files are now clean.
The decision logic is isolated in a pure, unit-tested function.
Closes #3228
AI assistance
This contribution was assisted by Claude Code.
🤖 Posted by Maximus bot (Claude Code) on behalf of @migmartri