scaffold

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package scaffold distributes typed plugin scaffold renderers. Renderers use ordinary Go functions and produce files through the same ownership/protection rules as plugin assets. They never execute automatically during boot.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Declarations

func Declarations(resolver foundation.Resolver) ([]manifest.Distribution, error)

Declarations lists scaffold metadata without invoking renderers or boot hooks.

func Register

func Register[T any](r *foundation.Registrar, scaffold *Scaffold[T]) error

Register retains both the concrete renderer and value-free metadata. Its declared input type remains part of duplicate/override validation.

Types

type ID

type ID string

ID identifies a scaffold within a plugin.

type Report

type Report = assets.Report

Report is the asset distribution publication report.

type Scaffold

type Scaffold[T any] struct {
	// contains filtered or unexported fields
}

Scaffold preserves concrete input T. The synchronous renderer must cooperate with context and finish before returning; panic and Goexit become errors. Foundry never abandons a running callback or writes a partial rendered set.

func New

func New[T any](declaration manifest.Manifest, id ID, render func(context.Context, T) ([]assets.File, error)) (*Scaffold[T], error)

New validates the distribution identity and creates a typed scaffold with a nonnil renderer.

func Resolve

func Resolve[T any](resolver foundation.Resolver, owner manifest.ID, id ID) (*Scaffold[T], error)

Resolve resolves a typed scaffold by plugin owner and scaffold identifier.

func (*Scaffold[T]) Info

func (s *Scaffold[T]) Info() manifest.Distribution

Info returns distribution metadata, or zero metadata for a nil scaffold.

func (*Scaffold[T]) Publish

func (s *Scaffold[T]) Publish(ctx context.Context, dir string, input T, check bool) (Report, error)

Publish renders scaffold files and publishes or checks their generated distribution in the target directory.

func (*Scaffold[T]) Render

func (s *Scaffold[T]) Render(ctx context.Context, input T) (map[string][]byte, error)

Render returns validated caller-owned bytes without touching the filesystem.

Jump to

Keyboard shortcuts

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