From 533fd3a94f8fbe50d953e2e91a1e71e33fcbaa4b Mon Sep 17 00:00:00 2001 From: lexx Date: Fri, 6 Nov 2026 14:00:00 +0200 Subject: [PATCH 1/3] Chore: enable re-skills Claude Code plugins at project scope Shared project settings now only enable plugins from the re-skills marketplace. Personal permissions belong in .claude/settings.local.json, which is now gitignored. Co-Authored-By: Claude Opus 5.5 --- .claude/settings.json | 46 ++++++++----------------------------------- .gitignore | 2 ++ 2 files changed, 10 insertions(+), 38 deletions(-) diff --git a/.claude/settings.json b/.claude/settings.json index 0d322e8..47fd5ba 100644 --- a/.claude/settings.json +++ b/.claude/settings.json @@ -1,41 +1,11 @@ { - "permissions": { - "allow": [ - "Bash(find /home/konstantinos/Projects/RadicalElements/boboko-core/docs/scratch -iname \"*cart*\" 2>/dev/null; find /home/konstantinos/Projects/RadicalElements -iname \"*cart-feature*\" -o -iname \"*feature-survey*\" 2>/dev/null)", - "Read(//home/konstantinos/Projects/RadicalElements/**)", - "Bash(find /home/konstantinos/Projects/RadicalElements/3dealer -path \"*config/lunar/payments.php\" 2>/dev/null; find /home/konstantinos/Projects/RadicalElements -maxdepth 4 -iname \"*stripe*\" -type d 2>/dev/null)", - "Bash(grep -n 'process\\(\\\\|->using\\\\|\\\\$data' /home/konstantinos/Projects/RadicalElements/boboko-core/vendor/filament/actions/src/CreateAction.php)", - "Bash(php -l src/Order/Commands/CloseExpiredReturnWindows.php)", - "Bash(php -l config/core.php)", - "Bash(./bin/dc-core.sh exec *)", - "Bash(php -l src/Shipping/Extensions/OrderViewExtension.php)", - "Bash(php -l src/Cart/Filament/Resources/CartResource/Pages/ViewCart.php)", - "Bash(./bin/dc-core.sh exec app php artisan tinker '--execute= *)", - "Bash(mkdir -p /home/konstantinos/Projects/RadicalElements/boboko-core/src/Cart/Http/Controllers)", - "Bash(rmdir /home/konstantinos/Projects/RadicalElements/boboko-core/src/Checkout/routes)", - "Bash(mkdir -p /home/konstantinos/Projects/RadicalElements/boboko-core/src/Checkout/routes)", - "Bash(php -l src/Cart/Http/Controllers/CartController.php)", - "Bash(php -l src/Checkout/Http/Controllers/CheckoutController.php)", - "Bash(php -l src/Providers/CheckoutModuleServiceProvider.php)", - "Bash(php -l src/Providers/CheckoutServiceProvider.php)", - "Bash(php -l src/Checkout/routes/checkout.php)", - "Bash(php -l config/checkout.php)", - "Bash(cp /home/konstantinos/Projects/RadicalElements/3dealer/resources/css/checkout.css /home/konstantinos/Projects/RadicalElements/boboko-core/resources/css/)", - "Bash(cp /home/konstantinos/Projects/RadicalElements/3dealer/resources/js/checkout/*.js /home/konstantinos/Projects/RadicalElements/boboko-core/resources/js/checkout/)", - "Bash(rm /home/konstantinos/Projects/RadicalElements/3dealer/app/Providers/CheckoutModuleServiceProvider.php)", - "Bash(rm -rf /home/konstantinos/Projects/RadicalElements/3dealer/app/Http/Controllers/Checkout)", - "Bash(rm /home/konstantinos/Projects/RadicalElements/3dealer/routes/checkout.php)", - "Bash(rm -rf /home/konstantinos/Projects/RadicalElements/3dealer/resources/js/checkout)", - "Bash(rm /home/konstantinos/Projects/RadicalElements/3dealer/resources/css/checkout.css)", - "Bash(composer dump-autoload *)", - "Bash(curl -s -o /tmp/checkout_test.html -w \"%{http_code}\\\\n\" http://localhost:8091/en/checkout)", - "Read(//tmp/**)", - "Bash(curl -s -o /tmp/home_test.html -w \"%{http_code}\\\\n\" http://localhost:8091/en/)", - "Bash(php -l bootstrap/providers.php)" - ], - "additionalDirectories": [ - "/home/konstantinos/Projects/RadicalElements/3dealer/bootstrap", - "/home/konstantinos/Projects/RadicalElements/3dealer/config" - ] + "extraKnownMarketplaces": { + "re-skills": { + "source": { "source": "git", "url": "git@code.radical-elements.com:radical/re-skills.git" }, + "autoUpdate": true + } + }, + "enabledPlugins": { + "engineering@re-skills": true } } diff --git a/.gitignore b/.gitignore index 539c2bd..e09a831 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,5 @@ yarn-error.log .idea .vscode *.log + +.claude/settings.local.json From 32475b63bd39db2e926709286e9a4193b4b49527 Mon Sep 17 00:00:00 2001 From: lexx Date: Fri, 6 Nov 2026 15:57:38 +0200 Subject: [PATCH 2/3] Docs: describe the core-mode pre-commit guard Co-Authored-By: Claude Opus 5.5 --- CONTRIBUTE.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTE.md b/CONTRIBUTE.md index 02872c3..6323bb1 100644 --- a/CONTRIBUTE.md +++ b/CONTRIBUTE.md @@ -38,7 +38,9 @@ bin/core-mode repo # back to tagged releases It swaps the `composer.json` / `package.json` wiring, runs `down` with the old mode's Compose wrapper and `up` with the new one, then waits until the entrypoints have re-resolved core. Running it for the mode you're already in skips the edits and just restarts the stack — in repo mode, that's how you pick up a newly pushed tag. -(`3dealer` has `bin/core-mode` and `bin/deploy`; they're app-agnostic, so other consumer apps can copy them as-is.) +**Pre-commit guard.** The first time you run `bin/core-mode local` or `repo`, it sets `git config core.hooksPath .githooks`. That turns on a pre-commit hook (`bin/check-core-mode`) that blocks any commit with local-mode `composer.json`, `package.json` or either lockfile staged. You can keep working in local mode and commit everything else: just leave those four files unstaged (`git restore --staged composer.json composer.lock package.json package-lock.json`). If you already use a custom `core.hooksPath`, `core-mode` leaves it alone and warns you. In that case, call `bin/check-core-mode` from your own hook. + +(`3dealer` has `bin/core-mode`, `bin/check-core-mode`, `.githooks/` and `bin/deploy`; they're app-agnostic, so other consumer apps can copy them as-is.) ### Day to day in local mode From 79e7e9b4fd80204eb1dcd8e0aabe745eab0b8ddc Mon Sep 17 00:00:00 2001 From: lexx Date: Fri, 6 Nov 2026 18:50:42 +0200 Subject: [PATCH 3/3] Docs: fix stale localization, module and contributing docs - localization.md: the label seeders are StorefrontTranslationsSeeder (and the checkout/validation ones), not a StorefrontLabels class or lunar:install; when each runs (storefront isn't seeded on boot); translations:pull; examples use the same slug in every locale. - modules.md: core's JS/CSS is a real npm package (@boboko/core) with a Vite plugin, not files read from vendor/; bin/core-mode does the swap; open 0.x ranges instead of ^1.0; a real shop as the example app. - CONTRIBUTE.md, README.md: seeding on boot corrected; 0.* range. Co-Authored-By: Claude Opus 5.5 --- CONTRIBUTE.md | 2 +- README.md | 2 +- docs/localization.md | 51 ++++++++++++++++++---------- docs/modules.md | 80 ++++++++++++++------------------------------ 4 files changed, 60 insertions(+), 75 deletions(-) diff --git a/CONTRIBUTE.md b/CONTRIBUTE.md index 6323bb1..96ca5be 100644 --- a/CONTRIBUTE.md +++ b/CONTRIBUTE.md @@ -108,7 +108,7 @@ export default defineConfig({ ## Translations added in the UI -Default translation lines ship in core's seeders (`StorefrontTranslationsSeeder`, `CheckoutTranslationsSeeder`, `ValidationTranslationsSeeder`), which every app runs on boot and which only ever add missing keys. Lines added while building a storefront usually start in the Filament Language Lines UI instead. To move them into core: +Default translation lines ship in core's seeders (`StorefrontTranslationsSeeder`, `CheckoutTranslationsSeeder`, `ValidationTranslationsSeeder`), which only ever add missing keys. A shop's entrypoint runs the checkout and validation seeders on every boot; `StorefrontTranslationsSeeder` currently has to be run explicitly (see `docs/localization.md`, "Seeding"). Lines added while building a storefront usually start in the Filament Language Lines UI instead. To move them into core: ```bash bin/dc-core.sh exec app php artisan boboko:translations:pull # local mode: writes into ../boboko-core diff --git a/README.md b/README.md index de58319..0d6d987 100644 --- a/README.md +++ b/README.md @@ -179,7 +179,7 @@ Add the repository to your project's `composer.json`: } ], "require": { - "boboko/core": "^1.0" + "boboko/core": "0.*" } } ``` diff --git a/docs/localization.md b/docs/localization.md index abf98c7..ba619f3 100644 --- a/docs/localization.md +++ b/docs/localization.md @@ -1,6 +1,6 @@ # Localization -Storefront routes can be locale-prefixed (`/el/proionta`, `/en/products`) using a middleware +Storefront routes can be locale-prefixed (`/el/products`, `/en/products`) using a middleware that reads directly from Lunar's `languages` table — the same table the Filament **Languages** resource manages, so there's no separate locale config to keep in sync. @@ -8,7 +8,7 @@ resource manages, so there's no separate locale config to keep in sync. ## Why prefix every locale, including the default -Leaving the default locale bare at the root (`/proionta` for Greek, `/en/products` for English) +Leaving the default locale bare at the root (`/products` for Greek, `/en/products` for English) creates ambiguity: is `/` the language-neutral homepage or specifically the Greek version? It also complicates `hreflang` (needs a self-referencing tag on the root plus a possibly-duplicate `x-default`) and risks duplicate content if a bot or campaign link reaches the root without a @@ -17,6 +17,11 @@ language signal. Prefixing every locale avoids this: every URL unambiguously declares its language, `hreflang` tags are symmetrical, and adding a locale later requires no URL restructuring. + +**Slugs are the same in every locale** (`/el/products/…` and `/en/products/…`, never +`/el/proionta/…`). Only the visible content is translated. Boboko shops don't use per-locale +slugs. + --- ## Opt-in, not global @@ -30,8 +35,8 @@ use Illuminate\Support\Facades\Route; Route::middleware('locale')->group(function () { Route::get('/{locale}', HomeController::class); - Route::get('/{locale}/proionta', ProductIndexController::class); - Route::get('/{locale}/proionta/{slug}', ProductShowController::class); + Route::get('/{locale}/products', ProductIndexController::class); + Route::get('/{locale}/products/{slug}', ProductShowController::class); }); ``` @@ -198,21 +203,31 @@ registered. ### Seeding -A starter set of common e-shop labels (`nav.*`, `cart.*`, `product.*`, `auth.*`, `search.*`, -`review.*`, `shop.*`, `pagination.*`, English + Greek) lives in -`Modules\Core\Localization\Services\StorefrontLabels::all()` — kept as its own class, separate -from the seeding logic, so the label list can be scanned/diffed without wading through the -seeding mechanics. +The default labels for every shop (`nav.*`, `footer.*`, `cart.*`, `product.*`, `shop.*`, +`search.*`, `auth.*`, `account.*`, `orders.*`, `contact.*`, `review.*`, `wishlist.*`, +`pagination.*`, English + Greek) live in +`Modules\Core\Localization\Database\Seeders\StorefrontTranslationsSeeder::lines()`. Checkout and +validation messages have their own seeders (`Modules\Core\Checkout\Database\Seeders\CheckoutTranslationsSeeder`, +`Modules\Core\Localization\Database\Seeders\ValidationTranslationsSeeder`). -`Modules\Core\Command\InstallLunarCommand` (overrides Lunar's own `lunar:install`) seeds them via -a **per-key upsert**, not an all-or-nothing "only seed if the group is empty" guard: a key already -present in the database — including one an admin has since edited via the Filament **Language -Lines** resource — is left untouched; only keys missing entirely are created. This is what makes -it safe to add new keys to `StorefrontLabels::all()` later and re-run `lunar:install` on an -already-installed store, without either silently skipping the new keys (the old guard's behavior) -or reverting an admin's edits back to the hardcoded default (what a naive `updateOrCreate` would -do). New writes go through `TranslationService::create()`, so the usual cache-invalidation and -activity-log events fire for them too. +The seeders are **additive per key**: a key already in the database, including one an admin has +since edited in the Filament **Language Lines** resource, is left untouched; only missing keys +are created. That makes it safe to add keys to a seeder later and re-run it on an installed store, +without skipping the new keys or reverting an admin's edits. New lines go through +`TranslationService::create()`, so the usual cache-invalidation and activity-log events fire. + +**When they run:** a shop's `docker/entrypoint.sh` runs the checkout and validation seeders on +every boot. `StorefrontTranslationsSeeder` isn't run automatically (not by `lunar:install`, not on +boot), so run it explicitly after a core update that adds keys, or add it to the shop's +entrypoint: + +```bash +php artisan db:seed --class="Modules\Core\Localization\Database\Seeders\StorefrontTranslationsSeeder" +``` + +**Lines added in the admin** while building a storefront are copied back into the seeders with +`php artisan boboko:translations:pull` (local mode; see `CONTRIBUTE.md`, "Translations added in +the UI"). A key that exists only in one shop's database shows as a raw key everywhere else. ### Admin UI diff --git a/docs/modules.md b/docs/modules.md index 8a44d8d..17ce6b3 100644 --- a/docs/modules.md +++ b/docs/modules.md @@ -42,10 +42,10 @@ boboko-core/ (this repo) Stoic/ ``` -The e-shop app (`boboko-test`) consumes it as `vendor/boboko/core`: +A shop app (e.g. `3dealer`) consumes it as `vendor/boboko/core`: ``` -boboko-test/ +my-shop/ app/ Models/ Customer.php ← app-level model, extends Modules\Core\Customer\Models\Customer @@ -75,7 +75,7 @@ Within a module, organise by concern rather than by type (`Auth/`, `Customer/`, ```json "require": { - "boboko/core": "^1.0" + "boboko/core": "0.*" }, "repositories": [ { @@ -99,7 +99,12 @@ This is the **default** — a fresh `composer install` never depends on a local ] ``` -This is a **manual, deliberate swap** of `composer.json` — not automated, since Composer has no clean built-in mechanism to merge an additional repository on top of the main list per-environment (`composer.local.json` is not auto-merged in Composer 2.x; `COMPOSER_REPOSITORIES` does not merge either — both were tested and ruled out). Swap it back to `vcs` before committing, so CI/prod builds never require `../boboko-core` to exist. +Don't swap it by hand: each shop's `bin/core-mode local` / `bin/core-mode repo` does it (and the +`package.json` side), restarts the stack, and turns on a pre-commit guard; see `CONTRIBUTE.md`. +It's a swap rather than an overlay because Composer has no clean built-in mechanism to merge an additional repository on top of the main list per-environment (`composer.local.json` is not auto-merged in Composer 2.x; `COMPOSER_REPOSITORIES` does not merge either — both were tested and ruled out). The committed state is always the `vcs` form, so CI/prod builds never require `../boboko-core` to exist. + +Below 1.0, shops require core with an open range (`0.*` in Composer, `#semver:0.x` in npm), never +a caret: `^0.31.0` means `<0.32.0` and would silently refuse the next minor. ### Docker Compose: the local-core mount @@ -124,58 +129,23 @@ Docker Compose merges `volumes:` lists additively across `-f` files, so the over ## Frontend Assets (JS/CSS) -A module's JS (Stimulus controllers) and CSS ship as plain source files under `resources/js/` and `resources/css/` — **there is no separate npm package per module.** A module is never `npm install`ed; its frontend assets are read directly by the consuming app's own Vite build, straight out of `vendor/boboko/`. +A module's Stimulus controllers and CSS ship as a **real npm package** (`@boboko/core`), +installed into the consumer's `node_modules`: a symlink to `../boboko-core` in local mode +(`file:../boboko-core`), a real copy of the tagged release in repo mode +(`git+https://…#semver:0.x`). It's a package rather than files read out of `vendor/` so npm +installs core's own JS dependencies (`leaflet`, `@hotwired/stimulus`) transitively, the same way +Composer does for PHP. -This mirrors the PHP story above exactly: Composer already gives every environment one single, unconditional path — `vendor/boboko/` — whether that resolves to a symlink into a sibling checkout (local path repo) or a real installed copy (tagged VCS release). A consumer's `vite.config.js` and JS entry point read from that same path, so there is nothing to toggle on the JS side — whatever Composer resolved is exactly what Vite sees, in both dev and prod, automatically. +- **One stable entry point:** consumers import only from the `@boboko/core` barrel + (`resources/js/index.js`, e.g. `import { registerCheckout, registerWishlist } from "@boboko/core"`), + never from a module's internal files, so the internal layout can change freely. +- **CSS:** `node_modules/@boboko/core/resources/css/…` in the consumer's Vite inputs and `@vite()` + (core's structural checkout CSS loads before the app's own, so the app's theming wins). +- **Vite:** the consumer adds the `boboko()` plugin from `@boboko/core/vite-plugin`. It owns the + settings the local-mode symlink needs (no stale pre-bundle, symlink-safe resolution, HMR on core + edits), so consumers don't copy them. -**Each module exposes one stable JS entry point** — `resources/js/index.js` — that re-exports whatever a consumer needs, e.g. `boboko-core`'s: - -```js -// boboko-core/resources/js/index.js -export { registerCheckout } from './checkout/index.js' -``` - -A consuming app imports from that one file only, never from a path reaching into a module's internal folder structure directly: - -```js -// consumer app's resources/js/app.js -import { registerCheckout } from "../../vendor/boboko/core/resources/js/index.js"; -registerCheckout(application); -``` - -```php -{{-- consumer app's layout --}} -@vite(['vendor/boboko/core/resources/css/checkout.css', 'resources/css/app.css', 'resources/js/app.js']) -``` - -This keeps a module's internal file layout free to change without breaking every consumer's entry point — the same reasoning as PSR-4 namespaces for PHP, just for JS imports. - -**A consuming app's `vite.config.js` needs one addition**, because `vendor/boboko/` is a symlink in local path-repo dev (not a real directory Vite would otherwise watch through): - -```js -export default defineConfig({ - server: { - watch: { - // vendor/boboko/ is a symlink into ../boboko- in - // local path-repo dev. Vite/chokidar don't follow symlinks for - // watched files by default, so edits to a module's source - // wouldn't otherwise trigger HMR. No-op against a real installed - // copy (tagged VCS release) in production. - followSymlinks: true, - }, - }, -}); -``` - -Bare imports inside a module's own JS (e.g. `leaflet`, `@hotwired/stimulus`) resolve against the **consumer's** `node_modules` via Node's normal upward resolution walk from `vendor/boboko//resources/js/...` — no extra config needed, as long as `vendor/boboko/` sits inside the consumer's own directory tree (true for both the symlink and real-copy case). The consumer's Vite Docker service (if any) needs the same bind mount the PHP containers already get, landing at the equivalent path relative to its own working directory: - -```yaml -# consumer app's docker-compose.core-dev.yml -services: - vite: - volumes: - - ../boboko-core:/app/vendor/boboko/core # match /app to the vite service's actual workdir -``` +Full details and the export map: `CONTRIBUTE.md`, "JS/CSS: a real npm package". --- @@ -190,7 +160,7 @@ services: "type": "library", "version": "1.0.0", "require": { - "boboko/core": "^1.0" + "boboko/core": "0.*" }, "autoload": { "psr-4": {