diff --git a/.ai/rules/e2e-tests.md b/.ai/rules/e2e-tests.md index 866945ff..df403872 100644 --- a/.ai/rules/e2e-tests.md +++ b/.ai/rules/e2e-tests.md @@ -8,6 +8,9 @@ paths: ## Select by test id Select elements by `data-testid`, never by translated text, labels, or role names, which change with the locale. Item-specific ids use `{action}-${item.id}`. +## Assert behaviour, not copy or design +Customers translate, reword and restyle a starter kit; a test must still pass. Assert what happened: an element is shown or hidden, a URL, a count, a `data-state`, data the test created (a name, price, version). Never assert UI copy (labels, toasts, errors, empty states), CSS, sizes or positions. If a state has no hook, add a `data-testid` or `data-state` to the component instead of matching its words. The same holds in PHPUnit: assert data and state, not `assertSee` on a heading or sentence. + ## Import the shared fixture Import `test` and `expect` from `@e2e/fixtures`, not `@playwright/test`. The fixture provides `credentials` and `loginAs`, and fails the test on any uncaught page error; list errors a spec causes on purpose with `test.use({ allowedPageErrors: [...] })`. diff --git a/.ai/skills/saucebase-frontend-development/SKILL.md b/.ai/skills/saucebase-frontend-development/SKILL.md index 35cadbcb..76cca9b2 100644 --- a/.ai/skills/saucebase-frontend-development/SKILL.md +++ b/.ai/skills/saucebase-frontend-development/SKILL.md @@ -69,6 +69,16 @@ Never import a `vendor/` path, and never reach into the app's pages. The `@saucebase/*` names are aliases the Vite preset in `saucebase/core` defines for its `resources/js`; only the app's own framework has one. +## Reuse the shared dialogs + +Before building a dialog, check what core already provides. A confirmation +(delete, revoke, sign out everywhere) goes through `useDialog().confirm()`, with +`variant: 'destructive'` and an icon when the action can't be undone; never a +page's own `AlertDialog`. Build a new dialog only when it holds a form or content +of its own, and then use the app's `@/components/ui/dialog` primitives. Every +confirmation then looks and behaves the same, and tests reach it through +`confirm-dialog`, `confirm-dialog-confirm`, and `confirm-dialog-cancel`. + ## Navigation Items are declared in PHP (`routes/navigation.php`); see diff --git a/.ai/skills/saucebase-testing/SKILL.md b/.ai/skills/saucebase-testing/SKILL.md index f646b335..f872c953 100644 --- a/.ai/skills/saucebase-testing/SKILL.md +++ b/.ai/skills/saucebase-testing/SKILL.md @@ -7,6 +7,8 @@ description: Choose, write, and run Saucebase tests — PHPUnit (app and modules Write the failing test first, then the code that makes it pass. +Test behaviour, not wording or looks: customers translate, reword and restyle, and the tests must still pass. Assert test ids, URLs, counts, `data-state` and data the test created; never UI copy, CSS, sizes or positions. Missing a hook? Add a `data-testid` or `data-state`. Details in `.ai/rules/e2e-tests.md`. + ## Which suite | Change | Suite | Location | diff --git a/.gitignore b/.gitignore index ea2b1ca7..cb286666 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,9 @@ /auth.json /node_modules +# Storybook: test coverage and the static build +/coverage +/storage/storybook /public/build /public/hot /public/modules diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d48f3cf5..e068defb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -203,6 +203,33 @@ task workers # both; Ctrl-C stops both `APP` set to `docker compose exec app` in `Taskfile.yml`, these run in the container. A second queue worker is harmless. +### Storybook + +Core's components have stories, and the design system (colours, type, shape, +brand) has pages, in Storybook: + +```bash +npm run storybook # http://localhost:6006 +npm run test:stories # every story renders and its checks pass +npm run storybook:build # static build in storage/storybook +``` + +Stories live beside their components in core, in the stack you're on +(`stubs/stack/vue/js/` or `stubs/stack/react/js/`). Storybook's own config is +in that stack's `js/.storybook/`. Every story is also a test: it must render, and its +`play` function must pass. A story tagged `contributor` (`tags: ['contributor']`, +for parts of Saucebase's own welcome page) shows in the sidebar only where +`saucebase.json` has `"contributor": true`; installed apps still run it as a test. + +Core's components live outside this app, where its `tsconfig.json` doesn't +reach. `saucebase stack --dev` writes core a `tsconfig.json` of its own +and a `node_modules` link (in `stubs/stack//js/`, git-ignored, pointing at +this app), so Storybook's +props tables, "Show code" and its `/mcp` docs work as in an installed app, and +your editor type-checks core's files. If Storybook prints a "Builder docgen" +deprecation warning, that file is missing: run `saucebase stack --reset`, then +`saucebase stack --dev` again. + `Taskfile.yml` is committed with no modules listed. Installing a module adds its tasks locally; run `php artisan saucebase:taskfile-sync` to list exactly the modules you have. Don't commit those lines. diff --git a/Taskfile.yml b/Taskfile.yml index 6e886ff2..5aa9fc09 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -92,7 +92,7 @@ tasks: # ── Helpers ─────────────────────────────────────────────────── db:reset: - desc: Reset the app and E2E databases (migrate:fresh + module seeds; DEMO=--demo adds sample content) + desc: Reset the app and E2E databases (migrate:fresh + module seeds; STATE=showcase adds sample content) prompt: This will erase ALL data, in the E2E database too. Are you sure? # Checked before anything runs. Without .env.e2e, --env=e2e loads .env, and a cached # config or exported DB_* variables do the same: the E2E reset would wipe the app's database. @@ -105,20 +105,20 @@ tasks: msg: 'The E2E environment resolves to the app database (check .env.e2e, a cached config, or exported DB_* variables). Nothing was reset.' cmds: - '{{.APP}} php artisan migrate:fresh --seed' - - '{{.APP}} php artisan modules:seed {{.DEMO}}' + - '{{.APP}} php artisan modules:seed {{if .STATE}}--state={{.STATE}}{{end}}' # On the host, like the E2E run itself; its server only migrates, so an # edited migration needs this to apply there. - php artisan migrate:fresh --env=e2e --force - db:reset:demo: - desc: Reset the app and E2E databases and load sample content (the auth module's demo includes an admin) + db:reset:showcase: + desc: Reset the app and E2E databases and load sample content (the auth module's showcase includes an admin) cmds: - task: db:reset - vars: { DEMO: '--demo' } + vars: { STATE: showcase } - db:seed:demo: + db:seed:showcase: desc: Seed every module with sample content - cmd: '{{.APP}} php artisan modules:seed --demo' + cmd: '{{.APP}} php artisan modules:seed --state=showcase' # ── Translation ─────────────────────────────────────────────── diff --git a/composer.json b/composer.json index fafd4841..36428af6 100644 --- a/composer.json +++ b/composer.json @@ -8,7 +8,7 @@ "php": "^8.4", "laravel/framework": "^13.38.0", "laravel/tinker": "^3.0.2", - "saucebase/core": "^2.12" + "saucebase/core": "^3.1" }, "require-dev": { "barryvdh/laravel-ide-helper": "^3.7", diff --git a/composer.lock b/composer.lock index 87414acb..6136e58b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "36becdb7b3a3c3deb095d53f11e49bfa", + "content-hash": "98afe2ac08fea8350835912524d7371d", "packages": [ { "name": "anourvalar/eloquent-serialize", @@ -7051,16 +7051,16 @@ }, { "name": "saucebase/core", - "version": "v2.12.0", + "version": "v3.1.1", "source": { "type": "git", "url": "https://github.com/saucebase-dev/core.git", - "reference": "071aecf898ea63650a2313c8c627717f76c1e88d" + "reference": "7055df8864ba009aa735ef0939a398b6a2bec963" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/saucebase-dev/core/zipball/071aecf898ea63650a2313c8c627717f76c1e88d", - "reference": "071aecf898ea63650a2313c8c627717f76c1e88d", + "url": "https://api.github.com/repos/saucebase-dev/core/zipball/7055df8864ba009aa735ef0939a398b6a2bec963", + "reference": "7055df8864ba009aa735ef0939a398b6a2bec963", "shasum": "" }, "require": { @@ -7075,7 +7075,7 @@ "laravel/framework": "^13.38", "php": "^8.4", "saucebase/breadcrumbs": "^1.1", - "saucebase/module-installer": "^3.0.1", + "saucebase/module-installer": "^3.3", "spatie/laravel-data": "^4.23", "spatie/laravel-navigation": "^1.3", "spatie/laravel-permission": "^8.3.2", @@ -7100,6 +7100,9 @@ "dont-discover": [ "internachi/modular" ] + }, + "branch-alias": { + "dev-dev": "3.x-dev" } }, "autoload": { @@ -7132,22 +7135,23 @@ ], "support": { "issues": "https://github.com/saucebase-dev/core/issues", - "source": "https://github.com/saucebase-dev/core/tree/v2.12.0" + "source": "https://github.com/saucebase-dev/core/tree/v3.1.1" }, - "time": "2026-11-07T16:43:51+00:00" + "time": "2026-11-20T20:30:40+00:00", + "published-time": "2026-11-20T20:30:45+00:00" }, { "name": "saucebase/module-installer", - "version": "v3.2.0", + "version": "v3.3.0", "source": { "type": "git", "url": "https://github.com/saucebase-dev/module-installer.git", - "reference": "93279038a9ee1afd25d0ee9d6c9ad7c2519b1d46" + "reference": "397d8c0d2e56dcebf0689b29e8ac25c247b43019" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/saucebase-dev/module-installer/zipball/93279038a9ee1afd25d0ee9d6c9ad7c2519b1d46", - "reference": "93279038a9ee1afd25d0ee9d6c9ad7c2519b1d46", + "url": "https://api.github.com/repos/saucebase-dev/module-installer/zipball/397d8c0d2e56dcebf0689b29e8ac25c247b43019", + "reference": "397d8c0d2e56dcebf0689b29e8ac25c247b43019", "shasum": "" }, "require": { @@ -7163,7 +7167,10 @@ }, "type": "composer-plugin", "extra": { - "class": "Saucebase\\ModuleInstaller\\Plugin" + "class": "Saucebase\\ModuleInstaller\\Plugin", + "branch-alias": { + "dev-dev": "3.3.x-dev" + } }, "autoload": { "psr-4": { @@ -7184,9 +7191,10 @@ "description": "Custom Composer installer for Sauce Base modules (type: saucebase-module). Installs to modules/ (lowercase) with configurable base dir.", "support": { "issues": "https://github.com/saucebase-dev/module-installer/issues", - "source": "https://github.com/saucebase-dev/module-installer/tree/v3.2.0" + "source": "https://github.com/saucebase-dev/module-installer/tree/v3.3.0" }, - "time": "2026-11-03T21:09:29+00:00" + "time": "2026-11-15T17:10:40+00:00", + "published-time": "2026-11-15T17:10:54+00:00" }, { "name": "scrivo/highlight.php", @@ -15255,5 +15263,5 @@ "php": "^8.4" }, "platform-dev": {}, - "plugin-api-version": "2.9.0" + "plugin-api-version": "2.11.0" } diff --git a/routes/navigation.php b/routes/navigation.php index 45b53cd6..bd6d2a16 100644 --- a/routes/navigation.php +++ b/routes/navigation.php @@ -53,37 +53,6 @@ function (Section $section) { } ); -Navigation::add( - 'Discord', - 'https://discord.gg/hCajBky39t', - function (Section $section) { - $section->attributes([ - 'group' => 'secondary', - 'slug' => 'discord', - 'icon' => 'discord', - 'external' => true, - 'newPage' => true, - 'order' => 5, - 'class' => 'bg-[#5865F2]/10 text-[#4752C4] hover:bg-[#5865F2]/20 hover:text-[#3C45A5] dark:text-[#949CF7] dark:hover:text-[#B5BAFA]', - ]); - } -); - -Navigation::add( - 'Discord', - 'https://discord.gg/hCajBky39t', - function (Section $section) { - $section->attributes([ - 'group' => 'landing', - 'slug' => 'discord', - 'external' => true, - 'newPage' => true, - 'order' => 99, - 'class' => 'text-[#4752C4] hover:text-[#3C45A5] dark:text-[#949CF7] dark:hover:text-[#B5BAFA]', - ]); - } -); - Navigation::addWhen( fn () => Auth::user()?->can('access admin panel') ?? false, 'Admin',