mapfile + array prevents word-splitting issues with filenames
containing spaces or other shell-special characters. Affects both
the affected-files listing and the stale-index safety check.
Without this fix, a filename like 'My Module.php' would be split
into 'My' and 'Module.php', causing the disk-existence check to
look for wrong paths.
Erweitert den Husky pre-commit-Hook um einen PHPUnit-Schritt.
Ausserdem wird scripts/safe-commit.sh aktualisiert, damit das
Safety-Net dieselbe Logik wie der Hook verwendet (kein doppelter Code).
Vorher: Hook rief nur 'npx lint-staged' auf.
Nachher: Hook ruft scripts/pre-commit-checks.sh auf, das
- lint-staged ausfuehrt (unveraendert)
- PHPUnit nur dann ausfuehrt, wenn PHP-relevante Dateien
gestaged sind (Performance-Optimierung: Issue #67 Anforderung)
- Bei Test-Fehler den Commit mit Exit-Code 1 abbricht
Closes#67
Extrahiert die Pre-Commit-Checks (lint-staged + PHPUnit) in ein
gemeinsames Script, das sowohl vom Husky-Hook (.husky/pre-commit)
als auch von scripts/safe-commit.sh aufgerufen wird.
Logik:
- lint-staged laeuft immer (HTML/CSS/JS/JSON/MD/PHP-Syntax)
- PHPUnit laeuft nur, wenn PHP-relevante Dateien gestaged sind
(*.php, phpunit.xml, composer.json, composer.lock)
- Safety-Check: alle gestaged PHP-Dateien muessen auf Disk existieren
- Bei Test-Fehler wird der Commit mit Exit-Code != 0 abgebrochen
- Composer-Deps werden nur bei Bedarf installiert (Cache-Hit)
- Add PHP syntax check to lint-staged via scripts/lint-php.sh
- Add lint:php script to package.json
- Update lint script to include PHP checks
- Create scripts/safe-commit.sh for AI agent use
- Update deploy-test.yml: lint jobs as gate before deploy
- Add branch protection for main requiring status checks
- Update AGENTS.md with pre-commit hook rules for agents
Also addresses #53: CI requires lint checks before merge
Co-authored-by: Claw <claw@openclaw.local>