print

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: May 28, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FirstLine added in v1.6.0

func FirstLine(s string) string

FirstLine returns the first line of s, trimmed and truncated to 80 chars.

func ParseSSEAttach added in v1.6.0

func ParseSSEAttach(reader io.Reader, w *AttachWriter) (string, error)

ParseSSEAttach reads SSE events and emits structured AttachEvents. Used by plan run --attach to produce structured output.

func ParseSSEStream added in v1.6.0

func ParseSSEStream(reader io.Reader, out io.Writer) (string, error)

ParseSSEStream reads SSE events and writes message content to out. Returns the last cursor and any error.

func RawJSON

func RawJSON(out io.Writer, v any) error

func RawK8SYAML added in v0.5.0

func RawK8SYAML(out io.Writer, v any) error

func RawYAML

func RawYAML(out io.Writer, v any) error

Types

type AttachEvent added in v1.6.0

type AttachEvent struct {
	Time   time.Time `json:"time"`
	Type   string    `json:"type"`             // "log", "output", "result"
	Step   string    `json:"step,omitempty"`   // for log events; for output events, the step that produced a plan-level output
	Stream string    `json:"stream,omitempty"` // "stdout" or "stderr", for log events
	Msg    string    `json:"msg,omitempty"`    // for log events
	Name   string    `json:"name,omitempty"`   // for output events

	// For output events:
	Kind        string `json:"kind,omitempty"`        // "inline" | "artifact"
	Value       any    `json:"value,omitempty"`       // present for inline outputs
	Size        int64  `json:"size,omitempty"`        // bytes, for artifact outputs
	Ready       *bool  `json:"ready,omitempty"`       // for artifact outputs (always set when Kind=artifact)
	ContentType string `json:"contentType,omitempty"` // for artifact outputs, when metadata.contentType is set

	ID     string `json:"id,omitempty"`     // for created/result events: the execution ID
	PlanID string `json:"planID,omitempty"` // for created events: the source plan
	Phase  string `json:"phase,omitempty"`  // for result events
	Error  string `json:"error,omitempty"`  // for result events (if failed); for output events, an artifact-side error
}

AttachEvent represents a structured event emitted during --attach mode.

type AttachWriter added in v1.6.0

type AttachWriter struct {
	// contains filtered or unexported fields
}

AttachWriter writes structured events to an io.Writer in either JSON (one object per line) or slog-style text format.

func NewAttachWriter added in v1.6.0

func NewAttachWriter(out io.Writer, jsonMode bool) *AttachWriter

NewAttachWriter creates an AttachWriter. If jsonMode is true, events are written as JSON lines; otherwise as slog-style text.

func (*AttachWriter) Emit added in v1.6.0

func (w *AttachWriter) Emit(e AttachEvent)

Emit writes an event.

Jump to

Keyboard shortcuts

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