project

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package project carries the project vocabulary every kb surface shares.

Every task carries exactly one project, spelled as the scoped label "project::<name>". Projects slice one board rather than splitting it into several: the label is ordinary task data, so nothing about the schema or Markdown codec changes.

The rules live here rather than in one surface because more than one surface writes tasks: the CLI resolves an active project and stamps it, and the TUI switches, filters and edits by it. A second implementation of "exactly one project:: label" is a second chance to get it wrong.

Index

Constants

View Source
const (
	// Scope is the label scope projects live under.
	Scope = "project"
	// LabelPrefix is what a project label starts with.
	LabelPrefix = Scope + "::"
	// Inbox is where tasks that never named a project end up.
	Inbox = "inbox"
)

Variables

This section is empty.

Functions

func Ensure

func Ensure(tags []string, name string) ([]string, error)

Ensure returns tags carrying exactly one project:: label: whatever project labels were in tags are dropped and name's label is appended. It is the invariant every write surface funnels through, so a task can never reach the store with zero or two projects.

func Label

func Label(name string) string

Label renders the scoped label for a project name.

func Lead

func Lead(tags []string) []string

Lead reorders a tag list so the project label comes first, leaving every other tag in its original order. The project is the card's loudest label, and the label row is rendered in survival order, so leading with it is what keeps it on the card when the row runs out of width.

func Of

func Of(tags []string) string

Of returns the single project a tag list carries, or "" when it carries none or more than one — both of which a write path then replaces.

func SplitTags

func SplitTags(tags []string) (projects, rest []string)

SplitTags separates the project names a tag list carries from the tags that are not project labels, both in their original order.

func ValidateName

func ValidateName(name string) (string, error)

ValidateName checks a project name by the rule already applied to label values: non-empty, no whitespace, no leading '#'. It additionally rejects "::" so a name can never smuggle a second scope into the label.

Types

This section is empty.

Jump to

Keyboard shortcuts

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