feat(mcp): issue を実行プロンプト化する issue_to_prompt tool を追加#207
Merged
Conversation
issue を「実装手順 + status 更新の指示 + issue 本文」を含むエージェント 向けプロンプトに整形して返す issue_to_prompt MCP tool を追加する。 issue_to_prompt → session_create → session_prompt と組み合わせることで、 コーディネータ役のエージェントが「issue を特定セッションのエージェントに 実装させる」オーケストレーションを最小手数で組める。 - usecase/issue に純粋なフォーマット関数 to_prompt を追加 - presentation/mcp/issue に issue_to_prompt tool(スキーマ・ディスパッチ)を追加 - 公開 tool 数を 15 → 16(issue 7)に更新 - document/03-commands/03-mcp.md を更新 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2e9f8ec to
4fbe316
Compare
usagi は任意のリポジトリを管理する汎用ツールだが、issue_to_prompt の 生成プロンプトに usagi 固有のパス(.agents/workflow.md / document/06-conventions.md)と Rust 固有のコマンド(cargo fmt/clippy/test)・ カバレッジ要件がハードコードされており、別言語のリポジトリでは破綻していた。 また tool_to_prompt のエラーパス(issue::get が Err)を検証するテストが 欠けており、カバレッジ 100% の CI ゲートを満たせていなかった。 - ワークフロー/規約の参照を「リポジトリの規約ドキュメントに従う」汎用文言に変更 - 品質チェックを「リポジトリの規約に沿ったフォーマット・Lint・テスト」に一般化 - status 更新(issue_update)の指示は usagi 固有なので維持 - usecase_errors_surface_for_every_tool に issue_to_prompt を追加し エラーパスを網羅(lines/functions 100% を回復) - リポジトリ非依存であることを検証するテストを追加 - ドキュメントの返り値フィールド順を実際の serde 出力順に修正 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
📊 Test Coverage
🎉✨ パーフェクト!全ファイル Lines カバレッジ 100% を達成しました 🏆🐰 |
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.
目的
「issue を agent に実行させる」オーケストレーションを MCP で組めるようにする。
既存の MCP には「特定セッションの agent を動かす」プリミティブ(
session_prompt= 対象 worktree でclaude -pを起動)はあるが、issue を agent 向けの実行指示に変換する手段がなかった。コーディネータ役の agent が手で「issue を読む → session を作る → 本文を整形 → status を更新 → prompt を投げる」を組み立てる必要があった。方針はユーザーと相談のうえ、小ツールを分けて合成・**実行は同期(現状踏襲)**を採用した。
変更内容
issue_to_prompt(number)MCP tool を追加(presentation/mcp/issue)。issue を「実装手順 + 着手/完了時の status 更新指示 + issue 本文・メタデータ」を含むエージェント向けプロンプトに整形し、{ number, title, prompt }を返す。issue が存在しなければ実行エラー。usecase::issue::to_prompt(&Issue)を純粋関数として追加(フォーマットのみ。disk I/O なしで単体テスト可能)。document/03-commands/03-mcp.mdを更新(tool 一覧・合成パターンの説明)。issue_to_prompt(number)→session_create(name)→session_prompt(name, prompt)と組み合わせて使う。テスト・確認方法
cargo fmt/cargo clippy --all-targets -- -D warnings/cargo testをパス。usecase::issue: メタデータ・本文の整形、空フィールドのプレースホルダ(なし/(本文なし))。presentation/mcp/issue:issue_to_promptがプロンプトを返すこと・未存在 issue でエラーになること、tools/listが 13 tool(issue 7 + memory 6)を返すこと。presentation/mcp/usagi: 合成サーバが 16 tool を公開すること。🤖 Generated with Claude Code