feat: add architecture_review tool handler

This commit is contained in:
2026-06-12 10:06:30 +01:00
parent fe2192ec7c
commit 867bc4860c
5 changed files with 599 additions and 52 deletions
+31 -2
View File
@@ -372,8 +372,37 @@ Create `src/tools/architecture-review.js` and `test/tools/architecture-review.te
- OpenAI errors pass through `String(err)` unchanged (no wrapping/reformatting).
- Mirror 4.1/4.2/4.3/4.4 structure: ~28 orchestration-only tests covering the same test categories.
Status: ⬜ Pending
Status: ✅ Complete
### Task 4.6 — Phase 4 completion summary
**Phase 4 — Tool Handlers** is now complete.
All five tool handlers are implemented and tested:
| # | Handler | File | Tests |
|---|---------|------|-------|
| 1 | `handleAskChatGpt` | `src/tools/ask-chatgpt.js` | ✅ 27 |
| 2 | `handleReviewPlan` | `src/tools/review-plan.js` | ✅ 28 |
| 3 | `handleReviewCode` | `src/tools/review-code.js` | ✅ 28 |
| 4 | `handleDebugIssue` | `src/tools/debug-issue.js` | ✅ 28 |
| 5 | `handleArchitectureReview` | `src/tools/architecture-review.js` | ✅ 28 |
**What Phase 4 established:**
- Five standalone, dependency-injected handlers following the same orchestration pattern: validate → config → budget → prompt → client → response.
- All external deps injected (loadConfig, createOpenAIClient, sendOpenAIResponse); internal utilities imported directly.
- Every handler returns structured `{ ok, answer|error, warnings }` — never throws to caller.
- Budget check short-circuits before prompt building or client creation.
- OpenAI errors pass through `String(err)` unchanged — no wrapping or reformatting.
- 139 orchestration-only tests covering success, validation failure, config failure, budget failure, client failure, OpenAI failure, call order, prompt integration, throws escaping, warnings, result shape, and short-circuit behavior.
**What Phase 4 did NOT do:**
- No MCP tool registration yet.
- No server or router code yet.
- That belongs to Phase 5.
---
Phase 2 complete. Phase 3 complete. Phase 4 next: Tool Handlers.
Phase 2 complete. Phase 3 complete. Phase 4 complete. Phase 5 next: MCP Server and Tool Registration.