Skip to content

feat(cli): show ZERO wordmark on --version#673

Merged
kevincodex1 merged 3 commits into
Gitlawb:mainfrom
euxaristia:wordmark-version-flag
Jul 16, 2026
Merged

feat(cli): show ZERO wordmark on --version#673
kevincodex1 merged 3 commits into
Gitlawb:mainfrom
euxaristia:wordmark-version-flag

Conversation

@euxaristia

@euxaristia euxaristia commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Exposes the TUI's empty-state ZERO ascii wordmark via a new tui.Wordmark helper and prints it above the version line for zero -v/--version, as an easter egg.
  • Coloring only applies when stdout is a real TTY and NO_COLOR isn't set, so redirected or piped output (e.g. scripts parsing the version) stays plain text.
  • Version line changed from zero <version> to version: <version> to read correctly under the wordmark.

Test plan

  • go build ./...
  • go test ./internal/cli/... ./internal/tui/...
  • Manually verified zero --version shows colored wordmark in a TTY, plain text when redirected to a file, and stays plain with NO_COLOR=1 set even in a TTY

Summary by CodeRabbit

  • New Features

    • Added a formatted ZERO wordmark to version output when displayed in an interactive terminal.
  • Bug Fixes

    • Preserved the concise, machine-readable zero <version> format when version output is redirected or piped.
    • Ensured redirected version output contains no extra banner or formatting.

The TUI's empty-state ZERO ascii art gets exposed via a new tui.Wordmark
helper and printed above the version line for `zero -v`/`--version`.
Coloring only applies when stdout is a real TTY and NO_COLOR isn't set,
so redirected or piped output (scripts parsing the version) stays plain.
@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 06ef48c0-1dad-4a39-a17d-a12865f3b4d5

📥 Commits

Reviewing files that changed from the base of the PR and between 051d761 and 1cdd3d0.

📒 Files selected for processing (4)
  • internal/cli/app.go
  • internal/cli/app_test.go
  • internal/tui/startup.go
  • internal/tui/startup_test.go

Walkthrough

The CLI now detects whether stdout is a terminal, displaying a wordmark banner interactively while preserving zero <version> for redirected output. The TUI exposes a reusable plain wordmark builder with tests.

Changes

TTY-aware version output

Layer / File(s) Summary
Reusable plain wordmark
internal/tui/startup.go, internal/tui/startup_test.go
Wordmark() assembles the uncolored ASCII wordmark and tests verify its lines contain no ANSI escapes.
CLI version output routing
internal/cli/app.go, internal/cli/app_test.go
Version output selects the wordmark banner for terminal stdout and the exact machine-readable line for redirected stdout, with coverage for file redirection.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Run
  participant stdoutIsTerminal
  participant tui.Wordmark
  participant stdout
  Run->>stdoutIsTerminal: Check stdout terminal status
  stdoutIsTerminal-->>Run: Return terminal or non-terminal status
  Run->>tui.Wordmark: Build wordmark for terminal output
  tui.Wordmark-->>Run: Return plain ASCII wordmark
  Run->>stdout: Write banner or zero version line
Loading

Suggested reviewers: anandh8x, gnan1990, pierrunoyt

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly captures the main change: showing the ZERO wordmark for --version in the CLI.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ 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

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

The release smoke check compared zero --version output to an exact
"zero <version>" string, which broke once --version started printing
the wordmark above the version line. Check for a "version: <version>"
suffix instead so the smoke check doesn't couple to the wordmark art.

@jatmn jatmn left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I found issues that need to be addressed before this is ready.

Findings

  • [P1] Preserve the machine-readable non-TTY version contract
    internal/cli/app.go:342
    Wordmark removes ANSI escapes for a pipe or redirection, but it still emits six banner lines and replaces the sole zero <version> record with version: <version>. That breaks existing command substitutions and exact parsers even though the PR says redirected output remains suitable for scripts; in particular, the checked-in NPM wrapper smoke contract still requires zero --version to report zero <package.json version>. Keep the existing single-line output when stdout is not a terminal (or provide a separately opt-in banner) and add coverage for the piped/redirection path.

  • [P2] Respect selected light themes when coloring the version wordmark
    internal/tui/startup.go:149
    The new command bypasses newModel, which is the only path that resolves --theme/ZERO_THEME and applies the selected palette. As a result, zero --theme light --version and ZERO_THEME=light zero --version render with the global dark palette (ink #ececee), not the selected light palette (ink #22201a); on a light terminal the banner is therefore largely unreadable. Resolve and apply the requested palette for this non-TUI renderer, or render it without color outside the TUI.

…color

- When stdout is not a terminal, --version prints exactly "zero <version>"
  again: pipes, redirects, command substitutions, and the release smoke
  contract all parse that single record, so the banner is a TTY-only
  affordance now.
- The TTY path keeps the banner but restores "zero <version>" as the
  version record instead of "version: <version>".
- Wordmark renders uncolored: only newModel resolves --theme/ZERO_THEME,
  so painting the global dark palette here was unreadable on light
  terminals. The terminal's default foreground works on any background.
- smokeVersion goes back to requiring the exact "zero <version>" output
  instead of the suffix match that papered over the banner.
@euxaristia

Copy link
Copy Markdown
Contributor Author

Pushed 1cdd3d0 for both findings.

  • P1: when stdout is not a terminal, --version prints exactly "zero " again, one line, no banner, no ANSI. The banner only renders on a TTY. The TTY path also uses "zero " as its version record instead of "version: ". smokeVersion in internal/release goes back to requiring the exact single-line output, which holds because the smoke check reads the binary through a pipe. Coverage added for both non-terminal writers (TestRunPrintsVersion) and a real redirected file (TestRunVersionRedirectedFile).
  • P2: Wordmark now renders uncolored rather than trying to resolve a theme outside the TUI. This renderer never sees --theme/ZERO_THEME, so any palette choice could land on the wrong background; the terminal's default foreground is readable everywhere. TestWordmarkIsPlain locks that in.

go build, go vet, and go test on internal/cli, internal/tui, and internal/release pass locally, except TestAltScreenTranscriptScrollKeepsFooterFixed in internal/tui, which also fails on this branch without these changes and is unrelated.

@jatmn jatmn left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@Vasanthdev2004 Vasanthdev2004 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nice touch the TTY/pipe split is exactly right: scripts, redirects, and the NPM wrapper keep the single zero <version> record, and the wordmark only renders on an interactive terminal. I like that Wordmark() reuses the existing art and stays uncolored, so it can't go unreadable on a light theme. Build and the new tests pass in an isolated worktree; the only red tests reproduce on clean main (sandbox/add-dir), so nothing here to block on.

@kevincodex1 kevincodex1 merged commit 9acb411 into Gitlawb:main Jul 16, 2026
7 checks passed
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.

4 participants