class

Finfry::App

Inherits Reference < Object

Wires the Jargon-defined CLI to the Store and renders output. Every entry path (manual commands now, the AI layer later) funnels through commit and render, so the ledger logic lives here rather than in the CLI handlers.

Constants

SHORT_OVER_ACCOUNT = "Expenses:ShortsAndOverages"

Finalize: every staged-cleared transaction is locked into the committed tier, but only if the cleared balance matches the statement — so you can't reconcile to a wrong number. Requires -s. Where --adjust books a small unexplained reconciliation residual — the classic "cash over and short" account. Big or explainable differences should be entered manually to their real accounts instead.

Constructors

new(store : Store = Store.new, out __arg0 : IO = STDOUT, interactive : Bool = true)
Source

Class methods

merge_mcp_config(existing : String | Nil, book : String) : String

Merge a finfry MCP server (pinned to book via FINFRY_DATA) into an existing .mcp.json document (or a fresh one), preserving any other servers.

Source

Instance methods

accounts_by_recency

Known accounts, most recently used first; never-used ones last, alphabetically. Ordering only — every account is always offered.

Source
agent_tools

The agent's tools as Claude tool definitions (built from the specs).

Source
balance_sheet(as_of : String | Nil = nil) : BalanceSheet
Source
balance_tree(prefix : String | Nil = nil) : Array(BalanceNode)

Balances as a tree: each parent with the total of its subtree, children indented under it, sorted by name. A parent with a single child and no postings of its own collapses into that child (Food:Coffee), the way ledger tools print charts, so depth only appears where it carries information.

Source
balances(prefix : String | Nil = nil) : Array(Tuple(String, Int64))

Display-signed balances, sorted by account name.

Source
budgets(month : String) : Array(BudgetRow)
Source
chart
Source
commit(date : String, description : String, postings : Array(Posting), recurrence : String | Nil = nil) : Transaction

Validate, persist, and echo a transaction. The single commit path.

Source
daily
Source
due_entries

The queue as it stands, without catching up — for pages, which must not write on a GET. Pair with newly_due to offer the catch-up.

Source
due_queue

The due queue, materializing anything newly due first (the CLI's semantics). Oldest first.

Source
execute(subcommand : String, arguments : JSON::Any) : Tuple(String, Bool)

Run one dispatch subcommand (e.g. "spend", "due ok") with pre-parsed arguments, capturing its output instead of printing. Returns the output (or the error message) and whether it errored. The web UI's write path.

Source
execute_tool(name : String, arguments : JSON::Any) : Tuple(String, Bool)

Execute one agent tool directly (no plan deferral) and return its captured output plus whether it errored. Used by the MCP server, where the client harness owns approval. Both reads and writes execute immediately; each write records its own undoable changeset via commit.

Source
general_ledger(prefix : String | Nil = nil, since : String | Nil = nil, until_date : String | Nil = nil) : Array(LedgerAccount)

The general ledger: every account with postings (exact, not subtree — each account is its own page), in name order, each with the balance brought forward into the period, its lines in the period, and the running balance. Accounts with nothing in the period and a zero balance are left out.

Source
history(limit : Int32 | Nil = nil, all : Bool = false) : Array(HistoryRow)

Newest first. all includes bookkeeping commits and undo marks.

Source
income_statement(month : String) : IncomeStatement
Source
label(rule : RecurringRule) : String

Human label for a recurring rule / due entry (memo, or the accounts, plus amount).

Source
label(entry : DueEntry) : String
Source
newly_due
Source
next_statement_date(account : String) : String

A sensible next statement date: a month after the last one, else today.

Source
recall(memo : String) : Transaction | Nil

The most recent transaction recorded under this memo (case-insensitive; exact match first, then prefix), so a repeat entry can start from it.

Source
recent_memos(limit : Int32 = 60) : Array(String)

Distinct memos, most recent first.

Source
reconcilable_accounts

Every account that has statements to reconcile against (assets and liabilities in use), with where its reconciliation stands.

Source
reconciliation(account : String, statement : Int64 | Nil = nil, as_of : String | Nil = nil) : ReconcileView

Reconciliation status: the working list (every not-yet-reconciled transaction with a posting on the account, staged ones flagged), the cleared balance (committed + staged), the full ledger balance, and — with a statement — the difference to it.

Source
register(account : String | Nil = nil, month : String | Nil = nil, since : String | Nil = nil, until_date : String | Nil = nil, min : Int64 | Nil = nil, max : Int64 | Nil = nil, match : String | Nil = nil, limit : Int32 | Nil = nil) : RegisterView
Source
render(txn : Transaction) : String

Human-readable rendering of a transaction's postings.

Source
run(argv : Array(String)) : Nil
Source
usual_funding_account

The funding account you used last (the credit leg of the most recent transaction that has an asset/liability one), else the default.

Source

Nested types