Skip to content

fix(api): resolve no-color flag from environment variables#89

Merged
moshloop merged 3 commits intomainfrom
pr/logging
Mar 24, 2026
Merged

fix(api): resolve no-color flag from environment variables#89
moshloop merged 3 commits intomainfrom
pr/logging

Conversation

@moshloop
Copy link
Copy Markdown
Member

@moshloop moshloop commented Mar 24, 2026

Summary by CodeRabbit

  • New Features

    • Added head-tail truncation mode to display first and last N lines with omitted line count indicator
    • Added task execution timeout configuration option
    • Enhanced command output truncation with improved line wrapping
    • Improved NO_COLOR environment variable detection and handling
  • Bug Fixes

    • Better handling of completed tasks in constrained terminal space with intelligent collapsing
  • Tests

    • Added comprehensive task fixture testing framework with CEL assertion support

Show first task, "... and X more", and last task when completed
tasks exceed the available terminal rows (total height minus
pending task lines).
…st n lines

Introduces "truncate-headtail" mode that displays first N + last N lines with an ellipsis separator for omitted content. Applies truncation at append time to prevent line splitting. Removes trailing whitespace in task render output.
Add ResolveNoColor() calls to respect NO_COLOR, COLOR, and TERM environment variables per no-color.org spec. Update test fixtures and dependencies.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 24, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 88b3f499-a6ab-4c91-81ef-273560f80a72

📥 Commits

Reviewing files that changed from the base of the PR and between 1025b96 and a13a143.

⛔ Files ignored due to path filters (1)
  • examples/uber_demo/go.sum is excluded by !**/*.sum
📒 Files selected for processing (16)
  • api/tailwind/tailwind.go
  • api/tailwind/truncate_test.go
  • api/text.go
  • api/text_test.go
  • api/themes.go
  • cmd/clicky/main.go
  • examples/uber_demo/go.mod
  • examples/uber_demo/main.go
  • exec/exec.go
  • flags.go
  • formatters/options.go
  • formatters/options_test.go
  • task/render.go
  • task/render_test.go
  • task/suite_test.go
  • task/task_fixture_test.go

Walkthrough

This PR introduces a new "headtail" truncation mode showing first and last N lines with an omission marker, adds terminal line configuration and no-color environment resolution helpers, refactors task rendering to collapse completed tasks based on available terminal space, and updates example module dependencies.

Changes

Cohort / File(s) Summary
Headtail Truncation Mode
api/tailwind/tailwind.go, api/tailwind/truncate_test.go, exec/exec.go
Added new truncation mode "headtail" via truncate-headtail class that displays first N + last N lines with an omission count separator. New exported function TruncateForAppend parses styles and applies default "suffix" mode. Updated ExecResult.PrettyFull() to use max-lines-[20] truncate-headtail for Stdout and Stderr rendering.
Text Truncation Integration
api/text.go, api/text_test.go
Modified Text.Append to use TruncateForAppend for multiline string handling with computed styles. Added test coverage validating truncation with max-lines-[3] and max-lines-[2] truncate-headtail modes.
Terminal Line Management
api/themes.go, task/render.go, task/render_test.go
Added SetTerminalLines(height int) to configure terminal height externally. Refactored prettyFromTasks to constrain completed task display based on available terminal lines, collapsing middle items while preserving first and last tasks when space is limited. Trailing spaces now stripped from rendered output lines.
No-Color Resolution
formatters/options.go, formatters/options_test.go, cmd/clicky/main.go, flags.go
Introduced IsNoColor() helper and (*FormatOptions).ResolveNoColor() method that check environment variables (NO_COLOR, COLOR, TERM), CLI flags (--no-color), and set NoColor field accordingly. Integrated into command execution paths and AllFlags.UseFlags().
Task Infrastructure
examples/uber_demo/main.go, task/suite_test.go, task/task_fixture_test.go
Added Timeout field to TasksOptions and propagated task.Option variadic parameters through task runner functions. Enhanced task functions to return concrete types instead of (any, error). Introduced Ginkgo-based test suite and YAML fixture-driven task testing framework supporting assertion evaluation via CEL expressions.
Dependency Updates
examples/uber_demo/go.mod
Bumped direct dependencies: clicky to v1.17.0, commons to v1.47.2, cobra to v1.10.2. Added new direct dependencies: gomplate/v3, uuid, ginkgo/v2, gomega, yaml.v3. Updated multiple indirect dependencies across build tools, cloud SDKs, and Kubernetes packages.

Possibly related PRs

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch pr/logging
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch pr/logging

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@moshloop moshloop merged commit 027bdec into main Mar 24, 2026
11 of 13 checks passed
@moshloop moshloop deleted the pr/logging branch March 24, 2026 21:00
@flankbot
Copy link
Copy Markdown

🎉 This PR is included in version 1.20.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants