Context
The MCP tool loopover_explain_review_risk (src/mcp/server.ts:2558-2565, implementation explainReviewRisk at src/mcp/server.ts:4210-4232) builds a review-risk explanation for a planned PR — the same buildPreflightResult core its sibling loopover_preflight_pr uses, plus an optional per-contributor roleContext (maintainer-lane / duplicate-risk recommendation) when contributorLogin is supplied. loopover_preflight_pr already has both a REST route (POST /v1/preflight/pr, src/api/routes.ts:3536) and a CLI mirror — loopover_explain_review_risk has neither, despite sharing the same preflightShape input contract (src/mcp/server.ts:327-336).
Requirements
- Add
POST /v1/preflight/review-risk in src/api/routes.ts, following POST /v1/preflight/pr's exact validation/response pattern (same preflightSchema/PREFLIGHT_LIMITS), but returning explainReviewRisk's richer payload (preflight, roleContext, recommendation) instead of the bare preflight result.
- Add a CLI mirror (
maintain explain-review-risk or the equivalent registerStdioTool entry in packages/loopover-mcp/bin/loopover-mcp.js, following the CLI mirror already shipped for loopover_preflight_pr).
contributorLogin stays optional in both the route and CLI mirror, matching the MCP tool's own optional-role-context behavior (src/mcp/server.ts:4211).
Deliverables
Test Coverage Requirements
99%+ Codecov patch coverage on every changed line and branch in the new route/CLI code, plus the parity test above.
Expected Outcome
loopover_explain_review_risk is reachable over REST and CLI, matching every other MCP tool in the "review" category.
Links & Resources
Precedent: POST /v1/preflight/pr (src/api/routes.ts:3536) and its CLI mirror — the sibling route/CLI pair using the identical preflightShape input contract.
Context
The MCP tool
loopover_explain_review_risk(src/mcp/server.ts:2558-2565, implementationexplainReviewRiskatsrc/mcp/server.ts:4210-4232) builds a review-risk explanation for a planned PR — the samebuildPreflightResultcore its siblingloopover_preflight_pruses, plus an optional per-contributorroleContext(maintainer-lane / duplicate-risk recommendation) whencontributorLoginis supplied.loopover_preflight_pralready has both a REST route (POST /v1/preflight/pr,src/api/routes.ts:3536) and a CLI mirror —loopover_explain_review_riskhas neither, despite sharing the samepreflightShapeinput contract (src/mcp/server.ts:327-336).Requirements
POST /v1/preflight/review-riskinsrc/api/routes.ts, followingPOST /v1/preflight/pr's exact validation/response pattern (samepreflightSchema/PREFLIGHT_LIMITS), but returningexplainReviewRisk's richer payload (preflight,roleContext,recommendation) instead of the bare preflight result.maintain explain-review-riskor the equivalentregisterStdioToolentry inpackages/loopover-mcp/bin/loopover-mcp.js, following the CLI mirror already shipped forloopover_preflight_pr).contributorLoginstays optional in both the route and CLI mirror, matching the MCP tool's own optional-role-context behavior (src/mcp/server.ts:4211).Deliverables
POST /v1/preflight/review-riskroutecontributorLogin)Test Coverage Requirements
99%+ Codecov patch coverage on every changed line and branch in the new route/CLI code, plus the parity test above.
Expected Outcome
loopover_explain_review_riskis reachable over REST and CLI, matching every other MCP tool in the "review" category.Links & Resources
Precedent:
POST /v1/preflight/pr(src/api/routes.ts:3536) and its CLI mirror — the sibling route/CLI pair using the identicalpreflightShapeinput contract.