model

package
v0.0.0-...-5f22abe Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package model defines the core data types for taskmd tasks.

It provides the Task struct along with typed enums for Status, Priority, Effort, and TaskType. All types support YAML marshaling via gopkg.in/yaml.v3.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateVerifySteps

func ValidateVerifySteps(steps []VerifyStep) []string

ValidateVerifySteps checks that each step has a type and the required fields for that type. Returns a list of human-readable validation errors.

Types

type Effort

type Effort string

Effort represents the estimated effort required

const (
	EffortSmall  Effort = "small"
	EffortMedium Effort = "medium"
	EffortLarge  Effort = "large"
)

type FlexibleTime

type FlexibleTime struct {
	time.Time
}

FlexibleTime wraps time.Time with a custom YAML unmarshaler that handles both quoted strings ("2025-01-15") and native YAML dates (2025-01-15).

func NewFlexibleTime

func NewFlexibleTime(t time.Time) FlexibleTime

NewFlexibleTime wraps a time.Time into a FlexibleTime.

func (FlexibleTime) MarshalYAML

func (ft FlexibleTime) MarshalYAML() (any, error)

func (*FlexibleTime) UnmarshalYAML

func (ft *FlexibleTime) UnmarshalYAML(value *yaml.Node) error

type Priority

type Priority string

Priority represents the importance level of a task

const (
	PriorityLow      Priority = "low"
	PriorityMedium   Priority = "medium"
	PriorityHigh     Priority = "high"
	PriorityCritical Priority = "critical"
)

type Status

type Status string

Status represents the current state of a task

const (
	StatusPending    Status = "pending"
	StatusInProgress Status = "in-progress"
	StatusCompleted  Status = "completed"
	StatusInReview   Status = "in-review"
	StatusBlocked    Status = "blocked"
	StatusCancelled  Status = "cancelled"
)

func (Status) IsResolved

func (s Status) IsResolved() bool

IsResolved returns true if the status represents a terminal state where the task is no longer active (completed or cancelled).

type Task

type Task struct {
	// Frontmatter fields
	ID           string       `yaml:"id" json:"id"`
	Title        string       `yaml:"title" json:"title"`
	Status       Status       `yaml:"status" json:"status"`
	Priority     Priority     `yaml:"priority" json:"priority,omitempty"`
	Effort       Effort       `yaml:"effort" json:"effort,omitempty"`
	Type         TaskType     `yaml:"type" json:"type,omitempty"`
	Dependencies []string     `yaml:"dependencies" json:"dependencies"`
	Tags         []string     `yaml:"tags" json:"tags"`
	Touches      []string     `yaml:"touches" json:"touches,omitempty"`
	Context      []string     `yaml:"context" json:"context,omitempty"`
	Group        string       `yaml:"group" json:"group,omitempty"`
	Owner        string       `yaml:"owner" json:"owner,omitempty"`
	Parent       string       `yaml:"parent,omitempty" json:"parent,omitempty"`
	Created      FlexibleTime `yaml:"created" json:"created"`
	Verify       []VerifyStep `yaml:"verify,omitempty" json:"verify,omitempty"`
	ExternalID   string       `yaml:"external_id,omitempty" json:"external_id,omitempty"`
	PRs          []string     `yaml:"pr,omitempty" json:"pr,omitempty"`

	// Content fields
	Body     string `json:"-"`
	FilePath string `json:"file_path"`

	// Worklog metadata (populated on demand, not from frontmatter)
	WorklogEntries int        `json:"worklog_entries,omitempty" yaml:"-"`
	WorklogUpdated *time.Time `json:"worklog_updated,omitempty" yaml:"-"`
}

Task represents a parsed task from a markdown file

func (*Task) GetGroup

func (t *Task) GetGroup() string

GetGroup returns the group, prioritizing frontmatter over derived value

func (*Task) IsValid

func (t *Task) IsValid() bool

IsValid checks if the task has required fields

type TaskType

type TaskType string

TaskType represents the classification of a work item

const (
	TypeFeature     TaskType = "feature"
	TypeBug         TaskType = "bug"
	TypeImprovement TaskType = "improvement"
	TypeChore       TaskType = "chore"
	TypeDocs        TaskType = "docs"
)

type VerifyStep

type VerifyStep struct {
	Type  string `yaml:"type" json:"type"`
	Run   string `yaml:"run,omitempty" json:"run,omitempty"`
	Dir   string `yaml:"dir,omitempty" json:"dir,omitempty"`
	Check string `yaml:"check,omitempty" json:"check,omitempty"`
}

VerifyStep represents a single verification check defined in task frontmatter.

Jump to

Keyboard shortcuts

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