Skip to content

ANSI escape sequences are emitted when stdout is not a TTY #682

Description

@contributor

OpenCodeReview Version

open-code-review v1.8.4 (e784744) windows/amd64

Operating System

Windows

Installation Method

GitHub Release binary

LLM Provider

Other OpenAI-compatible endpoint

Bug Description

Description

ocr review emits ANSI escape sequences even when its output is redirected or piped to another program.

This makes it difficult to use the command in scripts or to publish its output elsewhere (e.g. GitHub issue comments), because the raw escape sequences become part of the output.

Expected behavior

When stdout is not a TTY, ocr review should output plain text without ANSI escape sequences.

Alternatively, please provide an option such as:

  • --no-color
  • --color=never
  • --plain

to explicitly disable ANSI formatting.

Environment

  • OpenCode Review (ocr)
  • Windows (Git Bash)

Use case

I would like to pipe the review output directly into GitHub CLI:

ocr review --commit HEAD | gh issue comment <issue> --body-file -

Currently the resulting GitHub comment contains literal escape sequences such as:

�[2m
�[93m
�[0m

instead of plain text.

Steps to Reproduce

ocr review --commit HEAD | cat -v

Output contains ANSI sequences such as:

^[[2m─── packages/... ───^[[0m
^[[93m[maintainability · medium]^[[0m ...

or:

ocr review --commit HEAD | grep -P $'\x1b'

which matches the lines containing the colored severity labels.

Expected Behavior

When stdout is not a TTY, ocr review should output plain text without ANSI escape sequences.

Alternatively, please provide an option such as:

  • --no-color
  • --color=never
  • --plain

to explicitly disable ANSI formatting.

Logs / Error Output

Additional Context

Environment

  • OpenCode Review (ocr)
  • Windows (Git Bash)

Metadata

Metadata

Labels

bugSomething isn't workingenhancementNew feature or requestgood first issueGood for newcomershelp wantedExtra attention is needed

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions