reorder

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package reorder implements AI-powered task priority re-ranking for PM mode. It asks the AI to analyze the current plan state (completed tasks, project history, dependency graph) and return an optimal execution order for all pending tasks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyOrder

func ApplyOrder(plan *pm.Plan, rankedTasks []RankedTask) error

ApplyOrder reassigns priorities to pending tasks based on the AI-provided order. Tasks are assigned priorities 1, 2, 3, ... in the given order. Non-pending tasks (done/skipped/failed) are left unchanged. Returns an error if any ID in orderedIDs is not found in the plan.

func OrderedPendingIDs

func OrderedPendingIDs(plan *pm.Plan) []int

OrderedPendingIDs returns the IDs of all pending tasks sorted by current priority.

func ReorderPrompt

func ReorderPrompt(plan *pm.Plan, gitLog string) string

ReorderPrompt builds the prompt sent to the AI provider. It includes: goal, completed task summaries, pending task descriptions, dependency graph, and git history context (passed in as gitLog).

Types

type RankedTask

type RankedTask struct {
	ID        int    `json:"id"`
	Rationale string `json:"rationale"`
}

RankedTask is one entry in the AI's reorder response.

func Reorder

func Reorder(ctx context.Context, prov provider.Provider, opts provider.Options, plan *pm.Plan, gitLog string) ([]RankedTask, error)

Reorder calls the AI provider to re-rank all pending tasks in the plan. Returns the ordered list of RankedTask entries.

type ReorderResponse

type ReorderResponse struct {
	Order []RankedTask `json:"order"`
}

ReorderResponse is the full JSON structure returned by the AI.

Jump to

Keyboard shortcuts

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