Commit Graph
100 Commits
Author SHA1 Message Date
Li LiuandClaude Opus 4.7 6e31ec33ac test: drop obsolete summaries assertion after summary-step removal
The per-reviewer summary step was removed in 0f03726, dropping the
summaries field from DebateResult, but this test still asserted on it
and failed. Remove the stale assertion.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-26 14:28:30 -07:00
Li LiuandClaude Opus 4.7 f94808969f feat: add --fail-fast option to abort review/discuss on any reviewer failure
By default the orchestrator is resilient: a single reviewer (or context
gatherer) failure is logged and the round continues with the survivors,
aborting only when all reviewers fail.

The new --fail-fast flag flips to strict mode — any reviewer or
context-gathering failure re-throws immediately and terminates the
whole flow. Wired through the review and discuss commands via
OrchestratorOptions.failFast, with a regression test and README docs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-26 14:24:03 -07:00
Li LiuandClaude Opus 4.6 0f0372656d refactor: remove redundant per-reviewer summary step before final conclusion
The summarizer now generates the final conclusion directly from the full
debate conversation history, eliminating the intermediate step where each
reviewer was asked to summarize their own points. This saves one round of
API calls per reviewer without losing information.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 14:56:47 +08:00
Li LiuandClaude Opus 4.6 5ff7f2ea1a feat: add verified conclusion step that cross-checks summary against actual code
After the summarizer produces the final conclusion, a new verification step
re-examines it against the original PR diff/code to confirm correctness,
flag false positives, catch missed issues, and produce an authoritative
verified final conclusion.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 19:32:08 +08:00
Li LiuandClaude Opus 4.6 91d0b2388f feat: support specifying models for CLI providers via colon syntax
Allow CLI providers (claude-code, codex-cli, gemini-cli, qwen-code) to
accept a model override using colon syntax (e.g., `claude-code:claude-opus-4-6`).
Display the model name alongside reviewer IDs in review and discuss output.
Update default Gemini API model to gemini-3.1-pro-preview.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 18:28:24 +08:00
Li LiuandClaude Opus 4.6 62b61eb3e0 fix: handle large PR diffs that exceed GitHub's 20k line limit
gh pr diff returns HTTP 406 for PRs with >20,000 lines of diff.
Added fallback: fetch full diff via commit diff API endpoint (no line
limit), split into per-file sections, prioritize core files over tests,
and truncate to 15k lines to fit model context windows.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 18:20:59 +08:00
Li LiuandClaude Opus 4.6 aec6f67509 feat: add general discussion phase before issue-by-issue review
Introduce an optional General Discussion phase for PR reviews that sits
between review completion and the issue-by-issue comment loop. Users can
select participants, ask general questions, and resolve issues inline
(/post, /skip, /edit, /discuss, /issues) so only remaining issues flow
into the per-issue loop.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 17:39:11 +08:00
Li LiuandClaude Opus 4.6 b78cf9cc24 fix: strengthen language enforcement by injecting instructions into system prompt prefix
Move language instructions from user message suffix to system prompt prefix
where LLMs give them higher weight. Add langPrefix/withLang() to orchestrator
so all reviewer/analyzer/summarizer calls get the language requirement.
Also wire discuss command to use config.defaults.language instead of only
following user input language.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 11:19:20 +08:00
Li LiuandClaude Opus 4.6 8a8dab1ec4 fix: improve inline PR comment placement with content-based matching and full diff fallback
- Add extractDiffLineRanges() to include valid line ranges in structurizer prompt
- Add content-based matching (extractCodeFromBody + findLineByContent) as fallback
- Add full diff fallback via gh api when per-file patches are null
- Widen nearest-line threshold from 20 to 50 for better coverage

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 18:12:23 +08:00
Li LiuandClaude Opus 4.6 ad7f0d1e0c fix: auto-select all reviewers in non-TTY mode to prevent hanging
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 13:58:52 +08:00
Li LiuandClaude Opus 4.6 4fe80c808c chore: move typescript to devDependencies, remove unused readline package
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 13:58:11 +08:00
Li LiuandClaude Opus 4.6 613c1b479c fix: add SIGKILL fallback after SIGTERM timeout in CLI providers
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 13:57:24 +08:00
Li LiuandClaude Opus 4.6 64dd42a045 fix: add retry with backoff to all CLI providers and Gemini streaming
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 13:57:04 +08:00
Li LiuandClaude Opus 4.6 5df0e65e5e feat: pre-flight check for CLI binaries with friendly error messages
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 13:55:12 +08:00
Li LiuandClaude Opus 4.6 c2d0f583af fix: register exit handler to clean up temp prompt files
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 13:55:09 +08:00
Li LiuandClaude Opus 4.6 6bc75ca3ea fix: single reviewer failure no longer terminates entire review session
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 13:53:05 +08:00
Li LiuandClaude Opus 4.6 38ff61471a fix: prevent command injection in history-collector via spawnSync
Replace execSync with spawnSync in getFileHistory() and getPRDetails()
to prevent shell injection through file paths and PR numbers. Add input
validation for prNumber (must be a positive integer).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 13:51:12 +08:00
Li LiuandClaude Opus 4.6 9a6aaca563 fix: prevent command injection in reference-collector via spawnSync
Replace execSync with spawnSync in findReferences() to prevent shell
injection through malicious symbol names in PR diffs. Use -F (fixed-string)
and -e flags for safe argument passing to ripgrep.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 13:51:08 +08:00
Li LiuandClaude Opus 4.6 b541b509d7 fix: improve inline PR comment placement with near-line matching
When the AI reviewer references a line not exactly in a diff hunk,
find the nearest valid diff line (within 20 lines) and post inline
there instead of falling back to file-level. Also constrain the
structurizer prompt to only reference files actually in the diff.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 23:29:14 +08:00
Li LiuandClaude Opus 4.6 87abf873cd fix: handle large PR review failures in CLI providers
- Add stdin EPIPE error handlers to prevent unhandled exception crashes
  when child processes exit before reading all input
- Clear CLAUDECODE env var to avoid nested session detection when
  running from within Claude Code
- Write large prompts (>100KB) to temp files instead of stdin to bypass
  CLI prompt size limits; CLI tools read the file via their built-in
  file access capabilities
- Capture stderr in claude-code streaming mode for better error reporting

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 21:40:11 +08:00
Li LiuandClaude Opus 4.6 a472b45323 feat: add post-review discussion phase, comment style prompt, /skip, and language config
- Add interactivePostReviewDiscussion() for chatting with any role after review conclusion
- Show all roles (reviewers + analyzer + summarizer) in comment discussion picker
- Add comment style prompt before issue loop to style-guide first-gen comments
- Add /skip and /drop to abandon issues mid-discussion
- Add defaults.language config for localized output (e.g. language: zh)
- Expose getAnalyzer() and getSummarizer() from orchestrator
- Share reviewer sessions across discussion and comment phases

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Li Liu <li.liu@zilliz.com>
2026-03-02 12:09:10 +08:00
Li LiuandClaude Opus 4.6 c11554c781 feat: add --no-post flag to skip GitHub comment flow
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Li Liu <li.liu@zilliz.com>
2026-02-27 08:53:20 +00:00
Li LiuandClaude Opus 4.6 22cfae3347 fix: pass prompt via stdin instead of args to avoid E2BIG on large diffs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Li Liu <li.liu@zilliz.com>
2026-02-27 08:29:19 +00:00
Li LiuandClaude Opus 4.6 20dba4f0f3 fix: resolve correct upstream repo when reviewing PRs from a fork
When a bare PR number is given while in a fork's local clone, the code
now uses `gh pr view` to resolve the actual upstream repo before falling
back to git remote detection. This prevents 404 errors when posting
review comments on PRs that live on the upstream repository.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 22:52:37 +08:00
Li LiuandClaude Opus 4.6 aabf5924e7 fix: require exhaustive file-by-file review to eliminate partial findings
Reviewer prompts previously allowed LLMs to stop after finding a handful
of issues. Now every round demands systematic coverage of all changed
files/functions, and debate rounds additionally require reviewers to
identify what others missed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 17:16:15 +08:00
Li LiuandClaude Opus 4.6 2b0e1ba711 refactor: comprehensive codebase improvements across 7 phases
Phase A - Quick fixes:
- Remove debug logging that leaked prompt content (qwen-code)
- Fix orchestrator session leak with try/finally cleanup
- CJK-aware token estimation for better accuracy
- Issue parser validation (line > 0, endLine >= line, non-empty fields)
- Improved similarity matching with stop words filtering and description weight

Phase B - Medium fixes:
- Add retry utility with exponential backoff for API providers
- Config validation at load time (required fields, empty API key warnings)
- GitHub PR comment deduplication (skip already-posted comments)
- Ctrl+C graceful exit for interactive comment review

Phase C - Structured logging:
- Logger class with debug/info/warn/error levels (MAGPIE_LOG_LEVEL env var)

Phase D - Type safety:
- Replace `any` types with proper types across discuss.ts, review.ts,
  issue-parser.ts, commenter.ts, repo-orchestrator.ts, history-collector.ts

Phase E - Session helper extraction:
- CliSessionHelper class shared by 4 CLI providers, reducing duplication

Phase F - Split review.ts (1991 → 6 files):
- review.ts (command + action), interactive.ts, repo-review.ts,
  session-cmds.ts, utils.ts, types.ts

Phase G - Tests:
- 6 new test files (retry, logger, session-helper, issue-parser-enhanced,
  loader-validation, orchestrator-session)
- Fix pre-existing test failures (commenter, anthropic)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 22:46:46 +08:00
Li LiuandClaude Opus 4.6 fe080cd8e1 feat: prompt user before fallback when inline comment placement fails
Classify comments against PR diff before posting. When comments cannot
be placed inline (line not in diff), show user the fallback plan and
offer choices: post all with fallback, inline only, retry as inline,
or skip.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 21:03:28 +08:00
Li LiuandClaude Opus 4.6 5083785500 fix: post review comments as inline code annotations instead of global PR comments
Use GitHub Reviews API to batch-post comments as a proper code review.
Parse PR diff to determine valid line placements, with three-level
fallback: inline (exact line) → file-level (attached to file) → global.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 21:00:20 +08:00
Li LiuandClaude Opus 4.6 28c1d460c7 feat: add disappearing placeholder hint for discussion input
Show a dim "Enter to end discussion" hint at the input prompt that
automatically clears when the user starts typing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 20:36:03 +08:00
Li LiuandClaude Opus 4.6 79e30b082a feat: persistent reviewer sessions in post-processing discussion
Maintain a single session per reviewer across all issue discussions,
so that context (PR diff, gathered context, debate history) is sent
once at session start and subsequent issues use --resume for
claude-code provider. This enables cross-issue context sharing and
eliminates cold-start overhead per issue.

- Add ReviewerSessionState interface and session management helpers
- buildInitialSessionContext: rich first message with full PR context
- getOrCreateSession: lazy session creation with provider startSession
- Use DebateResult type instead of inline type for better type safety
- Wrap discussion flow in try/finally to guarantee session cleanup
- Synthetic assistant reply after initial context to maintain
  user/assistant alternation for API-based providers

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 20:34:22 +08:00
Li LiuandClaude Opus 4.6 99ee72433a fix: support cross-repo PR comment posting via --repo flag
When reviewing a PR from a different repository using a full GitHub URL,
the commenter commands (gh pr view, gh pr comment) defaulted to the
current directory's git remote, causing "Could not resolve PullRequest"
errors. Now extracts owner/repo from the PR URL and passes --repo flag.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 20:06:07 +08:00
Li LiuandClaude Opus 4.6 0f7b85cc5b feat: add regenerate option for post-discussion comments
After discuss generates a comment, users can now press [r] to
regenerate with custom instructions (e.g. "more concise", "add code
example"). Supports unlimited regeneration cycles with full
conversation context preserved.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 19:48:03 +08:00
Li LiuandClaude Opus 4.6 8b35dbecbf docs: update README with new providers, post-processing, and debug mode
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 21:27:52 +08:00
Li LiuandClaude Opus 4.6 1efe5165c7 fix: post inline comments per-line instead of one big review
Rewrote commenter to post each issue as an individual inline comment
on the specific line via GitHub PR comments API. If the line is not
in the diff, falls back to a regular PR comment with file:line context.
Previously used batch PR review API where one invalid line would fail
the entire batch.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 21:22:31 +08:00
Li LiuandClaude Opus 4.6 dda200a8a9 feat: auto-explain issues on discuss + progress tracking
- Discussion mode ('d') now auto-sends first message asking the
  reviewer to explain the issue in detail (where, why, how to fix)
  before user interaction begins
- Progress bar shows running tally: posted/edited/discussed/skipped
  counts displayed on each issue header

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 21:17:28 +08:00
Li LiuandClaude Opus 4.6 4beed0fd9c fix: ora discardStdin kills process during interactive discussion
Root cause: ora's default discardStdin=true calls process.stdin.pause()
when spinner stops. This makes the stdin handle inactive in libuv, and
since readline's question() does not call resume(), the event loop sees
no active handles and the process exits silently. Only affects TTY
environments (stdinDiscarder checks isTTY).

Fix: use discardStdin:false on all ora spinners that coexist with
readline, plus explicit process.stdin.resume() safety net.

Also includes:
- Multi-turn discussion with conversation history and debate context
- AI-generated final comments after discussion
- unhandledRejection guard for async generator cleanup
- Pre-fetch PR diff so API-only models get the code
- Solo review/discuss support (min 1 reviewer, skip convergence)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 21:15:11 +08:00
Li LiuandClaude Opus 4.6 52577cfce1 fix: add stream cleanup to anthropic/openai providers
- AnthropicProvider: stream.abort() in finally block ensures HTTP
  connection is released even if consumer breaks early
- OpenAIProvider: stream.controller.abort() for same reason
- GeminiProvider: document that consuming all chunks is sufficient

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 21:14:57 +08:00
Li LiuandClaude Opus 4.6 fe9257ebcc feat: add mock, qwen-code, minimax providers
- MockProvider for debug mode: supports MAGPIE_MOCK_DELAY,
  MAGPIE_MOCK_RESPONSE, MAGPIE_MOCK_FILE env vars; echoes input by default
- QwenCodeProvider: wraps qwen-code CLI (OAuth-based)
- MiniMaxProvider: API-based provider using MiniMax-M2.5
- config.mock top-level flag: when true, all models route to MockProvider
- model prefix matching: mock, mock1, mock2 etc. all map to mock provider

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 21:14:49 +08:00
Li LiuandClaude Opus 4.6 c54f1e1149 feat: add session support for Codex CLI provider
Use `codex exec --json` and `codex exec resume <thread_id>` to maintain
multi-turn conversation state, matching Claude and Gemini CLI behavior.
In debate rounds, only the last message is sent instead of full history.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 00:50:51 +08:00
Li LiuandClaude Opus 4.6 cea0cb758c fix: rich issue descriptions + fix discuss flow in post-processing
1. Structurizer now requests comprehensive markdown descriptions with
   original code quotes, impact analysis, and fix rationale — suitable
   for GitHub PR comments.

2. Fix discuss (d) silently skipping: raisedBy was stripped by
   parseReviewerOutput, defaulting to ['summarizer'] which matched no
   reviewer. Now preserved through parsing pipeline, with fallback to
   first available reviewer.

3. Issue display now renders markdown via marked() for proper formatting.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 15:07:00 +08:00
Li LiuandClaude Opus 4.6 e40eb6afc8 fix: disable tools for structurizer to prevent code modification instead of JSON extraction
When extracting structured issues from review text, Claude Code with
--dangerously-skip-permissions would interpret file paths and fix suggestions
as instructions to modify code, producing "All fixes applied..." instead of
JSON. Fix by passing --tools "" to disable all tools for the structurizer call.

Also: end summarizer session before structurization for clean non-session call,
make issue-parser more lenient (accept raw JSON objects, optional verdict/summary).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 00:04:31 +08:00
Li LiuandClaude Opus 4.6 6afc9a9498 fix: flush analysis buffer before displaying system context
The analysis content was still buffered when onContextGathered fired,
causing the context section to appear before the analysis text.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 21:45:28 +08:00
Li LiuandClaude Opus 4.6 0673274030 refactor: always use AI to extract structured issues, never parse reviewer JSON
Reviewer output format is not under our control. Instead of trying to
parse JSON blocks from reviewer messages (which may not match our schema),
always use the summarizer to extract structured issues from the review
discussion text. This is more robust and removes any dependency on
reviewer prompt configuration.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 21:39:27 +08:00
Li LiuandClaude Opus 4.6 f265dacea7 feat: auto-structurize review issues when reviewers don't output JSON
When reviewers don't include structured JSON blocks in their output,
the summarizer is called to extract issues from the unstructured review
text into the standard JSON format. This ensures the per-issue
interactive post-processing flow always works for PR reviews.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 21:37:25 +08:00
Li LiuandClaude Opus 4.6 4070d2ec70 fix: add role label to session names + fallback post-processing
1. Session names now include explicit role: "reviewer:gemini" instead of
   just "gemini", matching analyzer/summarizer pattern
2. PR post-processing no longer requires structured JSON issues. When
   reviewers don't output JSON blocks, offers to post the final
   conclusion as a general PR comment instead.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 21:33:59 +08:00
Li LiuandClaude Opus 4.6 6ca7a14f54 fix: prevent context gatherer output from interleaving with analysis stream
Move onContextGathered callback to after Promise.all resolves, so context
displays after analysis finishes streaming. Work is still parallel, only
the display is sequential.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 21:28:09 +08:00
Li LiuandClaude Opus 4.6 3a2ea02062 fix: add anti-preamble instruction to analyzer prompt
Prevents AI from outputting chatty preamble like "Here's my analysis"
before the actual content.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 21:25:47 +08:00
Li LiuandClaude Opus 4.6 c634075bf8 feat(providers): add Gemini CLI session support and session naming
- Gemini CLI: full session persistence via -o json/stream-json and
  --resume <uuid>, NDJSON parsing for streaming session_id capture
- Claude Code & Gemini CLI: session naming via [name] prefix in first
  message, visible in gemini --list-sessions and claude --resume
- Provider interface: startSession() now accepts optional name parameter
- Codex CLI: include stderr in error messages for better diagnostics

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 20:59:35 +08:00
Li LiuandClaude Opus 4.6 76e0031527 fix: add PR number validation to prevent command injection
Validates that PR numbers are numeric-only in postPRReview and
getPRHeadSha before passing them to shell commands.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 20:00:27 +08:00
Li LiuandClaude Opus 4.6 c0e22271b8 feat: integrate review history tracking and add stats command
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 19:56:04 +08:00
Li LiuandClaude Opus 4.6 989ec24e9f feat: add review history tracking with incremental diff
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 19:53:13 +08:00
Li LiuandClaude Opus 4.6 d73504889c feat(review): add post-processing interactive comment flow
Add human-in-the-loop review for each issue before posting to GitHub.
After structured issues are displayed, users can review each issue and
choose to post as-is, edit, discuss with the original reviewer, skip,
or stop. Approved comments are batched and posted via the GitHub API.

- Add getReviewers() method to DebateOrchestrator
- Add interactiveCommentReview function with per-issue actions (p/e/d/s/q)
- Add discuss mode: back-and-forth with the AI reviewer who raised the issue
- Wire post-processing prompt into PR review flow after issue table display

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 19:50:14 +08:00
Li LiuandClaude Opus 4.6 1625347559 feat: add GitHub PR comment posting utility
Add commenter module that builds GitHub PR review payloads from merged
issues. Issues with file+line become inline review comments, issues
without line info go into the review body. Includes gh CLI wrappers for
posting reviews and fetching PR head SHA.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 19:46:11 +08:00
Li LiuandClaude Opus 4.6 339f3a1b4d feat: add structured call chain context for reviewers
Add formatCallChainForReviewer to display exact code snippets at each
call site, giving reviewers precise context about how changed symbols
are used across the codebase. Raw references are now stored in
GatheredContext and formatted into the reviewer prompt.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 19:43:39 +08:00
Li LiuandClaude Opus 4.6 d3a3be9a19 feat: add dynamic focus broadcast from analyzer to reviewers
Add parseFocusAreas to extract suggested review focus from analyzer
output and inject them as hints into each reviewer's first-round
prompt. Focus areas are suggestions, not constraints — reviewers are
explicitly told to also flag anything else they notice.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 19:40:24 +08:00
Li LiuandClaude Opus 4.6 81e57495a9 perf: parallelize analyzer and context gatherer execution
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 19:37:33 +08:00
Li LiuandClaude Opus 4.6 a0467cfb0b feat: display structured issue table after review conclusion
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 19:36:12 +08:00
Li LiuandClaude Opus 4.6 a2755090d2 feat: integrate issue parsing and dedup into orchestrator
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 19:34:20 +08:00
Li LiuandClaude Opus 4.6 c368a1009f feat: update reviewer prompt to request structured JSON output
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 19:31:53 +08:00
Li LiuandClaude Opus 4.6 eccc867e6a feat: add issue parser with deduplication
Add parseReviewerOutput to extract structured issues from reviewer
JSON blocks and deduplicateIssues to merge similar issues across
multiple reviewers using Jaccard similarity on title words.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 19:27:17 +08:00
Li LiuandClaude Opus 4.6 e0b6f53ceb feat: add ReviewIssue, ReviewerOutput, MergedIssue types
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 19:21:23 +08:00
Li LiuandClaude Opus 4.5 3343d178a7 docs: update README with context gatherer feature
- Add contextGatherer config section with all options
- Add --skip-context, --plan-only, --reanalyze CLI options
- Update workflow diagram to include context gathering step
- Add Context Gathering feature description

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 16:45:59 +08:00
Li Liu a4f34b94c0 feat(config): add default context gatherer settings 2026-01-29 14:28:02 +08:00
Li Liu a198f9a178 feat(review): add context gathering to review command 2026-01-29 14:27:30 +08:00
Li Liu 5a547e05f6 feat(orchestrator): integrate ContextGatherer 2026-01-29 14:25:40 +08:00
Li Liu 99d70ad989 feat(orchestrator): add context gatherer types to options 2026-01-29 14:24:19 +08:00
Li Liu b9fbb8d6fb feat(config): add context gatherer config types 2026-01-29 14:23:40 +08:00
Li LiuandClaude Opus 4.5 f02dd88a62 feat(context-gatherer): add module index
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 14:23:05 +08:00
Li LiuandClaude Opus 4.5 7b3084f341 feat(context-gatherer): add main ContextGatherer class
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 14:22:18 +08:00
Li Liu 63dd4a3715 feat(context-gatherer): add prompts index 2026-01-29 14:20:46 +08:00
Li Liu 70efd80aca feat(context-gatherer): add AI analysis prompt 2026-01-29 14:20:15 +08:00
Li LiuandClaude Opus 4.5 d834df8a71 feat(context-gatherer): add collectors index
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 14:19:10 +08:00
Li LiuandClaude Opus 4.5 362f3595ee feat(context-gatherer): add docs collector
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 14:18:16 +08:00
Li LiuandClaude Opus 4.5 8860e6e66c feat(context-gatherer): add history collector
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 14:16:57 +08:00
Li LiuandClaude Opus 4.5 f5854d0d02 feat(context-gatherer): add reference collector
Add reference collector module that:
- Extracts function/class symbols from git diffs
- Uses ripgrep to find where symbols are referenced in the codebase

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 14:15:06 +08:00
Li LiuandClaude Opus 4.5 094c541e66 feat(context-gatherer): add type definitions
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 14:13:26 +08:00
Li LiuandClaude Opus 4.5 6093673173 feat: show convergence judgment reasoning and fix markdown rendering
- Add onConvergenceJudgment callback to display why judge ruled converged/not
- Increase joke rotation interval from 8s to 15s
- Fix markdown rendering issues from LLMs like Codex:
  - Add fixMarkdown() to convert indented lists to standard format
  - Increase terminal width from 80 to 120

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 13:40:41 +08:00
Li LiuandClaude Opus 4.5 579e15aba8 fix: require at least 2 rounds before convergence can be declared
The previous convergence check had two issues:
1. It could declare convergence after round 1, when reviewers hadn't
   seen each other's opinions yet (independent reviews)
2. The parsing logic was too loose - any response containing "CONVERGED"
   would pass, even if it was part of a sentence

Changes:
- Require at least 2 completed rounds before checking convergence
- Add stricter consensus criteria (critical issues must be cross-validated)
- Fix parsing to only accept exact "CONVERGED" as first word
- Clarify that silence on another's point is NOT agreement

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 17:29:15 +08:00
Li LiuandClaude Opus 4.5 d55b9f381d fix: stop spinner before reviewer selection to allow interactive input
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 16:57:59 +08:00
Li LiuandClaude Opus 4.5 76c37a3620 fix: interactive mode readline issues and add follow-up Q&A
- Fix readline stdin state issue causing immediate exit in -i mode
- Fix analysis content not displaying before interactive prompt
- Add follow-up Q&A after Final Conclusion in review command
- Refactor selectReviewers to accept optional shared readline instance

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 10:19:38 +08:00
Li LiuandClaude Opus 4.5 75bf857371 feat: show parallel execution status with timing
- Add ReviewerStatus type for tracking reviewer state
- Track start/end time and duration for each reviewer
- Display live status during parallel execution:
  ✓ done (with duration) | ⋯ thinking | ○ pending
- Update spinner in real-time as reviewers complete

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 20:56:16 +08:00
Li LiuandClaude Opus 4.5 8885763d60 fix: convergence detection and codex-cli consistency
- Fix convergence check: NOT_CONVERGED was incorrectly matching CONVERGED
- Allow convergence after round 1 (was requiring 2 rounds minimum)
- Unify codex-cli streaming/non-streaming to use same bypass flag

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 20:38:09 +08:00
Li LiuandClaude Opus 4.5 c08ee3819a docs: update README with new features
- Add Fair Debate Model and Parallel Execution to core concepts
- Update max_rounds default from 2 to 5
- Document new CLI options: --reviewers, --all/-a, --git-remote
- Add Reviewer Selection section with interactive/CLI examples
- Rewrite Workflow to show Round 1 independent → Round 2+ debate model
- Add Fair Debate Model explanation section
- Add Parallel Execution section with example output

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 19:07:34 +08:00
Li LiuandClaude Opus 4.5 de75d4f165 feat: parallel execution for reviewers in same round
Each round now executes all reviewers in parallel using Promise.all:
1. Build messages for all reviewers (same info)
2. Execute all chatStream calls concurrently
3. Collect all responses
4. Display results after all complete

Benefits:
- Faster execution (N reviewers run simultaneously)
- Semantically correct (same round = simultaneous)
- Same total API usage, just concurrent

Display shows: "Round N: All reviewers thinking (parallel)"

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 19:04:40 +08:00
Li LiuandClaude Opus 4.5 1ad9d0f04e feat: each round sees only previous rounds, not current round peers
Changed debate model:
- Round N: each reviewer sees only rounds 1 to N-1
- Reviewers in same round have identical information (fair)
- No anchoring bias from earlier reviewers in same round

Example with 3 reviewers:
  Round 2: claude sees [gemini_r1, codex_r1]
           gemini sees [claude_r1, codex_r1]  <- same info level
           codex  sees [claude_r1, gemini_r1] <- same info level

Also increased default max_rounds from 3 to 5 since convergence
may take longer with this fairer model.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 18:57:32 +08:00
Li LiuandClaude Opus 4.5 9615efec17 fix: session mode round 2 must include all others' round 1 messages
Bug: Round 1 is independent (no one sees others), so session doesn't
have other reviewers' messages. When entering Round 2 debate phase,
we were only sending messages after lastSeen, missing others' Round 1.

Fix: Check if reviewer just finished Round 1 (myMessageCount === 1).
If so, send ALL other reviewers' messages, not just incremental.

Round 3+ continues to use incremental (lastSeen + 1) since debate
context is already established in session.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 18:50:01 +08:00
Li LiuandClaude Opus 4.5 24bfb596e3 feat: round 1 independent opinions, round 2+ full context debate
Round 1: Each reviewer gives independent assessment
- Only sees analysis, not other reviewers' opinions
- Avoids anchoring bias from first reviewer

Round 2+: Full debate mode
- Sees all previous discussion
- Can agree/disagree with specific points from [reviewer_id]

This ensures diverse initial perspectives before debate begins.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 18:44:20 +08:00
Li LiuandClaude Opus 4.5 4d83dd97c2 feat: enable danger mode for all CLI providers
- claude-code: add --dangerously-skip-permissions
- codex-cli: use --dangerously-bypass-approvals-and-sandbox
- gemini-cli: already has -y (yolo mode)

This allows CLI tools to access network (e.g., gh commands to fetch PR)
without permission prompts.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 18:09:37 +08:00
Li LiuandClaude Opus 4.5 18f64e5fcf feat: add reviewer selection - default interactive, --all to skip
Usage:
- Default: shows interactive menu to select reviewers
  [0] All reviewers
  [1] claude
  [2] gemini
  ...

- --all (-a): use all reviewers, skip selection
- --reviewers claude,gemini: specify reviewers directly

Requires at least 2 reviewers for a debate.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 17:54:55 +08:00
Li LiuandClaude Opus 4.5 d4d5baa2e7 feat: add visual separator for convergence check
Now shows convergence check as a distinct step:
┌─ 🔍 Convergence Judge ─────────────────────────
⠋ Evaluating if reviewers reached consensus...
└─ Verdict: CONVERGED / NOT CONVERGED

Makes it clear this is a separate judge, not another reviewer.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 21:43:47 +08:00
Li LiuandClaude Opus 4.5 7144b98e08 fix: stricter convergence check - reject if any reviewer explicitly disagrees
Previous prompt was too lenient ("mostly agree on key points").
Now requires TRUE consensus:
- All reviewers must agree on the same verdict
- NOT converged if any reviewer says "I disagree/reject [X]'s view"
- NOT converged if they agree on problems but disagree on actions
- System prompt: "Be conservative - when in doubt, say NOT_CONVERGED"

This fixes false positives like Gemini saying "I reject [claude]'s view"
but still being marked as converged.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 21:40:46 +08:00
Li LiuandClaude Opus 4.5 406dcf7326 refactor: balance debate tone - goal is finding issues, not fighting
- "adversarial debate against" → "code review debate with"
- "opponent" → "the other reviewer"
- Add "shared goal: find real issues and reach the best conclusion"
- "agree where valid, challenge where you disagree"
- "acknowledge good points and build on them"

Keep the anti-sycophancy stance but focus on solving problems together.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 18:32:03 +08:00
Li LiuandClaude Opus 4.5 43c395a6d5 feat: improve debate format with named reviewers and adversarial prompts
- Replace anonymous [AI Reviewer] with specific reviewer IDs (e.g., [claude], [gemini])
- Rewrite prompts to emphasize adversarial debate, not collaborative review
- Each AI now knows: "You are [X], your opponent is [Y]"
- Use action words like "Challenge their points", "Defend your position"
- Remove verbose old instructions, keep prompts focused

This makes AIs actually argue with each other instead of politely agreeing.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 18:30:29 +08:00
Li LiuandClaude Opus 4.5 96fc85c217 fix: disable gemini-cli session support (uses full context mode)
Gemini CLI only supports index-based sessions (-r latest or -r 5),
not custom session IDs like Claude CLI. Since "latest" could refer
to a different session if user runs other Gemini commands, this is
unreliable. Disabled session support for Gemini CLI - it will always
use full context mode instead.

Also updated README to clarify session support per provider.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 18:10:33 +08:00
Li LiuandClaude Opus 4.5 de26a36e38 fix: gemini-cli session support for incremental discussion
Fixed bug where sessionId was checked instead of hasSession.
Now gemini-cli properly uses -r latest to resume sessions
for incremental discussion like claude-code.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 17:45:45 +08:00
Li LiuandClaude Opus 4.5 9bcaf728fd docs: update README with new features
- Add gemini-cli to supported providers
- Document session persistence
- Document post-analysis Q&A feature
- Document markdown rendering
- Document cold jokes
- Update example config for CLI-only setup
- Add PR URL support in examples

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 17:43:33 +08:00
Li LiuandClaude Opus 4.5 fdc1eeca7a feat: add Gemini CLI provider support
- New gemini-cli provider using the Gemini CLI tool
- Uses -y (yolo mode) for auto-approve and -o text for clean output
- Supports session resumption with -r latest
- 15 minute timeout like other CLI providers
- Added to init wizard as a no-API-key option

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 17:36:43 +08:00
Li LiuandClaude Opus 4.5 4fdb41d9ea fix: render markdown for analyzer and reviewer outputs
Previously only the final conclusion was rendered with markdown.
Now all reviewer outputs are buffered and rendered with marked
when each reviewer finishes speaking.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 17:32:08 +08:00
Li LiuandClaude Opus 4.5 6de693bc0e feat: add session persistence and post-analysis Q&A
Session persistence (reduces token usage):
- Claude Code provider maintains session across rounds
- Uses --session-id for first call, --resume for subsequent
- Only sends incremental messages in session mode

Post-analysis interactive Q&A:
- In interactive mode (-i), user can ask specific reviewers before debate
- Format: @reviewer_id question (e.g., @claude What about security?)
- Allows clarifying questions before full debate begins

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 17:14:16 +08:00
Li LiuandClaude Opus 4.5 68f31138c7 fix: stop spinner after summarizer completes
The summarizer uses non-streaming chat(), so onMessage callback
never fires to stop the spinner. Now explicitly stop it after
runStreaming() returns.

Also refactored spinner/interval to use object ref to fix
TypeScript control flow analysis issues with closures.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 16:57:24 +08:00