mirror of
https://github.com/Dasemu/Synapse.git
synced 2026-11-26 23:36:20 +00:00
Add root CLAUDE.md, LESSONS.md, .env.example, .claude/settings.json hooks (PostToolUse lint, Stop lint+test via bb dev:lint-and-test), and a .gitea/workflows/ci.yml lint+test workflow. No development branch exists here, so CI targets main; version.yml automation is skipped since this repo already has its own tag-driven release/version flow (scripts/bump-version.sh, build.yml on v* tags). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
30 lines
889 B
Bash
Executable File
30 lines
889 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# PostToolUse hook: lint/format the file that was just edited or written.
|
|
# Reads the hook JSON payload from stdin and dispatches by extension.
|
|
# Best-effort: missing tooling is reported but never blocks the edit.
|
|
set -u
|
|
|
|
payload="$(cat)"
|
|
file_path="$(printf '%s' "$payload" | sed -n 's/.*"file_path"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' | head -n1)"
|
|
|
|
[ -z "$file_path" ] && exit 0
|
|
[ -f "$file_path" ] || exit 0
|
|
|
|
repo_root="$(cd "$(dirname "$0")/../.." && pwd)"
|
|
cd "$repo_root" || exit 0
|
|
|
|
case "$file_path" in
|
|
*.clj|*.cljs|*.cljc)
|
|
if command -v clojure >/dev/null 2>&1; then
|
|
clojure -M:clj-kondo --lint "$file_path" --cache false || true
|
|
fi
|
|
;;
|
|
libs/*.ts|libs/*.tsx|libs/*.js)
|
|
if [ -f "libs/node_modules/.bin/prettier" ]; then
|
|
(cd libs && node_modules/.bin/prettier --write "${file_path#libs/}") || true
|
|
fi
|
|
;;
|
|
esac
|
|
|
|
exit 0
|