CodeRabbitはAIコードレビューサービスです。GitHubやGitLabなどと連携し、PRを自動的にコードレビューします。VS Code機能拡張やCLIも提供しており、こちらは無料で利用できます。パブリックなリポジトリであれば、CodeRabbitを無料で利用できます。
直近のアップデートとして、CodeRabbit CLIに --agent オプションが追加されました(0.4.0より)。これを使うと、レビュー情報を構造化されたJSONとして出力され、AIコーディングエージェントとの親和性が高くなります。Claude CodeやCodexとの親和性が高くなります。
CodeRabbit CLIのインストール
CodeRabbit CLIは、以下のコマンドでインストールできます。
curl -fsSL https://cli.coderabbit.ai/install.sh | sh
そして、認証します。
coderabbit auth login
# または
cr auth login
これで準備完了です。
レビューのスタイル
coderabbit コマンドでは、幾つかのレビュースタイルが用意されています。
coderabbit review --plain # テキストで出力
coderabbit review --prompt-only # AIコーディングエージェント用。修正情報のみ
ここに新しいオプションとして --agent が追加されます。
coderabbit review --agent
出力の違い
それぞれの出力の違いです。
--plain
ファイルパス、行数、レビューの種別に加えて、コメント、修正提案、AIコーディングエージェント向けのプロンプトが並びます。
============================================================================
File: src/main/kotlin/dev/moongift/coderabbit/annotator/AgentPromptCopySupport.kt
Line: 14 to 17
Type: potential_issue
Comment:
Ensure operations run on the EDT (Event Dispatch Thread).
The HintManager.showInformationHint() call is a UI operation that must execute on IntelliJ's Event Dispatch Thread. If this function is invoked from a background thread, it will throw an exception. The CopyPasteManager operation should also run on the EDT for consistency and safety.
IntelliJ Platform HintManager showInformationHint EDT thread requirement
🔧 Suggested fix to ensure EDT execution
+import com.intellij.openapi.application.ApplicationManager
+
internal object AgentPromptCopySupport {
fun copyToClipboard(agentPrompt: String, editor: Editor?) {
if (agentPrompt.isBlank()) {
return
}
- CopyPasteManager.getInstance().setContents(StringSelection(agentPrompt))
- editor?.let {
- HintManager.getInstance().showInformationHint(it, "Copied AI agent prompt")
+ ApplicationManager.getApplication().invokeLater {
+ CopyPasteManager.getInstance().setContents(StringSelection(agentPrompt))
+ editor?.let {
+ HintManager.getInstance().showInformationHint(it, "Copied AI agent prompt")
+ }
}
}
}
Prompt for AI Agent:
Verify each finding against the current code and only fix it if needed.
In @src/main/kotlin/dev/moongift/coderabbit/annotator/AgentPromptCopySupport.kt around lines 14 - 17, Wrap the clipboard and UI hint calls in an EDT invocation so both CopyPasteManager.getInstance().setContents(StringSelection(agentPrompt)) and HintManager.getInstance().showInformationHint(editor, "Copied AI agent prompt") run on the Event Dispatch Thread; locate the call site in AgentPromptCopySupport (references: agentPrompt, editor, CopyPasteManager, HintManager) and call ApplicationManager.getApplication().invokeLater { ... } (with appropriate ModalityState if needed) to execute those operations on the EDT.
--prompt-only
このオプションでは、メッセージやサジェストがすべて消えています。 Prompt for AI Agent だけが取得できる形です。
File: js/search-filter.js
Line: 53 to 61
Type: potential_issue
Prompt for AI Agent:
Verify each finding against the current code and only fix it if needed.
In @js/search-filter.js around lines 53 - 61, The case-insensitive search fails because shouldShowCard lowercases searchKeyword but not card.content; update shouldShowCard to compare card.content.toLowerCase() against searchKeyword (which is already lowercased) before calling includes, i.e., use card.content.toLowerCase().includes(searchKeyword) inside the shouldShowCard function to ensure matches like "Task" are found when searchKeyword is "task".
--agent
このオプションでは、JSONが順番に返却されてきます。一気にではないので、注意してください。JSONなので、分析しやすいです。
codegenInstructions の中に、AIコーディングエージェント向けのメッセージが入っています。
{"type":"review_context","reviewType":"all","currentBranch":"feature/terminal-login-flow","baseBranch":"main","workingDirectory":"/path/to/jetbrains-ext"}
{"type":"status","phase":"connecting","status":"connecting_to_review_service"}
{"type":"status","phase":"setup","status":"setting_up"}
{"type":"status","phase":"analyzing","status":"summarizing"}
{"type":"status","phase":"analyzing","status":"reviewing"}
{"type":"finding","severity":"major","fileName":"src/main/kotlin/dev/moongift/coderabbit/cli/TerminalCommandRunner.kt","codegenInstructions":"Verify each finding against the current code and only fix it if needed.\n\nIn @src/main/kotlin/dev/moongift/coderabbit/cli/TerminalCommandRunner.kt around lines 17 - 22, TerminalToolWindowManager.toolWindow may be null and createLocalShellWidget can block on the EDT; update TerminalCommandRunner to null-check terminalManager.toolWindow before using it (return or log if null) and avoid calling createLocalShellWidget on the UI thread — perform shell creation (createLocalShellWidget) on a background thread (e.g., ApplicationManager.getApplication().executeOnPooledThread) and then switch back to the EDT to call toolWindow.show/activate and widget.executeCommand, and also null-check the returned widget before executing the command.","suggestions":[]}
まとめ
agentオプションで既存システムやAIコーディングエージェントと、CodeRabbit CLIの連携・自動化がしやすくなります。ぜひお使いのコーディングエージェントと組み合わせて使ってみてください。
CodeRabbit Documentation - AI code reviews on pull requests, IDE, and CLI