Files
cline/sdk/examples/hooks/PreToolUse_RequireReview.sh
T
Renee Huangandabeatrix e215d3d91c chore: rename example folders; fix references (#60)
* rename folders

* fix examples reorg references

* move over files

* having agent fixing and validating all examples are still working

* fix sidecar paths

---------

Co-authored-by: abeatrix <beatrix@cline.bot>
2026-05-07 20:38:04 -07:00

20 lines
642 B
Bash
Executable File

#!/usr/bin/env bash
# Cline Hook: PreToolUse (Require Review)
# Pauses for review before writing to critical files
# Copy to ~/.cline/hooks/PreToolUse.sh and chmod +x
input=$(cat)
tool=$(echo "$input" | jq -r '.tool_call.name // ""')
file=$(echo "$input" | jq -r '.tool_call.input.filePath // ""')
# Require review for critical files
if [ "$tool" = "editor" ] || [ "$tool" = "write_file" ]; then
if [[ $file =~ (package\.json|tsconfig|\.env|secrets|config\.(ts|js)|\.cline) ]]; then
jq -n --arg file "$file" '{review: true, context: "This will modify a critical file: \($file)"}'
exit 0
fi
fi
# Allow everything else
echo '{}'