Add core engine: tarot + astrology reading generator with CLI and i18n

Plain-C, dependency-free engine that produces a personalized daily
Celtic Cross tarot spread and natal-chart/transit astrology reading,
plus a standalone CLI (dist/deck-engine) and run.sh wrapper. Includes
English/German output via a simple key=value translation format, and
docs/diagrams describing the architecture and I/O.
This commit is contained in:
ml
2026-07-04 06:49:18 +02:00
commit a93e5d4cdc
60 changed files with 17134 additions and 0 deletions
+80
View File
@@ -0,0 +1,80 @@
#!/bin/sh
# Runs deck-engine for "today": the tarot seed and the transit moment come
# from the OS clock, birth data comes from user.properties next to this
# script. Usage: ./run.sh [text|html] [lang]
#
# [lang] overrides user.properties' lang= for this run only (e.g.
# ./run.sh html de); omit it to use lang= from user.properties, which
# itself defaults to "en" if unset.
set -eu
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
BINARY="$SCRIPT_DIR/deck-engine"
PROPERTIES_FILE="$SCRIPT_DIR/user.properties"
if [ ! -x "$BINARY" ]; then
echo "error: $BINARY not found or not executable (run 'make' in engine/ first)" >&2
exit 1
fi
if [ ! -f "$PROPERTIES_FILE" ]; then
echo "error: $PROPERTIES_FILE not found" >&2
exit 1
fi
birth_date=""
birth_time=""
birth_utc_offset=""
birth_lat=""
birth_lon=""
lang="en"
while IFS='=' read -r key value || [ -n "$key" ]; do
key="$(printf '%s' "$key" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')"
value="$(printf '%s' "$value" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')"
case "$key" in
'' | '#'*) continue ;;
esac
case "$key" in
birth_date) birth_date="$value" ;;
birth_time) birth_time="$value" ;;
birth_utc_offset) birth_utc_offset="$value" ;;
birth_lat) birth_lat="$value" ;;
birth_lon) birth_lon="$value" ;;
lang) [ -n "$value" ] && lang="$value" ;;
esac
done <"$PROPERTIES_FILE"
check_set() {
case "$2" in
'' | *YOUR_*)
echo "error: $PROPERTIES_FILE: '$1' is not set - edit the file and fill in your details." >&2
exit 1
;;
esac
}
check_set birth_date "$birth_date"
check_set birth_time "$birth_time"
check_set birth_utc_offset "$birth_utc_offset"
check_set birth_lat "$birth_lat"
check_set birth_lon "$birth_lon"
# OS-provided inputs: today's date is the tarot seed (stable all day, a
# new spread each day), current UTC time drives today's transits.
seed="$(date +%Y-%m-%d)"
transit_date="$(date -u +%Y-%m-%dT%H:%M)"
format="${1:-text}"
lang="${2:-$lang}"
exec "$BINARY" \
--seed "$seed" \
--birth-date "$birth_date" \
--birth-time "$birth_time" \
--birth-utc-offset "$birth_utc_offset" \
--birth-lat "$birth_lat" \
--birth-lon "$birth_lon" \
--date "$transit_date" \
--format "$format" \
--lang "$lang" \
--i18n-dir "$SCRIPT_DIR/i18n"