Complete account and tag names in the rule builder

Both fields are free text, and a slug or tag that is slightly wrong produces
a rule that silently catches nothing — or a second, near-identical tag. They
now complete against what already exists: accounts from the folders on disk
and the index, tags from every tag in use plus any named in rules.toml, so a
tag is completable from the moment a rule mentions it.

The completion is ghosted after the cursor and never committed until it is
accepted, so inventing a new tag still works. tab takes it and moves focus
only when there is nothing left to complete; ctrl+n/ctrl+p cycle an ambiguous
prefix, and the hint under the box says how many candidates are left.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-09 23:06:31 +02:00
co-authored by Claude Opus 5
parent 3eca8f5376
commit 73fefea96d
4 changed files with 305 additions and 18 deletions
+18 -1
View File
@@ -88,19 +88,36 @@ a `▸` against each one the glob currently matches and a running
"*n* of *m* descriptions match" count.
```
▸ glob Untagged description N
glob Untagged description N
╭────────────────────────────╮ ACME PAYROLL JAN 1
│ *LIDL* │ BOLT RIDE 1
╰────────────────────────────╯ ▸ LIDL SOFIA 4412 2
vs. the description ▸ LIDL VARNA 9911 1
ZARA MLADOST 1
▸ tag
╭────────────────────────────╮
│ groceries │
╰────────────────────────────╯
tab completes · ctrl+n: 1 more
2 of 7 descriptions match
```
Only `gro` was typed in the tag field; `ceries` is the ghosted completion.
`tab` / `↑↓` move between the glob, account and tag fields, `pgup` / `pgdn`
scroll the list, and `enter` appends the rule to `rules.toml` and retags
immediately, so the rows it caught disappear from the list. `esc` goes back.
The account and tag fields complete as you type: the rest of the match is
ghosted in grey after the cursor, and `tab` (or `→` at the end of the line)
takes it. When several candidates share the prefix, the hint under the box says
how many, and `ctrl+n` / `ctrl+p` cycle through them. Nothing is committed until
you accept it, so a new tag is still just typed out in full. Accounts come from
the folders on disk and the index; tags from every tag in use plus any named in
`rules.toml`, so a tag is completable from the moment a rule mentions it —
which is what stops `groceries` acquiring a `grocery` twin.
Leaving the account blank applies the rule everywhere; filling it in also
narrows the preview to that account. Rules are appended, so anything already in
`rules.toml` keeps precedence — the preview accounts for that automatically,