Files
trips/AGENTS.md
Shaun Campbell fe289f0895
All checks were successful
Build and Push Image / docker-build-and-push (push) Successful in 2m31s
Add Playwright e2e coverage + comment-level video upload workflow (#40)
## Summary
- add Playwright e2e auth setup + seeded test DB flow
- fix Playwright startup order so DB seed runs before web server uses SQLite
- add full trip-planning e2e scenario (future trip, travellers, destination, flight, lodging, upcoming verification)
- configure Auth.js custom sign-in page for base-path routing
- add repo guidance in AGENTS.md / CLAUDE.md requiring e2e for user-facing changes
- document and validate comment-level Gitea video attachment workflow (create comment, upload to comment assets endpoint)

## Validation
- bunx playwright test e2e/auth.test.ts --project=chromium\n- bunx playwright test e2e/trip-planning.test.ts --project=chromium
- PW_VIDEO_MODE=on PW_TRACE_MODE=off bunx playwright test e2e/trip-planning.test.ts --project=chromium

## Issue
- relates to #38

Co-authored-by: AI Agent <ai-agent@campbellwireless.net>
Reviewed-on: #40
Co-authored-by: Shaun Campbell <shaun@campbellwireless.net>
Co-committed-by: Shaun Campbell <shaun@campbellwireless.net>
2026-02-22 21:20:19 +00:00

2.9 KiB

Repository Guidelines

Project Structure & Module Organization

  • src/: SvelteKit application source.
  • src/routes/: File-based routes and server handlers (e.g., +page.server.ts).
  • src/lib/: Shared UI and server modules (components/, server/, assets/).
  • src/tests/: Test helpers and stubs; unit tests live alongside code and match src/**/*.test.ts.
  • static/: Public assets served as-is.
  • build/: Production build output (generated).
  • trips.db: Local SQLite database for development.

Build, Test, and Development Commands

  • npm run dev: Start the Vite dev server.
  • npm run build: Create a production build.
  • npm run preview: Serve the production build locally.
  • npm run check: Typecheck with svelte-check.
  • npm run lint: Run ESLint on src.
  • npm run format: Format with Prettier (Svelte + Tailwind plugins).
  • npm run test: Run Vitest once.
  • npm run test:watch: Watch mode for Vitest.
  • npm run test:coverage: Coverage for src/lib/server/**/*.ts (db layer excluded).

Coding Style & Naming Conventions

  • Indentation: tabs (see .prettierrc).
  • Quotes: single quotes; trailing commas disabled.
  • Svelte components use .svelte; TypeScript modules use .ts.
  • Routes follow SvelteKit conventions (e.g., +page.svelte, +layout.server.ts).
  • Use $lib alias for src/lib imports.

Testing Guidelines

  • Framework: Vitest with node environment.
  • Test file pattern: src/**/*.test.ts.
  • Keep tests near the code they cover; use src/tests/stubs for runtime stubbing.
  • For every user-facing feature or behavior change, add/update Playwright e2e coverage under e2e/.
  • When work is tied to a Gitea issue, record an e2e run video and upload it to that issue.
    • One-off video run: PW_VIDEO_MODE=on PW_TRACE_MODE=on bunx playwright test <spec>
    • Prefer comment-level attachments: post a comment first, then upload the video to that comment.
      • Create comment: tea comment -l <login> -r <owner>/<repo> <issue-index> "<message>"
    • Upload with curl (example, tea api in this repo's toolchain does not send multipart correctly):
      • TOKEN=$(awk '/- name: cloud.campbellwireless.net/{f=1} f && $1=="token:"{print $2; exit}' "$HOME/Library/Application Support/tea/config.yml")
      • curl -fsS -X POST "https://cloud.campbellwireless.net/git/api/v1/repos/{owner}/{repo}/issues/comments/{comment_id}/assets" -H "Authorization: token $TOKEN" -F "name=<filename>" -F "attachment=@<path>"

Commit & Pull Request Guidelines

  • Commit messages currently follow a light “scope) message” pattern, e.g.,
    • trips) adding package-tours option
    • trip) adding support for lodgings
  • PRs should include a clear description of intent, testing performed (or why not), and any relevant screenshots for UI changes.

Configuration & Environment

  • Copy .env.example to .env for local secrets and auth settings.
  • SQLite data lives in trips.db; avoid committing local data changes unless intentional.