()
| 591 | } |
| 592 | |
| 593 | func (cli *ChatCLI) listMemoryNotes() { |
| 594 | if cli.memoryStore == nil { |
| 595 | return |
| 596 | } |
| 597 | |
| 598 | memDir := filepath.Dir(cli.memoryStore.TodayNotePath()) |
| 599 | memDir = filepath.Dir(memDir) // up from YYYYMM to memory/ |
| 600 | |
| 601 | var files []string |
| 602 | _ = filepath.Walk(memDir, func(path string, info os.FileInfo, err error) error { |
| 603 | if err != nil { |
| 604 | return nil |
| 605 | } |
| 606 | if !info.IsDir() && strings.HasSuffix(path, ".md") && info.Name() != "MEMORY.md" { |
| 607 | rel, _ := filepath.Rel(memDir, path) |
| 608 | files = append(files, rel) |
| 609 | } |
| 610 | return nil |
| 611 | }) |
| 612 | |
| 613 | sort.Strings(files) |
| 614 | |
| 615 | longTerm := cli.memoryStore.ReadLongTerm() |
| 616 | mgr := cli.memoryStore.Manager() |
| 617 | |
| 618 | fmt.Println() |
| 619 | fmt.Println(colorize(" "+i18n.T("memory.header.files"), ColorCyan+ColorBold)) |
| 620 | fmt.Println(colorize(" ─────────────────────────────────────────", ColorGray)) |
| 621 | |
| 622 | if longTerm != "" { |
| 623 | factCount := mgr.Facts.Count() |
| 624 | fmt.Printf(" %s %s\n", colorize("*", ColorGreen), i18n.T("mem.cmd.list.memory_md_facts", factCount)) |
| 625 | } else { |
| 626 | fmt.Printf(" %s %s\n", colorize("o", ColorGray), i18n.T("mem.cmd.list.memory_md_empty")) |
| 627 | } |
| 628 | |
| 629 | // Show structured files |
| 630 | structuredFiles := []string{"user_profile.json", "topics.json", "projects.json", "usage_stats.json", "memory_index.json"} |
| 631 | for _, f := range structuredFiles { |
| 632 | path := filepath.Join(memDir, f) |
| 633 | if info, err := os.Stat(path); err == nil && info.Size() > 0 { |
| 634 | fmt.Printf(" %s %s (%s)\n", colorize("*", ColorGreen), f, formatSize(info.Size())) |
| 635 | } |
| 636 | } |
| 637 | |
| 638 | if len(files) == 0 { |
| 639 | fmt.Printf(" %s %s\n", colorize("o", ColorGray), i18n.T("memory.no_daily_notes")) |
| 640 | } else { |
| 641 | fmt.Printf(" %s %s\n", colorize("*", ColorGreen), i18n.T("memory.daily_notes_count", len(files))) |
| 642 | start := 0 |
| 643 | if len(files) > 10 { |
| 644 | start = len(files) - 10 |
| 645 | fmt.Printf(" %s\n", i18n.T("mem.cmd.list.earlier_notes", start)) |
| 646 | } |
| 647 | for _, f := range files[start:] { |
| 648 | fmt.Printf(" %s\n", f) |
| 649 | } |
| 650 | } |
no test coverage detected