A Bridge hand evaluator + bidding advisor in Astro
  • JavaScript 56.6%
  • Astro 25.8%
  • TypeScript 11.7%
  • Python 3.2%
  • CSS 2.7%
Find a file
Dave Benvenuti 95e9976c68 feat: add collapsible Higher Bids toggle for bid levels 3-7
- 'Higher Bids ▸' button between 2NT row and X/XX/Undo/Reset
- Toggle reveals 5 rows: 3♣-3NT through 7♣-7NT
- Same suit coloring as existing buttons
- Collapses back when clicked again
2026-06-07 17:57:23 -07:00
.pi feat: phase-based rule matching with template bid resolution 2026-06-07 16:42:55 -07:00
docs feat: initial scaffold — Astro static site with SAYC bidding rules in YAML 2026-06-06 10:56:08 -07:00
plans feat: initial scaffold — Astro static site with SAYC bidding rules in YAML 2026-06-06 10:56:08 -07:00
public feat: initial scaffold — Astro static site with SAYC bidding rules in YAML 2026-06-06 10:56:08 -07:00
rules feat: phase-based rule matching with template bid resolution 2026-06-07 16:42:55 -07:00
scripts feat: phase-based rule matching with template bid resolution 2026-06-07 16:42:55 -07:00
src feat: add collapsible Higher Bids toggle for bid levels 3-7 2026-06-07 17:57:23 -07:00
tests feat: phase-based rule matching with template bid resolution 2026-06-07 16:42:55 -07:00
.env.example feat: add Cloudflare Pages deployment support 2026-06-06 16:54:06 -07:00
.gitignore feat: add Cloudflare Pages deployment support 2026-06-06 16:54:06 -07:00
astro.config.mjs chore: make dev server listen on 0.0.0.0 2026-06-06 11:12:10 -07:00
package-lock.json feat: comprehensive unit tests with AGENTS.md coverage policy 2026-06-06 23:12:37 -07:00
package.json feat: comprehensive unit tests with AGENTS.md coverage policy 2026-06-06 23:12:37 -07:00
progress.md feat: initial scaffold — Astro static site with SAYC bidding rules in YAML 2026-06-06 10:56:08 -07:00
README.md feat: add Cloudflare Pages deployment support 2026-06-06 16:54:06 -07:00
TODO.md feat: add collapsible Higher Bids toggle for bid levels 3-7 2026-06-07 17:57:23 -07:00
tsconfig.json feat: initial scaffold — Astro static site with SAYC bidding rules in YAML 2026-06-06 10:56:08 -07:00
vitest.config.ts feat: comprehensive unit tests with AGENTS.md coverage policy 2026-06-06 23:12:37 -07:00
wrangler.toml feat: add Cloudflare Pages deployment support 2026-06-06 16:54:06 -07:00

Bridge Bidding Reference

A static web application for learning and consulting Standard American Yellow Card (SAYC) contract bridge bidding rules. Built with Astro.

Build a hand, see instant evaluation (HCP, length, distribution, shape), then step through a full bidding auction with real-time rule-based suggestions.

Quick Start

npm install
npm run dev       # http://0.0.0.0:4321
npm run build     # static output → dist/
npm run preview   # preview the built site

Project Structure

bridge/
├── docs/
│   ├── bridge_cheat_sheet.md     # Source SAYC rules (plain text)
│   └── schema.yaml               # YAML schema for rule encoding
├── plans/architecture.md         # Full architecture document
├── rules/                        # 15 YAML rule files (one per topic)
├── src/
│   ├── components/
│   │   ├── CombinedAdvisor.astro # Main page: hand evaluator + bidding advisor
│   │   ├── hand-evaluator/       # Card selector UI + point calculation
│   │   └── bidding-advisor/      # Auction tracker + rule matching engine
│   ├── data/index.ts             # Build-time YAML loader
│   ├── types/rules.ts            # TypeScript type definitions
│   ├── layouts/BaseLayout.astro  # Page shell with nav
│   ├── pages/
│   │   ├── index.astro           # Home page (unified advisor)
│   │   └── rules.astro           # Rule browser
│   └── styles/global.css
├── wrangler.toml                 # Cloudflare Pages config
├── astro.config.mjs
├── tsconfig.json
└── package.json

Pages

Page Route Status
Home (unified advisor) / Live — card selector, hand evaluation, auction tracking, live bid suggestions
Rule Browser /rules 🚧 Placeholder — needs search/filter

Deploying to Cloudflare Pages

The site is fully static and deploys to Cloudflare Pages in one command.

Prerequisites

  1. A Cloudflare account

  2. Run npm installwrangler is included as a dev dependency

  3. A Cloudflare API token with the following permissions:

    Permission Scope Reason
    Cloudflare Pages — Edit Account Create and update the Pages project
    Account — Account Settings — Read Account Required to look up your account

    How to create the token:

    1. Go to https://dash.cloudflare.com/profile/api-tokens
    2. Click Create TokenCreate Custom Token
    3. Name it (e.g. "bridge-pages-deploy")
    4. Under Permissions, add both permissions from the table above at the Account level
    5. Create the token and copy it — you'll only see it once

Deploy

# Set your API token
export CLOUDFLARE_API_TOKEN=your_token_here

# Build and deploy
npm run deploy

Or create a .dev.vars file (gitignored) to avoid exporting every time:

CLOUDFLARE_API_TOKEN=your_token_here

The first deploy will prompt you to name the project (or it uses bridge-bidding-reference from wrangler.toml). Subsequent deploys update the existing project.

Deployment URL

After the first deploy, Cloudflare assigns a URL like: https://bridge-bidding-reference.pages.dev

You can add a custom domain in the Cloudflare dashboard under Workers & Pages → your project → Custom domains.

YAML Rules

All bidding rules live in rules/ as plain YAML files. Each rule has a unique ID, conditions (HCP range, suit lengths, hand shape, partner/opponent bids, position, vulnerability), an action (the recommended call), and a priority for disambiguation.

The schema is documented in docs/schema.yaml with corresponding TypeScript types in src/types/rules.ts.

Dev Server

The dev server listens on 0.0.0.0 (all network interfaces) by default for easy access from other devices on your local network.

License

ISC