demo

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package demo provides functionality for generating demo environments.

Index

Constants

View Source
const TmuxSocketName = "grove-demo"

TmuxSocketName is the name of the tmux socket used for demo environments. This is used with tmux's -L flag which creates sockets in the tmux temp directory. For multiple demos, this will be parameterized per demo (e.g., "grove-demo-homelab").

Variables

This section is empty.

Functions

func BuildEnvironment

func BuildEnvironment(demoDir, tmuxSocket string) map[string]string

BuildEnvironment returns the environment variables for the demo. Uses GROVE_HOME for full XDG isolation (config, data, state, cache all isolated) and GROVE_BIN to preserve access to the real installed binaries for delegation.

func DemosDir

func DemosDir() string

DemosDir returns the standard root directory for all demos. Typically ~/.local/share/grove/demos

func List

func List() []string

List returns a sorted list of all registered demo names.

func Register

func Register(spec DemoSpec)

Register adds a demo specification to the global registry. This is typically called in init() functions of demo spec implementations.

func SaveMetadata

func SaveMetadata(demoDir string, meta *Metadata) error

SaveMetadata saves the demo metadata to disk.

Types

type DemoContent

type DemoContent struct {
	// Ecosystems contains metadata about each ecosystem created.
	Ecosystems []EcosystemMeta

	// NotebookDirs lists the notebook directories created (optional).
	NotebookDirs []string

	// TmuxNeeded indicates whether this demo requires a tmux session.
	TmuxNeeded bool

	// CustomData allows specs to pass additional data to the generator (optional).
	CustomData map[string]interface{}
}

DemoContent contains the generated content from a demo specification. This is returned by DemoSpec.Generate() and used by the Generator to create the final demo environment.

type DemoSpec

type DemoSpec interface {
	// Name returns the unique identifier for this demo type.
	Name() string

	// Description returns a human-readable description of the demo.
	Description() string

	// Generate creates the demo content in the specified root directory.
	// Returns metadata about the created ecosystems and configuration.
	Generate(rootDir string) (*DemoContent, error)
}

DemoSpec defines the interface for demo specifications. Each demo type (homelab, bake-off, etc.) implements this interface to define how it generates its content.

func Get

func Get(name string) (DemoSpec, error)

Get retrieves a demo specification by name. Returns an error if the demo name is not found.

type EcosystemMeta

type EcosystemMeta struct {
	Name        string `yaml:"name"`
	Path        string `yaml:"path"`
	RepoCount   int    `yaml:"repo_count"`
	Description string `yaml:"description"`
}

EcosystemMeta contains metadata about a single ecosystem.

type Generator

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

Generator creates demo environments.

func NewGenerator

func NewGenerator(rootDir, demoName string) (*Generator, error)

NewGenerator creates a new demo generator for the specified demo type.

func (*Generator) Generate

func (g *Generator) Generate() error

Generate creates the complete demo environment.

type HomelabSpec

type HomelabSpec struct{}

HomelabSpec implements the DemoSpec interface for the homelab demo. This demo creates a full-featured environment with 3 ecosystems (13 repos total), multiple worktrees, realistic git states, notes, and plans.

func (*HomelabSpec) Description

func (h *HomelabSpec) Description() string

Description returns a human-readable description of the demo.

func (*HomelabSpec) Generate

func (h *HomelabSpec) Generate(rootDir string) (*DemoContent, error)

Generate creates the homelab demo content.

func (*HomelabSpec) Name

func (h *HomelabSpec) Name() string

Name returns the unique identifier for this demo type.

type Metadata

type Metadata struct {
	DemoName        string          `yaml:"demo_name"`
	CreatedAt       time.Time       `yaml:"created_at"`
	TmuxSocket      string          `yaml:"tmux_socket"`
	TmuxSessionName string          `yaml:"tmux_session_name,omitempty"`
	Ecosystems      []EcosystemMeta `yaml:"ecosystems"`
	ConfigPath      string          `yaml:"config_path"`
	NotebookDir     string          `yaml:"notebook_dir"`
}

Metadata stores information about a demo environment.

func LoadMetadata

func LoadMetadata(demoDir string) (*Metadata, error)

LoadMetadata loads the demo metadata from disk.

type Registry

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

Registry manages available demo specifications.

type RepoSpec

type RepoSpec struct {
	Name     string // Repository name
	Lang     string // Primary language (go, typescript, python, css, hcl, yaml)
	Depth    string // "hero" for full depth, "skeleton" for minimal
	Worktree string // Worktree branch name (empty for none)
	GitState string // Git state: clean, dirty-staged, dirty-unstaged, untracked
}

RepoSpec defines the specification for creating a repository.

Jump to

Keyboard shortcuts

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