ClaudeMods
☰
JA
● 0 人がオンライン ・閲覧 0 回
スポンサー作品を投稿
GitHub リポジトリ · 投稿者 tomasz-tomczyk

crit-tui

Claude Code 内の初期版 crit。ペインで会話、差分、ファイルにコメントし、レビューを Claude に送り、スレッドで Claude の返答を読めます。

tomasz-tomczyk@tomasz-tomczyk

tomasz-tomczyk/crit/tree/main/integrations/claude-code-tui

翻訳済み

この mod について

crit-tui

Claude Code 内で動くレビューのループを mod として提供します。会話の行、作業ツリーの差分、またはペイン内のファイルにコメントし、レビューをまとめて Claude に送れます。Claude はツールを使って各コメントのスレッドに返答します。

初期バージョンです。

インストール

Claude Code 2.1.287 以降(mods)と、PATH 上で使える crit CLI が必要です。

/plugin marketplace add tomasz-tomczyk/crit
/plugin install crit-tui@crit

同じマーケットプレイスにあるメインの crit プラグインと並べて動作します。両方を入れても構いません。checkout から試す場合は、次を実行します。

claude --plugin-dir integrations/claude-code-tui

使い方

  • /crit-tui でペインを開く(最後に使ったソースを使い、最初は会話を表示)
  • /crit-tui chat、/crit-tui diff、/crit-tui file <path> でソースを選ぶ
  • /crit-tui send でレビューを送り、/crit-tui close でペインを閉じる

ペインは 1 つの Client 領域です。生のキー入力とマウスイベントを受け取ります。一度クリックするとキー入力を渡せます(Esc でプロンプトに戻ります)。

| 入力 | 動作 | | --- | --- | | 行をクリック | カーソルをその行へ移動 | | ドラッグ | 行を選択 | | スレッドをクリック | r / x の対象にする | | j k、↑ ↓、ホイール | 移動 | | shift+↑ ↓、または v の後に移動 | 行を選択 | | space / pagedown、ctrl+u / pageup | ページ移動 | | g G、home end | 先頭、末尾 | | n p、→ ← | 次、前のメッセージまたはファイル | | l、tab | 次のスレッド | | c、enter | 行または選択範囲にコメント | | r | 選択したスレッド、またはこの行のスレッドに返信 | | x | 解決済みにする | | s | 下書きと返信を Claude に送る | | a | Claude に差分をレビューさせ、コメントを残す | | 1 2 3 | 会話、差分、ファイル | | h | 解決済みスレッドを表示/非表示 | | f | ソースを再読み込み |

コメント入力中は、enter で保存、shift+enter で行を追加、ctrl+u で消去します。キャンセルするには、空の入力欄で enter または backspace を押すか、cancel をクリックします。ctrl+c と Esc はペインには届かず、Claude Code が処理します。

ペインを閉じている間は、プロンプトの上にあるバンドに Claude の下書きと新しい返答が表示され、send と open のボタンが出ます。ステータス行にも同じ件数が表示されます。トランスクリプトでは、コメント付きの返答の下に件数の行が追加されます。

Claude に渡るもの

ツールは 3 つです。

  • mcp__crit-tui__reply { id, body, resolve? }:コメントに返答
  • mcp__crit-tui__comment { file, line, end_line?, body }:コードにコメント
  • mcp__crit-tui__threads { include_resolved? }:未解決スレッドを一覧表示

send は各新規コメント(場所、引用行、本文、id)と各新規返信を 1 つのプロンプトとして送信し、各項目に reply で返答するよう Claude に求めます。

コメントの保存先

すべて crit CLI に書き込まれるため、crit のブラウザー UI と crit comments には同じレビューが表示されます。

  • 差分とファイルのコメント はリポジトリのレビュー・ファイルに crit comment --json で保存されます。部分選択には、ウェブ UI のテキスト選択と同じように quote と quote_offset が付きます(古い crit はこの 2 つのフィールドを無視します)。
  • チャットコメント は claude-chat-<session id> という名前の crit プランに保存されます。最初のチャットコメントで、mod は crit plan --name <slug> --no-wait を使い、会話を 1 行 1 件で保存してから crit comment --plan <slug> でコメントします。各ターンの後にも保存し、テキストが変わった場合だけ crit がバージョンを追加します。チャットコメントのないセッションには何も作りません。crit plan --no-wait に対応した crit が必要です。古い crit ではチャットコメントはセッション内に残ります。
  • Claude の返信 は --author Claude 付きで書き込まれます。
  • crit CLI(critBin の設定)がない場合、コメントはすべてセッション内に残ります。

ペインの構成

  • hooks/register.tsx がデータ(ドキュメント、スレッド、crit 同期)を管理し、1 つの <Client module="./client.tsx"> としてペインを描画します。
  • hooks/client.tsx がカーソル、選択、スクロール、コメント欄を管理し、各変更(comment、reply、resolve、send など)を ui.message で hooks モジュールへ送ります。
  • Client の props は約 100k 文字に制限されるため、カーソル周辺の行を取得し、端に近づくと新しいウィンドウを要求します。
  • Client の描画中に行われた setState はエンジンに無視されます。そのため Client はモジュール変数に状態を保持し、キーとマウスのハンドラーからだけ setState を呼びます。

開発

claude plugin validate integrations/claude-code-tui
claude plugin test integrations/claude-code-tui

この初期版の制限

  • crit のパスはリポジトリルートからの相対パスとして扱われます。リポジトリルートから Claude Code を起動してください。
  • 削除(-)された差分行は新側の行にアンカーされます。crit comment --json に旧側のアンカーはありません。
  • crit comment --plan は anchor を空のままにします(crit のバグ)。そのため会話の前の行が変わっても、チャットコメントは元のテキストについてきません。
  • 解決済みの crit スレッドを再び開くには crit のブラウザー UI を使います。
  • 差分は git diff HEAD に、最大 20 個の未追跡ファイルを加えたものです。

インストール

まず作者の README で marketplace とプラグイン名を確認してください。コマンドはリポジトリの構成によって変わる場合があります。

claude plugin marketplace add tomasz-tomczyk/crit
claude plugin install crit-tui
原文 / README

crit-tui

A crit review loop inside Claude Code, as a mod. Comment on lines of the conversation, the working-tree diff, or a file in a pane. Send the review to Claude in one go. Claude answers each comment in its thread through a tool.

Early version.

Install

Needs Claude Code 2.1.287 or later (mods) and the crit CLI on your PATH.

/plugin marketplace add tomasz-tomczyk/crit
/plugin install crit-tui@crit

It sits next to the main crit plugin from the same marketplace; you can have both. To try it from a checkout instead:

claude --plugin-dir integrations/claude-code-tui

Use

  • /crit-tui opens the pane (last source used, the conversation at first)
  • /crit-tui chat, /crit-tui diff, /crit-tui file <path> pick the source
  • /crit-tui send sends the review, /crit-tui close closes the pane

The pane is one Client region: it gets raw keys and mouse events. Click it once to give it the keys (Esc gives them back to the prompt).

| input | does | | --- | --- | | click a line | move the cursor there | | drag | select rows | | click a thread | pick it for r / x | | j k, ↑ ↓, wheel | move | | shift+↑ ↓, or v then move | select rows | | space / pagedown, ctrl+u / pageup | page | | g G, home end | top, bottom | | n p, → ← | next, previous message or file | | l, tab | next thread | | c, enter | comment on the line or selection | | r | reply to the picked thread, or the one on this line | | x | resolve it | | s | send drafts and replies to Claude | | a | ask Claude to review the diff and leave comments | | 1 2 3 | conversation, diff, file | | h | show or hide resolved threads | | f | reload the source |

While typing a comment: enter saves, shift+enter adds a line, ctrl+u clears. To cancel: enter or backspace on an empty box, or click cancel. ctrl+c and Esc never reach the pane: Claude Code takes them.

While the pane is closed, a band above the prompt shows drafts and new replies from Claude, with send and open buttons. The status line shows the same counts. A reply in the transcript that has comments gets a line under it with the count.

What Claude gets

Three tools:

  • mcp__crit-tui__reply { id, body, resolve? }: answer a comment
  • mcp__crit-tui__comment { file, line, end_line?, body }: leave a comment on code
  • mcp__crit-tui__threads { include_resolved? }: list open threads

send submits one prompt with each new comment (where, quoted lines, body, id) and each new reply, and asks Claude to answer every item with reply.

Where comments live

Everything goes to crit through its CLI, so the crit browser UI and crit comments see the same review.

  • Diff and file comments go to the repo's review file with crit comment --json. A partial selection carries quote and quote_offset, as a web UI text selection does (an older crit ignores the two fields).
  • Chat comments go to a crit plan named claude-chat-<session id>. On the first chat comment the mod saves the conversation with crit plan --name <slug> --no-wait (one row per line), then comments with crit comment --plan <slug>. After each turn it saves again; crit adds a version only when the text changed. Sessions with no chat comments create nothing. Needs a crit with crit plan --no-wait; with an older crit, chat comments stay in the session.
  • Claude's replies are written with --author Claude.
  • Without the crit CLI (setting critBin), all comments stay in the session.

How the pane is built

  • hooks/register.tsx owns the data (documents, threads, crit sync) and draws the pane as one <Client module="./client.tsx">.
  • hooks/client.tsx owns the cursor, selection, scrolling and the comment box, and posts each change (comment, reply, resolve, send, ...) to the hooks module through ui.message.
  • A Client's props are capped near 100k characters, so it gets a window of rows around the cursor and asks for a new window near the edges.
  • The engine ignores a setState made while the Client draws, so the Client keeps its state in a module variable and calls setState only from its key and mouse handlers.

Developing

claude plugin validate integrations/claude-code-tui
claude plugin test integrations/claude-code-tui

Limits of this early version

  • crit paths are taken as repo-root relative. Start Claude Code at the repo root.
  • Removed (-) diff lines anchor to the new-side line they sit at; crit has no old-side anchor in crit comment --json.
  • crit comment --plan leaves anchor empty (crit bug), so a chat comment does not follow its text if earlier lines of the conversation change.
  • Reopening a resolved crit thread is left to the crit browser UI.
  • The diff is git diff HEAD plus up to 20 untracked files.

関連作品