🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
chore: Simplify pre-commit output (#17349)
Ben Bachemc83949f3a143
diff --git a/.husky/pre-commit b/.husky/pre-commitindex 592340d1ec..1219bd50f5 100755--- a/.husky/pre-commit+++ b/.husky/pre-commit@@ -6,13 +6,35 @@ current_branch=$(git rev-parse --abbrev-ref HEAD)# Define the protected branchprotected_branch="main"+echo "Running pre-commit checks..."++run_check() {+ label="$1"+ shift+ start_time=$(node -p "Date.now()")++ if output=$("$@" 2>&1); then+ elapsed_ms=$(($(node -p "Date.now()") - start_time))+ printf '%s passed in %d.%03ds.\n' "$label" "$((elapsed_ms / 1000))" "$((elapsed_ms % 1000))"+ else+ printf '%s\n' "$output"+ elapsed_ms=$(($(node -p "Date.now()") - start_time))+ printf '%s failed after %d.%03ds.\n' "$label" "$((elapsed_ms / 1000))" "$((elapsed_ms % 1000))"+ return 1+ fi+}++run_format_check() {+ run_check "Formatting" pnpm run format:check+}+run_lint() {if [ -n "${LANGFUSE_PRE_COMMIT_SKIP_LINT-}" ]; thenecho "Skipping lint because LANGFUSE_PRE_COMMIT_SKIP_LINT is set."return 0fi- pnpm run lint --filter=!ai-gateway+ run_check "Lint" pnpm run lint --filter=!ai-gateway}# Check if the current branch is the protected branch@@ -21,7 +43,7 @@ if [ "$current_branch" = "$protected_branch" ]; thenread -r answer </dev/ttyif [ "$answer" != "${answer#[Yy]}" ]; then# Commit approved, run checks- pnpm run format:check+ run_format_checkrun_lintelseecho "Commit to $protected_branch branch has been canceled."@@ -30,5 +52,5 @@ if [ "$current_branch" = "$protected_branch" ]; thenfi# If not the protected branch, run checks-pnpm run format:check+run_format_checkrun_lint