Documentation
¶
Index ¶
- Variables
- func AddLabel(name, color string) error
- func DeleteLabel(name string) error
- func EstimateDisplayValue(system string, value int) string
- func GetInboxLastRead(remoteURL string) time.Time
- func IsLocalProjectConfig() bool
- func ParseEstimateInput(system string, input string) (int, error)
- func ReadRemoteURL() string
- func RemoveServerCredential(serverURL string) error
- func SaveServerCredential(serverURL, token string) error
- func SaveUserConfig(c UserConfig) error
- func SetInboxLastRead(remoteURL string, t time.Time) error
- func SetRemoteURL(serverURL string) error
- func UpdateLabel(oldName, newName, color string) error
- func ValidateEstimate(system string, value int) error
- type Automations
- type Config
- type Cycle
- type CycleConfig
- func (cfg CycleConfig) CurrentCycle() Cycle
- func (cfg CycleConfig) CycleForDate(date time.Time) Cycle
- func (cfg CycleConfig) CycleForID(id string) (Cycle, error)
- func (cfg CycleConfig) DurationDays() int
- func (cfg CycleConfig) EnumerateCycles(now time.Time, pastCount, futureCount int) []Cycle
- func (cfg CycleConfig) IsPastCycle(cycleID string, now time.Time) bool
- func (cfg CycleConfig) Validate() error
- type DriveAgentConfig
- type DriveConfig
- type PermissionsConfig
- type ProjectState
- type RemoteConfig
- type ServerCredential
- type Style
- type UserConfig
Constants ¶
This section is empty.
Variables ¶
var AllCapabilities = []string{
"issue.read",
"issue.create",
"issue.update",
"issue.comment",
"issue.start",
"issue.merge",
"issue.delete",
"issue.link",
}
AllCapabilities is the canonical list of capabilities.
var BuiltinLabelOrder = []string{"bug", "feature", "epic", "improvement"}
BuiltinLabelOrder defines the canonical display order for built-in labels.
var BuiltinLabels = map[string]string{
"bug": "#eb5757",
"feature": "#b36cd9",
"epic": "#5e6ad2",
"improvement": "#4da6e8",
}
BuiltinLabels are the default labels seeded into new projects. Config labels take precedence over these when both exist.
var EstimationSystems = map[string][]int{
"fibonacci": {1, 2, 3, 5, 8},
"exponential": {1, 2, 4, 8, 16},
"linear": {1, 2, 3, 4, 5},
"shirt": {1, 2, 3, 5, 8},
}
Estimation system allowed values
var ShirtLabels = map[int]string{
1: "XS",
2: "S",
3: "M",
5: "L",
8: "XL",
}
ShirtLabels maps shirt-size estimate values to display labels
var ShirtValues = map[string]int{
"XS": 1,
"S": 2,
"M": 3,
"L": 5,
"XL": 8,
}
ShirtValues maps shirt-size display labels to estimate values
Functions ¶
func AddLabel ¶
AddLabel writes a label and its color to the project config file, preserving existing formatting via yaml.Node manipulation.
func DeleteLabel ¶
DeleteLabel removes a label from the project config file.
func EstimateDisplayValue ¶
EstimateDisplayValue returns the display string for an estimate value. For shirt system, returns the shirt label; for others, returns the number as string.
func GetInboxLastRead ¶
GetInboxLastRead returns the per-user inbox read cursor. In distributed mode (remoteURL set) it is stored under the server host; in local mode it is stored under the absolute .xpo path. A zero time means never read.
func IsLocalProjectConfig ¶
func IsLocalProjectConfig() bool
IsLocalProjectConfig returns true if .xpo/config.yaml looks like a server-side project config (has a prefix field) rather than a minimal remote-only config.
func ParseEstimateInput ¶
ParseEstimateInput parses user input into an int estimate value. For shirt system, accepts both numeric and shirt-size labels (XS, S, M, L, XL).
func ReadRemoteURL ¶
func ReadRemoteURL() string
ReadRemoteURL returns the remote.url from .xpo/config.yaml, if any.
func RemoveServerCredential ¶
RemoveServerCredential removes a stored server credential.
func SaveServerCredential ¶
SaveServerCredential stores a token for a server URL, preserving any existing per-user state (e.g. last_read) for that server.
func SaveUserConfig ¶
func SaveUserConfig(c UserConfig) error
SaveUserConfig writes all per-user state.
func SetInboxLastRead ¶
SetInboxLastRead persists the per-user inbox read cursor, routing to the server host (distributed) or absolute .xpo path (local) as appropriate.
func SetRemoteURL ¶
SetRemoteURL writes the remote.url field into .xpo/config.yaml, creating the file if it doesn't exist. Preserves existing content.
func UpdateLabel ¶
UpdateLabel renames a label and/or changes its color in the project config file.
func ValidateEstimate ¶
ValidateEstimate checks if a value is valid for the given estimation system.
Types ¶
type Automations ¶
type Config ¶
type Config struct {
Name string `mapstructure:"name" yaml:"name"`
Prefix string `mapstructure:"prefix" yaml:"prefix"`
User string `mapstructure:"user" yaml:"user"`
DefaultLabels []string `mapstructure:"default_labels" yaml:"default_labels"`
HideDefaultLabels bool `mapstructure:"hide_default_labels" yaml:"hide_default_labels"`
Editor string `mapstructure:"editor" yaml:"editor"`
AutoCommit bool `mapstructure:"auto_commit" yaml:"auto_commit"`
Style Style `mapstructure:"style" yaml:"style"`
Version int `mapstructure:"version" yaml:"version"`
EstimationSystem string `mapstructure:"estimation_system" yaml:"estimation_system"`
CountUnestimated bool `mapstructure:"count_unestimated" yaml:"count_unestimated"`
Automations Automations `mapstructure:"automations" yaml:"automations"`
Labels map[string]string `mapstructure:"labels" yaml:"labels"`
Cycles CycleConfig `mapstructure:"cycles" yaml:"cycles"`
Contributors []string `mapstructure:"contributors" yaml:"contributors"`
Remote RemoteConfig `mapstructure:"remote" yaml:"remote"`
Permissions PermissionsConfig `mapstructure:"permissions" yaml:"permissions,omitempty"`
Drive DriveConfig `mapstructure:"drive" yaml:"drive,omitempty"`
}
func LoadConfig ¶
LoadConfig reads configuration from file or environment variables.
type Cycle ¶
type CycleConfig ¶
type CycleConfig struct {
Enabled bool `mapstructure:"enabled" yaml:"enabled"`
Duration string `mapstructure:"duration" yaml:"duration"`
StartDay string `mapstructure:"start_day" yaml:"start_day"`
AnchorDate string `mapstructure:"anchor_date" yaml:"anchor_date"`
}
func (CycleConfig) CurrentCycle ¶
func (cfg CycleConfig) CurrentCycle() Cycle
func (CycleConfig) CycleForDate ¶
func (cfg CycleConfig) CycleForDate(date time.Time) Cycle
func (CycleConfig) CycleForID ¶
func (cfg CycleConfig) CycleForID(id string) (Cycle, error)
func (CycleConfig) DurationDays ¶
func (cfg CycleConfig) DurationDays() int
func (CycleConfig) EnumerateCycles ¶
func (cfg CycleConfig) EnumerateCycles(now time.Time, pastCount, futureCount int) []Cycle
func (CycleConfig) IsPastCycle ¶
func (cfg CycleConfig) IsPastCycle(cycleID string, now time.Time) bool
func (CycleConfig) Validate ¶
func (cfg CycleConfig) Validate() error
type DriveAgentConfig ¶ added in v1.0.2
type DriveConfig ¶
type DriveConfig struct {
Supervisor DriveAgentConfig `mapstructure:"supervisor" yaml:"supervisor"`
Coder DriveAgentConfig `mapstructure:"coder" yaml:"coder"`
MaxRetries int `mapstructure:"max_retries" yaml:"max_retries"`
TestCmd string `mapstructure:"test_cmd" yaml:"test_cmd"`
Timeout string `mapstructure:"timeout" yaml:"timeout"`
}
type PermissionsConfig ¶
type PermissionsConfig struct {
Roles map[string][]string `mapstructure:"roles" yaml:"roles,omitempty"`
Users map[string]string `mapstructure:"users" yaml:"users,omitempty"`
}
func (PermissionsConfig) Capabilities ¶
func (p PermissionsConfig) Capabilities(role string) []string
Capabilities returns the capability list for a role name, expanding the wildcard "*" into all known capabilities.
func (PermissionsConfig) Enabled ¶
func (p PermissionsConfig) Enabled() bool
Enabled reports whether a permissions section is configured.
func (PermissionsConfig) HasCapability ¶
func (p PermissionsConfig) HasCapability(email, capability string) bool
HasCapability reports whether the given email is allowed to perform the named capability. Returns true when no permissions are configured (open-access default) or when the user's role includes the capability or the wildcard.
func (PermissionsConfig) RoleFor ¶
func (p PermissionsConfig) RoleFor(email string) string
RoleFor returns the role name for the given email. Returns "" if no permissions are configured or the user has no explicit mapping.
type ProjectState ¶
type ProjectState struct {
LastRead string `yaml:"last_read,omitempty"`
}
ProjectState holds per-user state for a local project, keyed by the absolute path to its .xpo directory. Read state is always per-user and never shared in .xpo/, even in local mode.
type RemoteConfig ¶
type RemoteConfig struct {
URL string `mapstructure:"url" yaml:"url"`
Token string `mapstructure:"token" yaml:"token"`
}
func ResolveRemote ¶
func ResolveRemote(rc RemoteConfig) RemoteConfig
ResolveRemote fills in the token for a RemoteConfig by looking up the server URL in the user's credential store.
type ServerCredential ¶
type ServerCredential struct {
URL string `yaml:"url"`
Token string `yaml:"token"`
LastRead string `yaml:"last_read,omitempty"`
}
ServerCredential holds auth info and per-user state for a single server.
func GetServerCredential ¶
func GetServerCredential(serverURL string) (ServerCredential, bool)
GetServerCredential retrieves the token for a server URL.
type UserConfig ¶
type UserConfig struct {
Servers map[string]ServerCredential `yaml:"servers"`
Projects map[string]ProjectState `yaml:"projects,omitempty"`
}
UserConfig stores all per-user state. Server credentials and the distributed-mode inbox cursor live under Servers (keyed by host); the local-mode inbox cursor lives under Projects (keyed by absolute .xpo path). It is the single file for per-user concerns.
func LoadUserConfig ¶
func LoadUserConfig() UserConfig
LoadUserConfig reads all stored per-user state.