config

package
v0.40.0 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultConfig

func DefaultConfig() string

Types

type CommitMessageRule

type CommitMessageRule struct {
	Regex string `yaml:"regex" json:"regex"`
	Error string `yaml:"error" json:"error"`
}

type Config

type Config struct {
	Tools       map[string]Tool   `yaml:"tools" json:"tools"`
	Hooks       map[string][]Hook `yaml:"hooks" json:"hooks"`
	Policies    *Policies         `yaml:"policies" json:"policies"`
	ExcludeTags []string          `yaml:"exclude_tags" json:"exclude_tags"`
	Parallel    bool              `yaml:"parallel" json:"parallel"`
	ScriptsDir  string            `yaml:"scripts_dir" json:"scripts_dir"`
}

func Load

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

func (*Config) GetHooks

func (c *Config) GetHooks(hookType string) []Hook

func (*Config) GetPolicyURLs

func (c *Config) GetPolicyURLs() []string

func (*Config) GetTool

func (c *Config) GetTool(name string) *Tool

func (*Config) HasRemotePolicies

func (c *Config) HasRemotePolicies() bool

type ForbiddenContentPattern

type ForbiddenContentPattern struct {
	Pattern     string `yaml:"pattern" json:"pattern"`
	Description string `yaml:"description" json:"description"`
}

type Hook

type Hook struct {
	Name        string            `yaml:"name" json:"name"`
	Tool        string            `yaml:"tool" json:"tool"`
	Run         string            `yaml:"run" json:"run"`
	Script      string            `yaml:"script" json:"script"`
	Runner      string            `yaml:"runner" json:"runner"`
	Args        []string          `yaml:"args" json:"args"`
	FixArgs     []string          `yaml:"fix_args" json:"fix_args"`
	Files       string            `yaml:"files" json:"files"`
	Glob        string            `yaml:"glob" json:"glob"`
	Exclude     string            `yaml:"exclude" json:"exclude"`
	Root        string            `yaml:"root" json:"root"`
	Timeout     string            `yaml:"timeout" json:"timeout"`
	After       string            `yaml:"after" json:"after"`
	Skip        string            `yaml:"skip" json:"skip"`
	Only        string            `yaml:"only" json:"only"`
	Tags        []string          `yaml:"tags" json:"tags"`
	Env         map[string]string `yaml:"env" json:"env"`
	PassEnv     []string          `yaml:"pass_env" json:"pass_env"`
	FailFast    bool              `yaml:"fail_fast" json:"fail_fast"`
	Interactive bool              `yaml:"interactive" json:"interactive"`
	StageFixed  bool              `yaml:"stage_fixed" json:"stage_fixed"`
	Piped       bool              `yaml:"piped" json:"piped"`
}

type LocalPolicy

type LocalPolicy struct {
	Name        string            `yaml:"name" json:"name"`
	Version     string            `yaml:"version" json:"version"`
	Description string            `yaml:"description" json:"description"`
	Rules       PolicyRules       `yaml:"rules" json:"rules"`
	Metadata    map[string]string `yaml:"metadata" json:"metadata"`
}

type Policies

type Policies struct {
	Type          string        `yaml:"type" json:"type"`
	Policies      []PolicyRef   `yaml:"policies" json:"policies"`
	LocalPolicies []LocalPolicy `yaml:"localPolicies" json:"localPolicies"`
	LuaScripts    []string      `yaml:"lua_scripts" json:"lua_scripts"`
}

type PolicyRef

type PolicyRef struct {
	URL string `yaml:"url" json:"url"`
}

type PolicyRules

type PolicyRules struct {
	ForbidFiles          []string                  `yaml:"forbid_files" json:"forbid_files"`
	ForbidDirectories    []string                  `yaml:"forbid_directories" json:"forbid_directories"`
	ForbidFileExtensions []string                  `yaml:"forbid_file_extensions" json:"forbid_file_extensions"`
	RequiredFiles        []string                  `yaml:"required_files" json:"required_files"`
	MaxFileSizeKB        int                       `yaml:"max_file_size_kb" json:"max_file_size_kb"`
	MaxFilesChanged      int                       `yaml:"max_files_changed" json:"max_files_changed"`
	ForbidFileContent    []ForbiddenContentPattern `yaml:"forbid_file_content" json:"forbid_file_content"`
	CommitMessage        *CommitMessageRule        `yaml:"commit_message" json:"commit_message"`
	EnforceHooks         []string                  `yaml:"enforce_hooks" json:"enforce_hooks"`
	HookTimeBudgetMs     map[string]int            `yaml:"hook_time_budget_ms" json:"hook_time_budget_ms"`
	MaxParallelHooks     int                       `yaml:"max_parallel_hooks" json:"max_parallel_hooks"`
}

type Tool

type Tool struct {
	Version  string            `yaml:"version" json:"version"`
	Install  map[string]string `yaml:"install" json:"install"`
	Checksum string            `yaml:"checksum" json:"checksum"`
}

Jump to

Keyboard shortcuts

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