diff --git a/.dev/Dockerfile.sandbox b/.dev/Dockerfile.sandbox deleted file mode 100644 index 2794c3c..0000000 --- a/.dev/Dockerfile.sandbox +++ /dev/null @@ -1,19 +0,0 @@ -FROM docker/sandbox-templates:copilot - -USER root - -# Python dependencies for Flask API server -RUN apt-get update && apt-get install -y --no-install-recommends \ - python3-flask \ - python3-sqlalchemy \ - python3-flask-sqlalchemy \ - && rm -rf /var/lib/apt/lists/* - -# Playwright browsers and OS dependencies -RUN mkdir -p /usr/local/share/npm-global/lib && npx playwright install --with-deps chromium - -USER agent - -# Pre-install Node.js dependencies on native ext4 -COPY --chown=agent:agent app/client/package.json app/client/package-lock.json /home/agent/project-deps/ -RUN cd /home/agent/project-deps && npm ci diff --git a/.dev/sandbox.json b/.dev/sandbox.json deleted file mode 100644 index 40c79c7..0000000 --- a/.dev/sandbox.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "image_name": "pets-workshop-sandbox", - "watch_files": [ - "app/client/package.json", - "app/client/package-lock.json", - "app/server/requirements.txt" - ] -} diff --git a/.dev/start-copilot-sandbox.sh b/.dev/start-copilot-sandbox.sh deleted file mode 100755 index 67ed8e8..0000000 --- a/.dev/start-copilot-sandbox.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" -REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" -CONFIG_FILE="$SCRIPT_DIR/sandbox.json" -DOCKERFILE="$SCRIPT_DIR/Dockerfile.sandbox" - -cd "$REPO_ROOT" - -if [ ! -f "$CONFIG_FILE" ]; then - echo "Error: sandbox.json not found in $SCRIPT_DIR" >&2 - exit 1 -fi - -# Read config from sandbox.json -IMAGE_NAME=$(python3 -c "import json; print(json.load(open('$CONFIG_FILE'))['image_name'])") -mapfile -t WATCH_FILES < <(python3 -c " -import json -for f in json.load(open('$CONFIG_FILE')).get('watch_files', []): - print(f) -") -WATCH_FILES+=("$DOCKERFILE") - -needs_build() { - # Build if image doesn't exist - if ! docker image inspect "$IMAGE_NAME" &>/dev/null; then - echo "Image '$IMAGE_NAME' not found." - return 0 - fi - - # Get image creation timestamp - image_time=$(docker image inspect "$IMAGE_NAME" --format '{{.Created}}') - image_epoch=$(date -d "$image_time" +%s 2>/dev/null || date -jf "%Y-%m-%dT%H:%M:%S" "${image_time%%.*}" +%s 2>/dev/null) - - # Check if any watched files are newer than the image - for f in "${WATCH_FILES[@]}"; do - if [ -f "$f" ]; then - file_epoch=$(stat -c %Y "$f" 2>/dev/null || stat -f %m "$f" 2>/dev/null) - if [ "$file_epoch" -gt "$image_epoch" ]; then - echo "Rebuild needed: '$f' is newer than image." - return 0 - fi - fi - done - - echo "Image '$IMAGE_NAME' is up to date." - return 1 -} - -REBUILT=false -if needs_build; then - echo "Building sandbox image..." - docker build -t "$IMAGE_NAME" -f "$DOCKERFILE" . - echo "Build complete." - REBUILT=true -fi - -echo "Starting Copilot sandbox..." - -# If sandbox already exists and image was rebuilt, remove the old sandbox -if [ "$REBUILT" = true ] && docker sandbox ls 2>/dev/null | grep -q "copilot"; then - echo "Removing old sandbox to apply new image..." - docker sandbox rm copilot 2>/dev/null || true -fi - -# Use --template only when sandbox doesn't exist yet -if docker sandbox ls 2>/dev/null | grep -q "copilot"; then - exec docker sandbox run copilot -else - exec docker sandbox run --template "$IMAGE_NAME" copilot "$REPO_ROOT" -fi diff --git a/.gitignore b/.gitignore index 9ac1913..3a64e92 100644 --- a/.gitignore +++ b/.gitignore @@ -44,4 +44,7 @@ app/client/test-results/ app/client/playwright-report/ # e2e test database -app/server/e2e_test_dogshelter.db \ No newline at end of file +app/server/e2e_test_dogshelter.db + +# azure +.azure diff --git a/PLAN.md b/PLAN.md deleted file mode 100644 index 807fa92..0000000 --- a/PLAN.md +++ /dev/null @@ -1,95 +0,0 @@ -# Plan: Simplify Client App — Pure Astro, Remove Svelte - -## Problem Statement - -The client app is more complex than necessary: - -1. **Svelte is unnecessary** — Both Svelte components (`DogList.svelte`, `DogDetails.svelte`) have zero client-side interactivity (no state changes, no event handlers, just data display and `` links). They can be simple Astro components. -2. **Unnecessary client-side data fetching** — Components fetch data client-side via `fetch('/api/...')`, even though Astro is configured for SSR and can fetch server-side in page frontmatter -3. **Middleware API proxy adds complexity** — The middleware intercepts `/api/` requests and proxies them to Flask. With server-side fetching in Astro, this layer is unnecessary -4. **Dead dependencies** — `autoprefixer`, `postcss` (Tailwind v4 handles this), `flask-cors` (no cross-origin requests with SSR) -5. **Unused assets & redundant code** — Starter template leftovers, duplicate imports, placeholder comments - -## Proposed Approach - -Remove Svelte entirely. Convert Svelte components to Astro components. Fetch data server-side in Astro page frontmatter. Remove the middleware proxy, dead dependencies, and unused files. - -## Todos - -### 1. Convert `DogList.svelte` → `DogList.astro` -- **Delete**: `client/src/components/DogList.svelte` -- **Create**: `client/src/components/DogList.astro` -- Accept `dogs` array via `Astro.props` -- Render the same HTML grid of dog cards (pure template, no JS) - -### 2. Convert `DogDetails.svelte` → `DogDetails.astro` -- **Delete**: `client/src/components/DogDetails.svelte` -- **Create**: `client/src/components/DogDetails.astro` -- Accept `dog` object via `Astro.props` -- Render the same HTML dog detail card (pure template, no JS) - -### 3. Update `index.astro` — server-side data fetching -- **File**: `client/src/pages/index.astro` -- Fetch dogs list from Flask in frontmatter (`API_SERVER_URL/api/dogs`) -- Pass data to `DogList.astro` as props -- Handle error states in the page -- Remove `global.css` import (already in Layout) - -### 4. Update `[id].astro` — server-side data fetching -- **File**: `client/src/pages/dog/[id].astro` -- Fetch dog details from Flask in frontmatter (`API_SERVER_URL/api/dogs/{id}`) -- Pass data to `DogDetails.astro` as props -- Handle 404 / error states -- Remove redundant `export const prerender = false` and unused `props` variable - -### 5. Remove the API proxy middleware -- **Delete**: `client/src/middleware.ts` - -### 6. Remove Svelte from the project -- **File**: `client/astro.config.mjs` — Remove Svelte integration and duplicate vite plugin -- **Delete**: `client/svelte.config.js` -- **File**: `client/package.json` — Remove `svelte`, `@astrojs/svelte` - -### 7. Remove dead dependencies -- **File**: `client/package.json` — Remove `autoprefixer`, `postcss` (Tailwind v4 + Vite handles CSS natively) -- **File**: `server/requirements.txt` — Remove `flask-cors` (no cross-origin with SSR) - -### 8. Remove unused assets -- **Delete**: `client/src/assets/astro.svg`, `client/src/assets/background.svg` (starter template leftovers, not referenced anywhere) - -### 9. Clean up minor issues -- **Eliminate `global.css`** — It only contains `@import "tailwindcss"`. Move this into the `