feat: add task history via log command and info integration

Add engine/history.go with GetTaskHistory and diff-style FormatTaskHistory
that compares consecutive change_log entries to show only what changed.
Add cmd/log.go command for full task history. Integrate last 5 history
entries into FormatTaskDetail (info view) as a "Recent Changes" section.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-19 13:56:55 +01:00
parent 7aaaa86a0a
commit 32cc05a546
4 changed files with 277 additions and 1 deletions
+20
View File
@@ -2,6 +2,7 @@ package engine
import (
"fmt"
"strings"
"time"
"github.com/fatih/color"
@@ -187,6 +188,25 @@ func FormatTaskDetail(task *Task) string {
}
}
// Recent changes from change_log (last 5)
if entries, err := GetTaskHistory(task.UUID); err == nil && len(entries) > 0 {
t.AppendSeparator()
// Show last 5 entries
start := 0
if len(entries) > 5 {
start = len(entries) - 5
}
historyStr := FormatTaskHistory(entries[start:])
lines := strings.Split(strings.TrimSpace(historyStr), "\n")
for i, line := range lines {
label := ""
if i == 0 {
label = "History"
}
t.AppendRow(table.Row{label, line})
}
}
return t.Render()
}