← Back to PRs

#23522: feat(cli): add --quiet flag and OPENCLAW_NO_TAGLINE env var (#22635)

by dissaozw open 2026-02-22 11:26 View on GitHub →
cli size: S
Fixes #22635 ## Problem Every CLI command outputs a random tagline after the version string. No way to suppress it for scripts, cron jobs, or piped output. ## Fix **4 files, 136 insertions:** 1. **`src/cli/argv.ts`** — Added `"--quiet"` to `ROOT_BOOLEAN_FLAGS` so the `-v` version alias parser correctly skips it as a known root flag. 2. **`src/cli/banner.ts`** — Added `isQuietTagline()` helper that checks three sources (in priority order): - Explicit `quiet` option on `BannerOptions` - `OPENCLAW_NO_TAGLINE` env var (truthy) - `--quiet` or `-q` in argv When quiet, `formatCliBannerLine()` returns just the version line (`🦞 OpenClaw 1.0.0 (commit)`) without the `— random tagline` suffix. 3. **`src/cli/program/help.ts`** — Registered `-q, --quiet` as a global CLI option with description "Suppress the startup tagline". 4. **`src/cli/banner.test.ts`** (new) — 6 tests covering: default tagline present, `quiet: true` option, `--quiet` flag, `-q` flag, `OPENCLAW_NO_TAGLINE` env, and rich-mode quiet. All 41 existing tests pass. <!-- greptile_comment --> <h3>Greptile Summary</h3> Adds `--quiet` / `-q` flag and `OPENCLAW_NO_TAGLINE` env var to suppress the random startup tagline. The implementation uses a three-tier priority system: explicit `quiet` option → `OPENCLAW_NO_TAGLINE` env var → `--quiet`/`-q` argv flags. When quiet mode is active, the banner displays only the version and commit (`🦞 OpenClaw 1.0.0 (commit)`) without the tagline suffix. - **`src/cli/argv.ts`**: Added `--quiet` to `ROOT_BOOLEAN_FLAGS` for proper root version alias parsing - **`src/cli/banner.ts`**: Implemented `isQuietTagline()` helper with priority-based detection and early return in `formatCliBannerLine()` - **`src/cli/program/help.ts`**: Registered `-q, --quiet` global option - **`src/cli/banner.test.ts`**: Added 6 test cases covering default behavior and all three quiet modes All tests pass. Clean implementation following existing patterns. <h3>Confidence Score: 5/5</h3> - This PR is safe to merge with no issues found - Clean implementation with comprehensive test coverage, follows existing patterns, and addresses the stated problem directly. The three-tier priority system is well-designed, backward compatible, and integrates seamlessly with existing banner logic - No files require special attention <sub>Last reviewed commit: 897d4e3</sub> <!-- greptile_other_comments_section --> <sub>(4/5) You can add custom instructions or style guidelines for the agent [here](https://app.greptile.com/review/github)!</sub> <!-- /greptile_comment -->

Most Similar PRs