From 2efeb1b82c686000ecc4f75332b82fbec4bb797b Mon Sep 17 00:00:00 2001 From: 7000pctAUTO Date: Mon, 2 Feb 2026 20:50:55 +0000 Subject: [PATCH] Initial upload: Code Privacy Shield v0.1.0 --- examples/pre-commit-hook.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 examples/pre-commit-hook.sh diff --git a/examples/pre-commit-hook.sh b/examples/pre-commit-hook.sh new file mode 100644 index 0000000..c23d51c --- /dev/null +++ b/examples/pre-commit-hook.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# Pre-commit hook for Code Privacy Shield +# Add this to .git/hooks/pre-commit + +set -e + +# Find the project root +ROOT_DIR="$(git rev-parse --show-toplevel)" + +# Check if CPS is available +if command -v cps &> /dev/null; then + echo "Running Code Privacy Shield check..." + + # Check staged Python files + FILES=$(git diff --cached --name-only -- '*.py' '*.js' '*.ts' '*.json' '*.yaml' '*.yml' 2>/dev/null || true) + + if [ -n "$FILES" ]; then + # Preview what would be redacted + echo "$FILES" | xargs -I {} sh -c 'echo "Checking {}"; cps preview "{}" 2>/dev/null || true' + fi +fi + +exit 0