Add POST /api/semantic-diff endpoint for AI-powered code change explanations

Uses Anthropic claude-sonnet-4-6 server-side to explain the semantic meaning
of code diffs in the budget app domain (paychecks, bills, financing, actuals).
Input validation rejects empty or oversized (>50KB) diffs. Tests mock the
Anthropic client via direct method replacement (same pattern as db.pool.query).

Nightshift-Task: semantic-diff
Nightshift-Ref: https://github.com/marcus/nightshift
This commit is contained in:
2026-03-20 01:53:45 -04:00
parent ccd0fb2155
commit 5c5c777837
6 changed files with 183 additions and 0 deletions

View File

@@ -9,6 +9,7 @@
"test:watch": "vitest"
},
"dependencies": {
"@anthropic-ai/sdk": "^0.80.0",
"cors": "^2.8.5",
"dotenv": "^16.4.5",
"express": "^4.19.2",