config

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package config handles parsing and validation of .yeet.yaml configuration files.

Index

Constants

View Source
const DefaultFile = ".yeet.yaml"
View Source
const DefaultSchemaURL = "https://raw.githubusercontent.com/monkescience/yeet/main/yeet.schema.json"
View Source
const SchemaDirective = "# yaml-language-server: $schema=" + DefaultSchemaURL

Variables

View Source
var ErrEmptyRepoPath = errors.New("must not be empty")
View Source
var ErrInvalidConfig = errors.New("invalid config")
View Source
var ErrPathMustBeRepoRelative = errors.New("must be repo-relative")

Functions

func RepoPathContains added in v0.4.0

func RepoPathContains(basePath, candidatePath string) bool

RepoPathContains reports whether candidatePath is inside basePath using repo-relative forward-slash semantics. A basePath of "." contains everything.

Types

type AutoMergeMethod added in v0.1.2

type AutoMergeMethod = string
const (
	AutoMergeMethodAuto   AutoMergeMethod = "auto"
	AutoMergeMethodSquash AutoMergeMethod = "squash"
	AutoMergeMethodRebase AutoMergeMethod = "rebase"
	AutoMergeMethodMerge  AutoMergeMethod = "merge"
)

type CalVerConfig

type CalVerConfig struct {
	Format string `yaml:"format"`
}

type ChangelogConfig

type ChangelogConfig struct {
	File     string            `yaml:"file"`
	Include  []string          `yaml:"include"`
	Sections map[string]string `yaml:"sections"`
}

type Config

type Config struct {
	Versioning   VersioningStrategy `yaml:"versioning"`
	Branch       string             `yaml:"branch"`
	Provider     ProviderType       `yaml:"provider"`
	Repository   RepositoryConfig   `yaml:"repository"`
	VersionFiles []string           `yaml:"version_files,omitempty"`
	Release      ReleaseConfig      `yaml:"release"`
	Changelog    ChangelogConfig    `yaml:"changelog"`
	CalVer       CalVerConfig       `yaml:"calver"`
	Targets      map[string]Target  `yaml:"targets"`
}

func Default

func Default() *Config

func Load

func Load(path string) (*Config, error)

func Parse

func Parse(data []byte) (*Config, error)

func (*Config) ResolvedTargets added in v0.4.0

func (c *Config) ResolvedTargets() (map[string]ResolvedTarget, error)

func (*Config) Validate

func (c *Config) Validate() error

type ProviderType

type ProviderType = string
const (
	ProviderAuto   ProviderType = "auto"
	ProviderGitHub ProviderType = "github"
	ProviderGitLab ProviderType = "gitlab"
)

type ReleaseConfig

type ReleaseConfig struct {
	SubjectIncludeBranch bool            `yaml:"subject_include_branch"`
	AutoMerge            bool            `yaml:"auto_merge"`
	AutoMergeForce       bool            `yaml:"auto_merge_force"`
	AutoMergeMethod      AutoMergeMethod `yaml:"auto_merge_method"`
	PRBodyHeader         string          `yaml:"pr_body_header"`
	PRBodyFooter         string          `yaml:"pr_body_footer"`
}

type RepositoryConfig added in v0.1.3

type RepositoryConfig struct {
	Remote  string `yaml:"remote"`
	Host    string `yaml:"host"`
	Owner   string `yaml:"owner"`
	Repo    string `yaml:"repo"`
	Project string `yaml:"project"`
}

type ResolvedTarget added in v0.4.0

type ResolvedTarget struct {
	ID           string
	Type         TargetType
	Path         string
	TagPrefix    string
	Versioning   VersioningStrategy
	VersionFiles []string
	Changelog    ChangelogConfig
	CalVer       CalVerConfig
	ExcludePaths []string
	Includes     []string
}

type Target added in v0.4.0

type Target struct {
	Type         TargetType         `yaml:"type"`
	Path         string             `yaml:"path,omitempty"`
	TagPrefix    string             `yaml:"tag_prefix,omitempty"`
	Versioning   VersioningStrategy `yaml:"versioning,omitempty"`
	VersionFiles []string           `yaml:"version_files,omitempty"`
	Changelog    ChangelogConfig    `yaml:"changelog,omitempty"`
	CalVer       CalVerConfig       `yaml:"calver,omitempty"`
	ExcludePaths []string           `yaml:"exclude_paths,omitempty"`
	Includes     []string           `yaml:"includes,omitempty"`
}

type TargetType added in v0.4.0

type TargetType = string
const (
	TargetTypePath    TargetType = "path"
	TargetTypeDerived TargetType = "derived"
)

type VersioningStrategy

type VersioningStrategy = string
const (
	// VersioningSemver uses semantic versioning (MAJOR.MINOR.PATCH).
	VersioningSemver VersioningStrategy = "semver"
	// VersioningCalVer uses calendar versioning (e.g., YYYY.0M.MICRO).
	VersioningCalVer VersioningStrategy = "calver"
)

Jump to

Keyboard shortcuts

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