Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .ai/rules/e2e-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: [...] })`.

Expand Down
10 changes: 10 additions & 0 deletions .ai/skills/saucebase-frontend-development/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions .ai/skills/saucebase-testing/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
/auth.json

/node_modules
# Storybook: test coverage and the static build
/coverage
/storage/storybook
/public/build
/public/hot
/public/modules
Expand Down
27 changes: 27 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <stack> --dev` writes core a `tsconfig.json` of its own
and a `node_modules` link (in `stubs/stack/<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 <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.
Expand Down
14 changes: 7 additions & 7 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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 ───────────────────────────────────────────────

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
40 changes: 24 additions & 16 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 0 additions & 31 deletions routes/navigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down