From c8264932a5f5143c9df49d192cfffb2b8e53c7bd Mon Sep 17 00:00:00 2001 From: nodemode-ai Date: Tue, 1 Dec 2026 13:26:10 -0500 Subject: [PATCH 01/35] docs(community): bring the code of conduct, contributing and security pages to the family wording --- CODE_OF_CONDUCT.md | 2 +- CONTRIBUTING.md | 64 +++++++++++++++++++++++++++------------------- SECURITY.md | 57 ++++++++++++++++++++--------------------- 3 files changed, 67 insertions(+), 56 deletions(-) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index e2e5af0..ddc0889 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -26,7 +26,7 @@ for the project elsewhere. Report anything that breaks this code by opening an [issue](https://github.com/nodemode-dev/formledger/issues), or by reaching the maintainers on GitHub: the [nodemode-dev](https://github.com/nodemode-dev) -organization, [@nodemode-ai](https://github.com/nodemode-ai) and +organisation, [@nodemode-ai](https://github.com/nodemode-ai) and [@gbarnai](https://github.com/gbarnai). ## What happens next diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3cead65..74ccd8d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,8 +1,8 @@ # Contributing to FormLedger -Thank you for helping. FormLedger is a local-first business app. It is a scaffold for -now: a Go server and a web client that start, and a desktop shell around them. It grows -through real use and real contributions. +Thank you for helping. FormLedger aims to be a free, local-first set of books for a +small company, with sales, purchases, payments and stock in one ledger that stays on your +own computer, and it gets there through real use and real contributions. ## Where to start @@ -13,20 +13,22 @@ through real use and real contributions. ## Setting up -Clone the repository and run `./formledger_oc_install`, then `./formledger` (or -`formledger_oc_install.bat` and `formledger.bat` on Windows). The first downloads the -Go modules and installs the web client's packages; the second starts the server on -`127.0.0.1:8340` and the web client's dev server on port 5340. `./formledger --help` -lists the other commands. You need Go and Node 22. +Clone the repository and run `./formledger install`, then `./formledger boot` (or +`formledger_oc_install.bat` and `formledger.bat` on Windows). The first downloads the Go +modules and installs the web client's packages; the second starts the server on +`127.0.0.1:8340` and the web client's dev server on port 5340. `./formledger help` lists +every command, and the README's "Run it from source" section has the details and the +requirements. The code lives in: | Folder | What is there | | --- | --- | -| `cmd/formledger` | the server binary | -| `internal` | the server's packages (Go) | -| `web` | the client (TypeScript and Vite), embedded into the server when built | +| `cmd/formledger` | the server binary and the `cli` commands | +| `internal` | the engine (Go): ledger, selling, buying, stock, reports, printing, roles, audit | +| `web` | the window (TypeScript and Vite), embedded into the server when built | | `src-tauri` | the desktop shell (Rust, Tauri), which starts the server as a sidecar | +| `docs` | what each part does, and the behaviours the app commits to | | `.github` | the CI workflow and the code owners | ## Before you open a pull request @@ -39,13 +41,18 @@ go build ./... go vet ./... ``` -CI also starts the server and waits for `http://127.0.0.1:8340/api/health` to answer. -There are no automated tests yet. +`./formledger check` runs gofmt, go vet and the window's type check in one go. CI also +starts the server and waits for `http://127.0.0.1:8340/api/health` to answer. There are +no automated tests yet. - Keep each pull request to one change. -- Write commit subjects the way the history does: `feat(web): ...`, - `fix(server): ...`, `docs(...)`, with the scopes listed in [BRANCHING.md](BRANCHING.md). +- Write commit subjects the way the history does, in Conventional Commits: + `feat(web): ...`, `fix(server): ...`, `docs(...)` (see [BRANCHING.md](BRANCHING.md)). Leave the version alone; a maintainer bumps it when releasing. +- Keep emoji out of every file and em dashes out of Markdown. +- Every new dependency, binary or data file gets a row in `NOTICE.md` before it is used. +- Other vendors' product names appear only to name a file format or compatibility. + Never copy vendor help text, icons, templates or themes. ## Maintainers @@ -59,27 +66,32 @@ Reach them through issues and pull requests. ## How changes land -Work reaches `main` only through a pull request from a working branch; nobody pushes to `main` directly. Contributors without write access fork the repository and work on a branch there. A pull request merges when the `web` and `server` checks pass on an up-to-date branch and a maintainer has approved it after its last push. Pull requests are merged with a merge commit, never squashed and never rebased. +Nobody pushes to `main` directly. Everyone forks the repository, or branches from `main` with write access, and opens a pull request into `main`. A pull request merges when the `web` and `server` checks pass on an up-to-date branch and a maintainer has approved it after its last push. Pull requests are merged with a merge commit, never squashed and never rebased. ## Releases -Packaging and releases are done by FormCompiler (`nodemode-dev/formcompiler`), not in -this repository, and only a maintainer starts one. No push from a contributor starts a -release. See [BRANCHING.md](BRANCHING.md). +A release is a version, and only a maintainer makes one: after the version is bumped on +`main`, a maintainer hands it to formcompiler (`nodemode-dev/formcompiler`), which builds +every platform and publishes them together. Packaging is not done in this repository. No +push from a contributor starts a release. See [BRANCHING.md](BRANCHING.md). ## Licensing -FormLedger is licensed under the Apache License 2.0 ([LICENSE](LICENSE), SPDX -`Apache-2.0`). By contributing, you agree that your contribution is licensed under the -same terms. Only add code you have the right to contribute, and name any third-party -code and its license in the pull request. +FormLedger is licensed under the Apache License, Version 2.0 ([LICENSE](LICENSE), SPDX +`Apache-2.0`). By contributing, you agree that your contribution is licensed under +the same terms. Only add code you have the right to contribute, and name any +third-party code and its licence in the pull request. + +## Patents and other people's IP + +Some features are deliberately not built, or are taken out, because they come too close to someone else's patent, trademark, copyright or design. The maintainers hold that line with counsel; contributors do not decide it, and nobody here redesigns a feature on their own reading of a patent. This is engineering diligence, not legal advice. ### Rules for every contribution - Patents: do not add a feature, or a dependency that provides one, that reproduces a method you know to be patented. If you are unsure, open an issue that describes what the feature does, not which patent it resembles. Patent numbers stay out of code, commits, comments, logs and changelogs. -- Trademarks: other vendors' product and feature names appear only to name a file format or compatibility ("opens files", "for use with"). No command, menu, panel or tool takes another product's feature name, and no text says "like X" or "the way X does it". Describe what the feature does. -- Copyright: never copy another product's help, tooltip, dialog or documentation text (link to it instead); never trace or import vendor icons; never bundle vendor templates, themes, sample files, stock media or fonts. -- Licenses: every new dependency, binary or data file gets a row in `NOTICE.md` before it is used. GPL stays outside the distributed bundle, AGPL nowhere, LGPL dynamically linked and replaceable, MPL files unedited. CC BY credited, CC BY-SA only unmodified, CC NC and ND never. +- Trademarks: other vendors' product and feature names appear only to name a file format or compatibility ("opens files", "for use with"). No command, menu, panel, tool, template, theme or agent tool takes another product's feature name, and no text says "like X" or "the way X does it". Describe what the feature does. +- Copyright: never copy another product's help, tooltip, dialog or documentation text (link to it instead); never trace or import vendor icons; never bundle vendor templates, themes, presets, sample files, stock media or fonts. Compatibility layers carry names and signatures only. +- Licences: every new dependency, binary, font or data file gets a row in `NOTICE.md` before it is used. GPL stays outside the distributed bundle, AGPL nowhere, LGPL dynamically linked and replaceable, MPL files unedited. CC BY credited, CC BY-SA only unmodified, CC NC and ND never. ## Conduct diff --git a/SECURITY.md b/SECURITY.md index cc69f92..16781ac 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -7,7 +7,7 @@ check whether the problem is still there. | Version | Supported | | --- | --- | -| 0.1.x (latest release) | Yes | +| Latest release | Yes | | Anything older | No | ## Reporting a vulnerability @@ -22,37 +22,36 @@ is fixed and credit you in the release notes, unless you would rather not be nam ## What counts -FormLedger is a local-first app: a Go server that listens on `127.0.0.1:8340` by -default and serves the web client, and a Tauri shell that starts that server on the -same computer. At this stage it has no accounts, sharing or network features, so the -things that matter most are: - -- **Reaching the server from outside the computer**: the server answering on an - address other than the one it was told to bind, or a web page in a browser reaching - its local API from another origin. -- **The data directory**: reading or writing files outside the directory named by - `FORMLEDGER_DATA`. +FormLedger runs on your own machine, so the things that matter most are the ways +something outside it could get in: + +- **The server** listens on loopback (`127.0.0.1:8340` by default, set with + `FORMLEDGER_ADDR`; the desktop app starts its own copy on a loopback address). Anything + that makes it reachable from another machine without the person turning that on, or + lets a web page on another origin drive it. +- **Accounts, roles and app tokens**: getting past a role, reading or changing the books + as another user, an app token doing more than its read or write scope or its owner's + role allows, an app token making another one, or any edit or delete of a row in the + audit trail. See [`docs/ROLES.md`](docs/ROLES.md). +- **The data directory and the key**: reading or writing files outside the directory + named by `FORMLEDGER_DATA`. With a key (`FORMLEDGER_KEY_FILE`, or a systemd credential + named `formledger.key`) the ledger database, its WAL and its journal are encrypted + with XTS-AES-256, and without one the server says at start that the ledger is plain. + The desktop app makes its own key in its app data folder, never in the data directory. + A missing or wrong key stops the server before any database is opened. Reading the + encrypted database without the key, or anything that leaves ledger data in the clear + inside an encrypted data directory, counts. `formledger report snapshot` writes a plain + copy by design and must be treated as sensitive. See + [`docs/ENCRYPTION.md`](docs/ENCRYPTION.md). - **The desktop shell**: the Tauri shell running the bundled server with more permissions than its capability files grant, or loading content that did not come from the app. +- **The agent dock** (from 0.15.0): anything other than FormLedger's own window on this + computer reaching a shell or an agent program through it. +- **Files**: exporting, printing or taking a snapshot in a way that writes outside where + it should. - **The build**: a script, workflow or dependency in this repository that runs something it should not. -Bugs that need someone to already control the computer, or to run a modified build of -FormLedger, are ordinary bugs: please open an issue for those. - -## Data at rest - -With a key (`FORMLEDGER_KEY_FILE`, or a systemd credential named `formledger.key`), -the ledger database, its WAL and its journal are encrypted with XTS-AES-256 through the -`formledger-crypt` SQLite VFS, ported from form.md. Without a key the ledger is plain, -and the server says so at start. With `FORMLEDGER_KEY_HOME` set and no key given, the -server makes its own key once in that folder (owner-only) and uses it from then on; the -desktop app is written to set it to its app data folder, which is not the data directory. -A missing or wrong key stops the server before any -database is opened. The key is never stored in the data directory; if it is lost, the -ledger cannot be recovered by anyone. `formledger report snapshot` writes a plain copy -by design and must be treated as sensitive. See [`docs/ENCRYPTION.md`](docs/ENCRYPTION.md). - -Reading the encrypted database without the key, or anything that leaves ledger data -in the clear inside an encrypted data directory, counts as a vulnerability. +Bugs that need someone to already control your machine, or to run a modified build +of FormLedger, are ordinary bugs: please open an issue for those. From db442d6a70b2226d764096e0cf7bc244996af762 Mon Sep 17 00:00:00 2001 From: nodemode-ai Date: Tue, 1 Dec 2026 13:27:27 -0500 Subject: [PATCH 02/35] docs(readme): follow the family README shape with a download table and a network section --- README.md | 67 ++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 56 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index a24a397..0c81980 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,8 @@

Books for a small company; sales, purchases, payments and stock in one ledger.
Every sale, purchase, payment and stock movement is a numbered document
- that posts to shared ledgers for money and stock. Local-first, on your own machine. + that posts to shared ledgers for money and stock. Local-first, on your own machine,
+ and scriptable from the command line.

@@ -19,15 +20,24 @@

- Download · + Download FormLedger · Run it from source

+
+

- Features · In the box · Agents · Under the hood · - Download · Run from source + Features · + In the box · + Agents · + Network · + Under the hood · + Download · + Run from source

+
+ @@ -37,6 +47,8 @@

One ledger

Documents post to a general ledger and a stock ledger, and a trial balance and the stock check say whether the books agree.
+
+ ## Features @@ -62,7 +74,7 @@
- + @@ -80,21 +92,49 @@ The command line is a client of the running server; it never opens the database. [`docs/ledger/cli.md`](docs/ledger/cli.md) walks from an empty company to a trial balance. What the app commits to do is listed in [`docs/BEHAVIOURS.md`](docs/BEHAVIOURS.md), and [`AGENTS.md`](AGENTS.md) is the guide for coding agents working on the repo. +From 0.15.0 the window also has an agent dock: a terminal panel beside the books where you can open a shell or an agent program installed on your computer, opened from the View menu. FormLedger has no MCP server yet; an agent drives the books through the command line above. + +## Network + +FormLedger keeps the books on your own computer. + +- **The server** listens on `127.0.0.1:8340` and answers this computer only. `FORMLEDGER_ADDR` changes the address; an address other machines can reach is your choice to make. `FORMLEDGER_TLS_CERT` with `FORMLEDGER_TLS_KEY`, or `FORMLEDGER_ACME_DOMAINS`, serve it over HTTPS. +- **The desktop app** starts its own copy of the server on a loopback address, which stays on this computer. +- **Nothing calls out.** The window loads no font, script or image from another host, and the server makes no outbound request of its own, apart from the certificate authority when you set `FORMLEDGER_ACME_DOMAINS`. +- **The command line** talks only to the server at `FORMLEDGER_URL`, with an app token. +- **The agent dock** (from 0.15.0) runs a shell and agent programs on this computer. What those programs send over the network is up to them and to you. + +Security reports go through [`SECURITY.md`](SECURITY.md). + ## Under the hood - **Go server:** one process is the only writer to the database; amounts are whole numbers of a currency's minor unit, never floats. - **Encryption at rest:** the database is encrypted when you give the server a key (`formledger keygen`, then `FORMLEDGER_KEY_FILE`); `formledger encrypt` converts an existing ledger. Without a key the ledger is stored plain, and the server says so when it starts. See [`docs/ENCRYPTION.md`](docs/ENCRYPTION.md). - **Web client:** vanilla TypeScript and Vite, with no UI framework, embedded into the server binary by `./build_app --server-only`. -- **Desktop shell:** a Tauri shell in `src-tauri/` around the server binary, with a native menubar (File, Edit, View, Go, Window, Help). It has not been compiled yet, so the menubar has not been run. +- **Desktop shell:** a Tauri 2 shell in `src-tauri/` around the server binary. From 0.15.0 the menu bar (File, Edit, View, Go, Window, Help) is drawn in the window on Windows and Linux, and macOS gets the system menu from the same list. - **Checks:** `./formledger check` runs gofmt, go vet and the web client's type check. ## Download -Not released yet. The desktop app has not been compiled and there is no release to download. To use FormLedger now, run it from source below. +Pick the file for your computer from the [Releases page](https://github.com/nodemode-dev/formledger/releases) of this repository. Each file is named `formledger--` with the kind of file at the end. + +| Your computer | File to download | What it is | +|---|---|---| +| Mac with Apple silicon (M1 or newer) | `formledger--macos-arm64.dmg` | Disk image. Open it and drag FormLedger to Applications. | +| Mac with an Intel processor | `formledger--macos-x64.dmg` | The same for Intel Macs. | +| Windows PC (64-bit Intel or AMD) | `formledger--windows-x64-setup.exe` | Installer. The one most people on Windows want. | +| Windows PC (64-bit Intel or AMD) | `formledger--windows-x64.msi` | The same app as an MSI installer, for IT teams that install on many PCs. | +| Linux PC (64-bit Intel or AMD) | `formledger--linux-x64.AppImage` | One file that runs on most Linux systems with no install. | +| Linux PC (64-bit Intel or AMD) | `formledger--linux-x64.deb` | Package for Debian, Ubuntu, Linux Mint and Pop!_OS. | +| Linux PC (64-bit Intel or AMD) | `formledger--linux-x64.rpm` | Package for Fedora, Red Hat, Rocky Linux and openSUSE. | + +Needs macOS 12 or newer on a Mac. `SHA256SUMS.txt` on the same page lists a checksum for every file, to confirm that a download arrived whole. + +All FormLedger builds are compiled and released from [FormCompiler](https://github.com/nodemode-dev/formcompiler); this repo holds the source. ## Run it from source -**Requires:** Go 1.26 and Node 22, the versions the checks use. +**Requires:** Go 1.26 and Node 22, the versions the checks use. The desktop shell also needs Rust and the Tauri 2 system packages. ```sh git clone https://github.com/nodemode-dev/formledger.git @@ -105,6 +145,8 @@ cd formledger ./formledger help # every launcher command ``` +`./formledger desktop dev` opens the desktop window instead, with the server just compiled. + On Windows use `formledger_oc_install.bat` and `formledger.bat`. | Port | What listens | Change it with | @@ -123,9 +165,9 @@ On Windows use `formledger_oc_install.bat` and `formledger.bat`. | `FORMLEDGER_KEY_HOME` | Folder where the server makes and keeps its own key (`formledger.key`) when no key file is given. The desktop app sets it to its app data folder. Losing that key loses the books: back it up (`docs/ENCRYPTION.md`) | > [!IMPORTANT] -> **Status:** early. The ledger, selling, buying and stock work from the command line and over the server's routes. The window's screens for them are new and only partly checked in a browser, and the desktop app in `src-tauri/` has not been compiled. +> **Status:** early. The ledger, selling, buying and stock work from the command line and over the server's routes. The window's screens for them are new and only partly checked in a browser; see [`CHANGELOG.md`](CHANGELOG.md). -**Contributing:** see [`CONTRIBUTING.md`](CONTRIBUTING.md), [`BRANCHING.md`](BRANCHING.md) and [`AGENTS.md`](AGENTS.md). Security reports: [`SECURITY.md`](SECURITY.md). +**Contributing:** branch from `main`, keep changes to source here, and leave packaging and releases to FormCompiler. See [`CONTRIBUTING.md`](CONTRIBUTING.md), [`CODE_OF_CONDUCT.md`](CODE_OF_CONDUCT.md), [`BRANCHING.md`](BRANCHING.md) and [`AGENTS.md`](AGENTS.md). Report security issues privately as [`SECURITY.md`](SECURITY.md) describes. ## Repository @@ -135,7 +177,10 @@ On Windows use `formledger_oc_install.bat` and `formledger.bat`. | `internal/` | The Go server: ledger, selling, buying, stock, reports, printing, roles, audit | | `web/` | The TypeScript and Vite client | | `src-tauri/` | The desktop shell around the server binary | -| `docs/` | What each part does and the behaviors the app commits to | +| `docs/` | What each part does and the behaviours the app commits to | +| `formledger` · `build_app` | The launcher (`./formledger help`) and the build script behind it | + +Docs: [`docs/`](docs/) · Agents: [`CLAUDE.md`](CLAUDE.md), [`AGENTS.md`](AGENTS.md) · Contributing: [`BRANCHING.md`](BRANCHING.md)
From 420106a9f6602c1644321cf3a5ee7b8170ed2cc6 Mon Sep 17 00:00:00 2001 From: nodemode-ai Date: Tue, 1 Dec 2026 13:30:31 -0500 Subject: [PATCH 03/35] feat(home): a start screen and Preferences in the family's form, with theme and accent from the first frame --- web/index.html | 23 +++- web/src/engine/commands.ts | 16 +++ web/src/styles/home.css | 206 +++++++++++++++++++++++++++++++++++ web/src/styles/prefs.css | 218 +++++++++++++++++++++++++++++++++++++ web/src/ui/app.ts | 178 ++++++------------------------ web/src/ui/home.ts | 121 ++++++++++++++++++++ web/src/ui/prefs.ts | 216 ++++++++++++++++++++++++++++++++++++ web/src/ui/themes.ts | 92 ++++++++++++++++ web/src/ui/views.ts | 3 +- 9 files changed, 922 insertions(+), 151 deletions(-) create mode 100644 web/src/styles/home.css create mode 100644 web/src/styles/prefs.css create mode 100644 web/src/ui/home.ts create mode 100644 web/src/ui/prefs.ts create mode 100644 web/src/ui/themes.ts diff --git a/web/index.html b/web/index.html index d612781..b23c7e0 100644 --- a/web/index.html +++ b/web/index.html @@ -8,9 +8,10 @@ FormLedger - + + @@ -59,6 +60,7 @@

Join these books

+

Window

A list for every document type · one form with a line grid for sales and purchase documents · payments with allocation · setup lists · a dashboard of revenue, expenses, profit, cash and top customers by month · a command palette that reaches every screen · light, dark or system theme. See docs/window/

Window

A list for every document type · one form with a line grid for sales and purchase documents · payments with allocation · setup lists · a dashboard of revenue, expenses, profit, cash and top customers by month · a command palette that reaches every screen · light, dark or system theme · from 0.15.0, a menu bar (in the window on Windows and Linux, the system menu on macOS), a Home start screen and Preferences. See docs/window/

Reports

Trial balance · general ledger · profit and loss · balance sheet · receivables and payables aging · stock balance and value

Taking figures out

CSV of every list and report · PDF of quotes, orders, invoices, purchase documents and customer statements · a read-only SQLite snapshot of the books. See docs/EXPORT.md, docs/PRINT.md and docs/SNAPSHOT.md