Documentation
¶
Overview ¶
Package report is the build-reporting contract for wake.
It is a leaf package: it has no dependencies on the executor, on lipgloss, or on any producer. Three kinds of code use it:
- The executor (and anything orchestrating a build) drives a Reporter through the build lifecycle.
- A renderer (see report/pulse) implements Reporter to draw the build.
- A producer (e.g. the bindings generator, which runs as a child process) pushes live feedback into the active build UI via Emit — over a small wire protocol when it is a subprocess, or directly when in-process.
Keeping the contract here lets the code generator give live feedback to the build UI instead of printing to its own logger, without depending on wake.
Index ¶
- func Emit(w io.Writer, ev Event)
- func Encode(ev Event) string
- func Route(r Reporter, id StepID, ev Event)
- func SetActive(r Reporter)
- type Artifact
- type DebugField
- type DebugLine
- type Event
- type EventKind
- type Failure
- type Nop
- func (Nop) Artifact(Artifact)
- func (Nop) BuildEnd(time.Duration, bool)
- func (Nop) BuildStart(string, string, int)
- func (Nop) Debug(DebugLine)
- func (Nop) Level() Verbosity
- func (Nop) StepCommand(StepID, string)
- func (Nop) StepEnd(StepID, Status, time.Duration)
- func (Nop) StepFailed(StepID, Failure)
- func (Nop) StepInfo(StepID, string)
- func (Nop) StepOutput(StepID, string)
- func (Nop) StepStart(string, string) StepID
- type Reporter
- type Status
- type StepID
- type Verbosity
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Emit ¶
Emit writes ev to w as a wire line. A subprocess producer (e.g. the bindings generator running under wake) calls this with os.Stdout; the parent build reader recognises the line and routes it to the live UI.
Types ¶
type Artifact ¶
Artifact is one build output the executor wants surfaced in the summary (binary, bundle, archive, etc.). The wake executor builds these from the `generates:` declarations of Taskfile tasks and registers them via Reporter.Artifact when the task succeeds.
Size is the file's size in bytes; renderers format it human-readably. If Size is 0 the renderer may stat Path itself; pass a non-zero value to skip the stat (useful in tests and dry-runs where the artifact may not yet exist on disk by the time the renderer needs it).
Kind is an optional one-word label ("binary", "bundle", "archive", "icon") shown next to the path; empty Kind hides the label.
type DebugField ¶
type DebugField struct{ Key, Val string }
DebugField is one key=value pair on a DebugLine.
type DebugLine ¶
type DebugLine struct {
Category string // "dag", "dep", "var", "exec" — drives the badge colour
Subject string // primary identifier (task or var name)
Arrow string // optional "→ <target>" detail
Fields []DebugField // optional key=value pairs
}
DebugLine is a structured diagnostic for Debug verbosity. Rendering it as category badge + subject + arrow + key/value fields keeps the otherwise undifferentiated debug stream scannable.
type Failure ¶
type Failure struct {
Task string // fully-qualified task name
Command string // the command that failed (already template-expanded)
ExitCode int // process exit code, or -1 if unknown
Output string // captured stdout+stderr of the failing command
Err error // the underlying error
}
Failure carries everything needed to render a clean error for a failed step.
type Nop ¶
type Nop struct{}
Nop is a Reporter that does nothing. It is the zero value used by tests and by any Executor that has no reporter wired in.
func (Nop) StepCommand ¶
func (Nop) StepFailed ¶
func (Nop) StepOutput ¶
type Reporter ¶
type Reporter interface {
// BuildStart begins a build. verb is the command the user ran (e.g. "build",
// may be empty); target is the resolved task name the DAG says has totalSteps
// tasks.
BuildStart(verb, target string, totalSteps int)
// StepStart announces a task is starting and returns the StepID that
// subsequent step-scoped methods must reference.
StepStart(name, label string) StepID
// StepInfo is a sub-line attributed to the given step, typically pushed
// by a producer such as the code generator ("generated 12 bindings").
StepInfo(id StepID, msg string)
// StepCommand reports the command a step is about to run (shown when Verbose).
StepCommand(id StepID, cmd string)
// StepOutput is one line of live subprocess output (shown when Verbose).
StepOutput(id StepID, line string)
// StepEnd closes the step with its outcome and duration.
StepEnd(id StepID, status Status, dur time.Duration)
// StepFailed closes the step with a failure to render.
StepFailed(id StepID, f Failure)
// BuildEnd closes the build.
BuildEnd(dur time.Duration, ok bool)
// Artifact registers a build output (binary, bundle, archive, etc.) for
// display in the end-of-build summary.
Artifact(a Artifact)
// Debug renders one diagnostic line (only shown at Debug verbosity).
Debug(line DebugLine)
// Level reports the reporter's verbosity so callers can skip expensive work.
Level() Verbosity
}
Reporter receives the lifecycle of a build. Implementations render it.
Multiple steps may be in flight simultaneously under parallel execution: each call to StepStart returns a fresh StepID that the caller threads through StepInfo / StepCommand / StepOutput / StepEnd / StepFailed for that specific step. A nil-safe no-op is available as Nop.
type StepID ¶
type StepID uint64
StepID identifies a step. It is returned by Reporter.StepStart and passed back to every step-scoped method (Info/Command/Output/End/Failed), so the renderer can address the correct row even when several steps are in flight concurrently. A zero ID is reserved for "no step" and is a no-op in every method that accepts it.
type Verbosity ¶
type Verbosity int
Verbosity selects how much of a build is shown.
const ( // Silent shows nothing but failures. Silent Verbosity = iota // Normal shows the plan, one line per step, and failures. The default. Normal // Verbose additionally shows each command and streams subprocess output live. Verbose // Debug additionally shows resolver internals (dep wiring, var refs, DAG order). Debug )
Directories
¶
| Path | Synopsis |
|---|---|
|
Package pulse renders a wake build to a terminal as the "Pulse" TUI: a pre-painted skeleton of one row per planned step that updates each row in place as steps progress, plus a pinned progress strip and throughput sparkline beneath.
|
Package pulse renders a wake build to a terminal as the "Pulse" TUI: a pre-painted skeleton of one row per planned step that updates each row in place as steps progress, plus a pinned progress strip and throughput sparkline beneath. |
|
ansi
Package ansi is a tiny pure-stdlib set of ANSI helpers, just enough to render the wake build TUI without pulling in a styling library.
|
Package ansi is a tiny pure-stdlib set of ANSI helpers, just enough to render the wake build TUI without pulling in a styling library. |