Skip to content

"CLI-Anything: Making ALL Software Agent-Native" -- CLI-Hub: https://clianything.cc/

Python

feat(firefly-iii): add new command groups

wangyubine73d98031299
diff --git a/firefly-iii/agent-harness/cli_anything/firefly_iii/core/autocomplete.py b/firefly-iii/agent-harness/cli_anything/firefly_iii/core/autocomplete.py
new file mode 100644
index 000000000..82d691b32
--- /dev/null
+++ b/firefly-iii/agent-harness/cli_anything/firefly_iii/core/autocomplete.py
@@ -0,0 +1,215 @@
+r"""
+Autocomplete command group
+
+Provides quick autocomplete suggestions for various Firefly III entities.
+"""
+
+import click
+from ..firefly_iii_cli import get_backend, output
+
+
+def autocomplete():
+ """Autocomplete suggestions"""
+ pass
+
+
[email protected](name="accounts")
[email protected]("--query", help="Search query")
[email protected]("--limit", default=10, help="Number of results")
[email protected]("--date", help="Date for balance (YYYY-MM-DD)")
[email protected]("--types", help="Account types (comma-separated: asset,expense,revenue,liability)")
+def autocomplete_accounts(query, limit, date, types):
+ """Autocomplete accounts"""
+ backend = get_backend()
+ params = {"limit": limit}
+
+ if query:
+ params["query"] = query
+ if date:
+ params["date"] = date
+ if types:
+ params["types"] = types
+
+ result = backend.autocomplete_accounts(params)
+ output(result)
+
+
[email protected](name="bills")
[email protected]("--query", help="Search query")
[email protected]("--limit", default=10, help="Number of results")
+def autocomplete_bills(query, limit):
+ """Autocomplete bills"""
+ backend = get_backend()
+ params = {"limit": limit}
+
+ if query:
+ params["query"] = query
+
+ result = backend.autocomplete_bills(params)
+ output(result)
+
+
[email protected](name="budgets")
[email protected]("--query", help="Search query")
[email protected]("--limit", default=10, help="Number of results")
+def autocomplete_budgets(query, limit):
+ """Autocomplete budgets"""
+ backend = get_backend()
+ params = {"limit": limit}
+
+ if query:
+ params["query"] = query
+
+ result = backend.autocomplete_budgets(params)
+ output(result)
+
+
[email protected](name="categories")
[email protected]("--query", help="Search query")
[email protected]("--limit", default=10, help="Number of results")
+def autocomplete_categories(query, limit):
+ """Autocomplete categories"""
+ backend = get_backend()
+ params = {"limit": limit}
+
+ if query:
+ params["query"] = query
+
+ result = backend.autocomplete_categories(params)
+ output(result)
+
+
[email protected](name="currencies")
[email protected]("--query", help="Search query")
[email protected]("--limit", default=10, help="Number of results")
+def autocomplete_currencies(query, limit):
+ """Autocomplete currencies"""
+ backend = get_backend()
+ params = {"limit": limit}
+
+ if query:
+ params["query"] = query
+
+ result = backend.autocomplete_currencies(params)
+ output(result)
+
+
[email protected](name="piggy-banks")
[email protected]("--query", help="Search query")
[email protected]("--limit", default=10, help="Number of results")
+def autocomplete_piggy_banks(query, limit):
+ """Autocomplete piggy banks"""
+ backend = get_backend()
+ params = {"limit": limit}
+
+ if query:
+ params["query"] = query
+
+ result = backend.autocomplete_piggy_banks(params)
+ output(result)
+
+
[email protected](name="tags")
[email protected]("--query", help="Search query")
[email protected]("--limit", default=10, help="Number of results")
+def autocomplete_tags(query, limit):
+ """Autocomplete tags"""
+ backend = get_backend()
+ params = {"limit": limit}
+
+ if query:
+ params["query"] = query
+
+ result = backend.autocomplete_tags(params)
+ output(result)
+
+
[email protected](name="transactions")
[email protected]("--query", help="Search query")
[email protected]("--limit", default=10, help="Number of results")
+def autocomplete_transactions(query, limit):
+ """Autocomplete transactions"""
+ backend = get_backend()
+ params = {"limit": limit}
+
+ if query:
+ params["query"] = query
+
+ result = backend.autocomplete_transactions(params)
+ output(result)
+
+
[email protected](name="rule-groups")
[email protected]("--query", help="Search query")
[email protected]("--limit", default=10, help="Number of results")
+def autocomplete_rule_groups(query, limit):
+ """Autocomplete rule groups"""
+ backend = get_backend()
+ params = {"limit": limit}
+
+ if query:
+ params["query"] = query
+
+ result = backend.autocomplete_rule_groups(params)
+ output(result)
+
+
[email protected](name="rules")
[email protected]("--query", help="Search query")
[email protected]("--limit", default=10, help="Number of results")
+def autocomplete_rules(query, limit):
+ """Autocomplete rules"""
+ backend = get_backend()
+ params = {"limit": limit}
+
+ if query:
+ params["query"] = query
+
+ result = backend.autocomplete_rules(params)
+ output(result)
+
+
[email protected](name="recurring")
[email protected]("--query", help="Search query")
[email protected]("--limit", default=10, help="Number of results")
+def autocomplete_recurring(query, limit):
+ """Autocomplete recurring transactions"""
+ backend = get_backend()
+ params = {"limit": limit}
+
+ if query:
+ params["query"] = query
+
+ result = backend.autocomplete_recurring(params)
+ output(result)
+
+
[email protected](name="object-groups")
[email protected]("--query", help="Search query")
[email protected]("--limit", default=10, help="Number of results")
+def autocomplete_object_groups(query, limit):
+ """Autocomplete object groups"""
+ backend = get_backend()
+ params = {"limit": limit}
+
+ if query:
+ params["query"] = query
+
+ result = backend.autocomplete_object_groups(params)
+ output(result)
+
+
[email protected](name="transaction-types")
[email protected]("--query", help="Search query")
[email protected]("--limit", default=10, help="Number of results")
+def autocomplete_transaction_types(query, limit):
+ """Autocomplete transaction types"""
+ backend = get_backend()
+ params = {"limit": limit}
+
+ if query:
+ params["query"] = query
+
+ result = backend.autocomplete_transaction_types(params)
+ output(result)
diff --git a/firefly-iii/agent-harness/cli_anything/firefly_iii/core/currencies.py b/firefly-iii/agent-harness/cli_anything/firefly_iii/core/currencies.py
new file mode 100644
index 000000000..c0a103884
--- /dev/null
+++ b/firefly-iii/agent-harness/cli_anything/firefly_iii/core/currencies.py
@@ -0,0 +1,109 @@
+r"""
+Currency management command group
+"""
+
+import click
+from ..firefly_iii_cli import get_backend, output
+
+
+def currencies():
+ """Manage currencies"""
+ pass
+
+
[email protected](name="list")
[email protected]("--limit", default=50, help="Limit results")
[email protected]("--page", default=1, help="Page number")
+def currencies_list(limit, page):
+ """List all currencies"""
+ backend = get_backend()
+ params = {"limit": limit, "page": page}
+ result = backend.get_currencies(params)
+ output(result)
+
+
[email protected](name="get")
[email protected]("--id", required=True, type=int, help="Currency ID")
+def currencies_get(id):
+ """Get currency details"""
+ backend = get_backend()
+ result = backend.get_currency(id)
+ output(result)
+
+
[email protected](name="create")
[email protected]("--code", required=True, help="Currency code (ISO 4217, e.g., USD, EUR)")
[email protected]("--name", required=True, help="Currency name")
[email protected]("--symbol", required=True, help="Currency symbol (e.g., $)")
[email protected]("--decimal-places", default=2, type=int, help="Number of decimal places")
[email protected]("--enabled", default=True, type=bool, help="Is enabled")
+def currencies_create(code, name, symbol, decimal_places, enabled):
+ """Create a new currency"""
+ backend = get_backend()
+
+ data = {
+ "code": code,
+ "name": name,
+ "symbol": symbol,
+ "decimal_places": decimal_places,
+ "enabled": enabled,
+ }
+
+ result = backend.create_currency(data)
+ output(result)
+
+
[email protected](name="update")
[email protected]("--id", required=True, type=int, help="Currency ID")
[email protected]("--name", help="Currency name")
[email protected]("--symbol", help="Currency symbol")
[email protected]("--decimal-places", type=int, help="Number of decimal places")
[email protected]("--enabled", type=bool, help="Is enabled")
+def currencies_update(id, name, symbol, decimal_places, enabled):
+ """Update an existing currency"""
+ backend = get_backend()
+
+ data = {}
+ if name:
+ data["name"] = name
+ if symbol:
+ data["symbol"] = symbol
+ if decimal_places is not None:
+ data["decimal_places"] = decimal_places
+ if enabled is not None:
+ data["enabled"] = enabled
+
+ if not data:
+ click.echo("Error: At least one update field is required", err=True)
+ return
+
+ result = backend.update_currency(id, data)
+ output(result)
+
+
[email protected](name="delete")
[email protected]("--id", required=True, type=int, help="Currency ID")
[email protected]_option(prompt="Are you sure you want to delete this currency?")
+def currencies_delete(id):
+ """Delete a currency"""
+ backend = get_backend()
+ result = backend.delete_currency(id)
+ output(result)
+
+
[email protected](name="exchange-rates")
[email protected]("--from", "from_code", help="Source currency code")
[email protected]("--to", "to_code", help="Target currency code")
+def currencies_exchange_rates(from_code, to_code):
+ """Get currency exchange rates"""
+ backend = get_backend()
+ params = {}
+
+ if from_code:
+ params["from"] = from_code
+ if to_code:
+ params["to"] = to_code
+
+ result = backend.get_currency_exchange_rates(params)
+ output(result)
diff --git a/firefly-iii/agent-harness/cli_anything/firefly_iii/core/recurrences.py b/firefly-iii/agent-harness/cli_anything/firefly_iii/core/recurrences.py
new file mode 100644
index 000000000..59ebaf9fa
--- /dev/null
+++ b/firefly-iii/agent-harness/cli_anything/firefly_iii/core/recurrences.py
@@ -0,0 +1,152 @@
+r"""
+Recurring transaction management command group
+"""
+
+import click
+from datetime import datetime
+from ..firefly_iii_cli import get_backend, output
+
+
+def recurrences():
+ """Manage recurring transactions"""
+ pass
+
+
[email protected](name="list")
[email protected]("--limit", default=50, help="Limit results")
[email protected]("--page", default=1, help="Page number")
+def recurrences_list(limit, page):
+ """List all recurring transactions"""
+ backend = get_backend()
+ params = {"limit": limit, "page": page}
+ result = backend.get_recurrences(params)
+ output(result)
+
+
[email protected](name="get")
[email protected]("--id", required=True, type=int, help="Recurrence ID")
+def recurrences_get(id):
+ """Get recurring transaction details"""
+ backend = get_backend()
+ result = backend.get_recurrence(id)
+ output(result)
+
+
[email protected](name="create")
[email protected]("--title", required=True, help="Recurrence title")
+ type=click.Choice(['withdrawal', 'deposit', 'transfer']),
+ required=True,
+ help="Transaction type")
[email protected]("--amount", required=True, help="Amount")
[email protected]("--currency-code", default="USD", help="Currency code")
[email protected]("--source-account", required=True, help="Source account ID")
[email protected]("--destination-account", help="Destination account ID")
[email protected]("--frequency",
+ type=click.Choice(['daily', 'weekly', 'monthly', 'quarterly', 'half-yearly', 'yearly']),
+ required=True,
+ help="Frequency")
[email protected]("--start-date", help="Start date (YYYY-MM-DD)")
[email protected]("--end-date", help="End date (YYYY-MM-DD)")
[email protected]("--description", help="Description")
[email protected]("--notes", help="Notes")
[email protected]("--tags", help="Tags (comma-separated)")
+def recurrences_create(title, type, amount, currency_code, source_account,
+ destination_account, frequency, start_date, end_date,
+ description, notes, tags):
+ """Create a new recurring transaction"""
+ backend = get_backend()
+
+ data = {
+ "title": title,
+ "type": type,
+ "amount": amount,
+ "currency_code": currency_code,
+ "source_id": source_account,
+ "frequency": frequency,
+ }
+
+ if destination_account:
+ data["destination_id"] = destination_account
+ if start_date:
+ data["start_date"] = start_date
+ if end_date:
+ data["end_date"] = end_date
+ if description:
+ data["description"] = description
+ if notes:
+ data["notes"] = notes
+ if tags:
+ data["tags"] = [t.strip() for t in tags.split(",")]
+
+ result = backend.create_recurrence(data)
+ output(result)
+
+
[email protected](name="update")
[email protected]("--id", required=True, type=int, help="Recurrence ID")
[email protected]("--title", help="Recurrence title")
+ type=click.Choice(['withdrawal', 'deposit', 'transfer']),
+ help="Transaction type")
[email protected]("--amount", help="Amount")
[email protected]("--currency-code", help="Currency code")
[email protected]("--source-account", help="Source account ID")
[email protected]("--destination-account", help="Destination account ID")
[email protected]("--frequency",
+ type=click.Choice(['daily', 'weekly', 'monthly', 'quarterly', 'half-yearly', 'yearly']),
+ help="Frequency")
[email protected]("--start-date", help="Start date (YYYY-MM-DD)")
[email protected]("--end-date", help="End date (YYYY-MM-DD)")
[email protected]("--description", help="Description")
[email protected]("--notes", help="Notes")
[email protected]("--tags", help="Tags (comma-separated)")
+def recurrences_update(id, title, type, amount, currency_code, source_account,
+ destination_account, frequency, start_date, end_date,
+ description, notes, tags):
+ """Update an existing recurring transaction"""
+ backend = get_backend()
+
+ data = {}
+ if title:
+ data["title"] = title
+ if type:
+ data["type"] = type
+ if amount:
+ data["amount"] = amount
+ if currency_code:
+ data["currency_code"] = currency_code
+ if source_account:
+ data["source_id"] = source_account
+ if destination_account:
+ data["destination_id"] = destination_account
+ if frequency:
+ data["frequency"] = frequency
+ if start_date:
+ data["start_date"] = start_date
+ if end_date:
+ data["end_date"] = end_date
+ if description:
+ data["description"] = description
+ if notes:
+ data["notes"] = notes
+ if tags:
+ data["tags"] = [t.strip() for t in tags.split(",")]
+
+ if not data:
+ click.echo("Error: At least one update field is required", err=True)
+ return
+
+ result = backend.update_recurrence(id, data)
+ output(result)
+
+
[email protected](name="delete")
[email protected]("--id", required=True, type=int, help="Recurrence ID")
[email protected]_option(prompt="Are you sure you want to delete this recurring transaction?")
+def recurrences_delete(id):
+ """Delete a recurring transaction"""
+ backend = get_backend()
+ result = backend.delete_recurrence(id)
+ output(result)
diff --git a/firefly-iii/agent-harness/cli_anything/firefly_iii/core/rule_groups.py b/firefly-iii/agent-harness/cli_anything/firefly_iii/core/rule_groups.py
new file mode 100644
index 000000000..cb4172fd6
--- /dev/null
+++ b/firefly-iii/agent-harness/cli_anything/firefly_iii/core/rule_groups.py
@@ -0,0 +1,98 @@
+r"""
+Rule group management command group
+"""
+
+import click
+from ..firefly_iii_cli import get_backend, output
+
+
+def rule_groups():
+ """Manage rule groups"""
+ pass
+
+
+@rule_groups.command(name="list")
[email protected]("--limit", default=50, help="Limit results")
[email protected]("--page", default=1, help="Page number")
+def rule_groups_list(limit, page):
+ """List all rule groups"""
+ backend = get_backend()
+ params = {"limit": limit, "page": page}
+ result = backend.get_rule_groups(params)
+ output(result)
+
+
+@rule_groups.command(name="get")
[email protected]("--id", required=True, type=int, help="Rule group ID")
+def rule_groups_get(id):
+ """Get rule group details"""
+ backend = get_backend()
+ result = backend.get_rule_group(id)
+ output(result)
+
+
+@rule_groups.command(name="create")
[email protected]("--title", required=True, help="Rule group title")
[email protected]("--description", help="Description")
[email protected]("--priority", default=0, type=int, help="Priority")
+def rule_groups_create(title, description, priority):
+ """Create a new rule group"""
+ backend = get_backend()
+
+ data = {
+ "title": title,
+ "priority": priority,
+ }
+ if description:
+ data["description"] = description
+
+ result = backend.create_rule_group(data)
+ output(result)
+
+
+@rule_groups.command(name="update")
[email protected]("--id", required=True, type=int, help="Rule group ID")
[email protected]("--title", help="Rule group title")
[email protected]("--description", help="Description")
[email protected]("--priority", type=int, help="Priority")
[email protected]("--active", type=bool, help="Is active")
+def rule_groups_update(id, title, description, priority, active):
+ """Update an existing rule group"""
+ backend = get_backend()
+
+ data = {}
+ if title:
+ data["title"] = title
+ if description:
+ data["description"] = description
+ if priority is not None:
+ data["priority"] = priority
+ if active is not None:
+ data["active"] = active
+
+ if not data:
+ click.echo("Error: At least one update field is required", err=True)
+ return
+
+ result = backend.update_rule_group(id, data)
+ output(result)
+
+
+@rule_groups.command(name="delete")
[email protected]("--id", required=True, type=int, help="Rule group ID")
[email protected]_option(prompt="Are you sure you want to delete this rule group?")
+def rule_groups_delete(id):
+ """Delete a rule group"""
+ backend = get_backend()
+ result = backend.delete_rule_group(id)
+ output(result)
+
+
+@rule_groups.command(name="execute")
[email protected]("--id", required=True, type=int, help="Rule group ID")
+def rule_groups_execute(id):
+ """Execute all rules in a rule group"""
+ backend = get_backend()
+ result = backend.execute_rule_group(id)
+ output(result)
diff --git a/firefly-iii/agent-harness/cli_anything/firefly_iii/core/rules.py b/firefly-iii/agent-harness/cli_anything/firefly_iii/core/rules.py
new file mode 100644
index 000000000..12d43b16e
--- /dev/null
+++ b/firefly-iii/agent-harness/cli_anything/firefly_iii/core/rules.py
@@ -0,0 +1,135 @@
+r"""
+Rule management command group
+"""
+
+import click
+from datetime import datetime
+from ..firefly_iii_cli import get_backend, output
+
+
+def rules():
+ """Manage transaction rules"""
+ pass
+
+
[email protected](name="list")
[email protected]("--limit", default=50, help="Limit results")
[email protected]("--page", default=1, help="Page number")
+def rules_list(limit, page):
+ """List all rules"""
+ backend = get_backend()
+ params = {"limit": limit, "page": page}
+ result = backend.get_rules(params)
+ output(result)
+
+
[email protected](name="get")
[email protected]("--id", required=True, type=int, help="Rule ID")
+def rules_get(id):
+ """Get rule details"""
+ backend = get_backend()
+ result = backend.get_rule(id)
+ output(result)
+
+
[email protected](name="create")
[email protected]("--title", required=True, help="Rule title")
[email protected]("--trigger", required=True, help="Trigger type (e.g., from_account_is, to_account_is, description_contains)")
[email protected]("--value", required=True, help="Trigger value")
[email protected]("--action", required=True,
+ type=click.Choice(['set_category', 'add_tag', 'remove_tag', 'set_description', 'set_source_account', 'set_destination_account']),
+ help="Action to take")
[email protected]("--action-value", help="Action value (e.g., category name)")
[email protected]("--rule-group-id", type=int, help="Rule group ID")
[email protected]("--priority", default=0, type=int, help="Priority (lower = higher priority)")
[email protected]("--notes", help="Notes")
+def rules_create(title, trigger, value, action, action_value, rule_group_id, priority, notes):
+ """Create a new rule"""
+ backend = get_backend()
+
+ data = {
+ "title": title,
+ "triggers": [{"type": trigger, "value": value}],
+ "actions": [{"type": action, "value": action_value or ""}],
+ "priority": priority,
+ }
+
+ if rule_group_id:
+ data["rule_group_id"] = rule_group_id
+ if notes:
+ data["notes"] = notes
+
+ result = backend.create_rule(data)
+ output(result)
+
+
[email protected](name="update")
[email protected]("--id", required=True, type=int, help="Rule ID")
[email protected]("--title", help="Rule title")
[email protected]("--trigger", help="Trigger type")
[email protected]("--value", help="Trigger value")
[email protected]("--action",
+ type=click.Choice(['set_category', 'add_tag', 'remove_tag', 'set_description', 'set_source_account', 'set_destination_account']),
+ help="Action type")
[email protected]("--action-value", help="Action value")
[email protected]("--rule-group-id", type=int, help="Rule group ID")
[email protected]("--priority", type=int, help="Priority")
[email protected]("--notes", help="Notes")
[email protected]("--active", type=bool, help="Is active")
+def rules_update(id, title, trigger, value, action, action_value, rule_group_id, priority, notes, active):
+ """Update an existing rule"""
+ backend = get_backend()
+
+ data = {}
+ if title:
+ data["title"] = title
+ if trigger and value:
+ data["triggers"] = [{"type": trigger, "value": value}]
+ if action:
+ data["actions"] = [{"type": action, "value": action_value or ""}]
+ if rule_group_id:
+ data["rule_group_id"] = rule_group_id
+ if priority is not None:
+ data["priority"] = priority
+ if notes:
+ data["notes"] = notes
+ if active is not None:
+ data["active"] = active
+
+ if not data:
+ click.echo("Error: At least one update field is required", err=True)
+ return
+
+ result = backend.update_rule(id, data)
+ output(result)
+
+
[email protected](name="delete")
[email protected]("--id", required=True, type=int, help="Rule ID")
[email protected]_option(prompt="Are you sure you want to delete this rule?")
+def rules_delete(id):
+ """Delete a rule"""
+ backend = get_backend()
+ result = backend.delete_rule(id)
+ output(result)
+
+
[email protected](name="test")
[email protected]("--id", required=True, type=int, help="Rule ID")
[email protected]("--data", help="JSON data for test")
+def rules_test(id, data):
+ """Test a rule against sample data"""
+ backend = get_backend()
+ test_data = data or {}
+ result = backend.test_rule(id, test_data)
+ output(result)
+
+
[email protected](name="execute")
[email protected]("--id", required=True, type=int, help="Rule ID")
+def rules_execute(id):
+ """Execute a rule against existing transactions"""
+ backend = get_backend()
+ result = backend.execute_rule(id)
+ output(result)
diff --git a/firefly-iii/agent-harness/cli_anything/firefly_iii/core/summary.py b/firefly-iii/agent-harness/cli_anything/firefly_iii/core/summary.py
new file mode 100644
index 000000000..049e750b3
--- /dev/null
+++ b/firefly-iii/agent-harness/cli_anything/firefly_iii/core/summary.py
@@ -0,0 +1,105 @@
+r"""
+Summary command group
+
+Provides various summary reports and statistics.
+"""
+
+import click
+from ..firefly_iii_cli import get_backend, output
+
+
+def summary():
+ """Financial summaries and reports"""
+ pass
+
+
[email protected](name="default-set")
[email protected]("--start", required=True, help="Start date (YYYY-MM-DD)")
[email protected]("--end", required=True, help="End date (YYYY-MM-DD)")
+def summary_default_set(start, end):
+ """Get default summary set"""
+ backend = get_backend()
+ params = {"start": start, "end": end}
+ result = backend.get_summary("default-set", params)
+ output(result)
+
+
[email protected](name="account-summary")
[email protected]("--start", required=True, help="Start date (YYYY-MM-DD)")
[email protected]("--end", required=True, help="End date (YYYY-MM-DD)")
[email protected]("--accounts", help="Account IDs (comma-separated)")
+def summary_account_summary(start, end, accounts):
+ """Get account summary"""
+ backend = get_backend()
+ params = {"start": start, "end": end}
+ if accounts:
+ params["accounts"] = accounts
+ result = backend.get_summary("account-summary", params)
+ output(result)
+
+
[email protected](name="available-budget")
[email protected]("--start", required=True, help="Start date (YYYY-MM-DD)")
[email protected]("--end", required=True, help="End date (YYYY-MM-DD)")
+def summary_available_budget(start, end):
+ """Get available budget summary"""
+ backend = get_backend()
+ params = {"start": start, "end": end}
+ result = backend.get_summary("available-budget", params)
+ output(result)
+
+
[email protected](name="bill-summary")
[email protected]("--start", required=True, help="Start date (YYYY-MM-DD)")
[email protected]("--end", required=True, help="End date (YYYY-MM-DD)")
+def summary_bill_summary(start, end):
+ """Get bill summary"""
+ backend = get_backend()
+ params = {"start": start, "end": end}
+ result = backend.get_summary("bill-summary", params)
+ output(result)
+
+
[email protected](name="budget-summary")
[email protected]("--start", required=True, help="Start date (YYYY-MM-DD)")
[email protected]("--end", required=True, help="End date (YYYY-MM-DD)")
+def summary_budget_summary(start, end):
+ """Get budget summary"""
+ backend = get_backend()
+ params = {"start": start, "end": end}
+ result = backend.get_summary("budget-summary", params)
+ output(result)
+
+
[email protected](name="category-summary")
[email protected]("--start", required=True, help="Start date (YYYY-MM-DD)")
[email protected]("--end", required=True, help="End date (YYYY-MM-DD)")
+def summary_category_summary(start, end):
+ """Get category summary"""
+ backend = get_backend()
+ params = {"start": start, "end": end}
+ result = backend.get_summary("category-summary", params)
+ output(result)
+
+
[email protected](name="tag-summary")
[email protected]("--start", required=True, help="Start date (YYYY-MM-DD)")
[email protected]("--end", required=True, help="End date (YYYY-MM-DD)")
+def summary_tag_summary(start, end):
+ """Get tag summary"""
+ backend = get_backend()
+ params = {"start": start, "end": end}
+ result = backend.get_summary("tag-summary", params)
+ output(result)
+
+
[email protected](name="transfer-summary")
[email protected]("--start", required=True, help="Start date (YYYY-MM-DD)")
[email protected]("--end", required=True, help="End date (YYYY-MM-DD)")
+def summary_transfer_summary(start, end):
+ """Get transfer summary"""
+ backend = get_backend()
+ params = {"start": start, "end": end}
+ result = backend.get_summary("transfer-summary", params)
+ output(result)
diff --git a/firefly-iii/agent-harness/cli_anything/firefly_iii/core/webhooks.py b/firefly-iii/agent-harness/cli_anything/firefly_iii/core/webhooks.py
new file mode 100644
index 000000000..6d6919b42
--- /dev/null
+++ b/firefly-iii/agent-harness/cli_anything/firefly_iii/core/webhooks.py
@@ -0,0 +1,125 @@
+r"""
+Webhook management command group
+"""
+
+import click
+from ..firefly_iii_cli import get_backend, output
+
+
+def webhooks():
+ """Manage webhooks"""
+ pass
+
+
[email protected](name="list")
[email protected]("--limit", default=50, help="Limit results")
[email protected]("--page", default=1, help="Page number")
+def webhooks_list(limit, page):
+ """List all webhooks"""
+ backend = get_backend()
+ params = {"limit": limit, "page": page}
+ result = backend.get_webhooks(params)
+ output(result)
+
+
[email protected](name="get")
[email protected]("--id", required=True, type=int, help="Webhook ID")
+def webhooks_get(id):
+ """Get webhook details"""
+ backend = get_backend()
+ result = backend.get_webhook(id)
+ output(result)
+
+
[email protected](name="create")
[email protected]("--title", required=True, help="Webhook title")
[email protected]("--trigger",
+ type=click.Choice(['create', 'update', 'delete']),
+ required=True,
+ help="Trigger event type")
[email protected]("--url", required=True, help="Webhook URL")
[email protected]("--secret", help="Webhook secret")
[email protected]("--active", default=True, type=bool, help="Is active")
[email protected]("--events",
+ type=click.Choice(['ANY', 'TRANSACTION_STORE', 'TRANSACTION_UPDATE', 'TRANSACTION_DESTROY',
+ 'JOURNAL_CREATE', 'JOURNAL_UPDATE', 'JOURNAL_DESTROY']),
+ multiple=True,
+ help="Events to trigger on")
+def webhooks_create(title, trigger, url, secret, active, events):
+ """Create a new webhook"""
+ backend = get_backend()
+
+ data = {
+ "title": title,
+ "trigger": trigger,
+ "url": url,
+ "active": active,
+ }
+
+ if secret:
+ data["secret"] = secret
+ if events:
+ data["events"] = list(events)
+
+ result = backend.create_webhook(data)
+ output(result)
+
+
[email protected](name="update")
[email protected]("--id", required=True, type=int, help="Webhook ID")
[email protected]("--title", help="Webhook title")
[email protected]("--trigger",
+ type=click.Choice(['create', 'update', 'delete']),
+ help="Trigger event type")
[email protected]("--url", help="Webhook URL")
[email protected]("--secret", help="Webhook secret")
[email protected]("--active", type=bool, help="Is active")
[email protected]("--events",
+ type=click.Choice(['ANY', 'TRANSACTION_STORE', 'TRANSACTION_UPDATE', 'TRANSACTION_DESTROY',
+ 'JOURNAL_CREATE', 'JOURNAL_UPDATE', 'JOURNAL_DESTROY']),
+ multiple=True,
+ help="Events to trigger on")
+def webhooks_update(id, title, trigger, url, secret, active, events):
+ """Update an existing webhook"""
+ backend = get_backend()
+
+ data = {}
+ if title:
+ data["title"] = title
+ if trigger:
+ data["trigger"] = trigger
+ if url:
+ data["url"] = url
+ if secret:
+ data["secret"] = secret
+ if active is not None:
+ data["active"] = active
+ if events:
+ data["events"] = list(events)
+
+ if not data:
+ click.echo("Error: At least one update field is required", err=True)
+ return
+
+ result = backend.update_webhook(id, data)
+ output(result)
+
+
[email protected](name="delete")
[email protected]("--id", required=True, type=int, help="Webhook ID")
[email protected]_option(prompt="Are you sure you want to delete this webhook?")
+def webhooks_delete(id):
+ """Delete a webhook"""
+ backend = get_backend()
+ result = backend.delete_webhook(id)
+ output(result)
+
+
[email protected](name="trigger")
[email protected]("--id", required=True, type=int, help="Webhook ID")
+def webhooks_trigger(id):
+ """Trigger a webhook manually"""
+ backend = get_backend()
+ result = backend.trigger_webhook(id)
+ output(result)