work

package
v0.26.1 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package work reads and moves work items kept as files in .workline/work/, for projects without a forge (docs/spec/routing.md, "Work starts from a clear need").

Index

Constants

View Source
const NoResponse = "_No response_"

NoResponse is what an issue form writes for a field left empty.

Variables

View Source
var Headings = Table{
	{Meaning: Need, Headings: []string{"Need"}},
	{Meaning: Example, Headings: []string{"Example"}},
	{Meaning: Steps, Headings: []string{"Steps to reproduce"}},
	{Meaning: Validation, Headings: []string{"Validation"}},
	{Meaning: Verification, Headings: []string{"Verification"}, Builder: true},
	{Meaning: Scope, Headings: []string{"Scope"}, Builder: true},
}

Headings is the table the engine reads and writes issues with. A heading never leaves it: issues were written under it.

Required are the meanings an item needs before it is ready, in the order a check says what is missing.

Functions

func Break added in v0.23.0

func Break(line string) bool

Break says whether a line is a thematic break: `---`, `***` or `___`, CommonMark's.

func ByMeaning added in v0.23.0

func ByMeaning(body string) map[Meaning]Section

ByMeaning is a body's sections by meaning, read with the engine's table.

func Footer(body string) (string, string)

Footer splits a body from its footer, which belongs to no section (docs/spec/backlog-acts.md, "A body's footer"): from a thematic break (`---`, `***`, `___`, a blank line above it) after the last heading, or else the body's last line when it is a tool's signature alone in its paragraph ("🤖 Generated with …", "Generated by …"). It returns the body without it, its trailing blank lines too, and the footer, "" when there is none.

func Has added in v0.23.0

func Has(names []string, m Meaning) bool

Has says whether names, headings, hold one of meaning m.

func Heading added in v0.7.0

func Heading(line string) (string, bool)

Heading reads a section's heading line, "## Name" or "### Name".

func Name added in v0.23.0

func Name(m Meaning) string

Name is the heading the engine writes a meaning under.

func Path

func Path(repo, id string) string

Path is where item id lives.

func Ready

func Ready(repo, id string) *verdict.Verdict

Ready moves an item to ready if its four sections are written, and says which are missing otherwise. It checks presence, not quality: that is the person's call.

func ReadyOnForge

func ReadyOnForge(f forge.Forge, id int) *verdict.Verdict

ReadyOnForge is Ready for an issue on a forge: the sections are read from its description, and a ready issue gets the workline:ready label.

func Sections

func Sections(content string) map[string]string

Sections returns the text under each "## " or "### " heading — an issue form writes its fields as the latter. A field left empty in a form ("_No response_") is empty. A heading written twice holds the text under both, the first one's first. A thematic break ending a section — the line between the person's part of an issue and the builder's — is not its text.

func WithFooter added in v0.23.0

func WithFooter(main, footer string) string

WithFooter is a body rewritten without its footer, the footer put back after it: a section added goes above it.

Types

type Meaning added in v0.23.0

type Meaning string

Meaning is what a section of an issue says, whatever heading it is under. Its id is the key a refine gives the section, and never changes.

const (
	Need         Meaning = "need"
	Example      Meaning = "example"
	Steps        Meaning = "steps"
	Validation   Meaning = "validation"
	Verification Meaning = "verification"
	Scope        Meaning = "scope"
)

The meanings of an issue's sections.

func MeaningOf added in v0.23.0

func MeaningOf(heading string) Meaning

MeaningOf is the meaning a heading names in the engine's table; "" for none.

type Row added in v0.23.0

type Row struct {
	Meaning  Meaning
	Headings []string
	Builder  bool
}

Row is a meaning and its headings, the first the one written. A builder's section is below the line between the person's part of an issue and the builder's; above it, a person's, which the role drafts for a person to make theirs.

type Section added in v0.23.0

type Section struct {
	Heading string
	Text    string
}

Section is a body's section read by its meaning: the heading it is under there, the first when several hold it, and the text under all of them.

type Table added in v0.23.0

type Table []Row

Table holds each meaning once, in the order the role writes an issue's sections in, for its reader: the person's part — the need, a real example of it or a bug's steps to reproduce, how a person accepts it — then the builder's — how the machine proves it, the code it touches.

func (Table) Builder added in v0.23.0

func (t Table) Builder(m Meaning) bool

Builder says whether a meaning's section is the builder's, below the line.

func (Table) In added in v0.23.0

func (t Table) In(names []string, m Meaning) (string, bool)

In is the first of names, headings, that names meaning m; ok is false when none does.

func (Table) Meaning added in v0.23.0

func (t Table) Meaning(heading string) Meaning

Meaning is the meaning a heading names; "" when it names none.

func (Table) Meanings added in v0.23.0

func (t Table) Meanings() []Meaning

Meanings are the table's meanings, in the order the role writes them.

func (Table) Name added in v0.23.0

func (t Table) Name(m Meaning) string

Name is the heading a meaning is written under.

func (Table) Of added in v0.23.0

func (t Table) Of(m Meaning) []string

Of are the headings a meaning is read under, the one written first.

func (Table) Read added in v0.23.0

func (t Table) Read(body string) map[Meaning]Section

Read is a body's sections by meaning, as Sections reads them by heading: a meaning under two headings holds the text under both, the first one's first. A heading the table does not hold is in none.

func (Table) With added in v0.23.0

func (t Table) With(m Meaning, written string) Table

With is the table with written as the heading m is written under, those it had still read after it: how a meaning takes a new name.

Jump to

Keyboard shortcuts

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