feat(tui): add search via capture bar and absorb flow

Search uses existing parse grammar ?prefix — type `?query #tag` in
capture bar to filter entities client-side. Substring match on
body+title+description with AND tag filtering. Esc clears search.

Absorb via m key on fluid entities — opens source picker showing all
other entities, enter merges source into target. Uses existing
store.Absorb() backend.
This commit is contained in:
2026-05-17 21:35:44 -04:00
parent ce335cabd6
commit 1066c0bc7d
10 changed files with 387 additions and 17 deletions
+17 -2
View File
@@ -8,6 +8,13 @@ import (
"github.com/lerko/nib/internal/parse"
)
type inputResult struct {
entity *db.Entity
query bool
body string
tags []string
}
type inputModel struct {
ti textinput.Model
active bool
@@ -32,7 +39,7 @@ func (i *inputModel) reset() {
i.ti.Blur()
}
func (i inputModel) submit() *db.Entity {
func (i inputModel) submit() *inputResult {
val := i.ti.Value()
if val == "" {
return nil
@@ -43,6 +50,14 @@ func (i inputModel) submit() *db.Entity {
return nil
}
if parsed.Query {
return &inputResult{
query: true,
body: parsed.Body,
tags: parsed.FilterTags,
}
}
e := &db.Entity{
Body: parsed.Body,
Title: parsed.Title,
@@ -63,7 +78,7 @@ func (i inputModel) submit() *db.Entity {
e.Description = parsed.Description
}
return e
return &inputResult{entity: e}
}
func (i inputModel) updateKey(msg tea.KeyMsg) inputModel {