Skip to content

feat: config-base-syncプラグインを追加 - #188

Merged
keito4 merged 1 commit into
mainfrom
feat/add-config-base-sync-plugin
Dec 29, 2025
Merged

feat: config-base-syncプラグインを追加#188
keito4 merged 1 commit into
mainfrom
feat/add-config-base-sync-plugin

Conversation

@keito4

@keito4 keito4 commented Dec 29, 2025

Copy link
Copy Markdown
Owner

Summary

DevContainer設定を最新のconfig-baseイメージと同期するClaude Codeプラグインを追加しました。

主な機能

コマンド

  • /config-base-sync:check - 現在と最新のconfig-baseバージョンを確認

    • 現在のDevContainerバージョンを表示
    • 最新リリースとの比較
    • リリースノートへのリンク表示
  • /config-base-sync:update - 最新版に更新してプルリクエストを自動作成

    • 最新バージョンの自動取得
    • DevContainer設定の全面更新
    • Git操作の自動化(ブランチ作成、コミット、PR作成)
    • ステップバイステップの進捗報告

カスタマイズ機能

.claude/config-base-sync.local.mdで以下を設定可能:

  • baseBranch - PRのベースブランch(デフォルト: main)
  • autoCreatePR - 自動PR作成の有効化(デフォルト: true)
  • updateScope - 更新範囲(all/image-only/minimal)

コンポーネント

  • Commands: 2個(check.md, update.md)
  • Settings: 設定テンプレート
  • Documentation: README.md
  • DevContainer統合: Dockerfile更新

変更内容

  • プラグインファイル一式を .claude/plugins/config-base-sync/ に追加
  • DevContainerイメージビルド時にプラグインを含めるよう .devcontainer/Dockerfile を更新

Testing Checklist

  • /config-base-sync:check コマンドが正常に動作する
  • /config-base-sync:update コマンドが正常に動作する
  • 設定ファイルでカスタマイズが機能する
  • DevContainerイメージに含まれることを確認
  • CI/CDが通過する

関連Issue

このプラグインにより、config-baseイメージを使用する他のリポジトリで、DevContainer設定の更新が自動化されます。

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added config-base-sync Claude plugin for synchronizing DevContainer settings with the latest configuration image.
    • Two new commands: /config-base-sync:update fetches latest settings and automatically creates pull requests; /config-base-sync:check reports available updates without making changes.

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

DevContainer設定を最新のconfig-baseイメージと同期するClaude Codeプラグインを追加。

## 主な機能

- `/config-base-sync:check` - 現在と最新のconfig-baseバージョンを確認
- `/config-base-sync:update` - 最新版に更新してプルリクエストを自動作成
- カスタマイズ可能な設定(baseBranch, autoCreatePR, updateScope)
- DevContainerイメージに自動的に含まれる設定を追加

## コンポーネント

- Commands: 2個(check.md, update.md)
- Settings: 設定テンプレート
- Documentation: README.md
- DevContainer統合: Dockerfile更新

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

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

coderabbitai Bot commented Dec 29, 2025

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Introduces a new config-base-sync Claude plugin that synchronizes DevContainer settings with the latest config-base image. Includes plugin manifest, example configuration, documentation for check and update commands, gitignore rules, and integrates the plugin into the DevContainer image via a Dockerfile COPY operation.

Changes

Cohort / File(s) Summary
Plugin Manifest & Metadata
.claude/plugins/config-base-sync/.claude-plugin/plugin.json
Introduces plugin manifest file defining name, version, description, author, repository, license, and keywords.
Configuration & Setup
.claude/plugins/config-base-sync/.claude/config-base-sync.local.md.example, .claude/plugins/config-base-sync/.gitignore
Adds example YAML configuration file with baseBranch, autoCreatePR, and updateScope settings; establishes ignore rules for \*.local.md, node_modules/, and temporary files.
Documentation
.claude/plugins/config-base-sync/README.md, .claude/plugins/config-base-sync/commands/check.md, .claude/plugins/config-base-sync/commands/update.md
Comprehensive plugin documentation describing purpose, features, two commands (/config-base-sync:update and /config-base-sync:check), configuration options, prerequisites, error handling, and licensing; detailed workflows for version checking and DevContainer image synchronization.
Container Integration
.devcontainer/Dockerfile
Adds COPY step to include config-base-sync plugin files into /home/vscode/.claude/plugins/config-base-sync within the DevContainer image.

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant CLI
    participant FS as File System
    participant GitHub as GitHub API
    participant Git
    participant PR as PR System

    User->>CLI: /config-base-sync:update
    CLI->>FS: Load .claude/config-base-sync.local.md
    FS-->>CLI: Config (baseBranch, autoCreatePR, updateScope)
    CLI->>FS: Read .devcontainer/devcontainer.json
    FS-->>CLI: Current image version
    CLI->>GitHub: Fetch latest release tag
    GitHub-->>CLI: Latest version + release notes
    
    alt Version up to date
        CLI-->>User: Report: No update needed
    else Update available
        CLI->>Git: Create/checkout branch
        CLI->>FS: Update devcontainer.json (based on updateScope)
        alt updateScope = all or image-only
            CLI->>FS: Sync codex-config.json & claude-settings.json
        end
        CLI->>Git: Commit changes
        Git-->>CLI: Commit successful
        
        alt autoCreatePR enabled
            CLI->>PR: Create PR via gh CLI
            PR-->>User: PR link
        end
        CLI-->>User: Update complete report
    end
Loading

Estimated Code Review Effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly Related PRs

Poem

🐰 A plugin hops into the container bright,
Syncing DevContainer configs with all its might,
Check and update commands, oh what a delight!
Config-base-sync keeps our baselines tight,
No more manual work—automation done right! 🚀

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 clearly describes the main change: adding a config-base-sync Claude plugin, which is the primary objective of this pull request.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/add-config-base-sync-plugin

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.

@keito4
keito4 merged commit 269a82e into main Dec 29, 2025
3 of 4 checks passed
@claude

claude Bot commented Dec 29, 2025

Copy link
Copy Markdown
Contributor

PR Review: config-base-syncプラグイン追加

📋 概要

DevContainer設定を最新のconfig-baseイメージと同期するClaude Codeプラグインの追加です。機能的には有用で、自動化の価値が高いと評価できます。


✅ 良い点

1. 明確な構造と責任分離

  • プラグインの構造が適切に整理されています
  • checkupdateの2つのコマンドに機能が明確に分離されています
  • 設定ファイルのサンプル(.example)を提供している点が良い

2. 詳細なドキュメント

  • README.mdが充実しており、使用方法や前提条件が明確
  • コマンドファイル内のステップバイステップの手順が詳細
  • エラーハンドリングの説明が含まれている

3. 適切な.gitignore設定

  • ローカル設定ファイル(*.local.md)を除外
  • 一時ファイルを適切に無視

⚠️ 改善が必要な点

1. Critical: ハードコードされたパス (update.md:84-86)

- Read `/Users/keito4/develop/github.com/keito4/config/.devcontainer/devcontainer.json`
- Read `/Users/keito4/develop/github.com/keito4/config/.devcontainer/codex-config.json`
- Read `/Users/keito4/develop/github.com/keito4/config/.devcontainer/claude-settings.json`

問題点:

  • ユーザー固有の絶対パスがハードコードされています
  • 他の環境では動作しません
  • このプラグインは他のリポジトリでも使用される予定なので、深刻な問題です

推奨修正:

- Fetch template configuration from GitHub API or use relative paths
- Option 1: `gh api repos/keito4/config/contents/.devcontainer/devcontainer.json`
- Option 2: Use a known good configuration embedded in the plugin
- Option 3: Fetch from a specific release tag's files

2. セキュリティ: 設定値のバリデーション不足

update.mdの設定読み込みで、YAMLフロントマターからの値抽出について:

問題点:

  • バリデーションの記載はありますが、具体的な実装ガイダンスがない
  • 悪意のあるコマンドインジェクションのリスク

推奨:

  • ブランチ名のサニタイゼーション処理を明示
  • 許可される文字セットを制限 (例: [a-zA-Z0-9/_-])
  • booleanの厳密なチェック (true/falseのみ)

3. テストカバレッジの欠如

CLAUDE.mdの要求事項:

すべてのリポジトリ 70%+ 行カバレッジ

現状:

  • テストファイルが存在しません
  • PRのTesting Checklistは手動チェックのみ

推奨:

  • プラグインの自動テストを追加
  • 最低限のシナリオ:
    • バージョン比較ロジック
    • 設定ファイル読み込みとバリデーション
    • エラーハンドリング
    • モックされたGitHub APIレスポンス

4. エラーハンドリング: GitHub API レート制限

check.mdupdate.mdでGitHub APIを使用していますが、レート制限のハンドリングが不十分です。

推奨:

# レート制限を事前チェック
gh api rate_limit
# レスポンスに基づいて適切なエラーメッセージを表示

5. 設定例の矛盾 (README.md:74)

## <!-- .claude/config-base-sync.local.md -->

問題点:

  • Markdownコメントの構文が不正確
  • ユーザーがコピー&ペーストすると混乱する可能性

推奨:

# .claude/config-base-sync.local.md
---
baseBranch: develop
autoCreatePR: true
updateScope: all
---

6. Conventional Commits違反の可能性

CLAUDE.mdの要求:

Commits that touch .codex/**, .devcontainer/codex*, package*.json, or npm/global.json must use release-triggering types

確認事項:

  • .devcontainer/Dockerfileへの変更はfeatタイプで適切
  • ただし、今後package.jsonへの依存追加がある場合は注意が必要

🔒 セキュリティ考慮事項

1. Git操作の安全性

  • git status --porcelainで未コミット変更を確認
  • ✅ ブランチの存在チェック
  • ⚠️ force pushは使用していないが、ドキュメントで明示すべき

2. コマンドインジェクション

  • ⚠️ {target-version}などの変数がシェルコマンドに埋め込まれる
  • 推奨: 変数のサニタイゼーションを明示

📊 パフォーマンス考慮事項

1. API呼び出しの最適化

  • 現状: 各コマンド実行時に複数のGitHub API呼び出し
  • 推奨: 結果をキャッシュする仕組み (短期間)

2. 差分処理

  • updateScope: allの場合、大量の設定変更が発生する可能性
  • 推奨: 変更前後のdiffを表示して、ユーザーが確認できるようにする

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

🔴 High Priority (マージ前に修正必須)

  1. ハードコードされたパスの削除 (update.md:84-86)

    • GitHub APIまたは相対パスを使用
  2. テストの追加

    • 最低限の単体テスト
    • CI/CDでの自動実行

🟡 Medium Priority (次のイテレーションで対応)

  1. 設定値のバリデーション強化

    • サニタイゼーション処理の明示
  2. エラーハンドリングの改善

    • GitHub APIレート制限対応
  3. ドキュメントの修正

    • README.mdの設定例を修正

🟢 Low Priority (機能強化として検討)

  1. キャッシング機能の追加
  2. 差分プレビュー機能
  3. ロールバック機能

📝 総評

全体的な評価: 🟡 条件付き承認

このプラグインは有用な機能を提供していますが、ハードコードされたパステストの欠如という2つの重大な問題があります。これらを修正しない限り、本番環境での使用は推奨できません。

マージ可否

  • 現時点ではマージ不可
  • ✅ High Priorityの問題を修正後、再レビュー推奨

次のステップ

  1. update.md:84-86のハードコードパスを修正
  2. 基本的なテストケースを追加
  3. 上記2点が完了したら再レビュー依頼

レビュアー: Claude Code
レビュー日: 2025-12-29
参照: CLAUDE.md, .claude/CLAUDE.md

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

🧹 Nitpick comments (7)
.claude/plugins/config-base-sync/commands/check.md (2)

10-25: Add JSON validation when reading devcontainer.json.

The workflow reads .devcontainer/devcontainer.json but doesn't explicitly validate that it's valid JSON before extracting the image field. If the file is malformed, the extraction will fail with unclear error messages.

🔎 Suggested improvement

Consider adding JSON validation step:

Read `.devcontainer/devcontainer.json` and validate JSON structure.

Use `jq` to validate and extract:
```bash
jq -r '.image // "NOT_FOUND"' .devcontainer/devcontainer.json

If jq fails:

  • Report error: "Invalid JSON in .devcontainer/devcontainer.json"
  • Stop execution
</details>

---

`59-67`: **Clarify release notes extraction logic.**

Line 66 mentions extracting "key highlights from release notes (first few lines or bullet points)" but doesn't provide specific instructions on how to parse markdown, handle code blocks, or determine what constitutes "key highlights."



<details>
<summary>🔎 Suggested improvement</summary>

Consider adding more specific extraction logic:

```markdown
Extract key highlights from release notes:

```bash
gh api repos/keito4/config/releases/tags/v{latest-version} --jq '.body' | head -n 10

Or extract first markdown section:

gh api repos/keito4/config/releases/tags/v{latest-version} --jq '.body' | sed -n '1,/^##/p' | head -n -1
</details>

</blockquote></details>
<details>
<summary>.claude/plugins/config-base-sync/README.md (1)</summary><blockquote>

`73-85`: **Clarify configuration file format in the example.**

The example configuration at lines 74-85 shows a different structure than the actual YAML frontmatter format used in `config-base-sync.local.md.example`. The comment `## <!-- .claude/config-base-sync.local.md -->` and the placement of the YAML block might confuse users about the correct format.



<details>
<summary>🔎 Suggested improvement</summary>

Update the example to match the actual file format:

```diff
 ### 設定例
 
-```markdown
-## <!-- .claude/config-base-sync.local.md -->
-
+<!-- .claude/config-base-sync.local.md -->
+```yaml
+---
 baseBranch: develop
 autoCreatePR: true
 updateScope: all
-
 ---
+```
 
-# config-base-sync 設定
+```markdown
+# config-base-sync Plugin Settings
 
 カスタム設定の説明やメモをここに記載できます。

Or reference the example file directly to avoid duplication.
</details>

</blockquote></details>
<details>
<summary>.claude/plugins/config-base-sync/commands/update.md (4)</summary><blockquote>

`9-25`: **Validate YAML frontmatter parsing before use.**

The workflow loads settings from `.claude/config-base-sync.local.md` and extracts YAML frontmatter, but doesn't specify how to handle malformed YAML or missing required fields gracefully. The validation mentions stopping on failure, which is good, but could benefit from more specific parsing instructions.



<details>
<summary>🔎 Suggested improvement</summary>

Consider adding specific YAML parsing commands:

```markdown
If settings file exists, parse YAML frontmatter:

```bash
# Extract and validate YAML frontmatter
baseBranch=$(sed -n '/^---$/,/^---$/p' .claude/config-base-sync.local.md | grep '^baseBranch:' | cut -d: -f2- | xargs)
autoCreatePR=$(sed -n '/^---$/,/^---$/p' .claude/config-base-sync.local.md | grep '^autoCreatePR:' | cut -d: -f2- | xargs)
updateScope=$(sed -n '/^---$/,/^---$/p' .claude/config-base-sync.local.md | grep '^updateScope:' | cut -d: -f2- | xargs)

# Validate values
if [ -n "$baseBranch" ] && ! git rev-parse --verify "$baseBranch" &>/dev/null; then
  echo "Error: baseBranch '$baseBranch' is not a valid branch"
  exit 1
fi
</details>

---

`27-40`: **Add version format validation.**

The workflow accepts version numbers from arguments or fetches from GitHub releases but doesn't validate the version format (e.g., semantic versioning). Invalid version strings could cause issues in later steps.



<details>
<summary>🔎 Suggested improvement</summary>

Add version format validation:

```markdown
After determining target version:

Validate version format (X.Y.Z):
```bash
if ! echo "$targetVersion" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+$'; then
  echo "Error: Invalid version format '$targetVersion'. Expected X.Y.Z (e.g., 1.2.3)"
  exit 1
fi

Verify the release exists:

if ! gh api repos/keito4/config/releases/tags/v${targetVersion} &>/dev/null; then
  echo "Error: Release v${targetVersion} not found"
  exit 1
fi
</details>

---

`131-144`: **Verify multiline commit message format.**

The commit message spans multiple lines (lines 136-143) within the bash command. Ensure that the newlines and formatting are properly preserved when executed.



<details>
<summary>🔎 Suggested improvement</summary>

Consider using a heredoc or explicit newline characters for better reliability:

```bash
git commit -m "feat: Update config-base image to v${targetVersion}

- Update DevContainer image from v${oldVersion} to v${targetVersion}
- Sync configuration with latest recommended settings
- Update features, mounts, and environment variables

Release notes: https://github.com/keito4/config/releases/tag/v${targetVersion}"

Or using -m multiple times:

git commit \
  -m "feat: Update config-base image to v${targetVersion}" \
  -m "" \
  -m "- Update DevContainer image from v${oldVersion} to v${targetVersion}" \
  -m "- Sync configuration with latest recommended settings" \
  -m "- Update features, mounts, and environment variables" \
  -m "" \
  -m "Release notes: https://github.com/keito4/config/releases/tag/v${targetVersion}"

156-179: Ensure PR body formatting is preserved correctly.

The PR body (lines 161-178) contains multiline text with indentation, bullet points, and special characters. The gh pr create command needs proper escaping or quoting to preserve this formatting.

🔎 Suggested improvement

Use a heredoc for the PR body to ensure proper formatting:

PR_BODY=$(cat <<EOF
## Summary

Updates DevContainer configuration to use the latest config-base image.

### Changes
- **Image**: ghcr.io/keito4/config-base:${oldVersion} → v${targetVersion}
- **Configuration**: Synced with latest recommended settings

### Release Notes
See: https://github.com/keito4/config/releases/tag/v${targetVersion}

### Testing
- [ ] DevContainer builds successfully
- [ ] All tools and features work as expected
- [ ] CI passes

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

gh pr create \
  --base "${baseBranch}" \
  --title "feat: Update config-base to v${targetVersion}" \
  --body "$PR_BODY"
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e634795 and 559f523.

📒 Files selected for processing (7)
  • .claude/plugins/config-base-sync/.claude-plugin/plugin.json
  • .claude/plugins/config-base-sync/.claude/config-base-sync.local.md.example
  • .claude/plugins/config-base-sync/.gitignore
  • .claude/plugins/config-base-sync/README.md
  • .claude/plugins/config-base-sync/commands/check.md
  • .claude/plugins/config-base-sync/commands/update.md
  • .devcontainer/Dockerfile
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: CR
Repo: keito4/config PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-01T03:45:17.253Z
Learning: Publish DevContainer images to ghcr.io/keito4/config-base with semantic versioning
📚 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: Publish DevContainer images to ghcr.io/keito4/config-base with semantic versioning

Applied to files:

  • .claude/plugins/config-base-sync/README.md
  • .claude/plugins/config-base-sync/.claude-plugin/plugin.json
  • .claude/plugins/config-base-sync/commands/update.md
  • .claude/plugins/config-base-sync/commands/check.md
📚 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/docker-image.yml : Build DevContainer images automatically with semantic versioning and multi-platform support in .github/workflows/docker-image.yml

Applied to files:

  • .claude/plugins/config-base-sync/.claude-plugin/plugin.json
  • .claude/plugins/config-base-sync/commands/update.md
  • .claude/plugins/config-base-sync/commands/check.md
📚 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 {.codex/**,.devcontainer/codex*,package*.json,npm/global.json} : Use Conventional Commits format with release-triggering types (feat/fix/perf/revert/docs) for commits touching .codex/**, .devcontainer/codex*, package*.json, or npm/global.json

Applied to files:

  • .claude/plugins/config-base-sync/commands/update.md
  • .claude/plugins/config-base-sync/commands/check.md
📚 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/update-libraries.yml : Execute npm run update:libs on schedule and open pull requests when dependencies or Codex/Claude tooling changes in .github/workflows/update-libraries.yml

Applied to files:

  • .claude/plugins/config-base-sync/commands/update.md
⏰ 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 (7)
.claude/plugins/config-base-sync/.claude-plugin/plugin.json (1)

1-13: LGTM!

The plugin manifest is well-structured with all necessary metadata. The version, description, author, and license information are appropriate for an initial release.

.claude/plugins/config-base-sync/.gitignore (1)

1-9: LGTM!

The gitignore rules appropriately exclude user-specific configuration files (.local.md), dependencies (node_modules/), and temporary artifacts (.tmp, *.log). This aligns well with the plugin's design where .local.md files contain personalized settings.

.claude/plugins/config-base-sync/.claude/config-base-sync.local.md.example (1)

1-64: LGTM!

The example configuration file is well-structured with clear YAML frontmatter and comprehensive documentation in Japanese. The settings (baseBranch, autoCreatePR, updateScope) are clearly explained with defaults, allowed values, and usage examples.

.claude/plugins/config-base-sync/commands/check.md (2)

1-4: LGTM!

The frontmatter correctly specifies the allowed tools (Read, Bash with gh and jq) needed for the version check workflow.


30-41: GitHub CLI is already available and properly configured in the DevContainer via the official devcontainers/features/github-cli:1 feature, and authentication is mounted from the host's ~/.config/gh directory. No action needed.

.claude/plugins/config-base-sync/commands/update.md (1)

1-5: LGTM!

The frontmatter correctly specifies the workflow description, allowed tools, and the optional --version argument format.

.claude/plugins/config-base-sync/README.md (1)

87-92: Prerequisites are pre-configured in the DevContainer via features and host mounts.

The prerequisites listed in the README are largely handled automatically:

  • GitHub CLI, Git, and jq are installed via devcontainer features
  • Host authentication credentials and Git configuration (.gitconfig, .config/gh) are mounted into the container
  • The .devcontainer/devcontainer.json file is already present in the repository

These prerequisites only need to be satisfied on the host system before starting the DevContainer; they don't require additional configuration within the container environment.

Comment on lines +81 to +93

Read the reference configuration from this repository:

- Read `/Users/keito4/develop/github.com/keito4/config/.devcontainer/devcontainer.json`
- Read `/Users/keito4/develop/github.com/keito4/config/.devcontainer/codex-config.json`
- Read `/Users/keito4/develop/github.com/keito4/config/.devcontainer/claude-settings.json`

Extract recommended configuration based on `updateScope`:

- **all**: Update image, features, mounts, postCreateCommand, customizations, remoteEnv
- **image-only**: Update only the image field
- **minimal**: Update image and features only

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

Critical: Remove hardcoded absolute paths.

Lines 84-86 contain hardcoded absolute paths (/Users/keito4/develop/github.com/keito4/config/...) that are specific to the author's local machine. This will cause the workflow to fail in any other environment, including CI/CD and other users' machines.

🔎 Proposed fix

The workflow should read template files from the current repository or use relative paths. Since this is a plugin that will be copied into the DevContainer, you have a few options:

Option 1: Read from the plugin's bundled templates (recommended)

-Read the reference configuration from this repository:
+Read the reference configuration templates bundled with the plugin:

-- Read `/Users/keito4/develop/github.com/keito4/config/.devcontainer/devcontainer.json`
-- Read `/Users/keito4/develop/github.com/keito4/config/.devcontainer/codex-config.json`
-- Read `/Users/keito4/develop/github.com/keito4/config/.devcontainer/claude-settings.json`
+- Read `~/.claude/plugins/config-base-sync/templates/devcontainer.json`
+- Read `~/.claude/plugins/config-base-sync/templates/codex-config.json`
+- Read `~/.claude/plugins/config-base-sync/templates/claude-settings.json`
+
+(Note: You'll need to add these template files to the plugin directory)

Option 2: Fetch from GitHub repository

-Read the reference configuration from this repository:
+Fetch the reference configuration from the main repository:

-- Read `/Users/keito4/develop/github.com/keito4/config/.devcontainer/devcontainer.json`
-- Read `/Users/keito4/develop/github.com/keito4/config/.devcontainer/codex-config.json`
-- Read `/Users/keito4/develop/github.com/keito4/config/.devcontainer/claude-settings.json`
+```bash
+curl -fsSL https://raw.githubusercontent.com/keito4/config/main/.devcontainer/devcontainer.json
+curl -fsSL https://raw.githubusercontent.com/keito4/config/main/.devcontainer/codex-config.json  
+curl -fsSL https://raw.githubusercontent.com/keito4/config/main/.devcontainer/claude-settings.json
+```

Option 3: Read from current repository (if plugin is used within the same repo)

-Read the reference configuration from this repository:
+Read the reference configuration from the repository root:

-- Read `/Users/keito4/develop/github.com/keito4/config/.devcontainer/devcontainer.json`
-- Read `/Users/keito4/develop/github.com/keito4/config/.devcontainer/codex-config.json`
-- Read `/Users/keito4/develop/github.com/keito4/config/.devcontainer/claude-settings.json`
+- Read `.devcontainer/devcontainer.json` (from current repository)
+- Read `.devcontainer/codex-config.json`
+- Read `.devcontainer/claude-settings.json`
+
+Note: This assumes the plugin is being run from within the keito4/config repository itself.
📝 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
Read the reference configuration from this repository:
- Read `/Users/keito4/develop/github.com/keito4/config/.devcontainer/devcontainer.json`
- Read `/Users/keito4/develop/github.com/keito4/config/.devcontainer/codex-config.json`
- Read `/Users/keito4/develop/github.com/keito4/config/.devcontainer/claude-settings.json`
Extract recommended configuration based on `updateScope`:
- **all**: Update image, features, mounts, postCreateCommand, customizations, remoteEnv
- **image-only**: Update only the image field
- **minimal**: Update image and features only
Read the reference configuration from the repository root:
- Read `.devcontainer/devcontainer.json` (from current repository)
- Read `.devcontainer/codex-config.json`
- Read `.devcontainer/claude-settings.json`
Note: This assumes the plugin is being run from within the keito4/config repository itself.
Extract recommended configuration based on `updateScope`:
- **all**: Update image, features, mounts, postCreateCommand, customizations, remoteEnv
- **image-only**: Update only the image field
- **minimal**: Update image and features only
🤖 Prompt for AI Agents
.claude/plugins/config-base-sync/commands/update.md around lines 81 to 93:
remove the hardcoded absolute paths pointing to /Users/keito4/... and replace
them with a portable approach — read template files via relative paths inside
the plugin (e.g., path relative to the plugin or repository root), or if
templates are not bundled, fetch them from the canonical GitHub repo using
HTTP(S) (with fallback and error handling), or support a configurable template
directory; update the documentation and any code examples to show the chosen
relative path or URL approach rather than absolute local filesystem paths.

Comment on lines +95 to +111

Based on `updateScope`, update `.devcontainer/devcontainer.json`:

1. Update `image` field to `ghcr.io/keito4/config-base:{target-version}`

2. If `updateScope` is "all" or "minimal":
- Update `features` object with recommended features from template
- Preserve any user-added features not in template

3. If `updateScope` is "all":
- Update `remoteEnv` with recommended environment variables
- Update `mounts` with recommended mounts (preserve user additions)
- Update `customizations` with recommended VS Code settings
- Update `postCreateCommand` if significantly different

Use the Edit tool to make precise updates to the JSON file.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Add JSON validation after editing devcontainer.json.

The workflow uses the Edit tool to update .devcontainer/devcontainer.json but doesn't validate that the resulting JSON is well-formed. Malformed JSON could break the DevContainer build.

🔎 Proposed fix

Add validation after editing:

After making edits to `.devcontainer/devcontainer.json`:

Validate the JSON structure:
```bash
if ! jq empty .devcontainer/devcontainer.json 2>/dev/null; then
  echo "❌ Error: Generated devcontainer.json is not valid JSON"
  echo "Rolling back changes..."
  git checkout .devcontainer/devcontainer.json
  exit 1
fi

Verify the image field was updated correctly:

newImage=$(jq -r '.image' .devcontainer/devcontainer.json)
if [ "$newImage" != "ghcr.io/keito4/config-base:${targetVersion}" ]; then
  echo "❌ Error: Image was not updated correctly"
  echo "Expected: ghcr.io/keito4/config-base:${targetVersion}"
  echo "Got: $newImage"
  exit 1
fi
</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

.claude/plugins/config-base-sync/commands/update.md around lines 95-111: after
the Edit step that writes .devcontainer/devcontainer.json, add a JSON validation
step that runs a JSON parser (e.g., jq) to ensure the file is well-formed and,
on failure, prints an error, restores the original file and exits non-zero;
additionally verify the .image field equals
ghcr.io/keito4/config-base:{target-version} and error/exit if it does not; keep
the rollback behavior for malformed JSON and ensure any messages are clear so
the workflow fails fast on broken or incorrect edits.


</details>

<!-- fingerprinting:phantom:poseidon:puma -->

<!-- This is an auto-generated comment by CodeRabbit -->

Comment on lines +63 to +69
```yaml
---
baseBranch: main # PRのベースブランch
autoCreatePR: true # 自動PR作成の有効化
updateScope: all # 更新範囲 (all | image-only | minimal)
---
```

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 | 🟡 Minor

Fix typo in Japanese text.

Line 65 contains a typo: "ブランch" should be "ブランチ" (branch in Japanese).

🔎 Proposed fix
 ---
-baseBranch: main # PRのベースブランch
+baseBranch: main # PRのベースブランチ
 autoCreatePR: true # 自動PR作成の有効化
 updateScope: all # 更新範囲 (all | image-only | minimal)
 ---
📝 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
```yaml
---
baseBranch: main # PRのベースブランch
autoCreatePR: true # 自動PR作成の有効化
updateScope: all # 更新範囲 (all | image-only | minimal)
---
```
🤖 Prompt for AI Agents
In .claude/plugins/config-base-sync/README.md around lines 63 to 69, there is a
typo on line 65 where "ブランch" should be "ブランチ"; edit that line to replace
"ブランch" with "ブランチ" while leaving the surrounding YAML block and comments
unchanged.

Comment thread .devcontainer/Dockerfile
COPY --chown=vscode:vscode .claude/agents /home/vscode/.claude/agents
COPY --chown=vscode:vscode .claude/hooks /home/vscode/.claude/hooks
COPY --chown=vscode:vscode .claude/plugins/plugins.txt /home/vscode/.claude/plugins/plugins.txt
COPY --chown=vscode:vscode .claude/plugins/config-base-sync /home/vscode/.claude/plugins/config-base-sync

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 | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check for .dockerignore and potential local.md files

echo "=== Checking for .dockerignore ==="
if [ -f .dockerignore ]; then
  echo "Found .dockerignore:"
  cat .dockerignore
else
  echo "No .dockerignore found"
fi

echo ""
echo "=== Checking for .local.md files in plugin directory ==="
if [ -d .claude/plugins/config-base-sync ]; then
  echo "Directory exists. Searching for .local.md files:"
  fd -e md -g '*.local.md' .claude/plugins/config-base-sync/ 2>/dev/null || echo "No .local.md files found"
else
  echo "Directory .claude/plugins/config-base-sync does not exist"
fi

echo ""
echo "=== Listing contents of .claude/plugins/config-base-sync ==="
if [ -d .claude/plugins/config-base-sync ]; then
  ls -la .claude/plugins/config-base-sync/
else
  echo "Directory not found"
fi

echo ""
echo "=== Checking .gitignore in plugin directory ==="
if [ -f .claude/plugins/config-base-sync/.gitignore ]; then
  echo "Found .gitignore in plugin directory:"
  cat .claude/plugins/config-base-sync/.gitignore
else
  echo "No .gitignore in plugin directory"
fi

Repository: keito4/config

Length of output: 1509


Add .local.md exclusion to .dockerignore to prevent accidental copying of local configuration files.

The .dockerignore file does not exclude *.local.md files. While these files are currently absent from the repository and excluded by .gitignore, they are not protected from being copied into the Docker image during build. If a developer creates .local.md files locally (as intended by the .gitignore), they would be included in the COPY operation at line 79. Add *.local.md to .dockerignore to ensure user-specific configurations are not accidentally packaged into the image.

🤖 Prompt for AI Agents
In .devcontainer/Dockerfile around line 79, the COPY at that line can
unintentionally include developer-specific files like *.local.md; update the
repository's .dockerignore to add a line excluding *.local.md (e.g., add
"*.local.md") so those local configuration files are not copied into the image
during docker build, then save and commit the updated .dockerignore.

@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.12.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@github-actions github-actions Bot added the released リリース済み label Dec 29, 2025
@keito4
keito4 deleted the feat/add-config-base-sync-plugin branch January 29, 2026 00:51
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