statusline

package
v0.58.2 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2026 License: Apache-2.0 Imports: 14 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 is the `caprock statusline` command's logic: Claude Code invokes it (statusLine.command in settings.json) on every assistant message, piping a JSON status object on stdin. It prints a compact one-line status to stdout and, best-effort, forwards the rate-limit windows to the local daemon so the Cost screen can show them. It never fails: the status line is printed before any network call, and every error path is silent with exit 0.

It also asks the daemon for the session's own counters — turns, tool calls, what the cache cut off the bill, token totals — which only the daemon knows. That read happens *before* printing, so it is the one place the "never wait on the daemon" rule needs defending rather than merely obeying: the read carries a hard budget and any failure, timeout or missing daemon falls through to exactly the line `--plain` prints. See .ai/03-contracts.md § Statusline.

Index

Constants

View Source
const (

	// DebugEnv, when set, appends diagnostics to <data_dir>/hook-debug.log.
	DebugEnv = "CAPROCK_HOOK_DEBUG"
)

Variables

This section is empty.

Functions

func Run

func Run(stdin io.Reader, stdout io.Writer)

Run executes one statusline invocation. It always returns (callers exit 0).

func RunWith added in v0.53.0

func RunWith(stdin io.Reader, stdout io.Writer, opt Options)

RunWith is Run with explicit options.

Types

type Options added in v0.53.0

type Options struct {
	// Rich asks the daemon for the session counters before printing.
	Rich bool
	// Width is the terminal width to fit the line into; 0 means "detect, and
	// fall back to defaultWidth".
	Width int
}

Options are the knobs the CLI passes in. The zero value is the plain, long-standing behaviour, so an existing registration is unaffected.

Jump to

Keyboard shortcuts

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