Skip to content

Commit 9bff394

Browse files
fjmrytfjsnGitHub Copilot CLICopilot
authored
Add ECC config auto-fix tooling and investigation notes (#9)
Introduce reusable scripts to normalize ECC agent config compatibility and include investigation findings plus base opencode config file for setup alignment. Co-authored-by: GitHub Copilot CLI <copilot@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 7853973 commit 9bff394

File tree

4 files changed

+258
-0
lines changed

4 files changed

+258
-0
lines changed

docs/ECC_CONFIG_INVESTIGATION.md

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
# ecc-universal 設定エラー調査レポート
2+
3+
## 📊 調査結果サマリー
4+
5+
### **現状**
6+
- **インストール済みバージョン**: v1.9.0 (2026年3月21日リリース)
7+
- **最新npm版**: v1.9.0 (npmに公開済み)
8+
- **最新GitHub版**: v1.10.0 (2026年4月5日リリース、npmには未公開)
9+
10+
### **設定形式の問題**
11+
12+
**現在のecc-universal (v1.9.0 & v1.10.0):**
13+
```yaml
14+
tools: ["Read", "Write", "Edit", "Bash", "Grep", "Glob"]
15+
color: teal
16+
```
17+
18+
**OpenCodeが期待する形式:**
19+
```yaml
20+
tools:
21+
read: true
22+
write: true
23+
edit: true
24+
bash: true
25+
grep: true
26+
glob: true
27+
# colorフィールドは削除または有効な値のみ
28+
```
29+
30+
### **v1.10.0 でも修正されていない**
31+
32+
GitHub上のv1.10.0とmainブランチを確認した結果:
33+
- ✅ 設定形式は**変わっていない**(配列形式のまま)
34+
- ⚠️ npmには未公開(Issue #1287で報告あり)
35+
36+
## 🔍 関連するGitHub Issues
37+
38+
### **Issue #802: [ECC 2.0] Module 8: Agent profiles (model, tools, permissions)**
39+
- **ステータス**: Open
40+
- **内容**: エージェントプロファイル(model, tools, permissions)の設計
41+
- **影響**: この issue で設定形式の改善が議論される可能性
42+
43+
### **Issue #801: [ECC 2.0] Module 8: TOML config file support**
44+
- **ステータス**: Open
45+
- **内容**: TOML設定ファイルサポート
46+
- **影響**: 将来的な設定形式の大幅な変更の可能性
47+
48+
### **Issue #1287: v1.10.0 npm package still missing .opencode/dist/**
49+
- **ステータス**: Open
50+
- **内容**: v1.10.0がnpmに公開されていない
51+
- **影響**: 最新バージョンが利用不可
52+
53+
## 💡 結論と推奨事項
54+
55+
### **1. 上流パッケージは当面修正されない**
56+
57+
- ecc-universalは配列形式を使い続けている
58+
- ECC 2.0 (Module 8) で将来的に変更予定だが時期不明
59+
- 当面は**ローカルで自動修正する必要がある**
60+
61+
### **2. 推奨する対応策**
62+
63+
#### **A. startup.shに自動修正を組み込む(即時対応)**
64+
65+
```bash
66+
# .devcontainer/startup.sh に追加
67+
echo "🔧 OpenCode ECC設定を修正中..."
68+
python3 /workspace/scripts/fix-ecc-agents.py /home/vscode/.opencode/agents
69+
70+
if [ $? -eq 0 ]; then
71+
echo "✅ OpenCode ECC設定修正完了"
72+
else
73+
echo "⚠️ OpenCode ECC設定修正に失敗しました"
74+
fi
75+
```
76+
77+
**メリット:**
78+
- DevContainer起動時に自動修正
79+
- `ecc repair`後も再修正
80+
- メンテナンス不要
81+
82+
**デメリット:**
83+
- 起動時間が数秒増加
84+
85+
#### **B. カスタムECCプロファイルを作成(代替案)**
86+
87+
ecc-universalを使わず、独自の設定セットを管理:
88+
89+
```bash
90+
# カスタム設定を /workspace/.opencode-custom/ に配置
91+
ecc install --source /workspace/.opencode-custom --target opencode-home
92+
```
93+
94+
**メリット:**
95+
- 完全なコントロール
96+
- パッケージ更新の影響を受けない
97+
98+
**デメリット:**
99+
- 手動メンテナンスが必要
100+
- 新機能の取り込みに手間
101+
102+
#### **C. 上流に貢献(長期的解決)**
103+
104+
1. GitHubリポジトリにPRを送る
105+
2. Issue #802 のディスカッションに参加
106+
3. OpenCodeの期待形式をドキュメント化
107+
108+
### **3. モニタリング計画**
109+
110+
以下を定期的に確認:
111+
- [ ] ecc-universal npm版のリリース(週次)
112+
- [ ] Issue #802, #801 の進捗(週次)
113+
- [ ] OpenCode側の設定形式変更(月次)
114+
115+
## 🛠️ 実装スクリプト
116+
117+
すでに作成済み:
118+
-`/workspace/scripts/fix-ecc-agents.py` - Python版自動修正
119+
-`/workspace/scripts/fix-ecc-config.sh` - Bash版自動修正
120+
121+
## 📝 次のアクション
122+
123+
1. **即座に**: startup.shに自動修正を組み込む
124+
2. **短期**: GitHub Issueで状況を報告・質問
125+
3. **中期**: ECC 2.0の進捗を追跡
126+
4. **長期**: 必要に応じて上流にPR送信
127+
128+
---
129+
130+
**調査日**: 2026年4月6日
131+
**リポジトリ**: https://github.com/affaan-m/everything-claude-code
132+
**パッケージ**: ecc-universal@1.9.0

opencode.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"$schema": "https://opencode.ai/config.json",
3+
"model": "github-copilot/claude-sonnet-4.5",
4+
"small_model": "github-copilot/claude-haiku-4.5",
5+
"default_agent": "build"
6+
}

scripts/fix-ecc-agents.py

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#!/usr/bin/env python3
2+
"""
3+
OpenCode ECC Agent設定修正スクリプト
4+
tools配列形式をオブジェクト形式に変換し、無効なcolorフィールドを削除
5+
"""
6+
7+
import re
8+
import sys
9+
from pathlib import Path
10+
11+
def fix_tools_field(content):
12+
"""tools配列をオブジェクト形式に変換"""
13+
pattern = r'tools:\s*\[(.*?)\]'
14+
15+
def convert_tools(match):
16+
tools_str = match.group(1)
17+
tools = [t.strip().strip('"').strip("'") for t in tools_str.split(',')]
18+
19+
result = 'tools:\n'
20+
for tool in tools:
21+
if tool:
22+
# MCPツールはそのまま、それ以外は小文字に
23+
key = tool if tool.startswith('mcp__') else tool.lower()
24+
result += f' {key}: true\n'
25+
return result.rstrip()
26+
27+
return re.sub(pattern, convert_tools, content, flags=re.DOTALL)
28+
29+
def fix_color_field(content):
30+
"""無効なcolorフィールドを削除"""
31+
return re.sub(r'^color:.*$', '', content, flags=re.MULTILINE)
32+
33+
def fix_agent_file(md_file):
34+
"""個別のagentファイルを修正"""
35+
try:
36+
content = md_file.read_text()
37+
original = content
38+
39+
# tools修正
40+
content = fix_tools_field(content)
41+
# color削除
42+
content = fix_color_field(content)
43+
44+
if content != original:
45+
md_file.write_text(content)
46+
return True
47+
except Exception as e:
48+
print(f'❌ Error fixing {md_file.name}: {e}', file=sys.stderr)
49+
return False
50+
51+
def main(target_dir='/home/vscode/.opencode/agents'):
52+
"""メイン処理"""
53+
target_path = Path(target_dir)
54+
55+
if not target_path.exists():
56+
print(f'❌ Directory not found: {target_dir}', file=sys.stderr)
57+
return 1
58+
59+
fixed = 0
60+
total = 0
61+
62+
for md_file in target_path.glob('*.md'):
63+
total += 1
64+
if fix_agent_file(md_file):
65+
print(f'✅ Fixed: {md_file.name}')
66+
fixed += 1
67+
68+
print(f'\n📊 Results: {fixed}/{total} files fixed')
69+
return 0
70+
71+
if __name__ == '__main__':
72+
target = sys.argv[1] if len(sys.argv) > 1 else '/home/vscode/.opencode/agents'
73+
sys.exit(main(target))

scripts/fix-ecc-config.sh

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/bin/bash
2+
# OpenCode ECC設定修正スクリプト
3+
# tools配列形式をオブジェクト形式に変換し、colorフィールドを削除
4+
5+
set -e
6+
7+
TARGET_DIR="${1:-$HOME/.opencode/agents}"
8+
9+
if [ ! -d "$TARGET_DIR" ]; then
10+
echo "❌ エラー: ディレクトリが見つかりません: $TARGET_DIR"
11+
exit 1
12+
fi
13+
14+
echo "🔧 OpenCode ECC設定ファイルを修正中..."
15+
echo "📂 対象ディレクトリ: $TARGET_DIR"
16+
17+
cd "$TARGET_DIR"
18+
count=0
19+
20+
for file in *.md; do
21+
[ -f "$file" ] || continue
22+
23+
# ファイルのバックアップ
24+
cp "$file" "${file}.bak"
25+
26+
# tools配列 -> オブジェクト形式に変換(様々なパターンに対応)
27+
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"
28+
sed -i 's/tools: \[\"Read\", \"Grep\", \"Glob\"\]/tools:\n read: true\n grep: true\n glob: true/' "$file"
29+
sed -i 's/tools: \[\"Read\", \"Grep\", \"Glob\", \"Bash\"\]/tools:\n read: true\n grep: true\n glob: true\n bash: true/' "$file"
30+
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"
31+
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"
32+
sed -i 's/tools: \[\"Read\", \"Bash\"\]/tools:\n read: true\n bash: true/' "$file"
33+
34+
# colorフィールドを削除(teal, orange等の名前ベースの色は無効)
35+
sed -i '/^color:/d' "$file"
36+
37+
# バックアップと比較して変更があったかチェック
38+
if ! cmp -s "$file" "${file}.bak"; then
39+
((count++))
40+
fi
41+
42+
# バックアップファイル削除
43+
rm -f "${file}.bak"
44+
done
45+
46+
echo "✅ 完了: ${count}個のファイルを修正しました"
47+
ls *.md 2>/dev/null | wc -l | xargs echo "📊 総ファイル数:"

0 commit comments

Comments
 (0)