Documentation
¶
Overview ¶
Package priorityframeworks provides pluggable prioritization systems.
Built-in frameworks include Severity, Priority (P#), IETF RFC 2119, MoSCoW, and a General requirement framework. Users can choose which framework fits their organization's practices.
The position in the Levels slice implies priority order (index 0 = highest).
Index ¶
Constants ¶
const ( IDSeverity = "severity" IDPriority = "priority" IDIETF = "ietf" IDMoSCoW = "moscow" IDGeneral = "general" )
FrameworkID constants for built-in frameworks.
Variables ¶
This section is empty.
Functions ¶
func AllBuiltinIDs ¶
func AllBuiltinIDs() []string
AllBuiltinIDs returns all built-in framework IDs.
Types ¶
type Framework ¶
type Framework struct {
// ID is the unique identifier (e.g., "severity", "moscow").
ID string `json:"id" yaml:"id"`
// Name is the display name (e.g., "Severity", "MoSCoW").
Name string `json:"name" yaml:"name"`
// Description explains when to use this framework.
Description string `json:"description,omitempty" yaml:"description,omitempty"`
// Levels are ordered from highest to lowest priority.
// Index 0 is the highest priority level.
Levels []Level `json:"levels" yaml:"levels"`
}
Framework represents a prioritization system with ordered levels.
func General ¶
func General() *Framework
General returns a general-purpose requirement framework. Simple Required/Recommended/Optional/Avoid levels.
func IETF ¶
func IETF() *Framework
IETF returns the IETF RFC 2119 framework. Standard for requirement specification in technical documents. Ordered by implementation priority: actions to take, then actions to avoid.
func MoSCoW ¶
func MoSCoW() *Framework
MoSCoW returns the MoSCoW framework (Must/Should/Could/Won't). Common in agile and product management.
func Priority ¶
func Priority() *Framework
Priority returns the Priority framework (P0/P1/P2/P3/P4). Common in engineering teams for work prioritization.
func Severity ¶
func Severity() *Framework
Severity returns the Severity framework (Critical/High/Medium/Low/Informational). Common in security, incident response, and bug tracking.
func (*Framework) ActionableLevels ¶
ActionableLevels returns only levels where Actionable is true.
func (*Framework) Compare ¶
Compare compares two level identifiers within this framework. Returns: 1 if a > b (higher priority), -1 if a < b, 0 if equal. Returns 0 if either level is not found.
func (*Framework) IndexOf ¶
IndexOf returns the index of the level with the given ID or name. Returns -1 if not found.
type Level ¶
type Level struct {
// ID is the canonical identifier (e.g., "critical", "must", "p0").
ID string `json:"id" yaml:"id"`
// Name is the display name (e.g., "Critical", "MUST", "P0").
Name string `json:"name" yaml:"name"`
// Aliases are alternative names that parse to this level.
Aliases []string `json:"aliases,omitempty" yaml:"aliases,omitempty"`
// Actionable indicates whether items at this level require action.
// For example, "Critical" and "Must have" are actionable; "Informational" is not.
Actionable bool `json:"actionable" yaml:"actionable"`
// Color is the suggested display color (hex code).
Color string `json:"color,omitempty" yaml:"color,omitempty"`
}
Level represents a single priority level within a framework.
type NormalizedPriority ¶
type NormalizedPriority int
NormalizedPriority represents a normalized priority bucket (1-4). This allows comparison across different frameworks.
const ( NormalizedCritical NormalizedPriority = 4 // Highest NormalizedHigh NormalizedPriority = 3 NormalizedMedium NormalizedPriority = 2 NormalizedLow NormalizedPriority = 1 // Lowest )
func Normalize ¶
func Normalize(f *Framework, levelID string) NormalizedPriority
Normalize converts a level index to a normalized priority (1-4). This enables sorting and comparison across different frameworks.
The normalization maps the level's position in the framework to one of four buckets: Critical (4), High (3), Medium (2), Low (1).
func NormalizeIndex ¶
func NormalizeIndex(index, total int) NormalizedPriority
NormalizeIndex converts a level index and total count to normalized priority.
func (NormalizedPriority) String ¶
func (p NormalizedPriority) String() string
String returns the display name for the normalized priority.