config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package config loads and defaults a repo's .draftsman.yml.

Index

Constants

View Source
const (
	ModeSingle = "single"
	ModeMulti  = "multi"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Category

type Category struct {
	Type    string `yaml:"type"`
	Scope   string `yaml:"scope"`
	Section string `yaml:"section"`
}

Category maps a Conventional Commit type — optionally narrowed to a specific scope — to a changelog section name. A commit is matched against the configured Categories in order, first match wins; Scope empty matches any scope for that Type. This lets a scope-specific rule (e.g. type "fix", scope "security") take a commit before a broader type-only rule for the same Type, as long as it's listed first. Order in the config also determines section display order.

type Config

type Config struct {
	Mode                 string     `yaml:"mode"`
	Categories           []Category `yaml:"categories"`
	Packages             []Package  `yaml:"packages"`
	SkipChangelogTrailer string     `yaml:"skip-changelog-trailer"`
	// TagFormat locates the previous release tag and, in multi mode
	// (ticket 06+), the {{package}} placeholder scopes it per Package. In
	// single mode {{package}} is accepted but unused.
	TagFormat string `yaml:"tag-format"`
	Template  string `yaml:"template"`
}

Config is the fully-defaulted result of loading .draftsman.yml.

func Default

func Default() *Config

Default returns the built-in configuration used when no field is overridden — this is also what a repo with no .draftsman.yml gets.

func Load

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

Load reads path and applies any fields it sets on top of Default(). A missing file is only an error when required is true — callers should pass required = true exactly when the path was explicitly requested (e.g. an explicit --config flag), so an absent default path silently falls back to defaults while an absent explicit path is a real error.

type Package

type Package struct {
	Path string `yaml:"path"`
	Name string `yaml:"name"`
}

Package maps a path prefix to a monorepo package name. A commit is attributed to every Package whose Path prefixes one of its changed files.

Jump to

Keyboard shortcuts

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