task

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package task manages task file CRUD and state machine transitions. Task files are markdown with YAML frontmatter stored under gtms/tasks/{status}/.

Index

Constants

This section is empty.

Variables

View Source
var ValidStatuses = []string{"pending", "in-progress", "in-review", "complete", "error"}

ValidStatuses lists all valid task status values.

Functions

func Create

func Create(projectRoot string, tf *TaskFile, body string) (string, error)

Create writes a new task file to gtms/tasks/{status}/ with YAML frontmatter and body content. Returns the filepath of the created file.

func Move

func Move(projectRoot string, tf *TaskFile, newStatus string) error

Move physically moves a task file from its current status directory to a new one. It also updates the Status field in the frontmatter.

Types

type TaskFile

type TaskFile struct {
	ID          string `yaml:"id"`
	Type        string `yaml:"type"`   // create, automate, execute
	Target      string `yaml:"target"` // requirement ID or test case ID
	Adapter     string `yaml:"adapter"`
	Status      string `yaml:"status"`  // pending, in-progress, in-review, complete, error
	Created     string `yaml:"created"` // ISO 8601
	Branch      string `yaml:"branch"`
	Error       string `yaml:"error,omitempty"`
	Reference   string `yaml:"reference,omitempty"`   // create: --reference flag value; automate: test case source path
	Framework   string `yaml:"framework,omitempty"`   // automate only
	Environment string `yaml:"environment,omitempty"` // ENH-125: target environment (--env flag); rides task → record
	ExecutedBy  string `yaml:"executed_by,omitempty"` // ENH-125: resolved identity (--executed-by | env var | git user.name); rides task → record
}

TaskFile represents a GTMS task file with YAML frontmatter.

func FindByTarget

func FindByTarget(projectRoot, taskType, target string, statuses ...string) (*TaskFile, error)

FindByTarget finds a task by type and target across the given statuses. If no statuses are specified, checks pending and in-progress.

func List

func List(projectRoot string, statuses ...string) ([]*TaskFile, error)

List returns all task files matching the given statuses. If no statuses are specified, all statuses are scanned.

func Read

func Read(path string) (*TaskFile, error)

Read parses a task file from the given path, extracting YAML frontmatter.

func (*TaskFile) Filename

func (tf *TaskFile) Filename() string

Filename returns the canonical filename for this task file. It sanitizes the target to prevent path traversal and double extensions.

Jump to

Keyboard shortcuts

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