docs: add Claude AI assistant rules and configuration
All checks were successful
CVE Scan & Docker Build / security-scan (push) Successful in 45s
CVE Scan & Docker Build / build-and-push (push) Successful in 1m53s

Add comprehensive rule documentation for AI-assisted development covering
authentication surfaces, outbound-call safety invariants, and other project
conventions to guide Claude's understanding of critical system behaviors.
This commit is contained in:
2026-07-28 19:01:38 -04:00
parent 016d8be71d
commit 4a3c14d4af
40 changed files with 2851 additions and 202 deletions

View File

@@ -1,12 +1,12 @@
"""
API Dependencies — Shared dependency injection for all routes.
Auth is not here: the owner gate lives in `auth.py` (`get_current_owner` /
`OwnerUser`), applied as a router-level dependency in main.py.
"""
import secrets
from fastapi import HTTPException, Request
from fastapi import Header, HTTPException, Query, Request
from config import get_settings
from core.gateway import AIPSTNGateway
@@ -24,31 +24,3 @@ def get_routing_service(request: Request):
if routing is None:
raise HTTPException(status_code=503, detail="Routing service not ready")
return routing
def require_token(
authorization: str | None = Header(default=None),
token: str | None = Query(default=None),
) -> None:
"""
Enforce the static bearer token (API_TOKEN) on REST routes.
A `token` query parameter is accepted alongside the Authorization
header for clients that can't set headers — <audio>/<a> elements
fetching recordings — matching the WebSocket convention.
An empty configured token disables auth; startup refuses that
combination unless the server is bound to loopback.
"""
expected = get_settings().api_token.get_secret_value()
if not expected:
return
supplied = token or ""
if authorization and authorization.lower().startswith("bearer "):
supplied = authorization[7:]
if not secrets.compare_digest(supplied, expected):
raise HTTPException(
status_code=401,
detail="Missing or invalid bearer token",
headers={"WWW-Authenticate": "Bearer"},
)