feat: rhythm tracking and structured review

This commit is contained in:
voocel
2026-03-10 17:24:48 +08:00
parent ef55c89e9d
commit 0a48b66ed1
14 changed files with 246 additions and 80 deletions

View File

@@ -41,6 +41,7 @@ func (s *Store) UpdateForeshadow(chapter int, updates []domain.ForeshadowUpdate)
for _, u := range updates {
switch u.Action {
case "plant":
idx[u.ID] = len(entries)
entries = append(entries, domain.ForeshadowEntry{
ID: u.ID,
Description: u.Description,
@@ -61,6 +62,21 @@ func (s *Store) UpdateForeshadow(chapter int, updates []domain.ForeshadowUpdate)
return s.SaveForeshadowLedger(entries)
}
// LoadActiveForeshadow 返回未回收的伏笔条目status != "resolved")。
func (s *Store) LoadActiveForeshadow() ([]domain.ForeshadowEntry, error) {
all, err := s.LoadForeshadowLedger()
if err != nil {
return nil, err
}
var active []domain.ForeshadowEntry
for _, e := range all {
if e.Status != "resolved" {
active = append(active, e)
}
}
return active, nil
}
func renderForeshadow(entries []domain.ForeshadowEntry) string {
var b strings.Builder
b.WriteString("# 伏笔账本\n\n")