Skip to content

feat: hs meta archetypes/decks — live win-rate/tier/deck-code (Firestone)#19

Merged
say8425 merged 16 commits into
mainfrom
feat/meta-stats
May 31, 2026
Merged

feat: hs meta archetypes/decks — live win-rate/tier/deck-code (Firestone)#19
say8425 merged 16 commits into
mainfrom
feat/meta-stats

Conversation

@say8425

@say8425 say8425 commented May 29, 2026

Copy link
Copy Markdown
Owner

Summary

Adds live Hearthstone meta to the CLI via two new hs meta subcommands, 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 codes

Flags (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 — pure wilsonLower / marginOfError / tierBand
  • src/services/archetype-names.ts — Firestone translations slug→display name (24h cache)
  • src/services/meta-stats.tsbuildMetaUrl + fetchMeta (CDN JSON, 1h cache, UA header, stale-cache fallback) + pure rankArchetypes/rankDecks
  • src/services/formatter.tsformatMetaStats (table/json, attribution header, low-sample flag)
  • src/commands/meta.ts — static metadata types unchanged; new live types validated + wired

Deck codes from hs meta decks pipe into hs 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 pass
  • Pure logic covered by committed fixtures: wilson/MoE/tier, buildUrl, rank filter/sort/limit/deckcode, slug→display, formatMetaStats json+table+low-sample
  • e2e live: meta archetypes (real data, wilson sort, ±MoE), meta decks -f json deckcode → hs deck decodes a real deck, 1h cache hit, invalid-flag guard exits 1
  • static meta classes/sets unchanged (no regression)
  • CI green on this PR

🤖 Generated with Claude Code

@say8425 say8425 merged commit c99f3ef into main May 31, 2026
6 checks passed
@say8425 say8425 deleted the feat/meta-stats branch May 31, 2026 03:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant