Documentation
¶
Overview ¶
Package preset loads and installs layered-configuration presets independently of any forge. Callers fetch a local file or HTTPS URL, optionally validate a SHA-256 digest, and install the bytes unchanged as .fullsend/config.base.yaml while leaving .fullsend/config.yaml as the repository-local overlay (ADR 0069).
Index ¶
Constants ¶
const ( // BasePath is the repository-relative path of the vendor/base layer. BasePath = ".fullsend/config.base.yaml" // OverlayPath is the repository-relative path of the repo-local overlay. OverlayPath = ".fullsend/config.yaml" )
Variables ¶
This section is empty.
Functions ¶
func Fetch ¶
Fetch reads a preset configuration from a local file path or an HTTPS URL. Returns the raw content bytes.
func IsRemote ¶
IsRemote reports whether source is a URL rather than a local path, matching the schemes Fetch itself treats as remote (https:// only). A bare scheme check via url.Parse would misclassify strings such as a Windows-style path ("C:\presets\org.yaml", scheme "C") as remote even though Fetch treats them as local paths.
func Load ¶
Load fetches a preset, optionally validates a SHA-256 hex digest, and checks that the content is syntactically valid YAML. hash may be empty to skip digest verification. Layer-specific semantic validation is left to the caller.
func ValidateHash ¶
ValidateHash checks that the SHA-256 hash of data matches the expected hex-encoded hash string. Returns nil on match.
func ValidateYAML ¶
ValidateYAML checks that data is syntactically valid YAML.
Types ¶
type Plan ¶
type Plan struct {
// Base is the exact preset bytes to write to BasePath.
Base []byte
// Overlay is the existing overlay, copied unchanged. Nil if none existed.
Overlay []byte
// BaseChanged is true when Base differs from the previous base
// (including when no previous base existed).
BaseChanged bool
}
Plan is the forge-independent result of installing a preset as the base layer. Overlay is never rewritten by preset installation.
func Apply ¶
Apply returns the layered-config files after installing preset as the base layer. Overlay is preserved byte-for-byte. Base is replaced wholesale with a copy of preset; it is never merged with the overlay or with the previous base. Callers that commit via a forge API write Plan.Base to BasePath when Plan.BaseChanged (or always, for compatibility with github setup --config).