ui

package
v0.1.0-dev.20260902012330 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package ui exposes the runtime environment's [status.Narrator] capability to starlark.

The provider is a thin passthrough — it carries no state of its own. Method bodies forward to `p.RuntimeEnvironment().Status.<Method>(msg)`. Configuration (writer, program name, color, silent) lives on the [status.Narrator] instance the client installed at bootstrap; the same instance flows from the cli facade into the runtime environment, ensuring `--silent`, color settings, and program-name prefixing apply uniformly across cli emissions, provider emissions, and starlark `print()` output.

Index

Constants

View Source
const (
	Error   op.ActionName = "ui.error"
	Fail    op.ActionName = "ui.fail"
	Note    op.ActionName = "ui.note"
	Print   op.ActionName = "ui.print"
	Succeed op.ActionName = "ui.succeed"
	Warn    op.ActionName = "ui.warn"
)

Action-name constants for the ui provider's plan-mode actions.

Each constant is the short dotted action label its method dispatches under. Pass these to plan.Plan, op.ReceiverRegistry().BuildAction, RuntimeEnvironment.ActionByName, or WithActionNamed in place of a string literal so a typo is a compile error and rename / find-references work through the constant.

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

type Provider struct {
	op.ProviderBase
}

Provider exposes the [status.Narrator] capability to starlark.

Root-placed: the six methods surface as top-level globals -- note(), warn(), print() -- rather than under ui.*. Two of those names, print and fail, belong to starlark's universe, and the resolver checks predeclared before universal, so this REPLACES the builtins rather than shadowing them. That is the point: the builtin print writes straight to stderr through starlark-go, escaping --silent, color, and program-name prefixing, and would escape the diagnostics stream of docs/architecture/2.8-eventing-infrastructure.md. Routing it here is what makes the uniformity this package claims actually hold for a bare print(...).

The methods take one string rather than the builtin's variadic-with-separator. That is deliberate and documented in docs/architecture/3.5.16-ui-provider.md: starlark's % is an operator that runs BEFORE the call, so a format-string signature would re-scan an already-rendered string and corrupt any data containing a %, while a variadic one would receive Go natives after conversion and render True as true and None as <nil>. The script renders with str() and %, which is starlark's own rendering, and hands over a finished string.

+devlore:placement=promoted

func NewProvider

func NewProvider(runtimeEnvironment *op.RuntimeEnvironment) *Provider

NewProvider constructs a *Provider for the registered ProviderConstructor.

The provider holds no state of its own; configuration lives on the [status.Narrator] instance the runtime environment carries. Method bodies retrieve the narrator via p.RuntimeEnvironment().Status.

func (*Provider) Error

func (p *Provider) Error(msg string)

Error reports a non-fatal problem to the user.

Parameters:

  • `msg`: the error message to display.

+devlore:claim=deterministic

func (*Provider) Fail

func (p *Provider) Fail(msg string) error

Fail reports a fatal error and aborts execution.

Parameters:

  • `msg`: the fatal error message.

Returns:

  • `error`: a non-nil error wrapping msg.

+devlore:claim=deterministic

func (*Provider) Note

func (p *Provider) Note(msg string)

Note informs the user of progress.

Parameters:

  • `msg`: the informational message to display.

+devlore:claim=deterministic

func (*Provider) Print

func (p *Provider) Print(msg string)

Print emits raw text without categorized-message decoration.

Used by starlark `print()` output; reads as the script wrote it (no [program] [symbol] prefix).

Parameters:

  • `msg`: the raw text to emit.

+devlore:claim=deterministic

func (*Provider) Succeed

func (p *Provider) Succeed(msg string)

Succeed confirms completion to the user.

Parameters:

  • `msg`: the success message to display.

+devlore:claim=deterministic

func (*Provider) Warn

func (p *Provider) Warn(msg string)

Warn alerts the user to a potential issue.

Parameters:

  • `msg`: the warning message to display.

+devlore:claim=deterministic

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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