config

package
v0.6.7 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const ConfigFileName = ".gh-pm.yml"

Variables

This section is empty.

Functions

func Exists

func Exists() bool

Exists checks if configuration file exists

func FindConfigPath

func FindConfigPath() string

FindConfigPath returns the path to the configuration file

Types

type Config

type Config struct {
	Project      ProjectConfig           `yaml:"project"`
	Repositories []string                `yaml:"repositories"`
	Defaults     DefaultsConfig          `yaml:"defaults"`
	Fields       map[string]Field        `yaml:"fields"`
	Triage       map[string]TriageConfig `yaml:"triage,omitempty"`
	Metadata     *ConfigMetadata         `yaml:"metadata,omitempty"`
}

Config represents the project configuration

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns a default configuration

func Load

func Load() (*Config, error)

Load loads configuration from file

func LoadConfig

func LoadConfig() (*Config, error)

LoadConfig loads configuration from file with enhanced error handling

func (*Config) GetAllFields added in v0.5.0

func (c *Config) GetAllFields() []FieldInfo

GetAllFields returns all cached field information

func (*Config) GetFieldByID added in v0.5.0

func (c *Config) GetFieldByID(id string) *FieldInfo

GetFieldByID returns field information by ID

func (*Config) GetFieldByName added in v0.5.0

func (c *Config) GetFieldByName(name string) *FieldInfo

GetFieldByName returns field information by name

func (*Config) GetFieldMetadata

func (c *Config) GetFieldMetadata(fieldName string) *FieldMetadata

GetFieldMetadata returns metadata for a specific field

func (*Config) GetProjectID

func (c *Config) GetProjectID() string

GetProjectID returns the cached project ID if available

func (*Config) HasCachedFields added in v0.5.0

func (c *Config) HasCachedFields() bool

HasCachedFields returns true if field metadata is cached

func (*Config) LoadMetadata

func (c *Config) LoadMetadata() (*ConfigMetadata, error)

LoadMetadata loads just the metadata section from configuration

func (*Config) Save

func (c *Config) Save(path string) error

Save saves configuration to file

func (*Config) SaveWithMetadata

func (c *Config) SaveWithMetadata(path string) error

SaveWithMetadata saves configuration with metadata to file

func (*Config) SetProjectID

func (c *Config) SetProjectID(id string)

SetProjectID sets the project ID in metadata

func (*Config) Validate

func (c *Config) Validate() error

Validate checks if the configuration is valid

type ConfigMetadata

type ConfigMetadata struct {
	Project ProjectMetadata `yaml:"project"`
	Fields  []FieldInfo     `yaml:"fields,omitempty"` // All project fields
}

ConfigMetadata represents cached project metadata

type DefaultsConfig

type DefaultsConfig struct {
	Priority string   `yaml:"priority"`
	Status   string   `yaml:"status"`
	Labels   []string `yaml:"labels"`
}

DefaultsConfig represents default values

type Field

type Field struct {
	Field  string            `yaml:"field"`
	Values map[string]string `yaml:"values"`
}

Field represents a custom field mapping

type FieldInfo added in v0.5.0

type FieldInfo struct {
	Name     string        `yaml:"name"`
	ID       string        `yaml:"id"`
	DataType string        `yaml:"data_type"`
	Options  []FieldOption `yaml:"options,omitempty"`
}

FieldInfo represents complete field information

type FieldMetadata

type FieldMetadata struct {
	ID      string            `yaml:"id"`      // Field ID
	Options map[string]string `yaml:"options"` // name -> option ID
}

FieldMetadata represents cached field IDs and options

type FieldOption added in v0.5.0

type FieldOption struct {
	Name string `yaml:"name"`
	ID   string `yaml:"id"`
}

FieldOption represents a field option

type ProjectConfig

type ProjectConfig struct {
	Name   string `yaml:"name"`
	Number int    `yaml:"number,omitempty"`
	Org    string `yaml:"org,omitempty"`
	Owner  string `yaml:"owner,omitempty"` // Project owner username (for URL generation)
}

ProjectConfig represents project settings

type ProjectMetadata

type ProjectMetadata struct {
	ID string `yaml:"id"` // Node ID (e.g., "PVT_kwHOAAlRwM4A8arc")
}

ProjectMetadata represents cached project IDs

type TriageApply added in v0.3.0

type TriageApply struct {
	Labels []string          `yaml:"labels,omitempty"`
	Fields map[string]string `yaml:"fields,omitempty"`
}

TriageApply represents what to apply during triage

type TriageConfig added in v0.3.0

type TriageConfig struct {
	Query             string            `yaml:"query"`
	Instruction       string            `yaml:"instruction,omitempty"`
	Apply             TriageApply       `yaml:"apply"`
	Interactive       TriageInteractive `yaml:"interactive,omitempty"`
	InteractiveFields map[string]bool   `yaml:"-"` // Runtime only, not persisted
}

TriageConfig represents a triage configuration

type TriageInteractive added in v0.3.0

type TriageInteractive struct {
	Status   bool `yaml:"status,omitempty"`
	Estimate bool `yaml:"estimate,omitempty"`
}

TriageInteractive represents interactive options for triage

Jump to

Keyboard shortcuts

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