feat(cli): quality improvements — --quiet, pager, TTY, error dedup, Esc policy#119
Open
Patel230 wants to merge 2 commits into
Open
feat(cli): quality improvements — --quiet, pager, TTY, error dedup, Esc policy#119Patel230 wants to merge 2 commits into
Patel230 wants to merge 2 commits into
Conversation
- Add --quiet/-q global flag to suppress spinners, progress, and decoration - Add StartPager/StopPager for long output (uses less/more via PAGER) - Add per-stream TTY detection (stdin/stdout/stderr independent) - Add IsQuiet/CanPrompt/ShouldColor/ShouldUnicode helpers in cmd/ui.go - Deduplicate error classification: single source in internal/hawkerr with ClassifyExitCode and ClassifyErrorMessage both delegating to it
Prevents accidental cancellation of long-running operations. Users must press Ctrl+C to cancel mid-turn, matching Grok CLI behavior.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CLI quality improvements benchmarked against top 20 OSS GitHub CLIs (gh, grok, fzf, bat, gum, lazygit, etc.).
Changes
--quiet/-qglobal flag — suppresses spinners, progress bars, and decorative output for machine-parseable scripting. Modeled onghand other top CLIs.Pager for long output —
StartPager()/StopPager()pipe long output throughless -FRX(or$PAGER/HAWK_PAGER). Disables automatically when output is piped or--quietis set.Per-stream TTY detection — independent
stdinIsTerminal,stdoutIsTerminal,stderrIsTerminalfunctions. Enables correct behavior when only some streams are TTYs (e.g.,hawk ... | grepwhere stdout is a pipe but stderr is a terminal).Error classification deduplication — single source of truth in
internal/hawkerr/classify.go. BothClassifyExitCode()andClassifyErrorMessage()delegate to the same pattern matcher, eliminating drift between exit codes and human-readable messages.Mid-turn Esc policy — Esc is now a no-op during an active agent turn (
waiting == true). Prevents accidental cancellation of long-running operations. Users must press Ctrl+C to cancel, matching Grok CLI behavior.New files
cmd/pager.go— pager lifecycle managementcmd/ui.go— shared UI helpers (IsQuiet, CanPrompt, ShouldColor, ShouldUnicode, TermSize)cmd/error_classify.go— cmd-level enrichment of hawkerr classificationinternal/hawkerr/classify.go— shared error classification engineTest plan
go build ./...passesgo test ./internal/hawkerr/...passes (TestClassifyExitCode)go test ./cmd/ -run TestFriendlypasses--quiet --versionoutputs clean version string--helpshows the new flag