playground

package
v0.267.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: MIT Imports: 40 Imported by: 0

Documentation

Overview

Package playground implements the interactive `ofga` TUI: a full-screen, Crush-style shell for exploring a store — picking models, browsing tuples, running live checks, and visualizing the authorization model as a graph. The model pane offers two views, toggled with `v`: the node-link diagram (types and relations) and the weighted graph (the fully-expanded resolution graph with per-terminal-type weights, in the style of model-visualizer). It is launched by the bare `ofga` command (there is no named subcommand).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, cli *cli.CLI) error

Run launches the playground.

func RunSeeded added in v0.266.0

func RunSeeded(ctx context.Context, cli *cli.CLI, o SeedOptions) error

RunSeeded launches the playground against an injected, already-built client (rather than one resolved from config), with any test results preloaded. When results are present it opens on the Test Results section; otherwise it opens on the default section. It writes config only when the user explicitly presses ctrl+g: that sets a global display preference rather than persisting anything about the ephemeral store/model this run was seeded with.

Types

type Model

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

Model is the task-pilot-style playground model.

func (Model) Init

func (m Model) Init() tea.Cmd

Init kicks off initial loads.

func (Model) Update

func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update is the central dispatcher. It forwards every message to the toast model first (so its expiry timer advances regardless of which branch below handles the message), then dispatches as before.

func (Model) View

func (m Model) View() tea.View

View implements tea.Model in v2, owning terminal background and alt-screen state.

type SeedOptions added in v0.266.0

type SeedOptions struct {
	Client    *openfga.Client
	StoreID   string
	ModelID   string
	Results   []modeltest.TestResult // may be empty (pure explore)
	Endpoint  string                 // for a boot notice
	Workspace *modeltest.Workspace   // parsed workspace behind this seed, for the workbench
}

SeedOptions configures RunSeeded: an SDK client already pointed at an ephemeral endpoint (e.g. `model test --playground`), the seeded store/model ids, optional test results to open on, and the endpoint string for a boot notice.

Jump to

Keyboard shortcuts

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