0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

親レポのClaudeCodeから自動でサブモジュール作業を立ち上げる

Posted at

警告
この記事はAIに書いてもらっています、実装前の構想段階なのでご注意ください

サブモジュール管理ガイド

1. 概要

親リポジトリで作業中のClaude Codeが、サブモジュールの修正が必要になった際に、自動的に別のClaude Codeセッションを起動し、GitHub Issueに基づいた修正作業を並行して実行できるシステム。

解決する課題

  • サブモジュールの修正時にコンテキストスイッチが発生する
  • 親リポジトリの作業を中断する必要がある
  • 手動でディレクトリ移動やClaude Code起動が必要
  • Issue管理との連携が手動

2. システムアーキテクチャ

コンポーネント構成

親リポジトリ/
├── scripts/
│   ├── claude-submodule-fix.sh    # メイン実行スクリプト
│   └── claude-helper.sh           # ヘルパー関数集
├── submodules/                    # サブモジュール格納ディレクトリ
│   └── [各サブモジュール]/
├── CLAUDE.md                      # Claude Code用インストラクション
└── .gitmodules                    # サブモジュール設定

処理フロー

3. 実装

基本的な使用方法

# サブモジュール追加
git submodule add https://github.com/org/module.git submodules/module

# 修正が必要な場合
./scripts/claude-submodule-fix.sh submodules/module 123

# 複数のサブモジュール管理
source ./scripts/claude-helper.sh
fix_multiple_submodules module1 101 module2 102

スクリプト機能

claude-submodule-fix.sh

  • サブモジュールパスとIssue番号/URLを受け取る
  • Issue URLの自動構築
  • プラットフォーム別のターミナル起動(macOS/Linux)
  • Claude Code起動時のプロンプト自動生成

claude-helper.sh

  • fix_submodule(): 単一サブモジュール修正
  • fix_multiple_submodules(): 複数サブモジュール一括修正
  • check_submodule_status(): サブモジュール状態確認

プラットフォーム別実行

4. 並行処理

5. エラーハンドリング

6. ワークフロー例

単一サブモジュール修正

# 親Claude Codeから実行
./scripts/claude-submodule-fix.sh submodules/auth-module 45
# → 新ターミナルで子Claude Codeが起動
# → Issue #45 に基づいて修正
# → PR作成まで自動実行

修正後の同期

# サブモジュールの最新を取得
git submodule update --remote submodules/auth-module

# 親リポジトリにコミット
git add submodules/auth-module
git commit -m "Update auth-module: Fix issue #45"

7. ベストプラクティス

DO ✅

  • 必ずIssueベースで修正を管理
  • PR作成時にIssue番号を含める
  • 修正完了後は親リポジトリで必ず同期
  • コミットメッセージに修正内容を明記

DON'T ❌

  • 手動でサブモジュール内を直接編集
  • Issueなしで修正作業
  • 同期せずに放置

8. トラブルシューティング

問題: 新しいターミナルが開かない

  • 対処: ターミナルアプリケーションの権限確認
  • 代替: 手動でコマンドをコピー&ペースト

問題: Claude Codeが起動しない

  • 対処: Claude CLIのパス確認 (which claude)
  • 対処: 環境変数の設定確認

問題: Issueが見つからない

  • 対処: リポジトリのURLパターン確認
  • 対処: アクセス権限の確認

9. 実装チェックリスト

  • サブモジュール用ディレクトリ構造
  • メインスクリプト (claude-submodule-fix.sh)
  • ヘルパー関数 (claude-helper.sh)
  • CLAUDE.md ドキュメント
  • 基本的なテスト実行
  • VS Code統合 (tasks.json)
  • GitHub Actions ワークフロー
  • Windows対応
  • 自動Issue作成機能
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?