config

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package config handles loading and validating .contextception/config.yaml.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Version     int      `yaml:"version"`
	Entrypoints []string `yaml:"entrypoints,omitempty"`
	Ignore      []string `yaml:"ignore,omitempty"`
	Generated   []string `yaml:"generated,omitempty"`
}

Config represents the user's repository configuration.

func Empty

func Empty() *Config

Empty returns a zero-value config where all predicates return false.

func Load

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

Load reads .contextception/config.yaml from repoRoot. Returns Empty() if the file does not exist. Returns an error if the file exists but is malformed or contains unknown keys.

func (*Config) IsConfigEntrypoint

func (c *Config) IsConfigEntrypoint(path string) bool

IsConfigEntrypoint returns true if path exactly matches a config entrypoint.

func (*Config) IsGenerated

func (c *Config) IsGenerated(path string) bool

IsGenerated returns true if path matches any config generated prefix.

func (*Config) IsIgnored

func (c *Config) IsIgnored(path string) bool

IsIgnored returns true if path matches any config ignore prefix.

func (*Config) Validate

func (c *Config) Validate(repoRoot string) (warnings []string, err error)

Validate checks config for correctness. Returns warnings for non-fatal issues (e.g. non-existent paths) and an error for fatal issues (e.g. wrong version, absolute paths).

type GlobalConfig added in v1.0.3

type GlobalConfig struct {
	Update UpdateConfig `yaml:"update"`
}

GlobalConfig represents the user's global contextception configuration, stored at {configDir}/contextception/config.yaml.

func DefaultGlobal added in v1.0.3

func DefaultGlobal() *GlobalConfig

DefaultGlobal returns a GlobalConfig with all default values applied. Update.Check defaults to true.

func LoadGlobal added in v1.0.3

func LoadGlobal(configDir string) *GlobalConfig

LoadGlobal reads {configDir}/contextception/config.yaml and returns a GlobalConfig. It returns defaults if the file is missing or malformed — global config is tolerant by design since it may evolve over time.

type RepoProfile

type RepoProfile struct {
	Type        string   // monorepo, python-package, go-module, ts-project, mixed, unknown
	Signals     []string // detection signals found
	Entrypoints []string // auto-detected entrypoints
}

RepoProfile represents an auto-detected repository type.

func DetectRepoProfile

func DetectRepoProfile(repoRoot string) RepoProfile

DetectRepoProfile detects the repository type from file structure. Returns a profile with type and suggested entrypoints.

type UpdateConfig added in v1.0.3

type UpdateConfig struct {
	Check bool `yaml:"check"`
}

UpdateConfig holds update-check settings.

Jump to

Keyboard shortcuts

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