kitchen/_copy_from_archive.sh
jtricerolph 8d688b459d Initial kitchen scaffold — Phase 1 kitchen port (build-verified 2026-07-11)
FastAPI backend (Python 3.11, MSSQL ODBC for SambaPOS, Azure DI OCR),
kitchen_db on central PG. React/TS/Vite frontend with navy sidebar layout.

Backend: auth.py (APP_SLUG=kitchen, SimpleNamespace — archive routes use
.kitchen_id/.is_admin without modification), main.py (51 migrations, scheduler,
internal router for KDS bookings feed), api/internal.py, full archive API
(31 routers: invoices, recipes, menus, sambapos, resos, newbook, disputes,
purchase_orders, etc.), models, migrations, OCR pipeline.
kitchen_id pinned to 1 (B1 — single hotel).

Frontend: AuthGate (app=kitchen, token shim for archive compat — B5b pending),
Layout (navy sidebar, 6 sections, Lucide icons, teal --app-primary),
App.tsx (Outlet pattern, UploadApp outside Layout), index.css (full :root block).
strict: false — archive components have type issues; build clean.

Note: 45 archive components call fetch('/api/...') without /kitchen/ prefix
(B5b). Runtime 404s; deferred until after initial testing.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-12 12:15:39 +00:00

76 lines
3.1 KiB
Bash

#!/usr/bin/env bash
# Phase 1 setup — copy archive backend/frontend source files into kitchen/
# Run once from the repo root: bash kitchen/_copy_from_archive.sh
set -euo pipefail
ARCHIVE=/home/jtr/laptop-archive/kitchen-invoice-flash-docker
DEST=/home/jtr/dev/HNF-PROXMOX/kitchen
echo "==> Copying backend source from archive..."
# API routers (all except kds.py)
cp -r "$ARCHIVE/backend/api" "$DEST/backend/"
rm -f "$DEST/backend/api/kds.py"
# Services (exclude KDS-specific)
cp -r "$ARCHIVE/backend/services" "$DEST/backend/"
rm -f "$DEST/backend/services/signalr_listener.py"
rm -f "$DEST/backend/services/kds_graphql.py"
# Models (exclude kds.py — tables stay in DB for KDS app migration later)
cp -r "$ARCHIVE/backend/models" "$DEST/backend/"
rm -f "$DEST/backend/models/kds.py"
# Migrations (exclude KDS migrations)
cp -r "$ARCHIVE/backend/migrations" "$DEST/backend/"
rm -f "$DEST/backend/migrations/add_kds_tables.py"
rm -f "$DEST/backend/migrations/add_kds_course_flow.py"
rm -f "$DEST/backend/migrations/add_kds_order_tracking.py"
rm -f "$DEST/backend/migrations/add_kds_bookings_refresh.py"
# OCR pipeline
cp -r "$ARCHIVE/backend/ocr" "$DEST/backend/"
# Core files (auth.py and main.py are rewritten — do not copy)
cp "$ARCHIVE/backend/database.py" "$DEST/backend/"
cp "$ARCHIVE/backend/scheduler.py" "$DEST/backend/"
# Fix auth import in every copied router
echo "==> Patching auth imports in api/*.py..."
find "$DEST/backend/api" -name "*.py" \
-exec sed -i 's/from auth\.jwt import get_current_user/from auth import get_current_user, require_cap/g' {} \;
echo "==> Copying frontend source from archive..."
# Components (all 45 — shell conversion done; B5 tracks full design-system pass)
cp -r "$ARCHIVE/frontend/src/components" "$DEST/frontend/src/"
# Pages (exclude Login, KDS, KDSApp — those belong to other apps)
mkdir -p "$DEST/frontend/src/pages"
for page in Settings NewbookData ResosData ResidentsTableChart BookingsStats WastageLogbook UploadApp; do
src="$ARCHIVE/frontend/src/pages/${page}.tsx"
[ -f "$src" ] && cp "$src" "$DEST/frontend/src/pages/" && echo " pages/${page}.tsx"
done
# Utilities
cp -r "$ARCHIVE/frontend/src/utils" "$DEST/frontend/src/"
# Public dir (sw.js for UploadApp PWA service worker)
[ -d "$ARCHIVE/frontend/public" ] && cp -r "$ARCHIVE/frontend/public" "$DEST/frontend/"
# index.html (vite entry — already exists from scaffold, only copy if missing)
[ ! -f "$DEST/frontend/index.html" ] && \
[ -f "$ARCHIVE/frontend/index.html" ] && \
cp "$ARCHIVE/frontend/index.html" "$DEST/frontend/"
echo "==> Copying archive docs..."
mkdir -p "$DEST/docs/archive"
cp "$ARCHIVE/"PLAN_*.md "$DEST/docs/archive/" 2>/dev/null || true
for f in RECIPE-SYSTEM-PLAN.md PURCHASE-ORDER-PLAN.md MENUS-PLAN.md LLM-INTEGRATION-PLAN.md LLM-MANIFEST.md; do
[ -f "$ARCHIVE/$f" ] && cp "$ARCHIVE/$f" "$DEST/docs/archive/"
done
[ -d "$ARCHIVE/docs" ] && cp "$ARCHIVE/docs/"*.md "$DEST/docs/archive/" 2>/dev/null || true
echo ""
echo "Done. Next: docker compose build (backend) && npm run build (frontend)."
echo "Do NOT push to Forgejo until Phase 4 registration is complete."