diff --git a/.gitignore b/.gitignore index 1c26386..76bccf5 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,4 @@ /phpunit.xml /.phpunit.cache/ ###< phpunit/phpunit ### +/node_modules/ diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..e050e4d --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,116 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with +code in this repository. + +## What this is + +The course repo for SymfonyCasts' [Agentic Development](https://symfonycasts.com/screencast/agentic-development) +tutorial: "Time Traveler's Lost & Found", a Symfony 8.1 / PHP 8.4 app. +`sfcasts/` holds the course script (currently just an empty `metadata.yml`). +Because it's a tutorial repo, the app is deliberately half-built — see "Current +state" below before assuming something is missing by mistake. + +## Commands + +Start Postgres first — the app is configured for it, not SQLite: + +```bash +docker compose up -d # Postgres 16 on a random host port +symfony serve -d # web server; also boots the tailwind:build --watch worker +``` + +`.symfony.local.yaml` registers `symfony console tailwind:build --watch` as a +worker, so `symfony serve` is the intended way to run the app — CSS rebuilds +automatically. Without the Symfony CLI you must run that watcher yourself. + +```bash +php bin/console # or: symfony console +php bin/console tailwind:build # one-off CSS build -> var/tailwind/app.built.css +php bin/console make:migration && php bin/console doctrine:migrations:migrate +php bin/console foundry:load-fixtures dev # rebuild the DB and load every story +php bin/console foundry:load-fixtures items --append # one story, keep existing rows +php bin/console make:factory / make:story # scaffold a Foundry factory or story +php bin/console importmap:require # add JS deps (never npm/yarn — see below) +php bin/console debug:router +``` + +Tests (PHPUnit 13, config in `phpunit.dist.xml`): + +```bash +php bin/phpunit # whole suite +php bin/phpunit --filter testSomething # single test +php bin/phpunit tests/Path/To/SomeTest.php # single file +``` + +The suite is configured strictly: `failOnDeprecation`, `failOnNotice`, and +`failOnWarning` are all true, so a deprecation notice fails the build. Test DB +names get a `_test` suffix automatically (`config/packages/doctrine.yaml`). + +## Architecture + +- **Frontend has no Node build step.** AssetMapper serves `assets/` directly via + importmaps (`importmap.php`); JS deps are vendored into `assets/vendor/` by + `importmap:require`. The `yarn.lock` at the root is vestigial and + `node_modules/` is gitignored — do not add npm dependencies or a bundler. + Stimulus + Turbo are wired through `assets/app.js` → `stimulus_bootstrap.js`. +- **Tailwind v4 comes from `symfonycasts/tailwind-bundle`** (standalone binary + v4.3.3, no PostCSS). Source is the single `@import "tailwindcss";` line in + `assets/styles/app.css`; the built file lands in `var/tailwind/app.built.css` + and reaches the page because `app.js` imports `./styles/app.css`. +- **The theme lives in `assets/styles/app.css`.** A v4 `@theme` block defines the + `tardis` / `accent` colors and the `display` (Orbitron) / `sans` (Inter) font + tokens, followed by plain rules for `.tardis-lamp` and `.panel-lines`. Setting + `--font-sans` is what makes Preflight apply Inter to `html`. +- **`base.html.twig` follows the AssetMapper recipe**: `{% block javascripts %}` + contains only `{{ importmap('app') }}`, `{% block stylesheets %}` is empty, and + there are no inline `