mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-10-17 16:03:06 +00:00
* fix: serve getJob in the ai evals benchmark api catalog Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore: scope the frontend format hook to the frontend dir Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * fix: answer the run-by-path endpoints and mirror the real getJob entry Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * fix: gate the format hook on a repo-root frontend, not the project dir Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
30 lines
1.2 KiB
Bash
Executable File
30 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
# Format frontend files with prettier after Claude edits them
|
|
|
|
# Get the file path from the tool result (passed via stdin as JSON)
|
|
INPUT=$(cat)
|
|
FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // empty')
|
|
|
|
# Exit if no file path
|
|
if [ -z "$FILE_PATH" ]; then
|
|
exit 0
|
|
fi
|
|
|
|
# Only the frontend app itself, i.e. a "frontend" directory sitting at a repo root.
|
|
# A bare */frontend/* substring also matches ai_evals/adapters/frontend and the
|
|
# ai_evals app fixtures, which no prettier config governs — prettier then falls back
|
|
# to its defaults and rewrites the whole file. Anchoring to $CLAUDE_PROJECT_DIR
|
|
# instead would skip worktrees edited from a session rooted elsewhere.
|
|
if [[ "$FILE_PATH" == *"/frontend/"* ]] && [[ -e "${FILE_PATH%%/frontend/*}/.git" ]]; then
|
|
# Check if it's a formattable file type
|
|
if [[ "$FILE_PATH" =~ \.(ts|js|svelte|json|css|html|md)$ ]]; then
|
|
cd "$CLAUDE_PROJECT_DIR/frontend" || exit 0
|
|
# Run prettier, surface errors as context but don't block Claude
|
|
if ./node_modules/.bin/prettier --plugin prettier-plugin-svelte --write "$FILE_PATH" 2>&1; then
|
|
echo "Formatted $(basename "$FILE_PATH")"
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
exit 0
|