Skip to content

no-color cli output#256

Open
dharmateja03 wants to merge 2 commits intoexospherehost:mainfrom
dharmateja03:fix/ci-stop-current-head
Open

no-color cli output#256
dharmateja03 wants to merge 2 commits intoexospherehost:mainfrom
dharmateja03:fix/ci-stop-current-head

Conversation

@dharmateja03
Copy link
Copy Markdown

@dharmateja03 dharmateja03 commented Apr 30, 2026

Description

Type of Change

  • Bug fix
  • [ X ] New feature
  • Refactor
  • Documentation

Checklist

  • npm run lint passes
    • npx tsc --noEmit passes
    • npm run test:run passes
    • npm run build succeeds

Summary by CodeRabbit

Release Notes

  • New Features

    • Added NO_COLOR environment variable and --no-color command-line flag to disable ANSI-colored CLI output for improved compatibility with CI logs and non-ANSI-compatible terminals.
  • Documentation

    • Updated documentation to describe the new color-disabling options.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 30, 2026

Warning

Rate limit exceeded

@NiveditJain has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 24 minutes and 35 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a7387ba6-c170-4ddb-b8b9-714897e03ac2

📥 Commits

Reviewing files that changed from the base of the PR and between 0eb45b4 and 115106f.

📒 Files selected for processing (5)
  • CHANGELOG.md
  • README.md
  • __tests__/hooks/install-prompt.test.ts
  • bin/failproofai.mjs
  • src/hooks/install-prompt.ts
📝 Walkthrough

Walkthrough

Introduces support for disabling colored CLI output via the NO_COLOR environment variable or --no-color CLI flag. A new cli-color module provides centralized styling and cursor control. The install-prompt integrates this module, falls back to non-interactive mode when colors are disabled, and ensures cursor restoration on exit.

Changes

Cohort / File(s) Summary
Documentation
CHANGELOG.md, README.md, docs/cli/environment-variables.mdx
Documents the new NO_COLOR environment variable and --no-color flag for disabling ANSI-colored CLI output.
CLI Argument Handling
bin/failproofai.mjs
Strips --no-color from argv and maps it to NO_COLOR=1 in process.env; updates help text to document the flag.
Core Styling & Cursor Module
src/cli-color.ts
New module providing createCliStyler() for conditional ANSI styling based on NO_COLOR/FORCE_COLOR/TTY, and createCursorController() for managing cursor visibility with automatic restoration on process exit.
Feature Integration
src/hooks/install-prompt.ts
Refactors to use centralized createCliStyler() and createCursorController() APIs; adds control-flow fallback to non-interactive defaults when style.enabled is false.
Test Coverage
__tests__/hooks/install-prompt.test.ts
Adds tests for NO_COLOR behavior in promptPolicySelection(), verifies colorless warning output in resolveTargetClis(), and ensures terminal raw-mode is not manipulated when NO_COLOR is set.

Sequence Diagram

sequenceDiagram
    actor User
    participant CLI as bin/failproofai.mjs
    participant Env as process.env
    participant Styler as cli-color.ts
    participant Prompt as install-prompt.ts
    participant Term as Terminal

    User->>CLI: --no-color or NO_COLOR=1
    CLI->>Env: Set NO_COLOR=1
    Prompt->>Styler: createCliStyler(stdout)
    Styler->>Env: Check NO_COLOR
    Styler-->>Prompt: CliStyler {enabled: false}
    
    alt NO_COLOR enabled
        Prompt->>Prompt: Skip interactive selection
        Prompt->>Prompt: Use defaults (non-interactive)
    else NO_COLOR disabled & TTY
        Prompt->>Prompt: Enable interactive selection
    end
    
    Prompt->>Term: Render output (with/without ANSI codes)
    Prompt->>Styler: createCursorController()
    Styler->>Term: Hide cursor on render
    Prompt->>Term: Display prompt
    Prompt->>Styler: dispose() on cleanup
    Styler->>Term: Restore cursor & remove exit listener
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

Possibly related PRs

Poem

🐰 Colors now fade when told to disappear,
A --no-color flag makes terminals clear,
Cursor hides gracefully, restored with care,
Tests ensure the fallback flows fair,
No ANSI chaos in CI's lair! ✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is missing detailed explanation of what the PR does and why it's needed. The 'Description' section is empty with only a comment placeholder. Fill the Description section with an explanation of the NO_COLOR feature, its purpose (CI/non-ANSI terminal compatibility), and how it affects CLI behavior.
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'no-color cli output' accurately describes the main change: adding NO_COLOR environment variable and --no-color flag support to disable CLI output coloring.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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
Review rate limit: 0/1 reviews remaining, refill in 24 minutes and 35 seconds.

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

# Conflicts:
#	CHANGELOG.md
#	src/hooks/install-prompt.ts
@NiveditJain
Copy link
Copy Markdown
Member

Thanks for the PR @dharmateja03! Curious about the motivation here — are you running failproofai somewhere with NO_COLOR set (CI logs, a piped tool, a non-ANSI terminal), or was this more of a general spec-compliance improvement? Just want to understand the use case so we can make sure the no-color path covers what you actually need.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants