belege-cli (0.0.2)
Installation
registry=https://gitea.i.ivo-zilkenat.de/api/packages/ivo.zilkenat/npm/npm install belege-cli@0.0.2"belege-cli": "0.0.2"About this package
belege-cli
TypeScript CLI for Belege. Calls the public Convex functions — the same the
frontend uses — as a real user, authenticated by an opaque blg_… token
exchanged for a short-lived JWT at /cli/token. Architecture adopted from
Plexus.
Quickstart
pnpm install
pnpm dev config show # in-repo (tsx), no build
pnpm dev whoami
pnpm dev tokens create "my machine" # mint a token (shown once)
pnpm build && pnpm link:global # → `belege-cli` on PATH
Local dev needs zero config: run from inside a started rdu worktree and the
CLI resolves that deployment + bootstraps a token via the rdu admin key. Remote
targets need a blg_… token — see .claude/rules/cli.md for the belege.yml
schema and the full command reference.
Architecture
core/ brand-neutral framework (transport, auth, jwt-cache, config, output, spec, command)
belege/ branded layer — branding, client (env/auth resolution), command base, commands/, lib/
cli.ts clipanion bootstrap
core/ never hard-codes a product; belege/branding.ts supplies all
product-specific strings. Commands import the backend's generated api
(app/convex/_generated), so calls are end-to-end typed and bundled at build.
Escape hatch: belege-cli call <module:fn> [--kind query|mutation|action] k=v …
reaches any public function without a typed wrapper.
Buchungsaufteilung — split / unsplit
Eine Bank-Buchung auf mehrere Konten aufteilen (z. B. 70/30-Bewirtung), ohne den
rohen call bookings:splitBooking JSON-Umweg:
# Jede Position: "konto:betrag:steuerschluessel[:zusatzangabe]" (>=2, wiederholbar)
# Betrag in EUR: 70, 70.00 oder 70,00 werden string-basiert nach Cent umgerechnet
# (kein Float-Drift). konto/zusatzangabe dürfen leer sein.
belege-cli --env local --tenant test split <bookingId> \
--line "4930:55,93:0" \
--line "4980:23,97:0"
# Aufteilung wieder zusammenführen (Geschwisterzeilen löschen, Primärzeile auf den
# vollen Betrag zurücksetzen):
belege-cli --env local --tenant test unsplit <bookingId>
Regeln (fail-loud in bookings:splitBooking — die CLI reicht die Server-Meldung
wörtlich durch, kein Schlucken):
- mind. 2 Positionen, jeder Betrag > 0;
- Kontrollsumme: Summe der Positionen = Buchungsbetrag (exakt, in Cent);
- Buchung darf nicht
validated(vorher entsperren) und nicht bereits aufgeteilt sein; Periode muss offen sein.
split zeigt danach die entstandenen Geschwisterzeilen (--json für Rohdaten).
Dependencies
Development Dependencies
| ID | Version |
|---|---|
| @types/js-yaml | ^4.0.9 |
| @types/node | ^22.10.0 |
| clipanion | 4.0.0-rc.4 |
| convex | ^1.38.0 |
| esbuild | 0.27.0 |
| js-yaml | ^4.2.0 |
| tsx | ^4.21.0 |
| typescript | ^6.0.3 |