@diy-accounting-uk/diya-gl
v1.2.36
Published
Recalculate, read and write DIYA-GL books from the command line
Downloads
8,305
Maintainers
Readme
@diy-accounting-uk/diya-gl
Run a UK sole trader's or company's accounts from the command line. A DIYA-GL™ book is a book.toml and a lines.jsonl file, usually a few kilobytes, that hold a year of transactions and the chart of accounts they post to. This package recalculates one, reads one out of an Excel workbook, writes one back into a workbook, and serves one over MCP, all through the same engine the DIY Accounting Spreadsheets™ site reconciles in CI.
Four products: Basic Sole Trader, Taxi Driver, Self Employed, Limited Company.
Install
npm install -g @diy-accounting-uk/diya-glWith Homebrew:
brew tap diy-accounting-uk/diya-gl
brew install diy-accounting-uk/diya-gl/diya-glOr run the image straight from GHCR, no install:
docker run --rm -v "$PWD":/data ghcr.io/diy-accounting-uk/diya-gl:latest \
recalc --package bst --data /data/my-book --years se-2025-2026 --output-dir /data/outUse
diya-gl recalc --package bst --data my-book --years se-2025-2026 --output-dir out
diya-gl read-workbook --file my-workbook.xlsx --output-dir out
diya-gl write-workbook --data my-book --output-dir out
diya-gl mcpEach subcommand is also its own command, if you only want one on your PATH:
diya-gl-recalc, diya-gl-read-workbook, diya-gl-write-workbook, diya-gl-mcp.
- recalc takes a diya-gl book (
--data) or a populated workbook (--source-dir,--mode saved|recalculate) and writesreport.json: every figure, report section and compliance check the engine computes. - read-workbook takes an
.xlsx, a package zip, or a diya-gl zip or JSON file (--file), and writesbook.toml,lines.jsonl,report.jsonandbookchecks.json. - write-workbook takes a diya-gl book (
--dataor--file) and writes the Excel package its product composes onto its template — the same client-side path the DIYA-GL pages use, so it never needs LibreOffice. Add--zipfor the package as one zip. - mcp runs a stdio MCP server with four tools:
extract_book,report,edit_lines,save_workbook. Point an MCP client atdiya-gl-mcp(ordiya-gl mcp) with no arguments.
The format
A diya-gl book's fields are drawn from the XBRL Global Ledger Taxonomy Framework 2015 and
map onto HMRC's SA103S boxes. The two schemas that validate a book are published at
/schema/diya-gl-book-v2.schema.json
and
/schema/diya-gl-lines-v2.schema.json.
The full field mapping, the check catalogue and the reconciliation evidence behind them are
on the format spec page.
Provenance
Every book this package writes carries five stamps: the format version, this package's own
version and commit, a hash over the tax-year data applied, and each product's template hash
and reconciliation scorecard. Recalculating an old book either reproduces its report.json
byte for byte or names the stamp that differs. Every published release is cut from a commit
whose reconciliation checks passed; the scorecards are on the
reconciled releases page.
Licence
This package is licensed under the Apache License 2.0. Embed it, ship it, change it. See LICENSE
and NOTICE.
The diya-gl format itself is an open specification. The two JSON Schemas are Apache-2.0 and the format text is CC BY 4.0, so you can implement the format in anything with attribution.
The workbook templates are not part of this package. write-workbook and the MCP save_workbook
tool fetch the template they need from
spreadsheets.diyaccounting.co.uk the first time they run,
print the terms, and cache it for later runs. The templates are the company's own work, under the
PolyForm Internal Use License 1.0.0 with an additional grant: use them for your own accounts, or for
your clients' accounts if you are an accountant or a bookkeeper, and do not redistribute them.
This repository does not accept contributions.
Copyright (C) 2006-2026 DIY Accounting Limited.
