Files
grabowski 22f04ee9a1
Deploy test site / deploy (push) Successful in 24s
Plant assistant mockup: operator, management, sales
docs/plant-assistant.html (test site /demos/plant-assistant/): the
plant assistant on vinyl-ai as three roles see it. Operator at the C1
press kiosk in Thai or English with push to talk (non-fill rejects
explained from cycle rows, lot change and press hall humidity, the
stamper change procedure quoted from the approved version, a lot on
hold, a refused price question, a safety question answered word for
word); management at a desk (output and yield per press against the
plan basis, steam per record against scale.md, orders at risk, the
weekly note, payroll refused); sales on a phone (order status and ship
window, repress feasibility from archived mothers and the standby
calendar, repress leads, a test pressing status, fans' addresses
refused). Each answer carries numbered sources; the side panel shows
the tool calls (ERPNext as the asker's role, the PostgreSQL replica,
VictoriaMetrics, documents, event log) on premises with the internet
not used; action buttons create drafts only. Deep links
#role=<role>&q=<id>, light and dark theme. Invented data; names match
the factory console demo.

plant-assistant.md: mockup link; sales and customer service row in
"Who asks what"; sales drafts (quotation, CRM opportunity, message).
README, site index and site/build.sh link and publish the page.
2026-10-27 09:50:42 +07:00

76 lines
2.5 KiB
Bash

#!/usr/bin/env bash
# Assemble the cnxvinyl.lol web root in site/dist.
#
# site/public/ copied verbatim: landing page, robots.txt, and any static
# site dropped in as its own directory (site/public/<name>/)
# DEMOS below pages copied out of docs/, so docs/ stays their one source
#
# Run locally with `bash site/build.sh`, then open site/dist/index.html.
# CI (.gitea/workflows/deploy-site.yml) runs the same script and deploys
# site/dist as it is.
set -euo pipefail
cd "$(dirname "$0")/.."
out=site/dist
rm -rf "$out"
mkdir -p "$out"
cp -R site/public/. "$out/"
# "<source in the repo> <path under the web root>"
DEMOS=(
"docs/plant-operation.html demos/plant-operation/index.html"
"docs/fleet-calculator.html demos/fleet-calculator/index.html"
"docs/steam-cooling.html demos/steam-cooling/index.html"
"docs/order.html demos/order/index.html"
"docs/artist-order.html demos/artist-order/index.html"
"docs/make-a-record.html demos/make-a-record/index.html"
"docs/factory-console.html demos/factory/index.html"
"docs/plant-assistant.html demos/plant-assistant/index.html"
)
for entry in "${DEMOS[@]}"; do
read -r src dst <<<"$entry"
mkdir -p "$out/$(dirname "$dst")"
cp "$src" "$out/$dst"
done
# "<directory in the repo> <directory under the web root>": multi-file
# pages (a page with its images and downloads), copied whole
DIRS=(
"docs/pitch pitch"
)
for entry in "${DIRS[@]}"; do
read -r src dst <<<"$entry"
mkdir -p "$out/$dst"
cp -R "$src/." "$out/$dst/"
done
# The deploy job reads this back from the server to confirm what is live.
git rev-parse HEAD >"$out/version.txt" 2>/dev/null || echo unknown >"$out/version.txt"
# Fail on a dead internal link: every href/src in every page that points
# inside the site must resolve to a file in dist.
dead=0
while IFS= read -r page; do
dir=$(dirname "$page")
while IFS= read -r ref; do
# shellcheck disable=SC2016 # literal ${ and {{ mark JS/template strings
case "$ref" in
'' | '#'* | http:* | https:* | mailto:* | tel:* | data:* | javascript:* | *'${'* | *'{{'*) continue ;;
esac
ref=${ref%%#*}
ref=${ref%%\?*}
case "$ref" in
/*) target="$out$ref" ;;
*) target="$dir/$ref" ;;
esac
[ -d "$target" ] && target="${target%/}/index.html"
if [ ! -f "$target" ]; then
echo "dead link in ${page#"$out"/}: $ref" >&2
dead=1
fi
done < <(grep -o -E '(href|src)="[^"]*"' "$page" | sed -E 's/^(href|src)="//; s/"$//')
done < <(find "$out" -name '*.html')
[ "$dead" -eq 0 ] || exit 1
echo "built $out: $(find "$out" -type f | wc -l | tr -d ' ') files"