Documentation
¶
Overview ¶
Package sprint implements AI-powered sprint planning with velocity-based grouping. It groups pending tasks into time-boxed sprints using velocity data from the forecast package, deadlines, priorities, and task dependencies.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PlanPrompt ¶
PlanPrompt builds the AI prompt for sprint planning. It embeds velocity metrics, task list, deadlines, and dependencies.
func Save ¶
func Save(workDir string, sf *SprintFile) error
Save writes the SprintFile to .cloop/sprints.json atomically.
A torn write (crash mid-write, ENOSPC, two `sprint plan` runs racing) would leave a 0-byte or truncated file; the next Load would fail to parse and `cloop sprint list/show/burndown` would all silently lose the plan. The write is staged into a sibling .tmp file, fsynced, then renamed into place. The mutex serialises in-process writers; the rename serialises across processes.
Types ¶
type Sprint ¶
type Sprint struct {
ID int `json:"id"`
Name string `json:"name"`
Goal string `json:"goal"`
TaskIDs []int `json:"task_ids"`
EstimatedHours float64 `json:"estimated_hours"`
StartDate time.Time `json:"start_date"`
EndDate time.Time `json:"end_date"`
CreatedAt time.Time `json:"created_at"`
}
Sprint represents a time-boxed unit of work.
func Plan ¶
func Plan(ctx context.Context, p provider.Provider, s *state.ProjectState, f *forecast.Forecast, model string, sprintDays int, streamFn func(string)) ([]*Sprint, error)
Plan calls the AI provider to decompose pending tasks into sprints. It saves the result to .cloop/sprints.json and updates SprintID on each task.
type SprintFile ¶
type SprintFile struct {
Sprints []*Sprint `json:"sprints"`
UpdatedAt time.Time `json:"updated_at"`
}
SprintFile is the on-disk format for .cloop/sprints.json.
func Load ¶
func Load(workDir string) (*SprintFile, error)
Load reads sprints from .cloop/sprints.json. Returns an empty SprintFile if the file does not exist.
On parse failure (zero-byte file, manual edit gone wrong, schema drift) the corrupt file is quarantined aside as sprints.json.corrupt-<unix> and an empty SprintFile is returned. The next `cloop sprint plan` will recreate the file from current state — losing the planned sprints is preferable to breaking every `cloop sprint *` subcommand because of one bad save.