feat: add zen_review and zen_review_resume MCP tools#8
Merged
Conversation
Extract worktree creation logic into shared internal/review package used by both CLI and MCP server. The review package accepts a Logger parameter so MCP callers pass nil to avoid stdout pollution over stdio. Also: - Add ensureClaudeCommand to auto-install /review-pr before sessions - Use exec.CommandContext with 2m timeout on git subprocesses - Export RemoveStaleLock and use it instead of unconditional os.Remove
This was referenced Apr 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Add two new MCP tools (
zen_review,zen_review_resume) and extract PR review worktree creation into a sharedinternal/reviewpackage.Why
The worktree creation logic was duplicated between the CLI (
cmd/review.go) and the MCP server would need its own copy. Extracting it into a shared package lets both callers reuse the same code while keeping MCP-safe (no stdout writes).Supersedes #5 with fixes for:
review.CreateWorktreeaccepts aLoggerparameter — CLI passesui.LogInfo, MCP passesnilto avoid corrupting the stdio-based MCP protocolfetch,worktree add) now useexec.CommandContextwith a 2-minute timeout, consistent with the codebase pattern established in github: add 30s timeout to all API calls #4os.Remove(lockFile)replaced withRemoveStaleLock(only removes if the holding process is dead)Notes
ensureClaudeCommand("review-pr")auto-installs the/review-prClaude command from the embedded FS before launching review sessions (bothzen reviewandzen review resume)DetectRepois the non-interactive equivalent ofdetectRepoForPR— returns an error on ambiguity instead of promptingReviewResultstruct moved fromcmd/review.gotointernal/reviewasreview.Result