Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
251 changes: 220 additions & 31 deletions .claude/commands/config-base-sync-update.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
---
description: Update DevContainer to latest config-base image and create PR
allowed-tools: Read, Write, Edit, Bash(git:*), Bash(gh:*), Bash(curl:*), Bash(jq:*)
description: Update DevContainer to latest config-base image, sync recommended features, and create PR
allowed-tools: Read, Write, Edit, Bash(git:*), Bash(gh:*), Bash(curl:*), Bash(jq:*), Bash(find:*), Bash(test:*), Bash(ls:*)
argument-hint: [--version X.Y.Z]
---

# DevContainer Update Workflow

このコマンドは以下を自動実行します:

- config-baseイメージの最新バージョンへの更新
- プロジェクトタイプに基づいた推奨featuresの自動追加
- Claude Code動作に必要な設定の確保(mounts, postCreateCommand)
- 重複featuresの検出と報告
- GitHub PRの自動作成

## Step 1: Load Settings

Try to read `.claude/config-base-sync.local.md` for user configuration.
Expand Down Expand Up @@ -74,35 +82,112 @@ If branch already exists:
- Suggest: "Delete the branch with: git branch -D update-config-base-{target-version}"
- Stop execution

## Step 6: Read Template Configuration
## Step 6: Read Template and Recommended Configuration

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`
- Read `/Users/keito4/develop/github.com/keito4/config/.codex/devcontainer-recommendations.md`

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

### Recommended Features Detection

From `devcontainer-recommendations.md`, identify:

1. **必須Features(全プロジェクト共通)**:
- `ghcr.io/devcontainers/features/github-cli:1`
- `ghcr.io/devcontainers/features/docker-in-docker:2`
- `ghcr.io/devcontainers/features/git:1`

2. **Claude Code必須設定**:
- `.codex` mount (必須)
- `.claude` mount (必須)
- `postCreateCommand`に`/usr/local/bin/setup-claude.sh`を含める

3. **プロジェクトタイプ別Features**(現在のプロジェクトに基づいて判定):
- Node.js/TypeScriptプロジェクト(package.jsonが存在):
- `ghcr.io/devcontainers/features/node:1`
- `ghcr.io/devcontainers-extra/features/pnpm:2`
- `ghcr.io/eitsupi/devcontainer-features/jq-likes:2`
- Supabaseプロジェクト(supabase/config.tomlが存在):
- `ghcr.io/devcontainers-extra/features/supabase-cli`
- E2Eテスト(playwright.config.tsが存在):
- `ghcr.io/schlich/devcontainer-features/playwright:0`
- Terraformプロジェクト(\*.tfファイルが存在):
- `ghcr.io/devcontainers/features/terraform:1`

## Step 7: Update devcontainer.json

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

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

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

### 7.2: Update Features (if updateScope is "all" or "minimal")

**Features Update Strategy**:

1. **必須Features追加**(存在しない場合のみ追加):
- GitHub CLI
- Docker-in-Docker
- Git

2. **プロジェクトタイプ別Features追加**:
- プロジェクト内のファイル存在をチェック
- 該当するfeaturesを自動追加(存在しない場合のみ)

3. **既存Features保持**:
- ユーザーが手動追加したfeaturesは保持
- 推奨設定に含まれるfeaturesのバージョン設定を更新

4. **非推奨Features検出**:
- config-baseに既に含まれるfeaturesを検出
- ユーザーに削除推奨として報告(自動削除はしない)

**Features更新の報告**:

- ✅ 追加されるfeatures: [リスト]
- 📝 更新されるfeatures: [リスト]
- ⚠️ 削除推奨features: [リスト](重複)
- ✨ 保持されるユーザー追加features: [リスト]

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

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
**Claude Code必須mounts**を確認・追加:

- `.codex` mount
- `.claude` mount

**標準mounts**を確認・追加:

- `.cursor` mount
- `.gitconfig` mount
- `.config/gh` mount

既存のユーザー追加mountsは保持。

### 7.4: Update postCreateCommand (if updateScope is "all")

**Claude Code必須**:

- `postCreateCommand`に`/usr/local/bin/setup-claude.sh`が含まれているか確認
- 含まれていない場合は末尾に追加:
```

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

Add language identifier to code block for markdown compliance.

Line 183 contains a code block without a language specification, which violates MD040. This should specify bash since it shows a bash command continuation.

🔎 Proposed fix
-  ```
+  ```bash
   既存コマンド && /usr/local/bin/setup-claude.sh
-  ```
+  ```

Committable suggestion skipped: line range outside the PR's diff.

🧰 Tools
🪛 markdownlint-cli2 (0.18.1)

183-183: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
In .claude/commands/config-base-sync-update.md around line 183, the fenced code
block lacks a language identifier (MD040); update the opening fence to include
"bash" so the block starts with ```bash and leave the closing fence unchanged to
mark the end of the block.

既存コマンド && /usr/local/bin/setup-claude.sh
```

### 7.5: Update Other Settings (if updateScope is "all")

- Update `remoteEnv` with recommended environment variables
- Update `customizations` with recommended VS Code settings

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

Expand All @@ -117,28 +202,82 @@ If `updateScope` is "all":

## Step 9: Report Changes

Display a summary of changes made:
Display a detailed summary of all changes made:

### Image Version

- `ghcr.io/keito4/config-base:{old-version}` → `v{target-version}`

### Features Changes (if updateScope is "all" or "minimal")

**✅ 追加されたFeatures**:

- Image version: old → new
- Added features (if any)
- Updated settings (if any)
- Changed commands (if any)
```

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

Add language identifier to code block for markdown compliance.

Line 215 needs a language identifier for the code block showing feature names and versions.

🔎 Proposed fix
-```
+```text
 - feature-name-1: version
 - feature-name-2: version
-```
+```
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)

215-215: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
In .claude/commands/config-base-sync-update.md around line 215, the code block
showing feature names and versions is missing a language identifier; update the
opening fence from ``` to ```text so the block starts with ```text (leave the
content lines unchanged) and keep the closing ``` as-is to ensure Markdown
compliance.

- feature-name-1: version
- feature-name-2: version
```

**📝 更新されたFeatures**:

```

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

Add language identifier to code block for markdown compliance.

Line 222 needs a language identifier for the feature version update examples.

🔎 Proposed fix
-```
+```text
 - feature-name: old-version → new-version
-```
+```

Committable suggestion skipped: line range outside the PR's diff.

🧰 Tools
🪛 markdownlint-cli2 (0.18.1)

222-222: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
In .claude/commands/config-base-sync-update.md around line 222, the fenced code
block lacks a language identifier; update the opening fence to include "text" so
the example becomes a ```text fenced block showing the feature-name version
change, and ensure the closing fence remains ``` to keep markdown valid.

- feature-name: old-version → new-version
```

**⚠️ 削除推奨Features** (config-baseに含まれるため重複):

```

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

Add language identifier to code block for markdown compliance.

Line 228 needs a language identifier for the duplicate features list.

🔎 Proposed fix
-```
+```text
 - feature-name-1
 - feature-name-2
-```
+```
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)

228-228: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
In .claude/commands/config-base-sync-update.md around line 228, the closing code
fence for the duplicate features list is missing a language identifier; update
the opening fence to include a language (suggest "text") so the block becomes
triple-backtick with "text" (e.g., ```text) and keep the list and closing fence
unchanged to ensure valid markdown and proper syntax highlighting.

- feature-name-1
- feature-name-2
```

_注意: これらのfeaturesは自動削除されていません。必要に応じて手動で削除してください。_

**✨ 保持されたユーザー追加Features**:

```

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

Add language identifier to code block for markdown compliance.

Line 237 needs a language identifier for the preserved features list.

🔎 Proposed fix
-```
+```text
 - custom-feature-1: version
 - custom-feature-2: version
-```
+```
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)

237-237: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
In .claude/commands/config-base-sync-update.md around line 237, the fenced code
block lacks a language identifier which breaks markdown compliance for the
preserved features list; update the opening fence from ``` to ```text (or
another appropriate language tag) so the block reads as a text-labeled fenced
code block and leave the closing triple backticks unchanged, ensuring the
preserved features list remains inside the fenced block.

- custom-feature-1: version
- custom-feature-2: version
```

### Mounts Changes (if updateScope is "all")

**追加されたMounts**:

- `.codex` (Claude Code必須)
- `.claude` (Claude Code必須)

### Commands Changes (if updateScope is "all")

**postCreateCommand**:

- 追加: `/usr/local/bin/setup-claude.sh` (Claude Code必須)

### Other Changes (if updateScope is "all")

- Updated remoteEnv settings
- Updated VS Code customizations

## Step 10: Commit Changes

Create commit with conventional commit message:
Create commit with conventional commit message including features details:

```bash
git add .devcontainer/
git commit -m "feat: Update config-base image to v{target-version}

- Update DevContainer image from v{old-version} to v{target-version}
- Sync configuration with latest recommended settings
- Add {count} new features based on project type detection
- Ensure Claude Code compatibility (mounts, postCreateCommand)
- Update features, mounts, and environment variables

Features added: {list-of-added-features}

Release notes: https://github.com/keito4/config/releases/tag/v{target-version}"
```

_Note: Replace `{count}` and `{list-of-added-features}` with actual values from Step 9._

## Step 11: Push and Create PR

Push branch to remote:
Expand All @@ -157,19 +296,44 @@ If `autoCreatePR` is true:
--title "feat: Update config-base to v{target-version}" \
--body "## Summary

Updates DevContainer configuration to use the latest config-base image.
Updates DevContainer configuration to use the latest config-base image and syncs with recommended settings.

### Changes

#### Image Version
- **Image**: ghcr.io/keito4/config-base:{old-version} → v{target-version}
- **Configuration**: Synced with latest recommended settings

#### Features
- ✅ **Added**: {added-features-list}
- 📝 **Updated**: {updated-features-list}
- ⚠️ **Recommended for removal** (duplicates): {duplicate-features-list}
- ✨ **Preserved**: {preserved-features-list}

#### Configuration
- 📁 **Mounts**: Added Claude Code required mounts (`.codex`, `.claude`)
- 🔧 **postCreateCommand**: Ensured `/usr/local/bin/setup-claude.sh` execution
- ⚙️ **Settings**: Synced remoteEnv and VS Code customizations

### Claude Code Compatibility
This update ensures full Claude Code compatibility with:
- Required mounts for `.codex` and `.claude`
- Automatic Claude CLI setup via `setup-claude.sh`
- Recommended features based on project type

### Release Notes
See: https://github.com/keito4/config/releases/tag/v{target-version}

### Testing
### Testing Checklist
- [ ] DevContainer builds successfully
- [ ] All tools and features work as expected
- [ ] Claude Code works (can run claude commands)
- [ ] All project-specific tools work as expected
- [ ] CI passes
- [ ] No permission issues with mounts

### Recommended Actions
{if duplicate-features exist}
- Consider removing duplicate features: {duplicate-features-list}
{endif}

🤖 Generated with [Claude Code](https://claude.com/claude-code)
"
Expand All @@ -184,19 +348,44 @@ If `autoCreatePR` is false:

## Step 12: Final Report

Provide a complete summary:
Provide a complete summary including features changes:

```

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

Add language identifier to code block for markdown compliance.

Line 353 contains the final summary block without a language identifier.

🔎 Proposed fix
-```
+```text
 ✅ DevContainer update complete!
 
 📦 Image Version
...
-```
+```
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)

353-353: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
In .claude/commands/config-base-sync-update.md around line 353, the final fenced
code block lacks a language identifier; update the opening fence to include a
language (e.g., ```text) so the block becomes ```text ... ``` to satisfy
Markdown compliance and syntax highlighting, ensuring the opening fence exactly
matches the proposed fix and leaving the closing fence as ```; no other content
changes required.

✅ DevContainer update complete!

Version: v{old-version} → v{target-version}
Branch: update-config-base-{target-version}
PR: {PR-URL or "Manual creation required"}

Next steps:
1. Review the pull request
2. Test the DevContainer locally
3. Merge when ready
📦 Image Version
- ghcr.io/keito4/config-base:{old-version} → v{target-version}

🔧 Features Summary
- Added: {count} features
- Updated: {count} features
- Recommended for removal: {count} features (duplicates)
- Preserved: {count} custom features

📁 Configuration
- Claude Code mounts: ✅ Configured
- setup-claude.sh: ✅ Included in postCreateCommand
- Standard mounts: ✅ Updated

🌿 Git Branch
- Branch: update-config-base-{target-version}
- PR: {PR-URL or "Manual creation required"}

📋 Next Steps
1. Review the pull request (check features changes)
2. Test the DevContainer locally:
- Rebuild container: Cmd/Ctrl + Shift + P → "Dev Containers: Rebuild Container"
- Verify Claude Code works: `claude --version`
- Check all tools are available
3. {if duplicate features exist}
Consider removing duplicate features before merging
{endif}
4. Merge when all checks pass

💡 Tips
- Run `claude help` to verify Claude Code is working
- Check logs if container build fails
- Review `.devcontainer/devcontainer.json` for any conflicts
```

---
Expand Down
Loading