Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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
8 changes: 4 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Tests

on: ['push', 'pull_request']
on: ["push", "pull_request"]

jobs:
laravel-tests:
Expand All @@ -14,7 +14,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
php-version: 8.4
tools: composer:v2
coverage: xdebug

Expand All @@ -35,8 +35,8 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
node-version: "20"
cache: "npm"
cache-dependency-path: editor/package-lock.json

- name: Install Dependencies
Expand Down
18 changes: 18 additions & 0 deletions .mcp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"mcpServers": {
"laravel-boost": {
"command": "bash",
"args": [
"-c",
"cd _api_app && php artisan mcp:start laravel-boost"
]
},
"herd": {
"command": "bash",
"args": [
"-c",
"SITE_PATH=\"$PWD/_api_app\" php /Applications/Herd.app/Contents/Resources/herd-mcp.phar"
]
}
}
}
79 changes: 79 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Project Overview

Berta is a file-based CMS (no database required for content storage). It has three distinct sub-applications that are developed and built independently:

1. **`_api_app/`** — Laravel 12 API backend (PHP 8.4+)
2. **`editor/`** — Angular 20 admin editor (TypeScript)
3. **`engine/`** — Legacy PHP rendering engine with Gulp-built assets

## Development Commands

### Laravel API (`_api_app/`)

```bash
cd _api_app
composer install
php artisan test --compact # Run all tests
php artisan test --compact --filter=TestName # Run specific test
vendor/bin/pint --dirty # Format changed PHP files
npm run dev # Vite dev server
npm run build # Build assets
```

### Angular Editor (`editor/`)

```bash
cd editor
npm install
npm run dev # Watch mode (outputs to engine/dist)
npm run build # Production build (outputs to engine/dist)
npm test # Karma/Jasmine unit tests
```

### Legacy Engine Assets (root)

```bash
npm install
npm run dev # Gulp watch (compiles Sass for themes/templates)
npm run build # Gulp production build
```

## Architecture

### How the Parts Connect

- The **Angular editor** (`editor/`) compiles into `engine/dist/` — the legacy PHP engine serves these compiled assets to the browser.
- The **Laravel API** (`_api_app/`) exposes REST endpoints consumed by the Angular editor for CMS operations (site settings, sections, media, shop).
- The **legacy PHP engine** (`engine/`) handles frontend rendering of sites using file-based XML storage. It reads `.xml` files directly from the user's site directory.
- The Angular editor's **Twig templates** are bundled at build time via `editor/copy-twig-templates.mjs` and `editor/bundle-twig-templates.js` (prebuild step), then rendered client-side using the `twig` npm package.

### Key Directories

| Path | Purpose |
| ----------------------------- | --------------------------------------------------- |
| `_api_app/app/Sites/` | Site/section/entry management domain |
| `_api_app/app/Shop/` | E-commerce plugin |
| `_api_app/app/Plugins/` | Plugin system |
| `_api_app/app/Configuration/` | App configuration classes |
| `editor/src/` | Angular source (components, state, services) |
| `engine/_classes/` | Legacy PHP classes for site rendering |
| `engine/_lib/berta/` | CSS/JS assets bundled by Gulp |
| `_themes/` | Site themes (capetown, jaipur, kyoto, madrid, etc.) |
| `_templates/` | Email/system templates with SCSS |
| `_plugin_shop/` | Shop plugin PHP files |

### State Management (Angular)

The editor uses **NGXS** for state management. State files live in `editor/src/app/**/state/` alongside their actions.

### Authentication

Laravel Sanctum handles API auth. JWT tokens (Firebase JWT) are used for certain operations.

## Laravel API Guidelines

See `_api_app/CLAUDE.md` for detailed Laravel/PHP conventions, Pest testing rules, and Laravel Boost MCP tool usage. Those guidelines apply whenever working inside `_api_app/`.
4 changes: 2 additions & 2 deletions INSTALL/includes/check.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ function getStatus($isOk, $message, $failDesc = '', $isIndented = false, $isFata
$testOutput .= '<p><strong>Is your website hosted on a suitable server?</strong></p>';

// php version ...
$isOk = version_compare(PHP_VERSION, '8.2', '>=');
$isOk = version_compare(PHP_VERSION, '8.4', '>=');
$listOk &= $isOk;
$listHasErrors |= ! $isOk;
$testOutput .= getStatus($isOk, 'Supported PHP version', 'Berta needs PHP >= 8.2 support on server. Ask your server administrator to enable supported PHP version.');
$testOutput .= getStatus($isOk, 'Supported PHP version', 'Berta needs PHP >= 8.4 support on server. Ask your server administrator to enable supported PHP version.');

// multibyte ...
$isOk = function_exists('mb_ereg_replace') && function_exists('mb_strlen') && function_exists('mb_substr');
Expand Down
2 changes: 1 addition & 1 deletion INSTALL/includes/first_visit_serverreqs.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
<div class="xMAlign-inner">
<h2>Thank you for choosing Berta.me!</h2>
<p>This server does not meet Berta's requirements.<br />
Berta needs PHP >= 8.2 support on server.</p>
Berta needs PHP >= 8.4 support on server.</p>
</div>
</div>
</div>
Expand Down
72 changes: 0 additions & 72 deletions WARP.md

This file was deleted.

Loading
Loading