models

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package models holds the board data model: a single task, its lifecycle state, and its workflow status.

North uses two orthogonal axes:

  • State is the lifecycle location — the folder a task lives in (drafts/ tasks/ archive/). It is the source of truth for "where" a task is.
  • Status is the workflow column (ready/in_progress/done/failed/blocked), stored only in frontmatter. It only changes while the task is active.

Both axes are freeform: any status can move to any other status, and any state to any other state, in a single step. The fixed status/state *lists* are hardcoded for the MVP (configurable statuses are deferred).

Index

Constants

View Source
const DefaultStatus = Ready

DefaultStatus is the status a new task carries.

Variables

View Source
var StateDirs = map[TaskState]string{
	StateDraft:   "drafts",
	StateActive:  "tasks",
	StateArchive: "archive",
}

StateDirs maps each state to its on-disk folder name (in board order).

StateOrder lists the states in board order (drafts → tasks → archive).

Statuses lists every workflow status in board order — a left→right flow: blocked sits beside in_progress (a parked task), terminal states last.

Functions

func IsState

func IsState(s TaskState) bool

IsState reports whether s is a known state. State moves are freeform: any known state is a legal target from any other.

func IsStatus

func IsStatus(s TaskStatus) bool

IsStatus reports whether s is a known status. Status moves are freeform: any known status is a legal target from any other (active tasks only).

func StateIndex

func StateIndex(s TaskState) int

StateIndex returns the board-order position of a state (for stable sorting).

Types

type Task

type Task struct {
	ID        string
	Title     string
	State     TaskState
	Status    TaskStatus
	Path      string
	Assignee  string
	Labels    []string
	DependsOn []string
	CreatedAt *time.Time
	UpdatedAt *time.Time
	Body      string
}

Task is one board task. Path is where the file currently lives on disk; State is derived from its folder, Status from its frontmatter.

func (*Task) ToMap

func (t *Task) ToMap() map[string]any

ToMap returns a stable, JSON-serialisable view used by --json output.

type TaskState

type TaskState string

TaskState is the lifecycle location of a task — the folder it lives in.

const (
	StateDraft   TaskState = "draft"
	StateActive  TaskState = "active"
	StateArchive TaskState = "archive"
)

func StateForDir

func StateForDir(dir string) (TaskState, bool)

StateForDir returns the state whose folder is dir.

type TaskStatus

type TaskStatus string

TaskStatus is the workflow column, stored in frontmatter.

const (
	Ready      TaskStatus = "ready"
	InProgress TaskStatus = "in_progress"
	Done       TaskStatus = "done"
	Failed     TaskStatus = "failed"
	Blocked    TaskStatus = "blocked"
)

Jump to

Keyboard shortcuts

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