feat(tui): add interactive run mode for checklists and fill mode for templates

Run mode (r key on checklist cards): cursor navigates steps, space
toggles done/undone, r resets all, esc saves changes to DB and exits.
Persists step state — improvement over web which discards on exit.

Fill mode (f key on template cards): tab/shift-tab navigates slots,
type to fill values, enter resolves template and copies to clipboard
with use count increment. Esc cancels without copying.

Both modes are sub-states of detail view, keeping architecture simple.
This commit is contained in:
2026-05-17 21:53:55 -04:00
parent 1066c0bc7d
commit 77222ff1b8
8 changed files with 423 additions and 20 deletions
+26
View File
@@ -49,6 +49,10 @@ type absorbSourcesLoadedMsg struct {
entities []*db.Entity
}
type stepsPersistedMsg struct{}
type templateCopiedMsg struct{}
type tagsLoadedMsg struct {
tags []db.TagCount
}
@@ -235,3 +239,25 @@ func absorbEntity(store *db.Store, targetID, sourceID string) tea.Cmd {
return entityAbsorbedMsg{targetID}
}
}
func persistSteps(store *db.Store, entityID string, stepsJSON string) tea.Cmd {
return func() tea.Msg {
update := db.EntityUpdate{CardData: &stepsJSON}
if err := store.Update(entityID, &update); err != nil {
return errMsg{err}
}
return stepsPersistedMsg{}
}
}
func copyResolved(store *db.Store, entityID string, resolved string) tea.Cmd {
return func() tea.Msg {
if err := clipboard.WriteAll(resolved); err != nil {
return errMsg{err}
}
if err := store.IncrementUse(entityID); err != nil {
return errMsg{err}
}
return templateCopiedMsg{}
}
}