Documentation
¶
Overview ¶
Package next scores and ranks actionable tasks to recommend what to work on.
Tasks are scored based on priority, critical-path position, downstream impact, and effort. Only tasks whose dependencies are satisfied are considered.
Effort points scale with the value's position in the project's configured vocabulary (an github.com/driangle/taskmd/sdk/go/effort.Scale): the lowest value earns the most and the highest earns none. The lowest value is also what Options.QuickWins selects.
Index ¶
- Constants
- func BuildChildrenMap(tasks []*model.Task) map[string][]*model.Task
- func BuildTaskMap(tasks []*model.Task) map[string]*model.Task
- func CalculateCriticalPathTasks(tasks []*model.Task, taskMap map[string]*model.Task) map[string]bool
- func ComputeDownstreamInfo(tasks []*model.Task) map[string]DownstreamInfo
- func HasIncompleteChildren(task *model.Task, childrenMap map[string][]*model.Task) bool
- func HasUnmetDependencies(task *model.Task, taskMap map[string]*model.Task) bool
- func IsActionable(task *model.Task, taskMap map[string]*model.Task, ...) bool
- func ScoreTask(task *model.Task, criticalPath map[string]bool, ...) (int, []string)
- type DownstreamInfo
- type Options
- type Recommendation
- type ScoreComponent
Constants ¶
const ( ScorePriorityCritical = 40 ScorePriorityHigh = 30 ScorePriorityMedium = 20 ScorePriorityLow = 10 ScoreCriticalPath = 15 ScorePerDownstream = 3 ScoreDownstreamMax = 15 // ScoreEffortMax is the score awarded to the lowest effort value in the // project's vocabulary. Higher values earn proportionally less, down to // zero for the highest. See effort.Scale.Points. ScoreEffortMax = 5 // ScoreEffortSmall and ScoreEffortMedium are the points the default // three-value vocabulary awards to small and medium effort. Retained as // named constants for callers and tests; both derive from ScoreEffortMax. ScoreEffortSmall = ScoreEffortMax ScoreEffortMedium = ScoreEffortMax / 2 ScorePhaseBase = 25 ScorePhaseDecay = 5 )
Scoring constants
Variables ¶
This section is empty.
Functions ¶
func BuildChildrenMap ¶
BuildChildrenMap creates a map from parent task ID to its child tasks.
func BuildTaskMap ¶
BuildTaskMap creates a map of task ID to task.
func CalculateCriticalPathTasks ¶
func CalculateCriticalPathTasks(tasks []*model.Task, taskMap map[string]*model.Task) map[string]bool
CalculateCriticalPathTasks identifies tasks on the critical path.
func ComputeDownstreamInfo ¶
func ComputeDownstreamInfo(tasks []*model.Task) map[string]DownstreamInfo
ComputeDownstreamInfo computes downstream counts and max priority for each task.
func HasIncompleteChildren ¶
HasIncompleteChildren returns true if the task has any children that are not resolved.
func HasUnmetDependencies ¶
HasUnmetDependencies checks if any dependency is not completed.
Types ¶
type DownstreamInfo ¶
DownstreamInfo holds both the count and max priority of downstream tasks.
type Options ¶
type Options struct {
Limit int
Filters []string
QuickWins bool
Critical bool
Scope string
ScopeExact bool
Root string
ArchivedTasks []*model.Task
Phase string
PhaseOrder []string
StrictPhases bool
StrictPriority bool
// Efforts is the project's effort vocabulary. The zero value means the
// default small, medium, large.
Efforts effort.Scale
// Excluded maps task IDs to a reason they must not be recommended even
// when otherwise actionable. Excluded tasks still participate in
// dependency and children resolution. Recommend uses only the keys; the
// reason text belongs to the caller.
Excluded map[string]string
}
Options controls recommendation behaviour.
type Recommendation ¶
type Recommendation struct {
Rank int `json:"rank" yaml:"rank"`
ID string `json:"id" yaml:"id"`
Title string `json:"title" yaml:"title"`
FilePath string `json:"file_path" yaml:"file_path"`
Status string `json:"status" yaml:"status"`
Priority string `json:"priority" yaml:"priority"`
Effort string `json:"effort,omitempty" yaml:"effort,omitempty"`
Score int `json:"score" yaml:"score"`
Reasons []string `json:"reasons" yaml:"reasons"`
ScoreBreakdown []ScoreComponent `json:"score_breakdown" yaml:"score_breakdown"`
DownstreamCount int `json:"downstream_count" yaml:"downstream_count"`
OnCriticalPath bool `json:"on_critical_path" yaml:"on_critical_path"`
}
Recommendation represents a scored task recommendation.
type ScoreComponent ¶
type ScoreComponent struct {
Label string `json:"label" yaml:"label"`
Points int `json:"points" yaml:"points"`
Base int `json:"base,omitempty" yaml:"base,omitempty"`
Multiplier float64 `json:"multiplier,omitempty" yaml:"multiplier,omitempty"`
}
ScoreComponent is a single itemized contribution to a task's score. Base and Multiplier are populated for scaled bonuses (critical path, downstream) so the scaling is explainable; for flat components they are zero and omitted. Points is always the actual points contributed.
func ScoreTaskBreakdown ¶
func ScoreTaskBreakdown( task *model.Task, criticalPath map[string]bool, downstreamInfo map[string]DownstreamInfo, efforts effort.Scale, ) []ScoreComponent
ScoreTaskBreakdown returns the itemized scoring components for an actionable task (priority, critical path, downstream, effort). Their points sum to the score returned by ScoreTask. Phase scoring is added separately by callers.