From 07f4134d38e53bf6c9235f3ad18dd5b33e89d9ff Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Thu, 15 Oct 2026 11:02:34 +0200 Subject: feat(piggy): piggy list/add/remove (v0.6.0) New `piggy` group: - `piggy list` lists piggy banks with saved/target amounts and linked accounts. - `piggy add|remove [--account NAME]` changes the saved amount on a linked account via PUT /piggy-banks/{id}. Firefly syncs the whole account list on that PUT, so every linked account is resent (others without current_amount, which keeps their value) or it would be unlinked. Removing below zero is rejected before any write, and the saved amount is read back so a refused add fails loudly instead of returning 200 unchanged. add/remove currently hit an upstream bug on Firefly III <= 6.7.9: PiggyBankFactory::linkToAccountIds passes the pivot current_amount (an int from the DB) to bcsub() uncast, so any PUT with "accounts" 500s (firefly-iii/firefly-iii#13063). Documented in SKILL.md/README; the live integration test skips on that error and runs once upstream is fixed. Co-Authored-By: Claude Opus 5.5 --- firefly_cli/resolver.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'firefly_cli/resolver.py') diff --git a/firefly_cli/resolver.py b/firefly_cli/resolver.py index cb7e9a8..1a5de11 100644 --- a/firefly_cli/resolver.py +++ b/firefly_cli/resolver.py @@ -59,3 +59,11 @@ class Resolver: def budget_by_id(self, budget_id): item = self.client.request("GET", f"/api/v1/budgets/{budget_id}")["data"] return {"id": item["id"], **item.get("attributes", {})} + + def piggy(self, name_or_id): + # Same name-or-id sniff as budget(), same ponytail caveat (a piggy bank + # literally named "7" is unreachable by name). + if str(name_or_id).isdigit(): + item = self.client.request("GET", f"/api/v1/piggy-banks/{name_or_id}")["data"] + return {"id": item["id"], **item.get("attributes", {})} + return self._match("piggy bank", self._list("/api/v1/piggy-banks"), name_or_id) -- cgit v1.2.3