Skip to content
Draft

V2 #15

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .claude/hooks/post-edit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/usr/bin/env bash
# PostToolUse hook (Edit|Write). Three jobs on TS/JS files:
# 1. Auto-format the file Claude just wrote with oxfmt (import + tailwind sort
# come from .oxfmtrc.json).
# 2. Lint it (oxlint, per-file) and type-check the owning project (tsc) — in
# parallel, so the per-edit cost is max(lint, tsc), not their sum.
# 3. Surface any problems back to Claude via exit 2 (stderr → model feedback).
# Exit 0 is silent. tsc type-checks the whole project on every TS edit (a few
# seconds) — that's the immediate-feedback tradeoff; scope it down if it drags.
set -uo pipefail

file=$(jq -r '.tool_input.file_path // empty' 2>/dev/null)
cd "${CLAUDE_PROJECT_DIR:-.}" || exit 0

case "$file" in
*.ts | *.tsx | *.js | *.jsx) ;;
*) exit 0 ;;
esac

# 1. Format Claude's output.
pn exec oxfmt "$file" >/dev/null 2>&1 || true

# Pick the tsconfig that actually covers the edited file. scripts/ is its own
# project (excluded from the root tsconfig); everything else is the root config.
case "$file" in
"$PWD"/scripts/* | scripts/*) tsc_args="-p scripts --noEmit" ;;
*) tsc_args="--noEmit" ;;
esac

# 2. Lint the file + type-check the project, concurrently.
lint_out=$(mktemp)
type_out=$(mktemp)
trap 'rm -f "$lint_out" "$type_out"' EXIT
pn exec oxlint "$file" >"$lint_out" 2>&1 &
lint_pid=$!
# shellcheck disable=SC2086 # tsc_args is intentionally word-split.
pn exec tsc $tsc_args >"$type_out" 2>&1 &
type_pid=$!
wait "$lint_pid"
lint_rc=$?
wait "$type_pid"
type_rc=$?

# 3. Report failures.
if [ "$lint_rc" -ne 0 ] || [ "$type_rc" -ne 0 ]; then
{
if [ "$lint_rc" -ne 0 ]; then
echo "── oxlint ($file) ──"
cat "$lint_out"
fi
if [ "$type_rc" -ne 0 ]; then
echo "── tsc $tsc_args ──"
grep -E 'error TS' "$type_out" | head -40
fi
} >&2
exit 2
fi
exit 0
18 changes: 12 additions & 6 deletions .claude/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@
"permissions": {
"allow": [
"WebSearch",
"Bash(bun run typecheck:*)",
"Bash(bun run build:*)",
"Bash(bun run check:*)",
"Bash(bun run test:*)",
"Bash(bun run db:migrate:local:*)"
"Bash(mise run typecheck:*)",
"Bash(mise run lint:*)",
"Bash(mise run fmt:check:*)",
"Bash(mise run verify:*)",
"Bash(mise run db:migrate:local:*)",
"Bash(pnpm exec tsc:*)",
"Bash(pnpm exec oxlint:*)",
"Bash(pnpm exec oxfmt:*)"
]
},
"hooks": {
Expand All @@ -16,10 +19,13 @@
"hooks": [
{
"type": "command",
"command": "bun run check && bun run typecheck"
"command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/post-edit.sh\""
}
]
}
]
},
"enabledPlugins": {
"cloudflare@cloudflare": true
}
}
133 changes: 0 additions & 133 deletions .claude/skills/api-route/SKILL.md

This file was deleted.

77 changes: 0 additions & 77 deletions .claude/skills/shadcn/SKILL.md

This file was deleted.

Loading