Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AskYesNo ¶
AskYesNo asks question on w and reads a yes/no response from r. AssumeYes short-circuits to true; NonInteractive (without AssumeYes) short-circuits to false. Default (empty answer) is no. Recognises: y, yes (case-insensitive, trimmed).
func ColorEnabled ¶
ColorEnabled reports whether color/ANSI escapes should be emitted to w.
- ColorNever or NO_COLOR/COMMITBRIEF_NO_COLOR env set → false
- ColorAlways → true (caller's choice, even when piped)
- ColorAuto → true only if w is a TTY
func EnableANSI ¶
EnableANSI applies platform-specific tweaks needed to render ANSI escapes (e.g. enabling VT processing on Windows 10+). No-op on POSIX.
func IsStdinTTY ¶
IsStdinTTY reports whether the given reader is a TTY. Used by the CLI to decide whether to set AskOptions.NonInteractive automatically.
Types ¶
type AskOptions ¶
type Progress ¶ added in v0.9.0
type Progress struct {
// contains filtered or unexported fields
}
Progress is the staged-spinner driving the review pipeline's long-running operations. It renders a `tree` of stage lines on a single writer (typically stderr), animating the leading `⏺` glyph on the *currently active* stage and freezing prior stages with a terminal-state color (green for Finish, red for Fail, muted for Soft).
Three operating modes, decided at construction:
- **Animated** — TTY writer + colors enabled. Full breathing-dot animation, ANSI cursor escapes to redraw the tree, multi-line output. The natural mode for interactive terminals.
- **Plain** — non-TTY writer (CI, pipe) but not silent. One line per stage transition (`[start]`, `[done]`, `[info]`, `[fail]`). No animation. Useful for CI logs.
- **Silent** — caller opts out (Quiet=true). No output at all.
The mode is fixed for the lifetime of the Progress; callers don't need to branch on TTY state at each call.
Concurrency: Start/Info/Finish/Fail/Soft are safe to call from a single goroutine driving the pipeline. The animation lives in its own goroutine that reads the stage list under a mutex.
func NewProgress ¶ added in v0.9.0
NewProgress returns a Progress configured for the given writer. The Animated mode requires a TTY writer and colors enabled (ColorAuto + no NO_COLOR env, or ColorAlways). On non-TTY or NO_COLOR, falls back to Plain mode. Set Quiet=true to suppress every output mode.
func (*Progress) Clear ¶ added in v0.9.0
func (p *Progress) Clear()
Clear stops the animation and erases the rendered progress tree from the terminal. Use this when downstream output (cards / JSON / markdown body) is about to take over the screen and the per-stage breadcrumbs would be redundant clutter — the rendered output is itself proof the pipeline completed.
In plain mode (non-TTY) Clear is a no-op: those per-stage lines already shipped on each Start/Info/Finish call, are useful in CI logs, and aren't visually redundant the way a fixed-viewport tree is. In silent mode there is nothing to erase. Idempotent.
func (*Progress) Close ¶ added in v0.9.0
func (p *Progress) Close()
Close stops the animation goroutine, ensuring the final frame is rendered (so completed stages stay on screen) and the cursor is restored to a known column. Idempotent.
Use Close when the progress tree is the user's primary feedback (empty-diff `no_changes` path, provider-error path). Use Clear instead when downstream output — rendered cards, JSON, markdown — will take over the screen and the tree would just be clutter.
func (*Progress) Fail ¶ added in v0.9.0
Fail marks the current stage as failed (red ⏺) and emits the error indented below it on the next render.
func (*Progress) Finish ¶ added in v0.9.0
func (p *Progress) Finish()
Finish marks the current stage as completed (green ⏺).
func (*Progress) Info ¶ added in v0.9.0
Info appends a static informational line (no animated glyph, no terminal state). Used for stats lines like "36 files +1233 -34".
func (*Progress) Pause ¶ added in v0.9.0
func (p *Progress) Pause()
Pause stops the animation loop and clears the in-progress render so the terminal is handed back to the caller (e.g. an interactive cost prompt). The recorded stage list is preserved; Resume continues from where it left off.
func (*Progress) Resume ¶ added in v0.9.0
func (p *Progress) Resume()
Resume restarts the animation after Pause. No-op if not paused.