Documentation
¶
Index ¶
- func AtomicWriteFile(path string, data []byte) error
- func BranchExists(branchName string) bool
- func CreateBackup(path string) error
- func CurrentBranch() (string, error)
- func CurrentFile() (string, error)
- func GenerateTemplate(name, goal string) []byte
- func GetCurrent() (string, error)
- func GitRoot() (string, error)
- func ListPlans() ([]string, error)
- func NameToBranch(name string) string
- func NameToFilename(name string) string
- func ParseTitle(data []byte) string
- func PlansDir() (string, error)
- func ResolveCurrentPlan(name string) (string, error)
- func ResolvePlanPath(name string) (string, error)
- func SetCurrent(name string) error
- func SetSubTaskDone(data []byte, ref string) ([]byte, error)
- func SetTaskBlocked(data []byte, taskNum int, reason string) ([]byte, error)
- func SetTaskDone(data []byte, taskNum int) ([]byte, error)
- func SlugToTitle(slug string) string
- func SwitchBranch(branchName string) error
- type PlanStatus
- type TaskInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AtomicWriteFile ¶ added in v0.2.0
AtomicWriteFile writes data to path using a temp file + rename.
func BranchExists ¶
BranchExists checks if a git branch exists.
func CreateBackup ¶ added in v0.2.0
CreateBackup copies the file at path to plans/.backup in the same directory.
func CurrentBranch ¶
CurrentBranch returns the current git branch name.
func CurrentFile ¶
CurrentFile returns the path to the .current file that tracks the active plan.
func GenerateTemplate ¶ added in v0.2.0
GenerateTemplate creates a new plan Markdown file with the given name and goal.
func GetCurrent ¶
GetCurrent reads the current plan name from plans/.current. Returns empty string if no current plan is set.
func NameToBranch ¶
NameToBranch converts a plan name to a branch name.
func NameToFilename ¶
NameToFilename converts a plan name to a filename slug.
func ParseTitle ¶ added in v0.2.0
ParseTitle extracts the first # heading from the data.
func ResolveCurrentPlan ¶
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 ¶
ResolvePlanPath returns the full path to a named plan file.
func SetCurrent ¶
SetCurrent writes the current plan name to plans/.current.
func SetSubTaskDone ¶ added in v0.2.0
SetSubTaskDone marks a sub-task as done by reference (e.g. "1.1"). It finds the indented line matching "- [ ] 1.1." under ## Tasks and flips [ ] → [x].
func SetTaskBlocked ¶ added in v0.2.0
SetTaskBlocked marks a task with a [blocked] annotation. taskNum is 1-based.
func SetTaskDone ¶ added in v0.2.0
SetTaskDone marks a task as done by flipping [ ] → [x]. taskNum is 1-based.
func SlugToTitle ¶ added in v0.2.0
SlugToTitle converts a filename slug to a title. "deploy-pipeline" → "Deploy Pipeline"
func SwitchBranch ¶
SwitchBranch switches to an existing git branch.
Types ¶
type PlanStatus ¶ added in v0.2.0
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.
type TaskInfo ¶ added in v0.2.0
type TaskInfo struct {
Index int // 1-based task number
Text string // Full text of the task line (after checkbox)
Done bool // true if [x] or [X]
Blocked bool // true if text contains "[blocked]" marker
LineNum int // 0-based line number in the file
}
TaskInfo holds parsed info about a top-level task under ## Tasks.
func ParseTasks ¶ added in v0.2.0
ParseTasks finds the ## Tasks section and parses top-level checkboxes. Only top-level items (lines starting with "- [ ]" or "- [x]") are parsed. Sub-items (indented lines) are ignored.