fix: NO_COLOR does not win over CLICOLOR_FORCE under --color=auto
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
Research direction
Start in internal/cli/colorflag.go: the stated precedence is at lines 101-103, the NO_COLOR rewrite in rewriteEnviron at 115-135, and the handling around 155-168. The fix is to drop CLICOLOR_FORCE from the environment when NO_COLOR is non-empty under --color=auto, before colorprofile reads it. Reproduce with NO_COLOR=1 CLICOLOR_FORCE=1 codegraph version | cat -v, then add a test for that input asserting zero ESC bytes, which should fail on the current code.
Written by the indexing model from the issue text.
Description
What happens
$ NO_COLOR=1 CLICOLOR_FORCE=1 codegraph version | cat -v
^[[1;38;2;95;215;255mcodegraph dev^[[m ^[[2;38;2;147;161;161m(commit unknown, built unknown)^[[m ...
Under --color=auto, rewriteEnviron rewrites NO_COLOR to NO_COLOR=1 but passes CLICOLOR_FORCE through unchanged, and colorprofile lets CLICOLOR_FORCE win.
What you expected instead
No escape bytes. The code's stated order is NO_COLOR > CLICOLOR_FORCE > CLICOLOR=0 > TTY.
Steps to reproduce
Run the command above with any build of main.
Version
main at d384473e (built locally, codegraph dev)
Platform
macOS 27 arm64
How did you install it?
Built from source
Evidence
internal/cli/colorflag.go:101-103(stated order),:115-135(NO_COLOR rewritten, CLICOLOR_FORCE kept),:155-168
Acceptance criteria
- With a non-empty
NO_COLOR,--color=autodropsCLICOLOR_FORCEbefore colorprofile sees it. - A test covering
NO_COLOR=1 CLICOLOR_FORCE=1asserts zero ESC bytes, and fails on the current code.
Source (GSD planning files, archived at d384473e): .planning/milestones/v0.14.0-MILESTONE-AUDIT.md (T-04-30)
🤖 Generated with Claude Code
- Dominant language
- Go
- Stars
- 0
- Forks
- 0
- Avg merge
- 5h 16m
- Merged PRs (30d)
- 107
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from seanb4t/codegraph-go
-
area:indexer bug needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
seanb4t/codegraph-go#385 ·
Maintainers usually reply within 1 day
-
chore needs-triage
Difficulty 1/5 Under an hour Newbie friendliness 88/100
seanb4t/codegraph-go#380 ·
Maintainers usually reply within 1 day
-
chore needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
seanb4t/codegraph-go#379 ·
Maintainers usually reply within 1 day
-
chore needs-triage
Difficulty 1/5 1-3 hours Newbie friendliness 84/100
seanb4t/codegraph-go#362 ·
Maintainers usually reply within 1 day
-
area:query bug priority:low spec-needed
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
seanb4t/codegraph-go#355 ·
Maintainers usually reply within 1 day
All issues in seanb4t/codegraph-go
Similar issues
-
enhancement exporter/awskinesis needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
open-telemetry/opentelemetry-collector-contrib#53334 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
erigontech/erigon#26523 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 83/100
SocialGouv/iterion#3376 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
seaweedfs/seaweedfs#12740 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day