Files
watermarks-remover/.gitignore
T
a3b414654f feat: add pre-commit hook integration for staged-file checking/cleaning (#138)
CI gating for AI provenance marks already exists (audit_dir.py's -j
concurrency + SARIF export from #101), but that only runs after a
marked file has already been committed and pushed. Catch it at commit
time instead, using git's own hook point.

Adds two hooks via .pre-commit-hooks.yaml:
- watermarks-remover-check: fails the commit and lists findings when
  staged files carry AI/C2PA marks. Wraps audit_lib.scan_file() /
  is_actionable() -- the exact per-file logic audit_dir.py already
  uses for CI, so the pre-commit gate and the CI gate agree on what
  counts as actionable.
- watermarks-remover-clean (opt-in): rewrites staged files in place by
  shelling out to clean_file.py --in-place per file (no duplicated
  cleaning logic), then exits 1 so the developer reviews the diff and
  re-stages -- the same convention as auto-fixing hooks like ruff --fix.

.pre-commit-hooks.yaml needed an explicit allow-rule in the deny-by-
default .gitignore, same as every other root-level config file already
listed there.

Closes #135

Co-authored-by: Guillaume Meyer (The Opinionated Man) <1385518+guillaumemeyer@users.noreply.github.com>
2026-08-18 07:26:58 -07:00

41 lines
702 B
Plaintext

# Deny by default: only what is explicitly allowed below can be added to git.
# Local test artifacts, secrets (.env), and tooling stay out without a rule
# for each one. Tracked files are unaffected.
/*
!/.github/
!/.github/**
!/docs/
!/docs/**
!/service/
!/service/**
!/skills/remove-ai-marks/
!/skills/remove-ai-marks/**
!/tests/
!/tests/**
!/.dockerignore
!/.env.example
!/.gitignore
!/.pre-commit-hooks.yaml
!/CODE_OF_CONDUCT.md
!/compose-check.sh
!/compose.yaml
!/CONTRIBUTING.md
!/LICENSE
!/Makefile
!/pytest.ini
!/README.md
!/requirements-dev.txt
!/ruff.toml
!/SECURITY.md
# Exceptions even inside allowed trees
.env
**/__pycache__/
*.pyc
.venv/
.firecrawl/
.figlet/
posts.md
*.cleaned.*
*.bak