render

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Banner(b *board.Board, t Theme, width int) string

Banner renders the violet AGENTDASH splash plus a one-glance HUD off the board. Callers must show it on a TTY only — never in --json/--plain/pipes. Narrower than the figlet, it falls back to a bold one-line wordmark.

func CleanTask

func CleanTask(s string) string

CleanTask tidies a task for display only (the raw task stays in --json): collapses scraped whitespace into single spaces and shortens an unpaired row's marker to a tight "(no session)".

func ClipANSI

func ClipANSI(s string, w int) string

ClipANSI truncates s to w display cells, copying ANSI escape sequences through verbatim (they cost no width) so colors survive the cut. Replaces ansi.Truncate(s, w, ""): no ellipsis, never exceeds w visible cells.

func ConfigInventory

func ConfigInventory(r config.Result, t Theme, treeView bool) string

ConfigInventory renders the config inventory as a human-readable table.

func ConfigWhy

func ConfigWhy(r config.Result, filePath string, t Theme) string

ConfigWhy explains why a particular file affects the project (scope chain).

func CtxCell

func CtxCell(raw string, t Theme) string

CtxCell renders "40%" as a 10-cell bar+percent: yellow at 70, red at 85.

func DriftFindingDetail

func DriftFindingDetail(f drift.Finding, t Theme) string

DriftFindingDetail renders a single drift finding with evidence.

func DriftFindings

func DriftFindings(findings []drift.Finding, project string, t Theme) string

DriftFindings renders the list of drift findings as a human-readable report.

func EventLogSummary

func EventLogSummary(sum eventlog.Summary, t Theme) string

EventLogSummary renders aggregate stats for the event log.

func EventLogTail

func EventLogTail(events []eventlog.Event, t Theme) string

EventLogTail renders a list of recent events, one per line.

func FishPath

func FishPath(p, home string, w int) string

FishPath abbreviates leading path segments fish-style, keeping the tail: ~/code/checkout-api -> ~/c/checkout-api; over-width paths keep their end.

func FmtMem

func FmtMem(mib float64) string

FmtMem renders container memory in MiB compactly: 28M / 1.1G.

func FmtUp

func FmtUp(s int64) string

FmtUp compacts an uptime: 42m / 16h / 1d6h.

func FriendlyWhat

func FriendlyWhat(what string) string

FriendlyWhat shortens a login's WHAT command to a recognizable name.

func MemoryBoard

func MemoryBoard(rows []memory.BoardRow, t Theme) string

MemoryBoard renders the cross-project memory-health board, most-stale first.

func MemoryLog

func MemoryLog(project string, entries []memory.LogEntry, t Theme) string

MemoryLog renders one project's memory change history, newest last.

func Pad

func Pad(s string, w int) string

Pad right-pads s to w display cells.

func RegisterExternalTurns

func RegisterExternalTurns(f func(kind, key string, n int) ([][2]string, bool))

RegisterExternalTurns installs the recent-turns hook for an external kind.

func Show

func Show(cache *parse.Cache, pid int, t Theme, now float64) (string, error)

Show prints the drill-down panel: task, usage, recent turns, resume.

func StatusCell

func StatusCell(s string, changed bool, t Theme) string

StatusCell colors a status and pads it to 10 chars; changed adds bold.

func Table

func Table(b *board.Board, t Theme, o Opts) string

Table renders the whole frame (header, agent table, sections) exactly like the v1 render(); the TUI and the one-shot path share it.

func Trunc

func Trunc(s string, w int) string

Trunc hard-truncates to w display cells with an ellipsis.

func UpdateCmd

func UpdateCmd() string

UpdateCmd is the reinstall command the staleness nudge prints. It carries the running binary's build tags (updateTags), so a Hermes build advertises -tags=hermes and a reinstall keeps session monitoring. agentdash never runs this itself — it only ever prints it, keeping the binary fully no-network.

func UpdateHint

func UpdateHint(t Theme, rev string, dirty bool, ageSecs int64, staleDays int) string

UpdateHint is the no-network staleness nudge shown under the banner: how old the running binary is and, once it crosses staleDays, the reinstall command. agentdash makes no network calls, so it cannot know whether a newer release exists — build age is an honest local proxy, read from the binary's embedded VCS stamp. Returns "" when the binary carries no build provenance (ageSecs<0) or staleDays<=0 (the nudge is disabled).

func VisibleWidth

func VisibleWidth(s string) int

VisibleWidth is the display width of s in terminal cells, ignoring ANSI escape sequences (SGR colors etc.). Replaces ansi.StringWidth — no charm dependency.

func Why

func Why(cache *parse.Cache, pid int, t Theme, now float64) (string, error)

Why prints the provenance panel: which evidence produced every value.

Types

type Opts

type Opts struct {
	Long       bool
	Expand     bool
	Width      int
	Home       string         // for ~ abbreviation in paths
	SelPID     int            // watch-mode cursor; 0 = none
	PrevStatus map[int]string // watch mode: bold a status that flipped
	Watching   bool
}

Opts steers one frame's rendering.

type Theme

type Theme struct {
	B, D, G, Y, R, V, N string
}

Theme carries the six SGR fragments the board uses; one meaning per color (green working, yellow worth a look, red needs you, dim ignorable). Plain mode and NO_COLOR empty them all.

func NewTheme

func NewTheme(plain bool) Theme

NewTheme honors --plain and NO_COLOR.

Jump to

Keyboard shortcuts

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