Skip to content

Commit 10215db

Browse files
committed
Add SOURCE_META with human-readable labels and source URLs
Derives OpeningSource type from SOURCE_META keys so they can never go out of sync. Each source now has a .label (display name) and optional .url (provenance link).
1 parent 22802a6 commit 10215db

1 file changed

Lines changed: 25 additions & 6 deletions

File tree

src/types.ts

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
/**
2-
* Source of the opening data.
3-
* eco_tsv is the authoritative source from lichess.
4-
* eco_wikip = Wikipedia chess openings pages
5-
* eco_wikip.g = Wikipedia "List of chess gambits" page (wikiGambits parser)
6-
* wiki_b = Wikibooks Chess Opening Theory (wikiChessOpeningTheoryCrawler)
7-
* fics = Free Internet Chess Server opening database (parser unknown/missing)
2+
* Source of the opening data in eco.json.
3+
*
4+
* eco_tsv is the authoritative source — when it conflicts with any other
5+
* source, eco_tsv wins and the other source's name moves to aliases.
86
*/
7+
98
export type OpeningSource =
109
| "eco_tsv"
1110
| "eco_js"
@@ -21,6 +20,26 @@ export type OpeningSource =
2120
| "pgn"
2221
| "interpolated";
2322

23+
/**
24+
* Human-readable metadata for each opening data source.
25+
* Useful for UI display, documentation, and debugging.
26+
*/
27+
export const SOURCE_META = {
28+
eco_tsv: { label: "Lichess", url: "https://github.com/lichess-org/chess-openings" },
29+
eco_js: { label: "chess.js / chessops", url: "https://github.com/niklasf/chessops" },
30+
scid: { label: "SCID", url: "https://scid.sourceforge.net/" },
31+
eco_wikip: { label: "Wikipedia", url: "https://en.wikipedia.org/wiki/Chess_opening" },
32+
"eco_wikip.g": { label: "Wikipedia Gambits", url: "https://en.wikipedia.org/wiki/List_of_chess_gambits" },
33+
wiki_b: { label: "Wikibooks Opening Theory", url: "https://en.wikibooks.org/wiki/Chess_Opening_Theory" },
34+
fics: { label: "FICS", url: "https://www.freechess.org/" },
35+
ct: { label: "ChessTempo", url: "https://www.chesstempo.com/" },
36+
chessGraph: { label: "Chess-Graph", url: "https://github.com/Destaq/chess-graph" },
37+
chronos: { label: "Chronos / pgn-extract", url: "https://www.cs.kent.ac.uk/people/staff/djb/pgn-extract/" },
38+
icsbot: { label: "ICS Bot", url: undefined },
39+
pgn: { label: "PGN (generic)", url: undefined },
40+
interpolated: { label: "Interpolated (generated)", url: undefined },
41+
} satisfies Record<OpeningSource, { label: string; url?: string }>;
42+
2443
/**
2544
* ECO category (A-E)
2645
*/

0 commit comments

Comments
 (0)