perf: replace O(n²) bubble sort with O(n log n) sort.Slice

Amolith created

Replace inefficient bubble sort implementation in formatTaskListWithFilter
with Go's standard library sort.Slice for better performance and readability.

- Improves time complexity from O(n²) to O(n log n)
- Reduces code from 7 lines to 3 lines
- Uses idiomatic Go standard library patterns
- Maintains identical sorting behavior (oldest tasks first)
- Passes all linting and static analysis checks

Change summary

internal/planning/manager.go | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)

Detailed changes

internal/planning/manager.go 🔗

@@ -7,6 +7,7 @@ package planning
 import (
 	"fmt"
 	"log/slog"
+	"sort"
 	"strings"
 	"sync"
 	"time"
@@ -268,14 +269,10 @@ func (m *Manager) formatTaskListWithFilter(filterStatus *TaskStatus) string {
 	}
 	lines = append(lines, legend)
 
-	// Simple sort by creation time (newest first could be changed if needed)
-	for i := range len(taskList) {
-		for j := i + 1; j < len(taskList); j++ {
-			if taskList[i].CreatedAt.After(taskList[j].CreatedAt) {
-				taskList[i], taskList[j] = taskList[j], taskList[i]
-			}
-		}
-	}
+	// Sort tasks by creation time (oldest first for consistent ordering)
+	sort.Slice(taskList, func(i, j int) bool {
+		return taskList[i].CreatedAt.Before(taskList[j].CreatedAt)
+	})
 
 	for _, task := range taskList {
 		line := fmt.Sprintf("%s %s [%s]", task.Status.String(), task.Title, task.ID)