presetgen

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package presetgen generates a preset-library index and definition files from the repo's authored presets (presets/sqi/*.yaml) and publishes them into a library checkout. It is the publisher counterpart to internal/presetlib (the server-side client): both share presetlib.IndexEntry so the index format never drifts between what is written and what is read. Not compiled into the server or worker — it is a release-time tool (cmd/presetgen).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Publish

func Publish(presetsDir, outDir, definitionDir string) error

Publish generates the preset index + definition files from presetsDir and writes them into outDir (a checkout of the library repo). The owned definitionDir subtree is wiped and rewritten so removed/renamed presets are cleaned; the merged index preserves any foreign entries. Only outDir/index.json and outDir/<definitionDir>/ are touched.

Types

type Generated

type Generated struct {
	Entry presetlib.IndexEntry
	Path  string
	Data  []byte
}

Generated is one published preset: its index entry, the path it is written to under the library root (e.g. "sqi/blender-batch-render.yaml"), and the raw definition bytes served at that path.

func Build

func Build(presetsDir, definitionDir string) ([]Generated, error)

Build reads every *.yaml in presetsDir, validates it against the product schema (a malformed preset is a hard error), and returns one Generated per preset sorted by name. definitionDir is the path prefix under the library root used for the index's definition field and the published file location. The sha256 is computed over the raw file bytes so the served file always matches the fingerprint the index vouches for.

type Index

type Index struct {
	Presets []presetlib.IndexEntry `json:"presets"`
}

Index is the library index document. It mirrors presetlib's internal index shape ({"presets": [...]}) using the exported IndexEntry.

func Merge

func Merge(existingIndex []byte, generated []Generated, definitionDir string) (Index, error)

Merge combines the generated entries into an existing index, replacing every entry this repo owns (definition under definitionDir/) while preserving all others. existingIndex may be nil/empty. The result is sorted by name.

Jump to

Keyboard shortcuts

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