feat: hs meta archetypes/decks — live win-rate/tier/deck-code (Firestone)#19
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds live Hearthstone meta to the CLI via two new
hs metasubcommands, backed by Firestone (firestoneapp.com), used with written permission:hs meta archetypes— archetype tier view (aggregated win rate per archetype)hs meta decks— individual decks with deck codesFlags (both):
--game-format standard|wild|twist,--rank legend|top-2000-legend|competitive|legend-diamond|diamond|platinum|bronze-gold|all,--period last-patch|past-3|past-7|past-20|current-season,--min-games N,--sort wilson|winrate|games,--limit N, plus existing-f table|json.Methodology (why this isn't naive)
Ranking by raw win rate surfaces small-sample flukes, so rows are ranked by the Wilson score lower bound (the Reddit/Yelp standard), shown alongside raw WR and a ±margin-of-error column. Sample-size floor (decks 400 / archetypes 2000, overridable). Heuristic tier bands (S/A/B/C/D) computed on the Wilson lower bound so a 40/50 spike can't inflate to tier S. Rank brackets are never silently blended (low ranks skew). Defaults:
legend/last-patch.Architecture (small, focused units)
src/services/stats-math.ts— purewilsonLower/marginOfError/tierBandsrc/services/archetype-names.ts— Firestone translations slug→display name (24h cache)src/services/meta-stats.ts—buildMetaUrl+fetchMeta(CDN JSON, 1h cache, UA header, stale-cache fallback) + purerankArchetypes/rankDeckssrc/services/formatter.ts—formatMetaStats(table/json, attribution header, low-sample flag)src/commands/meta.ts— static metadata types unchanged; new live types validated + wiredDeck codes from
hs meta deckspipe intohs deck <code>. Attribution in output + all 6 READMEs. Does not touch Firestone's rate-sensitive per-deck Lambda endpoint.Test Plan
bun run check— lint 0, fmt:check clean, typecheck 0, 75 tests passmeta archetypes(real data, wilson sort, ±MoE),meta decks -f jsondeckcode →hs deckdecodes a real deck, 1h cache hit, invalid-flag guard exits 1meta classes/setsunchanged (no regression)🤖 Generated with Claude Code