feat: Claude プラグイン管理をローカル環境/DevContainer両対応に改善 - #186
Conversation
DevContainer環境でのプラグインインストール問題を修正し、 存在しないプラグインを削除して最適化 変更内容: 1. クロスデバイスリンクエラー対策 - devcontainer.jsonにTMPDIR環境変数を追加 - setup-claude.shで専用の一時ディレクトリ作成 2. マーケットプレイス自動検出機能 - plugins.txtから必要なマーケットプレイスを抽出 - known_marketplaces.jsonから情報を読み取り 3. プラグインリストの最適化 - 存在しないプラグインを削除(vercel, supabase, nextjs-vercel-pro, supabase-toolkit) - claude-code-templatesマーケットプレイスを削除(プラグインディレクトリなし) - 実在するプラグインのみを保持 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
📝 WalkthroughWalkthroughThis PR transitions Claude plugin marketplace configuration from a static JSON file to an environment-independent template-based approach. It replaces the hardcoded Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
(aside) |
|
Claude finished @keito4's task in 2m 35s —— View job マージコンフリクトの分析と解決方法問題の原因このPRブランチ ブランチの状態:
コミット履歴: このPRの実際の変更内容
これはプラグインリストの最適化のみの変更です。TMPDIR修正とマーケットプレイス自動検出は既にmainに含まれています(PR #185)。 解決方法以下のいずれかの方法で対応できます: 推奨方法1: ブランチを再作成 # mainから新しいブランチを作成
git checkout origin/main
git checkout -b fix/claude-plugin-list-optimization
# このPRの実際の変更のみを適用
git cherry-pick 3d5d55a
# 新しいブランチをプッシュ
git push origin fix/claude-plugin-list-optimizationその後、このPR #186を閉じて、新しいブランチで新しいPRを作成してください。 方法2: このPRを閉じる
方法3: mainが更新されるのを待つ
制限事項
|
## 変更内容
### テンプレート化
- `known_marketplaces.json.template` を追加
- `{{HOME}}` プレースホルダーを使用して環境非依存に
- `.gitignore` に `known_marketplaces.json` を追加(環境固有ファイル)
### セットアップスクリプト改善
- `script/setup-claude.sh` を環境検出対応に修正
- テンプレートから `known_marketplaces.json` を自動生成
- `$HOME` ベースのパス設定で macOS/Linux/DevContainer すべてで動作
- bash 4.0+ 要件を追加(連想配列使用)
### ドキュメント更新
- `.claude/plugins/README.md` を更新
- 環境非依存の仕組みを説明
- セットアップ手順を明確化
## 動作確認
- macOS (Apple Silicon) でテスト完了
- 9つのプラグインすべてインストール成功
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
script/setup-claude.sh (2)
43-45: Consider cleaning up tmp directory on exit.The temporary directory is created but never cleaned up. Consider adding a cleanup trap to avoid accumulating stale files over time.
🔎 Proposed addition after line 45
# クリーンアップ用トラップを設定 cleanup() { rm -rf "${CLAUDE_DIR}/tmp"/* 2>/dev/null || true } trap cleanup EXIT
99-114: Consider logging jq extraction failures more explicitly.When
jqreturns empty for bothrepoandurl, the script logs a warning. However, ifjqitself fails (e.g., malformed JSON), the2>/dev/nullsuppresses the error, making debugging harder.🔎 Proposed improvement
- repo=$(jq -r ".\"$marketplace\".source.repo // empty" "$KNOWN_MARKETPLACES" 2>/dev/null) - url=$(jq -r ".\"$marketplace\".source.url // empty" "$KNOWN_MARKETPLACES" 2>/dev/null) + repo=$(jq -r ".\"$marketplace\".source.repo // empty" "$KNOWN_MARKETPLACES") || repo="" + url=$(jq -r ".\"$marketplace\".source.url // empty" "$KNOWN_MARKETPLACES") || url=""
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
.claude/plugins/README.md.claude/plugins/known_marketplaces.json.claude/plugins/known_marketplaces.json.template.claude/plugins/plugins.txt.devcontainer/devcontainer.json.gitignorescript/install-claude-plugins.shscript/setup-claude.sh
💤 Files with no reviewable changes (1)
- .claude/plugins/known_marketplaces.json
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-12-01T03:45:17.253Z
Learnt from: CR
Repo: keito4/config PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-01T03:45:17.253Z
Learning: Applies to .github/workflows/claude.yml : Trigger automatic AI assistance on claude mentions in issues, PRs, and comments using .github/workflows/claude.yml
Applied to files:
.claude/plugins/plugins.txt
🔇 Additional comments (13)
.gitignore (1)
56-58: LGTM!Correctly ignoring the generated
known_marketplaces.jsonfile since it's now auto-generated from the template with environment-specificHOMEpaths..devcontainer/devcontainer.json (1)
25-26: Verify TMPDIR directory exists before use.
TMPDIRis set to/home/vscode/.claude/tmp, but this directory is created bysetup-claude.shinpostCreateCommand. If any feature or tool usesTMPDIRbeforepostCreateCommandcompletes, it may fail.Consider adding the directory creation to
initializeCommand:🔎 Proposed fix
- "initializeCommand": "mkdir -p ~/.claude ~/.cursor", + "initializeCommand": "mkdir -p ~/.claude ~/.claude/tmp ~/.cursor",script/install-claude-plugins.sh (1)
48-51: LGTM!The addition of
claude-plugins-officialmarketplace registration follows the existing pattern and provides consistent error handling..claude/plugins/known_marketplaces.json.template (2)
1-44: Template structure looks correct.The JSON template correctly uses the
{{HOME}}placeholder for environment-independent paths and properly distinguishes betweengit(URL-based) andgithub(repo-based) source types.
16-22: The premise of this comment is incorrect. The PR objectives do not mention removingclaude-code-templates. The commit message describes improving Claude plugin management for both local and DevContainer environments and indicates all plugins installed successfully. Additionally, verification confirms the davila7/claude-code-templates repository exists and contains a valid plugin directory structure, making the marketplace entry appropriate for inclusion in the template.Likely an incorrect or invalid review comment.
.claude/plugins/plugins.txt (1)
16-23: LGTM!The plugin reorganization under the
claude-code-workflowssection is well-structured with descriptive comments for each plugin category.script/setup-claude.sh (4)
11-17: Bash version check is appropriate.Good defensive programming to ensure associative array support. The error message provides clear remediation steps for macOS users.
69-74: Template substitution looks correct.Using
sedwith|as delimiter avoids issues with/in HOME paths. The approach is sound for generating environment-specific configuration.
115-137: Fallback mapping is a good resilience pattern.The hardcoded fallback for environments without
jqensures the script remains functional. This aligns well with the template contents.
169-178: Verify the "already installed" detection pattern against Claude CLI documentation.The grep pattern
"already installed\|already exists"is a hardcoded assumption about the error output format from the Claude CLI plugin install command. The repository does not document or test the actual error messages produced byclaude plugin install, so this pattern could fail silently if the CLI output changes. Consider obtaining the expected error message format from the Claude CLI documentation or adding tests that capture and validate the actual error output..claude/plugins/README.md (3)
10-11: Documentation correctly reflects file structure changes.Clear distinction between the template (tracked) and generated file (ignored).
23-39: Environment-independent configuration section is well documented.The explanation of the
{{HOME}}placeholder and auto-generation workflow is clear and helpful for users.
56-99: Setup instructions are comprehensive.Both the recommended
makecommands and manual steps are well documented, providing flexibility for different user preferences.
プラグインリストを統合: - code-review@claude-plugins-official を追加 - playwright-skill@playwright-skill を追加 コンフリクト解決: - plugins.txt: 両方の変更をマージ - setup-claude.sh: 環境非依存の新しい実装を維持
PR Review: Claude プラグイン管理のローカル/DevContainer両対応化総合評価✅ Approve with Minor Suggestions このPRは、Claude Codeプラグイン管理を環境非依存にする優れた改善です。テンプレート化のアプローチは適切で、コードの品質も高いです。いくつかの軽微な改善提案がありますが、現状でもマージ可能と判断します。 1. Code Quality & Best Practices✅ 良い点
|
|
🎉 This PR is included in version 1.11.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
概要
Claude Code プラグイン管理をテンプレート化し、macOS/Linux/DevContainer すべての環境で動作するように改善しました。
変更内容
1. テンプレート化による環境非依存化
known_marketplaces.json.templateを新規作成{{HOME}}プレースホルダーを使用して環境に依存しない設定を実現.gitignoreにknown_marketplaces.jsonを追加(環境固有ファイルとして扱う)2. セットアップスクリプトの改善
script/setup-claude.shの主な変更:known_marketplaces.jsonを自動生成$HOMEベースのパス設定で柔軟性を向上3. ドキュメント更新
.claude/plugins/README.mdの改善:動作確認
ローカル環境(macOS Apple Silicon)
known_marketplaces.json自動生成成功テスト結果
影響範囲
マイグレーション
既存環境でプラグインを再インストールする場合:
チェックリスト
🤖 Generated with Claude Code
Summary by CodeRabbit
Documentation
New Features
Removals
✏️ Tip: You can customize this high-level summary in your review settings.