Documentation
¶
Index ¶
Constants ¶
const ( SectionRules = "rules" SectionPathRules = "path-rules" SectionVersion = "version" SectionKeybindings = "keybindings" // SectionGeneral is used when the loader cannot map a failure to one // section (unknown top-level key, root syntax error, IO failure). SectionGeneral = "config" )
Well-known .layerx.yaml sections. Used by LoadError and SectionHelp so the CLI can print targeted hints without dumping the full command usage block.
Variables ¶
This section is empty.
Functions ¶
func SectionHelp ¶ added in v1.4.0
SectionHelp returns a short reference excerpt for section. When section is empty or unknown, a general .layerx.yaml hint is returned so every config failure surfaces actionable next steps.
Types ¶
type Config ¶
type Config struct {
// Version is the schema version of this .layerx.yaml. Currently only 1
// is accepted. Unset (zero) is treated as 1. Future schema breakage
// will rev this — readers that see a version they don't understand
// must error rather than guess.
Version int `yaml:"version,omitempty"`
Rules RulesConfig `yaml:"rules"`
// PathRules is populated by the loader's normalize() pass. It is NOT
// directly unmarshalled from YAML — see normalizePathRules() — because
// the YAML can be either a mapping (flat form) or a sequence (list
// form). Tagged "-" so yaml.Strict() doesn't barf on a missing key.
PathRules []PathRuleSpec `yaml:"-"`
// Keybindings is a placeholder for the M12 keybinding-override feature
// documented in CLAUDE.md. Declared here so yaml.Strict() accepts the
// documented top-level key without rejecting the whole config; semantics
// are wired up in M12.
Keybindings map[string]string `yaml:"keybindings,omitempty"`
}
Config holds all user-configurable settings.
type LoadError ¶ added in v1.4.0
LoadError wraps a config parse or validation failure with the file path and the config section the user should fix. cmd/ uses SectionHelp(Section) to print a short excerpt after the one-line error.
type PathRuleSpec ¶ added in v1.3.0
type PathRuleSpec struct {
ID string
Type PathRuleType
Paths []string
Threshold int
}
PathRuleSpec is the canonical, post-normalize representation of one path rule. Both YAML forms (flat map and list-of-rules) collapse to a slice of these — downstream code never needs to know which form the user wrote.
For Block / DenyWaste: Paths is populated, Threshold is 0. For MaxLayerCount: Threshold is populated, Paths is nil.
ID is the rule identifier used for log-grep and future --rule-id filters. In flat form, ID is the rule type name itself ("block", "deny-waste", "max-layer-count"). In list form, ID is user-supplied and must be unique.
type PathRuleType ¶ added in v1.3.0
type PathRuleType string
PathRuleType identifies one of the three supported path-rule kinds. Unknown values are rejected at load time.
const ( PathRuleBlock PathRuleType = "block" PathRuleDenyWaste PathRuleType = "deny-waste" PathRuleMaxLayerCount PathRuleType = "max-layer-count" )
type RulesConfig ¶
type RulesConfig struct {
LowestEfficiency float64 `yaml:"lowest-efficiency"`
HighestWastedBytes int64 `yaml:"highest-wasted-bytes"`
HighestUserWastedPercent float64 `yaml:"highest-user-wasted-percent"`
}
RulesConfig holds CI rule thresholds.