Skip to content

fix: plain output when the CLI is not attached to a terminal - #349

Merged
PhantomInTheWire merged 2 commits into
mainfrom
capy/plain-output-when-the
Oct 26, 2026
Merged

PhantomInTheWire merged 2 commits into
mainfrom
capy/plain-output-when-the

Conversation

@PhantomInTheWire

@PhantomInTheWire PhantomInTheWire commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

firecrawl agent --wait with stderr piped, 2s:

- before  1753 bytes
- ⠋ Starting agent...
- ⠙ Agent running... (Job ID: 01a1770a-…)
- ⠹ Agent running... (Job ID: 01a1770a-…)
- ⠸ Agent running... (Job ID: 01a1770a-…)
- … 20 more, one per 80ms frame

+ after   102 bytes
+ Starting agent...
+ Agent running... (Job ID: 01a1770a-…)
+ ✓ Agent completed
@@ on spinner or progress update @@
+ if stderr is a TTY and TERM != dumb
+   redraw line in place
+ else if message changed
+   print plain line
+ else
+   skip

@@ color tokens @@
+ if NO_COLOR is non-empty          → off
+ else if FORCE_COLOR is set        → on unless '0'
+ else if stdout and stderr are TTYs → on
+ else                              → off

Behavior change: with both NO_COLOR and FORCE_COLOR set, doctor now follows NO_COLOR, the same as the update notices.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 13 files

Confidence score: 4/5

  • In src/utils/terminal.ts, an empty NO_COLOR value still disables color. Check that the value is non-empty before disabling it.
  • In src/__tests__/utils/spinner.test.ts, the assertion can pass with an incorrect frame count. Assert the exact sequence length.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/__tests__/utils/spinner.test.ts">

<violation number="1" location="src/__tests__/utils/spinner.test.ts:85">
P3: This assertion is looser than the deterministic behavior. Under fake timers the sequence is exactly three frames, then the clear, then the final line, so assert the exact length to catch regressions in frame count.</violation>
</file>

<file name="src/utils/terminal.ts">

<violation number="1" location="src/utils/terminal.ts:10">
P3: `NO_COLOR` should only disable color when it is non-empty, per the no-color.org convention this change follows. Check `process.env.NO_COLOR` truthiness (non-empty) instead of `!== undefined`.</violation>
</file>

Shadow auto-approve: would not auto-approve because issues were found.
Click Fix with cubic on a comment, or reply @cubic-dev-ai fix this, and cubic writes the fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread src/utils/terminal.ts Outdated
Comment thread src/__tests__/utils/spinner.test.ts Outdated
Comment thread src/utils/terminal.ts Outdated
Comment thread src/utils/spinner.ts

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 3 files (changes from recent commits).

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Shadow auto-approve: would auto-approve. Fixes CLI progress output when stderr is not a terminal by printing plain lines only when the message changes, and centralizes TTY-aware color handling; a focused, tested bug fix with no rollout, policy, or contract change.

View guided diff | Turn on auto-fix | Re-trigger cubic

@PhantomInTheWire
PhantomInTheWire merged commit 7bb7661 into main Oct 26, 2026
8 checks passed
@PhantomInTheWire
PhantomInTheWire deleted the capy/plain-output-when-the branch October 26, 2026 12:47
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