A Git pre-commit hook has been installed to automatically run npm run build on the frontend before each commit. This ensures TypeScript compilation errors are caught before code is committed.
When you run git commit, the hook will:
- ✅ Check if any files in
src/frontend/have been modified - ✅ If frontend files changed, run
npm run buildinsrc/frontend/ - ✅ If build succeeds, allow the commit to proceed
- ❌ If build fails, block the commit and show the error
- Catches TypeScript errors early - No more committing code with type errors
- Ensures code quality - Only compilable code gets committed
- Saves time - Prevents broken builds from reaching the repository
- Smart - Only runs when frontend files are actually changed
$ git commit -m "Update team selector"
🔍 Running pre-commit checks...
📦 Frontend files changed, running build...
🔨 Building frontend...
> Multi Agent frontend@0.1.0 build
> tsc && vite build
✓ 2487 modules transformed.
✓ built in 4.77s
✅ Frontend build successful!
✅ Pre-commit checks passed!
[main abc1234] Update team selector
2 files changed, 10 insertions(+), 5 deletions(-)$ git commit -m "Update backend routes"
🔍 Running pre-commit checks...
ℹ️ No frontend changes detected, skipping build.
✅ Pre-commit checks passed!
[main def5678] Update backend routes
1 file changed, 5 insertions(+), 2 deletions(-)$ git commit -m "Add new feature"
🔍 Running pre-commit checks...
📦 Frontend files changed, running build...
🔨 Building frontend...
> Multi Agent frontend@0.1.0 build
> tsc && vite build
src/pages/PlanPage.tsx:123:45 - error TS2339: Property 'foo' does not exist...
❌ Frontend build failed! Please fix the errors before committing.If you absolutely need to commit without running the build (not recommended), you can use:
git commit --no-verify -m "Your message"--no-verify in emergencies. It defeats the purpose of the hook.
The hook is located at: .git/hooks/pre-commit
-
Check if the hook file exists:
ls -la .git/hooks/pre-commit
-
Check if it's executable:
chmod +x .git/hooks/pre-commit
The build typically takes 4-5 seconds. If it's taking longer:
- Check if
node_modulesis up to date:cd src/frontend && npm install - Clear the build cache:
rm -rf src/frontend/build
If you need to disable the hook temporarily:
# Rename the hook
mv .git/hooks/pre-commit .git/hooks/pre-commit.disabled
# To re-enable
mv .git/hooks/pre-commit.disabled .git/hooks/pre-commitNote: Git hooks are not committed to the repository. Each team member needs to set up the hook manually.
To set up on a new machine:
- Copy the hook script from this README
- Save it to
.git/hooks/pre-commit - Make it executable:
chmod +x .git/hooks/pre-commit
Or use the setup script (if created):
./setup-git-hooks.sh