@geekbeer/minion 3.40.2 → 3.42.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -36,6 +36,7 @@ function streamClaude(input, onEvent, ctx = {}) {
36
36
  cwd: config.HOME_DIR,
37
37
  stdio: ['pipe', 'pipe', 'pipe'],
38
38
  timeout: input.timeoutMs || 3600000, // 60 min default
39
+ shell: IS_WINDOWS, // Resolve .cmd shims (e.g. claude.cmd) on Windows
39
40
  env: {
40
41
  ...process.env,
41
42
  HOME: config.HOME_DIR,
@@ -40,6 +40,7 @@ function spawnWithStdin({ binary, args, prompt, homeDir, env = {}, timeoutMs = 3
40
40
  const child = spawn(binary, args, {
41
41
  cwd: homeDir,
42
42
  stdio: ['pipe', 'pipe', 'pipe'],
43
+ shell: IS_WINDOWS, // Resolve .cmd shims (e.g. claude.cmd) on Windows
43
44
  env: {
44
45
  ...process.env,
45
46
  HOME: homeDir,
@@ -772,6 +772,125 @@ Response:
772
772
 
773
773
  プロジェクト変数はワークフロー実行時に `template_vars` としてミニオンに渡され、スキルの `{{VAR_NAME}}` テンプレートを展開する。
774
774
 
775
+ ### Project Tasks
776
+
777
+ タスクは5段階Kanban (`backlog`/`todo`/`doing`/`review`/`done`)で管理される。親子関係は2階層まで(孫タスク禁止)。担当は **ミニオンか人間の二択**(両方は不可、後勝ち null)。
778
+
779
+ | Method | Endpoint | Description |
780
+ |--------|----------|-------------|
781
+ | GET | `/api/minion/projects/:projectId/tasks` | タスク一覧 |
782
+ | POST | `/api/minion/projects/:projectId/tasks` | タスク作成 |
783
+ | GET | `/api/minion/projects/:projectId/tasks/:taskId` | タスク詳細 |
784
+ | PATCH | `/api/minion/projects/:projectId/tasks/:taskId` | タスク更新(部分更新) |
785
+ | DELETE | `/api/minion/projects/:projectId/tasks/:taskId` | タスク削除(子タスクはCASCADE) |
786
+ | POST | `/api/minion/projects/:projectId/tasks/reorder` | D&D 後の並び替え |
787
+
788
+ GET クエリパラメータ:
789
+ - `?milestone_id=<uuid>` または `?milestone_id=null` (マイルストーン未割当のみ)
790
+ - `?status=backlog|todo|doing|review|done`
791
+ - `?priority=high,urgent` (カンマ区切りで複数指定可。`low`/`normal`/`high`/`urgent`)
792
+ - `?assignee_minion_id=<uuid>` / `?assignee_user_id=<uuid>`
793
+ - `?parent_task_id=<uuid>` または `?parent_task_id=null` (親タスクのみ抽出可)
794
+ - `?overdue=true` (`due_date < today AND status != 'done'`)
795
+ - `?q=<keyword>` タイトル+説明の部分一致検索(pg_trgm + ILIKE。大小文字無視、日本語OK。ワイルドカード構文は使用不可 — リテラル部分文字列として扱われる)
796
+
797
+ POST body:
798
+ ```json
799
+ {
800
+ "title": "...", // required, non-empty string
801
+ "description": null,
802
+ "status": "backlog", // backlog|todo|doing|review|done (default: backlog)
803
+ "priority": "normal", // low|normal|high|urgent (default: normal)
804
+ "milestone_id": null,
805
+ "parent_task_id": null, // 指定時は子タスクとして作成。親が既に子の場合 400
806
+ "assignee_minion_id": null,
807
+ "assignee_user_id": null, // assignee_minion_id と同時指定不可
808
+ "due_date": null // YYYY-MM-DD
809
+ }
810
+ ```
811
+
812
+ ミニオン経由で作成したタスクには `created_by_minion_id` に自身のIDが自動設定される。
813
+
814
+ PATCH body: 同じフィールドを任意で部分指定。**`status` を変更すると `status_changed_at` がサーバ側で自動更新される**(stalled 検出に使われる)。手動で `status_changed_at` を渡しても無視される。`assignee_minion_id` を set するともう一方の `assignee_user_id` は自動 null、その逆も同じ。
815
+
816
+ reorder body:
817
+ ```json
818
+ {
819
+ "task_id": "uuid", // required
820
+ "status": "doing", // 移動先カラム(省略時はそのまま)
821
+ "prev_task_id": null, // 移動後の前隣タスク
822
+ "next_task_id": null // 移動後の次隣タスク
823
+ }
824
+ ```
825
+
826
+ 両 neighbor が null の場合は列の先頭/初期値で挿入される。
827
+
828
+ ### Project Milestones
829
+
830
+ | Method | Endpoint | Description |
831
+ |--------|----------|-------------|
832
+ | GET | `/api/minion/projects/:projectId/milestones` | 一覧 |
833
+ | POST | `/api/minion/projects/:projectId/milestones` | 作成 |
834
+ | GET | `/api/minion/projects/:projectId/milestones/:milestoneId` | 詳細 |
835
+ | PATCH | `/api/minion/projects/:projectId/milestones/:milestoneId` | 更新 |
836
+ | DELETE | `/api/minion/projects/:projectId/milestones/:milestoneId` | 削除(タスクの `milestone_id` は SET NULL) |
837
+
838
+ POST body:
839
+ ```json
840
+ {
841
+ "title": "...", // required
842
+ "description": null,
843
+ "target_date": null, // YYYY-MM-DD
844
+ "status": "planned" // planned|in_progress|done|cancelled
845
+ }
846
+ ```
847
+
848
+ ミニオン作成時は `created_by_minion_id` が自動設定される。マイルストーンを削除しても紐づくタスクは残る(`milestone_id` だけ NULL になる)。
849
+
850
+ ### Project Health
851
+
852
+ PMミニオンが朝のスタンドアップ等で叩く想定の集計エンドポイント。`tasks` と `milestones` を都度 fetch して集計するより、こちらの方がトークン効率が良い。
853
+
854
+ | Method | Endpoint | Description |
855
+ |--------|----------|-------------|
856
+ | GET | `/api/minion/projects/:projectId/health` | プロジェクト健康度サマリ |
857
+
858
+ Response:
859
+ ```json
860
+ {
861
+ "summary": {
862
+ "total_tasks": 42,
863
+ "by_status": {"backlog": 10, "todo": 8, "doing": 6, "review": 3, "done": 15},
864
+ "overdue": 4,
865
+ "stalled": 2
866
+ },
867
+ "milestones": [
868
+ {
869
+ "id": "...",
870
+ "title": "MVP リリース",
871
+ "target_date": "2026-05-31",
872
+ "status": "in_progress",
873
+ "total": 12,
874
+ "done": 5,
875
+ "progress_pct": 41.7,
876
+ "overdue_count": 1,
877
+ "days_remaining": 39
878
+ }
879
+ ]
880
+ }
881
+ ```
882
+
883
+ 定義:
884
+ - `overdue`: `due_date < today AND status != 'done'`
885
+ - `stalled`: `status = 'doing' AND status_changed_at < now() - 5 days`
886
+ - `progress_pct`: マイルストーン内 **leafタスク** の `done / total` × 100 (小数1桁)
887
+ - `days_remaining`: `target_date - today` の日数(target_date が null なら null)
888
+
889
+ **マイルストーン集計の考え方**:
890
+ - `total` / `done` / `overdue_count` は **leaf タスクのみ** を対象にする(子を持つ親 EPIC は集計から除外、コンテナとみなす)。
891
+ - 子タスクが `milestone_id=null` でも、親 EPIC の `milestone_id` を継承して集計される(effective milestone)。つまり「親に MVP を付ければ配下の子タスクも MVP 進捗に含まれる」。
892
+ - `summary.by_status` は従来どおり全タスク(親含む)で計上する。
893
+
775
894
  ### Workflow Variables (PM only)
776
895
 
777
896
  | Method | Endpoint | Description |
@@ -562,6 +562,119 @@ curl -s -X PUT "$HQ_URL/api/minion/me/project/<project-id>/context" \
562
562
 
563
563
  ---
564
564
 
565
+ ## プロジェクトタスク管理
566
+
567
+ タスクは5段階Kanban (`backlog`/`todo`/`doing`/`review`/`done`)で管理する。詳細なAPI仕様は `~/.minion/docs/api-reference.md` の「Project Tasks」「Project Milestones」「Project Health」を参照。
568
+
569
+ ### PM ロールの典型操作
570
+
571
+ #### 1. 朝の健康度チェック
572
+
573
+ ```bash
574
+ curl -s "$HQ_URL/api/minion/projects/<project-id>/health" \
575
+ -H "Authorization: Bearer $API_TOKEN"
576
+ ```
577
+
578
+ `overdue > 0` または `stalled > 0` のタスクを抽出してフォローアップ:
579
+
580
+ ```bash
581
+ # 過遅れタスク一覧
582
+ curl -s "$HQ_URL/api/minion/projects/<project-id>/tasks?overdue=true" \
583
+ -H "Authorization: Bearer $API_TOKEN"
584
+
585
+ # 5日以上 doing のまま停滞しているタスク
586
+ curl -s "$HQ_URL/api/minion/projects/<project-id>/tasks?status=doing" \
587
+ -H "Authorization: Bearer $API_TOKEN" | \
588
+ jq '[.[] | select(.status_changed_at < (now - 5*86400 | todate))]'
589
+ ```
590
+
591
+ #### 2. ユーザー要望をエピック+タスクに分解
592
+
593
+ ```bash
594
+ # 1. エピック(親タスク)を作成。マイルストーンは親にだけ付ければ OK(子は継承して集計される)
595
+ curl -X POST "$HQ_URL/api/minion/projects/<project-id>/tasks" \
596
+ -H "Authorization: Bearer $API_TOKEN" -H "Content-Type: application/json" \
597
+ -d '{"title":"認証フロー実装","status":"todo","priority":"high","milestone_id":"<m-uuid>"}'
598
+ # レスポンスの id を <epic-id> として控える
599
+
600
+ # 2. 子タスクを複数作成して engineer ミニオンに割り当て
601
+ curl -X POST "$HQ_URL/api/minion/projects/<project-id>/tasks" \
602
+ -H "Authorization: Bearer $API_TOKEN" -H "Content-Type: application/json" \
603
+ -d '{"title":"DBスキーマ設計","parent_task_id":"<epic-id>","priority":"normal","assignee_minion_id":"<eng-id>"}'
604
+ ```
605
+
606
+ 注意: 親タスクが既に子タスク(=2階層目)の場合、子を作ろうとすると 400 が返る。**孫タスクは作れない**。
607
+
608
+ **priority ガイド**:
609
+ - `urgent`: 今日中に着手が必要。インシデント対応や本番影響あり
610
+ - `high`: 今週中に終わらせたい。マイルストーンのクリティカルパス
611
+ - `normal`: 通常(default)
612
+ - `low`: 余裕があればやる改善/nice-to-have
613
+
614
+ **タスクの検索**(キーワードで絞り込み):
615
+
616
+ ```bash
617
+ # タイトル + 説明文を部分一致検索(日本語OK、大小文字無視)
618
+ curl -s "$HQ_URL/api/minion/projects/<project-id>/tasks?q=認証" \
619
+ -H "Authorization: Bearer $API_TOKEN"
620
+
621
+ # priority で絞り込み(カンマ区切り複数可)
622
+ curl -s "$HQ_URL/api/minion/projects/<project-id>/tasks?priority=high,urgent" \
623
+ -H "Authorization: Bearer $API_TOKEN"
624
+ ```
625
+
626
+ #### 3. マイルストーン管理
627
+
628
+ ```bash
629
+ # 作成
630
+ curl -X POST "$HQ_URL/api/minion/projects/<project-id>/milestones" \
631
+ -H "Authorization: Bearer $API_TOKEN" -H "Content-Type: application/json" \
632
+ -d '{"title":"MVP リリース","target_date":"2026-05-31","status":"planned"}'
633
+
634
+ # ステータス更新
635
+ curl -X PATCH "$HQ_URL/api/minion/projects/<project-id>/milestones/<m-id>" \
636
+ -H "Authorization: Bearer $API_TOKEN" -H "Content-Type: application/json" \
637
+ -d '{"status":"in_progress"}'
638
+ ```
639
+
640
+ ### Engineer ロールの典型操作
641
+
642
+ #### 1. 自分にアサインされたタスクを取得
643
+
644
+ ```bash
645
+ curl -s "$HQ_URL/api/minion/projects/<project-id>/tasks?assignee_minion_id=$MINION_ID&status=todo" \
646
+ -H "Authorization: Bearer $API_TOKEN"
647
+ ```
648
+
649
+ #### 2. 進捗マーク
650
+
651
+ ```bash
652
+ # 着手 (status_changed_at がサーバ側で自動更新されるので、stalled 検出が正しく動く)
653
+ curl -X PATCH "$HQ_URL/api/minion/projects/<project-id>/tasks/<task-id>" \
654
+ -H "Authorization: Bearer $API_TOKEN" -H "Content-Type: application/json" \
655
+ -d '{"status":"doing"}'
656
+
657
+ # レビュー依頼
658
+ curl -X PATCH "$HQ_URL/api/minion/projects/<project-id>/tasks/<task-id>" \
659
+ -H "Authorization: Bearer $API_TOKEN" -H "Content-Type: application/json" \
660
+ -d '{"status":"review"}'
661
+
662
+ # 完了
663
+ curl -X PATCH "$HQ_URL/api/minion/projects/<project-id>/tasks/<task-id>" \
664
+ -H "Authorization: Bearer $API_TOKEN" -H "Content-Type: application/json" \
665
+ -d '{"status":"done"}'
666
+ ```
667
+
668
+ ### 共通の注意
669
+
670
+ - **`status_changed_at` を手動で渡してはならない**。サーバ側で自動更新される(stalled 検出に使われる)。
671
+ - **`assignee_minion_id` と `assignee_user_id` は二者択一**。どちらかを set すると、もう一方は自動で null になる。
672
+ - **タスク削除はCASCADE**。エピックを消すと子タスクも全て消えるので注意。
673
+ - **マイルストーン削除時、紐づくタスクの `milestone_id` は SET NULL**(タスク自体は残る)。
674
+ - **作成・編集したタスク/マイルストーンには `created_by_minion_id` が自動記録される**ので、誰が起票したかを後追いできる。
675
+
676
+ ---
677
+
565
678
  ## 実行結果の確認
566
679
 
567
680
  ### ローカル実行履歴
@@ -410,6 +410,13 @@ async function buildContextPrefix(message, context, sessionId, workspaceId) {
410
410
  `プロジェクト情報を取得するには以下を実行してください:`,
411
411
  ` hq fetch project ${context.projectId}`,
412
412
  ` hq fetch project-context ${context.projectId}`,
413
+ `タスク・マイルストーン・健康度を扱う場合は以下のAPIを使えます (Bearer 認証必須):`,
414
+ ` GET \$HQ_URL/api/minion/projects/${context.projectId}/tasks # 一覧 (?milestone_id= ?status= ?priority=high,urgent ?assignee_minion_id= ?overdue=true ?q=<substring> 等で絞り込み可。q は日本語OKの部分一致)`,
415
+ ` POST \$HQ_URL/api/minion/projects/${context.projectId}/tasks # 作成 (body: title, description?, status?, priority?, milestone_id?, parent_task_id?, assignee_minion_id?, due_date?)`,
416
+ ` PATCH \$HQ_URL/api/minion/projects/${context.projectId}/tasks/<id> # 更新 (status変更で status_changed_at がサーバ自動更新、priority 変更も可)`,
417
+ ` GET \$HQ_URL/api/minion/projects/${context.projectId}/milestones # マイルストーン一覧`,
418
+ ` GET \$HQ_URL/api/minion/projects/${context.projectId}/health # 健康度サマリ (overdue/stalled/マイルストーン進捗。progress_pct は leaf タスク基準)`,
419
+ `タスクは5段階Kanban (backlog→todo→doing→review→done)、親子は2階層まで(孫不可)。priority は low|normal|high|urgent (可視化+フィルタ用)。親EPICに milestone_id を付ければ子タスクも進捗に自動反映される。詳細は ~/.minion/docs/api-reference.md の「Project Tasks」「Project Milestones」「Project Health」を参照。`,
413
420
  `取得した内容をもとに回答してください。`
414
421
  )
415
422
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geekbeer/minion",
3
- "version": "3.40.2",
3
+ "version": "3.42.2",
4
4
  "description": "AI Agent runtime for Minion - manages status and skill deployment on VPS",
5
5
  "main": "linux/server.js",
6
6
  "bin": {
package/rules/core.md CHANGED
@@ -36,6 +36,14 @@ Minion
36
36
  - **transform ノードの I/O 型は edge の contract から自動導出**。incoming edge と outgoing edge にそれぞれ contract を必ず貼ること。`transform_instruction` は contract だけで意図が伝わらない場合の補足ヒント(任意)
37
37
  - **fan_out の incoming edge に contract を貼る場合**、`fan_out_source` が指すフィールドが contract 内に `type='array'` として宣言されている必要がある(静的検証で弾かれる)
38
38
  - **Routine**: ミニオンスコープ。ミニオンローカルの定期タスク。
39
+ - **Project Tasks / Milestones**: プロジェクトスコープ。**人間+ミニオンが共有するタスクボード**(5段階Kanban: `backlog`→`todo`→`doing`→`review`→`done`)とロードマップ(マイルストーン)。ミニオンは `/api/minion/projects/:projectId/{tasks,milestones,health}` で操作可能。
40
+ - PMロールは朝のチェックで `/health` を叩いて遅延・停滞タスクを把握、ユーザー要望をエピック+子タスクに分解
41
+ - Engineerロールは `?assignee_minion_id=$MINION_ID` で自分のタスクを取得し、着手時に `status: doing` へ更新(以降 `status_changed_at` がサーバ側で自動更新され、停滞検出に使われる)
42
+ - 親子は2階層のみ(孫タスク禁止)、担当は **ミニオン or 人間** の二択
43
+ - **priority**: `low` / `normal` / `high` / `urgent` (default `normal`)。可視化とフィルタ用途(並び順は `sort_order` が優先)
44
+ - **`milestone_id` は親 EPIC に付ければ配下の子タスクも自動的にその進捗に含まれる**(effective milestone)。子を個別にひもづけ直す必要はない。`/health` は leaf タスク基準で `progress_pct` を算出する
45
+ - **タスク検索**: `?q=<keyword>` でタイトル+説明の部分一致検索(pg_trgm、日本語OK)、`?priority=high,urgent` でカンマ区切り複数指定
46
+ - 詳細は `~/.minion/docs/api-reference.md` の「Project Tasks」「Project Milestones」「Project Health」と `~/.minion/docs/task-guides.md` の「プロジェクトタスク管理」を参照
39
47
  - **Workspace**: ミニオンは複数のワークスペースに所属でき、スキルやプロジェクトはワークスペース単位でスコープされる。チャットセッションもワークスペース別に分離される。所属ワークスペースはハートビートで自動同期され、`hq list workspaces` で確認できる。
40
48
  - ミニオンは複数プロジェクトに `pm`、`engineer`、`accountant` として参加できる。
41
49
 
@@ -473,6 +473,13 @@ async function buildContextPrefix(message, context, sessionId, workspaceId) {
473
473
  `プロジェクト情報を取得するには以下を実行してください:`,
474
474
  ` hq fetch project ${context.projectId}`,
475
475
  ` hq fetch project-context ${context.projectId}`,
476
+ `タスク・マイルストーン・健康度を扱う場合は以下のAPIを使えます (Bearer 認証必須):`,
477
+ ` GET \$HQ_URL/api/minion/projects/${context.projectId}/tasks # 一覧 (?milestone_id= ?status= ?priority=high,urgent ?assignee_minion_id= ?overdue=true ?q=<substring> 等で絞り込み可。q は日本語OKの部分一致)`,
478
+ ` POST \$HQ_URL/api/minion/projects/${context.projectId}/tasks # 作成 (body: title, description?, status?, priority?, milestone_id?, parent_task_id?, assignee_minion_id?, due_date?)`,
479
+ ` PATCH \$HQ_URL/api/minion/projects/${context.projectId}/tasks/<id> # 更新 (status変更で status_changed_at がサーバ自動更新、priority 変更も可)`,
480
+ ` GET \$HQ_URL/api/minion/projects/${context.projectId}/milestones # マイルストーン一覧`,
481
+ ` GET \$HQ_URL/api/minion/projects/${context.projectId}/health # 健康度サマリ (overdue/stalled/マイルストーン進捗。progress_pct は leaf タスク基準)`,
482
+ `タスクは5段階Kanban (backlog→todo→doing→review→done)、親子は2階層まで(孫不可)。priority は low|normal|high|urgent (可視化+フィルタ用)。親EPICに milestone_id を付ければ子タスクも進捗に自動反映される。詳細は ~/.minion/docs/api-reference.md の「Project Tasks」「Project Milestones」「Project Health」を参照。`,
476
483
  `取得した内容をもとに回答してください。`
477
484
  )
478
485
  }