npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@jackemcpherson/tipper

v3.4.0

Published

AFL match prediction CLI combining MOV-Elo with player-level PAV ratings

Readme

tipper

CI npm

AFL match prediction CLI combining MOV-Elo ratings with player-level PAV (Player Approximate Value). The CLI calls the Cloudflare D1 REST API directly and runs the prediction engine locally.

This is personal tooling: it requires your own Cloudflare D1 database populated with the afl-stats schema. It will not work out of the box against someone else's data.

Setup

npm install -g @jackemcpherson/tipper

# Auth: uses wrangler's OAuth token automatically
wrangler login

If wrangler login isn't available, set CLOUDFLARE_API_TOKEN instead.

Environment variables

| Variable | Purpose | | -------------------------- | ---------------------------------------------------------------- | | CLOUDFLARE_API_TOKEN | API token with D1 read access (takes precedence over wrangler's OAuth token) | | CLOUDFLARE_ACCOUNT_ID | Overrides the default Cloudflare account ID | | CLOUDFLARE_D1_DATABASE_ID| Overrides the default D1 database ID | | TIPPER_NO_CACHE | Set to disable the local season-data cache |

Point CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_D1_DATABASE_ID at your own account and afl-stats D1 database.

Usage

# Backtest the current model across historical seasons
tipper backtest

# Backtest a specific config
tipper backtest --config predha-080

# Predict upcoming matches
tipper predict --season 2026 --round 15

# Bootstrap-compare two configs
tipper compare --config-a predha-080 --config-b od-w100-k008

# Manage configs
tipper config list
tipper config show predha-080
tipper config current
tipper config promote predha-080 --reason "v3: prediction-side home advantage"
tipper config create new-config --from predha-080
tipper config diff config-a config-b

Caching

Historical season data (matches, lineups, player stats) is cached under ~/.cache/tipper/ after the first fetch. Past seasons are append-only, so the cache never goes stale; the current season is always fetched live. Pass --no-cache (or set TIPPER_NO_CACHE=1) to bypass it.

Development

bun run build        # Compile TypeScript
bun run typecheck    # Type-check without emitting
bun run test         # Run tests (vitest)
bun run check        # Lint + format (biome)
bun run format       # Auto-format

Architecture

Two parallel state machines joined by a read-only predictor:

  • Elo — MOV-Elo rating system (FiveThirtyEight-style margin-of-victory multiplier). Tracks team strength over time.
  • PAV — Round-by-round player approximate value using the HPN formula with a fixed pool of 100 points per team per zone per season. Captures player-level quality that Elo misses.
  • Blend — Weighted combination: rating = 0.6 * elo + 0.4 * (slope * pav). The calibration slope (6.986) converts PAV into Elo-equivalent units.

The engine is pure functions with no I/O. The CLI fetches all data from the Cloudflare D1 REST API (the former thin Worker was retired in v3.2) and passes pre-fetched data to the engine.

Current model (v3)

Model:  predha-080
Type:   MOV-Elo + PAV (corrected defence formula) + prediction-side home advantage

Parameters:
  K-factor:                     25
  Update home advantage:        160 Elo points (shapes Elo's expected result)
  Prediction home advantage:    80 rating points = 5.6 scoreboard points
  Regression to mean:           0.10
  MOV multiplier:               538_log
  Sigma:                        36
  Blend weight (Elo):           0.6
  PAV cal. slope:               6.986

Performance (2021-2025, 1062 matches):
  Tip%:      68.1%  (716/1062)
  LogLoss:   0.8485
  MAE:       26.31

Out-of-sample (2026, R1-R14, 116 matches):
  Tip%:      73.3%  (85/116)
  LogLoss:   0.7893

The defining feature of v3 (docs/task-20-prediction-home-advantage.md) is that home advantage finally enters predictions: prior HA tuning only shaped Elo's update sizes, leaving a +5.6 pt/match systematic bias against home teams in the predicted margin. The 80-point fix is derived from the measured bias, not fitted, and the out-of-sample improvement (−0.04 LogLoss vs v2) exceeded the in-sample one — the opposite of an overfit signature.

See docs/ for the full research ledger (Tasks 1–37). Weekly comp monitoring vs the Squiggle field lives at analysis/weekly-monitor.py.

Contributing

This is personal tooling targeting Jack McPherson's entry in the 2027 Squiggle model competition. The CLI is published to npm so the maintainer can install it on new machines, not as an invitation to contribute — it requires a private Cloudflare D1 database populated with the afl-stats schema and won't work against anyone else's data.

External issues and pull requests are out of scope. If you're curious about the modelling, the full research ledger and the rationale behind every accepted/rejected experiment lives in docs/task-*.md; the running open-items list lives in HANDOFF.md.