playground

package
v0.270.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: MIT Imports: 45 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 bare `ofga` (against the real profile) and by `ofga playground` (against the embedded sandbox server).

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 RunSandbox added in v0.270.0

func RunSandbox(ctx context.Context, cli *cli.CLI, o SandboxOptions) error

RunSandbox launches the playground against the embedded sandbox server, presented under the synthetic `playground` profile. Nothing about it is ever written to config.toml.

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 SandboxOptions added in v0.270.0

type SandboxOptions struct {
	Endpoint   string
	Workspaces map[string]*modeltest.Workspace
}

SandboxOptions configures RunSandbox: the embedded sandbox server's endpoint and the sample workspaces keyed by store name.

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