bbdata-cli 0.1.1 → 0.3.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/dist/bin/bbdata.js +1044 -36
- package/dist/bin/bbdata.js.map +1 -1
- package/dist/src/index.d.ts +55 -2
- package/dist/src/index.js +978 -33
- package/dist/src/index.js.map +1 -1
- package/dist/templates/queries/hitter-batted-ball.ts +66 -0
- package/dist/templates/queries/hitter-hot-cold-zones.ts +81 -0
- package/dist/templates/queries/hitter-raw-bip.ts +65 -0
- package/dist/templates/queries/hitter-vs-pitch-type.ts +78 -0
- package/dist/templates/queries/hitter-zone-grid.ts +90 -0
- package/dist/templates/queries/index.ts +27 -0
- package/dist/templates/queries/leaderboard-comparison.ts +72 -0
- package/dist/templates/queries/leaderboard-custom.ts +90 -0
- package/dist/templates/queries/matchup-pitcher-vs-hitter.ts +81 -0
- package/dist/templates/queries/matchup-situational.ts +68 -0
- package/dist/templates/queries/pitcher-arsenal.ts +89 -0
- package/dist/templates/queries/pitcher-handedness-splits.ts +81 -0
- package/dist/templates/queries/pitcher-raw-pitches.ts +62 -0
- package/dist/templates/queries/pitcher-velocity-trend.ts +73 -0
- package/dist/templates/queries/registry.ts +73 -0
- package/dist/templates/queries/trend-rolling-average.ts +98 -0
- package/dist/templates/queries/trend-year-over-year.ts +73 -0
- package/dist/templates/reports/advance-lineup.hbs +29 -0
- package/dist/templates/reports/advance-sp.hbs +66 -0
- package/dist/templates/reports/college-hitter-draft.hbs +49 -0
- package/dist/templates/reports/college-pitcher-draft.hbs +48 -0
- package/dist/templates/reports/dev-progress.hbs +29 -0
- package/dist/templates/reports/draft-board-card.hbs +35 -0
- package/dist/templates/reports/hs-prospect.hbs +48 -0
- package/dist/templates/reports/partials/footer.hbs +7 -0
- package/dist/templates/reports/partials/header.hbs +12 -0
- package/dist/templates/reports/post-promotion.hbs +25 -0
- package/dist/templates/reports/pro-hitter-eval.hbs +77 -0
- package/dist/templates/reports/pro-pitcher-eval.hbs +81 -0
- package/dist/templates/reports/registry.ts +215 -0
- package/dist/templates/reports/relief-pitcher-quick.hbs +29 -0
- package/dist/templates/reports/trade-target-onepager.hbs +45 -0
- package/package.json +68 -63
- package/src/templates/reports/advance-sp.hbs +66 -60
- package/src/templates/reports/pro-hitter-eval.hbs +77 -65
- package/src/templates/reports/pro-pitcher-eval.hbs +81 -69
package/dist/src/index.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ interface QueryOptions {
|
|
|
17
17
|
format?: OutputFormat;
|
|
18
18
|
source?: string;
|
|
19
19
|
cache?: boolean;
|
|
20
|
+
stdin?: boolean;
|
|
20
21
|
}
|
|
21
22
|
interface QueryResult {
|
|
22
23
|
data: Record<string, unknown>[];
|
|
@@ -44,6 +45,7 @@ interface ReportOptions {
|
|
|
44
45
|
audience?: Audience;
|
|
45
46
|
format?: 'markdown' | 'json';
|
|
46
47
|
validate?: boolean;
|
|
48
|
+
stdin?: boolean;
|
|
47
49
|
}
|
|
48
50
|
interface ReportResult {
|
|
49
51
|
content: string;
|
|
@@ -69,6 +71,51 @@ interface ValidationResult {
|
|
|
69
71
|
*/
|
|
70
72
|
declare function report(options: ReportOptions): Promise<ReportResult>;
|
|
71
73
|
|
|
74
|
+
type ChartType = 'movement' | 'spray' | 'zone' | 'rolling';
|
|
75
|
+
type VizFormat = 'svg' | 'png' | 'pdf' | 'html';
|
|
76
|
+
/**
|
|
77
|
+
* Audience vocabulary for visualization styling.
|
|
78
|
+
* This is a superset of the report Audience type. The report layer uses
|
|
79
|
+
* 'gm'/'scout' as role labels; the viz layer uses 'frontoffice'/'presentation'
|
|
80
|
+
* as presentation-style labels. `resolveVizAudience` maps between them.
|
|
81
|
+
*/
|
|
82
|
+
type VizAudience = 'coach' | 'analyst' | 'frontoffice' | 'presentation';
|
|
83
|
+
interface VizOptions {
|
|
84
|
+
type: ChartType;
|
|
85
|
+
player?: string;
|
|
86
|
+
players?: string[];
|
|
87
|
+
season?: number;
|
|
88
|
+
audience?: Audience | VizAudience;
|
|
89
|
+
format?: VizFormat;
|
|
90
|
+
width?: number;
|
|
91
|
+
height?: number;
|
|
92
|
+
colorblind?: boolean;
|
|
93
|
+
output?: string;
|
|
94
|
+
source?: string;
|
|
95
|
+
stdin?: boolean;
|
|
96
|
+
cache?: boolean;
|
|
97
|
+
title?: string;
|
|
98
|
+
}
|
|
99
|
+
interface VizResult {
|
|
100
|
+
svg: string;
|
|
101
|
+
spec: object;
|
|
102
|
+
meta: {
|
|
103
|
+
chartType: ChartType;
|
|
104
|
+
player: string;
|
|
105
|
+
season: number;
|
|
106
|
+
audience: VizAudience;
|
|
107
|
+
rowCount: number;
|
|
108
|
+
source: string;
|
|
109
|
+
width: number;
|
|
110
|
+
height: number;
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Programmatic API — skills and agents call this directly.
|
|
116
|
+
*/
|
|
117
|
+
declare function viz(options: VizOptions): Promise<VizResult>;
|
|
118
|
+
|
|
72
119
|
declare const ConfigSchema: z.ZodObject<{
|
|
73
120
|
defaultTeam: z.ZodOptional<z.ZodString>;
|
|
74
121
|
defaultFormat: z.ZodDefault<z.ZodEnum<["json", "table", "csv", "markdown"]>>;
|
|
@@ -207,7 +254,7 @@ type BbdataConfig = z.infer<typeof ConfigSchema>;
|
|
|
207
254
|
declare function getConfig(): BbdataConfig;
|
|
208
255
|
declare function setConfig(updates: Partial<BbdataConfig>): BbdataConfig;
|
|
209
256
|
|
|
210
|
-
type DataSource = 'savant' | 'fangraphs' | 'mlb-stats-api' | 'baseball-reference';
|
|
257
|
+
type DataSource = 'savant' | 'fangraphs' | 'mlb-stats-api' | 'baseball-reference' | 'stdin';
|
|
211
258
|
declare const PitchDataSchema: z.ZodObject<{
|
|
212
259
|
pitcher_id: z.ZodString;
|
|
213
260
|
pitcher_name: z.ZodString;
|
|
@@ -223,6 +270,8 @@ declare const PitchDataSchema: z.ZodObject<{
|
|
|
223
270
|
plate_z: z.ZodNumber;
|
|
224
271
|
launch_speed: z.ZodNullable<z.ZodNumber>;
|
|
225
272
|
launch_angle: z.ZodNullable<z.ZodNumber>;
|
|
273
|
+
hc_x: z.ZodNullable<z.ZodNumber>;
|
|
274
|
+
hc_y: z.ZodNullable<z.ZodNumber>;
|
|
226
275
|
description: z.ZodString;
|
|
227
276
|
events: z.ZodNullable<z.ZodString>;
|
|
228
277
|
bb_type: z.ZodNullable<z.ZodString>;
|
|
@@ -245,6 +294,8 @@ declare const PitchDataSchema: z.ZodObject<{
|
|
|
245
294
|
plate_z: number;
|
|
246
295
|
launch_speed: number | null;
|
|
247
296
|
launch_angle: number | null;
|
|
297
|
+
hc_x: number | null;
|
|
298
|
+
hc_y: number | null;
|
|
248
299
|
description: string;
|
|
249
300
|
events: string | null;
|
|
250
301
|
bb_type: string | null;
|
|
@@ -267,6 +318,8 @@ declare const PitchDataSchema: z.ZodObject<{
|
|
|
267
318
|
plate_z: number;
|
|
268
319
|
launch_speed: number | null;
|
|
269
320
|
launch_angle: number | null;
|
|
321
|
+
hc_x: number | null;
|
|
322
|
+
hc_y: number | null;
|
|
270
323
|
description: string;
|
|
271
324
|
events: string | null;
|
|
272
325
|
bb_type: string | null;
|
|
@@ -344,4 +397,4 @@ interface DataAdapter {
|
|
|
344
397
|
resolvePlayer(name: string): Promise<PlayerId | null>;
|
|
345
398
|
}
|
|
346
399
|
|
|
347
|
-
export { type AdapterQuery, type BbdataConfig, type DataAdapter, type OutputFormat, type PitchData, type PlayerStats, type QueryOptions, type QueryResult, type ReportOptions, type ReportResult, getConfig, query, report, setConfig };
|
|
400
|
+
export { type AdapterQuery, type BbdataConfig, type ChartType, type DataAdapter, type OutputFormat, type PitchData, type PlayerStats, type QueryOptions, type QueryResult, type ReportOptions, type ReportResult, type VizAudience, type VizOptions, type VizResult, getConfig, query, report, setConfig, viz };
|