plan

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AtomicWriteFile added in v0.2.0

func AtomicWriteFile(path string, data []byte) error

AtomicWriteFile writes data to path using a temp file + rename.

func CurrentFile

func CurrentFile() (string, error)

CurrentFile returns the path to the .current file that tracks the active plan.

func GenerateTemplate added in v0.2.0

func GenerateTemplate(name string) []byte

GenerateTemplate creates a new plan Markdown file with the given name.

func GetCurrent

func GetCurrent() (string, error)

GetCurrent reads the current plan name from plans/.current. Returns empty string if no current plan is set.

func GitRoot

func GitRoot() (string, error)

GitRoot walks up from cwd to find the directory containing .git/.

func ListPlans

func ListPlans() ([]string, error)

ListPlans returns all plan file slugs in the plans/ directory.

func NameToFilename

func NameToFilename(name string) string

NameToFilename converts a plan name to a filename slug.

func ParseTaskCounts added in v0.4.0

func ParseTaskCounts(data []byte) (done, total int)

ParseTaskCounts finds the ## Tasks section and counts top-level checkboxes. Only lines starting with "- [ ]" or "- [x]" (no leading whitespace) are counted. Indented checkboxes (sub-tasks) are ignored.

func ParseTitle added in v0.2.0

func ParseTitle(data []byte) string

ParseTitle extracts the first # heading from the data.

func PlansDir

func PlansDir() (string, error)

PlansDir returns the plans/ directory path at the git root.

func ResolveCurrentPlan

func ResolveCurrentPlan(name string) (string, error)

ResolveCurrentPlan figures out which plan to use: 1. If a name is given, use that 2. If plans/.current exists, use that 3. If only one plan exists, use that Returns the plan name or error.

func ResolvePlanPath

func ResolvePlanPath(name string) (string, error)

ResolvePlanPath returns the full path to a named plan file.

func SetCurrent

func SetCurrent(name string) error

SetCurrent writes the current plan name to plans/.current.

func SlugToTitle added in v0.2.0

func SlugToTitle(slug string) string

SlugToTitle converts a filename slug to a title. "deploy-pipeline" → "Deploy Pipeline"

Types

type PlanStatus added in v0.2.0

type PlanStatus struct {
	Name      string
	FilePath  string
	DoneCount int
	Total     int
}

PlanStatus holds parsed status information for a plan file.

func ParsePlanStatus added in v0.2.0

func ParsePlanStatus(path string) (*PlanStatus, error)

ParsePlanStatus reads a plan file and returns its status.

Jump to

Keyboard shortcuts

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