Documentation
¶
Overview ¶
Package board holds the kanban board model and its markdown wire codec.
The markdown grammar preserves the frozen wire format used by older clients.
Index ¶
- Constants
- Variables
- func ContainsSpace(s string) bool
- func IsBlank(s string) bool
- func IsSingleEmoji(s string) bool
- func LeadingEmoji(s string) string
- func NormalizePrio(p int) int
- func PrioName(p int) string
- func Serialize(b Board) string
- func ValidPrio(p int) bool
- type Board
- type Check
- type Status
- type Task
Constants ¶
const ( PrioHigh = 1 PrioMedium = 2 PrioLow = 3 // PrioDefault is the priority a task takes when none is given. PrioDefault = PrioLow )
The priority scale, collapsed to three values by issue #234. The stored representation stays the integer the tasks.prio column has always held: the card renders the digit (spec section 3.4), the board sorts on it, and the frozen markdown and JSON wires carry it. Names are a surface vocabulary, not a storage change.
Variables ¶
var PrioNames = map[int]string{ PrioHigh: "high", PrioMedium: "medium", PrioLow: "low", }
PrioNames maps each priority to its canonical name, low to high urgency.
var Statuses = []Status{StatusTodo, StatusDoing, StatusDone, StatusCancelled}
Statuses lists the valid statuses in canonical column order.
Functions ¶
func ContainsSpace ¶
ContainsSpace reports whether s contains a rune the wire format's token splitter treats as whitespace (JavaScript's \s class). Fields serialized as single tokens (tags) must not contain any.
func IsBlank ¶
IsBlank reports whether s is empty or holds nothing but runes the wire format's token splitter treats as whitespace. A blank title serializes to a bare "- [ ] " line, which Parse reads back as description text rather than as a task.
func IsSingleEmoji ¶
IsSingleEmoji reports whether s is exactly the leading-emoji token the title-line grammar recognizes: one Extended_Pictographic rune plus an optional U+FE0F variation selector. Anything else would not survive a Serialize/Parse round trip as the emoji field.
func LeadingEmoji ¶
LeadingEmoji returns the leading emoji token recognized by the markdown grammar, or an empty string when s does not start with one.
func NormalizePrio ¶
NormalizePrio folds any value the three-value scale does not name onto PrioLow. It is the read-side counterpart of the schema v10 migration: a legacy 4 meant low before the collapse and means low after it, and an unset or corrupt value takes the same default a task with no priority takes.
func Serialize ¶
Serialize renders a board in canonical markdown form: "# Title", one "## To Do"/"## Doing"/"## Done"/"## Cancelled" section per status, and per task a "- [ ] emoji title !p @due ~E %blocked #tag" line followed by two-space-indented description lines and checklist items. Tasks keep their slice order within each section. The Cancelled section is a phase-3 addition and is written only when it has tasks, so legacy three-section boards stay byte-identical on the wire.
Types ¶
type Board ¶
Board is a titled collection of tasks.
func Parse ¶
Parse decodes markdown into a Board. It is content-preserving and infallible: unknown constructs degrade into title/description text rather than errors. IDs are left empty (the wire format carries none); CreatedAt and MovedAt are set to the parse time; Position is the task's 0-based ordinal within its column.
type Status ¶
type Status string
Status is a board column: "todo", "doing", "done", or "cancelled".
type Task ¶
type Task struct {
ID string
Seq int
Emoji string
Title string
Desc string
Status Status
Blocked bool
Prio int
Due string
Effort string
Tags []string
Checks []Check
Position int
CreatedAt time.Time
MovedAt time.Time
}
Task is one card on the board.
Due is "YYYY-MM-DD" or empty; Effort is "S", "M", "L", or empty; Prio is 1..3 - 1 high, 2 medium, 3 low - with 3 the default (a Prio of 3 is omitted from the wire format). Issue #234 collapsed the scale from four values; the wire reader still accepts a legacy !4 and normalizes it to 3, which is what it always meant. Blocked marks a task as blocked and rides the wire as the "%blocked" title-line token (written only when true). Tags are plain ("backend") or scoped ("type::bug"). Position is the 0-based ordinal within the task's column and, like ID, Seq, CreatedAt, and MovedAt, is metadata not carried by the wire format. Seq is the task's stable per-board sequence number (#n): assigned once on creation, never reused, 0 when unknown, such as a task parsed from legacy Markdown.