brewlog/scripts/bootstrap-db.sh
Jon Seager 0090c4ba43
refactor(cli): restructure commands from flat to nested subcommands
Change CLI structure from `brewlog {verb}-{entity}` to `brewlog {entity} {verb}`:
- brewlog add-roaster → brewlog roaster add
- brewlog list-bags → brewlog bag list
- brewlog create-token → brewlog token create
- etc.

Each entity module now owns its subcommand enum and dispatch logic,
simplifying main.rs and improving discoverability via `brewlog {entity} --help`.

- Add RoasterCommands, RoastCommands, BagCommands, GearCommands, TokenCommands enums
- Add run() dispatcher to each entity module
- Simplify top-level Commands enum to delegate to entity modules
- Update all CLI tests and bootstrap script
2026-02-02 17:02:46 +00:00

556 lines
No EOL
19 KiB
Bash
Executable file
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env bash
set -euo pipefail
cargo build
BREWLOG_TOKEN="$(./target/debug/brewlog token create --name "bootstrap-token" --username admin --password password | grep -Po "BREWLOG_TOKEN=\K.+$")"
export BREWLOG_TOKEN
if [[ -z "$BREWLOG_TOKEN" ]]; then
echo "Error: BREWLOG_TOKEN environment variable is not set."
exit 1
fi
# Tim Wendelboe (Norway)
./target/debug/brewlog roaster add \
--name "Tim Wendelboe" \
--country "Norway" \
--city "Oslo" \
--homepage "https://timwendelboe.no" \
--notes "World-renowned Nordic micro-roastery dedicated to clarity and sustainability."
./target/debug/brewlog roast add \
--roaster-id "$(./target/debug/brewlog roaster list | jq -r '.[] | select(.name=="Tim Wendelboe") | .id')" \
--name "Ben Saïd Natural" \
--origin "Ethiopia" \
--region "Sidamo" \
--producer "Ben Saïd" \
--process "Natural" \
--tasting-notes "Bergamot, Apricot, Floral"
./target/debug/brewlog roast add \
--roaster-id "$(./target/debug/brewlog roaster list | jq -r '.[] | select(.name=="Tim Wendelboe") | .id')" \
--name "Finca Tamana Washed" \
--origin "Colombia" \
--region "El Pital, Huila" \
--producer "Elias Roa" \
--process "Washed" \
--tasting-notes "Red Apple, Vanilla, Caramel"
# Coffee Collective (Denmark)
./target/debug/brewlog roaster add \
--name "Coffee Collective" \
--country "Denmark" \
--city "Copenhagen" \
--homepage "https://coffeecollective.dk" \
--notes "Pioneers of transparency and sustainability; multi-time Nordic roaster award winners."
./target/debug/brewlog roast add \
--roaster-id "$(./target/debug/brewlog roaster list | jq -r '.[] | select(.name=="Coffee Collective") | .id')" \
--name "Daterra Sweet Collection" \
--origin "Brazil" \
--region "Cerrado" \
--producer "Daterra" \
--process "Pulped Natural" \
--tasting-notes "Hazelnut, Milk Chocolate, Yellow Fruit"
./target/debug/brewlog roast add \
--roaster-id "$(./target/debug/brewlog roaster list | jq -r '.[] | select(.name=="Coffee Collective") | .id')" \
--name "Kieni" \
--origin "Kenya" \
--region "Nyeri" \
--producer "Kieni Factory" \
--process "Washed" \
--tasting-notes "Currant, Black Tea, Grape"
# Drop Coffee (Sweden)
./target/debug/brewlog roaster add \
--name "Drop Coffee" \
--country "Sweden" \
--city "Stockholm" \
--homepage "https://dropcoffee.com" \
--notes "Award-winning Swedish roastery prized for its elegance and clean Scandinavian style."
./target/debug/brewlog roast add \
--roaster-id "$(./target/debug/brewlog roaster list | jq -r '.[] | select(.name=="Drop Coffee") | .id')" \
--name "La Linda" \
--origin "Bolivia" \
--region "Caranavi" \
--producer "Pedro Rodriguez" \
--process "Washed" \
--tasting-notes "Red Apple, Caramel, Floral"
./target/debug/brewlog roast add \
--roaster-id "$(./target/debug/brewlog roaster list | jq -r '.[] | select(.name=="Drop Coffee") | .id')" \
--name "El Sunzita" \
--origin "El Salvador" \
--region "Ahuachapan" \
--producer "Jorge Raul Rivera" \
--process "Natural" \
--tasting-notes "Strawberry, Mango, Dark Chocolate"
# La Cabra (Denmark)
./target/debug/brewlog roaster add \
--name "La Cabra" \
--country "Denmark" \
--city "Aarhus" \
--homepage "https://www.lacabra.dk" \
--notes "Scandinavian minimalist roastery known for clarity and innovative sourcing."
./target/debug/brewlog roast add \
--roaster-id "$(./target/debug/brewlog roaster list | jq -r '.[] | select(.name=="La Cabra") | .id')" \
--name "Halo Beriti" \
--origin "Ethiopia" \
--region "Yirgacheffe" \
--producer "Halo Beriti Cooperative" \
--process "Washed" \
--tasting-notes "Jasmine, Lemon, Stone Fruit"
./target/debug/brewlog roast add \
--roaster-id "$(./target/debug/brewlog roaster list | jq -r '.[] | select(.name=="La Cabra") | .id')" \
--name "Cerro Azul" \
--origin "Colombia" \
--region "Valle del Cauca" \
--producer "Granja La Esperanza" \
--process "Washed" \
--tasting-notes "Blueberry, Plum, Grapefruit"
# April Coffee (Denmark)
./target/debug/brewlog roaster add \
--name "April Coffee" \
--country "Denmark" \
--city "Copenhagen" \
--homepage "https://aprilcoffeeroasters.com" \
--notes "Modern approach to Nordic coffee, emphasizing transparency and traceability."
./target/debug/brewlog roast add \
--roaster-id "$(./target/debug/brewlog roaster list | jq -r '.[] | select(.name=="April Coffee") | .id')" \
--name "El Salvador Pacamara" \
--origin "El Salvador" \
--region "Santa Ana" \
--producer "Ernesto Menendez" \
--process "Honey" \
--tasting-notes "Grapefruit, Sugar Cane, Plum"
./target/debug/brewlog roast add \
--roaster-id "$(./target/debug/brewlog roaster list | jq -r '.[] | select(.name=="April Coffee") | .id')" \
--name "Guji Highland" \
--origin "Ethiopia" \
--region "Guji" \
--producer "Andualem Abebe" \
--process "Natural" \
--tasting-notes "Peach, Strawberry, Cream"
# Assembly Coffee (UK)
./target/debug/brewlog roaster add \
--name "Assembly Coffee" \
--country "UK" \
--city "London" \
--homepage "https://assemblycoffee.co.uk" \
--notes "Based in Brixton, Assembly focuses on collaborative sourcing and education."
./target/debug/brewlog roast add \
--roaster-id "$(./target/debug/brewlog roaster list | jq -r '.[] | select(.name=="Assembly Coffee") | .id')" \
--name "Kochere" \
--origin "Ethiopia" \
--region "Yirgacheffe" \
--producer "Kochere Region Growers" \
--process "Washed" \
--tasting-notes "Peach, Lemon, Jasmine"
./target/debug/brewlog roast add \
--roaster-id "$(./target/debug/brewlog roaster list | jq -r '.[] | select(.name=="Assembly Coffee") | .id')" \
--name "La Laja" \
--origin "Mexico" \
--region "Veracruz" \
--producer "La Laja Estate" \
--process "Natural" \
--tasting-notes "Cherry, Milk Chocolate, Praline"
# Square Mile (UK)
./target/debug/brewlog roaster add \
--name "Square Mile Coffee" \
--country "UK" \
--city "London" \
--homepage "https://squaremilecoffee.com" \
--notes "One of London's pioneers; delivers balanced and clear, fruit-forward coffees."
./target/debug/brewlog roast add \
--roaster-id "$(./target/debug/brewlog roaster list | jq -r '.[] | select(.name=="Square Mile Coffee") | .id')" \
--name "Red Brick Espresso" \
--origin "Blend" \
--region "Multiple Origins" \
--producer "Various" \
--process "Washed, Natural" \
--tasting-notes "Berry, Chocolate, Citrus"
./target/debug/brewlog roast add \
--roaster-id "$(./target/debug/brewlog roaster list | jq -r '.[] | select(.name=="Square Mile Coffee") | .id')" \
--name "Kamwangi" \
--origin "Kenya" \
--region "Kirinyaga" \
--producer "Kamwangi Factory" \
--process "Washed" \
--tasting-notes "Blackcurrant, Rhubarb, Blood Orange"
# Dak Coffee Roasters (Netherlands)
./target/debug/brewlog roaster add \
--name "Dak Coffee Roasters" \
--country "Netherlands" \
--city "Amsterdam" \
--homepage "https://www.dakcoffeeroasters.com" \
--notes "Highly experimental Dutch roastery; celebrates vibrant acidity and alternative processing."
./target/debug/brewlog roast add \
--roaster-id "$(./target/debug/brewlog roaster list | jq -r '.[] | select(.name=="Dak Coffee Roasters") | .id')" \
--name "El Paraiso 92 Anaerobic" \
--origin "Colombia" \
--region "Cauca" \
--producer "Diego Bermudez" \
--process "Thermal Shock Anaerobic" \
--tasting-notes "Passionfruit, Raspberry, Yogurt"
./target/debug/brewlog roast add \
--roaster-id "$(./target/debug/brewlog roaster list | jq -r '.[] | select(.name=="Dak Coffee Roasters") | .id')" \
--name "Oreti SL28" \
--origin "Kenya" \
--region "Kirinyaga" \
--producer "Oreti Estate" \
--process "Washed" \
--tasting-notes "Grapefruit, Blackcurrant, Plum"
# Bonanza Coffee (Germany)
./target/debug/brewlog roaster add \
--name "Bonanza Coffee" \
--country "Germany" \
--city "Berlin" \
--homepage "https://www.bonanzacoffee.de" \
--notes "Pioneering Berlin roastery focused on brightness, balance, and freshness."
./target/debug/brewlog roast add \
--roaster-id "$(./target/debug/brewlog roaster list | jq -r '.[] | select(.name=="Bonanza Coffee") | .id')" \
--name "Gatomboya" \
--origin "Kenya" \
--region "Nyeri" \
--producer "Gatomboya Cooperative" \
--process "Washed" \
--tasting-notes "Blackcurrant, Lime, Tomato"
./target/debug/brewlog roast add \
--roaster-id "$(./target/debug/brewlog roaster list | jq -r '.[] | select(.name=="Bonanza Coffee") | .id')" \
--name "Los Pirineos" \
--origin "El Salvador" \
--region "Usulután" \
--producer "Gilberto Baraona" \
--process "Honey" \
--tasting-notes "Maple, Fudge, Green Apple"
# Friedhats (Netherlands)
./target/debug/brewlog roaster add \
--name "Friedhats" \
--country "Netherlands" \
--city "Amsterdam" \
--homepage "https://friedhats.com" \
--notes "Quirky branding meets serious, awarded, fruit-forward coffees from Amsterdam."
./target/debug/brewlog roast add \
--roaster-id "$(./target/debug/brewlog roaster list | jq -r '.[] | select(.name=="Friedhats") | .id')" \
--name "Sidamo Guji" \
--origin "Ethiopia" \
--region "Guji" \
--producer "Smallholders" \
--process "Natural" \
--tasting-notes "Peach, Raspberry, Rosehip"
./target/debug/brewlog roast add \
--roaster-id "$(./target/debug/brewlog roaster list | jq -r '.[] | select(.name=="Friedhats") | .id')" \
--name "La Esmeralda Geisha" \
--origin "Panama" \
--region "Boquete" \
--producer "Hacienda La Esmeralda" \
--process "Washed" \
--tasting-notes "Jasmine, Bergamot, Papaya"
# Origin Coffee (UK)
./target/debug/brewlog roaster add \
--name "Origin Coffee" \
--country "UK" \
--city "Porthleven" \
--homepage "https://origincoffee.co.uk" \
--notes "Specialty roaster with close partnerships at origin; leading UK scene with cutting-edge lots."
./target/debug/brewlog roast add \
--roaster-id "$(./target/debug/brewlog roaster list | jq -r '.[] | select(.name=="Origin Coffee") | .id')" \
--name "San Fermin" \
--origin "Colombia" \
--region "Tolima" \
--producer "San Fermin Smallholders" \
--process "Washed" \
--tasting-notes "Red Grape, Caramel, Blood Orange"
./target/debug/brewlog roast add \
--roaster-id "$(./target/debug/brewlog roaster list | jq -r '.[] | select(.name=="Origin Coffee") | .id')" \
--name "Aricha" \
--origin "Ethiopia" \
--region "Yirgacheffe" \
--producer "Aricha Washing Station" \
--process "Washed" \
--tasting-notes "Honey, Peach, Black Tea"
# Dark Arts Coffee (UK)
./target/debug/brewlog roaster add \
--name "Dark Arts Coffee" \
--country "UK" \
--city "London" \
--homepage "https://www.darkartscoffee.co.uk" \
--notes "Playful, disruptive roaster with a cult following and flavor-forward offerings."
./target/debug/brewlog roast add \
--roaster-id "$(./target/debug/brewlog roaster list | jq -r '.[] | select(.name=="Dark Arts Coffee") | .id')" \
--name "Death to Decaf" \
--origin "Brazil" \
--region "Minas Gerais" \
--producer "Carmo de Minas" \
--process "Swiss Water Decaf" \
--tasting-notes "Cocoa, Cherry, Almond"
./target/debug/brewlog roast add \
--roaster-id "$(./target/debug/brewlog roaster list | jq -r '.[] | select(.name=="Dark Arts Coffee") | .id')" \
--name "Snoop" \
--origin "Guatemala" \
--region "Huehuetenango" \
--producer "Various Smallholders" \
--process "Washed" \
--tasting-notes "Toffee, Green Apple, Plum"
# KAWA Coffee (France)
./target/debug/brewlog roaster add \
--name "KAWA Coffee" \
--country "France" \
--city "Paris" \
--homepage "https://www.kawa.coffee" \
--notes "One of Paris most exciting specialty roasteries, known for unusual and competition-level lots."
./target/debug/brewlog roast add \
--roaster-id "$(./target/debug/brewlog roaster list | jq -r '.[] | select(.name=="KAWA Coffee") | .id')" \
--name "Sudan Rume" \
--origin "Colombia" \
--region "Cauca" \
--producer "Granja La Esperanza" \
--process "Natural" \
--tasting-notes "Strawberry, Cinnamon, Grape"
./target/debug/brewlog roast add \
--roaster-id "$(./target/debug/brewlog roaster list | jq -r '.[] | select(.name=="KAWA Coffee") | .id')" \
--name "Arbegona" \
--origin "Ethiopia" \
--region "Sidama" \
--producer "Arbegona Washing Station" \
--process "Washed" \
--tasting-notes "Violet, Apricot, Lemon"
# Stow Coffee (Slovenia)
./target/debug/brewlog roaster add \
--name "Stow Coffee" \
--country "Slovenia" \
--city "Ljubljana" \
--homepage "https://www.stowcoffee.com" \
--notes "Slovenias specialty leader, awarded for pure, brightly acidic profiles and innovation."
./target/debug/brewlog roast add \
--roaster-id "$(./target/debug/brewlog roaster list | jq -r '.[] | select(.name=="Stow Coffee") | .id')" \
--name "Santa Barbara" \
--origin "Honduras" \
--region "Santa Barbara" \
--producer "Benjamin Paz" \
--process "Honey" \
--tasting-notes "Red Currant, Honeydew, Cocoa"
./target/debug/brewlog roast add \
--roaster-id "$(./target/debug/brewlog roaster list | jq -r '.[] | select(.name=="Stow Coffee") | .id')" \
--name "Suke Quto" \
--origin "Ethiopia" \
--region "Guji" \
--producer "Tesfaye Bekele" \
--process "Natural" \
--tasting-notes "Blackberry, Vanilla, Jasmine"
# Bows Coffee (Canada)
./target/debug/brewlog roaster add \
--name "Bows Coffee" \
--country "Canada" \
--city "Victoria" \
--homepage "https://bowscoffee.com" \
--notes "Canadian micro-roaster with focus on clarity, complexity, and ethical sourcing."
./target/debug/brewlog roast add \
--roaster-id "$(./target/debug/brewlog roaster list | jq -r '.[] | select(.name=="Bows Coffee") | .id')" \
--name "La Chumeca" \
--origin "Costa Rica" \
--region "Tarrazú" \
--producer "Doña Olga Jiménez" \
--process "White Honey" \
--tasting-notes "Mandarin, Honeycomb, Almond"
./target/debug/brewlog roast add \
--roaster-id "$(./target/debug/brewlog roaster list | jq -r '.[] | select(.name=="Bows Coffee") | .id')" \
--name "Simbi" \
--origin "Rwanda" \
--region "Huye" \
--producer "Simbi Co-op" \
--process "Washed" \
--tasting-notes "Black Tea, Orange, Cane Sugar"
# ============================================================================
# Bags - Various bags from different roasters with amounts ranging 100g-500g
# ============================================================================
# Tim Wendelboe - Ben Saïd Natural (250g)
./target/debug/brewlog bag add \
--roast-id "$(./target/debug/brewlog roast list | jq -r '.[] | select(.name=="Ben Saïd Natural") | .id')" \
--roast-date "2026-01-15" \
--amount 250
# Tim Wendelboe - Finca Tamana Washed (350g)
./target/debug/brewlog bag add \
--roast-id "$(./target/debug/brewlog roast list | jq -r '.[] | select(.name=="Finca Tamana Washed") | .id')" \
--roast-date "2026-01-18" \
--amount 350
# Coffee Collective - Daterra Sweet Collection (200g)
./target/debug/brewlog bag add \
--roast-id "$(./target/debug/brewlog roast list | jq -r '.[] | select(.name=="Daterra Sweet Collection") | .id')" \
--roast-date "2026-01-10" \
--amount 200
# Drop Coffee - La Linda (500g)
./target/debug/brewlog bag add \
--roast-id "$(./target/debug/brewlog roast list | jq -r '.[] | select(.name=="La Linda") | .id')" \
--roast-date "2026-01-20" \
--amount 500
# La Cabra - Halo Beriti (150g)
./target/debug/brewlog bag add \
--roast-id "$(./target/debug/brewlog roast list | jq -r '.[] | select(.name=="Halo Beriti") | .id')" \
--roast-date "2026-01-12" \
--amount 150
# April Coffee - Guji Highland (300g)
./target/debug/brewlog bag add \
--roast-id "$(./target/debug/brewlog roast list | jq -r '.[] | select(.name=="Guji Highland") | .id')" \
--roast-date "2026-01-22" \
--amount 300
# Assembly Coffee - Kochere (250g)
./target/debug/brewlog bag add \
--roast-id "$(./target/debug/brewlog roast list | jq -r '.[] | select(.name=="Kochere") | .id')" \
--roast-date "2026-01-08" \
--amount 250
# Square Mile Coffee - Red Brick Espresso (400g)
./target/debug/brewlog bag add \
--roast-id "$(./target/debug/brewlog roast list | jq -r '.[] | select(.name=="Red Brick Espresso") | .id')" \
--roast-date "2026-01-25" \
--amount 400
# Dak Coffee Roasters - El Paraiso 92 Anaerobic (100g - small competition lot)
./target/debug/brewlog bag add \
--roast-id "$(./target/debug/brewlog roast list | jq -r '.[] | select(.name=="El Paraiso 92 Anaerobic") | .id')" \
--roast-date "2026-01-28" \
--amount 100
# Bonanza Coffee - Gatomboya (175g)
./target/debug/brewlog bag add \
--roast-id "$(./target/debug/brewlog roast list | jq -r '.[] | select(.name=="Gatomboya") | .id')" \
--roast-date "2026-01-05" \
--amount 175
# Stow Coffee - Suke Quto (225g)
./target/debug/brewlog bag add \
--roast-id "$(./target/debug/brewlog roast list | jq -r '.[] | select(.name=="Suke Quto") | .id')" \
--roast-date "2026-01-30" \
--amount 225
# Bows Coffee - Simbi (450g)
./target/debug/brewlog bag add \
--roast-id "$(./target/debug/brewlog roast list | jq -r '.[] | select(.name=="Simbi") | .id')" \
--roast-date "2026-01-14" \
--amount 450
# ============================================================================
# Finished Bags - Mark 4 older bags as finished
# ============================================================================
# Finish Gatomboya bag (oldest - Jan 5)
./target/debug/brewlog bag update \
--id "$(./target/debug/brewlog bag list | jq -r '.[] | select(.roast_name=="Gatomboya") | .id')" \
--closed true \
--finished-at "2026-01-20"
# Finish Kochere bag (Jan 8)
./target/debug/brewlog bag update \
--id "$(./target/debug/brewlog bag list | jq -r '.[] | select(.roast_name=="Kochere") | .id')" \
--closed true \
--finished-at "2026-01-22"
# Finish Daterra Sweet Collection bag (Jan 10)
./target/debug/brewlog bag update \
--id "$(./target/debug/brewlog bag list | jq -r '.[] | select(.roast_name=="Daterra Sweet Collection") | .id')" \
--closed true \
--finished-at "2026-01-25"
# Finish Halo Beriti bag (Jan 12)
./target/debug/brewlog bag update \
--id "$(./target/debug/brewlog bag list | jq -r '.[] | select(.roast_name=="Halo Beriti") | .id')" \
--closed true \
--finished-at "2026-01-28"
# ============================================================================
# Gear - 2 grinders and 3 brewers
# ============================================================================
# Grinders
./target/debug/brewlog gear add \
--category "grinder" \
--make "Comandante" \
--model "C40 MK4"
./target/debug/brewlog gear add \
--category "grinder" \
--make "1Zpresso" \
--model "J-Max"
# Brewers
./target/debug/brewlog gear add \
--category "brewer" \
--make "Hario" \
--model "V60 02"
./target/debug/brewlog gear add \
--category "brewer" \
--make "AeroPress" \
--model "Original"
./target/debug/brewlog gear add \
--category "brewer" \
--make "Fellow" \
--model "Stagg XF"
echo
echo "Bootstrapped database"
echo
echo "Set token $BREWLOG_TOKEN to use the data added here."