feat: add review_plan tool handler

This commit is contained in:
2026-06-12 08:02:06 +01:00
parent 3eedcfa559
commit 4c3776e2ce
5 changed files with 525 additions and 3 deletions
+30
View File
@@ -314,6 +314,36 @@ Create `src/tools/ask-chatgpt.js` and `test/tools/ask-chatgpt.test.js`.
Status: ✅ Complete
### Task 4.2 - review_plan MCP tool handler
Create `src/tools/review-plan.js` and `test/tools/review-plan.test.js`.
**Requirements:**
- Export `handleReviewPlan(input, deps)` as standalone dependency-injected function.
- Execution order: validateToolInput → loadConfig → checkContextBudget → buildReviewPlanPrompt → createOpenAIClient → sendOpenAIResponse.
- Inject only 3 external deps: `loadConfig`, `createOpenAIClient`, `sendOpenAIResponse`. Internal utilities imported directly.
- If budget check fails (`ok: false`), immediately return that result — do not call buildReviewPlanPrompt or create client.
- All paths return structured `{ ok, answer|error, warnings }` — never throws to caller.
- OpenAI errors pass through `String(err)` unchanged (no wrapping/reformatting).
- Mirror 4.1 structure: ~28 orchestration-only tests covering the same test categories (success path, validation failure, config failure, budget failure, client creation failure, OpenAI failure, dependency call order, buildReviewPlanPrompt integration, no throws escaping, warning propagation, result shape, short-circuit behavior).
Status: ✅ Complete
### Task 4.3 - review_code tool handler (NEXT)
Create `src/tools/review-code.js` and `test/tools/review-code.test.js`.
**Requirements:**
- Export `handleReviewCode(input, deps)` as standalone dependency-injected function.
- Execution order: validateToolInput → loadConfig → checkContextBudget → buildReviewCodePrompt → createOpenAIClient → sendOpenAIResponse.
- Inject only 3 external deps: `loadConfig`, `createOpenAIClient`, `sendOpenAIResponse`. Internal utilities imported directly.
- If budget check fails (`ok: false`), immediately return that result — do not call buildReviewCodePrompt or create client.
- All paths return structured `{ ok, answer|error, warnings }` — never throws to caller.
- OpenAI errors pass through `String(err)` unchanged (no wrapping/reformatting).
- Mirror 4.1 and 4.2 structure: ~28 orchestration-only tests covering the same test categories.
Status: ⬜ Pending
---
Phase 2 complete. Phase 3 complete. Phase 4 next: Tool Handlers.