Skip to content

Commit 1d02d20

Browse files
committed
Clarify CommitVigil scope
1 parent 22f8608 commit 1d02d20

4 files changed

Lines changed: 76 additions & 71 deletions

File tree

README.md

Lines changed: 70 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -3,96 +3,102 @@
33
[![CI](https://github.com/daretechie/CommitVigil/actions/workflows/ci.yml/badge.svg)](https://github.com/daretechie/CommitVigil/actions/workflows/ci.yml)
44
![Python](https://img.shields.io/badge/python-3.12%2B-blue)
55

6-
> GitHub webhook listener that monitors commits and pull requests for risky patterns,
7-
> evaluates developer commitments against actual delivery, and sends Slack alerts on violations.
6+
> FastAPI lab for extracting commitments from chat and Git commit text, with Slack/reporting components, PostgreSQL, Redis, background workers, and Prometheus metrics.
87
9-
---
8+
## Problem
109

11-
## What It Does
10+
Teams often make commitments in chat, commit messages, or review comments, but those commitments are hard to track later. This project explores a small service that extracts structured commitment records and connects them to reporting and feedback workflows.
1211

13-
CommitVigil sits between your GitHub repository and your team's Slack channel. It:
12+
This is an application/backend lab, not a lead DevOps portfolio project.
1413

15-
1. **Receives GitHub webhook events** — push, pull_request, commit comment
16-
2. **Scans for risky patterns**:
17-
- Direct pushes to `main`/`master` without a PR
18-
- Unusually large diffs (configurable threshold)
19-
- Commit messages containing secret-like strings
20-
- Soft commitments ("I'll fix this later", "TODO: refactor") tracked against follow-through
21-
3. **Scores and classifies** the event using structured LLM extraction (Instructor + Pydantic)
22-
4. **Sends a Slack alert** with the violation type, commit author, and diff link
14+
## Current Scope
2315

24-
---
16+
Implemented or represented in the repo:
2517

26-
## Architecture
18+
- FastAPI app with versioned API routing.
19+
- `/ingest/raw` endpoint for extracting commitments from raw text.
20+
- `/ingest/git` endpoint for extracting commitments from Git commit messages.
21+
- API-key protection and request rate limiting.
22+
- PostgreSQL, Redis, worker, and Prometheus services in Docker Compose.
23+
- Structured logging and basic health checks.
24+
- Tests for API, worker, database, Slack, reports, safety, and performance paths.
2725

28-
```
29-
GitHub Repository
30-
└── Webhook (push / pull_request events)
31-
└── CommitVigil API (FastAPI)
32-
├── Ingest: validates HMAC signature → queues job (ARQ + Redis)
33-
├── Worker: pattern scan → LLM evaluation → risk score
34-
│ ├── Direct-push detector
35-
│ ├── Large-diff detector (threshold: configurable)
36-
│ └── Secret-pattern regex scan
37-
└── Alert dispatcher → Slack Incoming Webhook
38-
```
26+
Not currently proven in this README:
27+
28+
- GitHub webhook HMAC validation.
29+
- Direct-push detection.
30+
- Large-diff analysis from real GitHub payloads.
31+
- Production Slack alert screenshots.
32+
- End-to-end deployment evidence.
3933

40-
**Async processing:** Events are acknowledged immediately (200 OK) and processed by an ARQ background worker — GitHub's 10-second timeout is never a concern.
34+
Those should be added before presenting this as a GitHub security or DevOps control.
4135

42-
---
36+
## Architecture
37+
38+
```text
39+
Client / script
40+
-> CommitVigil API (FastAPI)
41+
-> ingestion endpoint
42+
-> commitment extraction
43+
-> database / reporting paths
44+
-> optional Slack or report output
45+
46+
Docker Compose
47+
-> api
48+
-> worker
49+
-> redis
50+
-> postgres
51+
-> prometheus
52+
```
4353

4454
## Tech Stack
4555

4656
| Layer | Technology |
4757
|---|---|
48-
| API | FastAPI (Python 3.12+) |
49-
| Background jobs | ARQ (async Redis queue) |
50-
| LLM extraction | Instructor + Pydantic |
51-
| Database | PostgreSQL |
52-
| Cache / queue | Redis |
53-
| Observability | Prometheus + Structlog |
54-
55-
---
58+
| API | FastAPI, Python 3.12 |
59+
| Background jobs | ARQ, Redis |
60+
| Database | PostgreSQL, SQLModel/Alembic |
61+
| Reporting / templates | Jinja2 |
62+
| Observability | Prometheus, structured logging |
63+
| Testing | pytest, pytest-asyncio, httpx |
5664

5765
## Quick Start
5866

5967
```bash
6068
git clone https://github.com/darestack/CommitVigil.git
6169
cd CommitVigil
62-
cp .env.example .env # add GITHUB_WEBHOOK_SECRET and SLACK_WEBHOOK_URL
70+
cp .env.example .env
6371
docker compose up -d
6472
```
6573

66-
**Configure GitHub webhook:**
67-
1. Repo → Settings → Webhooks → Add webhook
68-
2. Payload URL: `https://your-domain/api/v1/ingest/raw`
69-
3. Content type: `application/json`
70-
4. Secret: the value from your `.env`
71-
5. Events: Push + Pull requests
72-
73-
---
74-
75-
## Example Alert
74+
API:
7675

77-
```
78-
⚠️ CommitVigil Alert
79-
Repo: darestack/my-service
80-
Author: daretechie
81-
Event: Direct push to main (no PR)
82-
Commit: a3f9c12 — "hotfix: temp disable auth check"
83-
Risk: HIGH — bypassed code review + suspicious message pattern
84-
Link: https://github.com/darestack/my-service/commit/a3f9c12
76+
```text
77+
http://localhost:8000
78+
http://localhost:8000/docs
79+
http://localhost:8000/health
8580
```
8681

87-
---
82+
## Main Endpoints
8883

89-
## Configuration
84+
| Endpoint | Purpose |
85+
|---|---|
86+
| `POST /api/v1/ingest/raw` | Extract a structured commitment from raw chat-style text |
87+
| `POST /api/v1/ingest/git` | Extract a structured commitment from a Git commit message |
88+
| `GET /health` | Check API, database, and Redis status |
89+
| `GET /metrics` | Prometheus metrics, protected by API key |
9090

91-
| Variable | Purpose |
91+
## Evidence To Add
92+
93+
| Evidence | Status |
9294
|---|---|
93-
| `GITHUB_WEBHOOK_SECRET` | HMAC secret for validating GitHub payloads |
94-
| `SLACK_WEBHOOK_URL` | Incoming webhook URL for Slack alerts |
95-
| `LARGE_DIFF_THRESHOLD` | Line count triggering large-diff alert (default: 500) |
96-
| `DATABASE_URL` | PostgreSQL connection string |
97-
| `REDIS_URL` | Redis connection string |
98-
| `GROQ_API_KEY` / `OPENAI_API_KEY` | LLM provider key |
95+
| CI run screenshot | Needed |
96+
| Example request and response | Needed |
97+
| Prometheus metrics screenshot | Needed |
98+
| Worker log showing async processing | Needed |
99+
| Slack/report output screenshot | Needed before alerting claims |
100+
| GitHub webhook fixture and HMAC test | Needed before webhook/security claims |
101+
102+
## Portfolio Note
103+
104+
This repo should stay unpinned until the README, product scope, and proof artifacts are tighter. If it is kept public, frame it as a backend/automation lab rather than a production DevOps security system.

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[tool.poetry]
22
name = "commitvigil"
33
version = "0.1.0"
4-
description = "CommitVigil is a standalone, AI-powered service designed to enforce human commitments and behavioral accountability."
4+
description = "FastAPI lab for extracting commitments from chat and Git commit text."
55
license = "MIT"
66
authors = ["daretechie <deeprince2020@gmail.com>"]
77
readme = "README.md"
@@ -86,4 +86,3 @@ exclude = ["migrations/", "tests/"]
8686
[tool.bandit]
8787
exclude_dirs = ["tests", "migrations"]
8888
tests = ["B201", "B301"]
89-

src/api/v1/ingestion.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,18 @@ class GitCommitInbound(BaseModel):
2222
)
2323
async def ingest_raw_commitment(user_id: str, raw_text: str):
2424
"""
25-
Elite Feature: Extract structured commitment record from raw Slack/Discord text.
25+
Extract a structured commitment record from raw chat text.
2626
"""
2727
extractor = CommitmentExtractor()
2828

2929
extracted = await extractor.parse_conversation(raw_text)
3030

31-
# Hash identity for Privacy-Preserving Logging
31+
# Hash identity before logging.
3232
identity_hash = (
3333
hashlib.sha256(extracted.who.encode()).hexdigest()[:12] if extracted.who else "none"
3434
)
3535

36-
# Audit: In a full production system, we would persist this to a 'tasks' table.
36+
# In a full workflow, this would be persisted to a tasks table.
3737
logger.info(
3838
"commitment_extracted",
3939
user_id=user_id,
@@ -55,7 +55,7 @@ async def ingest_raw_commitment(user_id: str, raw_text: str):
5555
)
5656
async def ingest_git_commitment(commit_data: GitCommitInbound):
5757
"""
58-
Advanced GitOps Feature: Extract commitments directly from Git Commit Messages.
58+
Extract commitments from Git commit messages.
5959
"""
6060
extractor = CommitmentExtractor()
6161
author_email = commit_data.author_email

src/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ async def dispatch(self, request: Request, call_next) -> Response:
5252
@asynccontextmanager
5353
async def lifespan(fastapi_app: FastAPI): # noqa: ARG001
5454
"""
55-
Modern lifespan management for Enterprise FastAPI apps.
55+
Lifespan management for the FastAPI app.
5656
Handles startup and shutdown logic.
5757
"""
5858
logger.info("application_startup", status="initializing_resources")

0 commit comments

Comments
 (0)