planner

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package planner implements structured planning that generates artifacts before coding begins. It produces a Plan containing tasks, design notes, and risk analysis, and can persist/load plans as JSON files under .hawk/plans/.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatMarkdown

func FormatMarkdown(plan *Plan) string

FormatMarkdown renders the plan as readable markdown.

func MarkDone

func MarkDone(plan *Plan, taskID int)

MarkDone marks a task as completed. If the taskID is not found, this is a no-op.

func MarkSkipped

func MarkSkipped(plan *Plan, taskID int)

MarkSkipped marks a task as skipped. If the taskID is not found, this is a no-op.

func Save

func Save(dir string, plan *Plan) (string, error)

Save writes the plan to .hawk/plans/{sanitized-title}.json under the given dir. Returns the path of the saved file.

Types

type Plan

type Plan struct {
	Title     string    `json:"title"`
	Summary   string    `json:"summary"`
	Tasks     []Task    `json:"tasks"`
	Design    string    `json:"design"`     // high-level design notes
	RiskNotes string    `json:"risk_notes"` // identified risks and mitigations
	CreatedAt time.Time `json:"created_at"`
}

Plan represents a structured development plan.

func Load

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

Load reads a plan from disk.

func ParsePlan

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

ParsePlan parses the LLM response into a structured Plan. It handles responses that may be wrapped in markdown code fences.

type PlanPrompt

type PlanPrompt struct {
	System string
	User   string
}

PlanPrompt contains the prompt to send to the LLM for plan generation.

func Generate

func Generate(description string, repoContext string) *PlanPrompt

Generate creates a PlanPrompt from a feature description and repository context. This is a template -- the actual LLM call happens in hawk's engine.

type Task

type Task struct {
	ID          int    `json:"id"`
	Description string `json:"description"`
	File        string `json:"file,omitempty"`    // target file
	Status      string `json:"status"`            // pending, done, skipped
	Depends     []int  `json:"depends,omitempty"` // IDs of tasks this depends on
}

Task represents a single unit of work within a plan.

func PendingTasks

func PendingTasks(plan *Plan) []Task

PendingTasks returns all tasks that are still pending.

Jump to

Keyboard shortcuts

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