protocol

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func CalcProgress

func CalcProgress(goals []Goal) int

func DetectRepo

func DetectRepo(dir string) string

func DetectTags

func DetectTags(dir string) []string

func HasProject

func HasProject(projectRoot string) bool

func Now

func Now() string

func ProjectFilePath

func ProjectFilePath(projectRoot string) string

func RegistryDir

func RegistryDir() string

func RegistryPath

func RegistryPath() string

func SyncToRegistry

func SyncToRegistry(projectRoot string, p *Project) error

func WriteProject

func WriteProject(projectRoot string, p *Project) error

func WriteRegistry

func WriteRegistry(r *Registry) error

Types

type FullProject

type FullProject struct {
	Project
	Path    string
	Missing bool
}

FullProject is a loaded project with filesystem context

func LoadAllProjects

func LoadAllProjects() ([]FullProject, error)

type Goal

type Goal struct {
	Text string `json:"text"`
	Done bool   `json:"done"`
}
type Links struct {
	Repo   *string `json:"repo"`
	Deploy *string `json:"deploy"`
	Design *string `json:"design"`
}

type Note

type Note struct {
	Ts   string `json:"ts"`
	Text string `json:"text"`
}

type Project

type Project struct {
	ID           string        `json:"id"`
	Name         string        `json:"name"`
	Description  *string       `json:"description"`
	Status       ProjectStatus `json:"status"`
	Progress     int           `json:"progress"`
	Tags         []string      `json:"tags"`
	Created      string        `json:"created"`
	LastActivity string        `json:"lastActivity"`
	Goals        []Goal        `json:"goals"`
	Notes        []Note        `json:"notes"`
	Links        Links         `json:"links"`

	// Extra fields preserved on round-trip
	Extra map[string]any `json:"-"`
}

func CreateProject

func CreateProject(projectRoot string) *Project

func ReadProject

func ReadProject(projectRoot string) (*Project, error)

type ProjectStatus

type ProjectStatus string
const (
	StatusActive    ProjectStatus = "active"
	StatusIdea      ProjectStatus = "idea"
	StatusPaused    ProjectStatus = "paused"
	StatusDone      ProjectStatus = "done"
	StatusAbandoned ProjectStatus = "abandoned"
)

type Registry

type Registry struct {
	Version  int             `json:"version"`
	Projects []RegistryEntry `json:"projects"`
}

func ReadRegistry

func ReadRegistry() (*Registry, error)

type RegistryEntry

type RegistryEntry struct {
	ID           string `json:"id"`
	Path         string `json:"path"`
	Name         string `json:"name"`
	Status       string `json:"status"`
	LastActivity string `json:"lastActivity"`
}

type ScanResult

type ScanResult struct {
	Path string
	Tags []string
}

ScanResult is a discovered project not yet tracked by drift

func ScanDir

func ScanDir(root string, maxDepth int) []ScanResult

ScanDir recursively finds projects in a directory. maxDepth limits recursion (0 = root only, -1 = unlimited). Skips directories that already have .drift/, and known non-project dirs.

type TreeLine

type TreeLine struct {
	Indent  int
	Name    string
	IsDir   bool
	Project *FullProject
	Last    bool // last child at this level (for tree drawing)
}

FlattenTree produces a flat list with indentation info for rendering.

func FlattenTree

func FlattenTree(node *TreeNode, indent int) []TreeLine

type TreeNode

type TreeNode struct {
	Name     string       // directory name
	FullPath string       // absolute path
	Project  *FullProject // nil if just a directory
	Children []*TreeNode
}

BuildTree groups projects by their parent directory relative to a common root.

func BuildProjectTree

func BuildProjectTree(projects []FullProject) *TreeNode

BuildProjectTree organizes projects into a directory tree.

Jump to

Keyboard shortcuts

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