Repository navigation
fix(devcontainer): DevContainerビルド時のClaudeプラグインインストールを改善 #179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| #!/usr/bin/env bash | ||
| # ============================================================================ | ||
| # Post-Create Plugin Installer | ||
| # DevContainer 起動後にプラグインが不足している場合に自動インストール | ||
| # ============================================================================ | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| PLUGINS_FILE="${1:-/home/vscode/.claude/plugins/plugins.txt}" | ||
|
|
||
| echo "[INFO] Claude プラグインの状態を確認中..." | ||
|
|
||
| # プラグインリストが存在するか確認 | ||
| if [[ ! -f "$PLUGINS_FILE" ]]; then | ||
| echo "[WARN] plugins.txt が見つかりません: ${PLUGINS_FILE}" | ||
| exit 0 | ||
| fi | ||
|
|
||
| installed=0 | ||
| missing=0 | ||
|
|
||
| while IFS= read -r line || [[ -n "$line" ]]; do | ||
| # 空行とコメント行をスキップ | ||
| [[ -z "$line" || "$line" =~ ^[[:space:]]*# ]] && continue | ||
|
|
||
| # 前後の空白を除去 | ||
| plugin=$(echo "$line" | xargs) | ||
| [[ -z "$plugin" ]] && continue | ||
|
|
||
| # プラグインがインストール済みかチェック | ||
| if ! claude plugin list 2>/dev/null | grep -q "$plugin"; then | ||
| echo "[INFO] インストール中: ${plugin}" | ||
| if claude plugin install "$plugin" 2>/dev/null; then | ||
| echo "[SUCCESS] 完了: ${plugin}" | ||
| installed=$((installed + 1)) | ||
| else | ||
| echo "[WARN] スキップまたは失敗: ${plugin}" | ||
| missing=$((missing + 1)) | ||
| fi | ||
| fi | ||
| done < "$PLUGINS_FILE" | ||
|
|
||
| if [[ $installed -gt 0 ]]; then | ||
| echo "[SUCCESS] ${installed} 個のプラグインをインストールしました" | ||
| fi | ||
|
|
||
| if [[ $missing -gt 0 ]]; then | ||
| echo "[WARN] ${missing} 個のプラグインのインストールに失敗しました" | ||
| echo "[INFO] 手動でインストールするには: claude plugin install <plugin>@<marketplace>" | ||
| fi | ||
|
|
||
| exit 0 | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix plugin existence check to use exact matching.
The current
grep -q "$plugin"performs substring matching, which can produce false positives. For example, if the plugins list contains both "git" and "github", checking for "git" would incorrectly match "github".🔎 Proposed fix using exact matching
Alternatively, use word boundary matching:
Note: The best approach depends on the exact output format of
claude plugin list. You may need to verify the output format to ensure the pattern matches correctly.📝 Committable suggestion
🤖 Prompt for AI Agents