trellis

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2025 License: AGPL-3.0 Imports: 10 Imported by: 2

README

Trellis

"Faça uma coisa e faça bem feita. Trabalhe com fluxos de texto." - Filosofia Unix

Trellis é o "Cérebro Lógico" de um sistema de automação. Projetada como uma Função Pura de Transição de Estado, opera isolada de efeitos colaterais.

Quick Start

Instalação
git clone https://github.com/aretw0/trellis
cd trellis
go mod tidy
Rodando o Golden Path (Demo)
# Execução do Engine (Demo)
go run ./cmd/trellis ./examples/tour

Usage

Running a Flow
# Interactive mode
trellis run ./my-flow

# Headless mode (for automation/pipes)
echo "start\nyes" | trellis run --headless ./my-flow
Introspection

Visualize your flow as a Mermaid graph:

trellis graph ./my-flow
# Outputs: graph TD ...

Documentação

Estrutura

trellis/
├── cmd/           # Entrypoints (trellis)
├── docs/          # Documentação do Projeto
├── examples/      # Demos e Receitas
├── internal/      # Implementação (Loam Adapter, Runtime)
├── pkg/           # Contratos Públicos (Domain, Ports)
└── tests/         # Testes de Integração (Certification Suite)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

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

Engine is the high-level entry point for the Trellis library. It wraps the internal runtime and provides a simplified API for consumers.

func New

func New(repoPath string, opts ...Option) (*Engine, error)

New initializes a new Trellis Engine backed by a Loam repository at the given path. It sets up the necessary adapters and loads the content.

func (*Engine) Inspect

func (e *Engine) Inspect() ([]domain.Node, error)

Inspect returns the full graph definition for visualization or introspection tools.

func (*Engine) Start

func (e *Engine) Start() *domain.State

Start creates the initial state for the flow. It acts as a factory for the first generic State.

func (*Engine) Step

func (e *Engine) Step(ctx context.Context, state *domain.State, input string) ([]domain.ActionRequest, *domain.State, error)

Step executes a single transition step in the flow based on the input.

type Option

type Option func(*Engine)

Option defines a functional option for configuring the Engine.

func WithConditionEvaluator

func WithConditionEvaluator(eval runtime.ConditionEvaluator) Option

WithConditionEvaluator sets a custom logic evaluator for the engine.

type Runner

type Runner struct {
	Input    io.Reader
	Output   io.Writer
	Headless bool
}

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).

func NewRunner

func NewRunner() *Runner

NewRunner creates a new Runner with default Stdin/Stdout. Use SetInput/SetOutput to override for testing.

func (*Runner) Run

func (r *Runner) Run(engine *Engine) error

Run executes the engine loop until termination.

Directories

Path Synopsis
cmd
trellis command
internal
pkg

Jump to

Keyboard shortcuts

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