Documentation
¶
Overview ¶
Package demo provides functionality for generating demo environments.
Index ¶
- Constants
- func BuildEnvironment(demoDir, tmuxSocket string) map[string]string
- func DemosDir() string
- func List() []string
- func Register(spec DemoSpec)
- func SaveMetadata(demoDir string, meta *Metadata) error
- type DemoContent
- type DemoSpec
- type EcosystemMeta
- type Generator
- type HomelabSpec
- type Metadata
- type Registry
- type RepoSpec
Constants ¶
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 ¶
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 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 ¶
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.
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 ¶
NewGenerator creates a new demo generator for the specified demo type.
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 ¶
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.