Skip to the content.

🚀 Phase 2 - 詳細な実装計画

開始日: 2026-02-27
完成目標: 2026-03-06(1週間)
ゴール: GitHub Issue → Supabase Realtime → VS Code Copilot 統合パイプラインの完全動作


📋 全体構成(3段階のマイルストーン)

🥇 Milestone 1: データ層(Task #1)

期間: 2026-02-27 ~ 2026-02-28
必要時間: 30分~1時間
ステータス: ⏳ Not Started

1.1 Supabase スキーマ設計

1.2 Supabase Studio でテーブル作成

チェックリスト:

1.3 RLS (Row Level Security) ポリシー設定

-- Anon users: READ/INSERT のみ (authentication 不要)
CREATE POLICY "anon_insert" ON github_issues
  FOR INSERT TO anon
  WITH CHECK (true);

CREATE POLICY "anon_select" ON github_issues
  FOR SELECT TO anon
  USING (true);

-- Authenticated users: full access
CREATE POLICY "auth_full" ON github_issues
  FOR ALL TO authenticated
  USING (true)
  WITH CHECK (true);

1.4 Realtime Policies 有効化

1.5 サンプルデータ INSERT & テスト

INSERT INTO github_issues (issue_number, title, body, creator, status)
VALUES (123, 'Test Issue', 'This is a test issue', 'test-user', 'pending');

完了条件: ✅ 3つのテーブルが Supabase に存在 ✅ RLS ポリシーが有効 ✅ Realtime policies が有効 ✅ サンプルデータ INSERT が成功


🥈 Milestone 2: パイプライン層(Task #2)

期間: 2026-02-28 ~ 2026-03-02
必要時間: 1~2時間
ステータス: ⏳ Not Started

2.1 GitHub Actions ワークフロー設計

ファイル: .github/workflows/issue-to-supabase.yml

name: Issue to Supabase
on:
  issues:
    types: [opened, edited]
  issue_comment:
    types: [created, edited]

env:
  SUPABASE_URL: $
  SUPABASE_KEY: $

jobs:
  sync-to-supabase:
    runs-on: ubuntu-latest
    steps:
      - name: Extract issue data
        uses: actions/github-script@v6
        with:
          script: |
            const issue = context.payload.issue;
            const payload = {
              issue_number: issue.number,
              title: issue.title,
              body: issue.body,
              creator: issue.user.login,
              status: 'pending'
            };
            console.log('Payload:', JSON.stringify(payload));

      - name: Send to Supabase
        run: |
          curl -X POST 'https://rootomzbucovwdqsscqd.supabase.co/rest/v1/github_issues' \
            -H 'apikey: $' \
            -H 'Content-Type: application/json' \
            -d "$PAYLOAD"

2.2 Webhook ペイロード解析

2.3 Supabase REST API 呼び出し実装

curl -X POST "https://rootomzbucovwdqsscqd.supabase.co/rest/v1/github_issues" \
  -H "apikey: $SUPABASE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "issue_number": 42,
    "title": "New Feature",
    "body": "Description...",
    "creator": "miyataken999",
    "status": "pending"
  }'

2.4 エラーハンドリング・ロギング

2.5 テスト実行

完了条件:.github/workflows/issue-to-supabase.yml が存在 ✅ GitHub secrets に API キーが登録 ✅ テスト Issue でデータが自動 INSERT される ✅ Supabase に github_issues データが存在


🥉 Milestone 3: AI 統合層(Task #3)

期間: 2026-03-02 ~ 2026-03-06
必要時間: 2~3時間
ステータス: ⏳ Not Started

3.1 AUTOCREATER コード分析

タスク: 既存実装パターンの学習

3.2 Supabase Realtime Listener 実装

ファイル: src/supabase_listener.py

import asyncio
from supabase import create_client, Client
from realtime.channel import Channel

SUPABASE_URL = "https://rootomzbucovwdqsscqd.supabase.co"
SUPABASE_KEY = os.getenv("SUPABASE_KEY")

async def listen_to_github_issues():
    client = create_client(SUPABASE_URL, SUPABASE_KEY)
    
    # Realtime listener setup
    channel = client.channel("github_issues")
    
    def on_insert(payload):
        print(f"New issue: {payload['new']}")
        # Copilot に送信
        process_with_copilot(payload['new'])
    
    channel.on("INSERT", on_insert).subscribe()
    
    # Keep listening
    while True:
        await asyncio.sleep(1)

if __name__ == "__main__":
    asyncio.run(listen_to_github_issues())

3.3 pyautogui Copilot Chat 連携

ファイル: src/copilot_automation.py

import pyautogui
import time
from PIL import ImageGrab

def send_to_copilot_chat(message: str):
    """Copilot Chat ウィンドウに自動入力"""
    
    # Copilot Chat ウィンドウをアクティブ化
    pyautogui.hotkey('cmd', 'shift', 'p')  # Command Palette
    time.sleep(0.5)
    pyautogui.typewrite('Copilot Chat')
    pyautogui.press('enter')
    
    # テキスト入力
    time.sleep(1)
    pyautogui.typewrite(message, interval=0.05)
    
    # 送信
    pyautogui.hotkey('ctrl', 'enter')
    
    # 応答待機
    time.sleep(3)
    
    return capture_copilot_response()

def capture_copilot_response():
    """Copilot の応答をキャプチャ"""
    screenshot = ImageGrab.grab()
    # または VS Code API でテキスト取得
    return screenshot

3.4 メッセージ フォーマット処理

def format_for_copilot(github_issue: dict) -> str:
    """GitHub Issue を Copilot Chat 用にフォーマット"""
    return f"""
GitHub Issue #{github_issue['issue_number']}
Title: {github_issue['title']}
Reporter: {github_issue['creator']}

Description:
{github_issue['body']}

Please analyze this issue and provide a solution.
"""

3.5 応答ストレージ実装

async def store_copilot_response(github_issue_id: str, response: str):
    """Copilot の応答を Supabase に保存"""
    client = create_client(SUPABASE_URL, SUPABASE_KEY)
    
    client.table("ai_responses").insert({
        "github_issue_id": github_issue_id,
        "response_text": response,
        "generated_at": datetime.now().isoformat()
    }).execute()

3.6 End-to-End テスト

テストフロー:

1. GitHub Issue #999 作成
2. GitHub Actions トリガー
3. Supabase INSERT (github_issues)
4. Realtime listener イベント受信
5. Copilot Chat に自動入力
6. Copilot 応答取得
7. Supabase ai_responses に保存
8. 全プロセス完了確認

完了条件: ✅ Realtime listener が正常に動作 ✅ Copilot Chat に自動入力できる ✅ 応答が Supabase に保存される ✅ End-to-end フローが完全に動作


🔑 環境セットアップ(前提条件)

GitHub Secrets の登録

gh secret set SUPABASE_URL --body "https://rootomzbucovwdqsscqd.supabase.co"
gh secret set SUPABASE_KEY --body "your-anon-key-here"

.env ファイル(ローカル開発)

SUPABASE_URL=https://rootomzbucovwdqsscqd.supabase.co
SUPABASE_KEY=your-anon-key
GITHUB_TOKEN=your-github-token-here

Python 依存関係

pip install supabase realtime pyautogui pillow python-dotenv

📊 進捗トラッキング

Milestone Task ETA Status
🥇 Data Layer #1 Supabase 2/28 ⏳ Not Started
🥈 Pipeline #2 Actions 3/2 ⏳ Not Started
🥉 Integration #3 Bridge 3/6 ⏳ Not Started

🤖 AI管理者システム(Advanced Pattern)

🎯 アーキテクチャ図

miyataken(人間)
    ↓ Issue 作成
GitHub #1-23(指示書)
    ↓ (GitHub Actions)
Supabase chat_history / github_issues
    ↑↓ Realtime (Subscription)
VS Code copilot-input-helper plugin
    ↑↓ (pyautogui)
GitHub Copilot Chat (AI管理者)
    ↓ (Issue を分析・他AIに指示)
リモートAI(Gemini, Claude等)
    ↓ (実装実行)
結果
    ↓ (Supabase INSERT)
AI管理者へ戻る ← 循環完成

✨ clasp + copilot-input-helper の活用

既存実装 (localProject/clasp/vscode/copilot-input-helper):

このシステムを ai-automation-platform に統合:

  1. Issue → Supabase → オブザーブ
    • GitHub Issue が作成される
    • GitHub Actions が Supabase INSERT(github_issues)
    • copilot-input-helper plugin が Realtime で INSERT イベントをキャッチ
  2. Copilot Chat へ自動入力
    • plugin が Issue データをフォーマット
    • pyautogui で Copilot Chat に自動入力
    • 「Execute this GitHub Issue」という指示を送る
  3. AI管理実行
    • GitHub Copilot が Issue を分析
    • リモートAI(n8n ワークフロー組み込みGemini等)に指示を出す
    • 実装結果を生成
  4. 結果を保存 → 循環継続
    • Copilot が ai_responses テーブルに INSERT
    • リモートAI がテーブルを参照・フィードバック
    • miyataken が結果を確認

🔄 マルチAI協調のフロー例

Issue #50: "Implement user auth system"
     
Copilot (AI管理者):
  "Claude, analyze this auth requirements and generate implementation"
    
Claude (n8n経由):
  "Generated auth implementation code..."
    
Copilot (AI管理者):
  "Gemini, review this code and suggest improvements"
    
Gemini (n8n経由):
  "Code review: Found 3 issues, suggestions..."
    
Copilot (AI管理者):
  "Apply improvements and finalize"
    
Final Result → ai_responses テーブル
    
miyataken が確認 → Issue close

📋 実装チェックリスト(追加)

clasp 統合:

マルチAI設定:


🎯 定義:完成とは

最小要件(MVP):

中程度の完成:

拡張機能(今後):


作成者: GitHub Copilot AI
最終更新: 2026-02-27
参考: localProject/clasp/vscode/copilot-input-helper
Next Action: Task #1 Supabase テーブル実装開始