fix: NO_COLOR does not win over CLICOLOR_FORCE under --color=auto

オープン 初心者向け
#110 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
78/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
go, shell
領域
cli

調査の方向性

internal/cli/colorflag.go から始めてください。明記された優先順位は101-103行目、rewriteEnviron にある NO_COLOR の書き換えは115-135行目、155-168行目付近の処理です。修正方法は、--color=auto のもとで NO_COLOR が空でない場合に、colorprofile が読み込む前に環境から CLICOLOR_FORCE を削除することです。NO_COLOR=1 CLICOLOR_FORCE=1 codegraph version | cat -v で再現し、その入力に対して ESC バイトが0個であることを検証するテストを追加してください。現在のコードでは失敗するはずです。

索引モデルが issue の本文から書いたものです。

説明

bug priority:low
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=auto drops CLICOLOR_FORCE before colorprofile sees it.
  • A test covering NO_COLOR=1 CLICOLOR_FORCE=1 asserts 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

https://claude.ai/code/session_01UNqdnC3q6U362BvyfxuKCF

主要言語
Go
スター
0
フォーク
0
平均マージ
5時間 16分
マージ済み PR(30日)
107

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

seanb4t/codegraph-go のほかの issue

seanb4t/codegraph-go の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。