Skip to content

A full-featured CRM built with React, shadcn/ui, and Supabase.

Fix formatting issues in AI generated code

François Zaninotto98e29ff0b46e
diff --git a/.claude/hooks/format-file.sh b/.claude/hooks/format-file.sh
new file mode 100755
index 00000000..7a15d869
--- /dev/null
+++ b/.claude/hooks/format-file.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+# Hook input is provided on stdin as JSON by Claude Code
+input=$(cat)
+
+# Extract file path from the tool_input
+file_path=$(node -e "const i=JSON.parse(process.argv[1]);console.log((i.tool_input&&(i.tool_input.file_path||i.tool_input.notebook_path))||'')" "$input")
+
+# Only format files with supported extensions
+if echo "$file_path" | grep -qE '\.(ts|tsx|js|jsx|json|css|md|html)$'; then
+ npx prettier --write "$file_path"
+fi
diff --git a/.claude/settings.json b/.claude/settings.json
new file mode 100644
index 00000000..be252a3d
--- /dev/null
+++ b/.claude/settings.json
@@ -0,0 +1,16 @@
+{
+ "hooks": {
+ "PostToolUse": [
+ {
+ "matcher": "Edit|Write|NotebookEdit",
+ "hooks": [
+ {
+ "type": "command",
+ "command": "bash .claude/hooks/format-file.sh",
+ "timeout": 30
+ }
+ ]
+ }
+ ]
+ }
+}