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 Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry holds the active sources and routes work to them by name.
func NewRegistry ¶
NewRegistry builds a registry over the given sources, in display order.
func (*Registry) ByName ¶
ByName returns the source with the given Name, or nil if none is registered.
func (*Registry) ListProjects ¶
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.
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 ¶
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.
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.
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. |