source

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package source defines the backend abstraction lazydash renders through. A Source lists projects and loads their boards; a Source that can also mutate issues additionally implements Writer. The TUI talks only to these interfaces and the core model, so adding a backend (GitHub Projects, local git issues, another forge) never touches the rendering layer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Capabilities

type Capabilities struct {
	Offline  bool // works with no network (e.g. local git refs)
	Create   bool // create new issues
	Comment  bool // add comments
	SetState bool // close / reopen
	SetField bool // set a single-select field value (move a card between columns)
	Labels   bool // add / remove labels
	Assign   bool // set assignees
}

Capabilities describes what a source supports. Reads are always available; the write flags gate mutation actions in the TUI and correspond to the optional Writer methods. A backend advertises only what it can actually do, so the same key can be a no-op on one source and a live edit on another.

type Draft

type Draft struct {
	Title     string
	Body      string
	Labels    []string
	Assignees []string
	Priority  string
}

Draft is the payload for creating a new issue.

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry holds the active sources and routes work to them by name.

func NewRegistry

func NewRegistry(sources ...Source) *Registry

NewRegistry builds a registry over the given sources, in display order.

func (*Registry) ByName

func (r *Registry) ByName(name string) Source

ByName returns the source with the given Name, or nil if none is registered.

func (*Registry) GetBoard

func (r *Registry) GetBoard(p core.Project) (*core.BoardData, error)

GetBoard routes a board load to the source that owns the project.

func (*Registry) ListProjects

func (r *Registry) ListProjects() ([]core.Project, error)

ListProjects aggregates projects across every source, stamping each project with its owning source name. A source that errors is skipped rather than failing the whole listing, so one broken backend (GitHub offline) never hides a working one (local issues). If every source fails, the first error is returned so the user still sees something actionable.

func (*Registry) Sources

func (r *Registry) Sources() []Source

Sources returns the registered sources in order.

type Source

type Source interface {
	// Name is the stable identifier stamped onto core.Project.Source and used
	// to route board loads and mutations back to the owning backend.
	Name() string
	// Caps reports what this source supports right now.
	Caps() Capabilities
	// ListProjects returns the projects this source exposes.
	ListProjects() ([]core.Project, error)
	// GetBoard loads views, fields and items for one project.
	GetBoard(projectID string) (*core.BoardData, error)
}

Source is a read backend: it lists projects and loads a project's board.

type Undoer

type Undoer interface {
	Undo(item core.Card) error
}

Undoer is implemented by sources that can reverse the last change to an item. The local backend can (an issue is an append-only commit chain, so undo is a ref reset); GitHub cannot, so it simply does not implement this.

func AsUndoer

func AsUndoer(s Source) (Undoer, bool)

AsUndoer returns the Source as an Undoer if it implements one.

type Writer

type Writer interface {
	CreateIssue(projectID string, d Draft) (core.Card, error)
	Comment(item core.Card, body string) error
	SetState(item core.Card, state string) error // "open" | "closed"
	SetField(item core.Card, field, option string) error
	SetLabels(item core.Card, labels []string) error
	SetAssignees(item core.Card, who []string) error
}

Writer is implemented by sources that can mutate issues. The TUI type-asserts a Source to Writer (via AsWriter) and gates each action on the matching Capabilities flag, so a read-only source simply never exposes the action.

Item mutations take the whole core.Card rather than a bare id: the local backend keys off Card.ID (the issue UUID) while GitHub keys off Card.URL, and passing the card lets each backend read what it needs without a lookup.

func AsWriter

func AsWriter(s Source) (Writer, bool)

AsWriter returns the Source as a Writer if it implements one.

Directories

Path Synopsis
Package github adapts the GitHub Projects v2 client (internal/api) to the source.Source interface: it resolves the viewer, aggregates user and org projects, applies the config include/exclude filters, and loads boards.
Package github adapts the GitHub Projects v2 client (internal/api) to the source.Source interface: it resolves the viewer, aggregates user and org projects, applies the config include/exclude filters, and loads boards.
Package local is the offline backend: it reads (and later writes) git-native-issue issues stored as commit chains under refs/issues/ in the repository lazydash is launched in.
Package local is the offline backend: it reads (and later writes) git-native-issue issues stored as commit chains under refs/issues/ in the repository lazydash is launched in.

Jump to

Keyboard shortcuts

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