Skip to content

fix(cli): avoid spinner escape spam on plugin install in non-TTY#32440

Open
0xDevNinja wants to merge 1 commit into
anomalyco:devfrom
0xDevNinja:fix-plugin-install-spinner-nontty
Open

fix(cli): avoid spinner escape spam on plugin install in non-TTY#32440
0xDevNinja wants to merge 1 commit into
anomalyco:devfrom
0xDevNinja:fix-plugin-install-spinner-nontty

Conversation

@0xDevNinja

Copy link
Copy Markdown

Issue for this PR

Closes #27908

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

opencode plugin install uses the clack spinner, which animates by emitting carriage returns and ANSI escape sequences. In a non-TTY environment (CI, a subprocess, a piped PowerShell session) those control characters are not interpreted, so every animation frame is printed on its own line with Installing plugin package... repeated.

This guards the default spinner factory with a process.stdout.isTTY check (the same approach already used in cli/ui.ts). When stdout is not a terminal it falls back to a static spinner that writes the start/stop message once as plain text, with no escape sequences. TTY behavior is unchanged.

How did you verify your code works?

  • bun typecheck passes.
  • bun test test/plugin/install.test.ts -> 21 pass.
  • The change is confined to defaultPlugDeps; the existing tests inject their own spinner via PlugDeps, so production behavior is the only thing affected and the test surface is unchanged.

Screenshots / recordings

N/A - CLI output change, no UI.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

The plugin install command uses the clack spinner, which animates via
carriage returns and ANSI escapes. In a non-TTY (CI, subprocess, piped
PowerShell) those are not interpreted, so every frame is printed as a
separate line with the message repeated.

Guard the default spinner with a process.stdout.isTTY check and fall back
to plain static text when stdout is not a terminal.

Closes anomalyco#27908
@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Potential Duplicate PRs Found

Based on the search results, there are several related PRs addressing similar non-TTY spinner issues:

  1. fix: silence plugin spinner outside TTY #32317 - fix: silence plugin spinner outside TTY

    • Directly related to the same issue (plugin spinner in non-TTY)
  2. fix: use static plugin spinner outside TTY #27951 - fix: use static plugin spinner outside TTY

    • Addresses the same problem (static spinner fallback for non-TTY)
  3. fix(cli): disable spinner animation in non-TTY environments #31598 - fix(cli): disable spinner animation in non-TTY environments

    • General CLI spinner fix for non-TTY environments
  4. fix(tui): prevent spinner garbage in non-TTY environments #29601 - fix(tui): prevent spinner garbage in non-TTY environments

    • Similar TUI-specific spinner issue in non-TTY

PRs #32317 and #27951 appear to be the most directly related, as they specifically target the plugin install spinner behavior in non-TTY environments, which is exactly what PR #32440 addresses.

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.

plugin install spinner outputs garbage in non-TTY environment

1 participant