- JavaScript 56.6%
- Astro 25.8%
- TypeScript 11.7%
- Python 3.2%
- CSS 2.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 |
||
|---|---|---|
| .pi | ||
| docs | ||
| plans | ||
| public | ||
| rules | ||
| scripts | ||
| src | ||
| tests | ||
| .env.example | ||
| .gitignore | ||
| astro.config.mjs | ||
| package-lock.json | ||
| package.json | ||
| progress.md | ||
| README.md | ||
| TODO.md | ||
| tsconfig.json | ||
| vitest.config.ts | ||
| wrangler.toml | ||
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
-
Run
npm install—wrangleris included as a dev dependency -
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:
- Go to https://dash.cloudflare.com/profile/api-tokens
- Click Create Token → Create Custom Token
- Name it (e.g. "bridge-pages-deploy")
- Under Permissions, add both permissions from the table above at the Account level
- 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