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)
Neue Gitea-CI-Pipeline analog zur bestehenden lint.yml:
- Trigger auf push und pull_request
- Installiert PHP + Composer + Extensions (xml, mbstring)
- Fuehrt 'composer install' und 'vendor/bin/phpunit' aus
- 18 Tests / 31 Assertions gruen
The JS had a dangling document.getElementById('contactForm') call that
did nothing - no event handler attached, no return value used.
Form handling is entirely server-side (PHP POST → redirect to #form-result).
No JS form intervention needed.
Closes#58
- 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>
2026-05-22 07:25:57 +00:00
14 changed files with 282 additions and 29 deletions
# Run pre-commit checks manually as a safety net (in case hook is skipped)
# Same logic as .husky/pre-commit, just in case the hook is bypassed.
./scripts/pre-commit-checks.sh
# Commit with hooks enabled (no --no-verify)
git commit -m "$MSG"
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.