Implement urgency system with TaskWarrior-inspired calculation

- Add urgency calculation based on multiple factors:
  * Due date (linear scale: overdue=12.0, today=10.0, week=6.0, 2weeks=2.0)
  * Priority (H=6.0, M=3.9, D=1.8, L=0.0)
  * Age (0-2.0 over 365 days)
  * Active status (+4.0 boost)
  * Waiting status (-3.0 penalty)
  * Tags (+1.0 with count modifier)
  * Project assignment (+1.0)
  * Configurable urgent tag (default 'next', +15.0)

- Replace priority column with urgency in all reports
  * Display as decimal with 1 decimal place
  * 4-tier color coding: ≥10 (bright red), ≥5 (red), ≥2 (yellow), <2 (cyan)
  * Minimal format color-coded by urgency

- Add default urgency sorting to all reports
  * list, minimal, active, ready, overdue reports sort by urgency
  * newest/oldest keep date-based sorting

- Implement 'next' report
  * Shows most urgent ready tasks
  * Configurable limit (default 5)
  * Only includes tasks ready to work on (no future wait/scheduled)

- Add urgency display to info command
  * Shows urgency score alongside priority

- All urgency coefficients configurable via config
  * Adjusted defaults for Opal's simpler model (no blocking/annotations)
  * Configurable urgent tag name (not hardcoded to 'next')

Priority order maintained: High > Medium > Default > Low
This commit is contained in:
2026-01-06 14:32:44 +01:00
parent 1c3186a342
commit 8f6db4672a
5 changed files with 361 additions and 6 deletions
+48
View File
@@ -18,6 +18,22 @@ type Config struct {
WeekStartDay string `mapstructure:"week_start_day"`
DefaultDueTime string `mapstructure:"default_due_time"`
// Urgency coefficients
UrgencyDue float64 `mapstructure:"urgency_due_coefficient"`
UrgencyPriorityH float64 `mapstructure:"urgency_priority_h_coefficient"`
UrgencyPriorityM float64 `mapstructure:"urgency_priority_m_coefficient"`
UrgencyPriorityD float64 `mapstructure:"urgency_priority_d_coefficient"`
UrgencyPriorityL float64 `mapstructure:"urgency_priority_l_coefficient"`
UrgencyActive float64 `mapstructure:"urgency_active_coefficient"`
UrgencyAge float64 `mapstructure:"urgency_age_coefficient"`
UrgencyAgeMax int `mapstructure:"urgency_age_max"`
UrgencyTags float64 `mapstructure:"urgency_tags_coefficient"`
UrgencyProject float64 `mapstructure:"urgency_project_coefficient"`
UrgencyWaiting float64 `mapstructure:"urgency_waiting_coefficient"`
UrgencyUrgentTag string `mapstructure:"urgency_urgent_tag"`
UrgencyUrgentCoeff float64 `mapstructure:"urgency_urgent_coefficient"`
NextLimit int `mapstructure:"next_limit"`
// Sync settings
SyncEnabled bool `mapstructure:"sync_enabled"`
SyncURL string `mapstructure:"sync_url"`
@@ -89,6 +105,22 @@ func LoadConfig() (*Config, error) {
v.SetDefault("week_start_day", "monday")
v.SetDefault("default_due_time", "")
// Urgency defaults (adjusted for Opal's simpler model)
v.SetDefault("urgency_due_coefficient", 12.0)
v.SetDefault("urgency_priority_h_coefficient", 6.0)
v.SetDefault("urgency_priority_m_coefficient", 3.9)
v.SetDefault("urgency_priority_d_coefficient", 1.8)
v.SetDefault("urgency_priority_l_coefficient", 0.0)
v.SetDefault("urgency_active_coefficient", 4.0)
v.SetDefault("urgency_age_coefficient", 2.0)
v.SetDefault("urgency_age_max", 365)
v.SetDefault("urgency_tags_coefficient", 1.0)
v.SetDefault("urgency_project_coefficient", 1.0)
v.SetDefault("urgency_waiting_coefficient", -3.0)
v.SetDefault("urgency_urgent_tag", "next")
v.SetDefault("urgency_urgent_coefficient", 15.0)
v.SetDefault("next_limit", 5)
// Sync defaults
v.SetDefault("sync_enabled", false)
v.SetDefault("sync_url", "")
@@ -138,6 +170,22 @@ func SaveConfig(cfg *Config) error {
v.Set("week_start_day", cfg.WeekStartDay)
v.Set("default_due_time", cfg.DefaultDueTime)
// Urgency settings
v.Set("urgency_due_coefficient", cfg.UrgencyDue)
v.Set("urgency_priority_h_coefficient", cfg.UrgencyPriorityH)
v.Set("urgency_priority_m_coefficient", cfg.UrgencyPriorityM)
v.Set("urgency_priority_d_coefficient", cfg.UrgencyPriorityD)
v.Set("urgency_priority_l_coefficient", cfg.UrgencyPriorityL)
v.Set("urgency_active_coefficient", cfg.UrgencyActive)
v.Set("urgency_age_coefficient", cfg.UrgencyAge)
v.Set("urgency_age_max", cfg.UrgencyAgeMax)
v.Set("urgency_tags_coefficient", cfg.UrgencyTags)
v.Set("urgency_project_coefficient", cfg.UrgencyProject)
v.Set("urgency_waiting_coefficient", cfg.UrgencyWaiting)
v.Set("urgency_urgent_tag", cfg.UrgencyUrgentTag)
v.Set("urgency_urgent_coefficient", cfg.UrgencyUrgentCoeff)
v.Set("next_limit", cfg.NextLimit)
// Sync settings
v.Set("sync_enabled", cfg.SyncEnabled)
v.Set("sync_url", cfg.SyncURL)