models

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseFrontmatter

func ParseFrontmatter(content string) (map[string]any, string, error)

ParseFrontmatter extracts YAML frontmatter from Markdown content. Returns the parsed key-value pairs, the remaining body text, and any error. Both LF and CRLF line endings are supported.

func SerializeFrontmatter

func SerializeFrontmatter(fields map[string]any, body string) string

SerializeFrontmatter produces a Markdown string with YAML frontmatter and body.

Types

type Artifact

type Artifact struct {
	ID            string         `json:"id" yaml:"id" validate:"required"`
	Title         string         `json:"title" yaml:"title" validate:"required,max=200"`
	Status        ArtifactStatus `` /* 132-byte string literal not displayed */
	ArtifactType  string         `json:"artifact_type" yaml:"artifact_type" validate:"required"`
	ParentID      string         `json:"parent_id,omitempty" yaml:"parent_id,omitempty"`
	Sprint        string         `json:"sprint,omitempty" yaml:"sprint,omitempty"`
	Priority      string         `json:"priority,omitempty" yaml:"priority,omitempty"`
	Description   string         `json:"description,omitempty" yaml:"description,omitempty"`
	AssignedTo    string         `json:"assigned_to,omitempty" yaml:"assigned_to,omitempty"`
	Owner         string         `json:"owner,omitempty" yaml:"owner,omitempty"`
	Labels        []string       `json:"labels,omitempty" yaml:"labels,omitempty"`
	Dependencies  []string       `json:"dependencies,omitempty" yaml:"dependencies,omitempty"`
	Links         []ArtifactLink `json:"links,omitempty" yaml:"links,omitempty"`
	References    []string       `json:"references,omitempty" yaml:"references,omitempty"`
	Commit        string         `json:"commit,omitempty" yaml:"commit,omitempty"`
	CustomFields  map[string]any `json:"custom_fields,omitempty" yaml:"custom_fields,omitempty"`
	CreatedAt     time.Time      `json:"created_at" yaml:"created_at"`
	UpdatedAt     time.Time      `json:"updated_at" yaml:"updated_at"`
	Level         int            `json:"level,omitempty" yaml:"level,omitempty"`
	HierarchyPath string         `json:"hierarchy_path,omitempty" yaml:"hierarchy_path,omitempty"`
}

Artifact holds the current state of a backlogit work item.

func ArtifactFromFrontmatter

func ArtifactFromFrontmatter(fm map[string]any, body string) (*Artifact, error)

ArtifactFromFrontmatter converts raw frontmatter to a typed Artifact struct.

func (*Artifact) Compact

func (a *Artifact) Compact() CompactArtifact

Compact returns a reduced projection of the artifact suitable for list views.

func (Artifact) Validate

func (a Artifact) Validate() error

Validate checks all struct tags and returns a descriptive error on failure.

type ArtifactLink struct {
	TargetID string `json:"target_id" yaml:"target_id"`
	LinkType string `json:"link_type" yaml:"link_type"`
}

ArtifactLink represents a durable outgoing semantic link stored in artifact frontmatter.

type ArtifactStatus

type ArtifactStatus string

ArtifactStatus represents the lifecycle state of a backlogit artifact.

const (
	StatusQueued    ArtifactStatus = "queued"
	StatusActive    ArtifactStatus = "active"
	StatusBlocked   ArtifactStatus = "blocked"
	StatusReview    ArtifactStatus = "review"
	StatusDone      ArtifactStatus = "done"
	StatusAccepted  ArtifactStatus = "accepted"
	StatusRejected  ArtifactStatus = "rejected"
	StatusArchived  ArtifactStatus = "archived"
	StatusShipped   ArtifactStatus = "shipped"
	StatusAbandoned ArtifactStatus = "abandoned"
)

type CompactArtifact

type CompactArtifact struct {
	ID           string         `json:"id"`
	Title        string         `json:"title"`
	Status       ArtifactStatus `json:"status"`
	ArtifactType string         `json:"artifact_type"`
	ParentID     string         `json:"parent_id,omitempty"`
	Priority     string         `json:"priority,omitempty"`
	AssignedTo   string         `json:"assigned_to,omitempty"`
	Owner        string         `json:"owner,omitempty"`
}

CompactArtifact is a reduced projection of an Artifact for token-efficient agent consumption. It omits description, timestamps, labels, dependencies, references, and custom fields, retaining the identity and assignment fields most useful for queue and triage views.

type Sprint

type Sprint struct {
	ID          string    `json:"id" yaml:"id" validate:"required"`
	Goal        string    `json:"goal" yaml:"goal" validate:"required"`
	StartDate   time.Time `json:"start_date,omitempty" yaml:"start_date,omitempty"`
	EndDate     time.Time `json:"end_date,omitempty" yaml:"end_date,omitempty"`
	ArtifactIDs []string  `json:"artifact_ids,omitempty" yaml:"artifact_ids,omitempty"`
}

Sprint represents a sprint container with goal and date boundaries.

func (Sprint) Validate

func (s Sprint) Validate() error

Validate checks sprint required fields.

Jump to

Keyboard shortcuts

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