Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContentRenderer ¶
ContentRenderer is a function that transforms the content before outputting it. This allows for TUI rendering (markdown to ANSI) without coupling the core package.
type IOHandler ¶
type IOHandler interface {
// Output presents the actions to the user.
// Returns true if the output requires user input (e.g. asking a question),
// or if the handler expects to read input after this.
Output(ctx context.Context, actions []domain.ActionRequest) (bool, error)
// Input reads a response from the user.
Input(ctx context.Context) (string, error)
}
IOHandler defines the strategy for interacting with the user. This allows switching between Text (CLI/TUI) and JSON (Structured) modes.
type JSONHandler ¶
JSONHandler implements the IOHandler interface for structured JSON-Lines communication.
func NewJSONHandler ¶
func NewJSONHandler(r io.Reader, w io.Writer) *JSONHandler
NewJSONHandler creates a handler for JSON IO.
func (*JSONHandler) Output ¶
func (h *JSONHandler) Output(ctx context.Context, actions []domain.ActionRequest) (bool, error)
type Runner ¶
type Runner struct {
// Handler is the strategy for IO. If nil, it falls back to legacy fields.
Handler IOHandler
// Deprecated: Use Handler instead. These are kept for backward compatibility.
Input io.Reader
Output io.Writer
Headless bool
Renderer ContentRenderer
}
Runner handles the execution loop of the Trellis engine using provided IO. This allows for easy testing and integration with different frontends (CLI, TUI, etc). Runner handles the execution loop of the Trellis engine using provided IO. It uses an IOHandler strategy to abstract the interaction mode (Text vs JSON).
type TextHandler ¶
type TextHandler struct {
Reader *bufio.Reader
Writer io.Writer
Renderer ContentRenderer
}
TextHandler implements the standard text-based interface.
func NewTextHandler ¶
func NewTextHandler(r io.Reader, w io.Writer) *TextHandler
NewTextHandler creates a handler for standard text IO.
func (*TextHandler) Output ¶
func (h *TextHandler) Output(ctx context.Context, actions []domain.ActionRequest) (bool, error)