football-docs 0.8.0 → 0.9.1
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/README.md +12 -5
- package/data/docs.db +0 -0
- package/dist/crawl.js +181 -16
- package/dist/provider-truth.d.ts +31 -1
- package/dist/provider-truth.js +52 -1
- package/docs/fast-forward/api.md +605 -0
- package/docs/fast-forward/benchmarks.md +39 -0
- package/docs/fast-forward/concepts-coordinate-systems.md +129 -0
- package/docs/fast-forward/concepts-dataset.md +210 -0
- package/docs/fast-forward/concepts-distributed-compute.md +189 -0
- package/docs/fast-forward/concepts-filelike.md +56 -0
- package/docs/fast-forward/concepts-layouts.md +106 -0
- package/docs/fast-forward/concepts-orientations.md +90 -0
- package/docs/fast-forward/concepts-transformations.md +108 -0
- package/docs/fast-forward/getting-started.md +130 -0
- package/docs/fast-forward/index.md +129 -0
- package/docs/fast-forward/providers-cdf.md +60 -0
- package/docs/fast-forward/providers-gradientsports.md +65 -0
- package/docs/fast-forward/providers-hawkeye.md +104 -0
- package/docs/fast-forward/providers-optavision.md +62 -0
- package/docs/fast-forward/providers-respovision.md +74 -0
- package/docs/fast-forward/providers-scisports.md +58 -0
- package/docs/fast-forward/providers-secondspectrum.md +61 -0
- package/docs/fast-forward/providers-signality.md +78 -0
- package/docs/fast-forward/providers-skillcorner.md +86 -0
- package/docs/fast-forward/providers-sportec.md +58 -0
- package/docs/fast-forward/providers-statsperform.md +77 -0
- package/docs/fast-forward/providers-tracab.md +69 -0
- package/docs/fast-forward/providers.md +62 -0
- package/docs/fast-forward/reporting-issues.md +88 -0
- package/docs/floodlight/compendium-0-compendium.md +1 -1
- package/docs/floodlight/compendium-1-data.md +5 -5
- package/docs/floodlight/compendium-2-design.md +1 -1
- package/docs/floodlight/compendium-3-time.md +6 -6
- package/docs/floodlight/compendium-4-space.md +9 -9
- package/docs/floodlight/compendium-5-identifier.md +10 -10
- package/docs/floodlight/core-code.md +13 -15
- package/docs/floodlight/core-core.md +10 -28
- package/docs/floodlight/core-definitions.md +1 -1
- package/docs/floodlight/core-events.md +31 -37
- package/docs/floodlight/core-pitch.md +12 -16
- package/docs/floodlight/core-property.md +19 -25
- package/docs/floodlight/core-teamsheet.md +13 -16
- package/docs/floodlight/core-xy.md +34 -40
- package/docs/floodlight/guides-contrib-manual.md +23 -24
- package/docs/floodlight/guides-getting-started.md +9 -9
- package/docs/floodlight/guides-tutorial-analysis.md +18 -115
- package/docs/floodlight/guides-tutorial-matchsheets.md +13 -242
- package/docs/floodlight/index.md +2 -2
- package/docs/floodlight/io-datasets.md +41 -47
- package/docs/floodlight/io-dfl.md +17 -19
- package/docs/floodlight/io-io.md +35 -83
- package/docs/floodlight/io-kinexon.md +21 -27
- package/docs/floodlight/io-opta.md +9 -9
- package/docs/floodlight/io-secondspectrum.md +13 -15
- package/docs/floodlight/io-skillcorner.md +5 -6
- package/docs/floodlight/io-sportradar.md +5 -5
- package/docs/floodlight/io-statsbomb.md +9 -11
- package/docs/floodlight/io-statsperform.md +37 -43
- package/docs/floodlight/io-tracab.md +13 -14
- package/docs/floodlight/io-utils.md +11 -13
- package/docs/floodlight/metrics-entropy.md +5 -6
- package/docs/floodlight/metrics-metrics.md +1 -1
- package/docs/floodlight/metrics-trajectory-clustering.md +5 -6
- package/docs/floodlight/metrics-zone-aggregation.md +5 -6
- package/docs/floodlight/models-geometry.md +42 -47
- package/docs/floodlight/models-kinematics.md +22 -25
- package/docs/floodlight/models-kinetics.md +21 -22
- package/docs/floodlight/models-models.md +22 -67
- package/docs/floodlight/models-space.md +19 -22
- package/docs/floodlight/transforms-filter.md +21 -26
- package/docs/floodlight/transforms-interpolation.md +13 -16
- package/docs/floodlight/transforms-permutation.md +5 -6
- package/docs/floodlight/transforms-spatial.md +9 -10
- package/docs/floodlight/transforms-temporal.md +5 -6
- package/docs/floodlight/transforms-transforms.md +19 -37
- package/docs/floodlight/utils-types.md +2 -2
- package/docs/floodlight/utils-utils.md +1 -1
- package/docs/floodlight/vis-pitches.md +9 -11
- package/docs/floodlight/vis-positions.md +9 -11
- package/docs/floodlight/vis-vis.md +5 -8
- package/docs/unravelsports/additional-citations.md +60 -0
- package/docs/unravelsports/additional-license.md +54 -0
- package/docs/unravelsports/american-football-dataset.md +176 -0
- package/docs/unravelsports/american-football-graphs.md +189 -0
- package/docs/unravelsports/api-american-football.md +18 -0
- package/docs/unravelsports/api-classifiers.md +345 -0
- package/docs/unravelsports/api-soccer.md +26 -0
- package/docs/unravelsports/api-utils.md +24 -0
- package/docs/unravelsports/generated-unravel-utils-add-dummy-label-column.md +17 -0
- package/docs/unravelsports/generated-unravel-utils-add-graph-id-column.md +15 -0
- package/docs/unravelsports/generated-unravel-utils-dummy-graph-ids.md +17 -0
- package/docs/unravelsports/generated-unravel-utils-dummy-labels.md +17 -0
- package/docs/unravelsports/getting-started-concepts.md +215 -0
- package/docs/unravelsports/getting-started-installation.md +79 -0
- package/docs/unravelsports/getting-started-quickstart.md +175 -0
- package/docs/unravelsports/index.md +134 -0
- package/docs/unravelsports/soccer-dataset.md +393 -0
- package/docs/unravelsports/soccer-graphs.md +325 -0
- package/docs/unravelsports/soccer-models.md +459 -0
- package/docs/unravelsports/tutorials-american-football.md +179 -0
- package/docs/unravelsports/tutorials-formation-detection.md +212 -0
- package/docs/unravelsports/tutorials-pressing-intensity.md +198 -0
- package/docs/unravelsports/tutorials-soccer-gnn.md +327 -0
- package/docs/unravelsports/utils-features.md +52 -0
- package/docs/unravelsports/utils-helpers.md +77 -0
- package/docs/unravelsports/utils-objects.md +41 -0
- package/package.json +15 -9
- package/providers.json +31 -1
- package/docs/_reference/skillcorner-crunch-help/getting-started-api-access-dynamic-events.md +0 -134
- package/docs/_reference/skillcorner-crunch-help/getting-started-api-access-our-tracking-data.md +0 -160
- package/docs/_reference/skillcorner-crunch-help/getting-started-best-practice-analysis-guidance.md +0 -16
- package/docs/_reference/skillcorner-crunch-help/getting-started-dynamic-events-check.md +0 -33
- package/docs/_reference/skillcorner-crunch-help/getting-started-explore-game-intelligence-data-1.md +0 -37
- package/docs/_reference/skillcorner-crunch-help/getting-started-explore-game-intelligence-data.md +0 -29
- package/docs/_reference/skillcorner-crunch-help/getting-started-first-requests.md +0 -99
- package/docs/_reference/skillcorner-crunch-help/getting-started-generate-visual-reports.md +0 -90
- package/docs/_reference/skillcorner-crunch-help/getting-started-make-your-first-queries.md +0 -92
- package/docs/_reference/skillcorner-crunch-help/getting-started-off-ball-run-sportscode-xml.md +0 -32
- package/docs/_reference/skillcorner-crunch-help/getting-started-on-ball-engagement-video-definitio.md +0 -15
- package/docs/_reference/skillcorner-crunch-help/getting-started-python-retrieve-dynamic-events-fil.md +0 -102
- package/docs/_reference/skillcorner-crunch-help/getting-started-python-retrieve-game-intelligence-.md +0 -158
- package/docs/_reference/skillcorner-crunch-help/getting-started-python-sync-your-database-with-ski.md +0 -192
- package/docs/_reference/skillcorner-crunch-help/getting-started-run-detection-and-classification.md +0 -131
- package/docs/_reference/skillcorner-crunch-help/getting-started-skill-corner-tracking-data.md +0 -82
- package/docs/_reference/skillcorner-crunch-help/getting-started-skillcorner-python-client.md +0 -70
- package/docs/_reference/skillcorner-crunch-help/getting-started-using-skillcorner-api.md +0 -146
- package/docs/_reference/skillcorner-crunch-help/getting-started.md +0 -43
- package/docs/_reference/skillcorner-crunch-help/glossaries-coordinates-distance-speeds-and-directi.md +0 -149
- package/docs/_reference/skillcorner-crunch-help/glossaries-dynamic-events-csv-specifications.md +0 -15
- package/docs/_reference/skillcorner-crunch-help/glossaries-forward-momentum.md +0 -13
- package/docs/_reference/skillcorner-crunch-help/glossaries-game-intelligence-v2-metrics.md +0 -17
- package/docs/_reference/skillcorner-crunch-help/glossaries-in-possession-package-content.md +0 -19
- package/docs/_reference/skillcorner-crunch-help/glossaries-line-breaking-passes.md +0 -103
- package/docs/_reference/skillcorner-crunch-help/glossaries-off-ball-run-dynamic-events.md +0 -197
- package/docs/_reference/skillcorner-crunch-help/glossaries-overcoming-pressure.md +0 -105
- package/docs/_reference/skillcorner-crunch-help/glossaries-passing-metrics-1.md +0 -144
- package/docs/_reference/skillcorner-crunch-help/glossaries-passing-moment-frame-selection.md +0 -19
- package/docs/_reference/skillcorner-crunch-help/glossaries-peak-sprint-velocity.md +0 -26
- package/docs/_reference/skillcorner-crunch-help/glossaries-phases-of-play-video-definitions.md +0 -15
- package/docs/_reference/skillcorner-crunch-help/glossaries-physical-data-glossary.md +0 -127
- package/docs/_reference/skillcorner-crunch-help/glossaries-running-off-ball-metrics-1.md +0 -135
- package/docs/_reference/skillcorner-crunch-help/glossaries.md +0 -43
- package/docs/_reference/skillcorner-crunch-help/index.md +0 -33
- package/docs/_reference/skillcorner-crunch-help/models-general-concepts-pass-completion-probabilit.md +0 -15
- package/docs/_reference/skillcorner-crunch-help/models-general-concepts-passing-option.md +0 -30
- package/docs/_reference/skillcorner-crunch-help/models-general-concepts-physical-load-prediction-m.md +0 -63
- package/docs/_reference/skillcorner-crunch-help/models-general-concepts-pressure-detection.md +0 -46
- package/docs/_reference/skillcorner-crunch-help/models-general-concepts-pressure-intensity.md +0 -80
- package/docs/_reference/skillcorner-crunch-help/models-general-concepts-threat.md +0 -40
- package/docs/_reference/skillcorner-crunch-help/models-general-concepts.md +0 -37
- package/docs/_reference/skillcorner-crunch-help/product-updates-1-changelog-2025.md +0 -57
- package/docs/_reference/skillcorner-crunch-help/product-updates-1-game-intelligence-v2-migration.md +0 -64
- package/docs/_reference/skillcorner-crunch-help/product-updates-1-product-updates.md +0 -200
- package/docs/_reference/skillcorner-crunch-help/product-updates-1.md +0 -25
- package/docs/_reference/skillcorner-crunch-help/tool-box-api-data-version.md +0 -255
- package/docs/_reference/skillcorner-crunch-help/tool-box-data-availability.md +0 -55
- package/docs/_reference/skillcorner-crunch-help/tool-box-python-event-tracking-synchronization-1.md +0 -442
- package/docs/_reference/skillcorner-crunch-help/tool-box-python-event-tracking-synchronization.md +0 -276
- package/docs/_reference/skillcorner-crunch-help/tool-box-python-off-ball-runs-radar-plots.md +0 -69
- package/docs/_reference/skillcorner-crunch-help/tool-box-rule-based-event-synchronisation.md +0 -44
- package/docs/_reference/skillcorner-crunch-help/tool-box.md +0 -35
- package/docs/_reference/skillcorner-crunch-help/working-with-the-data-averaging-per-match-per-even.md +0 -179
- package/docs/_reference/skillcorner-crunch-help/working-with-the-data-benchmarking-normalisation.md +0 -27
- package/docs/_reference/skillcorner-crunch-help/working-with-the-data-data-quality-standards.md +0 -45
- package/docs/_reference/skillcorner-crunch-help/working-with-the-data-physical-data-glossary-1-1.md +0 -54
- package/docs/_reference/skillcorner-crunch-help/working-with-the-data-physical-data-glossary-1.md +0 -25
- package/docs/_reference/skillcorner-crunch-help/working-with-the-data-pitch-modelisation.md +0 -27
- package/docs/_reference/skillcorner-crunch-help/working-with-the-data-playing-time-info.md +0 -133
- package/docs/_reference/skillcorner-crunch-help/working-with-the-data.md +0 -43
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ Searchable football data provider and tooling documentation for AI coding agents
|
|
|
4
4
|
|
|
5
5
|
**Who it's for:** Developers and analysts who use AI coding tools (Claude Code, Cursor, VS Code Copilot) to work with football data. Works with any tool that supports MCP.
|
|
6
6
|
|
|
7
|
-
**What it does:** Gives your AI agent a searchable index of documentation for
|
|
7
|
+
**What it does:** Gives your AI agent a searchable index of documentation for 23 football data providers and tools — event types, qualifier IDs, coordinate systems, API endpoints, data models, identity surfaces, and cross-provider comparisons for the data providers (StatsBomb, Opta, Wyscout, Impect, SkillCorner, Sportradar, TheSportsDB, FMDB Pro, TransferRoom, and more), plus the open-source libraries people build with (kloppy, mplsoccer, socceraction, soccerdata, floodlight, fast-forward, unravelsports, and more). Your agent looks up the real docs instead of guessing from training data.
|
|
8
8
|
|
|
9
9
|
**Why not just let the AI figure it out?** LLMs get football data specifics wrong constantly — Opta qualifier IDs, StatsBomb coordinate ranges, API endpoint URLs, library method signatures. These are mutable facts that change across versions. football-docs gives the agent verified, sourced documentation with provenance tracking so you know where every answer came from.
|
|
10
10
|
|
|
@@ -92,7 +92,7 @@ Add to `claude_desktop_config.json`:
|
|
|
92
92
|
| `request_update` | Request a new provider, flag outdated docs, or suggest a better doc source. Queues locally and points to the matching public GitHub issue template. |
|
|
93
93
|
| `resolve_entity` | Resolve players, teams, or coaches to cross-provider IDs via the Reep API. |
|
|
94
94
|
|
|
95
|
-
Provider filters use the indexed provider keys shown by `list_providers`, but common aliases are accepted. Examples: `fbref`, `understat`, `ClubElo`, `football-data.co.uk`, and `engsoccerdata` search `free-sources`; `Sofascore` and `ESPN` search `soccerdata`; `FMDB` searches `fmdb-pro`; `Transfer Room` searches `transferroom`; `Hudl Wyscout` searches `wyscout`; `Stats Perform` / `Opta F24` / `WhoScored` search `opta`; `Metrica`, `Sportec` / `DFL`, and `TRACAB` search `databallpy`; `Second Spectrum` searches `kloppy`; `SportRadar API` / `Soccer Extended` search `sportradar`; `The Sports DB` / `TSDB` search `thesportsdb`; `StatsBomb Open Data` searches `statsbomb`.
|
|
95
|
+
Provider filters use the indexed provider keys shown by `list_providers`, but common aliases are accepted. Examples: `fbref`, `understat`, `ClubElo`, `football-data.co.uk`, and `engsoccerdata` search `free-sources`; `Sofascore` and `ESPN` search `soccerdata`; `FMDB` searches `fmdb-pro`; `Transfer Room` searches `transferroom`; `Hudl Wyscout` searches `wyscout`; `Stats Perform` / `Opta F24` / `WhoScored` search `opta`; `Metrica`, `Sportec` / `DFL`, and `TRACAB` search `databallpy`; `Second Spectrum` searches `kloppy`; `Hawk-Eye`, `SciSports`, `Signality`, `Respovision`, `GradientSports` and `OptaVision` search `fast-forward`; `unravel` searches `unravelsports`; `SportRadar API` / `Soccer Extended` search `sportradar`; `The Sports DB` / `TSDB` search `thesportsdb`; `StatsBomb Open Data` searches `statsbomb`.
|
|
96
96
|
|
|
97
97
|
## Example queries
|
|
98
98
|
|
|
@@ -108,10 +108,12 @@ Provider filters use the indexed provider keys shown by `list_providers`, but co
|
|
|
108
108
|
|
|
109
109
|
| Provider | Chunks | Categories |
|
|
110
110
|
|----------|--------|------------|
|
|
111
|
+
| fast-forward | 251 | overview, getting-started, data-model, coordinate-system, orientations, layouts, transformations, distributed-compute, api-reference, 12 provider format pages |
|
|
111
112
|
| StatsBomb | 235 | event-types, data-model, coordinate-system, api-access, api-endpoints, charting-lineups, xg-model, iq-metrics, player/team stats, player-mapping, identity-surfaces |
|
|
113
|
+
| unravelsports | 202 | overview, installation, quickstart, concepts, graph converters, pressing intensity, formation detection, models, utils, american-football |
|
|
112
114
|
| Wyscout | 161 | event-types, data-model, coordinate-system, api-access, api-endpoints, charting-analysis-metrics, glossary, identity-surfaces |
|
|
113
115
|
| kloppy | 126 | data-model, usage, provider-mapping, tracking-rendering, event-derived-metrics |
|
|
114
|
-
| floodlight |
|
|
116
|
+
| floodlight | 144 | core data objects, io parsers (Tracab, DFL, Kinexon, Opta, SkillCorner, StatsBomb, StatsPerform, Second Spectrum), transforms, metrics, models, visualisation, guides |
|
|
115
117
|
| SportMonks | 82 | event-types, data-model, api-access, charting-season-stories, identity-surfaces |
|
|
116
118
|
| databallpy | 63 | data-model, overview, usage |
|
|
117
119
|
| mplsoccer | 64 | overview, pitch-types, visualizations |
|
|
@@ -130,7 +132,7 @@ Provider filters use the indexed provider keys shown by `list_providers`, but co
|
|
|
130
132
|
| Soccerdonna | 3 | identity-surfaces |
|
|
131
133
|
| Transfermarkt | 3 | identity-surfaces |
|
|
132
134
|
|
|
133
|
-
**1,
|
|
135
|
+
**1,808 searchable chunks** across 23 providers and tools.
|
|
134
136
|
|
|
135
137
|
> **Impect** documentation is built solely from the public
|
|
136
138
|
> [ImpectAPI/open-data](https://github.com/ImpectAPI/open-data) repository — a
|
|
@@ -150,7 +152,7 @@ trusting them.
|
|
|
150
152
|
|
|
151
153
|
| Providers | Ground truth | Checked by |
|
|
152
154
|
|---|---|---|
|
|
153
|
-
| kloppy, socceraction, soccerdata, mplsoccer, floodlight, databallpy, skillcorner | The installed package itself — enum members, importable symbols, class constants | `src/__tests__/provider-truth.test.ts` |
|
|
155
|
+
| kloppy, socceraction, soccerdata, mplsoccer, floodlight, databallpy, skillcorner, fast-forward, unravelsports | The installed package itself — enum members, importable symbols, class constants, `Literal` parameter vocabularies | `src/__tests__/provider-truth.test.ts` |
|
|
154
156
|
| Wyscout, SkillCorner, FMDB Pro, Sportradar | The vendor's own publicly published OpenAPI spec — endpoint paths and methods | `src/__tests__/provider-truth.test.ts` |
|
|
155
157
|
| BeSoccer | The vendor's published Postman collection — request vocabulary and parameters | `src/__tests__/provider-truth.test.ts` |
|
|
156
158
|
| Impect | The public [open-data](https://github.com/ImpectAPI/open-data) repository | `src/__tests__/impect-open-data-validation.test.ts` |
|
|
@@ -176,6 +178,11 @@ A doc that names an enum member or importable symbol which does not exist in the
|
|
|
176
178
|
real package fails the build. `scripts/gen_openapi_truth.py` derives the same kind
|
|
177
179
|
of facts from a vendor OpenAPI spec, for providers documented that way.
|
|
178
180
|
|
|
181
|
+
Not every vocabulary is an enum. fast-forward's coordinate systems, orientations
|
|
182
|
+
and layouts are lowercase strings on `Literal`-annotated parameters, so the truth
|
|
183
|
+
files also record what each parameter accepts, and a doc writing
|
|
184
|
+
`coordinates="statsbomb"` fails the same way an invented enum member would.
|
|
185
|
+
|
|
179
186
|
## Contributing
|
|
180
187
|
|
|
181
188
|
Contributions are welcome from everyone. There are three ways to help:
|
package/data/docs.db
CHANGED
|
Binary file
|
package/dist/crawl.js
CHANGED
|
@@ -58,6 +58,142 @@ turndown.addRule("sphinxPreSpan", {
|
|
|
58
58
|
.includes("pre"),
|
|
59
59
|
replacement: (_content, node) => `\`${node.textContent ?? ""}\``,
|
|
60
60
|
});
|
|
61
|
+
// Sphinx and mkdocs both append a permalink anchor to every heading. Left in, it
|
|
62
|
+
// becomes `## Orientations[¶](https://.../#orientations "Permanent link")`, and
|
|
63
|
+
// since a chunk is titled by its heading that URL is the first thing an agent
|
|
64
|
+
// reads in a search result. It carries no information the frontmatter lacks.
|
|
65
|
+
// Sphinx and mkdocs append a permalink anchor to every heading and every API
|
|
66
|
+
// definition. Its visible text is junk (a pilcrow, or nothing at all), so it
|
|
67
|
+
// has to go. But on an API definition the href fragment is the only place the
|
|
68
|
+
// fully-qualified name appears: the signature itself renders as `frame`(t),
|
|
69
|
+
// and dropping the anchor took floodlight.core.xy.XY.frame out of the corpus
|
|
70
|
+
// with it - 93 identifiers on floodlight alone. A heading's fragment is a
|
|
71
|
+
// slug (#decoupling-data-and-pitches) and carries nothing, so keep the
|
|
72
|
+
// fragment only when it looks like a dotted identifier.
|
|
73
|
+
const DOTTED_IDENTIFIER = /^[A-Za-z_][A-Za-z0-9_]*(?:\.[A-Za-z_][A-Za-z0-9_]*)+$/;
|
|
74
|
+
turndown.addRule("headerlink", {
|
|
75
|
+
filter: (node) => node.nodeName === "A" &&
|
|
76
|
+
(node.getAttribute?.("class") ?? "")
|
|
77
|
+
.split(/\s+/)
|
|
78
|
+
.includes("headerlink"),
|
|
79
|
+
replacement: (_content, node) => {
|
|
80
|
+
const href = node.getAttribute?.("href") ?? "";
|
|
81
|
+
const fragment = href.slice(href.indexOf("#") + 1);
|
|
82
|
+
if (!href.includes("#") || !DOTTED_IDENTIFIER.test(fragment))
|
|
83
|
+
return "";
|
|
84
|
+
// A code span, not bare text: the name sits immediately after the
|
|
85
|
+
// signature, and backticks keep it one searchable token. The enum-member
|
|
86
|
+
// check only matches SCREAMING_SNAKE inside backticks, so a dotted
|
|
87
|
+
// lowercase path adds search coverage without inventing a truth-file claim.
|
|
88
|
+
return ` \`${fragment}\``;
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
// Turndown has no table rule, so a <table> falls through to block handling and
|
|
92
|
+
// every cell lands on its own line. That is worse than losing the table: a
|
|
93
|
+
// coordinate-system alias table becomes a column of unattached words, and an
|
|
94
|
+
// agent reading "cdf / CDF / Center / meters / Up" cannot tell which value
|
|
95
|
+
// belongs to which heading. Emit GFM instead - the corpus is markdown that
|
|
96
|
+
// models read, and the row is the unit of meaning.
|
|
97
|
+
turndown.addRule("gfmTable", {
|
|
98
|
+
filter: "table",
|
|
99
|
+
replacement: (_content, node) => {
|
|
100
|
+
// Turndown parses with its own bundled DOM, whose NodeList is neither
|
|
101
|
+
// spreadable nor guaranteed to implement querySelectorAll. Walking direct
|
|
102
|
+
// children is portable, and it keeps a nested table's rows out of this one.
|
|
103
|
+
const childrenNamed = (parent, names) => {
|
|
104
|
+
const out = [];
|
|
105
|
+
const kids = parent.childNodes;
|
|
106
|
+
for (let i = 0; i < (kids?.length ?? 0); i++) {
|
|
107
|
+
const kid = kids[i];
|
|
108
|
+
if (names.includes(kid.nodeName))
|
|
109
|
+
out.push(kid);
|
|
110
|
+
}
|
|
111
|
+
return out;
|
|
112
|
+
};
|
|
113
|
+
const table = node;
|
|
114
|
+
const rows = [];
|
|
115
|
+
for (const section of [table, ...childrenNamed(table, ["THEAD", "TBODY", "TFOOT"])]) {
|
|
116
|
+
rows.push(...childrenNamed(section, ["TR"]));
|
|
117
|
+
}
|
|
118
|
+
if (rows.length === 0)
|
|
119
|
+
return "";
|
|
120
|
+
// textContent alone would flatten `<code>cdf</code>` to bare cdf, and the
|
|
121
|
+
// enum-member check only looks inside backticks - so a vocabulary documented
|
|
122
|
+
// in a table would silently stop being validated.
|
|
123
|
+
const cellText = (cell) => {
|
|
124
|
+
let text = "";
|
|
125
|
+
const visit = (element) => {
|
|
126
|
+
const kids = element.childNodes;
|
|
127
|
+
for (let i = 0; i < (kids?.length ?? 0); i++) {
|
|
128
|
+
const kid = kids[i];
|
|
129
|
+
if (kid.nodeName === "CODE")
|
|
130
|
+
text += `\`${kid.textContent ?? ""}\``;
|
|
131
|
+
else if (kid.nodeName === "#text")
|
|
132
|
+
text += kid.textContent ?? "";
|
|
133
|
+
else
|
|
134
|
+
visit(kid);
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
visit(cell);
|
|
138
|
+
// Flatten to one line and neutralise pipes, which would invent columns.
|
|
139
|
+
// Backslashes have to go first: escaping only the pipe turns a cell reading
|
|
140
|
+
// `a\|b` into `a\\|b`, where the backslash escapes itself and the pipe is
|
|
141
|
+
// left live, splitting the row.
|
|
142
|
+
return text
|
|
143
|
+
.replace(/\s+/g, " ")
|
|
144
|
+
.replace(/\\/g, "\\\\")
|
|
145
|
+
.replace(/\|/g, "\\|")
|
|
146
|
+
.trim();
|
|
147
|
+
};
|
|
148
|
+
const body = rows
|
|
149
|
+
.map((row) => childrenNamed(row, ["TH", "TD"]).map(cellText))
|
|
150
|
+
.filter((cells) => cells.length > 0);
|
|
151
|
+
if (body.length === 0)
|
|
152
|
+
return "";
|
|
153
|
+
// A table whose first row carries <th> has an explicit header; otherwise GFM
|
|
154
|
+
// still requires a delimiter row, so synthesise an empty one.
|
|
155
|
+
const hasHeader = childrenNamed(rows[0], ["TH"]).length > 0;
|
|
156
|
+
const width = Math.max(...body.map((cells) => cells.length));
|
|
157
|
+
const pad = (cells) => [...cells, ...Array(width - cells.length).fill("")];
|
|
158
|
+
const line = (cells) => `| ${pad(cells).join(" | ")} |`;
|
|
159
|
+
const header = hasHeader ? body[0] : Array(width).fill("");
|
|
160
|
+
const rest = hasHeader ? body.slice(1) : body;
|
|
161
|
+
return `\n\n${[line(header), `|${" --- |".repeat(width)}`, ...rest.map(line)].join("\n")}\n\n`;
|
|
162
|
+
},
|
|
163
|
+
});
|
|
164
|
+
// Definition lists lose their structure the same way tables did. Sphinx writes
|
|
165
|
+
// prose glossaries and "Parameters:"/"Returns:" field lists as <dl>, and with no
|
|
166
|
+
// rule the terms and their descriptions all land as unattached paragraphs -
|
|
167
|
+
// "Unit of measurement" then "What's x and y measured in?", with nothing to say
|
|
168
|
+
// which is the term. Bold marks the term, so the pair survives as a pair.
|
|
169
|
+
//
|
|
170
|
+
// Scoped deliberately: Sphinx also renders API signatures as <dl class="py
|
|
171
|
+
// method">, where the <dt> is the signature itself. Bolding those would fight
|
|
172
|
+
// the code formatting they already carry, so only plain and field-list <dl>s
|
|
173
|
+
// are rewritten.
|
|
174
|
+
const isPlainDefinitionList = (node) => {
|
|
175
|
+
const parent = node.parentNode;
|
|
176
|
+
if (parent?.nodeName !== "DL")
|
|
177
|
+
return false;
|
|
178
|
+
const classes = (parent.getAttribute?.("class") ?? "").split(/\s+/);
|
|
179
|
+
if (classes.includes("py"))
|
|
180
|
+
return false;
|
|
181
|
+
return classes.includes("simple") || classes.includes("field-list");
|
|
182
|
+
};
|
|
183
|
+
turndown.addRule("definitionTerm", {
|
|
184
|
+
filter: (node) => node.nodeName === "DT" && isPlainDefinitionList(node),
|
|
185
|
+
replacement: (content) => {
|
|
186
|
+
const term = content.replace(/\s+/g, " ").trim();
|
|
187
|
+
return term ? `\n\n**${term}**\n\n` : "";
|
|
188
|
+
},
|
|
189
|
+
});
|
|
190
|
+
turndown.addRule("definitionDescription", {
|
|
191
|
+
filter: (node) => node.nodeName === "DD" && isPlainDefinitionList(node),
|
|
192
|
+
replacement: (content) => {
|
|
193
|
+
const body = content.trim();
|
|
194
|
+
return body ? `${body}\n\n` : "";
|
|
195
|
+
},
|
|
196
|
+
});
|
|
61
197
|
// Turndown escapes every underscore in plain text nodes by default (guarding
|
|
62
198
|
// against accidental markdown emphasis), including identifiers that carry no
|
|
63
199
|
// code markup at all — e.g. Sphinx renders parameter/return names in
|
|
@@ -95,12 +231,16 @@ export function htmlToMarkdown(html, url) {
|
|
|
95
231
|
? html
|
|
96
232
|
: html.replace(/(<head[^>]*>)/i, `$1<base href="${url}">`);
|
|
97
233
|
const { document } = parseHTML(htmlWithBase);
|
|
98
|
-
//
|
|
99
|
-
//
|
|
100
|
-
//
|
|
234
|
+
// Readability strips every class it is not told to keep, so any Turndown rule
|
|
235
|
+
// that keys off one has to name it here:
|
|
236
|
+
// pre Sphinx's no-wrap marker for inline literals (sphinxPreSpan)
|
|
237
|
+
// headerlink Sphinx's and mkdocs' permalink anchor (headerlink)
|
|
238
|
+
// simple a plain <dl> glossary (definitionTerm/definitionDescription)
|
|
239
|
+
// field-list a Sphinx "Parameters:"/"Returns:" block, same rules
|
|
240
|
+
// py a Python API signature <dl>, which those rules must skip
|
|
101
241
|
const reader = new Readability(document, {
|
|
102
242
|
charThreshold: 100,
|
|
103
|
-
classesToPreserve: ["pre"],
|
|
243
|
+
classesToPreserve: ["pre", "headerlink", "simple", "field-list", "py"],
|
|
104
244
|
});
|
|
105
245
|
const article = reader.parse();
|
|
106
246
|
if (!article?.content)
|
|
@@ -180,8 +320,13 @@ async function crawlDocsSite(baseUrl) {
|
|
|
180
320
|
source_type: "crawled",
|
|
181
321
|
});
|
|
182
322
|
}
|
|
183
|
-
// Extract links from the index page
|
|
184
|
-
|
|
323
|
+
// Extract links from the index page.
|
|
324
|
+
//
|
|
325
|
+
// Sphinx writes page links as `concepts/dataset.html`; mkdocs and anything else
|
|
326
|
+
// using directory URLs writes `concepts/dataset/`. Matching only the first form
|
|
327
|
+
// is why a mkdocs site used to yield its index page and nothing else.
|
|
328
|
+
const linkPattern = /href="([^"]+)"/g;
|
|
329
|
+
const rootPath = new URL(`${root}/`).pathname;
|
|
185
330
|
const links = new Set();
|
|
186
331
|
for (const match of indexHtml.matchAll(linkPattern)) {
|
|
187
332
|
const href = match[1];
|
|
@@ -191,16 +336,24 @@ async function crawlDocsSite(baseUrl) {
|
|
|
191
336
|
href.includes("_static") ||
|
|
192
337
|
href.includes("_sources"))
|
|
193
338
|
continue;
|
|
194
|
-
let
|
|
339
|
+
let url;
|
|
195
340
|
try {
|
|
196
|
-
|
|
341
|
+
url = new URL(href, `${root}/`);
|
|
197
342
|
}
|
|
198
343
|
catch {
|
|
199
344
|
continue;
|
|
200
345
|
}
|
|
201
|
-
if (
|
|
346
|
+
if (url.hostname !== rootHost)
|
|
202
347
|
continue;
|
|
203
|
-
|
|
348
|
+
if (!/\.html?$/.test(url.pathname) && !url.pathname.endsWith("/"))
|
|
349
|
+
continue;
|
|
350
|
+
// The index page is already captured above, and every nav links back to it.
|
|
351
|
+
if (url.pathname === rootPath)
|
|
352
|
+
continue;
|
|
353
|
+
// Anchors and queries point into a page already queued, not at a new one.
|
|
354
|
+
url.hash = "";
|
|
355
|
+
url.search = "";
|
|
356
|
+
links.add(url.href);
|
|
204
357
|
}
|
|
205
358
|
// Cap at 50 pages to avoid hammering upstream
|
|
206
359
|
const pageUrls = [...links].slice(0, 50);
|
|
@@ -211,11 +364,15 @@ async function crawlDocsSite(baseUrl) {
|
|
|
211
364
|
const content = htmlToMarkdown(html, pageUrl);
|
|
212
365
|
if (!content || content.length < 100)
|
|
213
366
|
continue;
|
|
214
|
-
// Use last 2 path segments to avoid duplicate category names
|
|
367
|
+
// Use last 2 path segments to avoid duplicate category names, minus the
|
|
368
|
+
// language and version segments ReadTheDocs puts in every URL - without this
|
|
369
|
+
// a top-level page at /en/latest/getting-started/ is filed as
|
|
370
|
+
// "latest-getting-started", which reads as a version rather than a topic.
|
|
215
371
|
const pathSegments = new URL(pageUrl).pathname
|
|
216
372
|
.replace(/\.(html?|htm)$/, "")
|
|
217
373
|
.split("/")
|
|
218
|
-
.filter(Boolean)
|
|
374
|
+
.filter(Boolean)
|
|
375
|
+
.filter((segment) => !/^(en|latest|stable|v?\d+(\.\d+)*)$/i.test(segment));
|
|
219
376
|
let category = slugify(pathSegments.slice(-2).join("-") || "page");
|
|
220
377
|
// Deduplicate: append a suffix if the category is already used
|
|
221
378
|
if (usedCategories.has(category)) {
|
|
@@ -471,7 +628,15 @@ async function main() {
|
|
|
471
628
|
console.log(` → ${docs.length} doc(s) written`);
|
|
472
629
|
}
|
|
473
630
|
}
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
631
|
+
// Only run when executed directly. Importing this module for its exported
|
|
632
|
+
// helpers - which the tests do - must not start a crawl: it writes over docs/
|
|
633
|
+
// for every provider in the registry, from whatever upstream happens to serve
|
|
634
|
+
// that minute. Compare resolved paths rather than matching on the filename, so
|
|
635
|
+
// a same-named script elsewhere on the path cannot trigger it either.
|
|
636
|
+
const entrypoint = process.argv[1] ? resolve(process.argv[1]) : "";
|
|
637
|
+
if (entrypoint && entrypoint === fileURLToPath(import.meta.url)) {
|
|
638
|
+
main().catch((err) => {
|
|
639
|
+
console.error("Crawl failed:", err);
|
|
640
|
+
process.exit(1);
|
|
641
|
+
});
|
|
642
|
+
}
|
package/dist/provider-truth.d.ts
CHANGED
|
@@ -6,12 +6,17 @@
|
|
|
6
6
|
* checks docs/<provider>/*.md against those facts and is run by the test suite,
|
|
7
7
|
* so a doc claiming a symbol or enum member that does not exist fails the build.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
9
|
+
* Three checks, all chosen for precision over coverage:
|
|
10
10
|
*
|
|
11
11
|
* 1. Imports - every `from <package> import X` in a doc must resolve to a real
|
|
12
12
|
* symbol. This is what catches fabricated API surface.
|
|
13
13
|
* 2. Enum members - every SCREAMING_SNAKE token in a code span must belong to
|
|
14
14
|
* one of the package's enums, or be explicitly allowlisted below.
|
|
15
|
+
* 3. Literal arguments - every `param="value"` a doc writes must be a value that
|
|
16
|
+
* parameter's Literal annotation actually accepts. Checks 1 and 2
|
|
17
|
+
* both assume a vocabulary is made of identifiers; fast-forward's
|
|
18
|
+
* is entirely lowercase strings, so without this its docs would
|
|
19
|
+
* pass while naming a coordinate system that does not exist.
|
|
15
20
|
*
|
|
16
21
|
* Regenerate a truth file after a version bump:
|
|
17
22
|
* python3 scripts/gen_python_truth.py kloppy --provider kloppy
|
|
@@ -27,6 +32,10 @@ export interface PythonPackageTruth {
|
|
|
27
32
|
modules: Record<string, string[]>;
|
|
28
33
|
enums: Record<string, string[]>;
|
|
29
34
|
valueLists: Record<string, string[]>;
|
|
35
|
+
/** Parameter name -> every value any function in the package accepts for it. */
|
|
36
|
+
literals: Record<string, string[]>;
|
|
37
|
+
/** Qualified function -> its own Literal parameters, which are often narrower. */
|
|
38
|
+
literalsByFunction: Record<string, Record<string, string[]>>;
|
|
30
39
|
classes: string[];
|
|
31
40
|
symbols: string[];
|
|
32
41
|
signatures: Record<string, string>;
|
|
@@ -90,6 +99,27 @@ export declare function extractImportedSymbols(text: string, pkg: string): strin
|
|
|
90
99
|
/** SCREAMING_SNAKE_CASE tokens inside backtick code spans. */
|
|
91
100
|
export declare function extractEnumTokens(text: string): string[];
|
|
92
101
|
export declare function validateProviderDocs(docs: DocFile[], truth: PythonPackageTruth): string[];
|
|
102
|
+
/**
|
|
103
|
+
* `param="value"` pairs a doc writes, for parameters with a Literal annotation.
|
|
104
|
+
*
|
|
105
|
+
* Also matches the `to_`-prefixed form: fast-forward's transform() takes
|
|
106
|
+
* `to_coordinates` and `to_orientation` typed as plain `Optional[str]`, but the
|
|
107
|
+
* values they accept are the same vocabulary as the `coordinates` and
|
|
108
|
+
* `orientation` load parameters, and that is where a wrong value would be written.
|
|
109
|
+
*/
|
|
110
|
+
export declare function extractLiteralArguments(text: string, params: string[]): Array<{
|
|
111
|
+
param: string;
|
|
112
|
+
value: string;
|
|
113
|
+
}>;
|
|
114
|
+
export declare function validateLiteralArguments(docs: DocFile[], truth: PythonPackageTruth): string[];
|
|
115
|
+
/**
|
|
116
|
+
* How many literal arguments a doc set actually cites.
|
|
117
|
+
*
|
|
118
|
+
* validateLiteralArguments returns no violations both when every documented value
|
|
119
|
+
* is real and when the docs cite none at all, so the tests assert this separately
|
|
120
|
+
* rather than reading an empty violation list as coverage.
|
|
121
|
+
*/
|
|
122
|
+
export declare function countDocumentedLiteralArguments(docs: DocFile[], truth: PythonPackageTruth): number;
|
|
93
123
|
export interface PostmanTruth {
|
|
94
124
|
provider: string;
|
|
95
125
|
kind: string;
|
package/dist/provider-truth.js
CHANGED
|
@@ -6,12 +6,17 @@
|
|
|
6
6
|
* checks docs/<provider>/*.md against those facts and is run by the test suite,
|
|
7
7
|
* so a doc claiming a symbol or enum member that does not exist fails the build.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
9
|
+
* Three checks, all chosen for precision over coverage:
|
|
10
10
|
*
|
|
11
11
|
* 1. Imports - every `from <package> import X` in a doc must resolve to a real
|
|
12
12
|
* symbol. This is what catches fabricated API surface.
|
|
13
13
|
* 2. Enum members - every SCREAMING_SNAKE token in a code span must belong to
|
|
14
14
|
* one of the package's enums, or be explicitly allowlisted below.
|
|
15
|
+
* 3. Literal arguments - every `param="value"` a doc writes must be a value that
|
|
16
|
+
* parameter's Literal annotation actually accepts. Checks 1 and 2
|
|
17
|
+
* both assume a vocabulary is made of identifiers; fast-forward's
|
|
18
|
+
* is entirely lowercase strings, so without this its docs would
|
|
19
|
+
* pass while naming a coordinate system that does not exist.
|
|
15
20
|
*
|
|
16
21
|
* Regenerate a truth file after a version bump:
|
|
17
22
|
* python3 scripts/gen_python_truth.py kloppy --provider kloppy
|
|
@@ -53,6 +58,11 @@ const TOKEN_ALLOWLIST = {
|
|
|
53
58
|
databallpy: [],
|
|
54
59
|
// HTTP verbs in the endpoint tables.
|
|
55
60
|
skillcorner: ["GET", "POST"],
|
|
61
|
+
// Match-official position codes emitted when include_officials=True. They come
|
|
62
|
+
// from the Rust core rather than a Python enum, so introspection cannot see them.
|
|
63
|
+
"fast-forward": ["REF", "AREF", "VAR", "AVAR"],
|
|
64
|
+
// A torchmetrics metric the training loop tracks, not an unravel symbol.
|
|
65
|
+
unravelsports: ["AUROC"],
|
|
56
66
|
};
|
|
57
67
|
/**
|
|
58
68
|
* Endpoint paths a doc set may cite without the spec defining them - other
|
|
@@ -244,6 +254,47 @@ export function validateProviderDocs(docs, truth) {
|
|
|
244
254
|
}
|
|
245
255
|
return violations;
|
|
246
256
|
}
|
|
257
|
+
/**
|
|
258
|
+
* `param="value"` pairs a doc writes, for parameters with a Literal annotation.
|
|
259
|
+
*
|
|
260
|
+
* Also matches the `to_`-prefixed form: fast-forward's transform() takes
|
|
261
|
+
* `to_coordinates` and `to_orientation` typed as plain `Optional[str]`, but the
|
|
262
|
+
* values they accept are the same vocabulary as the `coordinates` and
|
|
263
|
+
* `orientation` load parameters, and that is where a wrong value would be written.
|
|
264
|
+
*/
|
|
265
|
+
export function extractLiteralArguments(text, params) {
|
|
266
|
+
if (params.length === 0)
|
|
267
|
+
return [];
|
|
268
|
+
const alternation = params.map((p) => p.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|");
|
|
269
|
+
const re = new RegExp(`\\b(?:to_)?(${alternation})\\s*=\\s*["']([^"'\\n]+)["']`, "g");
|
|
270
|
+
const out = [];
|
|
271
|
+
for (const match of text.matchAll(re))
|
|
272
|
+
out.push({ param: match[1], value: match[2] });
|
|
273
|
+
return out;
|
|
274
|
+
}
|
|
275
|
+
export function validateLiteralArguments(docs, truth) {
|
|
276
|
+
const violations = [];
|
|
277
|
+
const params = Object.keys(truth.literals);
|
|
278
|
+
for (const { file, text } of docs) {
|
|
279
|
+
for (const { param, value } of extractLiteralArguments(text, params)) {
|
|
280
|
+
if (!truth.literals[param].includes(value)) {
|
|
281
|
+
violations.push(`${file}: \`${param}="${value}"\` - not accepted by any ${truth.source.package} ${truth.source.version} function; valid: ${truth.literals[param].join(", ")}`);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
return violations;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* How many literal arguments a doc set actually cites.
|
|
289
|
+
*
|
|
290
|
+
* validateLiteralArguments returns no violations both when every documented value
|
|
291
|
+
* is real and when the docs cite none at all, so the tests assert this separately
|
|
292
|
+
* rather than reading an empty violation list as coverage.
|
|
293
|
+
*/
|
|
294
|
+
export function countDocumentedLiteralArguments(docs, truth) {
|
|
295
|
+
const params = Object.keys(truth.literals);
|
|
296
|
+
return docs.reduce((n, d) => n + extractLiteralArguments(d.text, params).length, 0);
|
|
297
|
+
}
|
|
247
298
|
export function loadPostmanTruth(provider) {
|
|
248
299
|
return JSON.parse(readFileSync(resolve(TRUTH_DIR, `${provider}.postman.json`), "utf-8"));
|
|
249
300
|
}
|