Skip to content

fafycat analytics top #35

@davidchris

Description

@davidchris

Parent

#26

What to build

Single subcommand fafycat analytics top that returns the largest spending transactions for a given month. Reuses AnalyticsService.get_top_transactions_by_month.

  • Flags: --year YYYY (default current year), --month MM (default current month), --limit N (default 5, cap 50).
  • Response shape mirrors the service: top transactions list, total spending for the month, and per-row percentage of total.

Acceptance criteria

  • fafycat analytics top returns the current month's top 5 spending transactions as JSON.
  • fafycat analytics top --year 2026 --month 4 returns April 2026 top transactions.
  • fafycat analytics top --limit 10 returns the top 10.
  • fafycat analytics top --limit 100 exits 2 with a usage error on stderr (cap is 50).
  • fafycat analytics top --month 13 exits 2 with a usage error.
  • Stdout is JSON only; stderr is empty on the happy path.
  • Tests are written before the implementation (red-green TDD).
  • Subprocess integration tests cover: defaults, explicit --year/--month, custom --limit, the over-cap error path, the invalid-month error path.

Blocked by

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions