statusline

package
v1.6.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 3, 2026 License: MIT Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package statusline draws the sitrep block of Claude Code's status line: the optional upstream status line (such as Claude HUD) first, then the session's Objective, Progress and Now, and a queue line. Claude Code gives it the session as JSON on standard input.

Index

Constants

View Source
const UpstreamTimeout = 3 * time.Second

UpstreamTimeout bounds the upstream status line: a prompt must not wait for a command that hangs.

Variables

This section is empty.

Functions

func ContextOf added in v0.8.0

func ContextOf(input []byte, now time.Time) (state.Context, bool)

ContextOf reads the context window of a session from the status line's input, and says whether there is one. The percentage is used_percentage when that is above 0: Claude Code sends 0 or null before the first answer though current_usage is real, so otherwise it is the tokens over the size. A window and no usage (a new session, or just after /compact) is empty, 0 used.

Types

type Line

type Line struct {
	Store state.Store
	Conf  conf.Conf
	Run   runner.Runner
	Env   []string // the environment of the upstream command, which gets SITREP_RENDERING=1 added
	// Version is this program's version; a newer release recorded by the daily check is announced after the queue line. Empty means no notice.
	Version string
	// Now is the time recorded with the context window; time.Now when nil.
	Now func() time.Time
	// UpstreamLimit is how long the upstream command may take; UpstreamTimeout when zero.
	UpstreamLimit time.Duration
}

Line draws the status line.

func (Line) Render

func (l Line) Render(ctx context.Context, in io.Reader, out io.Writer)

Render reads the event from in and writes the status line to out. It never fails: whatever goes wrong, what could be drawn is drawn.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL