diff --git a/.cursor/hooks.json b/.cursor/hooks.json new file mode 100644 index 000000000..93b1c827b --- /dev/null +++ b/.cursor/hooks.json @@ -0,0 +1,16 @@ +{ + "version": 1, + "hooks": { + "afterFileEdit": [ + { + "command": "./hooks/lint-file.sh" + } + ], + "stop": [ + { + "command": "./hooks/stop-check.sh" + } + ] + } +} + diff --git a/.cursor/hooks/lint-file.sh b/.cursor/hooks/lint-file.sh new file mode 100755 index 000000000..72c08d60d --- /dev/null +++ b/.cursor/hooks/lint-file.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# Cursor hook: afterFileEdit +# Runs lint --fix on JS/TS files after they are edited by the agent + +# Read JSON input from stdin +input=$(cat) + +# Extract file_path from the input +file_path=$(echo "$input" | jq -r '.file_path') + +# If file is a JS/TS file, run lint --fix on it +if [[ "$file_path" =~ \.(js|jsx|ts|tsx)$ ]]; then + pnpm run lint --fix "$file_path" || true +fi + +exit 0 + + diff --git a/.cursor/hooks/stop-check.sh b/.cursor/hooks/stop-check.sh new file mode 100755 index 000000000..f68ecf8be --- /dev/null +++ b/.cursor/hooks/stop-check.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# Cursor hook: stop +# Runs typecheck and lint when the agent loop ends + +# Read JSON input from stdin (contains status and loop_count) +input=$(cat) + +# Check if this is a repeated stop hook call (loop_count > 0) +# to prevent infinite loops +loop_count=$(echo "$input" | jq -r '.loop_count // 0') +if [[ "$loop_count" -gt 0 ]]; then + exit 0 +fi + +# Run typecheck and lint +pnpm run typecheck 1>&2 || exit 2 +pnpm run lint 1>&2 || exit 2 + +exit 0 + + diff --git a/.gitignore b/.gitignore index ce1a7c8f6..065772ac1 100644 --- a/.gitignore +++ b/.gitignore @@ -56,9 +56,6 @@ dist # Jetbrains .idea -# Cursor -.cursor - # GitHub Actions runner /actions-runner /_work diff --git a/examples/lovable-react-18-example/.cursor/mcp.json b/examples/lovable-react-18-example/.cursor/mcp.json new file mode 100644 index 000000000..0d45da732 --- /dev/null +++ b/examples/lovable-react-18-example/.cursor/mcp.json @@ -0,0 +1,7 @@ +{ + "mcpServers": { + "stack-auth": { + "url": "https://mcp.stack-auth.com/" + } + } +}