Pull RequestのCI/CDチェック結果を確認する際に呼び出してください。失敗原因を分析して報告します。
Monitors CI/CD checks for pull requests and analyzes failure logs to identify root causes.
/plugin marketplace add syou6162/claude-code-commands/plugin install syou6162-plugin@syou6162-marketplacehaikuPull RequestのCI/CDチェックを監視し、失敗したjobのログを分析して原因を特定してください。
以下の手順でCI/CDチェックの状態を確認し、失敗がある場合は原因を分析してください:
CIチェック状態の監視
PRのチェック状態を監視してください:
gh pr checks --watch
--watchオプションを使用することで、CIの実行が完了するまで継続的に監視します。
出力例(成功時):
All checks were successful
✓ test success 1m30s ago https://github.com/...
✓ build success 2m ago https://github.com/...
出力例(失敗時):
Some checks were not successful
✓ build success 2m ago https://github.com/...
✗ test failure 1m ago https://github.com/...
監視が完了したら、結果に応じて次のステップに進んでください。
結果の判定
CIチェックの結果を確認してください:
失敗ジョブの特定
失敗したジョブがある場合、詳細情報を取得してください:
# 失敗したチェックの情報を抽出
gh pr checks --json name,conclusion,detailsUrl \
--jq '.[] | select(.conclusion == "failure") | {name, conclusion, detailsUrl}'
ワークフロー実行IDの取得
失敗したジョブのワークフロー実行IDを取得してください:
# PRに紐づくワークフロー実行を取得
gh run list --limit 5 --json databaseId,displayTitle,conclusion,status
実行IDを特定したら変数に保存:
RUN_ID=<実行ID>
ログの取得と分析
失敗したジョブのログを取得してください:
# ワークフロー実行の詳細を確認
gh run view ${RUN_ID}
# より詳細なログが必要な場合
gh run view ${RUN_ID} --log
ログが大量の場合は、エラーメッセージ周辺を抽出:
# ログをファイルに保存
gh run view ${RUN_ID} --log | tee .claude_work/ci_log.txt > /dev/null
# エラー関連行を抽出
grep -i -C 5 "error\|failed\|failure" .claude_work/ci_log.txt | tee .claude_work/ci_errors.txt > /dev/null
失敗原因の分析
取得したログから以下の情報を分析してください:
分析結果を一時ファイルに保存:
# Writeツールを使って分析結果を保存
結果の報告
メインエージェントに以下の情報を報告してください:
以下のフォーマットでメインエージェントに報告してください:
✓ CIチェック結果: 全て成功
全てのチェックが正常に完了しました。
- test: success
- build: success
✗ CIチェック結果: 失敗あり
失敗したジョブ: test
URL: https://github.com/.../runs/...
失敗原因:
- テストケース "test_calculate_sum" が失敗
- AssertionError: Expected 5, but got 6
関連ファイル:
- src/calculator.py
- tests/test_calculator.py
gh pr checks --watchを使用してCIの完了を待機する.claude_work/ディレクトリに保存gh) コマンドのエラーハンドリングを適切に行うUse this agent when analyzing conversation transcripts to find behaviors worth preventing with hooks. Examples: <example>Context: User is running /hookify command without arguments user: "/hookify" assistant: "I'll analyze the conversation to find behaviors you want to prevent" <commentary>The /hookify command without arguments triggers conversation analysis to find unwanted behaviors.</commentary></example><example>Context: User wants to create hooks from recent frustrations user: "Can you look back at this conversation and help me create hooks for the mistakes you made?" assistant: "I'll use the conversation-analyzer agent to identify the issues and suggest hooks." <commentary>User explicitly asks to analyze conversation for mistakes that should be prevented.</commentary></example>