From 1edb8adecdb2ae566b6c1a68c9dfad852490efe8 Mon Sep 17 00:00:00 2001 From: GitHub Copilot CLI Date: Mon, 13 Apr 2026 00:04:34 +0900 Subject: [PATCH] Add ECC config auto-fix tooling and investigation notes Introduce reusable scripts to normalize ECC agent config compatibility and include investigation findings plus base opencode config file for setup alignment. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- docs/ECC_CONFIG_INVESTIGATION.md | 132 +++++++++++++++++++++++++++++++ opencode.json | 6 ++ scripts/fix-ecc-agents.py | 73 +++++++++++++++++ scripts/fix-ecc-config.sh | 47 +++++++++++ 4 files changed, 258 insertions(+) create mode 100644 docs/ECC_CONFIG_INVESTIGATION.md create mode 100644 opencode.json create mode 100755 scripts/fix-ecc-agents.py create mode 100755 scripts/fix-ecc-config.sh diff --git a/docs/ECC_CONFIG_INVESTIGATION.md b/docs/ECC_CONFIG_INVESTIGATION.md new file mode 100644 index 0000000..752883d --- /dev/null +++ b/docs/ECC_CONFIG_INVESTIGATION.md @@ -0,0 +1,132 @@ +# ecc-universal 設定エラー調査レポート + +## 📊 調査結果サマリー + +### **現状** +- **インストール済みバージョン**: v1.9.0 (2026年3月21日リリース) +- **最新npm版**: v1.9.0 (npmに公開済み) +- **最新GitHub版**: v1.10.0 (2026年4月5日リリース、npmには未公開) + +### **設定形式の問題** + +**現在のecc-universal (v1.9.0 & v1.10.0):** +```yaml +tools: ["Read", "Write", "Edit", "Bash", "Grep", "Glob"] +color: teal +``` + +**OpenCodeが期待する形式:** +```yaml +tools: + read: true + write: true + edit: true + bash: true + grep: true + glob: true +# colorフィールドは削除または有効な値のみ +``` + +### **v1.10.0 でも修正されていない** + +GitHub上のv1.10.0とmainブランチを確認した結果: +- ✅ 設定形式は**変わっていない**(配列形式のまま) +- ⚠️ npmには未公開(Issue #1287で報告あり) + +## 🔍 関連するGitHub Issues + +### **Issue #802: [ECC 2.0] Module 8: Agent profiles (model, tools, permissions)** +- **ステータス**: Open +- **内容**: エージェントプロファイル(model, tools, permissions)の設計 +- **影響**: この issue で設定形式の改善が議論される可能性 + +### **Issue #801: [ECC 2.0] Module 8: TOML config file support** +- **ステータス**: Open +- **内容**: TOML設定ファイルサポート +- **影響**: 将来的な設定形式の大幅な変更の可能性 + +### **Issue #1287: v1.10.0 npm package still missing .opencode/dist/** +- **ステータス**: Open +- **内容**: v1.10.0がnpmに公開されていない +- **影響**: 最新バージョンが利用不可 + +## 💡 結論と推奨事項 + +### **1. 上流パッケージは当面修正されない** + +- ecc-universalは配列形式を使い続けている +- ECC 2.0 (Module 8) で将来的に変更予定だが時期不明 +- 当面は**ローカルで自動修正する必要がある** + +### **2. 推奨する対応策** + +#### **A. startup.shに自動修正を組み込む(即時対応)** + +```bash +# .devcontainer/startup.sh に追加 +echo "🔧 OpenCode ECC設定を修正中..." +python3 /workspace/scripts/fix-ecc-agents.py /home/vscode/.opencode/agents + +if [ $? -eq 0 ]; then + echo "✅ OpenCode ECC設定修正完了" +else + echo "⚠️ OpenCode ECC設定修正に失敗しました" +fi +``` + +**メリット:** +- DevContainer起動時に自動修正 +- `ecc repair`後も再修正 +- メンテナンス不要 + +**デメリット:** +- 起動時間が数秒増加 + +#### **B. カスタムECCプロファイルを作成(代替案)** + +ecc-universalを使わず、独自の設定セットを管理: + +```bash +# カスタム設定を /workspace/.opencode-custom/ に配置 +ecc install --source /workspace/.opencode-custom --target opencode-home +``` + +**メリット:** +- 完全なコントロール +- パッケージ更新の影響を受けない + +**デメリット:** +- 手動メンテナンスが必要 +- 新機能の取り込みに手間 + +#### **C. 上流に貢献(長期的解決)** + +1. GitHubリポジトリにPRを送る +2. Issue #802 のディスカッションに参加 +3. OpenCodeの期待形式をドキュメント化 + +### **3. モニタリング計画** + +以下を定期的に確認: +- [ ] ecc-universal npm版のリリース(週次) +- [ ] Issue #802, #801 の進捗(週次) +- [ ] OpenCode側の設定形式変更(月次) + +## 🛠️ 実装スクリプト + +すでに作成済み: +- ✅ `/workspace/scripts/fix-ecc-agents.py` - Python版自動修正 +- ✅ `/workspace/scripts/fix-ecc-config.sh` - Bash版自動修正 + +## 📝 次のアクション + +1. **即座に**: startup.shに自動修正を組み込む +2. **短期**: GitHub Issueで状況を報告・質問 +3. **中期**: ECC 2.0の進捗を追跡 +4. **長期**: 必要に応じて上流にPR送信 + +--- + +**調査日**: 2026年4月6日 +**リポジトリ**: https://github.com/affaan-m/everything-claude-code +**パッケージ**: ecc-universal@1.9.0 diff --git a/opencode.json b/opencode.json new file mode 100644 index 0000000..565d27e --- /dev/null +++ b/opencode.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://opencode.ai/config.json", + "model": "github-copilot/claude-sonnet-4.5", + "small_model": "github-copilot/claude-haiku-4.5", + "default_agent": "build" +} diff --git a/scripts/fix-ecc-agents.py b/scripts/fix-ecc-agents.py new file mode 100755 index 0000000..7449f67 --- /dev/null +++ b/scripts/fix-ecc-agents.py @@ -0,0 +1,73 @@ +#!/usr/bin/env python3 +""" +OpenCode ECC Agent設定修正スクリプト +tools配列形式をオブジェクト形式に変換し、無効なcolorフィールドを削除 +""" + +import re +import sys +from pathlib import Path + +def fix_tools_field(content): + """tools配列をオブジェクト形式に変換""" + pattern = r'tools:\s*\[(.*?)\]' + + def convert_tools(match): + tools_str = match.group(1) + tools = [t.strip().strip('"').strip("'") for t in tools_str.split(',')] + + result = 'tools:\n' + for tool in tools: + if tool: + # MCPツールはそのまま、それ以外は小文字に + key = tool if tool.startswith('mcp__') else tool.lower() + result += f' {key}: true\n' + return result.rstrip() + + return re.sub(pattern, convert_tools, content, flags=re.DOTALL) + +def fix_color_field(content): + """無効なcolorフィールドを削除""" + return re.sub(r'^color:.*$', '', content, flags=re.MULTILINE) + +def fix_agent_file(md_file): + """個別のagentファイルを修正""" + try: + content = md_file.read_text() + original = content + + # tools修正 + content = fix_tools_field(content) + # color削除 + content = fix_color_field(content) + + if content != original: + md_file.write_text(content) + return True + except Exception as e: + print(f'❌ Error fixing {md_file.name}: {e}', file=sys.stderr) + return False + +def main(target_dir='/home/vscode/.opencode/agents'): + """メイン処理""" + target_path = Path(target_dir) + + if not target_path.exists(): + print(f'❌ Directory not found: {target_dir}', file=sys.stderr) + return 1 + + fixed = 0 + total = 0 + + for md_file in target_path.glob('*.md'): + total += 1 + if fix_agent_file(md_file): + print(f'✅ Fixed: {md_file.name}') + fixed += 1 + + print(f'\n📊 Results: {fixed}/{total} files fixed') + return 0 + +if __name__ == '__main__': + target = sys.argv[1] if len(sys.argv) > 1 else '/home/vscode/.opencode/agents' + sys.exit(main(target)) diff --git a/scripts/fix-ecc-config.sh b/scripts/fix-ecc-config.sh new file mode 100755 index 0000000..c1a695c --- /dev/null +++ b/scripts/fix-ecc-config.sh @@ -0,0 +1,47 @@ +#!/bin/bash +# OpenCode ECC設定修正スクリプト +# tools配列形式をオブジェクト形式に変換し、colorフィールドを削除 + +set -e + +TARGET_DIR="${1:-$HOME/.opencode/agents}" + +if [ ! -d "$TARGET_DIR" ]; then + echo "❌ エラー: ディレクトリが見つかりません: $TARGET_DIR" + exit 1 +fi + +echo "🔧 OpenCode ECC設定ファイルを修正中..." +echo "📂 対象ディレクトリ: $TARGET_DIR" + +cd "$TARGET_DIR" +count=0 + +for file in *.md; do + [ -f "$file" ] || continue + + # ファイルのバックアップ + cp "$file" "${file}.bak" + + # tools配列 -> オブジェクト形式に変換(様々なパターンに対応) + sed -i 's/tools: \[\s*\"\?Read\"\?,\?\s*\"\?Write\"\?,\?\s*\"\?Edit\"\?,\?\s*\"\?Bash\"\?,\?\s*\"\?Grep\"\?,\?\s*\"\?Glob\"\?\s*\]/tools:\n read: true\n write: true\n edit: true\n bash: true\n grep: true\n glob: true/' "$file" + sed -i 's/tools: \[\"Read\", \"Grep\", \"Glob\"\]/tools:\n read: true\n grep: true\n glob: true/' "$file" + sed -i 's/tools: \[\"Read\", \"Grep\", \"Glob\", \"Bash\"\]/tools:\n read: true\n grep: true\n glob: true\n bash: true/' "$file" + sed -i 's/tools: \[\"Read\", \"Grep\", \"Glob\", \"Bash\", \"Edit\"\]/tools:\n read: true\n grep: true\n glob: true\n bash: true\n edit: true/' "$file" + sed -i 's/tools: \[\"Read\", \"Write\", \"Edit\", \"Bash\", \"Grep\"\]/tools:\n read: true\n write: true\n edit: true\n bash: true\n grep: true/' "$file" + sed -i 's/tools: \[\"Read\", \"Bash\"\]/tools:\n read: true\n bash: true/' "$file" + + # colorフィールドを削除(teal, orange等の名前ベースの色は無効) + sed -i '/^color:/d' "$file" + + # バックアップと比較して変更があったかチェック + if ! cmp -s "$file" "${file}.bak"; then + ((count++)) + fi + + # バックアップファイル削除 + rm -f "${file}.bak" +done + +echo "✅ 完了: ${count}個のファイルを修正しました" +ls *.md 2>/dev/null | wc -l | xargs echo "📊 総ファイル数:"