lune

created pr with 124.1 on 2026-04-22T02:46:44Z · by 613b58b7
changed status to closed on 2026-06-21T16:45:31Z · by 66ddd677
Closing as superceded by 126
cmds
checkout latest patchset:
ssh pr.pico.sh print 124 | git am -3
checkout any patchset in a patch request:
ssh pr.pico.sh print 124.[rev] | git am -3
add changes to patch request:
git format-patch main --stdout | ssh pr.pico.sh pr add 124
set PR to open (enables RSS notifications):
ssh pr.pico.sh pr open 124
set PR to draft (stops RSS notifications):
ssh pr.pico.sh pr draft 124

Patchset 124.1 on 2026-04-22T02:46:44Z · commit 3b582e6

listing real name of tasks
juan 2026-04-21T03:21:16Z
construction of db for management of decrypted names of tasks
juan 2026-04-21T05:43:09Z
fix UTF8 chracteres
juan 2026-04-21T21:13:24Z
filter by status and coloring types of status
juan 2026-04-21T21:18:53Z
update help
juan 2026-04-21T21:21:36Z
list areas names
juan 2026-04-21T21:44:53Z
adjust table tasks to truncate name and list area
juan 2026-04-21T21:56:40Z
partial implementation of listing tasks by areas
juan 2026-04-21T22:05:20Z
final implementation of listing tasks by areas with UTF-8 chracteres
juan 2026-04-21T22:10:20Z
sort on task list to show first do now
juan 2026-04-21T22:33:29Z
update with 8 char of id and db.go
juan 2026-04-21T23:27:54Z
partial implementation of TUI menu on task update
juan 2026-04-21T23:35:35Z
task name correcion on TUI menu of Update task
juan 2026-04-21T23:38:19Z
TUI menu for update task with others flags
juan 2026-04-21T23:43:02Z
helper for TUI update task
juan 2026-04-21T23:49:56Z
search by first 8 char of note id for editing it
juan 2026-04-22T00:00:17Z
partial implementation on note TUI menu for update
juan 2026-04-22T00:05:46Z
TUI menu notebook just with tags
juan 2026-04-22T00:20:55Z
Note update now let you insert only the first 8 char of notebook id in update
juan 2026-04-22T00:25:53Z
implementation of (lune note notebook-list) for listing all notebooks and its ID
juan 2026-04-22T01:10:51Z
partial implementation of lune note show-content ID
juan 2026-04-22T02:01:11Z
convert \n in new line and \ in space for lune note show-content ID
juan 2026-04-22T02:18:42Z
+5 -3 cmd/area/list.go #
......@@ -25,14 +25,16 @@ type displayArea struct {
2525
2626 // ListCmd lists configured areas and their goals.
2727 var ListCmd = &cobra.Command{
28- Use: "list",
29- Short: "List areas",
28+ Use: "list",
29+ Aliases: []string{"lista"},
30+ Short: "List areas",
3031 Long: `List areas configured in lune or found in your local database.
3132
3233 Proactive Features:
3334 - Local Database Discovery: Automatically lists all areas from your Lunatask
3435 database if experimental mode is enabled.`,
35- RunE: runList,
36+ RunE: runList,
37+ SilenceUsage: true,
3638 }
3739
3840 func init() {
+48 -40 cmd/goal/list.go #
......@@ -10,6 +10,7 @@ import (
1010
1111 "git.secluded.site/lune/internal/completion"
1212 "git.secluded.site/lune/internal/config"
13+ "git.secluded.site/lune/internal/db"
1314 "git.secluded.site/lune/internal/ui"
1415 "github.com/charmbracelet/lipgloss"
1516 "github.com/charmbracelet/lipgloss/table"
......@@ -18,13 +19,16 @@ import (
1819
1920 // ListCmd lists configured goals.
2021 var ListCmd = &cobra.Command{
21- Use: "list",
22- Short: "List configured goals",
23- Long: `List goals configured in lune.
22+ Use: "list [AREA]",
23+ Aliases: []string{"lista"},
24+ Short: "List goals",
25+ Long: `List goals configured in lune or found in your local database.
2426
2527 By default, shows goals from the default area (if configured).
26-Use --area to specify a different area, or --all to show all goals.`,
27- RunE: runList,
28+Use --area or provide the area name as an argument to filter.`,
29+ Args: cobra.MaximumNArgs(1),
30+ RunE: runList,
31+ SilenceUsage: true,
2832 }
2933
3034 func init() {
......@@ -35,30 +39,55 @@ func init() {
3539 _ = ListCmd.RegisterFlagCompletionFunc("area", completion.Areas)
3640 }
3741
38-func runList(cmd *cobra.Command, _ []string) error {
42+func runList(cmd *cobra.Command, args []string) error {
3943 cfg, err := config.Load()
4044 if err != nil {
4145 return err
4246 }
4347
44- areaKey, _ := cmd.Flags().GetString("area")
45- showAll, _ := cmd.Flags().GetBool("all")
46- usingDefault := areaKey == "" && !showAll && cfg.Defaults.Area != ""
47-
48- areas := filterAreas(cfg, areaKey, showAll)
49- if len(areas) == 0 {
50- fmt.Fprintln(cmd.OutOrStdout(), "No areas found")
48+ if cfg != nil && cfg.Experimental.LocalDB {
49+ _ = db.WarmCache()
50+ }
5151
52- return nil
52+ areaInput := ""
53+ if len(args) > 0 {
54+ areaInput = args[0]
55+ } else {
56+ areaInput, _ = cmd.Flags().GetString("area")
5357 }
5458
55- goals := collectGoals(areas)
56- if len(goals) == 0 {
57- if usingDefault {
58- fmt.Fprintf(cmd.OutOrStdout(), "No goals configured in %s area\n", cfg.Defaults.Area)
59+ showAll, _ := cmd.Flags().GetBool("all")
60+
61+ var areas []config.Area
62+ if showAll {
63+ areas = cfg.Areas
64+ } else {
65+ targetAreaID := ""
66+ if areaInput == "" && cfg.Defaults.Area != "" {
67+ areaInput = cfg.Defaults.Area
68+ }
69+
70+ if areaInput != "" {
71+ // Try config
72+ if a := cfg.AreaByKey(areaInput); a != nil {
73+ targetAreaID = a.ID
74+ areas = []config.Area{*a}
75+ } else {
76+ // Try proactive DB
77+ targetAreaID = db.FindAreaIDByName(areaInput)
78+ if targetAreaID != "" {
79+ // We found an area in DB that isn't in config,
80+ // we create a temporary config.Area to show its goals
81+ areas = []config.Area{{ID: targetAreaID, Name: areaInput, Key: "-"}}
82+ }
83+ }
5984 } else {
60- fmt.Fprintln(cmd.OutOrStdout(), "No goals configured")
85+ areas = cfg.Areas
6186 }
87+ }
88+ goals := collectGoals(areas)
89+ if len(goals) == 0 {
90+ fmt.Fprintln(cmd.OutOrStdout(), "No goals configured")
6291
6392 return nil
6493 }
......@@ -78,27 +107,6 @@ type goalWithArea struct {
78107 AreaKey string `json:"area_key"`
79108 }
80109
81-func filterAreas(cfg *config.Config, areaKey string, showAll bool) []config.Area {
82- if showAll {
83- return cfg.Areas
84- }
85-
86- if areaKey == "" {
87- areaKey = cfg.Defaults.Area
88- }
89-
90- if areaKey == "" {
91- return cfg.Areas
92- }
93-
94- area := cfg.AreaByKey(areaKey)
95- if area == nil {
96- return nil
97- }
98-
99- return []config.Area{*area}
100-}
101-
102110 func collectGoals(areas []config.Area) []goalWithArea {
103111 var goals []goalWithArea
104112
+5 -3 cmd/note/list.go #
......@@ -27,15 +27,17 @@ type enrichedNote struct {
2727
2828 // ListCmd lists notes. Exported for potential use by shortcuts.
2929 var ListCmd = &cobra.Command{
30- Use: "list",
31- Short: "List notes",
30+ Use: "list",
31+ Aliases: []string{"lista"},
32+ Short: "List notes",
3233 Long: `List notes from Lunatask.
3334
3435 Proactive Features:
3536 - Local Database Enrichment: Retrieves real note and notebook names
3637 from your local database using your master password.
3738 - Organized View: Shows notes grouped by their original notebooks.`,
38- RunE: runList,
39+ RunE: runList,
40+ SilenceUsage: true,
3941 }
4042
4143 func init() {
+40 -27 cmd/task/list.go #
......@@ -8,11 +8,11 @@ import (
88 "encoding/json"
99 "errors"
1010 "fmt"
11+ "strings"
1112 "time"
1213
1314 "git.secluded.site/go-lunatask"
1415 "git.secluded.site/lune/internal/client"
15- "git.secluded.site/lune/internal/completion"
1616 "git.secluded.site/lune/internal/config"
1717 "git.secluded.site/lune/internal/db"
1818 "git.secluded.site/lune/internal/ui"
......@@ -32,19 +32,26 @@ var ErrUnknownArea = errors.New("unknown area key")
3232
3333 // ListCmd lists tasks. Exported for potential use by shortcuts.
3434 var ListCmd = &cobra.Command{
35- Use: "list",
36- Short: "List tasks",
35+ Use: "list [AREA]",
36+ Aliases: []string{"lista"},
37+ Short: "List tasks",
3738 Long: `List tasks from Lunatask.
3839
3940 By default, shows incomplete tasks and tasks completed today.
4041 Use --all to show entire task history.
4142
43+You can filter by area by providing its name as an argument
44+or using the --area flag.
45+
4246 Proactive Features:
4347 - Local Database Enrichment: If enabled in config and master password is set,
4448 real task names are retrieved from your local Lunatask database.
4549 - Status Coloring: Tasks are color-coded by their current status.
46- - Scheduled Filtering: Filter tasks by when they are planned (today, tomorrow, or date).`,
47- RunE: runList,
50+ - Scheduled Filtering: Filter tasks by when they are planned (today, tomorrow, or date).
51+ - Proactive Area Filtering: Filter by area names found in your local database.`,
52+ Args: cobra.MaximumNArgs(1),
53+ RunE: runList,
54+ SilenceUsage: true,
4855 }
4956
5057 func init() {
......@@ -53,12 +60,9 @@ func init() {
5360 ListCmd.Flags().StringP("scheduled", "d", "", "Filter by scheduled date (today, tomorrow, or YYYY-MM-DD)")
5461 ListCmd.Flags().Bool("all", false, "Show all tasks including completed")
5562 ListCmd.Flags().Bool("json", false, "Output as JSON")
56-
57- _ = ListCmd.RegisterFlagCompletionFunc("area", completion.Areas)
58- _ = ListCmd.RegisterFlagCompletionFunc("status", completion.TaskStatuses)
5963 }
6064
61-func runList(cmd *cobra.Command, _ []string) error {
65+func runList(cmd *cobra.Command, args []string) error {
6266 cfg, _ := config.Load()
6367 if cfg != nil && cfg.Experimental.LocalDB {
6468 _ = db.WarmCache()
......@@ -85,10 +89,11 @@ func runList(cmd *cobra.Command, _ []string) error {
8589 enriched = append(enriched, enrichedTask{Task: t, Name: name})
8690 }
8791
88- areaID, err := resolveAreaFilter(cmd)
92+ areaID, err := resolveAreaFilterSmart(cmd, args)
8993 if err != nil {
9094 return err
9195 }
96+// ...
9297
9398 statusFilter, err := resolveStatusFilter(cmd)
9499 if err != nil {
......@@ -134,34 +139,42 @@ func mustGetBoolFlag(cmd *cobra.Command, name string) bool {
134139 return f.Value.String() == "true"
135140 }
136141
137-func resolveAreaFilter(cmd *cobra.Command) (string, error) {
138- areaKey := mustGetStringFlag(cmd, "area")
142+func resolveAreaFilterSmart(cmd *cobra.Command, args []string) (string, error) {
143+ areaInput := ""
144+ if len(args) > 0 {
145+ areaInput = args[0]
146+ } else {
147+ areaInput = mustGetStringFlag(cmd, "area")
148+ }
139149
140- cfg, err := config.Load()
141- if err != nil {
142- if errors.Is(err, config.ErrNotFound) {
143- if areaKey != "" {
144- return "", err
145- }
150+ if areaInput == "" {
151+ cfg, err := config.Load()
152+ if err == nil && cfg.Defaults.Area != "" {
153+ areaInput = cfg.Defaults.Area
154+ } else {
146155 return "", nil
147156 }
148- return "", err
149157 }
150158
151- if areaKey == "" {
152- areaKey = cfg.Defaults.Area
159+ cfg, err := config.Load()
160+ if err == nil {
161+ area := cfg.AreaByKey(areaInput)
162+ if area != nil {
163+ return area.ID, nil
164+ }
153165 }
154166
155- if areaKey == "" {
156- return "", nil
167+ // Try local DB (proactive)
168+ if id := db.FindAreaIDByName(areaInput); id != "" {
169+ return id, nil
157170 }
158171
159- area := cfg.AreaByKey(areaKey)
160- if area == nil {
161- return "", fmt.Errorf("%w: %s", ErrUnknownArea, areaKey)
172+ // Fallback to error if it's not a UUID
173+ if len(areaInput) == 36 && strings.Count(areaInput, "-") == 4 {
174+ return areaInput, nil
162175 }
163176
164- return area.ID, nil
177+ return "", fmt.Errorf("%w: %s", ErrUnknownArea, areaInput)
165178 }
166179
167180 func resolveStatusFilter(cmd *cobra.Command) (string, error) {
+22 -1 internal/db/reader.go #
......@@ -118,7 +118,28 @@ func WarmCache() error {
118118 return nil
119119 }
120120
121-// EnrichTask attempts to find the task or note name in the cache or local database.
121+// FindAreaIDByName searches for an area ID by its name in the cache.
122+func FindAreaIDByName(name string) string {
123+ if !cacheWarmed {
124+ _ = WarmCache()
125+ }
126+
127+ nameLower := strings.ToLower(name)
128+ for id, n := range nameCache {
129+ if strings.ToLower(n) == nameLower {
130+ return id
131+ }
132+ }
133+ // Try partial match if no exact match
134+ for id, n := range nameCache {
135+ if strings.Contains(strings.ToLower(n), nameLower) {
136+ return id
137+ }
138+ }
139+ return ""
140+}
141+
142+// EnrichTask attempts to find the task or note name in the cache.
122143 func EnrichTask(taskID string) (string, error) {
123144 if !cacheWarmed {
124145 _ = WarmCache()
Back to top