feat: add architecture_review tool handler
This commit is contained in:
+23
-39
@@ -7,11 +7,11 @@ ChatGPT MCP Server
|
||||
## Status
|
||||
|
||||
Planning complete.
|
||||
Phase 0 complete. Phase 1 complete. Phase 2 complete. Phase 3 complete. Task 4.1 complete. Task 4.2 complete. Task 4.3 complete. Task 4.4 complete.
|
||||
Phase 0 complete. Phase 1 complete. Phase 2 complete. Phase 3 complete. Task 4.1 complete. Task 4.2 complete. Task 4.3 complete. Task 4.4 complete. Task 4.5 complete. Phase 4 complete.
|
||||
|
||||
## Current Phase
|
||||
|
||||
Phase 4 - Tool Handlers
|
||||
Phase 5 - MCP Server and Tool Registration
|
||||
|
||||
## Completed Tasks
|
||||
|
||||
@@ -35,6 +35,7 @@ Phase 4 - Tool Handlers
|
||||
- Task 4.2 — review_plan MCP tool handler (`src/tools/review-plan.js`, `test/tools/review-plan.test.js`) ✅
|
||||
- Task 4.3 — review_code MCP tool handler (`src/tools/review-code.js`, `test/tools/review-code.test.js`) ✅
|
||||
- Task 4.4 — debug_issue tool handler (`src/tools/debug-issue.js`, `test/tools/debug-issue.test.js`) ✅
|
||||
- Task 4.5 — architecture_review tool handler (`src/tools/architecture-review.js`, `test/tools/architecture-review.test.js`) ✅
|
||||
|
||||
## Phase 3 Completion Summary
|
||||
|
||||
@@ -58,46 +59,29 @@ Phase 3 — Tool Inputs and Prompts — is now complete.
|
||||
- No MCP tool registration.
|
||||
- No tool handlers.
|
||||
|
||||
## Completed Tasks (Phase 4)
|
||||
## Phase 4 Completion Summary — Tool Handlers ✅
|
||||
|
||||
### Task 4.1 — ask_chatgpt MCP Tool Handler ✅
|
||||
All five tool handlers are implemented and tested:
|
||||
|
||||
Implemented `src/tools/ask-chatgpt.js` with dependency-injected handler and 27 orchestration-only tests in `test/tools/ask-chatgpt.test.js`.
|
||||
| # | 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 |
|
||||
|
||||
**Key design decisions:**
|
||||
- Execution order: validate → loadConfig → checkContextBudget → buildAskChatGptPrompt → createOpenAIClient → sendOpenAIResponse
|
||||
- All external deps injected (loadConfig, createOpenAIClient, sendOpenAIResponse); internal utilities imported directly
|
||||
- OpenAI errors pass through `String(err)` unchanged — no wrapping or reformatting
|
||||
- Budget check short-circuits before prompt building or client creation
|
||||
- Every path returns structured `{ ok, answer|error, warnings }` — never throws to caller
|
||||
- 27 tests covering: success path, validation failure, config failure, budget failure, client creation failure, OpenAI failure, dependency call order, error handling for null/string throws, warning propagation, result shape, and short-circuit behavior
|
||||
**What Phase 4 established:**
|
||||
|
||||
### Task 4.2 — review_plan MCP Tool Handler ✅
|
||||
- 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.
|
||||
|
||||
Implemented `src/tools/review-plan.js` with dependency-injected handler and 28 orchestration-only tests in `test/tools/review-plan.test.js`.
|
||||
**What Phase 4 did NOT do:**
|
||||
|
||||
**Key design decisions:**
|
||||
- Execution order: validate → loadConfig → checkContextBudget → buildReviewPlanPrompt → createOpenAIClient → sendOpenAIResponse
|
||||
- All external deps injected (loadConfig, createOpenAIClient, sendOpenAIResponse); internal utilities imported directly
|
||||
- OpenAI errors pass through `String(err)` unchanged — no wrapping or reformatting
|
||||
- Budget check short-circuits before prompt building or client creation
|
||||
- Every path returns structured `{ ok, answer|error, warnings }` — never throws to caller
|
||||
- 28 tests mirroring 4.1 structure with one additional test verifying buildReviewPlanPrompt is called with budget.input
|
||||
|
||||
**Task 4.3 — review_code MCP Tool Handler ✅**
|
||||
|
||||
Implemented `src/tools/review-code.js` with dependency-injected handler and 28 orchestration-only tests in `test/tools/review-code.test.js`.
|
||||
|
||||
**Key design decisions:**
|
||||
- Execution order: validate → loadConfig → checkContextBudget → buildReviewCodePrompt → createOpenAIClient → sendOpenAIResponse
|
||||
- All external deps injected (loadConfig, createOpenAIClient, sendOpenAIResponse); internal utilities imported directly
|
||||
- OpenAI errors pass through `String(err)` unchanged — no wrapping or reformatting
|
||||
- Budget check short-circuits before prompt building or client creation
|
||||
- Every path returns structured `{ ok, answer|error, warnings }` — never throws to caller
|
||||
- 28 tests mirroring 4.1/4.2 structure with one test verifying buildReviewCodePrompt is called with budget.input
|
||||
|
||||
**Next pending task:**
|
||||
- Task 4.5 — architecture_review tool handler (`src/tools/architecture-review.js`, `test/tools/architecture-review.test.js`)
|
||||
|
||||
**Not done yet (Phase 4):**
|
||||
- No MCP tool registration
|
||||
- No MCP tool registration yet.
|
||||
- No server or router code yet.
|
||||
- That belongs to Phase 5.
|
||||
|
||||
Reference in New Issue
Block a user