fitzroy 1.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.
- package/LICENSE +21 -0
- package/README.md +70 -0
- package/dist/cli.js +90 -0
- package/dist/index.d.ts +1709 -0
- package/dist/index.js +119 -0
- package/dist/shared/chunk-99nkfy8s.js +65 -0
- package/dist/shared/chunk-9zcjfgwe.js +66 -0
- package/dist/shared/chunk-b380x0p6.js +54 -0
- package/dist/shared/chunk-c7vawngt.js +63 -0
- package/dist/shared/chunk-d6fkap72.js +67 -0
- package/dist/shared/chunk-eyrvakjt.js +1 -0
- package/dist/shared/chunk-kr78ch1j.js +67 -0
- package/dist/shared/chunk-ngvkaczn.js +70 -0
- package/dist/shared/chunk-xv8z2kms.js +4 -0
- package/dist/shared/chunk-z78xs4nr.js +185 -0
- package/package.json +58 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AflApiClient,
|
|
3
|
+
AflApiError,
|
|
4
|
+
AflApiTokenSchema,
|
|
5
|
+
AflTablesClient,
|
|
6
|
+
CfsMatchSchema,
|
|
7
|
+
CfsMatchTeamSchema,
|
|
8
|
+
CfsScoreSchema,
|
|
9
|
+
CfsVenueSchema,
|
|
10
|
+
CompetitionListSchema,
|
|
11
|
+
CompetitionSchema,
|
|
12
|
+
CompseasonListSchema,
|
|
13
|
+
CompseasonSchema,
|
|
14
|
+
FootyWireClient,
|
|
15
|
+
LadderEntryRawSchema,
|
|
16
|
+
LadderResponseSchema,
|
|
17
|
+
MatchItemListSchema,
|
|
18
|
+
MatchItemSchema,
|
|
19
|
+
MatchRosterSchema,
|
|
20
|
+
PeriodScoreSchema,
|
|
21
|
+
PlayerGameStatsSchema,
|
|
22
|
+
PlayerStatsItemSchema,
|
|
23
|
+
PlayerStatsListSchema,
|
|
24
|
+
RosterPlayerSchema,
|
|
25
|
+
RoundListSchema,
|
|
26
|
+
RoundSchema,
|
|
27
|
+
ScoreSchema,
|
|
28
|
+
ScrapeError,
|
|
29
|
+
SquadListSchema,
|
|
30
|
+
SquadPlayerInnerSchema,
|
|
31
|
+
SquadPlayerItemSchema,
|
|
32
|
+
SquadSchema,
|
|
33
|
+
TeamItemSchema,
|
|
34
|
+
TeamListSchema,
|
|
35
|
+
TeamPlayersSchema,
|
|
36
|
+
TeamScoreSchema,
|
|
37
|
+
UnsupportedSourceError,
|
|
38
|
+
ValidationError,
|
|
39
|
+
err,
|
|
40
|
+
fetchFixture,
|
|
41
|
+
fetchFryziggStats,
|
|
42
|
+
fetchLadder,
|
|
43
|
+
fetchLineup,
|
|
44
|
+
fetchMatchResults,
|
|
45
|
+
fetchPlayerStats,
|
|
46
|
+
fetchSquad,
|
|
47
|
+
fetchTeams,
|
|
48
|
+
inferRoundType,
|
|
49
|
+
normaliseTeamName,
|
|
50
|
+
ok,
|
|
51
|
+
parseAflApiDate,
|
|
52
|
+
parseAflTablesDate,
|
|
53
|
+
parseFootyWireDate,
|
|
54
|
+
toAestString,
|
|
55
|
+
transformLadderEntries,
|
|
56
|
+
transformMatchItems,
|
|
57
|
+
transformMatchRoster,
|
|
58
|
+
transformPlayerStats
|
|
59
|
+
} from "./shared/chunk-eyrvakjt.js";
|
|
60
|
+
import"./shared/chunk-xv8z2kms.js";
|
|
61
|
+
export {
|
|
62
|
+
transformPlayerStats,
|
|
63
|
+
transformMatchRoster,
|
|
64
|
+
transformMatchItems,
|
|
65
|
+
transformLadderEntries,
|
|
66
|
+
toAestString,
|
|
67
|
+
parseFootyWireDate,
|
|
68
|
+
parseAflTablesDate,
|
|
69
|
+
parseAflApiDate,
|
|
70
|
+
ok,
|
|
71
|
+
normaliseTeamName,
|
|
72
|
+
inferRoundType,
|
|
73
|
+
fetchTeams,
|
|
74
|
+
fetchSquad,
|
|
75
|
+
fetchPlayerStats,
|
|
76
|
+
fetchMatchResults,
|
|
77
|
+
fetchLineup,
|
|
78
|
+
fetchLadder,
|
|
79
|
+
fetchFryziggStats,
|
|
80
|
+
fetchFixture,
|
|
81
|
+
err,
|
|
82
|
+
ValidationError,
|
|
83
|
+
UnsupportedSourceError,
|
|
84
|
+
TeamScoreSchema,
|
|
85
|
+
TeamPlayersSchema,
|
|
86
|
+
TeamListSchema,
|
|
87
|
+
TeamItemSchema,
|
|
88
|
+
SquadSchema,
|
|
89
|
+
SquadPlayerItemSchema,
|
|
90
|
+
SquadPlayerInnerSchema,
|
|
91
|
+
SquadListSchema,
|
|
92
|
+
ScrapeError,
|
|
93
|
+
ScoreSchema,
|
|
94
|
+
RoundSchema,
|
|
95
|
+
RoundListSchema,
|
|
96
|
+
RosterPlayerSchema,
|
|
97
|
+
PlayerStatsListSchema,
|
|
98
|
+
PlayerStatsItemSchema,
|
|
99
|
+
PlayerGameStatsSchema,
|
|
100
|
+
PeriodScoreSchema,
|
|
101
|
+
MatchRosterSchema,
|
|
102
|
+
MatchItemSchema,
|
|
103
|
+
MatchItemListSchema,
|
|
104
|
+
LadderResponseSchema,
|
|
105
|
+
LadderEntryRawSchema,
|
|
106
|
+
FootyWireClient,
|
|
107
|
+
CompseasonSchema,
|
|
108
|
+
CompseasonListSchema,
|
|
109
|
+
CompetitionSchema,
|
|
110
|
+
CompetitionListSchema,
|
|
111
|
+
CfsVenueSchema,
|
|
112
|
+
CfsScoreSchema,
|
|
113
|
+
CfsMatchTeamSchema,
|
|
114
|
+
CfsMatchSchema,
|
|
115
|
+
AflTablesClient,
|
|
116
|
+
AflApiTokenSchema,
|
|
117
|
+
AflApiError,
|
|
118
|
+
AflApiClient
|
|
119
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import {
|
|
2
|
+
formatOutput,
|
|
3
|
+
showSummary,
|
|
4
|
+
withSpinner
|
|
5
|
+
} from "./chunk-z78xs4nr.js";
|
|
6
|
+
import {
|
|
7
|
+
fetchFixture
|
|
8
|
+
} from "./chunk-eyrvakjt.js";
|
|
9
|
+
import"./chunk-xv8z2kms.js";
|
|
10
|
+
|
|
11
|
+
// src/cli/commands/fixture.ts
|
|
12
|
+
import { defineCommand } from "citty";
|
|
13
|
+
var DEFAULT_COLUMNS = [
|
|
14
|
+
{ key: "roundNumber", label: "Round", maxWidth: 6 },
|
|
15
|
+
{ key: "date", label: "Date", maxWidth: 16 },
|
|
16
|
+
{ key: "homeTeam", label: "Home", maxWidth: 20 },
|
|
17
|
+
{ key: "awayTeam", label: "Away", maxWidth: 20 },
|
|
18
|
+
{ key: "venue", label: "Venue", maxWidth: 24 }
|
|
19
|
+
];
|
|
20
|
+
var fixtureCommand = defineCommand({
|
|
21
|
+
meta: {
|
|
22
|
+
name: "fixture",
|
|
23
|
+
description: "Fetch fixture/schedule for a season"
|
|
24
|
+
},
|
|
25
|
+
args: {
|
|
26
|
+
season: { type: "string", description: "Season year (e.g. 2025)", required: true },
|
|
27
|
+
round: { type: "string", description: "Round number" },
|
|
28
|
+
source: { type: "string", description: "Data source", default: "afl-api" },
|
|
29
|
+
competition: {
|
|
30
|
+
type: "string",
|
|
31
|
+
description: "Competition code (AFLM or AFLW)",
|
|
32
|
+
default: "AFLM"
|
|
33
|
+
},
|
|
34
|
+
json: { type: "boolean", description: "Output as JSON" },
|
|
35
|
+
csv: { type: "boolean", description: "Output as CSV" },
|
|
36
|
+
format: { type: "string", description: "Output format: table, json, csv" },
|
|
37
|
+
full: { type: "boolean", description: "Show all columns in table output" }
|
|
38
|
+
},
|
|
39
|
+
async run({ args }) {
|
|
40
|
+
const season = Number(args.season);
|
|
41
|
+
const round = args.round ? Number(args.round) : undefined;
|
|
42
|
+
const result = await withSpinner("Fetching fixture…", () => fetchFixture({
|
|
43
|
+
source: args.source,
|
|
44
|
+
season,
|
|
45
|
+
round,
|
|
46
|
+
competition: args.competition
|
|
47
|
+
}));
|
|
48
|
+
if (!result.success) {
|
|
49
|
+
throw result.error;
|
|
50
|
+
}
|
|
51
|
+
const data = result.data;
|
|
52
|
+
showSummary(`Loaded ${data.length} fixtures for ${season}${round ? ` round ${round}` : ""}`);
|
|
53
|
+
const formatOptions = {
|
|
54
|
+
json: args.json,
|
|
55
|
+
csv: args.csv,
|
|
56
|
+
format: args.format,
|
|
57
|
+
full: args.full,
|
|
58
|
+
columns: DEFAULT_COLUMNS
|
|
59
|
+
};
|
|
60
|
+
console.log(formatOutput(data, formatOptions));
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
export {
|
|
64
|
+
fixtureCommand
|
|
65
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import {
|
|
2
|
+
formatOutput,
|
|
3
|
+
showSummary,
|
|
4
|
+
withSpinner
|
|
5
|
+
} from "./chunk-z78xs4nr.js";
|
|
6
|
+
import {
|
|
7
|
+
fetchLineup
|
|
8
|
+
} from "./chunk-eyrvakjt.js";
|
|
9
|
+
import"./chunk-xv8z2kms.js";
|
|
10
|
+
|
|
11
|
+
// src/cli/commands/lineup.ts
|
|
12
|
+
import { defineCommand } from "citty";
|
|
13
|
+
var DEFAULT_COLUMNS = [
|
|
14
|
+
{ key: "matchId", label: "Match", maxWidth: 12 },
|
|
15
|
+
{ key: "homeTeam", label: "Home", maxWidth: 20 },
|
|
16
|
+
{ key: "awayTeam", label: "Away", maxWidth: 20 }
|
|
17
|
+
];
|
|
18
|
+
var lineupCommand = defineCommand({
|
|
19
|
+
meta: {
|
|
20
|
+
name: "lineup",
|
|
21
|
+
description: "Fetch match lineups for a round"
|
|
22
|
+
},
|
|
23
|
+
args: {
|
|
24
|
+
season: { type: "string", description: "Season year (e.g. 2025)", required: true },
|
|
25
|
+
round: { type: "string", description: "Round number", required: true },
|
|
26
|
+
"match-id": { type: "string", description: "Specific match ID" },
|
|
27
|
+
source: { type: "string", description: "Data source", default: "afl-api" },
|
|
28
|
+
competition: {
|
|
29
|
+
type: "string",
|
|
30
|
+
description: "Competition code (AFLM or AFLW)",
|
|
31
|
+
default: "AFLM"
|
|
32
|
+
},
|
|
33
|
+
json: { type: "boolean", description: "Output as JSON" },
|
|
34
|
+
csv: { type: "boolean", description: "Output as CSV" },
|
|
35
|
+
format: { type: "string", description: "Output format: table, json, csv" },
|
|
36
|
+
full: { type: "boolean", description: "Show all columns in table output" }
|
|
37
|
+
},
|
|
38
|
+
async run({ args }) {
|
|
39
|
+
const season = Number(args.season);
|
|
40
|
+
const round = Number(args.round);
|
|
41
|
+
const matchId = args["match-id"];
|
|
42
|
+
const result = await withSpinner("Fetching lineups…", () => fetchLineup({
|
|
43
|
+
source: args.source,
|
|
44
|
+
season,
|
|
45
|
+
round,
|
|
46
|
+
matchId,
|
|
47
|
+
competition: args.competition
|
|
48
|
+
}));
|
|
49
|
+
if (!result.success) {
|
|
50
|
+
throw result.error;
|
|
51
|
+
}
|
|
52
|
+
const data = result.data;
|
|
53
|
+
showSummary(`Loaded ${data.length} lineups for ${season} round ${round}`);
|
|
54
|
+
const formatOptions = {
|
|
55
|
+
json: args.json,
|
|
56
|
+
csv: args.csv,
|
|
57
|
+
format: args.format,
|
|
58
|
+
full: args.full,
|
|
59
|
+
columns: DEFAULT_COLUMNS
|
|
60
|
+
};
|
|
61
|
+
console.log(formatOutput(data, formatOptions));
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
export {
|
|
65
|
+
lineupCommand
|
|
66
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import {
|
|
2
|
+
formatOutput,
|
|
3
|
+
showSummary,
|
|
4
|
+
withSpinner
|
|
5
|
+
} from "./chunk-z78xs4nr.js";
|
|
6
|
+
import {
|
|
7
|
+
fetchTeams
|
|
8
|
+
} from "./chunk-eyrvakjt.js";
|
|
9
|
+
import"./chunk-xv8z2kms.js";
|
|
10
|
+
|
|
11
|
+
// src/cli/commands/teams.ts
|
|
12
|
+
import { defineCommand } from "citty";
|
|
13
|
+
var DEFAULT_COLUMNS = [
|
|
14
|
+
{ key: "teamId", label: "ID", maxWidth: 8 },
|
|
15
|
+
{ key: "name", label: "Team", maxWidth: 24 },
|
|
16
|
+
{ key: "abbreviation", label: "Abbr", maxWidth: 6 },
|
|
17
|
+
{ key: "competition", label: "Comp", maxWidth: 6 }
|
|
18
|
+
];
|
|
19
|
+
var teamsCommand = defineCommand({
|
|
20
|
+
meta: {
|
|
21
|
+
name: "teams",
|
|
22
|
+
description: "Fetch team list"
|
|
23
|
+
},
|
|
24
|
+
args: {
|
|
25
|
+
competition: { type: "string", description: "Competition code (AFLM or AFLW)" },
|
|
26
|
+
"team-type": { type: "string", description: "Team type filter" },
|
|
27
|
+
json: { type: "boolean", description: "Output as JSON" },
|
|
28
|
+
csv: { type: "boolean", description: "Output as CSV" },
|
|
29
|
+
format: { type: "string", description: "Output format: table, json, csv" },
|
|
30
|
+
full: { type: "boolean", description: "Show all columns in table output" }
|
|
31
|
+
},
|
|
32
|
+
async run({ args }) {
|
|
33
|
+
const result = await withSpinner("Fetching teams…", () => fetchTeams({
|
|
34
|
+
competition: args.competition,
|
|
35
|
+
teamType: args["team-type"]
|
|
36
|
+
}));
|
|
37
|
+
if (!result.success) {
|
|
38
|
+
throw result.error;
|
|
39
|
+
}
|
|
40
|
+
const data = result.data;
|
|
41
|
+
showSummary(`Loaded ${data.length} teams`);
|
|
42
|
+
const formatOptions = {
|
|
43
|
+
json: args.json,
|
|
44
|
+
csv: args.csv,
|
|
45
|
+
format: args.format,
|
|
46
|
+
full: args.full,
|
|
47
|
+
columns: DEFAULT_COLUMNS
|
|
48
|
+
};
|
|
49
|
+
console.log(formatOutput(data, formatOptions));
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
export {
|
|
53
|
+
teamsCommand
|
|
54
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import {
|
|
2
|
+
formatOutput,
|
|
3
|
+
showSummary,
|
|
4
|
+
withSpinner
|
|
5
|
+
} from "./chunk-z78xs4nr.js";
|
|
6
|
+
import {
|
|
7
|
+
fetchSquad
|
|
8
|
+
} from "./chunk-eyrvakjt.js";
|
|
9
|
+
import"./chunk-xv8z2kms.js";
|
|
10
|
+
|
|
11
|
+
// src/cli/commands/squad.ts
|
|
12
|
+
import { defineCommand } from "citty";
|
|
13
|
+
var DEFAULT_COLUMNS = [
|
|
14
|
+
{ key: "displayName", label: "Player", maxWidth: 24 },
|
|
15
|
+
{ key: "jumperNumber", label: "#", maxWidth: 4 },
|
|
16
|
+
{ key: "position", label: "Pos", maxWidth: 12 },
|
|
17
|
+
{ key: "heightCm", label: "Ht", maxWidth: 5 },
|
|
18
|
+
{ key: "weightKg", label: "Wt", maxWidth: 5 }
|
|
19
|
+
];
|
|
20
|
+
var squadCommand = defineCommand({
|
|
21
|
+
meta: {
|
|
22
|
+
name: "squad",
|
|
23
|
+
description: "Fetch team squad for a season"
|
|
24
|
+
},
|
|
25
|
+
args: {
|
|
26
|
+
"team-id": { type: "string", description: "Team ID", required: true },
|
|
27
|
+
season: { type: "string", description: "Season year (e.g. 2025)", required: true },
|
|
28
|
+
competition: {
|
|
29
|
+
type: "string",
|
|
30
|
+
description: "Competition code (AFLM or AFLW)",
|
|
31
|
+
default: "AFLM"
|
|
32
|
+
},
|
|
33
|
+
json: { type: "boolean", description: "Output as JSON" },
|
|
34
|
+
csv: { type: "boolean", description: "Output as CSV" },
|
|
35
|
+
format: { type: "string", description: "Output format: table, json, csv" },
|
|
36
|
+
full: { type: "boolean", description: "Show all columns in table output" }
|
|
37
|
+
},
|
|
38
|
+
async run({ args }) {
|
|
39
|
+
const teamId = args["team-id"];
|
|
40
|
+
const season = Number(args.season);
|
|
41
|
+
const result = await withSpinner("Fetching squad…", () => fetchSquad({
|
|
42
|
+
teamId,
|
|
43
|
+
season,
|
|
44
|
+
competition: args.competition
|
|
45
|
+
}));
|
|
46
|
+
if (!result.success) {
|
|
47
|
+
throw result.error;
|
|
48
|
+
}
|
|
49
|
+
const data = result.data;
|
|
50
|
+
showSummary(`Loaded ${data.players.length} players for ${data.teamName} ${season}`);
|
|
51
|
+
const formatOptions = {
|
|
52
|
+
json: args.json,
|
|
53
|
+
csv: args.csv,
|
|
54
|
+
format: args.format,
|
|
55
|
+
full: args.full,
|
|
56
|
+
columns: DEFAULT_COLUMNS
|
|
57
|
+
};
|
|
58
|
+
console.log(formatOutput(data.players, formatOptions));
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
export {
|
|
62
|
+
squadCommand
|
|
63
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import {
|
|
2
|
+
formatOutput,
|
|
3
|
+
showSummary,
|
|
4
|
+
withSpinner
|
|
5
|
+
} from "./chunk-z78xs4nr.js";
|
|
6
|
+
import {
|
|
7
|
+
fetchLadder
|
|
8
|
+
} from "./chunk-eyrvakjt.js";
|
|
9
|
+
import"./chunk-xv8z2kms.js";
|
|
10
|
+
|
|
11
|
+
// src/cli/commands/ladder.ts
|
|
12
|
+
import { defineCommand } from "citty";
|
|
13
|
+
var DEFAULT_COLUMNS = [
|
|
14
|
+
{ key: "position", label: "Pos", maxWidth: 4 },
|
|
15
|
+
{ key: "team", label: "Team", maxWidth: 24 },
|
|
16
|
+
{ key: "wins", label: "W", maxWidth: 4 },
|
|
17
|
+
{ key: "losses", label: "L", maxWidth: 4 },
|
|
18
|
+
{ key: "draws", label: "D", maxWidth: 4 },
|
|
19
|
+
{ key: "percentage", label: "Pct", maxWidth: 8 },
|
|
20
|
+
{ key: "premiershipsPoints", label: "Pts", maxWidth: 5 }
|
|
21
|
+
];
|
|
22
|
+
var ladderCommand = defineCommand({
|
|
23
|
+
meta: {
|
|
24
|
+
name: "ladder",
|
|
25
|
+
description: "Fetch ladder standings for a season"
|
|
26
|
+
},
|
|
27
|
+
args: {
|
|
28
|
+
season: { type: "string", description: "Season year (e.g. 2025)", required: true },
|
|
29
|
+
round: { type: "string", description: "Round number" },
|
|
30
|
+
source: { type: "string", description: "Data source", default: "afl-api" },
|
|
31
|
+
competition: {
|
|
32
|
+
type: "string",
|
|
33
|
+
description: "Competition code (AFLM or AFLW)",
|
|
34
|
+
default: "AFLM"
|
|
35
|
+
},
|
|
36
|
+
json: { type: "boolean", description: "Output as JSON" },
|
|
37
|
+
csv: { type: "boolean", description: "Output as CSV" },
|
|
38
|
+
format: { type: "string", description: "Output format: table, json, csv" },
|
|
39
|
+
full: { type: "boolean", description: "Show all columns in table output" }
|
|
40
|
+
},
|
|
41
|
+
async run({ args }) {
|
|
42
|
+
const season = Number(args.season);
|
|
43
|
+
const round = args.round ? Number(args.round) : undefined;
|
|
44
|
+
const result = await withSpinner("Fetching ladder…", () => fetchLadder({
|
|
45
|
+
source: args.source,
|
|
46
|
+
season,
|
|
47
|
+
round,
|
|
48
|
+
competition: args.competition
|
|
49
|
+
}));
|
|
50
|
+
if (!result.success) {
|
|
51
|
+
throw result.error;
|
|
52
|
+
}
|
|
53
|
+
const data = result.data;
|
|
54
|
+
showSummary(`Loaded ladder for ${season}${round ? ` round ${round}` : ""} (${data.entries.length} teams)`);
|
|
55
|
+
const formatOptions = {
|
|
56
|
+
json: args.json,
|
|
57
|
+
csv: args.csv,
|
|
58
|
+
format: args.format,
|
|
59
|
+
full: args.full,
|
|
60
|
+
columns: DEFAULT_COLUMNS
|
|
61
|
+
};
|
|
62
|
+
console.log(formatOutput(data.entries, formatOptions));
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
export {
|
|
66
|
+
ladderCommand
|
|
67
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { fetchFixture, fetchLadder, fetchLineup, fetchMatchResults, fetchPlayerStats, fetchSquad, fetchTeams, parseAflApiDate, parseAflTablesDate, parseFootyWireDate, toAestString, AflApiError, ScrapeError, UnsupportedSourceError, ValidationError, err, ok, normaliseTeamName, AflApiTokenSchema, CfsMatchSchema, CfsMatchTeamSchema, CfsScoreSchema, CfsVenueSchema, CompetitionListSchema, CompetitionSchema, CompseasonListSchema, CompseasonSchema, LadderEntryRawSchema, LadderResponseSchema, MatchItemListSchema, MatchItemSchema, MatchRosterSchema, PeriodScoreSchema, PlayerGameStatsSchema, PlayerStatsItemSchema, PlayerStatsListSchema, RosterPlayerSchema, RoundListSchema, RoundSchema, ScoreSchema, SquadListSchema, SquadPlayerInnerSchema, SquadPlayerItemSchema, SquadSchema, TeamItemSchema, TeamListSchema, TeamPlayersSchema, TeamScoreSchema, AflApiClient, AflTablesClient, FootyWireClient, fetchFryziggStats, transformLadderEntries, transformMatchRoster, inferRoundType, transformMatchItems, transformPlayerStats };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import {
|
|
2
|
+
formatOutput,
|
|
3
|
+
showSummary,
|
|
4
|
+
withSpinner
|
|
5
|
+
} from "./chunk-z78xs4nr.js";
|
|
6
|
+
import {
|
|
7
|
+
fetchMatchResults
|
|
8
|
+
} from "./chunk-eyrvakjt.js";
|
|
9
|
+
import"./chunk-xv8z2kms.js";
|
|
10
|
+
|
|
11
|
+
// src/cli/commands/matches.ts
|
|
12
|
+
import { defineCommand } from "citty";
|
|
13
|
+
var DEFAULT_COLUMNS = [
|
|
14
|
+
{ key: "date", label: "Date", maxWidth: 16 },
|
|
15
|
+
{ key: "roundNumber", label: "Round", maxWidth: 6 },
|
|
16
|
+
{ key: "homeTeam", label: "Home", maxWidth: 20 },
|
|
17
|
+
{ key: "awayTeam", label: "Away", maxWidth: 20 },
|
|
18
|
+
{ key: "homePoints", label: "H.Pts", maxWidth: 6 },
|
|
19
|
+
{ key: "awayPoints", label: "A.Pts", maxWidth: 6 },
|
|
20
|
+
{ key: "venue", label: "Venue", maxWidth: 24 }
|
|
21
|
+
];
|
|
22
|
+
var matchesCommand = defineCommand({
|
|
23
|
+
meta: {
|
|
24
|
+
name: "matches",
|
|
25
|
+
description: "Fetch match results for a season"
|
|
26
|
+
},
|
|
27
|
+
args: {
|
|
28
|
+
season: { type: "string", description: "Season year (e.g. 2025)", required: true },
|
|
29
|
+
round: { type: "string", description: "Round number" },
|
|
30
|
+
source: { type: "string", description: "Data source", default: "afl-api" },
|
|
31
|
+
competition: {
|
|
32
|
+
type: "string",
|
|
33
|
+
description: "Competition code (AFLM or AFLW)",
|
|
34
|
+
default: "AFLM"
|
|
35
|
+
},
|
|
36
|
+
json: { type: "boolean", description: "Output as JSON" },
|
|
37
|
+
csv: { type: "boolean", description: "Output as CSV" },
|
|
38
|
+
format: { type: "string", description: "Output format: table, json, csv" },
|
|
39
|
+
full: { type: "boolean", description: "Show all columns in table output" }
|
|
40
|
+
},
|
|
41
|
+
async run({ args }) {
|
|
42
|
+
const season = Number(args.season);
|
|
43
|
+
const round = args.round ? Number(args.round) : undefined;
|
|
44
|
+
const result = await withSpinner("Fetching match results…", () => fetchMatchResults({
|
|
45
|
+
source: args.source,
|
|
46
|
+
season,
|
|
47
|
+
round,
|
|
48
|
+
competition: args.competition
|
|
49
|
+
}));
|
|
50
|
+
if (!result.success) {
|
|
51
|
+
throw result.error;
|
|
52
|
+
}
|
|
53
|
+
const data = result.data;
|
|
54
|
+
showSummary(`Loaded ${data.length} matches for ${season}${round ? ` round ${round}` : ""}`);
|
|
55
|
+
const formatOptions = {
|
|
56
|
+
json: args.json,
|
|
57
|
+
csv: args.csv,
|
|
58
|
+
format: args.format,
|
|
59
|
+
full: args.full,
|
|
60
|
+
columns: DEFAULT_COLUMNS
|
|
61
|
+
};
|
|
62
|
+
console.log(formatOutput(data, formatOptions));
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
export {
|
|
66
|
+
matchesCommand
|
|
67
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import {
|
|
2
|
+
formatOutput,
|
|
3
|
+
showSummary,
|
|
4
|
+
withSpinner
|
|
5
|
+
} from "./chunk-z78xs4nr.js";
|
|
6
|
+
import {
|
|
7
|
+
fetchPlayerStats
|
|
8
|
+
} from "./chunk-eyrvakjt.js";
|
|
9
|
+
import"./chunk-xv8z2kms.js";
|
|
10
|
+
|
|
11
|
+
// src/cli/commands/stats.ts
|
|
12
|
+
import { defineCommand } from "citty";
|
|
13
|
+
var DEFAULT_COLUMNS = [
|
|
14
|
+
{ key: "displayName", label: "Player", maxWidth: 22 },
|
|
15
|
+
{ key: "team", label: "Team", maxWidth: 18 },
|
|
16
|
+
{ key: "disposals", label: "Disp", maxWidth: 6 },
|
|
17
|
+
{ key: "kicks", label: "Kicks", maxWidth: 6 },
|
|
18
|
+
{ key: "handballs", label: "HB", maxWidth: 6 },
|
|
19
|
+
{ key: "marks", label: "Marks", maxWidth: 6 },
|
|
20
|
+
{ key: "goals", label: "Goals", maxWidth: 6 }
|
|
21
|
+
];
|
|
22
|
+
var statsCommand = defineCommand({
|
|
23
|
+
meta: {
|
|
24
|
+
name: "stats",
|
|
25
|
+
description: "Fetch player statistics for a season"
|
|
26
|
+
},
|
|
27
|
+
args: {
|
|
28
|
+
season: { type: "string", description: "Season year (e.g. 2025)", required: true },
|
|
29
|
+
round: { type: "string", description: "Round number" },
|
|
30
|
+
"match-id": { type: "string", description: "Specific match ID" },
|
|
31
|
+
source: { type: "string", description: "Data source", default: "afl-api" },
|
|
32
|
+
competition: {
|
|
33
|
+
type: "string",
|
|
34
|
+
description: "Competition code (AFLM or AFLW)",
|
|
35
|
+
default: "AFLM"
|
|
36
|
+
},
|
|
37
|
+
json: { type: "boolean", description: "Output as JSON" },
|
|
38
|
+
csv: { type: "boolean", description: "Output as CSV" },
|
|
39
|
+
format: { type: "string", description: "Output format: table, json, csv" },
|
|
40
|
+
full: { type: "boolean", description: "Show all columns in table output" }
|
|
41
|
+
},
|
|
42
|
+
async run({ args }) {
|
|
43
|
+
const season = Number(args.season);
|
|
44
|
+
const round = args.round ? Number(args.round) : undefined;
|
|
45
|
+
const matchId = args["match-id"];
|
|
46
|
+
const result = await withSpinner("Fetching player stats…", () => fetchPlayerStats({
|
|
47
|
+
source: args.source,
|
|
48
|
+
season,
|
|
49
|
+
round,
|
|
50
|
+
matchId,
|
|
51
|
+
competition: args.competition
|
|
52
|
+
}));
|
|
53
|
+
if (!result.success) {
|
|
54
|
+
throw result.error;
|
|
55
|
+
}
|
|
56
|
+
const data = result.data;
|
|
57
|
+
showSummary(`Loaded ${data.length} player stat lines for ${season}${round ? ` round ${round}` : ""}`);
|
|
58
|
+
const formatOptions = {
|
|
59
|
+
json: args.json,
|
|
60
|
+
csv: args.csv,
|
|
61
|
+
format: args.format,
|
|
62
|
+
full: args.full,
|
|
63
|
+
columns: DEFAULT_COLUMNS
|
|
64
|
+
};
|
|
65
|
+
console.log(formatOutput(data, formatOptions));
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
export {
|
|
69
|
+
statsCommand
|
|
70
|
+
};
|