post-edit-format
Run best-effort formatter after edits.
hook
PostToolUse
github-copilot
config/hook-registry.json (entry) hooks/auto-format.sh
Run best-effort formatter after edits.
Registry Entry
Section titled “Registry Entry”| Field | Value |
|---|---|
| id | post-edit-format |
| logical_event | PostToolUse |
| matcher | Edit|Write|MultiEdit|edit|create|write_file|replace |
| command | ./hooks/auto-format.sh |
| timeout | 30 |
| harnesses | ["github-copilot"] |
Full hook config + command reference
{ "id": "post-edit-format", "description": "Run best-effort formatter after edits.", "logical_event": "PostToolUse", "matcher": "Edit|Write|MultiEdit|edit|create|write_file|replace", "command": "./hooks/auto-format.sh", "timeout": 30, "harnesses": [ "github-copilot" ]}#!/bin/bashcommand -v jq &>/dev/null || exit 0INPUT=$(cat)FILE_PATH=$(echo "$INPUT" | jq -r ' .tool_input.file_path // ( (.toolArgs | fromjson? // .toolArgs // {}) | if type == "object" then (.filePath // .path // .target_file // empty) else empty end ) // empty')[ -z "$FILE_PATH" ] || [ ! -f "$FILE_PATH" ] && exit 0
case "${FILE_PATH##*.}" in py) if [ -f "pyproject.toml" ] && command -v uv &>/dev/null; then uv run ruff format "$FILE_PATH" 2>/dev/null elif command -v ruff &>/dev/null; then ruff format "$FILE_PATH" 2>/dev/null fi ;; js|jsx|ts|tsx|css|scss|html|json|yaml|yml) if [ -f "node_modules/.bin/prettier" ]; then node_modules/.bin/prettier --write "$FILE_PATH" 2>/dev/null elif command -v prettier &>/dev/null; then prettier --write "$FILE_PATH" 2>/dev/null fi ;; rs) command -v rustfmt &>/dev/null && rustfmt "$FILE_PATH" 2>/dev/null ;; go) command -v gofmt &>/dev/null && gofmt -w "$FILE_PATH" 2>/dev/null ;;esacexit 0Resources
Section titled “Resources” Hooks Hub All repo-managed lifecycle hooks.
wagents hooks Inspect and validate hooks via CLI.