Remove the TUI; the web app is the frontend

money serve covers every screen the TUI had, so keeping both meant every
behaviour change landing twice. internal/tui goes, and with it bubbletea,
bubbles and lipgloss. `money` with no command now runs serve, the way it
used to open the TUI, and `money tui` is an unknown command.

Three invariants in CLAUDE.md were covered only by TUI tests. Two already
had web counterparts; TestPairedLegsAreNotUntagged is ported to the API:
a paired leg is neither listed as untagged nor offered to the rule
builder, while an unpaired one still is.

README's screen sections now describe the browser, which kept the
behaviour and changed only the controls. CLAUDE.md names the web
equivalents of the TUI functions its invariants pointed at, drops the tab
completion rule that only bubbles' textinput needed, and says how to test
the web app instead of how to drive a terminal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-02 18:51:54 +02:00
co-authored by Claude Opus 5.5
parent 8e4df08f43
commit ec8a844441
11 changed files with 228 additions and 5437 deletions
+111 -196
View File
@@ -84,8 +84,7 @@ only if you hand the binary to someone else.
## Usage
```
money # open the TUI (default)
money serve # the same screens as a web app, on 127.0.0.1:8080
money # the web app on 127.0.0.1:8080 (same as `money serve`)
money serve --addr :8080 # listen on every interface (there is no login)
money import # extract new transactions from every statement
money import --force # re-parse statements even if unchanged
@@ -103,7 +102,7 @@ money config # which data root is in use, and why
An account folder appears in the app only once its statements have been
imported — creating an `account.toml` is not enough on its own. Run
`money import` (or press `i` in the TUI) after adding one.
`money import` (or press Import in the web app) after adding one.
`--uniq` turns `ls` into a list of patterns still to write rather than a list of
rows to read: one line per distinct description, since fifty visits to the same
@@ -132,20 +131,58 @@ It composes with the other filters (`--account`, `--month`, `--search`), and
`--limit` caps the rows printed, saying how many it held back. It cannot be
combined with `--wide`, whose columns all belong to a single transaction.
### TUI keys
## The web app
`money serve`, which is also what `money` runs with no command, puts seven
screens in a browser: accounts, transactions, report, rule builder, rules,
transfer builder and transfers. It runs the same code as the CLI: amounts are formatted,
globs matched and transfers paired on the server, and the page only shows the
answers. It is one binary with the page built in; nothing else to deploy.
```
money # http://127.0.0.1:8080
money serve --root /srv/money --addr 0.0.0.0:8080
```
**There is no authentication.** Anyone who can reach the port can read every
transaction, rewrite `rules.toml` and start an import, which is why it listens
on loopback unless `--addr` says otherwise. To use it from elsewhere, put it
behind a reverse proxy that does the logging in, or reach it over SSH / a VPN.
Requests that change anything must be sent as JSON, so another website open in
the same browser cannot post a form to it.
The server outlives hand edits to `rules.toml`, so it treats the file the way a
fresh command would:
- **Retag and Import re-read `rules.toml`** (and Import the account folders)
before running, exactly as `money retag` / `money import` would. Until then a
banner says the file on disk no longer matches what the index was derived
from.
- **Edits and deletes check the file first.** They go by rule position, and the
page also sends the rule it showed you; if `rules.toml` no longer holds that
rule there (another tab, a hand edit) the change is refused and you are asked
to reload, rather than editing whichever rule moved into its place.
Shift-click **Import** for `import --force`.
### Keys
| Key | Action |
| --- | --- |
| `1` `2` `3` `4` `5` `6` `7` / `tab` | accounts · transactions · report · rule builder · rules · transfer builder · transfers |
| `enter` | open the selected account (accounts view) |
| `1` – `7` | accounts · transactions · report · rule builder · rules · transfer builder · transfers |
| `/` | filter by description |
| `u` | show only untagged transactions (matched transfer legs are not among them) |
| `a` | clear the account filter |
| `←` `→` | move the report's period (report view) |
| `s` | change how the report is sorted (report view) |
| `i` | import · `r` re-apply rules · `q` quit |
| `←` `→` | move the report's period (report) |
| `s` | change how the report is sorted (report) |
| `ctrl+s` | sort the rule builder's preview by name / by count |
| `i` | import · `r` retag |
There is no key that tags a transaction. Tags come from `rules.toml` and
Inside a form every printable key belongs to the field you are typing in, so
the single-letter keys only work outside one; that is why the builder's sort is
a chord. Clicking an account on `1` filters the transaction list to it.
There is no control that tags a transaction. Tags come from `rules.toml` and
nowhere else, so tagging what you are looking at means writing a rule for it on
`4` — which is why that screen shows you what a glob catches before you save.
@@ -157,34 +194,23 @@ and the month that has just ended is the last one your statements can be
complete for. If you have not downloaded that month yet, the screen says the
period is empty rather than quietly showing you a different one.
`←` and `→` move along the time axis on the left of the totals, which runs from
the widest window down to the oldest month in the index:
```
Period Tag Cur Out In Net N
all time groceries EUR 10.00 0.00 -10.00 1
this year TOTAL EUR 10.00 0.00 -10.00
last 12 months
last 3 months
this month
▸ last month
2026-05
2026-04
```
The time axis beside the totals runs from the widest window down to the oldest
month in the index — `all time`, `this year`, `last 12 months`, `last 3
months`, `this month`, `last month`, then one entry per month. Click one, or
step along it with `←` and `→`.
The three rolling windows run to the end of *this* month rather than to the
last complete one — you ask for "last 3 months" to see what is happening now,
and leaving out the days since the 1st would answer a different question. Each
month below `last month` is a month the index actually holds; months that a
named window above already covers are not repeated. The axis is hidden on a
terminal too narrow for it and the totals both, where the title still names the
period.
named window above already covers are not repeated.
`s` cycles how the rows are arranged, and the marked column heading says which
one they are arranged by: `Out ▾` largest spend first (the default question a
spending report answers), then `In ▾`, `Net ▾` lowest first so the biggest
losses lead, `N ▾` most transactions first, and `Tag ▴` A→Z. `money report`
takes the same choice as `--sort out|in|net|count|tag`.
Click a column heading, or press `s` to cycle, to change how the rows are
arranged; the marked heading says which one they are arranged by: `Out ▾`
largest spend first (the default question a spending report answers), then
`In ▾`, `Net ▾` lowest first so the biggest losses lead, `N ▾` most
transactions first, and `Tag ▴` A→Z. `money report` takes the same choice as
`--sort out|in|net|count|tag`.
Currency is always the outer grouping and no sort changes that — there are no
exchange rates here, so two currencies interleaved by amount would invite a
@@ -192,10 +218,9 @@ comparison between numbers that cannot be compared. Rows that tie fall back to
the tag, so they keep a fixed position rather than shuffling between reloads.
The sort rearranges rows; it never changes which rows there are.
The period narrows the report and only the report. The account filter (`a`,
`enter`), the search (`/`) and the untagged toggle (`u`) are shared with the
transaction list as before, so opening on last month does not hide the rest of
the index from `2`.
The period narrows the report and only the report. The account, the search and
the untagged toggle are shared with the transaction list, so opening on last
month does not hide the rest of the index from `2`.
`money report` takes `--month` instead; there is no command-line equivalent of
the wider windows.
@@ -203,9 +228,10 @@ the wider windows.
### Rule builder (`4`)
Writing rules by hand means guessing what a glob will catch. This screen shows
the answer as you type: the form is on the left, and on the right the
still-untagged descriptions the glob currently matches, marked `▸`, grouped by
description, under a running "*n* of *m* descriptions match" count.
the answer as you type: the form is on the left — glob, account, tag, note —
and on the right the still-untagged descriptions the glob currently matches,
marked `▸`, grouped by description, under a running "*n* of *m* descriptions
match" count.
The list narrows as you type, so what is on screen is what the rule would
claim — nothing else is left there to read past. The count keeps the context
@@ -214,60 +240,26 @@ glob picked two descriptions out of seven, and `0 of 7` says the glob is wrong.
With the glob still empty there is nothing to filter by, and the list is every
untagged description in the data — which is the other question this screen
answers, and where you go looking for the next thing to write a rule for.
Clicking a description fills the glob with `*THAT DESCRIPTION*`, as a starting
point to narrow down.
```
glob Untagged description ↓ N
╭────────────────────────────╮ ▸ LIDL SOFIA 4412 2
│ *LIDL* │ ▸ LIDL VARNA 9911 1
╰────────────────────────────╯
vs. the description
`enter` (or **Save rule**) appends the rule to `rules.toml` and retags
immediately, so the rows it caught disappear from the list. The account stays
filled in, since the next rule is usually for the same one.
account
╭────────────────────────────╮
│ blank = every account │
╰────────────────────────────╯
blank = all accounts
▸ tag
╭────────────────────────────╮
│ groceries │
╰────────────────────────────╯
tab completes · ctrl+n: 1 more
note
╭────────────────────────────╮
│ optional │
╰────────────────────────────╯
why this rule exists
2 of 7 descriptions match
```
Only `gro` was typed in the tag field; `ceries` is the ghosted completion.
`tab` / `↑↓` move between the glob, account, tag and note 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.
On a short window the form gives up its spacing and then its hints, so all four
fields stay on screen.
`ctrl+s` switches the list between by name and by count, most seen first — a
chord rather than a letter, because every printable key belongs to the field you
are typing in. The `↓` in the header says which column the order is read from.
Clicking the column headings, or `ctrl+s`, switches the list between by name and
by count, most seen first; the `↓` says which column the order is read from.
The two answer different questions: by name finds the payee you are looking at,
by count finds the rule worth writing next, since one pattern claiming forty
rows is worth more than the first of forty claiming one. Ties keep the
alphabetical order, so the list does not reshuffle under you, and the choice
lasts until you change it.
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 account and tag fields offer completions as you type. 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.
which is what stops `groceries` acquiring a `grocery` twin. A new tag is just
typed out in full.
Leaving the account blank applies the rule everywhere; filling it in also
narrows the preview to that account. The preview lists only transactions no
@@ -281,8 +273,8 @@ report leaves them out anyway.
#### Editing a rule
`e` on the rules screen (`5`) opens the selected rule in this same form with the
fields filled in, and `enter` rewrites that rule where it sits instead of
**Edit** on the rules screen (`5`) opens the rule in this same form with the
fields filled in, and saving rewrites that rule where it sits instead of
appending a new one. It keeps its position, since position still breaks ties
between equally specific rules; `rules.toml` is edited textually, so the
comments and formatting around it survive, exactly as when deleting.
@@ -297,8 +289,8 @@ you are about to hand back to whatever rule catches it next.
The form has no `type` field, so a rule that sets one carries it through
unchanged rather than losing it; it is shown under the glob as `+ type:… ·
kept`. Saving lands back on the rules screen with the new counts, and `esc`
leaves the rule as it was.
kept`. Saving lands back on the rules screen with the new counts; **Cancel**,
`esc`, or leaving the screen leaves the rule as it was.
### Rules (`5`)
@@ -307,7 +299,7 @@ are tried in — with the number of transactions it actually claims. Rules that
claim none are marked `✗`.
```
money · rules · 5 rules · 2 match nothing
Rules · 5 rules · 2 match nothing
# Pattern Account Tag Txns Note
1 *LIDL SOFIA* (all) groceries 3 the weekly shop
@@ -326,80 +318,44 @@ deleting. Note that shadowing has nothing to do with the numbering: rule 2 would
be just as dead written above rule 1, because precedence is decided by how
specific a rule is and not by where it sits.
`e` opens the selected rule in the builder to edit it, `d` deletes it, and `p`
deletes every rule marked `✗` at once; both deletions ask for a `y` first. `r`
recounts against what is currently in the index, which is what you want after an
import has added rows; `rules.toml` itself is read at startup and whenever you
save a rule from the builder, so an edit made in another window needs a restart.
Editing and deleting both work on `rules.toml` textually, so your comments,
ordering and formatting survive. A comment sitting directly above a deleted rule
goes with it, while one separated by a blank line is treated as a section
heading and left alone; an edited rule keeps its comments, since they say why it
is there and changing its glob rarely changes that.
**Edit** opens a rule in the builder, **Delete** deletes it, and **Prune
unused** deletes every rule marked `✗` at once; both deletions ask first.
**Refresh counts** recounts against what is currently in the index. Editing and
deleting both work on `rules.toml` textually, so your comments, ordering and
formatting survive. A comment sitting directly above a deleted rule goes with
it, while one separated by a blank line is treated as a section heading and
left alone; an edited rule keeps its comments, since they say why it is there
and changing its glob rarely changes that.
### Transfer builder (`6`)
Same idea as the rule builder, for money moved between your own accounts. Both
sides are named, and the preview on the right shows what the pair would be:
`▸` for a movement it matches end to end, `⚠` for a leg it catches on one side
and cannot pair with anything on the other.
Same idea as the rule builder, for money moved between your own accounts. The
form names both sides — from account, from desc, to account, to desc — plus an
optional tolerance and note, and the preview beside it shows what the pair
would be: `▸` for a movement it matches end to end, `⚠` for a leg it catches on
one side and cannot pair with anything on the other.
```
from account Date Amount Movement Description
╭────────────────────────────╮ ⚠ 2026-04-01 500.00 checking → ? TRANSFER TO SAVINGS
│ checking │ ▸ 2026-03-01 500.00 checking → savings TRANSFER TO SAVINGS
╰────────────────────────────╯
money leaves here
Date Amount Movement Description
⚠ 2026-04-01 500.00 checking → ? TRANSFER TO SAVINGS
▸ 2026-03-01 500.00 checking → savings TRANSFER TO SAVINGS
▸ from desc
╭────────────────────────────╮
│ *TO SAVINGS* │
╰────────────────────────────╯
glob vs. the leaving leg
to account
╭────────────────────────────╮
│ savings │
╰────────────────────────────╯
money arrives here
to desc
╭────────────────────────────╮
│ *FROM CHECKING* │
╰────────────────────────────╯
glob vs. the arriving leg
tolerance %
╭────────────────────────────╮
│ 0 │
╰────────────────────────────╯
0 = amounts must match exactly
note
╭────────────────────────────╮
│ optional │
╰────────────────────────────╯
why this transfer exists
1 pairs · 1 unpaired
1 pairs · 1 unpaired
```
The account fields complete exactly as the rule builder's do. `tab` / `↑↓` move
between fields, `pgup` / `pgdn` scroll the list, `enter` appends the definition
to `rules.toml` and re-pairs immediately, and `esc` goes back. Saving keeps both
account names in place and clears the two globs, since the next transfer you
write is usually the same route in the other direction. The tolerance is cleared
with them: carried over silently it would loosen a route that never asked for
one. Six fields need more room than the rule builder's four, so on a short
window this form gives up its spacing, then its hints, then the borders on the
fields you are not editing — every field stays on screen.
The account fields complete exactly as the rule builder's do. `enter` (or
**Save transfer**) appends the definition to `rules.toml` and re-pairs
immediately. Saving keeps both account names in place and clears the two globs,
since the next transfer you write is usually the same route in the other
direction. The tolerance is cleared with them: carried over silently it would
loosen a route that never asked for one.
`tolerance %` is the one field worth previewing before you save. Type a
`Tolerance %` is the one field worth previewing before you save. Type a
percentage and the pairs it buys appear immediately, showing both amounts —
`500.00 → 495.00` — with what they cost summarised beside the counts:
```
1 pairs · 0 unpaired · 5.00 in fees
1 pairs · 0 unpaired · 5.00 in fees
```
A half-written definition previews too: fill in one side and its legs show up as
@@ -411,7 +367,7 @@ written the other half.
Every definition in file order, with what it currently pairs.
```
money · transfers · 4 definitions · 1 leg(s) unpaired
Transfers · 4 definitions · 1 leg(s) unpaired
# From To Pairs Unpaired Tol Note
1 ⚠ checking *TO SAVINGS* savings *FROM CHECKING* 11 1 monthly saving
@@ -430,51 +386,10 @@ it: row 3's two pairs were matched on slack rather than on the amount agreeing.
It is blank for every definition that requires the exact amount — which is the
default, so an empty column means nothing here is pairing on a mismatch.
`d` deletes the selected definition and `p` deletes every `✗` one at once, both
after a `y`. Definitions marked `⚠` are never pruned — they are doing something,
just not finishing it, and deleting one would hide the problem rather than fix
it. `r` re-pairs against what is currently in the index.
## Web app
`money serve` puts the TUI's seven screens in a browser — accounts,
transactions, report, rule builder, rules, transfer builder, transfers — with
the same behaviour, because it runs the same code: amounts are formatted, globs
matched and transfers paired on the server, and the page only shows the
answers. It is one binary with the page built in; nothing else to deploy.
```
money serve # http://127.0.0.1:8080
money --root /srv/money serve --addr 0.0.0.0:8080
```
**There is no authentication.** Anyone who can reach the port can read every
transaction, rewrite `rules.toml` and start an import, which is why it listens
on loopback unless `--addr` says otherwise. To use it from elsewhere, put it
behind a reverse proxy that does the logging in, or reach it over SSH / a VPN.
Requests that change anything must be sent as JSON, so another website open in
the same browser cannot post a form to it.
What differs from the TUI:
- **Retag and Import re-read `rules.toml`** (and Import the account folders)
before running, exactly as a fresh `money retag` / `money import` would — the
server outlives hand edits to both. Until then a banner says the file on disk
no longer matches what the index was derived from.
- **Edits and deletes check the file first.** They go by rule position, as in
the TUI, but the page also sends the rule it showed you; if `rules.toml` no
longer holds that rule there (another tab, a hand edit) the change is refused
and you are asked to reload, rather than editing whichever rule moved into
its place.
- Clicking a description in the rule builder's preview fills the glob with
`*THAT DESCRIPTION*`, as a starting point to narrow down.
- Shift-click **Import** for `import --force`.
The keys still work where they do not fight the browser: `1`–`7` switch
screens, `/` searches, `u` toggles untagged, `a` clears the account filter, `i`
imports and `r` retags. On the report `←`/`→` move the period and `s` cycles
the sort (or click a column heading); in the rule builder `ctrl+s` re-sorts the
preview. Inside a form every printable key belongs to the field, as in the TUI.
**Delete** deletes a definition and **Prune unmatched** deletes every `✗` one at
once, both after asking. Definitions marked `⚠` are never pruned — they are
doing something, just not finishing it, and deleting one would hide the problem
rather than fix it. **Refresh pairing** re-reads what is currently in the index.
## rules.toml
@@ -597,7 +512,7 @@ amount wins.
**The difference is not forgiven, it is reported.** A pair leaves the report
entirely, so a fee hidden inside one would be spending that appears nowhere at
all. `money report` names it on the excluded line and the TUI's report gives it
all. `money report` names it on the excluded line and the web app's report gives it
its own row (see below). Across currencies there is no fee to compute — the two
numbers are in different units — so a tolerance there means nothing and is
ignored.