Skip to content

fix: Dockerビルドでのマーケットプレイス追加コマンドを修正 (v1.6.3) - #175

Merged
keito4 merged 1 commit into
mainfrom
fix/docker-plugin-marketplace-command
Dec 24, 2025
Merged

fix: Dockerビルドでのマーケットプレイス追加コマンドを修正 (v1.6.3)#175
keito4 merged 1 commit into
mainfrom
fix/docker-plugin-marketplace-command

Conversation

@keito4

@keito4 keito4 commented Dec 24, 2025

Copy link
Copy Markdown
Owner

問題

v1.6.2のDockerイメージでも依然としてプラグインがインストールされていませんでした。

ビルドログに記録されたエラー

[INFO] マーケットプレイスを初期化中...
[INFO] known_marketplaces.jsonが見つかりました
error: unknown command 'add-marketplace'
[WARN] claude-code-plugins already exists or failed to add
error: unknown command 'add-marketplace'
[WARN] claude-code-templates already exists or failed to add
error: unknown command 'add-marketplace'
[WARN] claude-code-workflows already exists or failed to add
[INFO] プラグインをインストール中...
[DEBUG] Claude version: 2.0.76
[DEBUG] Marketplaces directory: /home/vscode/.claude/plugins/marketplaces
[WARN] Marketplaces directory not found
[INFO] プラグイン: 0 インストール完了、15 失敗/スキップ

根本原因の詳細分析

  1. 存在しないコマンドの使用

    # install-claude-plugins.sh で使用していたコマンド(誤り)
    claude plugin add-marketplace anthropic/claude-code --name claude-code-plugins
  2. Claude CLI v2.0.76の実際のコマンド

    $ claude plugin --help
    Commands:
      ...
      marketplace  Manage Claude Code marketplaces
      ...
    
    $ claude plugin marketplace --help
    Commands:
      add <source>  Add a marketplace from a URL, path, or GitHub repo

    正しいコマンド構造: claude plugin marketplace add <source>

  3. 結果

    • add-marketplaceというサブコマンドは存在しない
    • マーケットプレイスが一つも追加されない
    • /home/vscode/.claude/plugins/marketplacesディレクトリが空のまま
    • 全15プラグインのインストールが失敗

解決策

コマンド修正

Before (v1.6.2):

claude plugin add-marketplace anthropic/claude-code --name claude-code-plugins
claude plugin add-marketplace https://github.com/davila7/claude-code-templates.git --name claude-code-templates
claude plugin add-marketplace wshobson/agents --name claude-code-workflows

After (v1.6.3):

claude plugin marketplace add anthropic/claude-code
claude plugin marketplace add https://github.com/davila7/claude-code-templates.git
claude plugin marketplace add wshobson/agents

変更ポイント

項目 Before After 理由
コマンド構造 plugin add-marketplace plugin marketplace add 正しいサブコマンド階層
--nameオプション あり 削除 不要(自動で名前が決定される)

コマンド動作確認(ローカル)

$ claude plugin marketplace add anthropic/claude-code
Successfully added marketplace 'claude-code-plugins'

$ claude plugin marketplace list
Configured marketplaces:
  ❯ claude-code-plugins
    Source: GitHub (anthropics/claude-code)

期待効果

プラグインインストール

項目 v1.6.0 v1.6.1 v1.6.2 v1.6.3 (This PR)
マーケットプレイス追加 ❌ エラー ✅ 成功
Secret アクセス
プラグインインストール ❌ 0/15 ❌ 0/15 ❌ 0/15 ✅ 15/15 期待
エラーログ表示

ビルド時間

変更なし - コマンド修正のみ(処理内容は同じ)

ビルドログ(成功時の期待出力)

[INFO] マーケットプレイスを初期化中...
[INFO] known_marketplaces.jsonが見つかりました
Successfully added marketplace 'claude-code-plugins'
Successfully added marketplace 'claude-code-templates'
Successfully added marketplace 'claude-code-workflows'
[INFO] プラグインをインストール中...
[DEBUG] Claude version: 2.0.76
[DEBUG] Marketplaces directory: /home/vscode/.claude/plugins/marketplaces
drwxr-xr-x  claude-code-plugins
drwxr-xr-x  claude-code-templates
drwxr-xr-x  claude-code-workflows
[INFO]   インストール中: frontend-design@claude-code-plugins
[SUCCESS]   完了: frontend-design@claude-code-plugins
...
[INFO] プラグイン: 15 インストール完了、0 失敗/スキップ
[SUCCESS] Claude プラグインのインストールが完了しました

テスト計画

フェーズ1: ローカルでの確認

  1. ✅ スクリプトの文法チェック
  2. ✅ pre-commit フック通過

フェーズ2: CI/CD ビルド

  1. ⏳ Docker ビルド実行
  2. ⏳ ビルドログでマーケットプレイス追加成功確認
  3. ⏳ ビルドログでプラグインインストール成功確認
  4. ⏳ エラーログに「unknown command」が出ないことを確認

フェーズ3: DevContainer 起動確認

  1. ⏳ v1.6.3 イメージで DevContainer 起動
  2. /plugin コマンドでエラーが出ないか確認
  3. ⏳ 15個のプラグインすべてが正常動作するか確認

影響範囲

Dockerビルド

  • ✅ マーケットプレイスが正しく追加される
  • ✅ プラグインが正しくインストールされる
  • ✅ ビルド時間は変わらず

ローカル環境

  • ✅ 影響なし

DevContainer 環境

  • ✅ プラグインが利用可能になる
  • /plugin コマンドでエラーが出なくなる

関連PR

ロールバック手順

問題が発生した場合:

# v1.6.2 に戻す
git revert <commit-hash>

# または、スクリプトを v1.6.2 に戻す
git checkout v1.6.2 -- script/install-claude-plugins.sh

検証ポイント

マージ後のビルドログで以下を確認:

  • Successfully added marketplace 'claude-code-plugins'
  • Successfully added marketplace 'claude-code-templates'
  • Successfully added marketplace 'claude-code-workflows'
  • [SUCCESS] 完了: frontend-design@claude-code-plugins(×15回)
  • [INFO] プラグイン: 15 インストール完了、0 失敗/スキップ
  • error: unknown command が出ないこと

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • Bug Fixes
    • Corrected Claude CLI plugin marketplace add commands to use the proper command syntax, ensuring reliable plugin marketplace initialization during setup.

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

## 問題

v1.6.2でも依然としてプラグインがインストールされていませんでした。

### エラー内容

```
error: unknown command 'add-marketplace'
[WARN] Marketplaces directory not found
[INFO] プラグイン: 0 インストール完了、15 失敗/スキップ
```

### 根本原因

`claude plugin add-marketplace` コマンドは存在しない。
正しくは `claude plugin marketplace add` コマンド。

## 解決策

### コマンド修正

**Before**:
```bash
claude plugin add-marketplace anthropic/claude-code --name claude-code-plugins
claude plugin add-marketplace https://github.com/davila7/claude-code-templates.git --name claude-code-templates
claude plugin add-marketplace wshobson/agents --name claude-code-workflows
```

**After**:
```bash
claude plugin marketplace add anthropic/claude-code
claude plugin marketplace add https://github.com/davila7/claude-code-templates.git
claude plugin marketplace add wshobson/agents
```

### 変更ポイント

- `add-marketplace` → `marketplace add` (正しいサブコマンド)
- `--name` オプション削除 (不要)

## 期待効果

| 項目 | v1.6.2 | v1.6.3 (This PR) |
|------|--------|------------------|
| マーケットプレイス追加 | ❌ エラー | ✅ 成功 |
| プラグインインストール | ❌ 0/15 | ✅ 15/15 |

🤖 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

The script script/install-claude-plugins.sh updates three marketplace plugin registration commands from the incorrect claude plugin add-marketplace to the correct claude plugin marketplace add syntax, while preserving targets and error handling.

Changes

Cohort / File(s) Summary
CLI Command Corrections
script/install-claude-plugins.sh
Replaced deprecated claude plugin add-marketplace with claude plugin marketplace add for three marketplace registrations. Updated command syntax and adjusted related comments.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

Poem

🐰 A hop through the scripts, commands made right,
Claude's marketplace now registers with delight!
Three paths corrected, deprecated away,
Plugin installation brightens the day!

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 title is in Japanese and focuses on fixing Marketplace add commands in Docker builds (v1.6.3), which directly matches the main change of correcting deprecated CLI commands.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ 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/docker-plugin-marketplace-command

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

PR Review: Dockerビルドでのマーケットプレイス追加コマンド修正 (v1.6.3)

概要

コマンドの誤りを修正し、Claude CLI v2.0.76の正しいコマンド構造に対応する重要な修正です。


✅ 承認ポイント

1. 根本原因の正確な特定

  • add-marketplacemarketplace add の正しいコマンド階層への修正
  • --name オプションの削除(不要なオプション)
  • CLI仕様に基づいた正確な修正

2. PR説明の品質

  • 問題の詳細な分析と証拠(ビルドログ)
  • Before/Afterの明確な対比
  • 期待効果とテスト計画の提示
  • 関連PRの履歴追跡

3. 影響範囲の限定

  • 変更は4行のみ(+4, -4)
  • 既存のエラーハンドリングは維持
  • スクリプトの他の部分に影響なし

🔍 品質面での指摘

1. テストカバレッジ不足 ⚠️

問題: script/install-claude-plugins.sh に対するテストが存在しない

リスク:

  • コマンドの実行可否は実際のビルドまで検証できない
  • 将来的な回帰バグのリスク
  • TDD原則(70%+カバレッジ)に反する

推奨対応:

オプション1: Batsによるシェルスクリプトテスト(推奨)

```bash

test/install-claude-plugins.bats

setup() {
load 'test_helper/bats-support/load'
load 'test_helper/bats-assert/load'

export CLAUDE_DIR="$BATS_TMPDIR/claude"
mkdir -p "$CLAUDE_DIR/plugins"
}

@test "マーケットプレイス追加コマンドの構造が正しい" {

Mockを使用してコマンド実行を検証

export PATH="$BATS_TEST_DIRNAME/mocks:$PATH"

run ./script/install-claude-plugins.sh

assert_success
assert_line --partial "claude plugin marketplace add anthropic/claude-code"
refute_line --partial "claude plugin add-marketplace"
refute_line --partial "--name"
}

@test "エラー時に適切な警告メッセージを表示" {

コマンド失敗をシミュレート

run ./script/install-claude-plugins.sh

assert_line --partial "[WARN] claude-code-plugins already exists or failed to add"
}
```

オプション2: CI/CDでの統合テスト

```yaml

.github/workflows/ci.yml に追加

  • name: Verify Claude CLI commands
    run: |

    コマンド構造の検証(実際の実行なし)

    grep -q "claude plugin marketplace add" script/install-claude-plugins.sh
    ! grep -q "claude plugin add-marketplace" script/install-claude-plugins.sh
    ! grep -q -- "--name" script/install-claude-plugins.sh
    ```

オプション3: ShellCheckによる静的解析

```yaml

  • name: ShellCheck
    run: shellcheck script/*.sh
    ```

2. エラーハンドリングの改善可能性 💡

現状:
```bash
claude plugin marketplace add anthropic/claude-code 2>&1 || echo "[WARN] claude-code-plugins already exists or failed to add"
```

問題:

  • 成功・失敗の判断基準が不明確
  • "already exists" と "failed to add" を区別できない

改善案:
```bash
if output=$(claude plugin marketplace add anthropic/claude-code 2>&1); then
echo "[SUCCESS] Marketplace added: claude-code-plugins"
elif echo "$output" | grep -q "already exists"; then
echo "[INFO] Marketplace already exists: claude-code-plugins"
else
echo "[ERROR] Failed to add marketplace: claude-code-plugins"
echo "[ERROR] Details: $output"
exit 1
fi
```

メリット:

  • エラーの詳細ログ
  • 既存環境での冪等性
  • デバッグ容易性の向上

3. セキュリティ観点 🔒

良い点:

  • script/install-claude-plugins.sh:90 で認証情報を削除
  • BuildKit secretの適切な使用

確認推奨:
```bash

.credentials.jsonのパーミッション確認

ls -la /home/vscode/.claude/.credentials.json # 期待: -rw------- (600)
```

4. ドキュメント 📝

欠落:

  • script/install-claude-plugins.sh の実行方法・前提条件のドキュメントがREADMEに不在

推奨追加内容:
```markdown

Claude Pluginのインストール

前提条件

  • Claude CLI v2.0.76+
  • BuildKit secret: claude_credentials

手動実行

```bash

BuildKit secretを使用してビルド

DOCKER_BUILDKIT=1 docker build \
--secret id=claude_credentials,src=$HOME/.claude/.credentials.json \
-f .devcontainer/Dockerfile .
```

トラブルシューティング

  • "unknown command" エラー → Claude CLIのバージョン確認
  • "Marketplaces directory not found" → マーケットプレイス追加の失敗
    ```
    ```

🎯 推奨アクション

マージ前(必須)

  • ShellCheckによる静的解析をCI/CDに追加
  • コマンド構造の簡易検証テストをCI/CDに追加

マージ後(推奨)

  • Batsまたは同等のテストフレームワーク導入
  • エラーハンドリングの改善(次回PR)
  • READMEにプラグインインストールのドキュメント追加

検証項目(ビルドログで確認)

  • `Successfully added marketplace 'claude-code-plugins'`
  • `Successfully added marketplace 'claude-code-templates'`
  • `Successfully added marketplace 'claude-code-workflows'`
  • `[INFO] プラグイン: 15 インストール完了、0 失敗/スキップ`
  • `error: unknown command` が出ないこと

🔢 総合評価

観点 評価 コメント
コード品質 ⭐⭐⭐⭐☆ コマンド修正は正確だが、テスト不足
セキュリティ ⭐⭐⭐⭐⭐ 認証情報の適切な管理
パフォーマンス ⭐⭐⭐⭐⭐ 影響なし
保守性 ⭐⭐⭐☆☆ ドキュメント・テスト不足
説明品質 ⭐⭐⭐⭐⭐ 非常に詳細で追跡可能

総合: 承認推奨

この修正は緊急性が高く、影響範囲も限定的です。テストカバレッジの課題は別PRで対応することを推奨します。


📋 フォローアップPRの提案

  1. test: Claude plugin installer のテスト追加 (優先度: 高)

    • Batsテストフレームワーク導入
    • コマンド構造の検証
    • エラーシナリオのテスト
  2. docs: プラグインインストールのドキュメント追加 (優先度: 中)

    • README更新
    • トラブルシューティングガイド
  3. refactor: エラーハンドリング改善 (優先度: 低)

    • 詳細なエラー分類
    • 冪等性の明示的な実装

🤖 Generated with Claude Code

@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: 1

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f2c5fe9 and ed6a8fa.

📒 Files selected for processing (1)
  • script/install-claude-plugins.sh
⏰ 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 (1)
script/install-claude-plugins.sh (1)

53-55: LGTM: Error handling approach is appropriate.

The use of || echo to handle failures gracefully is appropriate here, as marketplace additions may fail if they already exist. This allows the script to continue with plugin installation even if marketplace initialization encounters issues.

Comment on lines +52 to +55
# 必須マーケットプレイスを追加(正しいコマンド: claude plugin marketplace add)
claude plugin marketplace add anthropic/claude-code 2>&1 || echo "[WARN] claude-code-plugins already exists or failed to add"
claude plugin marketplace add https://github.com/davila7/claude-code-templates.git 2>&1 || echo "[WARN] claude-code-templates already exists or failed to add"
claude plugin marketplace add wshobson/agents 2>&1 || echo "[WARN] claude-code-workflows already exists or failed to add"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

# First, let's examine the file to understand the context better
cat -n script/install-claude-plugins.sh | head -60 | tail -20

Repository: keito4/config

Length of output: 1096


🏁 Script executed:

# Check git history to see what the original command was
cd script && git log -p --follow -S "add-marketplace" -- install-claude-plugins.sh | head -100

Repository: keito4/config

Length of output: 39


🏁 Script executed:

# Look for any documentation or comments about Claude CLI in the repo
find . -type f \( -name "*.md" -o -name "*.txt" -o -name "*.sh" \) -exec grep -l "claude.*plugin.*marketplace" {} \; | head -10

Repository: keito4/config

Length of output: 157


🏁 Script executed:

# Check git diff for this specific file
git diff HEAD~5..HEAD -- script/install-claude-plugins.sh | head -100

Repository: keito4/config

Length of output: 91


🏁 Script executed:

# Read the README for plugin context
cat .claude/plugins/README.md

Repository: keito4/config

Length of output: 3164


🏁 Script executed:

# Search for any documentation about the old command
rg "add-marketplace|claude.*plugin" --type sh --context 3

Repository: keito4/config

Length of output: 3691


🌐 Web query:

Claude CLI command syntax "claude marketplace add" OR "claude plugin marketplace add"

💡 Result:

Use the Claude Code plugin command: /plugin marketplace add

Examples:

  • Add GitHub repo: /plugin marketplace add owner/repo. [1]
  • Add any git URL: /plugin marketplace add https://gitlab.com/company/plugins.git. [1]
  • Add local directory: /plugin marketplace add ./my-marketplace (or a direct marketplace.json path). [1]
  • You can then list marketplaces with /plugin marketplace list and install plugins with /plugin install name@marketplace. [2]

Sources: [1] Claude Docs — Plugin Marketplaces; [2] Claude Docs — Plugins.


🌐 Web query:

Claude CLI v2.0.76 documentation plugin marketplace

💡 Result:

Here are official docs and resources for Claude Code/CLI plugins and marketplaces (including marketplace commands and examples):

  • Plugins (quickstart, plugin structure, install/manage commands). See "Plugins" guide. [1]
  • Plugin marketplaces (how to create/add marketplaces, examples, CLI commands like /plugin marketplace add, /plugin install, /plugin marketplace list, auto-update and team config). [2]
  • Plugins reference (component schemas: commands, agents, skills, hooks, MCP servers and CLI schemas). [3]
  • Community/third‑party registries & CLI helpers (browse/install public plugins easily). [4]

If you want, I can:

  • show the exact CLI commands and example marketplace.json manifest for v2.0.76-compatible Claude Code, or
  • fetch the changelog entry for v2.0.76 specifically.

Sources:
[1] Claude Docs — Plugins. https://docs.claude.com/en/docs/claude-code/plugins
[2] Claude Docs — Plugin marketplaces. https://docs.claude.com/en/docs/claude-code/plugin-marketplaces
[3] Claude Docs — Plugins reference. https://docs.claude.com/en/docs/claude-code/plugins-reference
[4] Claude-plugins community registry / claude-plugins.dev. https://claude-plugins.dev/


🌐 Web query:

Anthropic GitHub organization "anthropic/claude-code" OR "anthropics/claude-code" official repository

💡 Result:

The official Claude Code repository is under the GitHub org "anthropics" → anthropics/claude-code. [1][2]

Sources:
[1] GitHub — anthropics/claude-code. (github.com)
[2] Anthropic — Claude Code product page. (anthropic.com)

Citations:


Fix marketplace source identifier and update error messages.

Line 53 has a critical typo: anthropic/claude-code should be anthropics/claude-code (the official Anthropic GitHub organization name includes an 's'). The command syntax itself is correct.

Additionally, the error messages on lines 53–55 reference marketplace names (claude-code-plugins, claude-code-templates, claude-code-workflows) that were previously set via the --name option, which has been removed. Update them to reference the actual sources being added:

-    claude plugin marketplace add anthropic/claude-code 2>&1 || echo "[WARN] claude-code-plugins already exists or failed to add"
-    claude plugin marketplace add https://github.com/davila7/claude-code-templates.git 2>&1 || echo "[WARN] claude-code-templates already exists or failed to add"
-    claude plugin marketplace add wshobson/agents 2>&1 || echo "[WARN] claude-code-workflows already exists or failed to add"
+    claude plugin marketplace add anthropics/claude-code 2>&1 || echo "[WARN] Failed to add anthropics/claude-code marketplace"
+    claude plugin marketplace add https://github.com/davila7/claude-code-templates.git 2>&1 || echo "[WARN] Failed to add davila7/claude-code-templates marketplace"
+    claude plugin marketplace add wshobson/agents 2>&1 || echo "[WARN] Failed to add wshobson/agents marketplace"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# 必須マーケットプレイスを追加(正しいコマンド: claude plugin marketplace add)
claude plugin marketplace add anthropic/claude-code 2>&1 || echo "[WARN] claude-code-plugins already exists or failed to add"
claude plugin marketplace add https://github.com/davila7/claude-code-templates.git 2>&1 || echo "[WARN] claude-code-templates already exists or failed to add"
claude plugin marketplace add wshobson/agents 2>&1 || echo "[WARN] claude-code-workflows already exists or failed to add"
# 必須マーケットプレイスを追加(正しいコマンド: claude plugin marketplace add)
claude plugin marketplace add anthropics/claude-code 2>&1 || echo "[WARN] Failed to add anthropics/claude-code marketplace"
claude plugin marketplace add https://github.com/davila7/claude-code-templates.git 2>&1 || echo "[WARN] Failed to add davila7/claude-code-templates marketplace"
claude plugin marketplace add wshobson/agents 2>&1 || echo "[WARN] Failed to add wshobson/agents marketplace"
🤖 Prompt for AI Agents
In script/install-claude-plugins.sh around lines 52 to 55, fix the marketplace
source identifier typo and update the error messages: change the source
"anthropic/claude-code" to "anthropics/claude-code" and adjust the echo warnings
to reference the actual sources being added (e.g., "anthropics/claude-code",
"https://github.com/davila7/claude-code-templates.git", and "wshobson/agents")
so they accurately state the source already exists or failed to add.

@keito4
keito4 merged commit bea1a8a into main Dec 24, 2025
6 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.6.3 🎉

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