diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..71f78eb --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,61 @@ +# Changelog + +## 1.0.0 — 2026-09-27 + +The first release of the hledger plugin for Discourse. Put an +[hledger](https://hledger.org) journal in a fenced `hledger` code block in the +first post of a topic, and the block is replaced by a live, filterable report +dashboard, generated on demand by the server's `hledger` executable. + +### Reports + +The dashboard offers five views, each generated from hledger's machine-readable +JSON output: + +- **Accounts** — the full balance tree, with every parent account expanded. +- **Balance sheet** — assets, liabilities and equity, folded into sections. +- **P&L** — revenues and expenses. +- **Equity** — a per-commodity distribution of contributed capital. +- **Journal** — a transaction log with each posting. + +### Account trees + +Accounts are shown as a tree: every name is capitalized, nested accounts are +indented by depth, and on the balance sheet and P&L the matching top-level +account is folded into the section heading instead of being repeated. Empty +titled sections show a "No data" placeholder rather than a bare total. + +### Equity distribution + +The equity view groups balances by commodity and shows each holder's amount +alongside their percentage share of the contributed capital — with a reminder +that this reflects contributed capital, not legal ownership. + +### Mentions + +An account segment written as `@username` (for example `equity:@alice`) is +rendered as a Discourse mention link, with the same profile card as mentions in +posts. Only segments that match an existing user are linked; anything else stays +plain text. + +### Display + +Negative balances are shown in parentheses on the Accounts view, following +accounting convention. Journal account paths keep their `:` separators, with any +mention segments linked inline. Reports can be filtered by a From/To date range, +and the end date is inclusive. + +### Security + +Journals are treated as untrusted input. hledger runs with a scrubbed +environment, a private temporary working directory, a hard wall-clock timeout, +CPU and file-descriptor limits, and capped output. `include` and `!include` +directives are rejected, the journal must be valid UTF-8 and within size and +line limits, and only one journal per topic is accepted. Reports are returned +only for topics the viewer may see, the endpoint is rate-limited to 30 requests +per minute per IP, and results are cached per post revision. + +### Requirements + +- The `hledger` executable on the server. +- Discourse 2.7.0 or newer. \ No newline at end of file diff --git a/README.md b/README.md index 0fb31d9..0b5ce63 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,20 @@ # **hledger** Discourse Plugin +[![CI](https://gitea.kosmos.org/raucao/discourse-hledger/actions/workflows/ci.yml/badge.svg?branch=main&event=push)](https://gitea.kosmos.org/raucao/discourse-hledger/actions) +[![Release](https://img.shields.io/gitea/v/release/raucao/discourse-hledger?gitea_url=https://gitea.kosmos.org)](https://gitea.kosmos.org/raucao/discourse-hledger/releases) + Render [hledger](https://hledger.org) journal reports inside Discourse topics. Put an hledger journal in a fenced `hledger` code block in a topic's first post. The block is replaced by a dashboard with five reports, generated live by the `hledger` command line tool: -- Accounts and balances (a full account tree, each name capitalized) -- Balance sheet (indented account tree under each section) -- Profit & loss / P&L (indented account tree under each section) -- Equity distribution (account tree with per-commodity shares; contributed +- 📋 Accounts and balances (a full account tree, each name capitalized) +- ⚖️ Balance sheet (indented account tree under each section) +- 📈 Profit & loss / P&L (indented account tree under each section) +- 👥 Equity distribution (account tree with per-commodity shares; contributed capital, not legal ownership) -- Journal (a detailed transaction log: date, description and postings) +- 🧾 Journal (a detailed transaction log: date, description and postings) ## Installation diff --git a/plugin.rb b/plugin.rb index 0252a40..87f0600 100644 --- a/plugin.rb +++ b/plugin.rb @@ -3,9 +3,9 @@ # name: hledger # about: Render hledger journals in topics # meta_topic_id: TODO -# version: 0.0.1 +# version: 1.0.0 # authors: Râu Cao -# url: TODO +# url: https://gitea.kosmos.org/raucao/discourse-hledger # required_version: 2.7.0 register_asset "stylesheets/hledger.scss"