telco

CLI reference

Check and compare price books, explain a bill, inspect event schemas or listen for signed deliveries.

On this page

Install the CLI with cargo install telco, or from a checkout with cargo install --path crates/telco. Run telco --help for global options.

telco price check <BOOK_DIR> [--json]
telco price rate  <BOOK_DIR> --plan <ID> --start <YYYY-MM-DD> [--end <YYYY-MM-DD>]
                  --period <YYYY-MM> [--usage <FILE.toml>] [--json]
telco price quote <BOOK_DIR> --plan <ID> --start <YYYY-MM-DD> [--json]
telco price diff  <OLD_DIR> <NEW_DIR> [--format text|json|markdown]
telco price schema
telco price test  <CASE.json> --book <BOOK_DIR> [--book <BOOK_DIR>…]
telco price test  --from-bill <BILL> [--url URL]                  # TELCO_TOKEN
telco export <BILL> [--url URL]                                   # TELCO_TOKEN

telco evidence tariff-check <TARIFFS.json>
telco evidence prepare <REVIEW.json> <TARIFFS.json> --out <NEW_DIR>
telco evidence verify <PACK> --keyring <TRUSTED.gpg> --fingerprint <PRIMARY_FPR>

telco migration validate <PACKAGE.json>
telco migration shadow <PACKAGE.json>
telco migration verify <PACKAGE.json> <REPORT.json>
telco migration reconcile <PACKAGE.json> <REGISTER.json> [--details]

telco finance batches <YYYY-MM> --journal <JOURNAL> --adviser <NUMBER> --client <NUMBER>
                     [--url <ACCOUNTING_ORIGIN>] [--token-file <FILE>]
telco finance reconcile <RECEIPT.json> <IMPORTED.json>
telco finance review-month <REGISTER.json> <EVIDENCE_DIR>

telco dispatch review <SNAPSHOT.json> <SENDER.json>
telco complaints review <REGISTRY.json> <RETURN.json>…
telco complaints draft  <REGISTRY.json> <RETURN.json>… --reviewed <REVIEW_SHA256>

telco demo                    [--contractd URL] [--billd URL] [--accountingd URL] [--chargingd URL] [--usaged URL]
telco why <BILL_ID> [N]       [--url URL]                         # TELCO_TOKEN
telco listen [--types T,…] [--json] [--all]                       # TELCO_TOKEN
telco listen --webhook ADDR --secret S                            # TELCO_WEBHOOK_SECRET
telco listen --subscribe [--webhook ADDR]                         # registers, receives, removes
telco events list
telco events schema <TYPE> | --out DIR
telco events asyncapi

--edge URL   (TELCO_EDGE) reach operator services through the Desk’s edge

finance batches uses the private accounting origin (TELCO_ACCOUNTING_URL) and a named finance key file (TELCO_FINANCE_TOKEN_FILE). It prints a complete register in issue order. finance review-month checks the entire issued set against the adviser’s evidence. Month review, finance reconcile, billing assurance, migration rehearsal, tariff checks and event-schema commands run offline. Reconcile a DATEV import · Billing assurance · Migration guide

By default, service commands reach contractd on 127.0.0.1:9401 and billd on 127.0.0.1:9402 (just dev). --edge http://localhost:9400 reaches both through the Desk's edge, which is all just demo publishes. NO_COLOR turns colour off.

check

Compiles the book and runs its golden tests.

$ telco price check pricebooks/example-fibre
example-fibre 2026-11  sha256:fe9fd12f8962…  1 plan · 9 tests
  ✓ ending-mid-month
  ✓ first-month
  …
all 9 passed

Exit codes: 0 all passed, 1 a test failed, 2 the book was refused. A refusal names the file, line and column, and a fix:

error[book.unknown-key]: unknown key „recuring“
  --> plans/glasfaser-1000.toml:4:9
  = fix: did you mean „recurring“?

rate

Rates one plan for one month and prints the lines with their explanations and the VAT breakdown. The usage file has the same shape as a golden test's usage:

usage = [
  { id = "c1", kind = "calls-mobile", date = "2026-11-12", quantity = 754 },
  { id = "c2", kind = "calls-landline", date = "2026-11-13", quantity = 1260 },
]

--json prints one JSON document with every charge, its trace and the totals — the form to pipe into other tools.

quote

What a plan will cost from a day, as a shop shows it before the customer signs: the first bill (from the start day, with one-off charges), the next, and every later price step, each line with its „Warum?", then one sentence:

$ telco price quote pricebooks/example-fibre --plan glasfaser-1000 --start 2026-12-05
…
Erste Rechnung 96,10 €, danach 29,97 € im Monat, ab März 2027 59,97 €.

The same composition a seal runs, so the quote is the bill. --json prints what billd's GET /quote answers (Selling).

diff

telco price diff <old> <new> shows what one version of a book does to the bills compared with another, before anyone pays it. Every plan is rated for a regular month (the seventh month of a contract, past the usual promotions and one-off charges) and every golden test of the new book under both versions; the changes come largest first, with one sentence at the end.

$ telco price diff pricebooks/example-fibre ../next/example-fibre
Preisbuch example-fibre@2026-11 → example-fibre@2026-12

  Fall                                        Monat     vorher    nachher  Differenz
  Glasfaser 1000 · regulärer Monat          2027-05    59,97 €    62,97 €    +3,00 €
  second-month (Glasfaser 1000)             2026-11    32,44 €    35,44 €    +3,00 €
  first-month (Glasfaser 1000)              2026-10    85,47 €    87,02 €    +1,55 €
  Glasfaser 2000 · regulärer Monat          2027-05    69,97 €    69,97 €    ±0,00 €

3 Fälle teurer.

--format markdown prints the same as a table for a pull request (unchanged cases counted, not listed); --format json as one document with exact amounts. A plan only in one book is marked as added or removed; a scenario one book refuses shows the refusal code instead of an amount.

schema

telco price schema prints the JSON Schema (draft 2020-12) of a book file — header, plans, kinds, tax and golden tests — with a description for every key. The sample books name it on their first line, so Taplo and Tombi (the TOML language servers in VS Code, Zed, Helix and JetBrains IDEs) complete keys, explain them on hover and underline an unknown one:

#:schema ../../schema.json
[plan.glasfaser-1000]
name = "Glasfaser 1000"

The schema is generated from the types that parse the files; a test keeps pricebooks/schema.json equal to it.

demo

telco demo plays a year through running services and proves it adds up: three customers sign up, one changes plan, one has usage, one ends its contract, one bill is cancelled with a Stornorechnung, and in the last months a public authority signs up without an invoice e-mail, so its first bill waits in the Desk's Eingang. Each month contractd's clock moves first, then billd's. Then every bill and account is checked — lines sum to the bill, numbers rise, a Stornorechnung negates exactly its bill, no month is billed twice, and the ledger's receivable equals the bills.

$ just seed        # = TELCO_TOKEN=dev-token-0123456789 telco demo
✓ 12 Monate, 26 Rechnungen, 1 Storno, 0 Cent Differenz. 1 Rechnung wartet auf eine E-Mail-Adresse — im Desk unter Eingang.

It exits 1 naming each broken invariant, and refuses to start against a service on the system clock — before it writes anything. The seeder of just demo is this command.

export and price test

Use telco export BILL or telco price test --from-bill BILL to write the invoice’s JSON rating case to standard output. Both accept an invoice number or UUID and use the operator credential for billd. The local test reads the saved case and the supplied price-book directories.

telco --edge http://localhost:9400 export RE-2026-000002 > invoice.replay.json
telco price test invoice.replay.json --book pricebooks/example-fibre

Inputs, hash checks and the offline example

why

telco why <bill-id> [n] prints a sealed bill's lines, or line n, with the explanation the bill carries:

$ TELCO_TOKEN=dev-token-0123456789 telco why 01a1f7c8-… 1
Rechnung RE-2026-000001

Glasfaser-Anschluss
   1  Glasfaser 1000             05.10.2026 – 31.10.2026     43,54 €
      Warum? „Glasfaser 1000" anteilig für 27 von 31 Tagen …

listen

telco listen follows the contract, billing and usage feeds and prints one line per event as it happens, each aggregate in its colour; --types bill,contract.ended filters (a bare aggregate means all its types), --json prints the envelopes for jq, --all starts from the beginning. With --webhook 127.0.0.1:9199 --secret whsec_… it receives deliveries instead and checks each signature — a way to rehearse a subscriber. --subscribe registers a webhook on contractd and billd pointing at the listener (127.0.0.1:9199 unless --webhook says otherwise), prints every signed delivery, and removes the webhook on Ctrl-C — so you see exactly what an integration would receive. The services must be able to reach the address (just dev; in production only a public https URL is accepted). See Events and Webhooks.

events

telco events list prints every type with its source and meaning; telco events schema bill.held prints one type's JSON Schema; --out schemas/events writes all of them (just schemas), as committed in the repository. telco events asyncapi prints the whole contract as one AsyncAPI 3.0 document (schemas/asyncapi.json).

dispatch

Use telco dispatch review snapshot.json sender.json to find missing or conflicting invoice handoffs in a closed seal month. Reconcile invoice dispatch

complaints

Run telco complaints review registry.json crm.json portal.json to check the sources behind a reporting interval. A complete review gives the fingerprint for telco complaints draft. Complaint procedure

Download Markdown