Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 14 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Normalise text in the repository, let Git pick the working-copy ending.
* text=auto

# Shell scripts and Git hooks MUST keep LF endings. A hook checked out with
# CRLF fails at exec time with "bad interpreter: /bin/sh^M", including under
# Git for Windows and WSL.
*.sh text eol=lf
hooks/pre-commit text eol=lf

# Python stays LF for consistency across platforms.
*.py text eol=lf

# Documentation.
*.md text
57 changes: 57 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: CI

on:
push:
branches: [main]
pull_request:

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.10", "3.12"]

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: pip install -r requirements.txt

- name: Unit tests
run: python -m unittest discover -s tests -v

- name: Hook must fail open without credentials
shell: bash
env:
ANTHROPIC_API_KEY: ""
run: |
# No key configured: the engine must allow the commit, not block it.
git config user.email ci@example.com
git config user.name CI
cp examples/transaction_fault_unsafe.py payment_service.py
git add payment_service.py
python sentinel.py
echo "exit=$? (0 required: fail open)"

- name: Mock verdict drives both demo scenarios
shell: bash
env:
SENTINEL_MOCK: "1"
run: |
git reset
cp examples/transaction_fault_unsafe.py payment_service.py
git add payment_service.py
if python sentinel.py; then
echo "::error::unsafe diff was not blocked"; exit 1
fi
git reset
cp examples/transaction_fault_safe.py payment_service.py
git add payment_service.py
python sentinel.py || { echo "::error::safe diff was blocked"; exit 1; }
21 changes: 21 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Python
__pycache__/
*.py[cod]
*.egg-info/
.pytest_cache/

# Virtual environments
venv/
.venv/
env/

# Secrets - never commit an API key
.env
.env.*
!.env.example

# Editors / OS
.vscode/
.idea/
.DS_Store
Thumbs.db
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 SentinelCommit contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading
Loading