fe3644204a
Generic: Repo Health / Site Health (push) Has been skipped
Generic: Repo Health / Access control (push) Successful in 1s
Universal: Cascade Main → Dev / Cascade main → branches (push) Successful in 2s
Platform: moko-platform CI / Gate 1: Code Quality (push) Failing after 45s
Platform: moko-platform CI / Gate 2: Unit Tests (8.1) (push) Has been cancelled
Platform: moko-platform CI / Gate 2: Unit Tests (8.2) (push) Has been cancelled
Platform: moko-platform CI / Gate 2: Unit Tests (8.3) (push) Has been cancelled
Platform: moko-platform CI / Gate 3: Self-Health Check (push) Has been cancelled
Platform: moko-platform CI / Gate 4: Governance (push) Has been cancelled
Platform: moko-platform CI / Gate 5: Template Integrity (push) Has been cancelled
Platform: moko-platform CI / CI Summary (push) Has been cancelled
Generic: Repo Health / Release configuration (push) Has been cancelled
Generic: Repo Health / Scripts governance (push) Has been cancelled
Generic: Repo Health / Repository health (push) Has been cancelled
- Delete definitions/ directory (6 default + 48 sync = ~5000 lines of HCL) - Delete lib/Enterprise/DefinitionParser.php - Move manifest-schema.xsd to templates/schemas/ - Add governance.yml template for Template repos - Update RepositorySynchronizer to remove DefinitionParser dependency - Update push_files.php to detect platform from manifest.xml via API - Update auto_detect_platform.php to gracefully handle missing schema dir - Update archive_repo.php to remove sync def cleanup step Authored-by: Moko Consulting Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
103 lines
3.7 KiB
Markdown
103 lines
3.7 KiB
Markdown
# CLAUDE.md
|
|
|
|
This file provides guidance to Claude Code when working with this repository.
|
|
|
|
## Project Overview
|
|
|
|
**moko-platform** — Enterprise automation, validation, sync, and governance engine for all Moko Consulting repositories
|
|
|
|
| Field | Value |
|
|
|---|---|
|
|
| **Language** | PHP 8.1+ |
|
|
| **Default branch** | main |
|
|
| **License** | GPL-3.0-or-later |
|
|
| **Version** | 09.01.00 |
|
|
| **Wiki** | [moko-platform Wiki](https://git.mokoconsulting.tech/MokoConsulting/moko-platform/wiki) |
|
|
|
|
## Common Commands
|
|
|
|
```bash
|
|
composer install # Install PHP dependencies
|
|
php bin/moko health --path . # Run repo health check
|
|
php bin/moko check:syntax --path . # PHP syntax check
|
|
php bin/moko drift --org MokoConsulting # Scan for standards drift
|
|
php bin/moko dashboard --token $TOKEN -o dashboard.html # Generate client dashboard
|
|
|
|
# Code quality
|
|
php vendor/bin/phpcs --standard=phpcs.xml -n lib/ validate/ automation/ cli/
|
|
php vendor/bin/phpcbf --standard=phpcs.xml lib/ validate/ automation/ cli/
|
|
php vendor/bin/phpstan analyse -c phpstan.neon --memory-limit=512M
|
|
|
|
# Run all checks
|
|
composer check
|
|
```
|
|
|
|
## Architecture
|
|
|
|
### Directory Layout
|
|
|
|
| Directory | Purpose |
|
|
|-----------|---------|
|
|
| `cli/` | 32 standalone CLI tools (version, release, build, repo management) |
|
|
| `validate/` | 20 validation scripts (syntax, structure, manifests, drift) |
|
|
| `automation/` | 7 bulk operations (sync, push files, templates, cleanup) |
|
|
| `lib/Enterprise/` | Core library — CliFramework, ApiClient, adapters, validators |
|
|
| `lib/Enterprise/Plugins/` | 11 platform plugins (Joomla, Dolibarr, Node.js, Python, etc.) |
|
|
| `deploy/` | SFTP deployment scripts (Joomla, Dolibarr, health checks) |
|
|
| `templates/` | Universal templates, configs, governance schema |
|
|
| `.mokogitea/workflows/` | CI/CD workflows (Gitea Actions) |
|
|
| `bin/moko` | Unified CLI dispatcher — runs any tool via `php bin/moko <command>` |
|
|
|
|
### CLI Framework
|
|
|
|
All CLI tools extend `MokoEnterprise\CliFramework` (defined in `lib/Enterprise/CliFramework.php`).
|
|
|
|
Pattern for new tools:
|
|
```php
|
|
class MyTool extends CliFramework {
|
|
protected function configure(): void {
|
|
$this->setDescription('What this tool does');
|
|
$this->addArgument('--name', 'Description', 'default');
|
|
}
|
|
protected function run(): int {
|
|
$name = $this->getArgument('--name');
|
|
// ... business logic ...
|
|
return 0;
|
|
}
|
|
}
|
|
$app = new MyTool();
|
|
exit($app->execute());
|
|
```
|
|
|
|
Built-in flags: `--help`, `--verbose`, `--quiet`, `--dry-run`
|
|
|
|
### Platform Adapters
|
|
|
|
Git operations are abstracted via `GitPlatformAdapter` interface:
|
|
- `MokoGiteaAdapter` — for git.mokoconsulting.tech (primary)
|
|
- `GitHubAdapter` — for github.com mirrors
|
|
|
|
### Plugin System
|
|
|
|
Platform-specific logic lives in `lib/Enterprise/Plugins/`. Each plugin implements `ProjectPluginInterface` with methods for health checks, validation, build commands, and config schemas.
|
|
|
|
## Code Quality
|
|
|
|
| Tool | Level | Config |
|
|
|------|-------|--------|
|
|
| PHPCS | PSR-12 (errors only) | `phpcs.xml` |
|
|
| PHPStan | Level 2 | `phpstan.neon` |
|
|
|
|
PHPStan runs with `--memory-limit=512M` due to large codebase. CI enforces PHPCS errors; PHPStan is advisory (`continue-on-error`).
|
|
|
|
## Rules
|
|
|
|
- **Workflow directory**: `.mokogitea/` (not `.gitea/` or `.github/`)
|
|
- **Never commit** `.claude/`, `.mcp.json`, `TODO.md`, or `*.min.css`/`*.min.js`
|
|
- **Attribution**: use `Authored-by: Moko Consulting` in commits
|
|
- **Branch strategy**: develop on `dev`, merge to `main` for release
|
|
- **Minification**: handled at build time (CI) and runtime (MokoMinifyHelper for Joomla templates)
|
|
- **Wiki**: documentation lives in the Gitea wiki, not in `docs/` files
|
|
- **New CLI tools**: extend `CliFramework`, not `CLIApp` (legacy)
|
|
- **After adding a CLI tool**: register it in `bin/moko` COMMAND_MAP
|