团子 58494b8fca feat: React webui with flags support, build-ui pipeline
- packages/webui: Vite + React + Tailwind v4, single-file bundle
- Dark industrial theme, Space Grotesk + JetBrains Mono
- Config table with scope/flag badges, masked values, search/filter
- Admin panel for agent management
- scripts/build-ui.sh generates worker/src/ui.ts from webui build
- Worker serves UI at GET / before auth check
2026-04-21 04:01:35 +00:00

29 lines
653 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "$0")/.."
export PATH="$HOME/.bun/bin:$PATH"
echo "Building webui..."
cd packages/webui
bun run build
HTML=$(cat dist/index.html)
echo "Generating ui.ts..."
cat > ../worker/src/ui.ts << 'TSEOF'
export function renderUI(): string {
return UI_HTML;
}
TSEOF
# Use node to safely embed the HTML as a JS string
node -e "
const fs = require('fs');
const html = fs.readFileSync('dist/index.html', 'utf8');
const src = 'export function renderUI(): string {\n return ' + JSON.stringify(html) + ';\n}\n';
fs.writeFileSync('../worker/src/ui.ts', src);
"
echo "Done. Generated packages/worker/src/ui.ts"