plan

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package plan provides plan file selection, parsing, and manipulation.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoPlansFound = errors.New("no plans found")

ErrNoPlansFound is returned when no plan files exist in the plans directory.

Functions

func ExtractBranchName

func ExtractBranchName(planFile string) string

ExtractBranchName derives a branch name from a plan file path. removes the .md extension and strips any leading date prefix (e.g., "2024-01-15-").

func PromptDescription

func PromptDescription(ctx context.Context, r io.Reader, colors *progress.Colors) string

PromptDescription prompts the user to enter a plan description. returns empty string if user cancels (Ctrl+C or Ctrl+D).

Types

type Checkbox added in v0.16.0

type Checkbox struct {
	Text    string `json:"text"`
	Checked bool   `json:"checked"`
}

Checkbox represents a single checkbox item in a task.

type Plan added in v0.16.0

type Plan struct {
	Title string `json:"title"`
	Tasks []Task `json:"tasks"`
}

Plan represents a parsed plan file.

func ParsePlan added in v0.16.0

func ParsePlan(content string) (*Plan, error)

ParsePlan parses plan markdown content into a structured Plan.

func ParsePlanFile added in v0.16.0

func ParsePlanFile(path string) (*Plan, error)

ParsePlanFile reads and parses a plan file from disk.

func (*Plan) JSON added in v0.16.0

func (p *Plan) JSON() ([]byte, error)

JSON returns the plan as JSON bytes.

type Selector

type Selector struct {
	PlansDir string
	Colors   *progress.Colors
}

Selector handles plan file selection and resolution.

func NewSelector

func NewSelector(plansDir string, colors *progress.Colors) *Selector

NewSelector creates a new Selector with the given plans directory and colors.

func (*Selector) FindRecent

func (s *Selector) FindRecent(startTime time.Time) string

FindRecent finds the most recently modified plan file in the plans directory that was modified after the given start time.

func (*Selector) Select

func (s *Selector) Select(ctx context.Context, planFile string, optional bool) (string, error)

Select selects and prepares a plan file. if planFile is provided, validates it exists and returns absolute path. if planFile is empty and optional is true, returns empty string without error. if planFile is empty and optional is false, uses fzf for selection.

type Task added in v0.16.0

type Task struct {
	Number     int        `json:"number"`
	Title      string     `json:"title"`
	Status     TaskStatus `json:"status"`
	Checkboxes []Checkbox `json:"checkboxes"`
}

Task represents a task section in a plan.

type TaskStatus added in v0.16.0

type TaskStatus string

TaskStatus represents the execution status of a task.

const (
	TaskStatusPending TaskStatus = "pending"
	TaskStatusActive  TaskStatus = "active"
	TaskStatusDone    TaskStatus = "done"
	TaskStatusFailed  TaskStatus = "failed"
)

task status constants.

func DetermineTaskStatus added in v0.16.0

func DetermineTaskStatus(checkboxes []Checkbox) TaskStatus

DetermineTaskStatus calculates task status based on checkbox states.

Jump to

Keyboard shortcuts

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