feat: /setup-new-repo に Codespaces 対応をデフォルトで追加 - #480
Conversation
- devcontainer.json テンプレートに codespaces カスタマイゼーション、secrets、postCreateCommand を常に含める - Step 11 の Codespaces シークレット紐付けを Optional から Default に変更 - --no-codespaces オプションを追加(スキップ用) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
📝 WalkthroughWalkthroughAdded Codespaces support to the repository setup documentation: introduced a Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
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. Comment |
🔍 AI Code Review (Local Hook)Models: Codex (default) / Gemini (default) 🤖 Codex Review指摘事項(重要順)
結論: patch is incorrect
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: edc2330c81
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @@ -261,16 +316,14 @@ CONFIG_REPO/script/codespaces-secrets.sh repos add {owner}/{repo-name} | |||
| CONFIG_REPO/script/codespaces-secrets.sh sync | |||
There was a problem hiding this comment.
Run Codespaces sync only after remote repo exists
Step 11 now executes codespaces-secrets.sh repos add {owner}/{repo-name} and sync by default even though this workflow only initializes a local git repo in Step 4 and doesn’t prompt gh repo create until Step 12. In that common new-repo path, repos add can’t register a non-existent remote and cmd_sync in script/codespaces-secrets.sh fatals when no repos are configured, so /setup-new-repo can fail unless users manually opt out with --no-codespaces.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
.claude/commands/setup-new-repo.md (1)
360-362:⚠️ Potential issue | 🟠 MajorInconsistency: Codespaces setup is now default but listed as optional manual step.
Step 11 now runs by default (unless
--no-codespacesis specified), but lines 360-362 still list "Add to Codespaces secrets (if using GitHub Codespaces)" as a manual next step with manual commands. This contradicts the change that makes Codespaces support default.Since Codespaces secrets are now automatically configured in Step 11, this section should either:
- Be removed entirely (secrets already configured)
- Changed to "Verify Codespaces secrets setup" pointing to Step 11.3's verification command
- Only be shown in the output if
--no-codespaceswas used✏️ Proposed fix: Remove or update the manual step
Option 1 - Remove the manual step:
5. gh repo create (optional) 6. git push -u origin main -7. Add to Codespaces secrets (if using GitHub Codespaces): - - Run: ./script/codespaces-secrets.sh repos add {owner}/{repo-name} - - Run: ./script/codespaces-secrets.sh syncOption 2 - Change to verification (if Codespaces was configured):
-7. Add to Codespaces secrets (if using GitHub Codespaces): - - Run: ./script/codespaces-secrets.sh repos add {owner}/{repo-name} - - Run: ./script/codespaces-secrets.sh sync +7. Codespaces secrets configured ✅ + - Verify: ./script/codespaces-secrets.sh listOr add conditional logic to show this only if
--no-codespaceswas used.
🧹 Nitpick comments (2)
.claude/commands/setup-new-repo.md (2)
69-110: Invalid JSON syntax: Comments are not supported in standard JSON.The template includes inline comments at lines 75, 86, and 108 using
//, which are not valid in standard JSON. If users copy this template directly, JSON parsers will fail.DevContainer JSON files (
.devcontainer/devcontainer.json) do support JSONC (JSON with Comments), so the comments will work in practice. However, the documentation should clarify this or use a different notation to avoid confusion.📝 Proposed fix: Add clarification note
Add a note after line 69:
```json +<!-- Note: devcontainer.json supports JSON with Comments (JSONC), so inline comments are allowed --> {Or remove the inline comments and provide guidance separately:
"features": { - // プロジェクトに必要な追加 features をここに記載 },
114-121: Consider providing complete.vscode/configuration templates.Step 5.1 provides a complete
devcontainer.jsontemplate, but Step 5.2 only shows the directory creation command without the actual file contents. For consistency and completeness, consider either:
- Providing full templates for
extensions.jsonandsettings.json(preferred for consistency with 5.1)- Removing the bash snippet and just describing what should be included
This would help implementers understand exactly what needs to be created.
コードレビュー結果このPRでは 🟢 良い点1. Codespaces対応のデフォルト化
2. ドキュメントの明確化
3. テンプレート設計の改善
🟡 懸念点・改善提案1. JSONコメントの問題(重要).devcontainer/devcontainer.json:74,86,107 "features": {
// プロジェクトに必要な追加 features をここに記載
},"ms-vscode.vscode-typescript-next"
// プロジェクトに応じた拡張機能を追加}
// プロジェクト固有のシークレットを追加問題: 標準JSONはコメントをサポートしていません。このテンプレートから生成されたファイルは構文エラーになります。 推奨対応:
2. Step 11の実装詳細が不明確Step 11.2-11.3 (.claude/commands/setup-new-repo.md:310-324) コマンドの実行タイミングと失敗時の動作が不明確です: CONFIG_REPO/script/codespaces-secrets.sh repos add {owner}/{repo-name}
CONFIG_REPO/script/codespaces-secrets.sh sync懸念:
推奨対応:
3. Step 12の手順に矛盾Step 12 Summary (.claude/commands/setup-new-repo.md:360-362) 問題: Step 11でデフォルトで実行されるはずなのに、Step 12のNext Stepsに手動実行手順が含まれています。 推奨対応:
4. セキュリティ考慮事項devcontainer.json:103-108 "secrets": {
"ANTHROPIC_API_KEY": {
"description": "Anthropic API key for Claude Code"
}
}懸念:
推奨対応:
5. テストプランの未完了PR Description ## Test plan
- [ ] `/setup-new-repo /tmp/test-repo` で新規リポジトリをセットアップ...
- [ ] `--no-codespaces` オプションでシークレット紐付けがスキップされること...
- [ ] 既存プロジェクトへのセットアップで既存ファイルが壊れないこと...懸念: すべてのテストプランが未チェックのままPRが作成されています。 推奨対応 (CLAUDE.mdに従って):
🔵 その他の提案1. Step 5.1のテンプレート生成ロジック現状では大きなJSONブロックがドキュメントに記載されていますが、実装時に:
ことで保守性が向上します。 2. バージョン管理
📊 CLAUDE.md準拠チェック
✅ 推奨アクション優先度: High
優先度: Medium
優先度: Low
総評Codespaces対応のデフォルト化は開発体験向上に貢献する良い変更です。ただし、JSONコメントの構文エラーは実際の使用時に問題を引き起こすため、マージ前の修正が必須です。 その他の懸念点も対応することで、より堅牢で保守性の高いセットアップコマンドになります。 Generated by Claude Opus 4.6 via claude-review workflow |
setup-new-repo コマンドの Step 5 を変更: - ローカル用: .devcontainer/devcontainer.json(軽量構成) - Codespaces 用: .devcontainer/codespaces/devcontainer.json(sshd, secrets, codespaces カスタマイゼーション) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Fix all issues with AI agents
In @.claude/commands/setup-new-repo.md:
- Around line 30-31: The `--no-codespaces` flag description is inconsistent
across the doc: decide whether it skips both Codespaces devcontainer and secret
binding or only secret binding, then make all references consistent; update the
`--no-codespaces` bullet (current line ~30), the Step 5 description, the PR
objectives section, and all other occurrences (around lines noted) so the
wording uniformly states the chosen behavior, and ensure examples/usage and any
mentions of Codespaces settings/secrets use the exact same phrasing; search for
`--no-codespaces` and reconcile the docs to a single authoritative sentence
describing what the flag does.
- Line 79: The template currently always injects the DevContainer setting
postCreateCommand: "npm install" which contradicts the documented --no-install
flag; update the template and docs so the postCreateCommand is either omitted or
conditional based on the user's choice (e.g., only add postCreateCommand when
install is requested), and apply the same change to the other occurrences of
postCreateCommand in this file (the other template blocks that add
"postCreateCommand": "npm install"); also update the explanatory text to state
that the command will only be present when installation is enabled.
- Around line 69-100: The JSON examples include JavaScript-style comments (e.g.,
in the "features" and "extensions" arrays) which will break parsing when saved
as .devcontainer/devcontainer.json; either remove all `//` comment lines and
inline notes so the block becomes valid JSON (keep keys like
"postCreateCommand", "customizations", "remoteEnv", "features", "extensions"
unchanged) OR change the documentation to present the snippet as JSONC and
instruct users to save it as .jsonc (or remove comments before saving as .json)
so that consumers won’t get parse errors.
| - `--no-codespaces`: Codespacesシークレット紐付けをスキップ | ||
| - `--license TYPE`: ライセンス種別(デフォルト: MIT) |
There was a problem hiding this comment.
--no-codespaces meaning is inconsistent.
Line 30 says it only skips secret binding, Step 5 says both devcontainers are always created, and the PR objectives say Codespaces settings/secrets are skipped. Please align the flag behavior and docs (either skip Codespaces devcontainer + secrets, or only skip secrets).
✅ Suggested wording fix (if skipping Codespaces devcontainer + secrets)
-- `--no-codespaces`: Codespacesシークレット紐付けをスキップ
+- `--no-codespaces`: Codespaces用 devcontainer 生成とシークレット紐付けをスキップ
@@
-DevContainer設定をプロジェクトに合わせて新規作成する。ローカル用と Codespaces 用の2つを作成する。
+DevContainer設定をプロジェクトに合わせて新規作成する。`--no-codespaces` 以外ではローカル用と Codespaces 用の2つを作成する。Also applies to: 61-67, 103-138, 324-328, 395-401
🤖 Prompt for AI Agents
In @.claude/commands/setup-new-repo.md around lines 30 - 31, The
`--no-codespaces` flag description is inconsistent across the doc: decide
whether it skips both Codespaces devcontainer and secret binding or only secret
binding, then make all references consistent; update the `--no-codespaces`
bullet (current line ~30), the Step 5 description, the PR objectives section,
and all other occurrences (around lines noted) so the wording uniformly states
the chosen behavior, and ensure examples/usage and any mentions of Codespaces
settings/secrets use the exact same phrasing; search for `--no-codespaces` and
reconcile the docs to a single authoritative sentence describing what the flag
does.
| ```json | ||
| { | ||
| "name": "{project-name}", | ||
| "image": "ghcr.io/keito4/config-base:latest", | ||
| "features": { | ||
| // プロジェクトに必要な追加 features をここに記載 | ||
| }, | ||
| "remoteEnv": { | ||
| "TMPDIR": "/home/vscode/.claude/tmp" | ||
| }, | ||
| "postCreateCommand": "npm install", | ||
| "customizations": { | ||
| "vscode": { | ||
| "extensions": [ | ||
| "esbenp.prettier-vscode", | ||
| "dbaeumer.vscode-eslint", | ||
| "ms-vscode.vscode-typescript-next" | ||
| // プロジェクトに応じた拡張機能を追加 | ||
| ], | ||
| "settings": { | ||
| "editor.formatOnSave": true, | ||
| "editor.codeActionsOnSave": { | ||
| "source.fixAll.eslint": "explicit" | ||
| }, | ||
| "editor.defaultFormatter": "esbenp.prettier-vscode", | ||
| "files.eol": "\n", | ||
| "files.trimTrailingWhitespace": true, | ||
| "files.insertFinalNewline": true | ||
| } | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
JSON samples are invalid due to // comments.
If these snippets are copied verbatim into .devcontainer/devcontainer.json, they will fail to parse. Either remove comments or mark the blocks as JSONC and instruct users to save as .jsonc.
✅ Option A: remove comments in JSON blocks
- "features": {
- // プロジェクトに必要な追加 features をここに記載
- },
+ "features": {},
@@
- "extensions": [
- "esbenp.prettier-vscode",
- "dbaeumer.vscode-eslint",
- "ms-vscode.vscode-typescript-next"
- // プロジェクトに応じた拡張機能を追加
- ],
+ "extensions": [
+ "esbenp.prettier-vscode",
+ "dbaeumer.vscode-eslint",
+ "ms-vscode.vscode-eslint",
+ "ms-vscode.vscode-typescript-next"
+ ],
@@
- "features": {
- "ghcr.io/devcontainers/features/sshd:1": {},
- "ghcr.io/devcontainers/features/github-cli:1": {}
- // プロジェクトに必要な追加 features をここに記載
- },
+ "features": {
+ "ghcr.io/devcontainers/features/sshd:1": {},
+ "ghcr.io/devcontainers/features/github-cli:1": {}
+ },
@@
- "vscode": {
- // ローカル用と同じ extensions / settings
- },
+ "vscode": {},
@@
- "ANTHROPIC_API_KEY": {
- "description": "Anthropic API key for Claude Code"
- }
- // プロジェクト固有のシークレットを追加
+ "ANTHROPIC_API_KEY": {
+ "description": "Anthropic API key for Claude Code"
+ }
}Also applies to: 107-135
🤖 Prompt for AI Agents
In @.claude/commands/setup-new-repo.md around lines 69 - 100, The JSON examples
include JavaScript-style comments (e.g., in the "features" and "extensions"
arrays) which will break parsing when saved as .devcontainer/devcontainer.json;
either remove all `//` comment lines and inline notes so the block becomes valid
JSON (keep keys like "postCreateCommand", "customizations", "remoteEnv",
"features", "extensions" unchanged) OR change the documentation to present the
snippet as JSONC and instruct users to save it as .jsonc (or remove comments
before saving as .json) so that consumers won’t get parse errors.
| "remoteEnv": { | ||
| "TMPDIR": "/home/vscode/.claude/tmp" | ||
| }, | ||
| "postCreateCommand": "npm install", |
There was a problem hiding this comment.
--no-install is contradicted by postCreateCommand: "npm install".
Docs say --no-install skips installation, but the generated DevContainer will still run npm install. Clarify or conditionalize the template.
✅ Suggested doc fix: make postCreateCommand conditional
- "postCreateCommand": "npm install",
+ "postCreateCommand": "{if not --no-install}npm install{else}echo \"skip npm install\"{end}",Also applies to: 119-119, 316-322
🤖 Prompt for AI Agents
In @.claude/commands/setup-new-repo.md at line 79, The template currently always
injects the DevContainer setting postCreateCommand: "npm install" which
contradicts the documented --no-install flag; update the template and docs so
the postCreateCommand is either omitted or conditional based on the user's
choice (e.g., only add postCreateCommand when install is requested), and apply
the same change to the other occurrences of postCreateCommand in this file (the
other template blocks that add "postCreateCommand": "npm install"); also update
the explanatory text to state that the command will only be present when
installation is enabled.
PR Review - feat: /setup-new-repo に Codespaces 対応をデフォルトで追加📋 レビュー概要この PR は ✅ 優れている点
|
|
🎉 This PR is included in version 1.75.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Summary
/setup-new-repoコマンドで Codespaces 対応がデフォルトでセットアップされるように変更codespacesカスタマイゼーション、secrets、postCreateCommandを常に含めるChanges Made
devcontainer.jsonテンプレートに Codespaces 固有設定を追加(codespaces.openFiles、secrets、postCreateCommand)--no-codespacesオプションを新規追加(スキップ用)Test plan
/setup-new-repo /tmp/test-repoで新規リポジトリをセットアップし、.devcontainer/devcontainer.jsonに Codespaces 設定が含まれることを確認--no-codespacesオプションでシークレット紐付けがスキップされることを確認🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Documentation