Files
2025-11-30 08:35:56 +08:00

245 lines
7.6 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
description: 次に実行すべきタスクを取得して実行する
argument-hint: [issue_number] [--category=CAT] [--priority=high|medium|low]
allowed-tools: Bash, Read, Write, Edit, MultiEdit, Glob, Grep
---
# 次タスクの選択と実行
指定されたPBI$1が指定された場合または全PBIから次に実行すべきタスクを選択し、実行します。
## 実行オプション
```bash
/task-next # 全PBIから最適なタスクを選択
/task-next 123 # PBI #123から次タスクを選択
/task-next 123 --category=setup # 特定カテゴリのタスクを優先
/task-next --priority=high # 高優先度タスクのみ検索
```
## 実行内容
### 1. 次タスクの特定(カテゴリ・優先度考慮)
**PBI指定時$1が存在:**
- `tasks/pbi-$1/` ディレクトリ内の `todo-*.md` ファイルを検索
- カテゴリ別ファイル命名規則: `todo-{category}-{number}.md`
- 優先度とカテゴリ依存関係を考慮してタスク選択
**全PBI検索時引数なし:**
- `tasks/` 配下のすべての `pbi-*` ディレクトリを検索
- カテゴリ依存関係による実行可能タスクをフィルタリング
- 優先度・作成日時・ブロック状況を総合評価
**カテゴリ依存関係**:
```
Setup → Models → Services → UI → Tests
↓ ↓ ↓ ↓ ↓
基盤 データ層 API層 UI層 品質保証
```
### 2. 詳細タスク情報の表示
選択されたタスクの内容を表示:
```
【次のタスク】
PBI: #<issue_number>
カテゴリ: <category> (Setup/Models/Services/UI/Tests)
優先度: <priority> (High/Medium/Low)
推定時間: <estimated_hours>時間
タスク: <task_title>
ファイル: <task_filename>
=== 前提条件 ===
✅ 完了済み依存タスク: <dependency_tasks>
⚠️ 未完了依存タスク: <blocking_tasks>
=== タスク詳細 ===
<task_content>
=== リファインメント情報 ===
関連する要件: <requirement_trace>
技術仕様: <tech_spec_summary>
```
### 3. 実行確認と開始処理
**依存関係チェック**:
- 前提タスクの完了状況確認
- ブロック状況があれば警告表示
- 実行可能性の判定
**ユーザー確認**:
- 実行確認とブロック解除オプション提示
- 確認後、以下の処理を実行:
1. `todo-{category}-N.md``wip-{category}-N.md` にリネーム
2. YAMLフロントマターの `started` フィールドを現在時刻で更新
3. 作業開始をユーザーに通知
### 4. 実装作業のガイド(カテゴリ別)
**Setup系タスク**:
- 環境構築、依存関係インストール
- 設定ファイル作成、初期構造構築
- 他のカテゴリの前提条件を満たす
**Models系タスク**:
- データモデル・スキーマ定義
- データベース migration作成
- ORM/モデルクラス実装
**Services系タスク**:
- ビジネスロジック実装
- API エンドポイント作成
- 外部サービス連携
**UI系タスク**:
- コンポーネント実装
- 画面・フォーム作成
- ユーザーインタラクション
**Tests系タスク**:
- 単体テスト・統合テスト
- E2Eテスト実装
- テストデータ準備
### 5. 完了処理とカテゴリ連携
**状態更新**:
1. `wip-{category}-N.md``done-{category}-N.md` にリネーム
2. YAMLフロントマターの `completed` フィールドを現在時刻で更新
3. 親PBIの `README.md` のカテゴリ別タスク一覧を更新
**次タスクの解放**:
- 依存関係チェーンの確認
- ブロックされていたタスクの実行可能化
- 次の実行可能タスクの通知
**GitHub Issue連携**:
- カテゴリ付きタスク完了コメント投稿
- 進捗状況の更新(カテゴリ別進捗含む)
### 6. 進捗状況とカテゴリ分析
**PBI進捗の詳細表示**:
```
【PBI #123 進捗状況】
全体: 3/8 タスク完了 (37.5%)
カテゴリ別進捗:
✅ Setup: 1/1 完了 (100%)
🔄 Models: 1/2 進行中 (50%)
⏳ Services: 0/2 待機中 (Models完了待ち)
⬜ UI: 0/2 未開始
⬜ Tests: 0/1 未開始
次に実行可能:
- Models残り1タスク (高優先度)
```
**全体最適化提案**:
- 並行実行可能タスクの提案
- ボトルネックとなっているカテゴリの特定
- 実装順序の最適化提案
## 利用可能な検索・操作コマンド
```bash
# PBI一覧の取得
find tasks -name "pbi-*" -type d | sort
# カテゴリ別タスク検索
find tasks/pbi-$1 -name "todo-setup-*.md" # Setup系タスク
find tasks/pbi-$1 -name "todo-models-*.md" # Models系タスク
find tasks/pbi-$1 -name "todo-services-*.md" # Services系タスク
find tasks/pbi-$1 -name "todo-ui-*.md" # UI系タスク
find tasks/pbi-$1 -name "todo-tests-*.md" # Tests系タスク
# 優先度別検索
grep "priority: high" tasks/pbi-$1/todo-*.md
grep "priority: medium" tasks/pbi-$1/todo-*.md
# 依存関係確認
grep "depends_on:" tasks/pbi-$1/todo-*.md
# タスクファイルの状態変更(カテゴリ保持)
mv tasks/pbi-$1/todo-setup-1.md tasks/pbi-$1/wip-setup-1.md
mv tasks/pbi-$1/wip-setup-1.md tasks/pbi-$1/done-setup-1.md
# 進捗状況の取得
find tasks/pbi-$1 -name "done-*.md" | wc -l # 完了タスク数
find tasks/pbi-$1 -name "wip-*.md" | wc -l # 実行中タスク数
find tasks/pbi-$1 -name "todo-*.md" | wc -l # 未着手タスク数
# カテゴリ別進捗確認
find tasks/pbi-$1 -name "done-setup-*.md" | wc -l
find tasks/pbi-$1 -name "*-models-*.md" | wc -l
# GitHub Issueへのカテゴリ付きコメント投稿
gh issue comment $1 --body "✅ [Setup] タスク完了: <task_title>"
```
## カテゴリ依存関係の管理
```bash
# 依存関係チェック関数例
check_dependencies() {
local task_file="$1"
local depends_on=$(grep "depends_on:" "$task_file" | cut -d: -f2)
for dep in $depends_on; do
if [ ! -f "tasks/pbi-$1/done-$dep.md" ]; then
echo "❌ 依存タスク未完了: $dep"
return 1
fi
done
return 0
}
# 次実行可能タスクの特定
find_executable_tasks() {
for todo_file in tasks/pbi-$1/todo-*.md; do
if check_dependencies "$todo_file"; then
echo "$todo_file"
fi
done
}
```
## エラーハンドリング
### 基本エラー処理
- 指定されたPBIが存在しない場合の適切なエラー
- 実行可能なタスクが見つからない場合の案内
- GitHub CLI未認証時のエラー処理
- ファイル操作失敗時のロールバック
### カテゴリ特有のエラー処理
- 依存関係未満足時の詳細説明
- カテゴリ間の循環依存検出
- 優先度指定時の該当タスクなしエラー
- 推定時間超過時の警告
### 復旧支援機能
- 中断されたwipタスクの復旧提案
- 依存関係エラー時の解決パス提示
- カテゴリ順序の修正提案
## 完了条件
### 基本完了条件
- 次タスクが正常に特定・表示されている
- カテゴリと優先度が適切に考慮されている
- 依存関係チェックが正常に機能している
### 状態管理の完了条件
- タスク状態が適切に更新されているtodo→wip→done
- カテゴリ情報がファイル名に保持されている
- 依存関係の解放が正常に実行されている
### 進捗管理の完了条件
- PBI進捗状況が正確に表示されているカテゴリ別含む
- GitHub Issueに適切なコメントが投稿されている
- 次の実行可能タスクが適切に提案されている
実行を開始しますか?