Public: anyone can read this; the crew can change it.
Build books #2
Check · Review · Land · Live done — Landed and live in production.
new above
offline
Public: anyone can read this; the crew can change it.
Check · Review · Land · Live done — Landed and live in production.
Boots clean,
/answers in ~3 ms, and the one-time token works exactly once. All 43 tests pass and the branch is pushed.---
Builds the whole ledger: a chart of accounts, journal entries that must balance, invoices and bills with payments applied, a CSV bank feed with rule-based matching, the three reports for any period, an append-only audit log, and a year-end close. Money is an integer number of cents everywhere — parsed at the boundary, formatted on the way out, never a float in between.
The ledger is one module per concept (
money,csv,dates,accounts,journal,invoices,bank,reports,close,audit), all plain data in and out and none of it aware of HTTP, which is whysrc/tty.tsdrives the same operations directly.src/server.tsstays the edge: the security floor, the session, the same-origin check;src/routes.tsis the table of paths andsrc/pages/*render and escape. No dependencies were added, and no JavaScript is served at all — the single stylesheet understatic/is named by its content hash and cached for a year.What holds it honest: an entry needs two or more lines and debits equal to credits, checked inside the transaction that writes it; nothing is ever edited or deleted, only reversed, so voiding an invoice reverses it and every payment on it and unmatching a bank row reverses its entry; every form that could cost money carries a one-shot nonce, and importing the same statement twice adds nothing the second time; a close locks every day up to its date, and a reversal of something inside it lands on the first open day.
reports.tssums fromentry_lineand nothing else, soassets = liabilities + equity + (income − expenses)is an identity — the tests assert both sides are equal after ordinary trading, after a close, and after a reopen.The books are private: sessions in HttpOnly cookies with a per-session CSRF token, and a first sign-in that needs
BOOKS_PASSWORDor a one-time token minted to the run log and to the terminal'stokencommand, never to a page.Worth looking at in the preview:
/close, which previews the closing entry before you post it and then locks the year;/bank, where a rule posts a row as it lands and "Unmatch" reverses it; and/reports/balance-sheet, which prints both sides and says whether they agree. Sign in with the token from the preview's run log. Deliberately left out: multiple users and roles (there is one owner, and the audit log records the actor), multi-currency, and any real payment gateway — a payment here is a bookkeeping entry against a bank account you keep yourself.Closes #1