From 3ae5dc9e17e84e6efccba9a2c926ced822ab2872 Mon Sep 17 00:00:00 2001 From: Amolith Date: Thu, 8 Jan 2026 17:38:50 -0700 Subject: [PATCH] feat(area): add hint when goal list is truncated MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When any area has more than 3 goals, the table shows (+N). Users may not realize they can dig deeper. Now a conditional hint appears below the table: (+N) = more goals; run 'lune goal list -a AREA' to see all Only shown when truncation occurs, keeping the common case clean. Also documents in AGENTS.md that dim text (ANSI 8) should be avoided for accessibility—it's unreadable in many terminal color schemes. Assisted-by: Claude Opus 4.5 via Crush --- AGENTS.md | 3 +++ cmd/area/list.go | 19 ++++++++++++++----- internal/ui/styles.go | 1 + 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 67be37243c634d11b4fbb47b382722958b2a41db..6111ed3e386ca0f8055d47b8761c066ef3eff9a2 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -209,6 +209,9 @@ Use `cmd.OutOrStdout()` and `cmd.ErrOrStderr()` for testability. Styles are in `internal/ui/styles.go`—use `ui.Success`, `ui.Error`, etc. rather than inline colors. +**Accessibility**: Avoid dim text (ANSI color 8)—it's unreadable in many terminal +color schemes. Use italic or other formatting for de-emphasized text instead. + ## Testing Table-driven tests with `t.Parallel()`. Use `_test` package suffix for black-box diff --git a/cmd/area/list.go b/cmd/area/list.go index 4cef09f0631b5528f1c77752ed65cedcfab4b1da..e634763a4cb3261e30392c77d199db0e851d2a91 100644 --- a/cmd/area/list.go +++ b/cmd/area/list.go @@ -63,9 +63,14 @@ func outputJSON(cmd *cobra.Command, areas []config.Area) error { func outputTable(cmd *cobra.Command, areas []config.Area) error { rows := make([][]string, 0, len(areas)) + truncated := false for _, area := range areas { - goals := formatGoals(area.Goals) + goals, wasTruncated := formatGoals(area.Goals) + if wasTruncated { + truncated = true + } + rows = append(rows, []string{area.Key, area.Name, goals}) } @@ -83,12 +88,16 @@ func outputTable(cmd *cobra.Command, areas []config.Area) error { fmt.Fprintln(cmd.OutOrStdout(), tbl.Render()) + if truncated { + fmt.Fprintln(cmd.OutOrStdout(), ui.Hint.Render("(+N) = more goals; run 'lune goal list -a AREA' to see all")) + } + return nil } -func formatGoals(goals []config.Goal) string { +func formatGoals(goals []config.Goal) (string, bool) { if len(goals) == 0 { - return "-" + return "-", false } keys := make([]string, len(goals)) @@ -97,10 +106,10 @@ func formatGoals(goals []config.Goal) string { } if len(keys) <= 3 { - return joinKeys(keys) + return joinKeys(keys), false } - return joinKeys(keys[:3]) + fmt.Sprintf(" (+%d)", len(keys)-3) + return joinKeys(keys[:3]) + fmt.Sprintf(" (+%d)", len(keys)-3), true } func joinKeys(keys []string) string { diff --git a/internal/ui/styles.go b/internal/ui/styles.go index 1cd984e86cfcd3674cf20a57ada97099c66af49f..cc2b39579cb4fcde9288b71485f1b8a3fba71029 100644 --- a/internal/ui/styles.go +++ b/internal/ui/styles.go @@ -42,6 +42,7 @@ var ( Warning = Style{lipgloss.NewStyle().Foreground(lipgloss.Color("3"))} // yellow Error = Style{lipgloss.NewStyle().Foreground(lipgloss.Color("1"))} // red Bold = Style{lipgloss.NewStyle().Bold(true)} + Hint = Style{lipgloss.NewStyle().Italic(true)} ) // Heading styles with backgrounds for contrast on any theme.