Skip to content

fix: Claude Codeプラグイン設定エラーを修正 - #170

Merged
keito4 merged 1 commit into
mainfrom
fix/plugin-configuration-errors
Dec 24, 2025
Merged

fix: Claude Codeプラグイン設定エラーを修正#170
keito4 merged 1 commit into
mainfrom
fix/plugin-configuration-errors

Conversation

@keito4

@keito4 keito4 commented Dec 24, 2025

Copy link
Copy Markdown
Owner

Summary

Claude Code プラグイン設定のエラーを修正し、Docker環境とローカル環境で正しく動作するように改善しました。

Changes

  • .claude/plugins/plugins.txt: 実際に存在し動作するプラグインのみに整理

    • 存在しないマーケットプレイス(claude-code-templates)のプラグインを削除
    • キャッシュに未インストールのワークフロープラグインを削除
    • 削除したプラグインはコメントとして記録
  • .devcontainer/Dockerfile: プラグインマーケットプレイス設定のコピーを追加

    • known_marketplaces.json をコンテナにコピーするよう追加
  • script/setup-claude.sh: プラグイン同期ロジックを改善

    • plugins ディレクトリの同期を追加
    • known_marketplaces.json は環境固有のため同期対象外に設定

Test Plan

  • ローカル環境(macOS)で /plugin コマンドを実行しエラーが表示されないことを確認
  • Docker環境でコンテナをビルドしプラグインが正しくインストールされることを確認
  • setup-claude.sh を実行し設定が正しく同期されることを確認

Background

/plugin コマンド実行時に以下のエラーが発生していました:

  • claude-code-templates マーケットプレイスのプラグインが見つからない
  • claude-code-workflows マーケットプレイスの一部プラグインがキャッシュに存在しない

これは Docker コンテナビルド時と、ローカル環境での自動インストール時にプラグインエラーを引き起こしていました。

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Updated plugin configuration with a curated, cache-verified subset of available plugins.
    • Reorganized plugin categorization and removed deprecated entries.
    • Enhanced development environment setup to include latest plugin information and dependencies.

✏️ Tip: You can customize this high-level summary in your review settings.

- 存在しないマーケットプレイスのプラグインを削除
- キャッシュに未インストールのプラグインを削除
- Dockerfile に known_marketplaces.json のコピーを追加
- setup-claude.sh に plugins ディレクトリの同期を追加
- known_marketplaces.json を環境固有のため同期対象外に設定

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Dec 24, 2025

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Updates Claude plugin configuration by curating the plugin list to cache-verified entries, adds known_marketplaces.json copying to the development container Dockerfile, and modifies the setup script to skip marketplace data synchronization while ensuring plugin directory inclusion.

Changes

Cohort / File(s) Summary
Plugin Configuration
.claude/plugins/plugins.txt
Reclassifies plugin sections, curates plugin list to cache-verified subset (adds frontend-design, hookify, feature-dev, security-guidance; removes context7, github, commit-commands, etc.), removes Additional Plugins block, and adds annotations for removed/non-cached plugins.
Development Container Setup
.devcontainer/Dockerfile
Adds COPY step to include known_marketplaces.json into /home/vscode/.claude/plugins.
Setup Script
script/setup-claude.sh
Introduces conditional to skip syncing known_marketplaces.json during directory synchronization; adds plugins directory synchronization to main flow.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Poem

🐰 Hop hop, the plugins now align,
Cache-verified, each one does shine,
Marketplaces tucked in their place,
Setup scripts skip at a faster pace,
A tidier burrow, organized and fine!

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title is in Japanese and describes fixing Claude Code plugin configuration errors, which directly relates to the main changes in the PR that fix plugin configuration issues.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/plugin-configuration-errors

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@claude

claude Bot commented Dec 24, 2025

Copy link
Copy Markdown
Contributor

プルリクエストレビュー: Claude Codeプラグイン設定エラー修正

全体評価

このPRは Claude Code プラグイン設定のエラーを修正し、Docker 環境とローカル環境での一貫性を向上させる優れた改善です。以下、詳細なフィードバックを提供します。


✅ 良い点

1. 問題の適切な特定と対処

  • 存在しないマーケットプレイスやキャッシュに未インストールのプラグインを削除
  • 削除したプラグインをコメントとして記録し、トレーサビリティを確保

2. コードの品質

  • setup-claude.sh:122-127: known_marketplaces.json を環境固有として扱う判断が正しい
  • シェルスクリプトのエラーハンドリングが適切(set -euo pipefail

3. ドキュメンテーション

  • PR説明が明確で、変更の背景・内容・テスト計画を網羅
  • Conventional Commits に準拠(fix: プレフィックス使用)

⚠️ 改善提案

1. セキュリティ: Dockerfile の潜在的な問題

場所: .devcontainer/Dockerfile:79

COPY --chown=vscode:vscode .claude/plugins/known_marketplaces.json /home/vscode/.claude/plugins/known_marketplaces.json

懸念点:

  • README.md によると known_marketplaces.json は環境依存で Git 管理対象とされているが、このファイルに認証情報やセッショントークンが含まれる可能性がある
  • script/setup-claude.sh:122-127 では「環境固有のため同期対象外」と明示しているのに、Dockerfile では無条件にコピーしている

推奨対応:

Option A: ファイルが存在しない場合にビルドが失敗しないようにする

COPY --chown=vscode:vscode .claude/plugins/known_marketplaces.json* /home/vscode/.claude/plugins/ || true

Option B: 環境変数やビルド引数で制御可能にする

ARG COPY_MARKETPLACES=false
RUN if [ "$COPY_MARKETPLACES" = "true" ]; then \
    cp .claude/plugins/known_marketplaces.json /home/vscode/.claude/plugins/; \
fi

Option C (推奨): このファイルをコンテナに含めず、実行時に生成する

# known_marketplaces.json のコピーを削除
# コンテナ起動後にプラグインマーケットプレイスを追加するスクリプトを使用

2. テストカバレッジの不足

TDD要件との整合性: CLAUDE.md の「70%+ 行カバレッジ」要件に対し、このPRには自動テストが含まれていません。

推奨対応:

  • script/setup-claude.sh の単体テスト追加
  • Docker ビルドの統合テスト(GitHub Actions で自動実行)

テスト例:

# test/setup-claude.test.sh
test_known_marketplaces_skip() {
  # known_marketplaces.json が同期されないことを確認
  result=$(./script/setup-claude.sh --dry-run 2>&1 | grep "known_marketplaces.json")
  assert_contains "$result" "環境固有のため同期対象外"
}

3. パフォーマンス: 不要なファイル操作

場所: script/setup-claude.sh:243

sync_directory "${REPO_CLAUDE_DIR}/plugins" "${USER_CLAUDE_DIR}/plugins" "plugins"

懸念点:

  • plugins ディレクトリ全体を同期するが、実際に必要なのは plugins.txt のみ
  • known_marketplaces.json をスキップするロジックがあるものの、他の不要ファイルもコピーされる可能性

推奨対応:

# plugins.txt のみ明示的にコピー
cp "${REPO_CLAUDE_DIR}/plugins/plugins.txt" "${USER_CLAUDE_DIR}/plugins/plugins.txt"

4. エラーハンドリングの改善

場所: .devcontainer/Dockerfile:86

RUN --mount=type=secret,id=claude_credentials \
    /tmp/install-claude-plugins.sh /home/vscode/.claude/plugins/plugins.txt || true

懸念点:

  • || true により全てのエラーが無視される
  • プラグインインストール失敗時の診断情報が失われる

推奨対応:

RUN --mount=type=secret,id=claude_credentials \
    /tmp/install-claude-plugins.sh /home/vscode/.claude/plugins/plugins.txt || \
    echo "Warning: Some plugins failed to install. Check logs above."

または、install-claude-plugins.sh の終了コードを改善:

# 重要なプラグインが失敗した場合のみエラーとする
if [[ $failed -gt 0 && $installed -eq 0 ]]; then
    exit 1
fi

🔍 潜在的なバグ

シェルスクリプトのワイルドカードパターン

場所: script/setup-claude.sh:117

for file in "$src_dir"/*; do

問題: ディレクトリにファイルが一つもない場合、* がリテラルとして展開され、エラーが発生する可能性

推奨対応:

shopt -s nullglob  # スクリプト冒頭で設定
for file in "$src_dir"/*; do

📋 チェックリスト(Definition of Done)

  • コミットメッセージが Conventional Commits に準拠
  • PR説明が明確(Summary/Changes/Test Plan/Background)
  • 自動テストの追加 ← 未対応
  • CI パイプライン通過確認 ← Test Plan で未完了項目あり
  • ドキュメント更新(README.md の記載は適切)
  • セキュリティレビュー ← known_marketplaces.json の扱いを要確認

🎯 推奨アクション(優先度順)

High Priority

  1. セキュリティ: known_marketplaces.json のコピー方針を再検討(Option C 推奨)
  2. テスト: Docker 環境でのビルドテストを完了させる(Test Plan 2項目目)

Medium Priority

  1. テストカバレッジ: setup-claude.sh の単体テスト追加
  2. エラーハンドリング: Dockerfile の || true を改善

Low Priority

  1. パフォーマンス: sync_directory の対象を plugins.txt のみに限定
  2. バグ修正: nullglob の設定追加

📝 総評

このPRは実用上の問題を効果的に解決していますが、以下の点で CLAUDE.md の基準を完全には満たしていません:

  • TDD要件: テストが未実装(70%+ カバレッジ要件)
  • Quality Gates: CI パイプライン通過が未確認
  • セキュリティ: known_marketplaces.json の扱いに潜在的なリスク

High Priority の対応後にマージを推奨します。特に Docker ビルドテストの完了は必須です。


レビュー完了: 2025-12-24
レビュー基準: CLAUDE.md および .claude/CLAUDE.md

🤖 レビュー by Claude Sonnet 4.5

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
.devcontainer/Dockerfile (1)

79-79: Consider documenting why known_marketplaces.json is treated specially.

The file exists and is properly tracked in the repository, so the Docker build will succeed. However, the handling pattern warrants clarification:

  • The Dockerfile copies known_marketplaces.json from the repository as the initial container configuration.
  • The setup-claude.sh script explicitly skips syncing this file (line ~130: "environment-specific, don't sync"), preserving environment-specific customizations on updates.

This pattern is intentional and defensible—provide defaults in the repo/image, then avoid overwriting them on subsequent syncs. However, since the file contains instance-specific data (timestamps, customized marketplace URLs), consider adding a comment in the Dockerfile explaining why this file is treated differently from other .claude/plugins assets. This clarifies the design intent for future maintainers.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bbac42f and d747050.

📒 Files selected for processing (3)
  • .claude/plugins/plugins.txt
  • .devcontainer/Dockerfile
  • script/setup-claude.sh
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
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
⏰ 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)
  • GitHub Check: claude-review
🔇 Additional comments (5)
script/setup-claude.sh (2)

122-127: LGTM! Correctly handles environment-specific file.

The skip logic for known_marketplaces.json is well-implemented and aligns with the PR objective to treat this file as environment-specific. The implementation:

  • Follows the existing code pattern
  • Properly increments the skipped counter
  • Provides clear Japanese logging consistent with the codebase

This ensures that local marketplace data won't be overwritten during synchronization.


243-243: LGTM! Completes the plugin synchronization strategy.

Adding the plugins directory sync ensures plugins.txt is synchronized while respecting the environment-specific nature of known_marketplaces.json (skipped at lines 122-127). This aligns with the PR objective to properly sync plugin configurations.

.claude/plugins/plugins.txt (3)

6-11: LGTM! Cache-verified plugin curation.

The Code Plugins section correctly lists only cache-verified plugins from the claude-code-plugins marketplace. This directly addresses the PR objective to eliminate errors from non-existent or uninstalled plugins.

The reduction to 4 plugins is significant but appropriate given the background context about /plugin command errors.


13-16: LGTM! Consistent curation approach.

The Workflow Plugins section follows the same cache-verification approach, retaining only backend-development. This consistency ensures reliable plugin installation across environments.


17-27: Excellent documentation of removed plugins!

The detailed comments documenting removed plugins and their reasons (non-existent marketplace vs. cache-uninstalled) is a best practice. This:

  • Provides historical context for future reference
  • Makes it easy to restore plugins if they become available
  • Prevents confusion about why certain plugins are missing
  • Aligns with the PR test plan to verify error-free /plugin execution

@keito4
keito4 merged commit 15fe52b into main Dec 24, 2025
5 checks passed
@keito4
keito4 deleted the fix/plugin-configuration-errors branch December 24, 2025 05:52
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.5.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released リリース済み

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant