fitzroy 1.7.2 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (5) hide show
  1. package/README.md +48 -17
  2. package/dist/cli.js +4579 -4241
  3. package/dist/index.d.ts +177 -120
  4. package/dist/index.js +2076 -1744
  5. package/package.json +1 -2
package/README.md CHANGED
@@ -1,14 +1,20 @@
1
1
  # fitzroy
2
2
 
3
- TypeScript library and CLI for AFL data — match results, player stats, fixtures, ladders, lineups, squads, and teams.
3
+ [![CI](https://github.com/jackemcpherson/fitzRoy-ts/actions/workflows/ci.yml/badge.svg)](https://github.com/jackemcpherson/fitzRoy-ts/actions/workflows/ci.yml)
4
+ [![npm](https://img.shields.io/npm/v/fitzroy)](https://www.npmjs.com/package/fitzroy)
5
+
6
+ TypeScript library and CLI for AFL data — matches, stats, ladders, teams, players, and awards.
4
7
 
5
8
  A port of the [fitzRoy R package](https://github.com/jimmyday12/fitzRoy).
6
9
 
7
10
  ## Data Sources
8
11
 
9
- - **AFL API** — official AFL/AFLW match results, player stats, fixtures, lineups, ladders, and teams
10
- - **FootyWire** — scraped match results
11
- - **AFL Tables** — historical season results (1897-present)
12
+ - **AFL API** — official AFL data covering AFLM (2012+), AFLW (2017+), VFL and VFLW (2021+). Default for matches, stats, squads, lineups, ladders.
13
+ - **FootyWire** — scraped AFLM match results, fixtures, player stats, team stats, awards
14
+ - **AFL Tables** — AFLM historical results (1897+) and player stats (~1965+)
15
+ - **Squiggle** — AFLM match results and ladder
16
+ - **Fryzigg** — advanced AFLM and AFLW player stats
17
+ - **AFL Coaches** — AFLCA coaches votes
12
18
 
13
19
  ## Install
14
20
 
@@ -19,16 +25,25 @@ npm install fitzroy
19
25
  ## Library Usage
20
26
 
21
27
  ```typescript
22
- import { fetchMatchResults, fetchPlayerStats, fetchLadder } from "fitzroy";
28
+ import { fetchMatches, fetchPlayerStats, fetchLadder, fetchAwards } from "fitzroy";
29
+
30
+ // Matches for a season
31
+ const matches = await fetchMatches({ source: "afl-api", season: 2025, competition: "AFLM" });
23
32
 
24
- // Match results for a season
25
- const matches = await fetchMatchResults({ source: "afl-api", season: 2025, competition: "AFLM" });
33
+ // Only completed matches (the old fetchMatchResults behaviour)
34
+ const completed = await fetchMatches({ source: "afl-api", season: 2025, status: "Complete" });
35
+
36
+ // Upcoming fixtures
37
+ const upcoming = await fetchMatches({ source: "afl-api", season: 2025, status: "Upcoming" });
26
38
 
27
39
  // Player stats for a specific round
28
40
  const stats = await fetchPlayerStats({ source: "afl-api", season: 2025, round: 1 });
29
41
 
30
42
  // Ladder standings
31
43
  const ladder = await fetchLadder({ source: "afl-api", season: 2025 });
44
+
45
+ // Coleman Medal leaderboard (computed from PlayerStats)
46
+ const coleman = await fetchAwards({ award: "coleman", season: 2025, limit: 10 });
32
47
  ```
33
48
 
34
49
  All functions return `Result<T, Error>` — check `result.success` before accessing `result.data`.
@@ -39,24 +54,40 @@ All functions return `Result<T, Error>` — check `result.success` before access
39
54
  # Install globally
40
55
  npm install -g fitzroy
41
56
 
42
- # Match results
43
- fitzroy matches --season 2025 --round 1
57
+ # Six top-level commands, all sharing a uniform "drill in by adding flags" UX:
44
58
 
45
- # Player stats
46
- fitzroy stats --season 2025 --round 1
59
+ # Matches (subsumes the old `matches` and `fixture` commands)
60
+ fitzroy match --season 2025 --round 1
61
+ fitzroy match --season 2025 --status Upcoming
47
62
 
48
- # Ladder
63
+ # Player or team stats (subsumes the old `team-stats` command)
64
+ fitzroy stats --season 2025 --round 1 # per-player rows
65
+ fitzroy stats --season 2025 --by team # team aggregates
66
+
67
+ # Ladder standings
49
68
  fitzroy ladder --season 2025
50
69
 
51
- # Fixture
52
- fitzroy fixture --season 2025
70
+ # Team identity (subsumes the old `teams`, `squad`, `lineup` commands)
71
+ fitzroy team # list all teams
72
+ fitzroy team --name Carlton -s 2025 # team's squad for season
73
+ fitzroy team -s 2025 -r 3 # all match-day lineups for round 3
74
+
75
+ # Player biography (replaces `player-details`)
76
+ fitzroy player --team Carlton -s 2025
77
+
78
+ # Awards (subsumes `coaches-votes`; adds Coleman, Brownlow, etc.)
79
+ fitzroy awards --type brownlow -s 2024
80
+ fitzroy awards --type coleman -s 2025 --limit 10
81
+ fitzroy awards --type coaches -s 2024 --round 3
53
82
 
54
83
  # Output formats
55
- fitzroy matches --season 2025 --json # JSON (default when piped)
56
- fitzroy matches --season 2025 --csv # CSV with headers
57
- fitzroy matches --season 2025 --full # All columns in table view
84
+ fitzroy match --season 2025 --json # JSON (default when piped)
85
+ fitzroy match --season 2025 --csv # CSV with headers
86
+ fitzroy match --season 2025 --full # All columns in table view
58
87
  ```
59
88
 
89
+ Pass `--competition VFL` (or AFLW, VFLW) to any command to scope to that competition.
90
+
60
91
  Run `fitzroy --help` for all commands and options.
61
92
 
62
93
  ## Contributing