local

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: 10 Imported by: 0

Documentation

Overview

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. Reads use only git plumbing, so viewing issues never depends on the `git issue` binary being installed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasIssues

func HasIssues(root string) bool

HasIssues reports whether the repo at root has any refs/issues/* refs.

func RepoRoot

func RepoRoot(dir string) (string, error)

RepoRoot returns the working-tree root of the git repo containing dir, or an error if dir is not inside a repository.

Types

type Comment

type Comment struct {
	Author string
	Date   string
	Body   string
}

Comment is one comment event in an issue's history.

type Issue

type Issue struct {
	ID        string // UUID: the ref name under refs/issues/
	Title     string
	Body      string
	State     string // "open" | "closed"
	Labels    []string
	Assignee  string
	Priority  string
	Milestone string
	Comments  []Comment
	CreatedAt string // ISO-8601 date of the create commit
	UpdatedAt string // ISO-8601 date of the tip commit
}

Issue is a single git-native-issue issue, reconstructed by folding its commit chain (create → comments → state changes) into the current state.

func ListIssues

func ListIssues(root string) ([]Issue, error)

ListIssues reads and reconstructs every issue under refs/issues/ in the repo at root, most-recently-updated first. A malformed ref is skipped rather than failing the whole listing.

type Source

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

Source is the offline git-native-issue backend for one repository. It presents the repo's issues as a single project with synthesized fields and views, so the board/table renderer treats them exactly like a GitHub project.

func New

func New(dir string) (*Source, error)

New builds a local Source for the repo containing dir. It returns (nil, nil) when dir is not inside a git repo or the repo has no refs/issues/ — an absent local backend is a normal condition (most repos have no local issues), not an error that should be surfaced to the user.

func (*Source) Caps

func (s *Source) Caps() source.Capabilities

Caps reports the backend's capabilities. It works fully offline and supports the whole mutation surface, since writes are authored with git plumbing and need no external binary.

func (*Source) Comment

func (s *Source) Comment(item core.Card, body string) error

Comment appends a comment event.

func (*Source) CreateIssue

func (s *Source) CreateIssue(_ string, d source.Draft) (core.Card, error)

CreateIssue roots a new issue chain under a fresh refs/issues/<uuid>.

func (*Source) GetBoard

func (s *Source) GetBoard(string) (*core.BoardData, error)

GetBoard reads the repo's issues and folds them into a board with synthesized State/Priority fields and Board/Priority/Table views.

func (*Source) ListProjects

func (s *Source) ListProjects() ([]core.Project, error)

ListProjects exposes the repository as a single synthetic project.

func (*Source) Name

func (s *Source) Name() string

Name identifies this backend.

func (*Source) SetAssignees

func (s *Source) SetAssignees(item core.Card, who []string) error

SetAssignees replaces the assignee.

func (*Source) SetField

func (s *Source) SetField(item core.Card, field, option string) error

SetField sets a single-select field. State maps to close/reopen; every other field is recorded as a trailer of the same (canonicalised) name.

func (*Source) SetLabels

func (s *Source) SetLabels(item core.Card, labels []string) error

SetLabels replaces the label set.

func (*Source) SetState

func (s *Source) SetState(item core.Card, state string) error

SetState closes or reopens an issue by appending a state event.

func (*Source) Undo

func (s *Source) Undo(item core.Card) error

Undo pops the most recent event off an issue's chain by resetting its ref to the tip's parent. Because the chain is append-only this cleanly reverses the last comment or state/field change; the popped commit stays in the object store (recoverable via reflog). The create commit has no parent and cannot be undone this way.

Jump to

Keyboard shortcuts

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