refactor(task): use string-based priority flag

Amolith created

Replace int priority flag (-2 to 2) with string values (lowest, low,
normal, high, highest) using lunatask.ParsePriority. Add shell
completion for priority values.

Assisted-by: Claude Opus 4 via Crush

Change summary

cmd/task/add.go | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)

Detailed changes

cmd/task/add.go 🔗

@@ -43,7 +43,7 @@ func init() {
 	AddCmd.Flags().StringP("goal", "g", "", "Goal key (from config)")
 	AddCmd.Flags().StringP("status", "s", "", "Status: later, next, started, waiting")
 	AddCmd.Flags().StringP("note", "n", "", "Task note (use - for stdin)")
-	AddCmd.Flags().IntP("priority", "p", 0, "Priority: -2 to 2")
+	AddCmd.Flags().StringP("priority", "p", "", "Priority: lowest, low, normal, high, highest")
 	AddCmd.Flags().IntP("estimate", "e", 0, "Estimate in minutes (0-720)")
 	AddCmd.Flags().StringP("motivation", "m", "", "Motivation: must, should, want")
 	AddCmd.Flags().Bool("important", false, "Mark as important (Eisenhower matrix)")
@@ -56,6 +56,8 @@ func init() {
 	_ = AddCmd.RegisterFlagCompletionFunc("goal", completion.Goals)
 	_ = AddCmd.RegisterFlagCompletionFunc("status",
 		completion.Static("later", "next", "started", "waiting"))
+	_ = AddCmd.RegisterFlagCompletionFunc("priority",
+		completion.Static("lowest", "low", "normal", "high", "highest"))
 	_ = AddCmd.RegisterFlagCompletionFunc("motivation",
 		completion.Static("must", "should", "want"))
 }
@@ -162,8 +164,13 @@ func applyOptionalFlags(cmd *cobra.Command, builder *lunatask.TaskBuilder) error
 		builder.WithNote(resolved)
 	}
 
-	if priority, _ := cmd.Flags().GetInt("priority"); priority != 0 {
-		builder.Priority(lunatask.Priority(priority))
+	if priority, _ := cmd.Flags().GetString("priority"); priority != "" {
+		p, err := lunatask.ParsePriority(priority)
+		if err != nil {
+			return err
+		}
+
+		builder.Priority(p)
 	}
 
 	if estimate, _ := cmd.Flags().GetInt("estimate"); estimate != 0 {