Monorepo for Aesthetic.Computer
aesthetic.computer
1#!/bin/bash
2# build-name.sh — Generate a unique build name for each build.
3# Uses git hash for adj+animal, plus epoch seconds for uniqueness.
4# Every invocation produces a different name, even for the same commit.
5# Usage: ./build-name.sh → prints name (e.g., "swift-otter-7a3")
6set -e
7
8# 365 animals
9ANIMALS=(
10 # Mammals (60)
11 otter fox wolf bear lynx puma deer hare mink vole
12 stoat badger ferret weasel moose bison yak ibex oryx kudu
13 okapi tapir sloth koala lemur loris gibbon chimp bonobo mandrill
14 ocelot serval caracal margay civet genet mongoose meerkat numbat quoll
15 dingo jackal coyote fennec arctic pangolin aardvark echidna platypus wombat
16 possum wallaby quokka bandicoot bilby dugong manatee narwhal beluga orca
17 # Birds (60)
18 hawk eagle falcon kite osprey owl heron crane stork ibis
19 egret rail coot loon grebe diver petrel shear gannet booby
20 tern skua gull puffin murre auk razorbill fulmar albatross condor
21 vulture kestrel merlin hobby harrier buzzard sparrow finch wren robin
22 thrush pipit wagtail dipper warbler flicker nuthatch creeper swift martin
23 swallow nightjar kingfisher roller bee-eater hoopoe hornbill toucan parrot macaw
24 # Reptiles & Amphibians (40)
25 gecko lizard skink iguana chameleon monitor tegu cobra mamba adder
26 viper python anaconda rattler copperhead racer kingsnake milksnake garter coral
27 tortoise turtle terrapin croc gator caiman gharial newt salamander axolotl
28 treefrog bullfrog poison dart glass mantella reed toad midwife spadefoot
29 # Fish & Marine (40)
30 trout salmon char pike perch bass walleye sturgeon paddlefish gar
31 bowfin shad herring anchovy sardine mackerel tuna marlin sailfish swordfish
32 barracuda grouper snapper wrasse goby blenny sculpin flounder sole halibut
33 ray skate shark hammerhead mako thresher whale catfish carp loach
34 # Invertebrates (40)
35 crab lobster shrimp prawn krill squid octopus nautilus cuttlefish clam
36 mussel oyster scallop conch whelk slug snail leech worm centipede
37 millipede scorpion spider beetle ant wasp hornet moth butterfly dragonfly
38 damsel cricket katydid mantis stick leaf cicada firefly ladybug weevil
39 # Mythical (30)
40 dragon phoenix griffin sphinx hydra chimera minotaur centaur pegasus unicorn
41 kraken leviathan basilisk wyvern roc thunderbird yeti sasquatch wendigo golem
42 djinn nymph sprite pixie sylph dryad selkie kelpie banshee wraith
43 # Dinosaurs (30)
44 raptor rex bronto stego trike ankylo ptero diplo allo spino
45 carno bary dilo parasaur iguano hadro pachycephalo theri oviraptor archaeo
46 compy gallimimus deinonych utahraptor micro giganoto acro sucho cerato maia
47 # Space (30)
48 pulsar quasar nebula nova comet meteor asteroid aurora corona flare
49 vortex prism zenith apex orbit lunar solar stellar cosmic photon
50 neutron proton quantum flux ion plasma ember cinder spark blaze
51 # Nature (35)
52 river brook creek delta marsh fjord glacier canyon mesa butte
53 ridge summit caldera geyser lagoon atoll reef tide current drift
54 breeze gale storm tempest zephyr monsoon aurora borealis solstice equinox
55 tundra steppe prairie savanna taiga
56)
57
58# 200 adjectives
59ADJECTIVES=(
60 swift bold keen sharp bright vivid lucid agile nimble deft
61 brave calm clear crisp eager fierce gentle grand hardy jolly
62 lively merry noble proud quick quiet rapid sleek smooth snappy
63 steady sturdy subtle supple tender tough vital warm witty zesty
64 amber ashen azure blaze bronze cedar coral crimson dusk ember
65 flint frost golden hazel indigo ivory jade khaki lemon lilac
66 maple mossy navy opal pearl plum quartz russet sage scarlet
67 silver slate tawny umber velvet walnut zinc cobalt copper flax
68 dusty foggy hazy misty polar rustic stormy sunlit twilit wintry
69 ancient arcane astral cosmic cryptic digital feral hollow lunar mystic
70 neural orbital primal radiant sacred silent spectral temporal verdant woven
71 atomic binary cubic delta fractal harmonic infinite kinetic lattice modular
72 native oxide quantum reflex sonic turbo ultra vector wavelength xeric
73 ablaze acoustic alpine boreal carbon ceramic crystal dynamic elastic frozen
74 galactic hybrid igneous magnetic mineral organic prismatic resonant seismic thermal
75 alloy basalt chalk flint granite jasper marble obsidian pumice quartz
76 sandstone shale slate soapstone travertine basaltic chalky flinty granitic jaspery
77 lustrous matte opaque pearly polished rough satin silky textured uncut
78 aerial aquatic benthic coastal estuarine glacial insular littoral pelagic riparian
79 alpine arid boreal humid polar steppe sylvan tropic tundral volcanic
80)
81
82NUM_ANIMALS=${#ANIMALS[@]}
83NUM_ADJ=${#ADJECTIVES[@]}
84
85# Mix git hash + epoch + nanoseconds for a unique name every build
86GIT_HASH=$(git rev-parse HEAD 2>/dev/null || echo "0000000000000000000000000000000000000000")
87EPOCH=$(date +%s)
88NANO=$(date +%N 2>/dev/null || echo 0)
89
90# Adjective from git hash, animal from epoch (so same commit gets different animals)
91HEX_ADJ="${GIT_HASH:0:8}"
92DEC_ADJ=$(printf '%d' "0x${HEX_ADJ}" 2>/dev/null || echo 0)
93ADJ_IDX=$(( DEC_ADJ % NUM_ADJ ))
94# Mix epoch + first 4 hex of git hash into the animal index so the same
95# epoch-second but different commits still pick different animals.
96HEX_ANIMAL="${GIT_HASH:8:4}"
97DEC_ANIMAL=$(printf '%d' "0x${HEX_ANIMAL}" 2>/dev/null || echo 0)
98ANIMAL_IDX=$(( (EPOCH + DEC_ANIMAL) % NUM_ANIMALS ))
99
100# 3-char suffix to prevent name collisions across rebuilds of the same
101# commit or near-simultaneous builds. Combine last 3 digits of nanoseconds
102# with first 3 hex chars of git hash for a 5-char base-36 stamp.
103HEX_SUFFIX="${GIT_HASH:12:3}"
104NANO_TAIL="${NANO: -3}"
105# Compose into a 3-char base-36 suffix
106SUFFIX_NUM=$(( (0x${HEX_SUFFIX} + 10#${NANO_TAIL}) % 46656 )) # 36^3
107SUFFIX=$(printf '%03x' "$SUFFIX_NUM")
108
109echo "${ADJECTIVES[$ADJ_IDX]}-${ANIMALS[$ANIMAL_IDX]}-${SUFFIX}"