This document provides essential information for agentic coding agents working on the Kompass CMS repository.
- Install Dependencies:
composer install - Database Migrations:
php artisan migrate - Run Tests: No dedicated test suite found in
tests/, but Laravel standard isphp artisan testorvendor/bin/phpunit. - Run Single Test:
php artisan test --filter NameOfTest - Linting/Static Analysis: Rector is configured. Run
vendor/bin/rector process. - Clear Cache:
php artisan optimize:clear
- Install Dependencies:
bun install(preferred based onbun.lock) oryarn install. - Development:
npm run dev(starts Vite withAPP_URL='localhost:5088'). - Build Assets:
npm run build - Vite Preview:
npm run preview
- Namespace:
Secondnetwork\Kompass\...(mapped tosrc/). - Laravel Version: Targets Laravel 11/12+ features.
- Naming Conventions:
- Classes: PascalCase (e.g.,
PagesTable,KompassServiceProvider). - Methods: camelCase (e.g.,
addPage,registerGates). - Models: Singular PascalCase (e.g.,
Page,Post,Datafield). - Tables: Plural snake_case (e.g.,
pages,blocks).
- Classes: PascalCase (e.g.,
- Type Hinting: Use strict typing where possible (e.g.,
public function boot(): void). - Error Handling: Use Laravel's exception handling and validation rules in Livewire components (e.g.,
$this->validate()). - Dependencies: TALL stack (Tailwind, Alpine, Laravel, Livewire). Proactively use Livewire 4.0 attributes like
#[Locked]and#[Layout].
- Service Providers:
src/KompassServiceProvider.phphandles most component registrations and boot logic. - Morph Maps: Important for polymorphic relations (Page, Post, Datafield) are defined in the Service Provider.
- Livewire Components: Located in
src/Livewire/. Controllers are insrc/Http/Controllers/. - Helper Functions: Custom helpers are in
src/Helpers/and auto-loaded by the Service Provider.
- CSS Framework: Tailwind CSS 4.0 (oxide engine).
- UI Components: Uses Preline UI and DaisyUI.
- Vite: Configured to build assets into
public/assets/build.
src/: Main package logic (PSR-4Secondnetwork\Kompass\).resources/views/: Blade templates (prefixed withkompass::).src/database/migrations/: Migration files.stubs/: Default application files published during installation.
- No Secrets: Never hardcode API keys or credentials.
- Cache: Flush cache in Model boot methods (creating/updating/deleting) as seen in
Page.php. - Slugs: Use
Illuminate\Support\Str::slugfor URL generation. - Assets: When modifying frontend assets, ensure
npm run buildis executed.