Add per-client billing basis export

This commit is contained in:
tegwick 2026-08-11 14:39:48 +02:00
parent b75ad06b3a
commit fcec177ded
10 changed files with 506 additions and 11 deletions

View file

@ -15,6 +15,7 @@ from fin_hub.ingest.cloud import parse_cloud_cost_csv
from fin_hub.ingest.hosteurope import parse_hosteurope_csv
from fin_hub.services.alerts import evaluate_budget_alerts
from fin_hub.services.allocation import shared_cost_allocations
from fin_hub.services.billing import build_billing_basis
from fin_hub.services.evaluate import evaluate_runway
from fin_hub.services.evidence import write_runway_evidence
from fin_hub.services.ledger import (
@ -156,6 +157,12 @@ def _cmd_ledger_allocations(args: argparse.Namespace) -> int:
return 0
def _cmd_ledger_billing_basis(args: argparse.Namespace) -> int:
export = build_billing_basis(ledger_path=_ledger_path(args))
print(json.dumps(export.as_dict(), indent=2, default=str))
return 0
def _cmd_evaluate(args: argparse.Namespace) -> int:
report = evaluate_runway(
ledger_path=_ledger_path(args),
@ -275,6 +282,13 @@ def build_parser() -> argparse.ArgumentParser:
ledger_allocations.add_argument("--ledger", help="Ledger database path")
ledger_allocations.set_defaults(func=_cmd_ledger_allocations)
billing_basis = ledger_sub.add_parser(
"billing-basis",
help="Export deterministic per-client reporting basis (never an invoice)",
)
billing_basis.add_argument("--ledger", help="Ledger database path")
billing_basis.set_defaults(func=_cmd_ledger_billing_basis)
evaluate = sub.add_parser(
"evaluate",
help="Evaluate runway from ledger burns (cron/systemd friendly)",