backlog

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SectionRanked   = 1 // manually ordered, above the ⤵️ Unranked tasks divider
	SectionUnranked = 2 // under ⤵️ Unranked tasks, 📅 Overdue tasks, ⏰ Scheduled tasks, ✨ New tasks, 🏷️ Triaged tasks
	SectionOrphan   = 3 // not referenced in any backlog page
)

Section values for the PocketBase `section` field. Ranked=1, Unranked=2, Orphan=3 so that (backlog_index, section, rank) sorts ranked tasks before unranked tasks before orphans within any backlog.

Variables

View Source
var (
	HeaderFocus     = Header{"🎯", "Focus"}
	HeaderOverdue   = Header{"📅", "Overdue"}
	HeaderNewTasks  = Header{"✨", "New"}
	HeaderTriaged   = Header{"🏷️", "Triaged"}
	HeaderScheduled = Header{"⏰", "Scheduled"}
	HeaderUnranked  = Header{"⤵️", "Unranked"}
)

Backlog section header definitions. Detection uses Header.Matches (case-insensitive label search). Creation uses Header.String() so the canonical emoji+label+tasks is always written.

Functions

func AddBlockRefToFocusPage added in v0.8.0

func AddBlockRefToFocusPage(transaction *logseq.Transaction, focusPageTitle, uuid string) error

AddBlockRefToFocusPage adds a block ref ((uuid)) to the Focus page.

func BlockRefExistsUnder added in v0.8.0

func BlockRefExistsUnder(parent *content.Block, uuid logseqapi.TaskUUID) bool

BlockRefExistsUnder returns true if a block ref with the given UUID exists anywhere in the descendant tree of parent.

func FindFirstSectionDivider added in v0.8.0

func FindFirstSectionDivider(page logseq.Page) *content.Block

FindFirstSectionDivider finds the first block whose text matches a known section header.

func FormatCount

func FormatCount(count int, singular, plural string) string

FormatCount returns a string with the count and the singular or plural form of a word.

func MoveBlockRefToTriagedSection added in v0.8.0

func MoveBlockRefToTriagedSection(
	transaction *logseq.Transaction, backlogPage string, uuid logseqapi.TaskUUID, triagedText, scheduledText string,
) error

MoveBlockRefToTriagedSection moves a block ref to the Triaged section of a backlog page. If the ref exists in the regular area (not under Focus, New tasks, Overdue, or Scheduled), it is removed from there. If it's already in Triaged, no duplicate is added. Creates the Triaged section if it doesn't exist.

func NormalizeHeaderText added in v0.8.0

func NormalizeHeaderText(page logseq.Page) bool

NormalizeHeaderText scans all top-level blocks on the page and normalizes any block whose text node contains a known header keyword:

  • fixes the text to the canonical "emoji Label tasks" form
  • upgrades a plain Paragraph container to a Heading level 1

Returns true if any block was changed.

func RemoveBlockRefFromRegularArea added in v0.8.0

func RemoveBlockRefFromRegularArea(page logseq.Page, uuid logseqapi.TaskUUID)

RemoveBlockRefFromRegularArea removes the block ref with the given UUID from the regular area of the page. The regular area is any top-level block ref that is not itself a section divider. Section dividers (Focus, Overdue, New tasks, Triaged, Scheduled, Unranked) and their children are not part of the regular area. Since we walk only top-level blocks, child refs are never seen.

Types

type Backlog

type Backlog interface {
	Graph() *logseq.Graph
	ProcessAll(partialNames []string) error
	ProcessOne(pageTitle string, funcQueryRefs func() (*logseqapi.CategorizedTasks, error)) (*Result, error)
}

func NewBacklog

func NewBacklog(graph *logseq.Graph, logseqAPI logseqapi.LogseqAPI, reader ConfigReader,
	currentTime func() time.Time) Backlog

type Config

type Config struct {
	FocusPage string
	Backlogs  []SingleBacklogConfig
}

func (*Config) FindBacklogPageTitle added in v0.8.0

func (c *Config) FindBacklogPageTitle(backlogName string) string

FindBacklogPageTitle looks up the full backlog page path from config by backlog name. Returns empty string if no matching backlog is found.

type ConfigReader

type ConfigReader interface {
	ReadConfig() (*Config, error)
}

func NewPageConfigReader

func NewPageConfigReader(graph *logseq.Graph, configPage string) ConfigReader

NewPageConfigReader creates a new ConfigReader that reads the backlog configuration from a Logseq page.

type Header struct {
	Emoji string
	Label string
}

Header represents a backlog section divider. Label is the display word(s) without the "tasks" suffix (e.g. "Focus"). String() always returns "Emoji Label tasks".

func (Header) Matches added in v0.8.0

func (h Header) Matches(blockText string) bool

Matches reports whether blockText contains the label, case-insensitively.

func (Header) NewHeading added in v0.8.0

func (h Header) NewHeading() *content.Heading

NewHeading returns a level-1 heading node with the canonical header text followed by a [[quick capture]] page link. Use this when creating a new section divider so the user can identify blocks inserted by lqd backlog.

func (Header) String added in v0.8.0

func (h Header) String() string

String returns the canonical display form: "emoji label tasks".

type Result

type Result struct {
	FocusRefsFromPage *set.Set[string]
	ShowQuickCapture  bool
}

type SingleBacklogConfig

type SingleBacklogConfig struct {
	BacklogPage string
	Icon        string
	InputPages  []string
}

Jump to

Keyboard shortcuts

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