diff --git a/docs/changelog.md b/docs/changelog.md index cad49ec..0e46c23 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -11,6 +11,7 @@ below and to the page that documents the feature properly. | Version | What changed | Documented in | |---|---|---| +| [2.15.1](#v2151) | Color and rule-ID links appear only where they render; `NO_COLOR` honoured | [Color and links](example.md#color-and-links) | | [2.15.0](#v2150) | `--rev` names the commit under test; skipped checks are named on stderr | [Command-line recipes](example.md#checking-a-range-of-commits) | | [2.14.0](#v2140) | CC003 judges imperative mood by a word's form, not by a list of verbs | [CC003](rules.md#cc003) | | [2.13.1](#v2131) | JSON output reports the checked value for passing checks | [Output for scripts and CI](example.md#output-for-scripts-and-ci) | @@ -25,6 +26,21 @@ below and to the page that documents the feature properly. | [2.5.0](#v250) | Organization-wide config with `inherit_from` | [Integrations](guides/integrations.md#across-an-organization) | | [2.0.0](#v200) | Configuration moved from YAML to TOML — breaking | [Migrating from v1](migration.md) | +## v2.15.1 (2026-08-16) { #v2151 } + +### Fixed + +* **ANSI color is emitted only where it renders** — a terminal gets color; + piped and redirected output (a CI log, a file, another tool) gets plain text + instead of escape codes. `NO_COLOR` ([no-color.org](https://no-color.org)) + set to any non-empty value disables color everywhere, and `FORCE_COLOR` + overrides the detection in both directions — `0` off, anything else on — + outranking `NO_COLOR`, the same way the wider tooling ecosystem resolves + the pair. Contributed by [@larsch](https://github.com/larsch). + See PRs [#551](https://github.com/commit-check/commit-check/pull/551) and + [#552](https://github.com/commit-check/commit-check/pull/552), and + [Color and links](example.md#color-and-links). + ## v2.15.0 (2026-08-13) { #v2150 } ### Added diff --git a/docs/configuration.md b/docs/configuration.md index ed1cf0c..531fd7a 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -167,7 +167,7 @@ Used from a hook definition, with no config file anywhere in the repository: ```yaml title=".pre-commit-config.yaml" repos: - repo: https://github.com/commit-check/commit-check - rev: v2.15.0 + rev: v2.15.1 hooks: - id: check-message args: diff --git a/docs/example.md b/docs/example.md index 187339d..73390ff 100644 --- a/docs/example.md +++ b/docs/example.md @@ -131,7 +131,7 @@ pushed: ```yaml title=".pre-commit-config.yaml" repos: - repo: https://github.com/commit-check/commit-check - rev: v2.15.0 + rev: v2.15.1 hooks: - id: check-no-force-push stages: [pre-push] @@ -190,6 +190,22 @@ and how CLI, environment and file settings override each other. $ commit-check -m --dry-run ``` +### Color and links + +Output adapts to where it is going. A terminal gets ANSI color, and on +terminals that render OSC 8 hyperlinks the rule ID is itself a link to its +documentation. Piped or redirected output — a CI log, a file — gets plain +text with a `Docs:` line instead, so nothing is lost and no escape codes +leak into places that read them as noise. + +To override the detection: + +| Variable | Effect | +| --- | --- | +| `NO_COLOR=1` | no color, wherever it runs ([no-color.org](https://no-color.org)) | +| `FORCE_COLOR=1` / `FORCE_COLOR=0` | color on or off, outranking everything else | +| `FORCE_HYPERLINK=1` / `FORCE_HYPERLINK=0` | linked rule IDs on or off | + ### Checking a range of commits `--rev` makes each commit addressable without checking it out or piping its diff --git a/docs/guides/integrations.md b/docs/guides/integrations.md index 8a576bb..a5816f0 100644 --- a/docs/guides/integrations.md +++ b/docs/guides/integrations.md @@ -23,7 +23,7 @@ Add Commit Check to `.pre-commit-config.yaml`: ```yaml title=".pre-commit-config.yaml" repos: - repo: https://github.com/commit-check/commit-check - rev: v2.15.0 + rev: v2.15.1 hooks: - id: check-message - id: check-branch @@ -70,7 +70,7 @@ Options can be passed as hook arguments, which keeps everything in one file: ```yaml title=".pre-commit-config.yaml" repos: - repo: https://github.com/commit-check/commit-check - rev: v2.15.0 + rev: v2.15.1 hooks: - id: check-message args: diff --git a/docs/index.md b/docs/index.md index af331fd..370ca21 100644 --- a/docs/index.md +++ b/docs/index.md @@ -36,7 +36,7 @@ whatever your AI agent is committing on your behalf. ```yaml title=".pre-commit-config.yaml" repos: - repo: https://github.com/commit-check/commit-check - rev: v2.15.0 + rev: v2.15.1 hooks: - id: check-message - id: check-branch