From a6f433e4f2d516c928a683a757afbbf6398d5a68 Mon Sep 17 00:00:00 2001 From: Amolith Date: Thu, 30 Oct 2025 10:26:04 -0600 Subject: [PATCH] fix(cmd/t): show only tasks without goal header Implements: 87aeb06 Co-authored-by: Crush --- cmd/t/t.go | 14 +------------- internal/cli/plan.go | 20 ++++++++++++++++---- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/cmd/t/t.go b/cmd/t/t.go index 116e99481174de9931a7f67a89e8f9b35ed655ea..8d3997e40671234b397774f589d52e76ce8cd092 100644 --- a/cmd/t/t.go +++ b/cmd/t/t.go @@ -57,18 +57,6 @@ func runListTasks(cmd *cobra.Command, _ []string) error { return err } - goalDoc, ok, err := env.LoadGoal(cmd.Context(), sessionDoc.SID) - if err != nil { - return err - } - - state := cli.PlanState{ - Tasks: tasks, - } - if ok { - state.Goal = &goalDoc - } - - _, _ = fmt.Fprint(cmd.OutOrStdout(), cli.RenderPlan(state)) + _, _ = fmt.Fprint(cmd.OutOrStdout(), cli.RenderTasksOnly(tasks)) return nil } diff --git a/internal/cli/plan.go b/internal/cli/plan.go index 9488bb9635fe21a04062a539ad5d9f77197c1843..a008243043690a7453bad91b4abd335581896c68 100644 --- a/internal/cli/plan.go +++ b/internal/cli/plan.go @@ -84,20 +84,32 @@ func RenderPlan(state PlanState) string { b.WriteString("No goal set yet\n\n") } - legend := buildLegend(state.Tasks) + b.WriteString(renderTaskList(state.Tasks)) + return b.String() +} + +// RenderTasksOnly renders just the tasks without the goal header. +func RenderTasksOnly(tasks []task.Task) string { + return renderTaskList(tasks) +} + +func renderTaskList(tasks []task.Task) string { + var b strings.Builder + + legend := buildLegend(tasks) if legend != "" { b.WriteString("Legend: ") b.WriteString(legend) b.WriteString("\n") } - if len(state.Tasks) == 0 { + if len(tasks) == 0 { b.WriteString("No tasks yet.\n") return b.String() } - sorted := make([]task.Task, len(state.Tasks)) - copy(sorted, state.Tasks) + sorted := make([]task.Task, len(tasks)) + copy(sorted, tasks) sort.Slice(sorted, func(i, j int) bool { if sorted[i].CreatedSeq != sorted[j].CreatedSeq { return sorted[i].CreatedSeq < sorted[j].CreatedSeq