Documentation
¶
Index ¶
- Constants
- func AllFrequencies() []string
- func AllPriorityDisplayValues() []string
- func AllRecurrenceDisplayValues() []string
- func AllValidators() []func(*Task) string
- func AllWeekdays() []string
- func DayOfMonthFromRecurrence(r Recurrence) (int, bool)
- func IsActiveStatus(status Status) bool
- func IsMonthlyRecurrence(r Recurrence) (int, bool)
- func IsValidPoints(points int) bool
- func IsValidPriority(priority int) bool
- func IsValidRecurrence(r Recurrence) bool
- func IsValidTikiIDFormat(id string) bool
- func MonthlyDisplay(day int) string
- func NextOccurrence(r Recurrence) time.Time
- func NextOccurrenceFrom(r Recurrence, ref time.Time) time.Time
- func NormalizePriority(priority string) int
- func OrdinalSuffix(n int) string
- func ParseDueDate(s string) (time.Time, bool)
- func PriorityDisplay(priority int) string
- func PriorityFromDisplay(display string) int
- func PriorityLabel(priority int) string
- func RecurrenceDisplay(r Recurrence) string
- func StatusDisplay(status Status) string
- func StatusEmoji(status Status) string
- func StatusLabel(status Status) string
- func StatusToString(status Status) string
- func TypeDisplay(taskType Type) string
- func TypeEmoji(taskType Type) string
- func TypeLabel(taskType Type) string
- func ValidateDependsOn(t *Task) string
- func ValidateDue(t *Task) string
- func ValidatePoints(t *Task) string
- func ValidatePriority(t *Task) string
- func ValidateRecurrence(t *Task) string
- func ValidateStatus(t *Task) string
- func ValidateTitle(t *Task) string
- func ValidateType(t *Task) string
- func WeekdayFromRecurrence(r Recurrence) (string, bool)
- type Comment
- type DependsOnValue
- type DueValue
- type PriorityValue
- type Recurrence
- type RecurrenceFrequency
- type RecurrenceValue
- type SearchResult
- type Status
- type TagsValue
- type Task
- type Type
Constants ¶
const ( PriorityHigh = 1 PriorityMediumHigh = 2 PriorityMedium = 3 PriorityMediumLow = 4 PriorityLow = 5 )
Priority scale: lower = higher priority 1 = highest, 5 = lowest
const ( StatusBacklog = workflow.StatusBacklog StatusReady = workflow.StatusReady StatusInProgress = workflow.StatusInProgress StatusReview = workflow.StatusReview StatusDone = workflow.StatusDone )
convenience constants matching the default workflow.yaml statuses.
const ( TypeStory = workflow.TypeStory TypeBug = workflow.TypeBug TypeSpike = workflow.TypeSpike TypeEpic = workflow.TypeEpic )
well-known built-in type constants.
const ( MinPriority = 1 MaxPriority = 5 DefaultPriority = 3 // Medium )
Priority validation constants
const DateFormat = "2006-01-02"
Variables ¶
This section is empty.
Functions ¶
func AllFrequencies ¶ added in v0.3.1
func AllFrequencies() []string
AllFrequencies returns the ordered list of frequencies for the UI.
func AllPriorityDisplayValues ¶ added in v0.3.1
func AllPriorityDisplayValues() []string
AllPriorityDisplayValues returns priority display labels ordered high→low (1→5).
func AllRecurrenceDisplayValues ¶ added in v0.3.1
func AllRecurrenceDisplayValues() []string
AllRecurrenceDisplayValues returns the ordered list of display values for UI selection.
func AllValidators ¶ added in v0.4.0
AllValidators returns the complete list of field validation functions. Each returns an error message (empty string = valid).
func AllWeekdays ¶ added in v0.3.1
func AllWeekdays() []string
AllWeekdays returns weekday names in order for the UI.
func DayOfMonthFromRecurrence ¶ added in v0.3.1
func DayOfMonthFromRecurrence(r Recurrence) (int, bool)
DayOfMonthFromRecurrence extracts the day (1-31) from a monthly cron expression.
func IsActiveStatus ¶ added in v0.1.5
IsActiveStatus reports whether the status has the active flag set.
func IsMonthlyRecurrence ¶ added in v0.3.1
func IsMonthlyRecurrence(r Recurrence) (int, bool)
IsMonthlyRecurrence checks if a recurrence is a monthly pattern. Returns the day of month and true if it matches "0 0 N * *".
func IsValidPoints ¶ added in v0.0.4
IsValidPoints checks if a points value is within the valid range.
func IsValidPriority ¶ added in v0.0.4
IsValidPriority checks if a priority value is within the valid range.
func IsValidRecurrence ¶ added in v0.3.1
func IsValidRecurrence(r Recurrence) bool
IsValidRecurrence returns true if the recurrence is empty or matches a known or monthly pattern.
func IsValidTikiIDFormat ¶ added in v0.4.0
IsValidTikiIDFormat checks if a string matches the TIKI-XXXXXX format where X is an uppercase alphanumeric character.
func MonthlyDisplay ¶ added in v0.3.1
MonthlyDisplay returns a human-readable string like "Monthly on the 15th".
func NextOccurrence ¶ added in v0.3.1
func NextOccurrence(r Recurrence) time.Time
NextOccurrence computes the next occurrence date from today for a given recurrence. Returns zero time for RecurrenceNone.
func NextOccurrenceFrom ¶ added in v0.3.1
func NextOccurrenceFrom(r Recurrence, ref time.Time) time.Time
NextOccurrenceFrom computes the next occurrence date relative to ref. Only the date part of ref is used; result is always midnight UTC. Only daily, weekly, and monthly recurrences are supported. Unrecognized patterns return zero time, same as RecurrenceNone.
func NormalizePriority ¶
NormalizePriority standardizes a raw priority string or number into an integer. Returns the normalized priority value (clamped to 1-5) or -1 if invalid.
func OrdinalSuffix ¶ added in v0.3.1
OrdinalSuffix returns the ordinal suffix for a number (st, nd, rd, th).
func ParseDueDate ¶ added in v0.3.1
ParseDueDate parses a date string in YYYY-MM-DD format. Returns (time.Time, true) on success, (zero time, false) on failure. Empty string is treated as valid and returns zero time with true.
func PriorityDisplay ¶ added in v0.3.1
PriorityDisplay returns the human-readable label for a priority integer. e.g., 1 → "High", 3 → "Medium", 5 → "Low"
func PriorityFromDisplay ¶ added in v0.3.1
PriorityFromDisplay converts a display label back to a priority integer. e.g., "High" → 1, "Medium Low" → 4. Returns PriorityMedium if not found.
func PriorityLabel ¶
PriorityLabel returns an emoji-based label for a priority value.
func RecurrenceDisplay ¶ added in v0.3.1
func RecurrenceDisplay(r Recurrence) string
RecurrenceDisplay converts a cron expression to English display.
func StatusDisplay ¶
StatusDisplay returns "Label Emoji" for a status.
func StatusEmoji ¶
StatusEmoji returns the emoji for a status from the registry.
func StatusLabel ¶
StatusLabel returns the display label for a status from the registry.
func StatusToString ¶
StatusToString converts a Status to its string representation.
func TypeDisplay ¶
TypeDisplay returns a formatted display string with label and emoji.
func ValidateDependsOn ¶ added in v0.4.0
ValidateDependsOn returns an error message if any dependency ID is malformed.
func ValidateDue ¶ added in v0.4.0
ValidateDue returns an error message if the due date is not normalized to midnight UTC.
func ValidatePoints ¶ added in v0.4.0
ValidatePoints returns an error message if story points are out of range.
func ValidatePriority ¶ added in v0.4.0
ValidatePriority returns an error message if the task priority is out of range.
func ValidateRecurrence ¶ added in v0.4.0
ValidateRecurrence returns an error message if the recurrence pattern is invalid.
func ValidateStatus ¶ added in v0.4.0
ValidateStatus returns an error message if the task status is invalid.
func ValidateTitle ¶ added in v0.4.0
ValidateTitle returns an error message if the task title is invalid.
func ValidateType ¶ added in v0.4.0
ValidateType returns an error message if the task type is invalid.
func WeekdayFromRecurrence ¶ added in v0.3.1
func WeekdayFromRecurrence(r Recurrence) (string, bool)
WeekdayFromRecurrence extracts the weekday name from a weekly cron expression.
Types ¶
type DependsOnValue ¶ added in v0.3.0
type DependsOnValue []string
DependsOnValue is a custom type for dependsOn that provides lenient YAML unmarshaling. It gracefully handles invalid YAML by defaulting to an empty slice instead of failing. Values are uppercased to ensure consistent TIKI-XXXXXX format.
func (DependsOnValue) MarshalYAML ¶ added in v0.3.0
func (d DependsOnValue) MarshalYAML() (any, error)
MarshalYAML implements YAML marshaling for DependsOnValue. Returns the underlying slice as-is for standard YAML serialization.
func (DependsOnValue) ToStringSlice ¶ added in v0.3.0
func (d DependsOnValue) ToStringSlice() []string
ToStringSlice converts DependsOnValue to []string for use with Task entity.
func (*DependsOnValue) UnmarshalYAML ¶ added in v0.3.0
func (d *DependsOnValue) UnmarshalYAML(value *yaml.Node) error
UnmarshalYAML implements custom unmarshaling for dependsOn with lenient error handling. Valid YAML list formats are parsed normally. Invalid formats (scalars, objects, etc.) default to empty slice with a warning log instead of returning an error.
type DueValue ¶ added in v0.3.1
DueValue is a custom type for due dates that provides lenient YAML unmarshaling. It gracefully handles invalid YAML by defaulting to zero time instead of failing. Embeds time.Time to inherit IsZero() method (required for yaml:",omitempty").
func (DueValue) MarshalYAML ¶ added in v0.3.1
MarshalYAML implements YAML marshaling for DueValue. Returns empty string for zero time, otherwise formats as YYYY-MM-DD.
func (DueValue) ToTime ¶ added in v0.3.1
ToTime converts DueValue to time.Time for use with Task entity.
func (*DueValue) UnmarshalYAML ¶ added in v0.3.1
UnmarshalYAML implements custom unmarshaling for due dates with lenient error handling. Valid date strings in YYYY-MM-DD format are parsed normally. Invalid formats or types default to zero time with a warning log instead of returning an error.
type PriorityValue ¶
type PriorityValue int
PriorityValue unmarshals priority from int or string (e.g., "high", "medium-high"). high=1, low=5. Values outside 1-5 range are clamped to boundaries.
func (PriorityValue) MarshalYAML ¶
func (p PriorityValue) MarshalYAML() (interface{}, error)
func (*PriorityValue) UnmarshalYAML ¶
func (p *PriorityValue) UnmarshalYAML(value *yaml.Node) error
type Recurrence ¶ added in v0.3.1
type Recurrence string
Recurrence represents a task recurrence pattern as a cron expression. Empty string means no recurrence.
const ( RecurrenceNone Recurrence = "" RecurrenceDaily Recurrence = "0 0 * * *" RecurrenceMonthly Recurrence = "0 0 1 * *" )
func MonthlyRecurrence ¶ added in v0.3.1
func MonthlyRecurrence(day int) Recurrence
MonthlyRecurrence creates a monthly cron expression for the given day (1-31).
func ParseRecurrence ¶ added in v0.3.1
func ParseRecurrence(s string) (Recurrence, bool)
ParseRecurrence validates a cron string against known patterns or monthly pattern.
func RecurrenceFromDisplay ¶ added in v0.3.1
func RecurrenceFromDisplay(display string) Recurrence
RecurrenceFromDisplay converts an English display string to a cron expression.
func WeeklyRecurrence ¶ added in v0.3.1
func WeeklyRecurrence(dayName string) Recurrence
WeeklyRecurrence creates a weekly cron expression for the given day name.
type RecurrenceFrequency ¶ added in v0.3.1
type RecurrenceFrequency string
RecurrenceFrequency represents a high-level recurrence category for the UI editor.
const ( FrequencyNone RecurrenceFrequency = "None" FrequencyDaily RecurrenceFrequency = "Daily" FrequencyWeekly RecurrenceFrequency = "Weekly" FrequencyMonthly RecurrenceFrequency = "Monthly" )
func FrequencyFromRecurrence ¶ added in v0.3.1
func FrequencyFromRecurrence(r Recurrence) RecurrenceFrequency
FrequencyFromRecurrence extracts the high-level frequency from a cron expression.
type RecurrenceValue ¶ added in v0.3.1
type RecurrenceValue struct {
Value Recurrence
}
RecurrenceValue is a custom type for recurrence that provides lenient YAML unmarshaling.
func (RecurrenceValue) IsZero ¶ added in v0.3.1
func (r RecurrenceValue) IsZero() bool
IsZero reports whether the recurrence is empty (needed for omitempty).
func (RecurrenceValue) MarshalYAML ¶ added in v0.3.1
func (r RecurrenceValue) MarshalYAML() (any, error)
MarshalYAML implements YAML marshaling for RecurrenceValue.
func (RecurrenceValue) ToRecurrence ¶ added in v0.3.1
func (r RecurrenceValue) ToRecurrence() Recurrence
ToRecurrence converts RecurrenceValue to Recurrence.
func (*RecurrenceValue) UnmarshalYAML ¶ added in v0.3.1
func (r *RecurrenceValue) UnmarshalYAML(value *yaml.Node) error
UnmarshalYAML implements custom unmarshaling for recurrence with lenient error handling.
type SearchResult ¶
SearchResult represents a task match with relevance score
type Status ¶
Status is a type alias for workflow.StatusKey. This preserves compatibility: task.Status and workflow.StatusKey are the same type.
func AllStatuses ¶ added in v0.1.5
func AllStatuses() []Status
AllStatuses returns the ordered list of all configured statuses.
func DefaultStatus ¶ added in v0.1.5
func DefaultStatus() Status
DefaultStatus returns the status configured as default in workflow.yaml.
func DoneStatus ¶ added in v0.1.5
func DoneStatus() Status
DoneStatus returns the status configured as done in workflow.yaml.
func NormalizeStatus ¶
NormalizeStatus standardizes a raw status string into a Status.
func ParseStatus ¶ added in v0.0.4
ParseStatus normalizes a raw status string and validates it against the registry. Empty input returns the configured default status. Unknown values return (DefaultStatus(), false).
type TagsValue ¶
type TagsValue []string
TagsValue is a custom type for tags that provides lenient YAML unmarshaling. It gracefully handles invalid YAML by defaulting to an empty slice instead of failing.
func (TagsValue) MarshalYAML ¶
MarshalYAML implements YAML marshaling for TagsValue. Returns the underlying slice as-is for standard YAML serialization.
func (TagsValue) ToStringSlice ¶
ToStringSlice converts TagsValue to []string for use with Task entity.
func (*TagsValue) UnmarshalYAML ¶
UnmarshalYAML implements custom unmarshaling for tags with lenient error handling. Valid YAML list formats are parsed normally. Invalid formats (scalars, objects, etc.) default to empty slice with a warning log instead of returning an error.
type Task ¶
type Task struct {
ID string
Title string
Description string
Type Type
Status Status
Tags []string
DependsOn []string
Due time.Time
Recurrence Recurrence
Assignee string
Priority int // lower = higher priority
Points int
Comments []Comment
CreatedBy string // User who initially created the task
CreatedAt time.Time
UpdatedAt time.Time
LoadedMtime time.Time // File mtime when loaded (for optimistic locking)
}
Task represents a work item (user story, bug, etc.)
func FindBlockedTasks ¶ added in v0.3.1
FindBlockedTasks returns all tasks whose DependsOn list contains the given task ID. These are the downstream tasks that are waiting on taskID to be completed.
type Type ¶
Type is a type alias for workflow.TaskType. This preserves compatibility: task.Type and workflow.TaskType are the same type.
func AllTypes ¶ added in v0.4.0
func AllTypes() []Type
AllTypes returns the ordered list of all configured type keys.
func NormalizeType ¶
NormalizeType standardizes a raw type string into a Type.
func ParseDisplay ¶ added in v0.4.0
ParseDisplay reverses a TypeDisplay() string back to a canonical key. Returns (key, true) on match, or (fallback, false) for unrecognized display strings.